|
|
|
@ -3865,8 +3865,12 @@ class SessionManager |
|
|
|
|
* @param int $urlId |
|
|
|
|
* @return array|int A list with an user list. If $getCount is true then return a the count of registers |
|
|
|
|
*/ |
|
|
|
|
public static function get_users_by_session($id, $status = null, $getCount = false, $urlId = 0) |
|
|
|
|
{ |
|
|
|
|
public static function get_users_by_session( |
|
|
|
|
$id, |
|
|
|
|
$status = null, |
|
|
|
|
$getCount = false, |
|
|
|
|
$urlId = 0 |
|
|
|
|
) { |
|
|
|
|
if (empty($id)) { |
|
|
|
|
return array(); |
|
|
|
|
} |
|
|
|
@ -3969,7 +3973,12 @@ class SessionManager |
|
|
|
|
public static function get_sessions_by_coach($user_id) |
|
|
|
|
{ |
|
|
|
|
$session_table = Database::get_main_table(TABLE_MAIN_SESSION); |
|
|
|
|
return Database::select('*', $session_table, array('where' => array('id_coach = ?' => $user_id))); |
|
|
|
|
|
|
|
|
|
return Database::select( |
|
|
|
|
'*', |
|
|
|
|
$session_table, |
|
|
|
|
array('where' => array('id_coach = ?' => $user_id)) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -3980,10 +3989,10 @@ class SessionManager |
|
|
|
|
*/ |
|
|
|
|
public static function get_user_status_in_course_session($user_id, $courseId, $session_id) |
|
|
|
|
{ |
|
|
|
|
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
|
|
|
$table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
|
|
|
$tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
|
|
|
$sql = "SELECT session_rcru.status |
|
|
|
|
FROM $tbl_session_rel_course_rel_user session_rcru |
|
|
|
|
FROM $table session_rcru |
|
|
|
|
INNER JOIN $tbl_user user |
|
|
|
|
ON (session_rcru.user_id = user.user_id) |
|
|
|
|
WHERE |
|
|
|
@ -4028,8 +4037,13 @@ class SessionManager |
|
|
|
|
*/ |
|
|
|
|
public static function get_all_sessions_by_promotion($id) |
|
|
|
|
{ |
|
|
|
|
$t = Database::get_main_table(TABLE_MAIN_SESSION); |
|
|
|
|
return Database::select('*', $t, array('where' => array('promotion_id = ?' => $id))); |
|
|
|
|
$table = Database::get_main_table(TABLE_MAIN_SESSION); |
|
|
|
|
|
|
|
|
|
return Database::select( |
|
|
|
|
'*', |
|
|
|
|
$table, |
|
|
|
|
array('where' => array('promotion_id = ?' => $id)) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -4038,16 +4052,20 @@ class SessionManager |
|
|
|
|
*/ |
|
|
|
|
public static function subscribe_sessions_to_promotion($promotion_id, $list) |
|
|
|
|
{ |
|
|
|
|
$t = Database::get_main_table(TABLE_MAIN_SESSION); |
|
|
|
|
$table = Database::get_main_table(TABLE_MAIN_SESSION); |
|
|
|
|
$params = array(); |
|
|
|
|
$params['promotion_id'] = 0; |
|
|
|
|
Database::update($t, $params, array('promotion_id = ?' => $promotion_id)); |
|
|
|
|
Database::update( |
|
|
|
|
$table, |
|
|
|
|
$params, |
|
|
|
|
array('promotion_id = ?' => $promotion_id) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$params['promotion_id'] = $promotion_id; |
|
|
|
|
if (!empty($list)) { |
|
|
|
|
foreach ($list as $session_id) { |
|
|
|
|
$session_id = intval($session_id); |
|
|
|
|
Database::update($t, $params, array('id = ?' => $session_id)); |
|
|
|
|
Database::update($table, $params, ['id = ?' => $session_id]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -4272,9 +4290,7 @@ class SessionManager |
|
|
|
|
*/ |
|
|
|
|
public static function protectSession($id, $checkSession = true) |
|
|
|
|
{ |
|
|
|
|
// api_protect_admin_script(true); |
|
|
|
|
if (self::allowToManageSessions()) { |
|
|
|
|
|
|
|
|
|
if (api_is_platform_admin() && self::allowed($id)) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -4424,8 +4440,11 @@ class SessionManager |
|
|
|
|
* |
|
|
|
|
* @return array |
|
|
|
|
*/ |
|
|
|
|
public static function get_sessions_by_user($user_id, $ignoreVisibilityForAdmins = false, $ignoreTimeLimit = false) |
|
|
|
|
{ |
|
|
|
|
public static function get_sessions_by_user( |
|
|
|
|
$user_id, |
|
|
|
|
$ignoreVisibilityForAdmins = false, |
|
|
|
|
$ignoreTimeLimit = false |
|
|
|
|
) { |
|
|
|
|
$sessionCategories = UserManager::get_sessions_by_category( |
|
|
|
|
$user_id, |
|
|
|
|
false, |
|
|
|
@ -4464,6 +4483,8 @@ class SessionManager |
|
|
|
|
* @param bool $deleteUsersNotInList |
|
|
|
|
* @param bool $updateCourseCoaches |
|
|
|
|
* @param bool $sessionWithCoursesModifier |
|
|
|
|
* @param bool $addOriginalCourseTeachersAsCourseSessionCoaches |
|
|
|
|
* @param bool $removeAllTeachersFromCourse |
|
|
|
|
* @param int $showDescription |
|
|
|
|
* @param array $teacherBackupList |
|
|
|
|
* @param array $groupBackup |
|
|
|
@ -4944,11 +4965,9 @@ class SessionManager |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$course_counter++; |
|
|
|
|
|
|
|
|
|
$course_coaches = isset($courseArray[1]) ? $courseArray[1] : null; |
|
|
|
|
$course_users = isset($courseArray[2]) ? $courseArray[2] : null; |
|
|
|
|
|
|
|
|
|
$course_users = explode(',', $course_users); |
|
|
|
|
$course_users = isset($courseArray[2]) ? $courseArray[2] : null; |
|
|
|
|
$course_users = explode(',', $course_users); |
|
|
|
|
$course_coaches = explode(',', $course_coaches); |
|
|
|
|
|
|
|
|
|
// Checking if the flag is set TeachersWillBeAddedAsCoachInAllCourseSessions (course_edit.php) |
|
|
|
@ -5740,10 +5759,25 @@ class SessionManager |
|
|
|
|
foreach ($sessionsDestination as $sessionDestinationId) { |
|
|
|
|
$sessionDestinationInfo = self::fetch($sessionDestinationId); |
|
|
|
|
$messages[] = Display::return_message( |
|
|
|
|
sprintf(get_lang('AddingStudentsFromSessionXToSessionY'), $sessionInfo['name'], $sessionDestinationInfo['name']), 'info', false |
|
|
|
|
sprintf( |
|
|
|
|
get_lang( |
|
|
|
|
'AddingStudentsFromSessionXToSessionY' |
|
|
|
|
), |
|
|
|
|
$sessionInfo['name'], |
|
|
|
|
$sessionDestinationInfo['name'] |
|
|
|
|
), |
|
|
|
|
'info', |
|
|
|
|
false |
|
|
|
|
); |
|
|
|
|
if ($sessionId == $sessionDestinationId) { |
|
|
|
|
$messages[] = Display::return_message(sprintf(get_lang('SessionXSkipped'), $sessionDestinationId), 'warning', false); |
|
|
|
|
$messages[] = Display::return_message( |
|
|
|
|
sprintf( |
|
|
|
|
get_lang('SessionXSkipped'), |
|
|
|
|
$sessionDestinationId |
|
|
|
|
), |
|
|
|
|
'warning', |
|
|
|
|
false |
|
|
|
|
); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
$messages[] = Display::return_message(get_lang('StudentList').'<br />'.$userToString, 'info', false); |
|
|
|
@ -5934,9 +5968,12 @@ class SessionManager |
|
|
|
|
$courseUser = Database::get_main_table(TABLE_MAIN_COURSE_USER); |
|
|
|
|
|
|
|
|
|
// Select the teachers. |
|
|
|
|
$sql = "SELECT DISTINCT(cu.user_id) FROM $course c |
|
|
|
|
INNER JOIN $sessionCourse src ON c.id = src.c_id |
|
|
|
|
INNER JOIN $courseUser cu ON (cu.c_id = c.id) |
|
|
|
|
$sql = "SELECT DISTINCT(cu.user_id) |
|
|
|
|
FROM $course c |
|
|
|
|
INNER JOIN $sessionCourse src |
|
|
|
|
ON c.id = src.c_id |
|
|
|
|
INNER JOIN $courseUser cu |
|
|
|
|
ON (cu.c_id = c.id) |
|
|
|
|
WHERE src.session_id IN ('$sessionToString') AND cu.status = 1"; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
while ($row = Database::fetch_array($result, 'ASSOC')) { |
|
|
|
@ -6096,7 +6133,6 @@ class SessionManager |
|
|
|
|
*/ |
|
|
|
|
public static function removeCourseDescription($sessionId, $courseId) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -6105,8 +6141,11 @@ class SessionManager |
|
|
|
|
* @param bool $removeOldRelationShips |
|
|
|
|
* @return string |
|
|
|
|
*/ |
|
|
|
|
public static function subscribeDrhToSessionList($userSessionList, $sendEmail, $removeOldRelationShips) |
|
|
|
|
{ |
|
|
|
|
public static function subscribeDrhToSessionList( |
|
|
|
|
$userSessionList, |
|
|
|
|
$sendEmail, |
|
|
|
|
$removeOldRelationShips |
|
|
|
|
) { |
|
|
|
|
if (!empty($userSessionList)) { |
|
|
|
|
foreach ($userSessionList as $userId => $data) { |
|
|
|
|
$sessionList = array(); |
|
|
|
|