index.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  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();
  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('exercise_admin', 'get', api_get_self().'?session_id='.$session_id);
  167. $form->addElement(
  168. 'select',
  169. 'session_id',
  170. get_lang('SessionList'),
  171. $session_select,
  172. 'onchange="javascript:change_session()"'
  173. );
  174. $defaults['session_id'] = $session_id;
  175. $form->setDefaults($defaults);
  176. $form->display();
  177. }
  178. if (empty($session_id)) {
  179. $user_list = UserManager::get_user_list();
  180. } else {
  181. $user_list = SessionManager::get_users_by_session($session_id);
  182. }
  183. //Final data to be show
  184. $my_real_array = $new_exercises = array();
  185. $now = time();
  186. $courseList = SessionManager::get_course_list_by_session_id($session_id);
  187. if (!empty($courseList)) {
  188. foreach ($courseList as $courseInfo) {
  189. $courseCode = $courseInfo['code'];
  190. $courseId = $courseInfo['real_id'];
  191. $isSubscribed = CourseManager::is_user_subscribed_in_course(
  192. api_get_user_id(),
  193. $courseCode,
  194. true,
  195. $session_id
  196. );
  197. $exerciseList = ExerciseLib::get_all_exercises_for_course_id(
  198. $courseInfo,
  199. $session_id,
  200. $courseId,
  201. true
  202. );
  203. if (!empty($exerciseList)) {
  204. // Exercises
  205. foreach ($exerciseList as $exerciseInfo) {
  206. $exerciseId = $exerciseInfo['id'];
  207. if ($exerciseInfo['start_time'] == '0000-00-00 00:00:00') {
  208. $start_date = '-';
  209. } else {
  210. $start_date = $exerciseInfo['start_time'];
  211. }
  212. $best_score_data = ExerciseLib::get_best_attempt_in_course(
  213. $exerciseInfo['id'],
  214. $courseInfo['real_id'],
  215. $session_id
  216. );
  217. $best_score = '';
  218. if (!empty($best_score_data)) {
  219. $best_score = ExerciseLib::show_score(
  220. $best_score_data['exe_result'],
  221. $best_score_data['exe_weighting']
  222. );
  223. }
  224. $exerciseResultInfo = Event::getExerciseResultsByUser(
  225. $userId,
  226. $exerciseId,
  227. $courseId,
  228. $session_id
  229. );
  230. if (empty($exerciseResultInfo)) {
  231. // We check the date validation of the exercise if the user can make it
  232. if ($exerciseInfo['start_time'] != '0000-00-00 00:00:00') {
  233. $allowed_time = api_strtotime($exerciseInfo['start_time'], 'UTC');
  234. if ($now < $allowed_time) {
  235. continue;
  236. }
  237. }
  238. $name = Display::url(
  239. $exerciseInfo['title'],
  240. api_get_path(WEB_CODE_PATH)."exercise/overview.php?cidReq=$courseCode&exerciseId={$exerciseId}&id_session=$session_id",
  241. array('target' => SESSION_LINK_TARGET)
  242. );
  243. $new_exercises[] = array(
  244. 'status' => Display::return_icon(
  245. 'star.png',
  246. get_lang('New'),
  247. array('width' => ICON_SIZE_SMALL)
  248. ),
  249. 'date' => $exerciseInfo['start_time'],
  250. 'course' => $courseInfo['title'],
  251. 'exercise' => $name,
  252. 'attempt' => '-',
  253. 'result' => '-',
  254. 'best_result' => '-',
  255. 'position' => '-'
  256. );
  257. continue;
  258. }
  259. // Exercise results
  260. $counter = 1;
  261. foreach ($exerciseResultInfo as $result) {
  262. $platform_score = ExerciseLib::show_score(
  263. $result['exe_result'],
  264. $result['exe_weighting']
  265. );
  266. $my_score = 0;
  267. if (!empty($result['exe_weighting']) &&
  268. intval($result['exe_weighting']) != 0
  269. ) {
  270. $my_score = $result['exe_result'] / $result['exe_weighting'];
  271. }
  272. $position = ExerciseLib::get_exercise_result_ranking(
  273. $my_score,
  274. $result['exe_id'],
  275. $exerciseId,
  276. $courseCode,
  277. $session_id,
  278. $user_list
  279. );
  280. $name = Display::url(
  281. $exerciseInfo['title'],
  282. api_get_path(WEB_CODE_PATH)."exercise/result.php?cidReq=$courseCode&id={$result['exe_id']}&id_session=$session_id&show_headers=1",
  283. array('target' => SESSION_LINK_TARGET, 'class'=>'exercise-result-link')
  284. );
  285. $my_real_array[] = array(
  286. 'status' => Display::return_icon(
  287. 'quiz.png',
  288. get_lang('Attempted'),
  289. '',
  290. ICON_SIZE_SMALL
  291. ),
  292. 'date' => $start_date,
  293. 'course' => $courseInfo['title'],
  294. 'exercise' => $name,
  295. 'attempt' => $counter,
  296. 'result' => $platform_score,
  297. 'best_result' => $best_score,
  298. 'position' => $position,
  299. );
  300. $counter++;
  301. }
  302. }
  303. }
  304. }
  305. }
  306. $my_real_array = msort($my_real_array, 'date', 'asc');
  307. if (!empty($new_exercises)) {
  308. $my_real_array = array_merge($new_exercises, $my_real_array);
  309. }
  310. $start = $end = $start_only = $end_only = '';
  311. if (!empty($session_info['access_start_date'])) {
  312. $start = api_convert_and_format_date($session_info['access_start_date'], DATE_FORMAT_SHORT);
  313. $start_only = get_lang('From').' '.$session_info['access_start_date'];
  314. }
  315. if (!empty($session_info['access_start_date'])) {
  316. $end = api_convert_and_format_date($session_info['access_end_date'], DATE_FORMAT_SHORT);
  317. $end_only = get_lang('Until').' '.$session_info['access_end_date'];
  318. }
  319. if (!empty($start) && !empty($end)) {
  320. $dates = Display::tag('i', sprintf(get_lang('FromDateXToDateY'), $start, $end));
  321. } else {
  322. $dates = Display::tag('i', $start_only.' '.$end_only);
  323. }
  324. echo Display::tag('h1', $session_info['name']);
  325. echo $dates.'<br />';
  326. if ($session_info['show_description'] == 1) {
  327. ?>
  328. <div class="home-course-intro">
  329. <div class="page-course">
  330. <div class="page-course-intro">
  331. <p><?php echo $session_info['description']; ?></p>
  332. </div>
  333. </div>
  334. </div>
  335. <?php
  336. }
  337. // All Learnpaths grid settings (First tab, first subtab)
  338. $columns_courses = array(
  339. get_lang('Title'),
  340. get_lang('NumberOfPublishedExercises'),
  341. get_lang('NumberOfPublishedLps'),
  342. );
  343. $column_model_courses = array(
  344. array('name'=>'title', 'index'=>'title', 'width'=>'400px', 'align'=>'left', 'sortable'=>'true'),
  345. //array('name'=>'recent_lps', 'index'=>'recent_lps', 'width'=>'10px', 'align'=>'left', 'sortable'=>'false'),
  346. // array('name'=>'max_mutation_date', 'index'=>'max_mutation_date', 'width'=>'120px', 'align'=>'left', 'sortable'=>'true'),
  347. array('name'=>'exercise_count', 'index'=>'exercise_count', 'width'=>'180px', 'align'=>'left', 'sortable'=>'true'),
  348. array('name'=>'lp_count', 'index'=>'lp_count', 'width'=>'180px', 'align'=>'left', 'sortable'=>'true')
  349. );
  350. $extra_params_courses['height'] = '100%';
  351. $extra_params_courses['autowidth'] = 'true'; //use the width of the parent
  352. //$extra_params_courses['gridview'] = "false";
  353. /*$extra_params_courses['rowNum'] = 9000;
  354. $extra_params_courses['height'] = "100%";
  355. $extra_params_courses['autowidth'] = 'false'; //use the width of the parent
  356. $extra_params_courses['recordtext'] = '';
  357. $extra_params_courses['pgtext'] = '';
  358. $extra_params_courses['pgbuttons'] = false;*/
  359. //$extra_params_courses['width'] = '50%';
  360. //$extra_params_courses['autowidth'] = 'true';
  361. $url = api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=session_courses_lp_default&session_id='.$session_id.'&course_id='.$course_id;
  362. $columns = array(
  363. get_lang('PublicationDate'),
  364. get_lang('Course'),
  365. get_lang('LearningPaths')
  366. );
  367. $column_model = array(
  368. array('name'=>'date', 'index'=>'date', 'width'=>'120', 'align'=>'left', 'sortable'=>'true'),
  369. array('name'=>'course', 'index'=>'course', 'width'=>'300', 'align'=>'left', 'sortable'=>'true', 'wrap_cell' => 'true'),
  370. array('name'=>'lp', 'index'=>'lp', 'width'=>'440', 'align'=>'left', 'sortable'=>'true')
  371. );
  372. $extra_params = array();
  373. $extra_params['sortname'] = 'date';
  374. /*
  375. $extra_params['sortorder'] = 'asc';
  376. $extra_params['pgbuttons'] = false;
  377. $extra_params['recordtext'] = '';
  378. $extra_params['pgtext'] = '';
  379. $extra_params['height'] = "100%";
  380. */
  381. //$extra_params['autowidth'] = 'true'; //use the width of the parent
  382. //$extra_params['width'] = '90%';
  383. //$extra_params['autowidth'] = 'true'; //use the width of the parent
  384. //$extra_params['forceFit'] = 'true'; //use the width of the parent
  385. //$extra_params['altRows'] = 'true'; //zebra style
  386. $extra_params['height'] = '100%';
  387. $extra_params['autowidth'] = 'true'; //use the width of the parent
  388. //Per course grid settings
  389. $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;
  390. $extra_params_course = array();
  391. $extra_params_course['grouping'] = 'true';
  392. $extra_params_course['groupingView'] = array(
  393. 'groupCollapse' => false,
  394. 'groupField' => array('course'),
  395. 'groupColumnShow' => array('false'),
  396. 'groupText' => array('<b>'.get_lang('Course').' {0}</b>')
  397. );
  398. $extra_params_course['autowidth'] = 'true'; //use the width of the parent
  399. $extra_params_course['height'] = "100%";
  400. //Per Week grid
  401. $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;
  402. $column_week = array(
  403. get_lang('PeriodWeek'),
  404. get_lang('PublicationDate'),
  405. get_lang('Course'),
  406. get_lang('LearningPaths')
  407. );
  408. $column_week_model = array(
  409. array('name'=>'week', 'index'=>'week', 'width'=>'40', 'align'=>'left', 'sortable'=>'false'),
  410. array('name'=>'date', 'index'=>'date', 'width'=>'120', 'align'=>'left', 'sortable'=>'false'),
  411. array('name'=>'course', 'index'=>'course', 'width'=>'300', 'align'=>'left', 'sortable'=>'true', 'wrap_cell' => 'true'),
  412. array('name'=>'lp', 'index'=>'lp', 'width'=>'440', 'align'=>'left', 'sortable'=>'true')
  413. );
  414. $extra_params_week = array();
  415. $extra_params_week['grouping'] = 'true';
  416. //For more details see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:grouping
  417. $extra_params_week['groupingView'] = array(
  418. 'groupCollapse' => false,
  419. 'groupDataSorted' => false,
  420. 'groupField' => array('week'),
  421. 'groupOrder' => array('desc'),
  422. 'groupColumnShow' => 'false',
  423. 'groupText' => array('<b>'.get_lang('PeriodWeek').' {0}</b>')
  424. );
  425. $extra_params_week['autowidth'] = 'true'; //use the width of the parent
  426. $extra_params_week['height'] = '100%';
  427. // MyQCM grid
  428. if (!api_is_anonymous()) {
  429. $column_exercise = array(
  430. get_lang('Status'),
  431. get_lang('ExerciseStartDate'),
  432. get_lang('Course'),
  433. get_lang('Exercise'),
  434. get_lang('Attempts'),
  435. get_lang('Result'),
  436. get_lang('BestResultInCourse'),
  437. get_lang('Ranking')
  438. );
  439. $column_exercise_model = array(
  440. array('name'=>'status', 'index'=>'status', 'width'=>'40', 'align'=>'left', 'sortable'=>'false'),
  441. array('name'=>'date', 'index'=>'date', 'width'=>'130', 'align'=>'left', 'sortable'=>'true'),
  442. array('name'=>'course', 'index'=>'course', 'width'=>'200', 'align'=>'left', 'sortable'=>'true', 'wrap_cell' => 'true'),
  443. array('name'=>'exercise', 'index'=>'exercise', 'width'=>'200', 'align'=>'left', 'sortable'=>'false'),
  444. array('name'=>'attempt', 'index'=>'attempt', 'width'=>'60', 'align'=>'center', 'sortable'=>'true'),
  445. array('name'=>'result', 'index'=>'result', 'width'=>'120', 'align'=>'center', 'sortable'=>'true'),
  446. array('name'=>'best_result', 'index'=>'best_result', 'width'=>'140', 'align'=>'center', 'sortable'=>'true'),
  447. array('name'=>'position', 'index'=>'position', 'width'=>'55', 'align'=>'center', 'sortable'=>'true')
  448. );
  449. $extra_params_exercise['height'] = '100%';
  450. $extra_params_exercise['autowidth'] = 'true';
  451. //$extra_params_exercise['sortname'] = 'status';
  452. //$extra_params_exercise['sortorder'] = 'desc';
  453. //$extra_params_exercise['grouping'] = 'true';
  454. //$extra_params_exercise['groupingView'] = array('groupField'=>array('course'),'groupColumnShow'=>'false','groupText' => array('<b>'.get_lang('Course').' {0}</b>'));
  455. //$extra_params_exercise['groupingView'] = array('groupField'=>array('course'),'groupColumnShow'=>'false','groupText' => array('<b>'.get_lang('Course').' {0} - {1} Item(s)</b>'));
  456. }
  457. ?>
  458. <br />
  459. <script>
  460. function change_session() {
  461. document.exercise_admin.submit();
  462. }
  463. $(function() {
  464. //js used when generating images on the fly see function Tracking::show_course_detail()
  465. $(".dialog").dialog("destroy");
  466. $(".dialog").dialog({
  467. autoOpen: false,
  468. show: "blind",
  469. resizable: false,
  470. height:300,
  471. width:550,
  472. modal: true
  473. });
  474. $(".opener").click(function() {
  475. var my_id = $(this).attr('id');
  476. var big_image = '#main_graph_' + my_id;
  477. $( big_image ).dialog("open");
  478. return false;
  479. });
  480. /* Binds a tab id in the url */
  481. $("#tabs").bind('tabsselect', function(event, ui) {
  482. window.location.href=ui.tab;
  483. });
  484. <?php
  485. //Displays js code to use a jqgrid
  486. echo Display::grid_js(
  487. 'courses',
  488. '',
  489. $columns_courses,
  490. $column_model_courses,
  491. $extra_params_courses,
  492. $new_course_list
  493. );
  494. echo Display::grid_js(
  495. 'list_default',
  496. $url,
  497. $columns,
  498. $column_model,
  499. $extra_params,
  500. array(),
  501. ''
  502. );
  503. echo Display::grid_js(
  504. 'list_course',
  505. $url_by_course,
  506. $columns,
  507. $column_model,
  508. $extra_params_course,
  509. array(),
  510. ''
  511. );
  512. echo Display::grid_js(
  513. 'list_week',
  514. $url_week,
  515. $column_week,
  516. $column_week_model,
  517. $extra_params_week,
  518. array(),
  519. ''
  520. );
  521. if (!api_is_anonymous()) {
  522. echo Display::grid_js(
  523. 'exercises',
  524. '',
  525. $column_exercise,
  526. $column_exercise_model,
  527. $extra_params_exercise,
  528. $my_real_array
  529. );
  530. }
  531. ?>
  532. });
  533. </script>
  534. <?php
  535. $courseCode = isset($_GET['course']) ? $_GET['course'] : null;
  536. $reportingTab = '';
  537. if (!api_is_anonymous()) {
  538. $reportingTab = Tracking::show_user_progress(
  539. api_get_user_id(),
  540. $session_id,
  541. '#tabs-4',
  542. false,
  543. false
  544. );
  545. if (!empty($reportingTab)) {
  546. $reportingTab .= '<br />';
  547. $reportingTab .= Tracking::show_course_detail(
  548. api_get_user_id(),
  549. $courseCode,
  550. $session_id
  551. );
  552. }
  553. if (empty($reportingTab)) {
  554. $reportingTab = Display::return_message(get_lang('NoDataAvailable'), 'warning');
  555. }
  556. }
  557. // Main headers
  558. $headers = array(
  559. Display::return_icon('moderator_star.png'),
  560. get_lang('Courses'),
  561. get_lang('LearningPaths')
  562. );
  563. if (!api_is_anonymous()) {
  564. $headers[] = get_lang('MyQCM');
  565. $headers[] = get_lang('MyStatistics');
  566. }
  567. $coursesTab = Display::grid_html('courses');
  568. $starTab = Display::grid_html('list_default');
  569. $tabs = array(
  570. $starTab,
  571. $coursesTab,
  572. Display::grid_html('list_course'),
  573. Display::grid_html('exercises'),
  574. $reportingTab
  575. );
  576. $tabToHide = api_get_configuration_value('session_hide_tab_list');
  577. if (!empty($tabToHide)) {
  578. foreach ($tabToHide as $columnId) {
  579. unset($headers[$columnId]);
  580. unset($tabs[$columnId]);
  581. }
  582. }
  583. // Main headers data
  584. echo Display::tabs(
  585. $headers,
  586. $tabs
  587. );
  588. // Deleting the objects
  589. Session::erase('_gid');
  590. Session::erase('oLP');
  591. Session::erase('lpobject');
  592. api_remove_in_gradebook();
  593. Display::display_footer();