lp_list.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  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. $this_section = SECTION_COURSES;
  12. if (empty($lp_controller_touched) || $lp_controller_touched != 1) {
  13. header('location: lp_controller.php?action=list');
  14. }
  15. require_once 'back_compat.inc.php';
  16. $courseDir = api_get_course_path().'/scorm';
  17. $baseWordDir = $courseDir;
  18. $display_progress_bar = true;
  19. require_once 'learnpathList.class.php';
  20. require_once 'learnpath.class.php';
  21. require_once 'learnpathItem.class.php';
  22. /**
  23. * Display initialisation and security checks
  24. */
  25. // Extra javascript functions for in html head:
  26. $htmlHeadXtra[] =
  27. "<script language='javascript' type='text/javascript'>
  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. if (!$is_allowed_in_course) api_not_allowed();
  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. //api_display_tool_title($nameTools);
  49. /* Introduction section (editable by course admins) */
  50. Display::display_introduction_section(TOOL_LEARNPATH, array(
  51. 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
  52. 'CreateDocumentDir' => '../../courses/'.api_get_course_path().'/document/',
  53. 'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
  54. )
  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. //include 'content_makers.inc.php';
  79. echo '<div class="actions">';
  80. echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_lp">'.Display::return_icon('new_learnpath.png', get_lang('_add_learnpath'),'','32').'</a>' .
  81. str_repeat('&nbsp;', 3).
  82. '<a href="../upload/index.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'">'.Display::return_icon('import_scorm.png', get_lang('UploadScorm'),'','32').'</a>';
  83. if (api_get_setting('service_ppt2lp', 'active') == 'true') {
  84. echo str_repeat('&nbsp;', 3).'<a href="../upload/upload_ppt.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'">
  85. '.Display::return_icon('import_powerpoint.png', get_lang('PowerPointConvert'),'','32').'</a>';
  86. //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>';
  87. }
  88. echo '</div>';
  89. }
  90. echo '<table width="100%" border="0" cellspacing="2" class="data_table">';
  91. $is_allowed_to_edit ? $colspan = 9 : $colspan = 3;
  92. if (!empty($curDirPath)) {
  93. if (substr($curDirPath, 1, 1) == '/') {
  94. $tmpcurDirPath=substr($curDirPath,1,strlen($curDirPath));
  95. } else {
  96. $tmpcurDirPath = $curDirPath;
  97. }
  98. ?>
  99. <!-- current dir name -->
  100. <tr>
  101. <td colspan="<?php echo $colspan; ?>" align="left" bgcolor="#4171B5">
  102. <img src="../img/opendir.gif" align="absbottom" vspace="2" hspace="3" alt="open_dir" />
  103. <font color="#ffffff"><b><?php echo $tmpcurDirPath; ?></b></font>
  104. </td>
  105. </tr>
  106. <?php
  107. }
  108. /* CURRENT DIRECTORY */
  109. echo '<tr>';
  110. if ($is_allowed_to_edit) {
  111. echo '<th width="30%">'.get_lang('Title').'</th>';
  112. echo '<th>'.get_lang('PublicationDate').'</th>';
  113. echo '<th>'.get_lang('ExpirationDate').'</th>';
  114. echo '<th>'.get_lang('Progress')."</th>";
  115. echo '<th width="240px">'.get_lang('AuthoringOptions')."</th>";
  116. } else {
  117. echo '<th width="50%">'.get_lang('Title').'</th>';
  118. echo '<th>'.get_lang('Progress')."</th>";
  119. }
  120. echo '</tr>';
  121. /* DISPLAY SCORM LIST */
  122. $list = new LearnpathList(api_get_user_id());
  123. $flat_list = $list->get_flat_list();
  124. //var_dump($flat_list);
  125. if (is_array($flat_list)) {
  126. $test_mode = api_get_setting('server_type');
  127. $max = count($flat_list);
  128. $counter = 0;
  129. $current = 0;
  130. $autolunch_exists = false;
  131. foreach ($flat_list as $id => $details) {
  132. // Validacion when belongs to a session
  133. $session_img = api_get_session_image($details['lp_session'], $_user['status']);
  134. if (!$is_allowed_to_edit && $details['lp_visibility'] == 0) {
  135. // This is a student and this path is invisible, skip.
  136. continue;
  137. }
  138. // Check if the learnpath is visible for student.
  139. if (!$is_allowed_to_edit && !learnpath::is_lp_visible_for_student($id, api_get_user_id())) {
  140. continue;
  141. }
  142. $start_time = $end_time = '';
  143. if (!$is_allowed_to_edit) {
  144. $time_limits = false;
  145. //This is an old LP (from a migration 1.8.7) so we do nothing
  146. 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')) {
  147. $time_limits = false;
  148. }
  149. //Checking if expired_on is ON
  150. if ($details['expired_on'] != '' && $details['expired_on'] != '0000-00-00 00:00:00') {
  151. $time_limits = true;
  152. }
  153. if ($time_limits) {
  154. // check if start time
  155. if (!empty($details['publicated_on']) && $details['publicated_on'] != '0000-00-00 00:00:00' &&
  156. !empty($details['expired_on']) && $details['expired_on'] != '0000-00-00 00:00:00') {
  157. $start_time = api_strtotime($details['publicated_on'],'UTC');
  158. $end_time = api_strtotime($details['expired_on'],'UTC');
  159. $now = time();
  160. $is_actived_time = false;
  161. if ($now > $start_time && $end_time > $now ) {
  162. $is_actived_time = true;
  163. }
  164. if (!$is_actived_time) {
  165. continue;
  166. }
  167. }
  168. }
  169. $start_time = $end_time = '';
  170. } else {
  171. if (!empty($details['publicated_on'])) {
  172. $start_time = api_convert_and_format_date($details['publicated_on'], DATE_TIME_FORMAT_LONG);
  173. }
  174. if (!empty($details['expired_on'])) {
  175. $end_time = api_convert_and_format_date($details['expired_on'], DATE_TIME_FORMAT_LONG);
  176. }
  177. }
  178. $counter++;
  179. if (($counter % 2) == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; }
  180. $url_start_lp = 'lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$id;
  181. $name = Security::remove_XSS($details['lp_name']);
  182. if ($is_allowed_to_edit) {
  183. $dsp_desc = '<em>'.$details['lp_maker'].'</em> &nbsp;'.$details['lp_proximity'].' '.(learnpath::is_lp_visible_for_student($id, api_get_user_id())?'':' - ('.get_lang('LPNotVisibleToStudent').')');
  184. $extra = '<br /><font color="#999"><i>'.$dsp_desc .'</i></font>';
  185. }
  186. $image='<img src="../img/icons/22/learnpath.png" border="0" align="absmiddle" alt="' . $name . '">';
  187. $my_title = $name;
  188. if ($details['lp_visibility'] == 0 ) {
  189. $my_title = Display::tag('font', $name, array('style'=>'color:grey'));
  190. }
  191. $dsp_line = '<tr align="center" class="'.$oddclass.'">'.
  192. '<td align="left" valign="top">' .
  193. '<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_lp.'">' .
  194. $image . '</a></div><a href="'.$url_start_lp.'">' . $my_title . '</a>' . $session_img .$extra.
  195. "</td>";
  196. //$dsp_desc='<td>'.$details['lp_desc'].'</td>'."\n";
  197. $dsp_desc = '';
  198. $dsp_export = '';
  199. $dsp_edit = '';
  200. $dsp_build = '';
  201. $dsp_edit_close = '';
  202. $dsp_delete = '';
  203. $dsp_visible = '';
  204. $dsp_default_view = '';
  205. $dsp_debug = '';
  206. $dsp_order = '';
  207. // Select course theme.
  208. if (!empty($platform_theme)) {
  209. $mystyle = $platform_theme;
  210. }
  211. if (!empty($user_theme)) {
  212. $mystyle = $user_theme;
  213. }
  214. if (!empty($mycoursetheme)) {
  215. $mystyle = $mycoursetheme;
  216. }
  217. $lp_theme_css = $mystyle;
  218. if ($display_progress_bar) {
  219. if ($is_allowed_to_edit) {
  220. $dsp_progress = '<td>'.learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id()).'</td>';
  221. } else {
  222. $dsp_progress = '<td><div style="width:125px">'.learnpath::get_progress_bar('%',learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id())).'</div></td>';
  223. }
  224. } else {
  225. $dsp_progress = '<td style="padding-top:1em;"><div style="width:125px">'.learnpath::get_db_progress($id, api_get_user_id(), 'both','',false, api_get_session_id()).'</div></td>';
  226. }
  227. if ($is_allowed_to_edit) {
  228. /*
  229. if ($current_session == $details['lp_session']) {
  230. $dsp_desc = '<td valign="middle" style="color: grey; padding-top:1em;"><em>'.$details['lp_maker'].'</em> &nbsp;&nbsp; '.$details['lp_proximity'].' &nbsp;&nbsp; '.$details['lp_encoding'].'<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$id.'">&nbsp;&nbsp;<img src="../img/edit.gif" border="0" title="'.get_lang('_edit_learnpath').'"></a></td>'."\n";
  231. } else {
  232. $dsp_desc = '<td valign="middle" style="color: grey; padding-top:1em;"><em>'.$details['lp_maker'].'</em> &nbsp;&nbsp; '.$details['lp_proximity'].' &nbsp;&nbsp; '.$details['lp_encoding'].'<img src="../img/edit_na.gif" border="0" title="'.get_lang('_edit_learnpath').'"></td>'." ";
  233. }
  234. */
  235. /* // Deprecated code, Chamilo 1.8.8.
  236. $dsp_desc = '<td valign="middle" style="color: grey; padding-top:1em;"><em>'.$details['lp_maker'].'</em> &nbsp;&nbsp; '.$details['lp_proximity'].' &nbsp;&nbsp; '.$details['lp_encoding'].'</td>'."\n";
  237. */
  238. //$dsp_desc = '<td valign="middle" style="color: grey; padding-top:1em;"><em>'.$details['lp_maker'].'</em> &nbsp;&nbsp; '.$details['lp_proximity'].'<br />'.(learnpath::is_lp_visible_for_student($id,api_get_user_id())?'':'('.get_lang('LPNotVisibleToStudent').')').'</td>'."\n";
  239. /* Export */
  240. // Export is inside "Edit"
  241. // export not available for normal lps yet
  242. /*if ($details['lp_type'] == 1) {
  243. $dsp_export = '<td align="center">' .
  244. "<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" .
  245. "<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
  246. "</a>";
  247. } elseif ($details['lp_type'] == 2) {
  248. $dsp_export = '<td align="center">' .
  249. "<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".replace_dangerous_char($name,'strict').".zip'>" .
  250. "<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
  251. "</a>";
  252. } else {
  253. $dsp_export = '<td align="center">' .
  254. //"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" .
  255. "<img src=\"../img/cd_gray.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
  256. //"</a>";
  257. }*/
  258. /* Edit title and description */
  259. $dsp_edit = '<td align="center">';
  260. $dsp_edit_close = '</td>';
  261. // EDIT LP
  262. if ($current_session == $details['lp_session']) {
  263. $dsp_edit_lp = '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$id.'">'.Display::return_icon('settings.png', get_lang('CourseSettings'),'','22').'</a>';
  264. } else {
  265. $dsp_edit_lp = Display::return_icon('settings_na.png', get_lang('CourseSettings'),'','22');
  266. }
  267. // BUILD
  268. if ($current_session == $details['lp_session']) {
  269. if ($details['lp_type'] == 1 || $details['lp_type'] == 2) {
  270. $dsp_build = '<a href="lp_controller.php?'.api_get_cidreq().'&amp;action=build&amp;lp_id='.$id.'">'.Display::return_icon('edit.png', get_lang('_edit_learnpath'),'','22').'</a>';
  271. } else {
  272. $dsp_build = Display::return_icon('edit_na.png', get_lang('_edit_learnpath'),'','22');
  273. }
  274. } else {
  275. $dsp_build = Display::return_icon('edit_na.png', get_lang('_edit_learnpath'),'','22');
  276. }
  277. /* VISIBILITY COMMAND */
  278. // 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).
  279. //if ($current_session == $details['lp_session']) {
  280. if ($details['lp_visibility'] == 0) {
  281. $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'),'','22')."</a>";
  282. } else {
  283. $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'),'','22')."</a>";
  284. }
  285. //} else {
  286. // $dsp_visible = '<img src="../img/invisible.gif" border="0" title="'.get_lang('Show').'" />';
  287. //}
  288. /* PUBLISH COMMAND */
  289. if ($current_session == $details['lp_session']) {
  290. if ($details['lp_published'] == "i") {
  291. $dsp_publish = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=v\">" .
  292. Display::return_icon('lp_publish_na.png', get_lang('_publish'),'','22')."</a>";
  293. } else {
  294. $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('_no_publish'),'','22')."</a>";
  295. }
  296. } else {
  297. $dsp_publish = Display::return_icon('lp_publish_na.png', get_lang('_no_publish'),'','22');
  298. }
  299. /* MULTIPLE ATTEMPTS */
  300. if ($current_session == $details['lp_session']) {
  301. if ($details['lp_prevent_reinit'] == 1) {
  302. $dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_reinit&lp_id='.$id.'">' .
  303. Display::return_icon('reload_na.png', get_lang('AllowMultipleAttempts'),'','22').'</a>';
  304. } else {
  305. $dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_reinit&lp_id='.$id.'">' .
  306. Display::return_icon('reload.png', get_lang('PreventMultipleAttempts'),'','22').'</a>';
  307. }
  308. } else {
  309. $dsp_reinit = Display::return_icon('reload_na.png', get_lang('AllowMultipleAttempts'),'','22');
  310. }
  311. /* FUll screen VIEW */
  312. if ($current_session == $details['lp_session']) {
  313. /* Default view mode settings (fullscreen/embedded) */
  314. if ($details['lp_view_mode'] == 'fullscreen') {
  315. $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
  316. Display::return_icon('view_fullscreen.png', get_lang('ViewModeFullScreen'),'','22').'</a>';
  317. } elseif ($details['lp_view_mode'] == 'embedded') {
  318. $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
  319. Display::return_icon('view_left_right.png', get_lang('ViewModeEmbedded'),'','22').'</a>';
  320. } elseif ($details['lp_view_mode'] == 'embedframe') {
  321. $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
  322. Display::return_icon('view_nofullscreen.png', get_lang('ViewModeEmbedFrame'),'','22').'</a>';
  323. }
  324. } else {
  325. if ($details['lp_view_mode'] == 'fullscreen'){
  326. $dsp_default_view = Display::return_icon('view_fullscreen_na.png', get_lang('ViewModeEmbedded'),'','22');
  327. }
  328. else{
  329. $dsp_default_view = Display::return_icon('view_left_right_na.png', get_lang('ViewModeEmbedded'),'','22');
  330. }
  331. }
  332. /* Increase SCORM recording */
  333. /*
  334. if ($details['lp_force_commit'] == 1) {
  335. $dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' .
  336. '<img src="../img/clock.gif" border="0" alt="Normal SCORM recordings" title="'.get_lang('MakeScormRecordingNormal').'"/>' .
  337. '</a>&nbsp;';
  338. }else{
  339. $dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' .
  340. '<img src="../img/clock_gray.gif" border="0" alt="Extra SCORM recordings" title="'.get_lang('MakeScormRecordingExtra').'"/>' .
  341. '</a>&nbsp;';
  342. }
  343. */
  344. /* DEBUG */
  345. if ($test_mode == 'test' or api_is_platform_admin()) {
  346. if ($details['lp_scorm_debug'] == 1) {
  347. $dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">' .
  348. Display::return_icon('bug.png', get_lang('HideDebug'),'','22').'</a>';
  349. }else{
  350. $dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">' .
  351. Display::return_icon('bug_na.png', get_lang('ShowDebug'),'','22').'</a>';
  352. }
  353. }
  354. /* Export */
  355. if ($details['lp_type'] == 1) {
  356. $dsp_disk =
  357. "<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" .
  358. "<img src=\"../img/icons/22/export_scorm.png\" border=\"0\" title=\"".get_lang('Export')."\">" .
  359. "</a>" .
  360. "";
  361. } elseif ($details['lp_type'] == 2) {
  362. $dsp_disk =
  363. "<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".replace_dangerous_char($name, 'strict').".zip'>" .
  364. "<img src=\"../img/icons/22/export_scorm.png\" border=\"0\" title=\"".get_lang('Export')."\">" .
  365. "</a>" .
  366. "";
  367. } else {
  368. $dsp_disk =
  369. //"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" .
  370. "<img src=\"../img/cd_gray.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . //"</a>" .
  371. "";
  372. }
  373. /* Auto Lunch LP code*/
  374. $lp_auto_lunch_icon = '';
  375. if (api_get_course_setting('enable_lp_auto_launch') == 1) {
  376. if ($details['autolaunch'] == 1 && $autolunch_exists == false) {
  377. $autolunch_exists = true;
  378. $lp_auto_lunch_icon = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=auto_launch&status=0&lp_id='.$id.'">
  379. <img src="../img/launch.png" border="0" title="'.get_lang('DisableLPAutoLaunch').'" /></a>';
  380. } else {
  381. $lp_auto_lunch_icon = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=auto_launch&status=1&lp_id='.$id.'">
  382. <img src="../img/launch_na.png" border="0" title="'.get_lang('EnableLPAutoLaunch').'" /></a>';
  383. }
  384. }
  385. if (api_get_setting('pdf_export_watermark_enable') == 'true') {
  386. $export_icon = ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&lp_id='.$id.'">
  387. '.Display::return_icon('pdf.png', get_lang('ExportToPDF'),'','22').'</a>';
  388. }
  389. /* DELETE COMMAND */
  390. if ($current_session == $details['lp_session']) {
  391. $dsp_delete = "<a href=\"lp_controller.php?".api_get_cidreq()."&action=delete&lp_id=$id\" " .
  392. "onclick=\"javascript: return confirmation('".addslashes($name)."');\">" .
  393. Display::return_icon('delete.png', get_lang('_delete_learnpath'),'','22').'</a>';
  394. } else {
  395. $dsp_delete = Display::return_icon('delete_na.png', get_lang('_delete_learnpath'),'','22');
  396. }
  397. /* COLUMN ORDER */
  398. // Only active while session mode is not active
  399. if ($current_session == 0) {
  400. if ($details['lp_display_order'] == 1 && $max != 1) {
  401. $dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">
  402. '.Display::return_icon('down.png', get_lang('MoveDown'),'','22').'</a>
  403. <img src="../img/blanco.png" border="0" alt="" title="" />';
  404. } elseif ($current == $max-1 && $max != 1) {
  405. $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.'">
  406. '.Display::return_icon('up.png', get_lang('MoveUp'),'','22').'</a>';
  407. } elseif ($max == 1) {
  408. $dsp_order = '';
  409. } else {
  410. $dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">' .
  411. Display::return_icon('down.png', get_lang('MoveDown'),'','22').'</a>';
  412. $dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">' .
  413. Display::return_icon('up.png', get_lang('MoveUp'),'','22').'</a>';
  414. }
  415. }
  416. if ($is_allowed_to_edit) {
  417. $start_time = Display::tag('td', Display::div($start_time, array('class'=>'small')));
  418. $end_time = Display::tag('td', Display::div($end_time, array('class'=>'small')));
  419. } else {
  420. $start_time = $end_time= '';
  421. }
  422. } // end if ($is_allowedToEdit)
  423. 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.$dsp_default_view.$dsp_debug.$dsp_disk.$lp_auto_lunch_icon.$export_icon.$dsp_delete.$dsp_order.$dsp_edit_close;
  424. echo "</tr>";
  425. $current ++; //counter for number of elements treated
  426. } // end foreach ($flat_list)
  427. // TODO: Erint some user-friendly message if counter is still = 0 to tell nothing can be displayd yet.
  428. } // end if ( is_array($flat_list)
  429. echo "</table>";
  430. echo "<br /><br />";
  431. /* FOOTER */
  432. Display::display_footer();