index.php 25 KB

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