lp_list.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  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 language='javascript' type='text/javascript'>
  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. //api_display_tool_title($nameTools);
  51. /* Introduction section (editable by course admins) */
  52. Display::display_introduction_section(TOOL_LEARNPATH, array(
  53. 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
  54. 'CreateDocumentDir' => '../../courses/'.api_get_course_path().'/document/',
  55. 'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
  56. )
  57. );
  58. $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
  59. if ($is_allowed_to_edit) {
  60. /* DIALOG BOX SECTION */
  61. if (!empty($dialog_box)) {
  62. switch ($_GET['dialogtype']) {
  63. case 'confirmation':
  64. Display::display_confirmation_message($dialog_box);
  65. break;
  66. case 'error':
  67. Display::display_error_message($dialog_box);
  68. break;
  69. case 'warning':
  70. Display::display_warning_message($dialog_box);
  71. break;
  72. default:
  73. Display::display_normal_message($dialog_box);
  74. break;
  75. }
  76. }
  77. if (api_failure::get_last_failure()) {
  78. Display::display_normal_message(api_failure::get_last_failure());
  79. }
  80. echo '<div class="actions">';
  81. echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_lp">'.Display::return_icon('new_learnpath.png', get_lang('_add_learnpath'),'',ICON_SIZE_MEDIUM).'</a>' .
  82. str_repeat('&nbsp;', 3).
  83. '<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>';
  84. if (api_get_setting('service_ppt2lp', 'active') == 'true') {
  85. echo str_repeat('&nbsp;', 3).'<a href="../upload/upload_ppt.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'">
  86. '.Display::return_icon('import_powerpoint.png', get_lang('PowerPointConvert'),'',ICON_SIZE_MEDIUM).'</a>';
  87. //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>';
  88. }
  89. echo '</div>';
  90. }
  91. /* DISPLAY SCORM LIST */
  92. $list = new LearnpathList(api_get_user_id());
  93. $flat_list = $list->get_flat_list();
  94. if (!empty($flat_list)) {
  95. echo '<table width="100%" border="0" cellspacing="2" class="data_table">';
  96. $is_allowed_to_edit ? $colspan = 9 : $colspan = 3;
  97. if (!empty($curDirPath)) {
  98. if (substr($curDirPath, 1, 1) == '/') {
  99. $tmpcurDirPath=substr($curDirPath,1,strlen($curDirPath));
  100. } else {
  101. $tmpcurDirPath = $curDirPath;
  102. }
  103. ?>
  104. <!-- current dir name -->
  105. <tr>
  106. <td colspan="<?php echo $colspan; ?>" align="left" bgcolor="#4171B5">
  107. <img src="../img/opendir.gif" align="absbottom" vspace="2" hspace="3" alt="open_dir" />
  108. <font color="#ffffff"><b><?php echo $tmpcurDirPath; ?></b></font>
  109. </td>
  110. </tr>
  111. <?php
  112. }
  113. /* CURRENT DIRECTORY */
  114. echo '<tr>';
  115. if ($is_allowed_to_edit) {
  116. echo '<th width="50%">'.get_lang('Title').'</th>';
  117. echo '<th>'.get_lang('PublicationDate').'</th>';
  118. echo '<th>'.get_lang('ExpirationDate').'</th>';
  119. echo '<th>'.get_lang('Progress')."</th>";
  120. echo '<th width="240px">'.get_lang('AuthoringOptions')."</th>";
  121. } else {
  122. echo '<th width="50%">'.get_lang('Title').'</th>';
  123. echo '<th>'.get_lang('Progress')."</th>";
  124. echo '<th>'.get_lang('Actions')."</th>";
  125. }
  126. echo '</tr>';
  127. $test_mode = api_get_setting('server_type');
  128. $max = count($flat_list);
  129. $counter = 0;
  130. $current = 0;
  131. $autolunch_exists = false;
  132. foreach ($flat_list as $id => $details) {
  133. // Validacion when belongs to a session
  134. $session_img = api_get_session_image($details['lp_session'], $_user['status']);
  135. if (!$is_allowed_to_edit && $details['lp_visibility'] == 0) {
  136. // This is a student and this path is invisible, skip.
  137. continue;
  138. }
  139. // Check if the learnpath is visible for student.
  140. if (!$is_allowed_to_edit && !learnpath::is_lp_visible_for_student($id, api_get_user_id())) {
  141. continue;
  142. }
  143. $start_time = $end_time = '';
  144. if (!$is_allowed_to_edit) {
  145. $time_limits = false;
  146. //This is an old LP (from a migration 1.8.7) so we do nothing
  147. 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')) {
  148. $time_limits = false;
  149. }
  150. //Checking if expired_on is ON
  151. if ($details['expired_on'] != '' && $details['expired_on'] != '0000-00-00 00:00:00') {
  152. $time_limits = true;
  153. }
  154. if ($time_limits) {
  155. // check if start time
  156. if (!empty($details['publicated_on']) && $details['publicated_on'] != '0000-00-00 00:00:00' &&
  157. !empty($details['expired_on']) && $details['expired_on'] != '0000-00-00 00:00:00') {
  158. $start_time = api_strtotime($details['publicated_on'],'UTC');
  159. $end_time = api_strtotime($details['expired_on'],'UTC');
  160. $now = time();
  161. $is_actived_time = false;
  162. if ($now > $start_time && $end_time > $now ) {
  163. $is_actived_time = true;
  164. }
  165. if (!$is_actived_time) {
  166. continue;
  167. }
  168. }
  169. }
  170. $start_time = $end_time = '';
  171. } else {
  172. if (!empty($details['publicated_on'])) {
  173. $start_time = api_convert_and_format_date($details['publicated_on'], DATE_TIME_FORMAT_LONG);
  174. }
  175. if (!empty($details['expired_on'])) {
  176. $end_time = api_convert_and_format_date($details['expired_on'], DATE_TIME_FORMAT_LONG);
  177. }
  178. }
  179. $counter++;
  180. if (($counter % 2) == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; }
  181. $url_start_lp = 'lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$id;
  182. $name = Security::remove_XSS($details['lp_name']);
  183. if ($is_allowed_to_edit) {
  184. //&nbsp;'.$details['lp_proximity'].'
  185. $dsp_desc = '<em>'.$details['lp_maker'].'</em> '.(learnpath::is_lp_visible_for_student($id, api_get_user_id())?'':' - ('.get_lang('LPNotVisibleToStudent').')');
  186. $extra = '<div class ="lp_content_type_label">'.$dsp_desc .'</div>';
  187. }
  188. /*$image = '<img src="../img/icons/22/learnpath.png" border="0" align="absmiddle" alt="' . $name . '">';
  189. <div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_lp.'">' .
  190. $image . '</a></div>*/
  191. $my_title = $name;
  192. if ($details['lp_visibility'] == 0 ) {
  193. $my_title = Display::tag('font', $name, array('style'=>'color:grey'));
  194. }
  195. $dsp_line = '<tr align="center" class="'.$oddclass.'">'.
  196. '<td align="left" valign="top">'.Display::return_icon('learnpath.png', get_lang('LPName'),'',ICON_SIZE_SMALL).'<a href="'.$url_start_lp.'">' . $my_title . '</a>' . $session_img .$extra."</td>";
  197. //$dsp_desc='<td>'.$details['lp_desc'].'</td>'."\n";
  198. $dsp_desc = '';
  199. $dsp_export = '';
  200. $dsp_edit = '';
  201. $dsp_build = '';
  202. $dsp_edit_close = '';
  203. $dsp_delete = '';
  204. $dsp_visible = '';
  205. $dsp_default_view = '';
  206. $dsp_debug = '';
  207. $dsp_order = '';
  208. $progress = learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id());
  209. if ($is_allowed_to_edit) {
  210. $dsp_progress = '<td>'.$progress.'</td>';
  211. } else {
  212. $dsp_progress = '<td>'.learnpath::get_progress_bar('%',learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id())).'</td>';
  213. }
  214. $dsp_edit = '<td class="td_actions">';
  215. $dsp_edit_close = '</td>';
  216. if ($is_allowed_to_edit) {
  217. /*
  218. if ($current_session == $details['lp_session']) {
  219. $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";
  220. } else {
  221. $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>'." ";
  222. }
  223. */
  224. /* // Deprecated code, Chamilo 1.8.8.
  225. $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";
  226. */
  227. //$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";
  228. /* Export */
  229. // Export is inside "Edit"
  230. // export not available for normal lps yet
  231. /*if ($details['lp_type'] == 1) {
  232. $dsp_export = '<td align="center">' .
  233. "<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" .
  234. "<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
  235. "</a>";
  236. } elseif ($details['lp_type'] == 2) {
  237. $dsp_export = '<td align="center">' .
  238. "<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".replace_dangerous_char($name,'strict').".zip'>" .
  239. "<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
  240. "</a>";
  241. } else {
  242. $dsp_export = '<td align="center">' .
  243. //"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" .
  244. "<img src=\"../img/cd_gray.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
  245. //"</a>";
  246. }*/
  247. // EDIT LP
  248. if ($current_session == $details['lp_session']) {
  249. $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>';
  250. } else {
  251. $dsp_edit_lp = Display::return_icon('settings_na.png', get_lang('CourseSettings'),'',ICON_SIZE_SMALL);
  252. }
  253. // BUILD
  254. if ($current_session == $details['lp_session']) {
  255. if ($details['lp_type'] == 1 || $details['lp_type'] == 2) {
  256. $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'),'',ICON_SIZE_SMALL).'</a>';
  257. } else {
  258. $dsp_build = Display::return_icon('edit_na.png', get_lang('_edit_learnpath'),'',ICON_SIZE_SMALL);
  259. }
  260. } else {
  261. $dsp_build = Display::return_icon('edit_na.png', get_lang('_edit_learnpath'),'',ICON_SIZE_SMALL);
  262. }
  263. /* VISIBILITY COMMAND */
  264. // 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).
  265. //if ($current_session == $details['lp_session']) {
  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. //} else {
  272. // $dsp_visible = '<img src="../img/invisible.gif" border="0" title="'.get_lang('Show').'" />';
  273. //}
  274. /* PUBLISH COMMAND */
  275. if ($current_session == $details['lp_session']) {
  276. if ($details['lp_published'] == "i") {
  277. $dsp_publish = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=v\">" .
  278. Display::return_icon('lp_publish_na.png', get_lang('_publish'),'',ICON_SIZE_SMALL)."</a>";
  279. } else {
  280. $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'),'',ICON_SIZE_SMALL)."</a>";
  281. }
  282. } else {
  283. $dsp_publish = Display::return_icon('lp_publish_na.png', get_lang('_no_publish'),'',ICON_SIZE_SMALL);
  284. }
  285. /* MULTIPLE ATTEMPTS OR SERIOUS GAME MODE
  286. SERIOUSGAME MODE is a special mode where :
  287. * If a user exits the learning path before finishing it, he comes back where he left next time he tries
  288. * When lp status is completed, user can still modify the attempt (adds/time change score, and browse it)
  289. * It is thus a mix betwenn multiple attempt and mono attempt
  290. */
  291. if ($current_session == $details['lp_session']) {
  292. if ($details['seriousgame_mode'] == 1 && $details['lp_prevent_reinit'] == 1) { //seriousgame mode | next = single
  293. $dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_attempt_mode&lp_id='.$id.'">' .
  294. Display::return_icon('reload.png', get_lang('PreventMultipleAttempts'),'',ICON_SIZE_SMALL).
  295. '</a>';
  296. }
  297. if ($details['seriousgame_mode'] == 0 && $details['lp_prevent_reinit'] == 1) { //single mode | next = multiple
  298. $dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_attempt_mode&lp_id='.$id.'">' .
  299. Display::return_icon('reload_na.png', get_lang('AllowMultipleAttempts'),'',ICON_SIZE_SMALL).
  300. '</a>';
  301. }
  302. if ($details['seriousgame_mode'] == 0 && $details['lp_prevent_reinit'] == 0) { //multiple mode | next = seriousgame
  303. $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).
  304. '</a>';
  305. }
  306. } else {
  307. $dsp_reinit = Display::return_icon('reload_na.png', get_lang('AllowMultipleAttempts'),'',ICON_SIZE_SMALL);
  308. }
  309. /* FUll screen VIEW */
  310. if ($current_session == $details['lp_session']) {
  311. /* Default view mode settings (fullscreen/embedded) */
  312. if ($details['lp_view_mode'] == 'fullscreen') {
  313. $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
  314. Display::return_icon('view_fullscreen.png', get_lang('ViewModeFullScreen'),'',ICON_SIZE_SMALL).'</a>';
  315. } elseif ($details['lp_view_mode'] == '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. } elseif ($details['lp_view_mode'] == 'embedframe') {
  319. $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
  320. Display::return_icon('view_nofullscreen.png', get_lang('ViewModeEmbedFrame'),'',ICON_SIZE_SMALL).'</a>';
  321. }
  322. } else {
  323. if ($details['lp_view_mode'] == 'fullscreen'){
  324. $dsp_default_view = Display::return_icon('view_fullscreen_na.png', get_lang('ViewModeEmbedded'),'',ICON_SIZE_SMALL);
  325. }
  326. else{
  327. $dsp_default_view = Display::return_icon('view_left_right_na.png', get_lang('ViewModeEmbedded'),'',ICON_SIZE_SMALL);
  328. }
  329. }
  330. /* Increase SCORM recording */
  331. /*
  332. if ($details['lp_force_commit'] == 1) {
  333. $dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' .
  334. '<img src="../img/clock.gif" border="0" alt="Normal SCORM recordings" title="'.get_lang('MakeScormRecordingNormal').'"/>' .
  335. '</a>&nbsp;';
  336. }else{
  337. $dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' .
  338. '<img src="../img/clock_gray.gif" border="0" alt="Extra SCORM recordings" title="'.get_lang('MakeScormRecordingExtra').'"/>' .
  339. '</a>&nbsp;';
  340. }
  341. */
  342. /* DEBUG */
  343. if ($test_mode == 'test' or api_is_platform_admin()) {
  344. if ($details['lp_scorm_debug'] == 1) {
  345. $dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">' .
  346. Display::return_icon('bug.png', get_lang('HideDebug'),'',ICON_SIZE_SMALL).'</a>';
  347. }else{
  348. $dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">' .
  349. Display::return_icon('bug_na.png', get_lang('ShowDebug'),'',ICON_SIZE_SMALL).'</a>';
  350. }
  351. }
  352. /* Export */
  353. if ($details['lp_type'] == 1) {
  354. $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");
  355. } elseif ($details['lp_type'] == 2) {
  356. $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");
  357. } else {
  358. $dsp_disk = Display::return_icon('cd_gray.gif', get_lang('Export'), array(), ICON_SIZE_SMALL);
  359. }
  360. //Copy
  361. $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");
  362. /* Auto Lunch LP code*/
  363. $lp_auto_lunch_icon = '';
  364. if (api_get_course_setting('enable_lp_auto_launch') == 1) {
  365. if ($details['autolaunch'] == 1 && $autolunch_exists == false) {
  366. $autolunch_exists = true;
  367. $lp_auto_lunch_icon = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=auto_launch&status=0&lp_id='.$id.'">
  368. <img src="../img/launch.png" border="0" title="'.get_lang('DisableLPAutoLaunch').'" /></a>';
  369. } else {
  370. $lp_auto_lunch_icon = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=auto_launch&status=1&lp_id='.$id.'">
  371. <img src="../img/launch_na.png" border="0" title="'.get_lang('EnableLPAutoLaunch').'" /></a>';
  372. }
  373. }
  374. //if (api_get_setting('pdf_export_watermark_enable') == 'true') {
  375. $export_icon = ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&lp_id='.$id.'">
  376. '.Display::return_icon('pdf.png', get_lang('ExportToPDFOnlyHTMLAndImages'),'',ICON_SIZE_SMALL).'</a>';
  377. //}
  378. /* DELETE COMMAND */
  379. if ($current_session == $details['lp_session']) {
  380. $dsp_delete = "<a href=\"lp_controller.php?".api_get_cidreq()."&action=delete&lp_id=$id\" " .
  381. "onclick=\"javascript: return confirmation('".addslashes($name)."');\">" .
  382. Display::return_icon('delete.png', get_lang('_delete_learnpath'),'',ICON_SIZE_SMALL).'</a>';
  383. } else {
  384. $dsp_delete = Display::return_icon('delete_na.png', get_lang('_delete_learnpath'),'',ICON_SIZE_SMALL);
  385. }
  386. /* COLUMN ORDER */
  387. // Only active while session mode is not active
  388. if ($current_session == 0) {
  389. if ($details['lp_display_order'] == 1 && $max != 1) {
  390. $dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">
  391. '.Display::return_icon('down.png', get_lang('MoveDown'),'',ICON_SIZE_SMALL).'</a>
  392. <img src="../img/blanco.png" border="0" alt="" title="" />';
  393. } elseif ($current == $max-1 && $max != 1) {
  394. $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.'">
  395. '.Display::return_icon('up.png', get_lang('MoveUp'),'',ICON_SIZE_SMALL).'</a>';
  396. } elseif ($max == 1) {
  397. $dsp_order = '';
  398. } else {
  399. $dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">' .
  400. Display::return_icon('down.png', get_lang('MoveDown'),'',ICON_SIZE_SMALL).'</a>';
  401. $dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">' .
  402. Display::return_icon('up.png', get_lang('MoveUp'),'',ICON_SIZE_SMALL).'</a>';
  403. }
  404. }
  405. if ($is_allowed_to_edit) {
  406. $start_time = Display::tag('td', Display::div($start_time, array('class'=>'small')));
  407. $end_time = Display::tag('td', Display::div($end_time, array('class'=>'small')));
  408. } else {
  409. $start_time = $end_time= '';
  410. }
  411. } else { // end if ($is_allowedToEdit)
  412. //Student
  413. $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>';
  414. }
  415. 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.
  416. $dsp_default_view.$dsp_debug.$dsp_disk.$copy.$lp_auto_lunch_icon.$export_icon.$dsp_delete.$dsp_order.$dsp_edit_close;
  417. echo "</tr>";
  418. $current ++; //counter for number of elements treated
  419. } // end foreach ($flat_list)
  420. // TODO: Erint some user-friendly message if counter is still = 0 to tell nothing can be displayd yet.
  421. echo "</table>";
  422. } else {
  423. if ($is_allowed_to_edit) {
  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('_add_learnpath'), api_get_self().'?'.api_get_cidreq().'&action=add_lp' , array('class' => 'btn'));
  429. echo '</div>';
  430. echo '</div>';
  431. }
  432. }
  433. $course_info = api_get_course_info();
  434. $result = learnpath::generate_learning_path_folder($course_info);
  435. //Deleting the objects
  436. Session::erase('oLP');
  437. Session::erase('lpobject');
  438. Display::display_footer();