index.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use ChamiloSession as Session;
  4. /**
  5. * Session view
  6. * @package chamilo.session
  7. * @author Julio Montoya <gugli100@gmail.com> Beeznest
  8. */
  9. $cidReset = true;
  10. require_once __DIR__.'/../inc/global.inc.php';
  11. if (empty($_GET['session_id'])) {
  12. api_not_allowed(true);
  13. }
  14. $session_id = isset($_GET['session_id']) ? intval($_GET['session_id']) : null;
  15. $sessionField = new ExtraFieldValue('session');
  16. $valueAllowVisitors = $sessionField->get_values_by_handler_and_field_variable(
  17. $session_id,
  18. 'allow_visitors'
  19. );
  20. $allowVisitors = $valueAllowVisitors != false;
  21. if (!$allowVisitors) {
  22. // Only users who are logged in can proceed.
  23. api_block_anonymous_users();
  24. }
  25. $this_section = SECTION_COURSES;
  26. $htmlHeadXtra[] = api_get_jqgrid_js();
  27. $course_id = isset($_GET['course_id']) ? intval($_GET['course_id']) : null;
  28. Session::write('id_session', $session_id);
  29. // Clear the exercise session just in case
  30. Session::erase('objExercise');
  31. $userId = api_get_user_id();
  32. $session_info = SessionManager::fetch($session_id);
  33. $session_list = SessionManager::get_sessions_by_coach(api_get_user_id());
  34. $course_list = SessionManager::get_course_list_by_session_id($session_id);
  35. $userIsGeneralCoach = SessionManager::user_is_general_coach($userId, $session_id);
  36. $user_course_list = array();
  37. foreach ($course_list as $course) {
  38. $status = SessionManager::get_user_status_in_course_session(
  39. $userId,
  40. $course['real_id'],
  41. $session_id
  42. );
  43. if ($status !== false || api_is_platform_admin() || $userIsGeneralCoach) {
  44. $user_course_list[] = $course['real_id'];
  45. }
  46. }
  47. if (empty($user_course_list)) {
  48. api_not_allowed(true);
  49. }
  50. $my_session_list = array();
  51. $final_array = array();
  52. $new_course_list = array();
  53. if (!empty($course_list)) {
  54. foreach ($course_list as $course_data) {
  55. if (api_is_platform_admin()) {
  56. $course_data['title'] = Display::url(
  57. $course_data['title'],
  58. api_get_course_url($course_data['code'], $session_id)
  59. );
  60. } else {
  61. if (in_array($course_data['real_id'], $user_course_list) || api_is_anonymous()) {
  62. $course_data['title'] = Display::url(
  63. $course_data['title'],
  64. api_get_course_url($course_data['code'], $session_id)
  65. );
  66. } else {
  67. continue;
  68. }
  69. }
  70. $list = new LearnpathList(
  71. api_get_user_id(),
  72. $course_data['code'],
  73. $session_id,
  74. 'lp.publicatedOn ASC',
  75. true,
  76. null,
  77. true
  78. );
  79. $lp_list = $list->get_flat_list();
  80. $lp_count = 0;
  81. if (!empty($lp_list)) {
  82. foreach ($lp_list as $valLp) {
  83. if ($valLp['lp_visibility']) {
  84. $lp_count++;
  85. }
  86. }
  87. }
  88. $course_info = api_get_course_info($course_data['code']);
  89. $exercise_count = count(
  90. ExerciseLib::get_all_exercises(
  91. $course_info,
  92. $session_id,
  93. true,
  94. null,
  95. false,
  96. 1
  97. )
  98. );
  99. $max_mutation_date = '';
  100. $last_date = Tracking::get_last_connection_date_on_the_course(
  101. api_get_user_id(),
  102. $course_info,
  103. $session_id,
  104. false
  105. );
  106. $icons = '';
  107. foreach ($lp_list as $item) {
  108. if (empty($item['modified_on'])) {
  109. $lp_date_original = $item['created_on'];
  110. $image = 'new.gif';
  111. $label = get_lang('LearnpathAdded');
  112. } else {
  113. $lp_date_original = $item['modified_on'];
  114. $image = 'moderator_star.png';
  115. $label = get_lang('LearnpathUpdated');
  116. }
  117. $mutation_date = api_strtotime($item['publicated_on']) > api_strtotime($lp_date_original) ? $item['publicated_on'] : $lp_date_original;
  118. if (api_strtotime($mutation_date) > api_strtotime($max_mutation_date)) {
  119. $max_mutation_date = $mutation_date;
  120. }
  121. if (strtotime($last_date) < strtotime($lp_date_original)) {
  122. if (empty($icons)) {
  123. $icons .= ' '.Display::return_icon(
  124. $image,
  125. get_lang('TitleNotification').': '.$label.' - '.$lp_date_original
  126. ).' ';
  127. }
  128. }
  129. }
  130. $new_course_list[] = array(
  131. 'title' => $course_data['title'].$icons,
  132. // 'recent_lps' => $icons,
  133. //'max_mutation_date' => substr(api_get_local_time($max_mutation_date),0,10),
  134. 'exercise_count' => $exercise_count,
  135. 'lp_count' => $lp_count
  136. );
  137. }
  138. }
  139. //If session is not active we stop de script
  140. if (api_is_coach_of_course_in_session($session_id) == false) {
  141. //If session is not active we stop de script
  142. if (!api_is_allowed_to_session_edit()) {
  143. api_not_allowed(true);
  144. }
  145. }
  146. $entityManager = Database::getManager();
  147. $session = $entityManager->find('ChamiloCoreBundle:Session', $session_id);
  148. $sessionTitleLink = api_get_configuration_value('courses_list_session_title_link');
  149. if ($sessionTitleLink == 2 && $session->getNbrCourses() === 1) {
  150. $sessionCourses = $session->getCourses();
  151. $sessionCourse = $sessionCourses[0]->getCourse();
  152. $courseUrl = $sessionCourse->getDirectory().'/index.php?';
  153. $courseUrl .= http_build_query([
  154. 'id_session' => $session->getId()
  155. ]);
  156. header('Location: '.api_get_path(WEB_COURSE_PATH).$courseUrl);
  157. exit;
  158. }
  159. Display::display_header(get_lang('Session'));
  160. $session_select = array();
  161. foreach ($session_list as $item) {
  162. $session_select[$item['id']] = $item['name'];
  163. }
  164. // Session list form
  165. if (count($session_select) > 1) {
  166. $form = new FormValidator(
  167. 'exercise_admin',
  168. 'get',
  169. api_get_self().'?session_id='.$session_id
  170. );
  171. $form->addElement(
  172. 'select',
  173. 'session_id',
  174. get_lang('SessionList'),
  175. $session_select,
  176. 'onchange="javascript:change_session()"'
  177. );
  178. $defaults['session_id'] = $session_id;
  179. $form->setDefaults($defaults);
  180. $form->display();
  181. }
  182. if (empty($session_id)) {
  183. $user_list = UserManager::get_user_list();
  184. } else {
  185. $user_list = SessionManager::get_users_by_session($session_id);
  186. }
  187. //Final data to be show
  188. $my_real_array = $new_exercises = array();
  189. $now = time();
  190. $courseList = SessionManager::get_course_list_by_session_id($session_id);
  191. if (!empty($courseList)) {
  192. foreach ($courseList as $courseInfo) {
  193. $courseCode = $courseInfo['code'];
  194. $courseId = $courseInfo['real_id'];
  195. $isSubscribed = CourseManager::is_user_subscribed_in_course(
  196. api_get_user_id(),
  197. $courseCode,
  198. true,
  199. $session_id
  200. );
  201. $exerciseList = ExerciseLib::get_all_exercises_for_course_id(
  202. $courseInfo,
  203. $session_id,
  204. $courseId,
  205. true
  206. );
  207. if (!empty($exerciseList)) {
  208. // Exercises
  209. foreach ($exerciseList as $exerciseInfo) {
  210. $exerciseId = $exerciseInfo['id'];
  211. if ($exerciseInfo['start_time'] == '0000-00-00 00:00:00') {
  212. $start_date = '-';
  213. } else {
  214. $start_date = $exerciseInfo['start_time'];
  215. }
  216. $best_score_data = ExerciseLib::get_best_attempt_in_course(
  217. $exerciseInfo['id'],
  218. $courseInfo['real_id'],
  219. $session_id
  220. );
  221. $best_score = '';
  222. if (!empty($best_score_data)) {
  223. $best_score = ExerciseLib::show_score(
  224. $best_score_data['exe_result'],
  225. $best_score_data['exe_weighting']
  226. );
  227. }
  228. $exerciseResultInfo = Event::getExerciseResultsByUser(
  229. $userId,
  230. $exerciseId,
  231. $courseId,
  232. $session_id
  233. );
  234. if (empty($exerciseResultInfo)) {
  235. // We check the date validation of the exercise if the user can make it
  236. if ($exerciseInfo['start_time'] != '0000-00-00 00:00:00') {
  237. $allowed_time = api_strtotime($exerciseInfo['start_time'], 'UTC');
  238. if ($now < $allowed_time) {
  239. continue;
  240. }
  241. }
  242. $name = Display::url(
  243. $exerciseInfo['title'],
  244. api_get_path(WEB_CODE_PATH)."exercise/overview.php?cidReq=$courseCode&exerciseId={$exerciseId}&id_session=$session_id",
  245. array('target' => SESSION_LINK_TARGET)
  246. );
  247. $new_exercises[] = array(
  248. 'status' => Display::return_icon(
  249. 'star.png',
  250. get_lang('New'),
  251. array('width' => ICON_SIZE_SMALL)
  252. ),
  253. 'date' => $exerciseInfo['start_time'],
  254. 'course' => $courseInfo['title'],
  255. 'exercise' => $name,
  256. 'attempt' => '-',
  257. 'result' => '-',
  258. 'best_result' => '-',
  259. 'position' => '-'
  260. );
  261. continue;
  262. }
  263. // Exercise results
  264. $counter = 1;
  265. foreach ($exerciseResultInfo as $result) {
  266. $platform_score = ExerciseLib::show_score(
  267. $result['exe_result'],
  268. $result['exe_weighting']
  269. );
  270. $my_score = 0;
  271. if (!empty($result['exe_weighting']) &&
  272. intval($result['exe_weighting']) != 0
  273. ) {
  274. $my_score = $result['exe_result'] / $result['exe_weighting'];
  275. }
  276. $position = ExerciseLib::get_exercise_result_ranking(
  277. $my_score,
  278. $result['exe_id'],
  279. $exerciseId,
  280. $courseCode,
  281. $session_id,
  282. $user_list
  283. );
  284. $name = Display::url(
  285. $exerciseInfo['title'],
  286. api_get_path(WEB_CODE_PATH)."exercise/result.php?cidReq=$courseCode&id={$result['exe_id']}&id_session=$session_id&show_headers=1",
  287. array('target' => SESSION_LINK_TARGET, 'class'=>'exercise-result-link')
  288. );
  289. $my_real_array[] = array(
  290. 'status' => Display::return_icon(
  291. 'quiz.png',
  292. get_lang('Attempted'),
  293. '',
  294. ICON_SIZE_SMALL
  295. ),
  296. 'date' => $start_date,
  297. 'course' => $courseInfo['title'],
  298. 'exercise' => $name,
  299. 'attempt' => $counter,
  300. 'result' => $platform_score,
  301. 'best_result' => $best_score,
  302. 'position' => $position,
  303. );
  304. $counter++;
  305. }
  306. }
  307. }
  308. }
  309. }
  310. $my_real_array = msort($my_real_array, 'date', 'asc');
  311. if (!empty($new_exercises)) {
  312. $my_real_array = array_merge($new_exercises, $my_real_array);
  313. }
  314. $start = $end = $start_only = $end_only = '';
  315. if (!empty($session_info['access_start_date'])) {
  316. $start = api_convert_and_format_date($session_info['access_start_date'], DATE_FORMAT_SHORT);
  317. $start_only = get_lang('From').' '.$session_info['access_start_date'];
  318. }
  319. if (!empty($session_info['access_start_date'])) {
  320. $end = api_convert_and_format_date($session_info['access_end_date'], DATE_FORMAT_SHORT);
  321. $end_only = get_lang('Until').' '.$session_info['access_end_date'];
  322. }
  323. if (!empty($start) && !empty($end)) {
  324. $dates = Display::tag('i', sprintf(get_lang('FromDateXToDateY'), $start, $end));
  325. } else {
  326. $dates = Display::tag('i', $start_only.' '.$end_only);
  327. }
  328. $editLink = '';
  329. if (api_is_platform_admin()) {
  330. $editLink = '&nbsp;'.Display::url(
  331. Display::return_icon('edit.png', get_lang('Edit')),
  332. api_get_path(WEB_CODE_PATH).'session/session_edit.php?page=resume_session.php&id='.$session_id
  333. );
  334. }
  335. echo Display::tag('h1', $session_info['name'].$editLink);
  336. echo $dates.'<br />';
  337. $allow = api_get_setting('show_session_description') === 'true';
  338. if ($session_info['show_description'] == 1 && $allow) {
  339. ?>
  340. <div class="home-course-intro">
  341. <div class="page-course">
  342. <div class="page-course-intro">
  343. <p><?php echo $session_info['description']; ?></p>
  344. </div>
  345. </div>
  346. </div>
  347. <?php
  348. }
  349. // All Learnpaths grid settings (First tab, first subtab)
  350. $columns_courses = array(
  351. get_lang('Title'),
  352. get_lang('NumberOfPublishedExercises'),
  353. get_lang('NumberOfPublishedLps'),
  354. );
  355. $column_model_courses = array(
  356. array('name'=>'title', 'index'=>'title', 'width'=>'400px', 'align'=>'left', 'sortable'=>'true'),
  357. //array('name'=>'recent_lps', 'index'=>'recent_lps', 'width'=>'10px', 'align'=>'left', 'sortable'=>'false'),
  358. // array('name'=>'max_mutation_date', 'index'=>'max_mutation_date', 'width'=>'120px', 'align'=>'left', 'sortable'=>'true'),
  359. array('name'=>'exercise_count', 'index'=>'exercise_count', 'width'=>'180px', 'align'=>'left', 'sortable'=>'true'),
  360. array('name'=>'lp_count', 'index'=>'lp_count', 'width'=>'180px', 'align'=>'left', 'sortable'=>'true')
  361. );
  362. $extra_params_courses['height'] = '100%';
  363. $extra_params_courses['autowidth'] = 'true'; //use the width of the parent
  364. $url = api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=session_courses_lp_default&session_id='.$session_id.'&course_id='.$course_id;
  365. $columns = array(
  366. get_lang('PublicationDate'),
  367. get_lang('Course'),
  368. get_lang('LearningPaths')
  369. );
  370. $column_model = array(
  371. array('name'=>'date', 'index'=>'date', 'width'=>'120', 'align'=>'left', 'sortable'=>'true'),
  372. array('name'=>'course', 'index'=>'course', 'width'=>'300', 'align'=>'left', 'sortable'=>'true', 'wrap_cell' => 'true'),
  373. array('name'=>'lp', 'index'=>'lp', 'width'=>'440', 'align'=>'left', 'sortable'=>'true')
  374. );
  375. $extra_params = array();
  376. $extra_params['sortname'] = 'date';
  377. $extra_params['height'] = '100%';
  378. $extra_params['autowidth'] = 'true'; //use the width of the parent
  379. //Per course grid settings
  380. $url_by_course = api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=session_courses_lp_by_course&session_id='.$session_id.'&course_id='.$course_id;
  381. $extra_params_course = array();
  382. $extra_params_course['grouping'] = 'true';
  383. $extra_params_course['groupingView'] = array(
  384. 'groupCollapse' => false,
  385. 'groupField' => array('course'),
  386. 'groupColumnShow' => array('false'),
  387. 'groupText' => array('<b>'.get_lang('Course').' {0}</b>')
  388. );
  389. $extra_params_course['autowidth'] = 'true'; //use the width of the parent
  390. $extra_params_course['height'] = "100%";
  391. //Per Week grid
  392. $url_week = api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=session_courses_lp_by_week&session_id='.$session_id.'&course_id='.$course_id;
  393. $column_week = array(
  394. get_lang('PeriodWeek'),
  395. get_lang('PublicationDate'),
  396. get_lang('Course'),
  397. get_lang('LearningPaths')
  398. );
  399. $column_week_model = array(
  400. array('name'=>'week', 'index'=>'week', 'width'=>'40', 'align'=>'left', 'sortable'=>'false'),
  401. array('name'=>'date', 'index'=>'date', 'width'=>'120', 'align'=>'left', 'sortable'=>'false'),
  402. array('name'=>'course', 'index'=>'course', 'width'=>'300', 'align'=>'left', 'sortable'=>'true', 'wrap_cell' => 'true'),
  403. array('name'=>'lp', 'index'=>'lp', 'width'=>'440', 'align'=>'left', 'sortable'=>'true')
  404. );
  405. $extra_params_week = array();
  406. $extra_params_week['grouping'] = 'true';
  407. //For more details see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:grouping
  408. $extra_params_week['groupingView'] = array(
  409. 'groupCollapse' => false,
  410. 'groupDataSorted' => false,
  411. 'groupField' => array('week'),
  412. 'groupOrder' => array('desc'),
  413. 'groupColumnShow' => 'false',
  414. 'groupText' => array('<b>'.get_lang('PeriodWeek').' {0}</b>')
  415. );
  416. $extra_params_week['autowidth'] = 'true'; //use the width of the parent
  417. $extra_params_week['height'] = '100%';
  418. // MyQCM grid
  419. if (!api_is_anonymous()) {
  420. $column_exercise = array(
  421. get_lang('Status'),
  422. get_lang('ExerciseStartDate'),
  423. get_lang('Course'),
  424. get_lang('Exercise'),
  425. get_lang('Attempts'),
  426. get_lang('Result'),
  427. get_lang('BestResultInCourse'),
  428. get_lang('Ranking')
  429. );
  430. $column_exercise_model = array(
  431. array('name'=>'status', 'index'=>'status', 'width'=>'40', 'align'=>'left', 'sortable'=>'false'),
  432. array('name'=>'date', 'index'=>'date', 'width'=>'130', 'align'=>'left', 'sortable'=>'true'),
  433. array('name'=>'course', 'index'=>'course', 'width'=>'200', 'align'=>'left', 'sortable'=>'true', 'wrap_cell' => 'true'),
  434. array('name'=>'exercise', 'index'=>'exercise', 'width'=>'200', 'align'=>'left', 'sortable'=>'false'),
  435. array('name'=>'attempt', 'index'=>'attempt', 'width'=>'60', 'align'=>'center', 'sortable'=>'true'),
  436. array('name'=>'result', 'index'=>'result', 'width'=>'120', 'align'=>'center', 'sortable'=>'true'),
  437. array('name'=>'best_result', 'index'=>'best_result', 'width'=>'140', 'align'=>'center', 'sortable'=>'true'),
  438. array('name'=>'position', 'index'=>'position', 'width'=>'55', 'align'=>'center', 'sortable'=>'true')
  439. );
  440. $extra_params_exercise['height'] = '100%';
  441. $extra_params_exercise['autowidth'] = 'true';
  442. //$extra_params_exercise['sortname'] = 'status';
  443. //$extra_params_exercise['sortorder'] = 'desc';
  444. //$extra_params_exercise['grouping'] = 'true';
  445. //$extra_params_exercise['groupingView'] = array('groupField'=>array('course'),'groupColumnShow'=>'false','groupText' => array('<b>'.get_lang('Course').' {0}</b>'));
  446. //$extra_params_exercise['groupingView'] = array('groupField'=>array('course'),'groupColumnShow'=>'false','groupText' => array('<b>'.get_lang('Course').' {0} - {1} Item(s)</b>'));
  447. }
  448. ?>
  449. <br />
  450. <script>
  451. function change_session() {
  452. document.exercise_admin.submit();
  453. }
  454. $(function() {
  455. //js used when generating images on the fly see function Tracking::show_course_detail()
  456. //$(".dialog").dialog("destroy");
  457. $(".dialog").dialog({
  458. autoOpen: false,
  459. show: "blind",
  460. resizable: false,
  461. height:300,
  462. width:550,
  463. modal: true
  464. });
  465. $(".opener").click(function() {
  466. var my_id = $(this).attr('id');
  467. var big_image = '#main_graph_' + my_id;
  468. $( big_image ).dialog("open");
  469. return false;
  470. });
  471. // Redirect to tab
  472. var url = document.location.toString();
  473. if (url.match('#')) {
  474. var tabLink = url.split('#')[1];
  475. $('.nav-tabs a[href="#' + tabLink + '"]').tab('show');
  476. // Redirect to course part
  477. var secondLink = url.split('#')[2];
  478. if (secondLink) {
  479. var aTag = $("a[href='#" + secondLink + "']");
  480. $('html,body').animate({scrollTop: aTag.offset().top}, 'slow');
  481. }
  482. }
  483. <?php
  484. //Displays js code to use a jqgrid
  485. echo Display::grid_js(
  486. 'courses',
  487. '',
  488. $columns_courses,
  489. $column_model_courses,
  490. $extra_params_courses,
  491. $new_course_list
  492. );
  493. echo Display::grid_js(
  494. 'list_default',
  495. $url,
  496. $columns,
  497. $column_model,
  498. $extra_params,
  499. array(),
  500. ''
  501. );
  502. echo Display::grid_js(
  503. 'list_course',
  504. $url_by_course,
  505. $columns,
  506. $column_model,
  507. $extra_params_course,
  508. array(),
  509. ''
  510. );
  511. echo Display::grid_js(
  512. 'list_week',
  513. $url_week,
  514. $column_week,
  515. $column_week_model,
  516. $extra_params_week,
  517. array(),
  518. ''
  519. );
  520. if (!api_is_anonymous()) {
  521. echo Display::grid_js(
  522. 'exercises',
  523. '',
  524. $column_exercise,
  525. $column_exercise_model,
  526. $extra_params_exercise,
  527. $my_real_array
  528. );
  529. }
  530. ?>
  531. });
  532. </script>
  533. <?php
  534. $courseCode = isset($_GET['course']) ? $_GET['course'] : null;
  535. $reportingTab = '';
  536. if (!api_is_anonymous()) {
  537. $reportingTab = Tracking::show_user_progress(
  538. api_get_user_id(),
  539. $session_id,
  540. '#tabs-5',
  541. false,
  542. false
  543. );
  544. if (!empty($reportingTab)) {
  545. $reportingTab .= '<br />';
  546. $reportingTab .= Tracking::show_course_detail(
  547. api_get_user_id(),
  548. $courseCode,
  549. $session_id
  550. );
  551. }
  552. if (empty($reportingTab)) {
  553. $reportingTab = Display::return_message(get_lang('NoDataAvailable'), 'warning');
  554. }
  555. }
  556. // Main headers
  557. $headers = array(
  558. Display::return_icon('moderator_star.png'),
  559. get_lang('Courses'),
  560. get_lang('LearningPaths')
  561. );
  562. if (!api_is_anonymous()) {
  563. $headers[] = get_lang('MyQCM');
  564. $headers[] = get_lang('MyStatistics');
  565. }
  566. $coursesTab = Display::grid_html('courses');
  567. $starTab = Display::grid_html('list_default');
  568. $tabs = array(
  569. $starTab,
  570. $coursesTab,
  571. Display::grid_html('list_course'),
  572. Display::grid_html('exercises'),
  573. $reportingTab
  574. );
  575. $tabToHide = api_get_configuration_value('session_hide_tab_list');
  576. if (!empty($tabToHide)) {
  577. foreach ($tabToHide as $columnId) {
  578. unset($headers[$columnId]);
  579. unset($tabs[$columnId]);
  580. }
  581. }
  582. // Main headers data
  583. echo Display::tabs(
  584. $headers,
  585. $tabs
  586. );
  587. // Deleting the objects
  588. Session::erase('_gid');
  589. Session::erase('oLP');
  590. Session::erase('lpobject');
  591. api_remove_in_gradebook();
  592. Display::display_footer();