'session_list.php', 'name' => get_lang('SessionList'), ]; $orig_param = '&origin=resume_session'; // 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); $em = Database::getManager(); $sessionInfo = api_get_session_info($sessionId); /** @var SessionRepository $sessionRepository */ $sessionRepository = $em->getRepository('ChamiloCoreBundle:Session'); /** @var Session $session */ $session = $sessionRepository->find($sessionId); $sessionCategory = $session->getCategory(); $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_id']); header('Location: resume_session.php?id_session='.$sessionId); exit; break; case 'move_down': SessionManager::moveDown($sessionId, $_GET['course_id']); 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) { Display::addFlash( 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 = []; 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'])) { $class = (int) $_GET['class']; $result = Database::query( "DELETE FROM $tbl_session_rel_class WHERE session_id = $sessionId AND class_id = $class" ); $nbr_affected_rows = Database::affected_rows($result); 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'] ); } Display::addFlash(Display::return_message(get_lang('Updated'))); break; } $sessionHeader = Display::page_header( Display::return_icon('session.png', get_lang('Session')).' '.$session->getName(), null, 'h3' ); $url = Display::url( Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL), "session_edit.php?page=resume_session.php&id=$sessionId" ); $sessionTitle = Display::page_subheader(get_lang('GeneralProperties').$url); $generalCoach = api_get_user_info($sessionInfo['id_coach']); $sessionField = new ExtraField('session'); $extraFieldData = $sessionField->getDataAndFormattedValues($sessionId); $multiple_url_is_on = api_get_multiple_access_url(); $urlList = []; if ($multiple_url_is_on) { $urlList = UrlManager::get_access_url_from_session($sessionId); } $url = Display::url( Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL), "add_courses_to_session.php?page=resume_session.php&id_session=$sessionId" ); $courseListToShow = Display::page_subheader(get_lang('CourseList').$url); $courseListToShow .= '
'.get_lang('CourseTitle').' | '.get_lang('CourseCoach').' | '.get_lang('UsersNumber').' | '.get_lang('Actions').' |
---|---|---|---|
'.get_lang('NoCoursesForThisSession').' | |||
' .Display::url( $course->getTitle().' ('.$course->getVisualCode().')', $courseUrl ) .' | '; $courseItem .= ''.($namesOfCoaches ? implode(' ', $namesOfCoaches) : get_lang('None')).' | ';
$courseItem .= ''.$numberOfUsers.' | '; $courseItem .= ''; $courseItem .= Display::url(Display::return_icon('course_home.gif', get_lang('Course')), $courseUrl); if ($allowSkills) { $courseItem .= Display::url( Display::return_icon('skills.png', get_lang('Skills')), $codePath.'admin/skill_rel_course.php?session_id='.$sessionId.'&course_id='.$course->getId() ); } $courseItem .= $orderButtons; $courseItem .= Display::url( Display::return_icon('new_user.png', get_lang('AddUsers')), $codePath."session/add_users_to_session_course.php?id_session=$sessionId&course_id=".$course->getId() ); $courseItem .= Display::url( Display::return_icon('user.png', get_lang('Users')), $codePath."session/session_course_user_list.php?id_session=$sessionId&course_code=".$course->getCode() ); $courseItem .= Display::url( Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse')), $codePath."user/user_import.php?action=import&cidReq={$course->getCode()}&id_session=$sessionId" ); $courseItem .= Display::url( Display::return_icon('export_csv.png', get_lang('ExportUsersOfACourse')), $codePath."user/user_export.php?file_type=csv&course_session={$course->getCode()}:$sessionId&addcsvheader=1" ); $courseItem .= Display::url( Display::return_icon('statistics.gif', get_lang('Tracking')), $codePath."tracking/courseLog.php?id_session=$sessionId&cidReq={$course->getCode()}$orig_param&hide_course_breadcrumb=1" ); $courseItem .= Display::url( Display::return_icon('teacher.png', get_lang('ModifyCoach')), $codePath."session/session_course_edit.php?id_session=$sessionId&page=resume_session.php&course_code={$course->getCode()}$orig_param" ); $courseItem .= Display::url( Display::return_icon('folder_document.png', get_lang('UploadFile')), '#', [ 'class' => 'session-upload-file-btn', 'data-session' => $sessionId, 'data-course' => $course->getId(), ] ); $courseItem .= Display::url( Display::return_icon('delete.png', get_lang('Delete')), api_get_self()."?id_session=$sessionId&action=delete&idChecked[]={$course->getCode()}", [ 'onclick' => "javascript:if(!confirm('".get_lang('ConfirmYourChoice')."')) return false;", ] ); $courseItem .= ' |