'index.php','name' => get_lang('PlatformAdmin')); $interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList')); // Database Table Definitions $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); $tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS); $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); $tbl_user = Database::get_main_table(TABLE_MAIN_USER); $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY); $table_access_url_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $sql = 'SELECT name, nbr_courses, nbr_users, nbr_classes, DATE_FORMAT(date_start,"%d-%m-%Y") as date_start, DATE_FORMAT(date_end,"%d-%m-%Y") as date_end, lastname, firstname, username, session_admin_id, nb_days_access_before_beginning, nb_days_access_after_end, session_category_id, visibility FROM '.$tbl_session.' LEFT JOIN '.$tbl_user.' ON id_coach = user_id WHERE '.$tbl_session.'.id='.$sessionId; $rs = Database::query($sql); $session = Database::store_result($rs); $session = $session[0]; $sql = 'SELECT name FROM '.$tbl_session_category.' WHERE id = "'.intval($session['session_category_id']).'"'; $rs = Database::query($sql); $session_category = ''; if (Database::num_rows($rs)>0) { $rows_session_category = Database::store_result($rs); $rows_session_category = $rows_session_category[0]; $session_category = $rows_session_category['name']; } $action = isset($_GET['action']) ? $_GET['action'] : null; $url_id = api_get_current_access_url_id(); switch ($action) { case 'move_up': SessionManager::moveUp($sessionId, $_GET['course_code']); header('Location: resume_session.php?id_session='.$sessionId); exit; break; case 'move_down': SessionManager::moveDown($sessionId, $_GET['course_code']); header('Location: resume_session.php?id_session='.$sessionId); exit; break; case 'add_user_to_url': $user_id = $_REQUEST['user_id']; $result = UrlManager::add_user_to_url($user_id, $url_id); $user_info = api_get_user_info($user_id); if ($result) { $message = Display::return_message( get_lang('UserAdded').' '.api_get_person_name($user_info['firstname'], $user_info['lastname']), 'confirm' ); } break; case 'delete': // Delete course from session. $idChecked = isset($_GET['idChecked']) ? $_GET['idChecked'] : null; if (is_array($idChecked)) { $usersToDelete = array(); foreach ($idChecked as $courseCode) { // forcing the escape_string $courseInfo = api_get_course_info($courseCode); SessionManager::unsubscribe_course_from_session( $sessionId, $courseInfo['real_id'] ); } } if (!empty($_GET['class'])) { Database::query("DELETE FROM $tbl_session_rel_class WHERE session_id='$sessionId' AND class_id=".intval($_GET['class'])); $nbr_affected_rows=Database::affected_rows(); Database::query("UPDATE $tbl_session SET nbr_classes=nbr_classes-$nbr_affected_rows WHERE id='$sessionId'"); } if (!empty($_GET['user'])) { SessionManager::unsubscribe_user_from_session( $sessionId, $_GET['user'] ); } break; } Display::display_header($tool_name); if (!empty($_GET['warn'])) { Display::display_warning_message(urldecode($_GET['warn'])); } if (!empty($message)) { echo $message; } echo Display::page_header( Display::return_icon('session.png', get_lang('Session')).' '.$session['name'] ); $url = Display::url( Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "session_edit.php?page=resume_session.php&id=$sessionId" ); echo Display::page_subheader(get_lang('GeneralProperties').$url); ?>
: | |
: | |
: | |
: | |
: | '; echo 'URL'; echo ' | '; echo '';
$url_list = UrlManager::get_access_url_from_session($sessionId);
foreach ($url_list as $url_data) {
echo $url_data['url'].' '; } echo ' | ';
}
if (SessionManager::durationPerUserIsEnabled()) {
$sessionInfo = api_get_session_info($sessionId);
echo '
'; echo get_lang('Duration'); echo ' | '; echo ''; echo $sessionInfo['duration'].' '; echo get_lang('Days'); echo ' |
'.get_lang('NoCoursesForThisSession').' | '; } else { // select the courses $orderBy = "ORDER BY title"; if (SessionManager::orderCourseIsEnabled()) { $orderBy = "ORDER BY position"; } $sql = "SELECT code,title,visual_code, nbr_users FROM $tbl_course, $tbl_session_rel_course WHERE course_code = code AND id_session='$sessionId' $orderBy"; $result = Database::query($sql); $courses = Database::store_result($result); $count = 0; foreach ($courses as $course) { //select the number of users $sql = "SELECT count(*) FROM $tbl_session_rel_user sru, $tbl_session_rel_course_rel_user srcru WHERE srcru.id_user = sru.id_user AND srcru.id_session = sru.id_session AND srcru.course_code = '".Database::escape_string($course['code'])."' AND sru.relation_type <> ".SESSION_RELATION_TYPE_RRHH." AND srcru.id_session = '".intval($sessionId)."'"; $rs = Database::query($sql); $course['nbr_users'] = Database::result($rs, 0, 0); // Get coachs of the courses in session $sql = "SELECT user.lastname,user.firstname,user.username FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user WHERE session_rcru.id_user = user.user_id AND session_rcru.id_session = '".intval($sessionId)."' AND session_rcru.course_code ='".Database::escape_string($course['code'])."' AND session_rcru.status=2"; $rs = Database::query($sql); $coachs = array(); if (Database::num_rows($rs) > 0) { while($info_coach = Database::fetch_array($rs)) { $coachs[] = api_get_person_name($info_coach['firstname'], $info_coach['lastname']).' ('.$info_coach['username'].')'; } } else { $coach = get_lang('None'); } if (count($coachs) > 0) { $coach = implode('|||
'.Display::url($course['title'].' ('.$course['visual_code'].')', api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$sessionId),' | '.$coach.' | '.$course['nbr_users'].' | '.Display::return_icon('course_home.gif', get_lang('Course')).' '.$orderButtons.' '.Display::return_icon('user.png', get_lang('Edit'), '', ICON_SIZE_SMALL).' '.Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'), null, ICON_SIZE_SMALL).' '.Display::return_icon('statistics.gif', get_lang('Tracking')).' '.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).' '.Display::return_icon('delete.png', get_lang('Delete')).' |