index.php 22 KB

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