lp_list.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This file was origially the copy of document.php, but many modifications happened since then ;
  5. * the direct file view is not any more needed, if the user uploads a scorm zip file, a directory
  6. * will be automatically created for it, and the files will be uncompressed there for example ;
  7. *
  8. * @package chamilo.learnpath
  9. * @author Yannick Warnier <ywarnier@beeznest.org>
  10. */
  11. use \ChamiloSession as Session;
  12. $this_section = SECTION_COURSES;
  13. //@todo who turns on $lp_controller_touched?
  14. if (empty($lp_controller_touched) || $lp_controller_touched != 1) {
  15. header('location: lp_controller.php?action=list');
  16. }
  17. require_once 'back_compat.inc.php';
  18. $courseDir = api_get_course_path().'/scorm';
  19. $baseWordDir = $courseDir;
  20. require_once 'learnpathList.class.php';
  21. require_once 'learnpath.class.php';
  22. require_once 'learnpathItem.class.php';
  23. /**
  24. * Display initialisation and security checks
  25. */
  26. // Extra javascript functions for in html head:
  27. $htmlHeadXtra[] =
  28. "<script>
  29. function confirmation(name) {
  30. if (confirm(\" ".trim(get_lang('AreYouSureToDelete'))." \"+name+\"?\"))
  31. {return true;}
  32. else
  33. {return false;}
  34. }
  35. </script>";
  36. $nameTools = get_lang('LearningPaths');
  37. event_access_tool(TOOL_LEARNPATH);
  38. api_protect_course_script();
  39. //if (!$is_allowed_in_course) api_not_allowed();
  40. /**
  41. * Display
  42. */
  43. /* Require the search widget and prepare the header with its stuff. */
  44. if (api_get_setting('search_enabled') == 'true') {
  45. require api_get_path(LIBRARY_PATH).'search/search_widget.php';
  46. search_widget_prepare($htmlHeadXtra);
  47. }
  48. Display::display_header($nameTools, 'Path');
  49. $current_session = api_get_session_id();
  50. /* Introduction section (editable by course admins) */
  51. Display::display_introduction_section(TOOL_LEARNPATH, array(
  52. 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
  53. 'CreateDocumentDir' => '../../courses/'.api_get_course_path().'/document/',
  54. 'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
  55. ));
  56. $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
  57. if ($is_allowed_to_edit) {
  58. /* DIALOG BOX SECTION */
  59. if (!empty($dialog_box)) {
  60. switch ($_GET['dialogtype']) {
  61. case 'confirmation':
  62. Display::display_confirmation_message($dialog_box);
  63. break;
  64. case 'error':
  65. Display::display_error_message($dialog_box);
  66. break;
  67. case 'warning':
  68. Display::display_warning_message($dialog_box);
  69. break;
  70. default:
  71. Display::display_normal_message($dialog_box);
  72. break;
  73. }
  74. }
  75. if (api_failure::get_last_failure()) {
  76. Display::display_normal_message(api_failure::get_last_failure());
  77. }
  78. echo '<div class="actions">';
  79. echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_lp">'.Display::return_icon('new_learnpath.png', get_lang('LearnpathAddLearnpath'), '', ICON_SIZE_MEDIUM).'</a>'.
  80. str_repeat('&nbsp;', 3).
  81. '<a href="../upload/index.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'">'.Display::return_icon('import_scorm.png', get_lang('UploadScorm'), '', ICON_SIZE_MEDIUM).'</a>';
  82. if (api_get_setting('service_ppt2lp', 'active') == 'true') {
  83. echo str_repeat('&nbsp;', 3).'<a href="../upload/upload_ppt.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'">
  84. '.Display::return_icon('import_powerpoint.png', get_lang('PowerPointConvert'), '', ICON_SIZE_MEDIUM).'</a>';
  85. }
  86. echo '</div>';
  87. }
  88. $token = Security::get_token();
  89. /* DISPLAY SCORM LIST */
  90. $list = new LearnpathList(api_get_user_id());
  91. $flat_list = $list->get_flat_list();
  92. if (!empty($flat_list)) {
  93. echo '<table class="data_table">';
  94. echo '<tr>';
  95. if ($is_allowed_to_edit) {
  96. echo '<th width="35%">'.get_lang('Title').'</th>';
  97. echo '<th>'.get_lang('PublicationDate').'</th>';
  98. echo '<th>'.get_lang('ExpirationDate').'</th>';
  99. echo '<th>'.get_lang('Progress')."</th>";
  100. echo '<th width="300px">'.get_lang('AuthoringOptions')."</th>";
  101. } else {
  102. echo '<th width="50%">'.get_lang('Title').'</th>';
  103. echo '<th>'.get_lang('Progress')."</th>";
  104. echo '<th>'.get_lang('Actions')."</th>";
  105. }
  106. echo '</tr>';
  107. $test_mode = api_get_setting('server_type');
  108. $max = count($flat_list);
  109. $counter = 0;
  110. $current = 0;
  111. $autolunch_exists = false;
  112. foreach ($flat_list as $id => $details) {
  113. // Validacion when belongs to a session
  114. $session_img = api_get_session_image($details['lp_session'], $_user['status']);
  115. if (!$is_allowed_to_edit && $details['lp_visibility'] == 0) {
  116. // This is a student and this path is invisible, skip.
  117. continue;
  118. }
  119. // Check if the learnpath is visible for student.
  120. if (!$is_allowed_to_edit && !learnpath::is_lp_visible_for_student($id, api_get_user_id())) {
  121. continue;
  122. }
  123. $start_time = $end_time = '';
  124. if (!$is_allowed_to_edit) {
  125. $time_limits = false;
  126. //This is an old LP (from a migration 1.8.7) so we do nothing
  127. if ((empty($details['created_on']) || $details['created_on'] == '0000-00-00 00:00:00') && (empty($details['modified_on']) || $details['modified_on'] == '0000-00-00 00:00:00')) {
  128. $time_limits = false;
  129. }
  130. //Checking if expired_on is ON
  131. if ($details['expired_on'] != '' && $details['expired_on'] != '0000-00-00 00:00:00') {
  132. $time_limits = true;
  133. }
  134. if ($time_limits) {
  135. // check if start time
  136. if (!empty($details['publicated_on']) && $details['publicated_on'] != '0000-00-00 00:00:00' &&
  137. !empty($details['expired_on']) && $details['expired_on'] != '0000-00-00 00:00:00') {
  138. $start_time = api_strtotime($details['publicated_on'], 'UTC');
  139. $end_time = api_strtotime($details['expired_on'], 'UTC');
  140. $now = time();
  141. $is_actived_time = false;
  142. if ($now > $start_time && $end_time > $now) {
  143. $is_actived_time = true;
  144. }
  145. if (!$is_actived_time) {
  146. continue;
  147. }
  148. }
  149. }
  150. $start_time = $end_time = '';
  151. } else {
  152. if (!empty($details['publicated_on'])) {
  153. $start_time = api_convert_and_format_date($details['publicated_on'], DATE_TIME_FORMAT_LONG);
  154. }
  155. if (!empty($details['expired_on'])) {
  156. $end_time = api_convert_and_format_date($details['expired_on'], DATE_TIME_FORMAT_LONG);
  157. }
  158. }
  159. $counter++;
  160. if (($counter % 2) == 0) {
  161. $oddclass = 'row_odd';
  162. } else {
  163. $oddclass = 'row_even';
  164. }
  165. $url_start_lp = 'lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$id;
  166. $name = Security::remove_XSS($details['lp_name']);
  167. $extra = null;
  168. if ($is_allowed_to_edit) {
  169. $url_start_lp .= '&isStudentView=true';
  170. $dsp_desc = '<em>'.$details['lp_maker'].'</em> '.(learnpath::is_lp_visible_for_student($id, api_get_user_id()) ? '' : ' - ('.get_lang('LPNotVisibleToStudent').')');
  171. $extra = '<div class ="lp_content_type_label">'.$dsp_desc.'</div>';
  172. }
  173. $my_title = $name;
  174. $icon_learnpath = Display::return_icon('learnpath.png', get_lang('LPName'), '', ICON_SIZE_SMALL);
  175. if ($details['lp_visibility'] == 0) {
  176. $my_title = Display::tag('font', $name, array('class' => 'invisible'));
  177. $icon_learnpath = Display::return_icon('learnpath_na.png', get_lang('LPName'), '', ICON_SIZE_SMALL);
  178. }
  179. $dsp_line = '<tr align="center" class="'.$oddclass.'">'.
  180. '<td align="left" valign="top">'.$icon_learnpath.'
  181. <a href="'.$url_start_lp.'">'.$my_title.'</a>'.$session_img.$extra."</td>";
  182. $dsp_desc = '';
  183. $dsp_export = '';
  184. $dsp_build = '';
  185. $dsp_delete = '';
  186. $dsp_visible = '';
  187. $dsp_default_view = '';
  188. $dsp_debug = '';
  189. $dsp_order = '';
  190. $progress = learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id());
  191. if ($is_allowed_to_edit) {
  192. $dsp_progress = '<td><center>'.$progress.'</center></td>';
  193. } else {
  194. $dsp_progress = '<td>'.learnpath::get_progress_bar('%', learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id())).'</td>';
  195. }
  196. $dsp_edit = '<td class="td_actions">';
  197. $dsp_edit_close = '</td>';
  198. $token_parameter = "&sec_token=$token";
  199. $dsp_edit_lp = null;
  200. $dsp_publish = null;
  201. $dsp_reinit = null;
  202. $dsp_disk = null;
  203. $copy = null;
  204. $lp_auto_lunch_icon = null;
  205. if ($is_allowed_to_edit) {
  206. // EDIT LP
  207. if ($current_session == $details['lp_session']) {
  208. $dsp_edit_lp = '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$id.'">'.Display::return_icon('settings.png', get_lang('CourseSettings'), '', ICON_SIZE_SMALL).'</a>';
  209. } else {
  210. $dsp_edit_lp = Display::return_icon('settings_na.png', get_lang('CourseSettings'), '', ICON_SIZE_SMALL);
  211. }
  212. // BUILD
  213. if ($current_session == $details['lp_session']) {
  214. if ($details['lp_type'] == 1 || $details['lp_type'] == 2) {
  215. $dsp_build = '<a href="lp_controller.php?'.api_get_cidreq().'&amp;action=add_item&amp;type=step&amp;lp_id='.$id.'">'.Display::return_icon('edit.png', get_lang('LearnpathEditLearnpath'), '', ICON_SIZE_SMALL).'</a>';
  216. } else {
  217. $dsp_build = Display::return_icon('edit_na.png', get_lang('LearnpathEditLearnpath'), '', ICON_SIZE_SMALL);
  218. }
  219. } else {
  220. $dsp_build = Display::return_icon('edit_na.png', get_lang('LearnpathEditLearnpath'), '', ICON_SIZE_SMALL);
  221. }
  222. /* VISIBILITY COMMAND */
  223. // Session test not necessary if we want to show base course learning paths inside the session (see http://support.chamilo.org/projects/chamilo-18/wiki/Tools_and_sessions).
  224. //if ($current_session == $details['lp_session']) {
  225. if ($details['lp_visibility'] == 0) {
  226. $dsp_visible = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=1\">".Display::return_icon('invisible.png', get_lang('Show'), '', ICON_SIZE_SMALL)."</a>";
  227. } else {
  228. $dsp_visible = "<a href='".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=0'>".Display::return_icon('visible.png', get_lang('Hide'), '', ICON_SIZE_SMALL)."</a>";
  229. }
  230. //} else {
  231. // $dsp_visible = '<img src="../img/invisible.gif" border="0" title="'.get_lang('Show').'" />';
  232. //}
  233. /* PUBLISH COMMAND */
  234. if ($current_session == $details['lp_session']) {
  235. if ($details['lp_published'] == "i") {
  236. $dsp_publish = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=v\">".
  237. Display::return_icon('lp_publish_na.png', get_lang('LearnpathPublish'), '', ICON_SIZE_SMALL)."</a>";
  238. } else {
  239. $dsp_publish = "<a href='".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=i'>".Display::return_icon('lp_publish.png', get_lang('LearnpathDoNotPublish'), '', ICON_SIZE_SMALL)."</a>";
  240. }
  241. } else {
  242. $dsp_publish = Display::return_icon('lp_publish_na.png', get_lang('LearnpathDoNotPublish'), '', ICON_SIZE_SMALL);
  243. }
  244. /* MULTIPLE ATTEMPTS OR SERIOUS GAME MODE
  245. SERIOUSGAME MODE is a special mode where :
  246. * If a user exits the learning path before finishing it, he comes back where he left next time he tries
  247. * When lp status is completed, user can still modify the attempt (adds/time change score, and browse it)
  248. * It is thus a mix betwenn multiple attempt and mono attempt
  249. */
  250. if ($current_session == $details['lp_session']) {
  251. if ($details['seriousgame_mode'] == 1 && $details['lp_prevent_reinit'] == 1) { //seriousgame mode | next = single
  252. $dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_attempt_mode&lp_id='.$id.'">'.
  253. Display::return_icon('reload.png', get_lang('PreventMultipleAttempts'), '', ICON_SIZE_SMALL).
  254. '</a>';
  255. }
  256. if ($details['seriousgame_mode'] == 0 && $details['lp_prevent_reinit'] == 1) { //single mode | next = multiple
  257. $dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_attempt_mode&lp_id='.$id.'">'.
  258. Display::return_icon('reload_na.png', get_lang('AllowMultipleAttempts'), '', ICON_SIZE_SMALL).
  259. '</a>';
  260. }
  261. if ($details['seriousgame_mode'] == 0 && $details['lp_prevent_reinit'] == 0) { //multiple mode | next = seriousgame
  262. $dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_attempt_mode&lp_id='.$id.'">'.Display::return_icon('reload.png', get_lang('AllowMultipleAttempts'), '', ICON_SIZE_SMALL).
  263. '</a>';
  264. }
  265. } else {
  266. $dsp_reinit = Display::return_icon('reload_na.png', get_lang('AllowMultipleAttempts'), '', ICON_SIZE_SMALL);
  267. }
  268. /* SCREEN LP VIEW */
  269. if ($current_session == $details['lp_session']) {
  270. switch ($details['lp_view_mode']) {
  271. case 'fullscreen':
  272. $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.$token_parameter.'">'.
  273. Display::return_icon('view_fullscreen.png', get_lang('ViewModeFullScreen'), '', ICON_SIZE_SMALL).'</a>';
  274. break;
  275. case 'embedded':
  276. $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.$token_parameter.'">'.
  277. Display::return_icon('view_left_right.png', get_lang('ViewModeEmbedded'), '', ICON_SIZE_SMALL).'</a>';
  278. break;
  279. case 'embedframe':
  280. $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.$token_parameter.'">'.
  281. Display::return_icon('view_nofullscreen.png', get_lang('ViewModeEmbedFrame'), '', ICON_SIZE_SMALL).'</a>';
  282. break;
  283. case 'impress':
  284. $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.$token_parameter.'">'.
  285. Display::return_icon('window_list_slide.png', get_lang('ViewModeImpress'), '', ICON_SIZE_SMALL).'</a>';
  286. break;
  287. }
  288. } else {
  289. if ($details['lp_view_mode'] == 'fullscreen') {
  290. $dsp_default_view = Display::return_icon('view_fullscreen_na.png', get_lang('ViewModeEmbedded'), '', ICON_SIZE_SMALL);
  291. } else {
  292. $dsp_default_view = Display::return_icon('view_left_right_na.png', get_lang('ViewModeEmbedded'), '', ICON_SIZE_SMALL);
  293. }
  294. }
  295. /* DEBUG */
  296. if ($test_mode == 'test' or api_is_platform_admin()) {
  297. if ($details['lp_scorm_debug'] == 1) {
  298. $dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">'.
  299. Display::return_icon('bug.png', get_lang('HideDebug'), '', ICON_SIZE_SMALL).'</a>';
  300. } else {
  301. $dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">'.
  302. Display::return_icon('bug_na.png', get_lang('ShowDebug'), '', ICON_SIZE_SMALL).'</a>';
  303. }
  304. }
  305. /* Export */
  306. if ($details['lp_type'] == 1) {
  307. $dsp_disk = Display::url(Display::return_icon('cd.gif', get_lang('Export'), array(), ICON_SIZE_SMALL), api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id");
  308. } elseif ($details['lp_type'] == 2) {
  309. $dsp_disk = Display::url(Display::return_icon('cd.gif', get_lang('Export'), array(), ICON_SIZE_SMALL), api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".replace_dangerous_char($name, 'strict').".zip");
  310. } else {
  311. $dsp_disk = Display::return_icon('cd_gray.gif', get_lang('Export'), array(), ICON_SIZE_SMALL);
  312. }
  313. //Copy
  314. $copy = Display::url(Display::return_icon('cd_copy.png', get_lang('Copy'), array(), ICON_SIZE_SMALL), api_get_self()."?".api_get_cidreq()."&action=copy&lp_id=$id");
  315. /* Auto Lunch LP code */
  316. if (api_get_course_setting('enable_lp_auto_launch') == 1) {
  317. if ($details['autolaunch'] == 1 && $autolunch_exists == false) {
  318. $autolunch_exists = true;
  319. $lp_auto_lunch_icon = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=auto_launch&status=0&lp_id='.$id.'">
  320. <img src="../img/launch.png" border="0" title="'.get_lang('DisableLPAutoLaunch').'" /></a>';
  321. } else {
  322. $lp_auto_lunch_icon = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=auto_launch&status=1&lp_id='.$id.'">
  323. <img src="../img/launch_na.png" border="0" title="'.get_lang('EnableLPAutoLaunch').'" /></a>';
  324. }
  325. }
  326. //if (api_get_setting('pdf_export_watermark_enable') == 'true') {
  327. //Export to PDF
  328. $export_icon = ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&lp_id='.$id.'">
  329. '.Display::return_icon('pdf.png', get_lang('ExportToPDFOnlyHTMLAndImages'), '', ICON_SIZE_SMALL).'</a>';
  330. //}
  331. /* DELETE COMMAND */
  332. if ($current_session == $details['lp_session']) {
  333. $dsp_delete = "<a href=\"lp_controller.php?".api_get_cidreq()."&action=delete&lp_id=$id\" ".
  334. "onclick=\"javascript: return confirmation('".addslashes($name)."');\">".
  335. Display::return_icon('delete.png', get_lang('LearnpathDeleteLearnpath'), '', ICON_SIZE_SMALL).'</a>';
  336. } else {
  337. $dsp_delete = Display::return_icon('delete_na.png', get_lang('LearnpathDeleteLearnpath'), '', ICON_SIZE_SMALL);
  338. }
  339. /* COLUMN ORDER */
  340. // Only active while session mode is not active
  341. if ($current_session == 0) {
  342. if ($details['lp_display_order'] == 1 && $max != 1) {
  343. $dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">
  344. '.Display::return_icon('down.png', get_lang('MoveDown'), '', ICON_SIZE_SMALL).'</a>';
  345. } elseif ($current == $max - 1 && $max != 1) {
  346. $dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">
  347. '.Display::return_icon('up.png', get_lang('MoveUp'), '', ICON_SIZE_SMALL).'</a>';
  348. } elseif ($max == 1) {
  349. $dsp_order = '';
  350. } else {
  351. $dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">'.
  352. Display::return_icon('down.png', get_lang('MoveDown'), '', ICON_SIZE_SMALL).'</a>';
  353. $dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">'.
  354. Display::return_icon('up.png', get_lang('MoveUp'), '', ICON_SIZE_SMALL).'</a>';
  355. }
  356. }
  357. if ($is_allowed_to_edit) {
  358. $start_time = Display::tag('td', Display::div($start_time, array('class' => 'small')));
  359. $end_time = Display::tag('td', Display::div($end_time, array('class' => 'small')));
  360. } else {
  361. $start_time = $end_time = '';
  362. }
  363. } else { // end if ($is_allowedToEdit)
  364. //Student
  365. $export_icon = ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&lp_id='.$id.'">'.Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>';
  366. }
  367. echo $dsp_line.$start_time.$end_time.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_edit_lp.$dsp_visible.$dsp_publish.$dsp_reinit.
  368. $dsp_default_view.$dsp_debug.$dsp_disk.$copy.$lp_auto_lunch_icon.$export_icon.$dsp_delete.$dsp_order.$dsp_edit_close;
  369. echo "</tr>";
  370. $current++; //counter for number of elements treated
  371. } // end foreach ($flat_list)
  372. // TODO: Erint some user-friendly message if counter is still = 0 to tell nothing can be display yet.
  373. echo "</table>";
  374. } else {
  375. if ($is_allowed_to_edit) {
  376. echo '<div id="no-data-view">';
  377. echo '<h2>'.get_lang('LearningPaths').'</h2>';
  378. echo Display::return_icon('scorms.png', '', array(), 64);
  379. echo '<div class="controls">';
  380. echo Display::url(get_lang('LearnpathAddLearnpath'), api_get_self().'?'.api_get_cidreq().'&action=add_lp', array('class' => 'btn'));
  381. echo '</div>';
  382. echo '</div>';
  383. }
  384. }
  385. $course_info = api_get_course_info();
  386. learnpath::generate_learning_path_folder($course_info);
  387. //Deleting the objects
  388. Session::erase('oLP');
  389. Session::erase('lpobject');
  390. Display::display_footer();