lp_list.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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. exit;
  17. }
  18. require_once '../inc/global.inc.php';
  19. $courseDir = api_get_course_path().'/scorm';
  20. $baseWordDir = $courseDir;
  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[] = "<script>
  28. function confirmation(name) {
  29. if (confirm(\" ".trim(get_lang('AreYouSureToDelete'))." \"+name+\"?\"))
  30. {return true;}
  31. else
  32. {return false;}
  33. }
  34. </script>";
  35. $nameTools = get_lang('LearningPaths');
  36. event_access_tool(TOOL_LEARNPATH);
  37. api_protect_course_script();
  38. /**
  39. * Display
  40. */
  41. /* Require the search widget and prepare the header with its stuff. */
  42. if (api_get_setting('search_enabled') == 'true') {
  43. require api_get_path(LIBRARY_PATH).'search/search_widget.php';
  44. search_widget_prepare($htmlHeadXtra);
  45. }
  46. Display::display_header($nameTools, 'Path');
  47. $current_session = api_get_session_id();
  48. /* Introduction section (editable by course admins) */
  49. Display::display_introduction_section(TOOL_LEARNPATH, array(
  50. 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
  51. 'CreateDocumentDir' => '../../courses/'.api_get_course_path().'/document/',
  52. 'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
  53. ));
  54. $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
  55. if ($is_allowed_to_edit) {
  56. /* DIALOG BOX SECTION */
  57. if (!empty($dialog_box)) {
  58. switch ($_GET['dialogtype']) {
  59. case 'confirmation':
  60. Display::display_confirmation_message($dialog_box);
  61. break;
  62. case 'error':
  63. Display::display_error_message($dialog_box);
  64. break;
  65. case 'warning':
  66. Display::display_warning_message($dialog_box);
  67. break;
  68. default:
  69. Display::display_normal_message($dialog_box);
  70. break;
  71. }
  72. }
  73. if (api_failure::get_last_failure()) {
  74. Display::display_normal_message(api_failure::get_last_failure());
  75. }
  76. echo '<div class="actions">';
  77. echo Display::url(Display::return_icon('new_folder.png', get_lang('AddCategory'), array(), ICON_SIZE_MEDIUM), api_get_self().'?'.api_get_cidreq().'&action=add_lp_category');
  78. 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>'.
  79. str_repeat('&nbsp;', 3).
  80. '<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>';
  81. if (api_get_setting('service_ppt2lp', 'active') == 'true') {
  82. echo str_repeat('&nbsp;', 3).'<a href="../upload/upload_ppt.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'">
  83. '.Display::return_icon('import_powerpoint.png', get_lang('PowerPointConvert'), '', ICON_SIZE_MEDIUM).'</a>';
  84. //echo str_repeat('&nbsp;', 3).'<a href="../upload/upload_word.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"><img src="../img/word.gif" border="0" alt="'.get_lang('WordConvert').'" align="absmiddle">&nbsp;'.get_lang('WordConvert').'</a>';
  85. }
  86. echo '</div>';
  87. }
  88. $token = Security::get_token();
  89. /* DISPLAY SCORM LIST */
  90. $categories_temp = learnpath::get_categories(api_get_course_int_id());
  91. $category_test = new Entity\CLpCategory();
  92. $category_test->setId(0);
  93. $category_test->setName(get_lang('NoCategory'));
  94. $category_test->setPosition(0);
  95. $categories = array(
  96. $category_test
  97. );
  98. if (!empty($categories_temp)) {
  99. $categories = array_merge($categories, $categories_temp);
  100. }
  101. $test_mode = $app['debug'];
  102. $lp_showed = false;
  103. $total = count($categories);
  104. $counterCategories = 1;
  105. foreach ($categories as $item) {
  106. $list = new LearnpathList(api_get_user_id(), null, null, null, false, $item->getId());
  107. $flat_list = $list->get_flat_list();
  108. $edit_link = null;
  109. $delete_link = null;
  110. $moveUpLink = null;
  111. $moveDownLink = null;
  112. if ($item->getId() > 0 && api_is_allowed_to_edit()) {
  113. $url = 'lp_controller.php?'.api_get_cidreq().'&action=add_lp_category&id='.$item->getId();
  114. $edit_link = Display::url(Display::return_icon('edit.png', get_lang('Edit')), $url);
  115. $delete_url = 'lp_controller.php?'.api_get_cidreq().'&action=delete_lp_category&id='.$item->getId();
  116. $moveUpUrl = 'lp_controller.php?'.api_get_cidreq().'&action=move_up_category&id='.$item->getId();
  117. $moveDownUrl = 'lp_controller.php?'.api_get_cidreq().'&action=move_down_category&id='.$item->getId();
  118. if ($counterCategories == 1) {
  119. $moveUpLink = Display::url(Display::return_icon('up_na.png', get_lang('Move')), '#');
  120. } else {
  121. $moveUpLink = Display::url(Display::return_icon('up.png', get_lang('Move')), $moveUpUrl);
  122. }
  123. if (($total -1) == $counterCategories) {
  124. $moveDownLink = Display::url(Display::return_icon('down_na.png', get_lang('Move')), '#');
  125. } else {
  126. $moveDownLink = Display::url(Display::return_icon('down.png', get_lang('Move')), $moveDownUrl);
  127. }
  128. $delete_link = Display::url(Display::return_icon('delete.png', get_lang('Delete')), $delete_url);
  129. $counterCategories++;
  130. }
  131. echo Display::page_subheader2($item->getName().$edit_link.$moveUpLink.$moveDownLink.$delete_link);
  132. if (!empty($flat_list)) {
  133. echo '<table class="data_table">';
  134. echo '<tr>';
  135. if ($is_allowed_to_edit) {
  136. echo '<th width="50%">'.get_lang('Title').'</th>';
  137. echo '<th>'.get_lang('PublicationDate').'</th>';
  138. echo '<th>'.get_lang('ExpirationDate').'</th>';
  139. echo '<th>'.get_lang('Progress')."</th>";
  140. echo '<th width="240px">'.get_lang('AuthoringOptions')."</th>";
  141. } else {
  142. echo '<th width="50%">'.get_lang('Title').'</th>';
  143. echo '<th>'.get_lang('Progress')."</th>";
  144. echo '<th>'.get_lang('Actions')."</th>";
  145. }
  146. echo '</tr>';
  147. $max = count($flat_list);
  148. $counter = 0;
  149. $current = 0;
  150. $autolunch_exists = false;
  151. foreach ($flat_list as $id => $details) {
  152. // Validation when belongs to a session
  153. $session_img = api_get_session_image($details['lp_session'], $_user['status']);
  154. if (!$is_allowed_to_edit && $details['lp_visibility'] == 0) {
  155. // This is a student and this path is invisible, skip.
  156. continue;
  157. }
  158. // Check if the learnpath is visible for student.
  159. if (!$is_allowed_to_edit && !learnpath::is_lp_visible_for_student($id, api_get_user_id())) {
  160. continue;
  161. }
  162. $start_time = $end_time = '';
  163. if (!$is_allowed_to_edit) {
  164. $time_limits = false;
  165. //This is an old LP (from a migration 1.8.7) so we do nothing
  166. 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')) {
  167. $time_limits = false;
  168. }
  169. //Checking if expired_on is ON
  170. if ($details['expired_on'] != '' && $details['expired_on'] != '0000-00-00 00:00:00') {
  171. $time_limits = true;
  172. }
  173. if ($time_limits) {
  174. // check if start time
  175. if (!empty($details['publicated_on']) && $details['publicated_on'] != '0000-00-00 00:00:00' &&
  176. !empty($details['expired_on']) && $details['expired_on'] != '0000-00-00 00:00:00') {
  177. $start_time = api_strtotime($details['publicated_on'], 'UTC');
  178. $end_time = api_strtotime($details['expired_on'], 'UTC');
  179. $now = time();
  180. $is_actived_time = false;
  181. if ($now > $start_time && $end_time > $now) {
  182. $is_actived_time = true;
  183. }
  184. if (!$is_actived_time) {
  185. continue;
  186. }
  187. }
  188. }
  189. $start_time = $end_time = '';
  190. } else {
  191. if (!empty($details['publicated_on'])) {
  192. $start_time = api_convert_and_format_date($details['publicated_on'], DATE_TIME_FORMAT_LONG);
  193. }
  194. if (!empty($details['expired_on'])) {
  195. $end_time = api_convert_and_format_date($details['expired_on'], DATE_TIME_FORMAT_LONG);
  196. }
  197. }
  198. $counter++;
  199. if (($counter % 2) == 0) {
  200. $oddclass = 'row_odd';
  201. } else {
  202. $oddclass = 'row_even';
  203. }
  204. $url_start_lp = 'lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$id;
  205. $name = Security::remove_XSS($details['lp_name']);
  206. $extra = null;
  207. if ($is_allowed_to_edit) {
  208. $url_start_lp .= '&isStudentView=true';
  209. $dsp_desc = '<em>'.$details['lp_maker'].'</em> '.(learnpath::is_lp_visible_for_student($id, api_get_user_id()) ? '' : ' - ('.get_lang('LPNotVisibleToStudent').')');
  210. $extra = '<div class ="lp_content_type_label">'.$dsp_desc.'</div>';
  211. }
  212. $my_title = $name;
  213. if ($details['lp_visibility'] == 0) {
  214. $my_title = Display::tag('font', $name, array('style' => 'color:grey'));
  215. }
  216. $dsp_line = '<tr align="center" class="'.$oddclass.'">
  217. <td align="left" valign="top">'.Display::return_icon('learnpath.png', get_lang('LPName'), '', ICON_SIZE_SMALL).'
  218. <a href="'.$url_start_lp.'">'.$my_title.'</a>'.$session_img.$extra."</td>";
  219. $dsp_desc = '';
  220. $dsp_export = '';
  221. $dsp_edit = '';
  222. $dsp_build = '';
  223. $dsp_edit_close = '';
  224. $dsp_delete = '';
  225. $dsp_visible = '';
  226. $dsp_default_view = '';
  227. $dsp_debug = '';
  228. $dsp_order = '';
  229. $lp_auto_lunch_icon = '';
  230. $copy = null;
  231. $dsp_disk = null;
  232. $dsp_reinit = null;
  233. $subscribe_users = null;
  234. $dsp_publish = null;
  235. $dsp_edit_lp = null;
  236. $progress = learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id());
  237. if ($is_allowed_to_edit) {
  238. $dsp_progress = '<td>'.$progress.'</td>';
  239. } else {
  240. $dsp_progress = '<td>'.learnpath::get_progress_bar('%', learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id())).'</td>';
  241. }
  242. $dsp_edit = '<td class="td_actions">';
  243. $dsp_edit_close = '</td>';
  244. $token_parameter = "&sec_token=$token";
  245. if ($is_allowed_to_edit) {
  246. // EDIT LP
  247. if ($current_session == $details['lp_session']) {
  248. $dsp_edit_lp = '<a href="lp_controller.php?referer=lplist&'.api_get_cidreq().'&action=edit&lp_id='.$id.'">'.Display::return_icon('settings.png', get_lang('CourseSettings'), '', ICON_SIZE_SMALL).'</a>';
  249. } else {
  250. $dsp_edit_lp = Display::return_icon('settings_na.png', get_lang('CourseSettings'), '', ICON_SIZE_SMALL);
  251. }
  252. // BUILD
  253. if ($current_session == $details['lp_session']) {
  254. if ($details['lp_type'] == 1 || $details['lp_type'] == 2) {
  255. $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>';
  256. } else {
  257. $dsp_build = Display::return_icon('edit_na.png', get_lang('LearnpathEditLearnpath'), '', ICON_SIZE_SMALL);
  258. }
  259. } else {
  260. $dsp_build = Display::return_icon('edit_na.png', get_lang('LearnpathEditLearnpath'), '', ICON_SIZE_SMALL);
  261. }
  262. /* VISIBILITY COMMAND */
  263. // 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).
  264. //if ($current_session == $details['lp_session']) {
  265. if (!isset($details['subscribe_users']) || $details['subscribe_users'] != 1) {
  266. if ($details['lp_visibility'] == 0) {
  267. $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>";
  268. } else {
  269. $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>";
  270. }
  271. }
  272. /* PUBLISH COMMAND */
  273. if ($current_session == $details['lp_session']) {
  274. if ($details['lp_published'] == "i") {
  275. $dsp_publish = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=v\">".
  276. Display::return_icon('lp_publish_na.png', get_lang('LearnpathPublish'), '', ICON_SIZE_SMALL)."</a>";
  277. } else {
  278. $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>";
  279. }
  280. } else {
  281. $dsp_publish = Display::return_icon('lp_publish_na.png', get_lang('LearnpathDoNotPublish'), '', ICON_SIZE_SMALL);
  282. }
  283. /* MULTIPLE ATTEMPTS OR SERIOUS GAME MODE
  284. SERIOUSGAME MODE is a special mode where :
  285. * If a user exits the learning path before finishing it, he comes back where he left next time he tries
  286. * When lp status is completed, user can still modify the attempt (adds/time change score, and browse it)
  287. * It is thus a mix betwenn multiple attempt and mono attempt
  288. */
  289. if ($current_session == $details['lp_session']) {
  290. if ($details['seriousgame_mode'] == 1 && $details['lp_prevent_reinit'] == 1) { //seriousgame mode | next = single
  291. $dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_attempt_mode&lp_id='.$id.'">'.
  292. Display::return_icon('reload.png', get_lang('PreventMultipleAttempts'), '', ICON_SIZE_SMALL).
  293. '</a>';
  294. }
  295. if ($details['seriousgame_mode'] == 0 && $details['lp_prevent_reinit'] == 1) { //single mode | next = multiple
  296. $dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_attempt_mode&lp_id='.$id.'">'.
  297. Display::return_icon('reload_na.png', get_lang('AllowMultipleAttempts'), '', ICON_SIZE_SMALL).
  298. '</a>';
  299. }
  300. if ($details['seriousgame_mode'] == 0 && $details['lp_prevent_reinit'] == 0) { //multiple mode | next = seriousgame
  301. $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).
  302. '</a>';
  303. }
  304. } else {
  305. $dsp_reinit = Display::return_icon('reload_na.png', get_lang('AllowMultipleAttempts'), '', ICON_SIZE_SMALL);
  306. }
  307. //$dsp_reinit = null;
  308. /* FUll screen VIEW */
  309. if ($current_session == $details['lp_session']) {
  310. switch ($details['lp_view_mode']) {
  311. case 'fullscreen':
  312. $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">'.
  313. Display::return_icon('view_fullscreen.png', get_lang('ViewModeFullScreen'), '', ICON_SIZE_SMALL).'</a>';
  314. break;
  315. case 'embedded':
  316. $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">'.
  317. Display::return_icon('view_left_right.png', get_lang('ViewModeEmbedded'), '', ICON_SIZE_SMALL).'</a>';
  318. break;
  319. case 'embedframe':
  320. $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">'.
  321. Display::return_icon('view_nofullscreen.png', get_lang('ViewModeEmbedFrame'), '', ICON_SIZE_SMALL).'</a>';
  322. break;
  323. case 'impress':
  324. $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
  325. Display::return_icon('window_list_slide.png', get_lang('ViewModeImpress'),'',ICON_SIZE_SMALL).'</a>';
  326. break;
  327. }
  328. } else {
  329. if ($details['lp_view_mode'] == 'fullscreen') {
  330. $dsp_default_view = Display::return_icon('view_fullscreen_na.png', get_lang('ViewModeEmbedded'), '', ICON_SIZE_SMALL);
  331. } else {
  332. $dsp_default_view = Display::return_icon('view_left_right_na.png', get_lang('ViewModeEmbedded'), '', ICON_SIZE_SMALL);
  333. }
  334. }
  335. /* Debug */
  336. if ($test_mode == 'test' or api_is_platform_admin()) {
  337. if ($details['lp_scorm_debug'] == 1) {
  338. $dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">'.
  339. Display::return_icon('bug.png', get_lang('HideDebug'), '', ICON_SIZE_SMALL).'</a>';
  340. } else {
  341. $dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">'.
  342. Display::return_icon('bug_na.png', get_lang('ShowDebug'), '', ICON_SIZE_SMALL).'</a>';
  343. }
  344. }
  345. /* Export */
  346. if ($details['lp_type'] == 1) {
  347. $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");
  348. } elseif ($details['lp_type'] == 2) {
  349. $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=".api_replace_dangerous_char($name, 'strict').".zip");
  350. } else {
  351. $dsp_disk = Display::return_icon('cd_gray.gif', get_lang('Export'), array(), ICON_SIZE_SMALL);
  352. }
  353. //Copy
  354. $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");
  355. //Subscribe users
  356. $subscribe_users = null;
  357. if ($details['subscribe_users'] == 1) {
  358. $subscribe_users = Display::url(Display::return_icon('user.png', get_lang('SubscribeUsersToLp')), api_get_path(WEB_PUBLIC_PATH)."learnpath/subscribe_users/$id");
  359. }
  360. /* Auto Lunch LP code */
  361. $lp_auto_lunch_icon = '';
  362. if (api_get_course_setting('enable_lp_auto_launch') == 1) {
  363. if ($details['autolaunch'] == 1 && $autolunch_exists == false) {
  364. $autolunch_exists = true;
  365. $lp_auto_lunch_icon = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=auto_launch&status=0&lp_id='.$id.'">
  366. <img src="../img/launch.png" border="0" title="'.get_lang('DisableLPAutoLaunch').'" /></a>';
  367. } else {
  368. $lp_auto_lunch_icon = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=auto_launch&status=1&lp_id='.$id.'">
  369. <img src="../img/launch_na.png" border="0" title="'.get_lang('EnableLPAutoLaunch').'" /></a>';
  370. }
  371. }
  372. //if (api_get_setting('pdf_export_watermark_enable') == 'true') {
  373. $export_icon = ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&lp_id='.$id.'">
  374. '.Display::return_icon('pdf.png', get_lang('ExportToPDFOnlyHTMLAndImages'), '', ICON_SIZE_SMALL).'</a>';
  375. //}
  376. /* DELETE COMMAND */
  377. if ($current_session == $details['lp_session']) {
  378. $dsp_delete = "<a href=\"lp_controller.php?".api_get_cidreq()."&action=delete&lp_id=$id\" ".
  379. "onclick=\"javascript: return confirmation('".addslashes($name)."');\">".
  380. Display::return_icon('delete.png', get_lang('LearnpathDeleteLearnpath'), '', ICON_SIZE_SMALL).'</a>';
  381. } else {
  382. $dsp_delete = Display::return_icon('delete_na.png', get_lang('LearnpathDeleteLearnpath'), '', ICON_SIZE_SMALL);
  383. }
  384. /* COLUMN ORDER */
  385. // Only active while session mode is not active
  386. if ($current_session == 0) {
  387. if ($details['lp_display_order'] == 1 && $max != 1) {
  388. $dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">
  389. '.Display::return_icon('down.png', get_lang('MoveDown'), '', ICON_SIZE_SMALL).'</a>
  390. <img src="../img/blanco.png" border="0" alt="" title="" />';
  391. } elseif ($current == $max - 1 && $max != 1) {
  392. $dsp_order .= '<img src="../img/blanco.png" border="0" alt="" title="" /><a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">
  393. '.Display::return_icon('up.png', get_lang('MoveUp'), '', ICON_SIZE_SMALL).'</a>';
  394. } elseif ($max == 1) {
  395. $dsp_order = '';
  396. } else {
  397. $dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">'.
  398. Display::return_icon('down.png', get_lang('MoveDown'), '', ICON_SIZE_SMALL).'</a>';
  399. $dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">'.
  400. Display::return_icon('up.png', get_lang('MoveUp'), '', ICON_SIZE_SMALL).'</a>';
  401. }
  402. }
  403. if ($is_allowed_to_edit) {
  404. $start_time = Display::tag('td', Display::div($start_time, array('class' => 'small')));
  405. $end_time = Display::tag('td', Display::div($end_time, array('class' => 'small')));
  406. } else {
  407. $start_time = $end_time = '';
  408. }
  409. } else { // end if ($is_allowedToEdit)
  410. //Student
  411. $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>';
  412. }
  413. echo $dsp_line.$start_time.$end_time.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_edit_lp.$dsp_visible.$dsp_publish.$subscribe_users.$dsp_reinit.
  414. $dsp_default_view.$dsp_debug.$dsp_disk.$copy.$lp_auto_lunch_icon.$export_icon.$dsp_delete.$dsp_order.$dsp_edit_close;
  415. $lp_showed = true;
  416. echo "</tr>";
  417. $current++; //counter for number of elements treated
  418. } // end foreach ($flat_list)
  419. // TODO: Some user-friendly message if counter is still = 0 to tell nothing can be display yet.
  420. echo "</table>";
  421. }
  422. }
  423. if ($is_allowed_to_edit && $lp_showed == false) {
  424. echo '<div id="no-data-view">';
  425. echo '<h2>'.get_lang('LearningPaths').'</h2>';
  426. echo Display::return_icon('scorms.png', '', array(), 64);
  427. echo '<div class="controls">';
  428. echo Display::url(get_lang('LearnpathAddLearnpath'), api_get_self().'?'.api_get_cidreq().'&action=add_lp', array('class' => 'btn'));
  429. echo '</div>';
  430. echo '</div>';
  431. }
  432. $course_info = api_get_course_info();
  433. learnpath::generate_learning_path_folder($course_info);
  434. //Deleting the objects
  435. Session::erase('oLP');
  436. Session::erase('lpobject');
  437. Display::display_footer();