LEFT JOIN $tableUser c ON b.platform_user_id=c.user_id
WHERE a.specialty_id = $specialtyId";
$res = Database::query($sql);
while ($row = Database::fetch_assoc($res)) {
@ -440,7 +469,9 @@ function tutorsList($specialtyId)
function getListSpecialtyTutorial($specialtyId)
{
global $tableSepeParticipantsSpecialtyTutorials;
$sql = "SELECT * FROM $tableSepeParticipantsSpecialtyTutorials WHERE participant_specialty_id = $specialtyId";
$specialtyId = (int) $specialtyId;
$sql = "SELECT * FROM $tableSepeParticipantsSpecialtyTutorials
WHERE participant_specialty_id = $specialtyId";
$res = Database::query($sql);
$aux = [];
while ($row = Database::fetch_assoc($res)) {
@ -457,9 +488,10 @@ function listCourseAction()
{
global $tableSepeActions;
global $tableSepeCourseActions;
$sql = "SELECT $tableSepeCourseActions.*, course.title AS title, $tableSepeActions.action_origin AS action_origin, $tableSepeActions.action_code AS action_code
FROM $tableSepeCourseActions, course, $tableSepeActions
WHERE $tableSepeCourseActions.course_id=course.id
$sql = "SELECT $tableSepeCourseActions.*, course.title AS title, $tableSepeActions.action_origin AS action_origin, $tableSepeActions.action_code AS action_code
FROM $tableSepeCourseActions, course, $tableSepeActions
WHERE $tableSepeCourseActions.course_id=course.id
AND $tableSepeActions.id=$tableSepeCourseActions.action_id";
$res = Database::query($sql);
$aux = [];
@ -474,9 +506,10 @@ function listCourseFree()
{
global $tableCourse;
global $tableSepeCourseActions;
$sql = "SELECT id, title FROM $tableCourse
WHERE NOT EXISTS (
SELECT * FROM $tableSepeCourseActions WHERE $tableCourse.id = $tableSepeCourseActions.course_id)
$sql = "SELECT id, title FROM $tableCourse
WHERE NOT EXISTS (
SELECT * FROM $tableSepeCourseActions
WHERE $tableCourse.id = $tableSepeCourseActions.course_id)
;";
$res = Database::query($sql);
while ($row = Database::fetch_assoc($res)) {
@ -490,9 +523,9 @@ function listActionFree()
{
global $tableSepeActions;
global $tableSepeCourseActions;
$sql = "SELECT id, action_origin, action_code FROM $tableSepeActions
WHERE NOT EXISTS (
SELECT * FROM $tableSepeCourseActions WHERE $tableSepeActions.id = $tableSepeCourseActions.action_id)
$sql = "SELECT id, action_origin, action_code FROM $tableSepeActions
WHERE NOT EXISTS (
SELECT * FROM $tableSepeCourseActions WHERE $tableSepeActions.id = $tableSepeCourseActions.action_id)
;";
$res = Database::query($sql);
$aux = [];
@ -508,8 +541,11 @@ function listActionFree()
function getSpecialtyTutorId($specialtyId, $tutorId)
{
global $tableSepeSpecialtyTutors;
$sql = "SELECT id
FROM $tableSepeSpecialtyTutors
$specialtyId = (int) $specialtyId;
$tutorId = (int) $tutorId;
$sql = "SELECT id
FROM $tableSepeSpecialtyTutors
WHERE specialty_id = $specialtyId AND tutor_id = $tutorId";
$res = Database::query($sql);
$row = Database::fetch_assoc($res);
@ -520,6 +556,8 @@ function getSpecialtyTutorId($specialtyId, $tutorId)
function checkInsertNewLog($platformUserId, $actionId)
{
global $tableSepeLogParticipant;
$platformUserId = (int) $platformUserId;
$actionId = (int) $actionId;
$sql = "SELECT * FROM $tableSepeLogParticipant WHERE platform_user_id = $platformUserId AND action_id = $actionId";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
@ -532,6 +570,8 @@ function checkInsertNewLog($platformUserId, $actionId)
function getUserPlatformFromParticipant($participantId)
{
global $tableSepeParticipants;
$participantId = (int) $participantId;
$sql = "SELECT * FROM $tableSepeParticipants WHERE id = $participantId";