123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324 |
- <?php //$id:$
- /*
- ==============================================================================
- Dokeos - elearning and course management software
- Copyright (c) 2004-2006 Dokeos S.A.
- Copyright (c) 2004 Denes Nagy
- Copyright (c) 2003 University of Ghent (UGent)
- Copyright (c) 2001 Universite catholique de Louvain (UCL)
- For a full list of contributors, see "credits.txt".
- The full license can be read in "license.txt".
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
- See the GNU General Public License for more details.
- Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
- ==============================================================================
- */
- /**
- ==============================================================================
- * This file was origially the copy of document.php, but many modifications happened since then ;
- * the direct file view is not any more needed, if the user uploads a scorm zip file, a directory
- * will be automatically created for it, and the files will be uncompressed there for example ;
- *
- * @package dokeos.learnpath
- * @author Yannick Warnier <ywarnier@beeznest.org>
- ==============================================================================
- */
- /**
- * Script
- */
- if(empty($lp_controller_touched) || $lp_controller_touched!=1){
- header('location: lp_controller.php?action=list');
- }
- require_once('back_compat.inc.php');
- $courseDir = api_get_course_path().'/scorm';
- $baseWordDir = $courseDir;
- require_once('learnpathList.class.php');
- require_once('learnpath.class.php');
- require_once('learnpathItem.class.php');
- //$charset = 'UTF-8';
- //$charset = 'ISO-8859-1';
- /**
- * Display initialisation and security checks
- */
- //extra javascript functions for in html head:
- $htmlHeadXtra[] =
- "<script language='javascript' type='text/javascript'>
- function confirmation (name)
- {
- if (confirm(\" ".get_lang('AreYouSureToDelete')." \"+ name + \" ?\"))
- {return true;}
- else
- {return false;}
- }
- </script>";
- $nameTools = get_lang("Doc");
- event_access_tool(TOOL_LEARNPATH);
- if (! $is_allowed_in_course) api_not_allowed();
- /**
- * Display
- */
- Display::display_header($nameTools,"Path");
- //api_display_tool_title($nameTools);
- /*
- -----------------------------------------------------------
- Introduction section
- (editable by course admins)
- -----------------------------------------------------------
- */
- if($my_version=='1.8'){
- Display::display_introduction_section(TOOL_LEARNPATH);
- }else{
- api_introductionsection(TOOL_LEARNPATH);
- }
- if(api_is_allowed_to_edit())
- {
- /*--------------------------------------
- DIALOG BOX SECTION
- --------------------------------------*/
- if ($dialog_box)
- {
- Display::display_normal_message($dialog_box);
- }
- if (api_failure::get_last_failure())
- {
- Display::display_normal_message(api_failure::get_last_failure());
- }
-
- if($_REQUEST['action']=='add_lp' && !($new_lp_id>0)){
- require('lp_add.php');
- }
- include('content_makers.inc.php');
- echo '<table border="0" cellspacing="2" cellpadding="4">
- <tr>
- <td style="padding-bottom: 15px;">' .
- '<a href="'.$_SERVER['PHP_SELF'].'?action=add_lp">'.
- '<img src="../img/scormbuilder.gif" border="0" align="absmiddle" alt="scormbuilder">'.get_lang('_add_learnpath').
- '</a>' .
- str_repeat(' ',10)."</td>".
- "<td>" .
- /*--------------------------------------
- UPLOAD SECTION - displays file upload box
- --------------------------------------*/
- '<form name="ext_upload" action="../upload/index.php" method="post">' .
- '<input type="hidden" name="curdirpath" value="/">' .
- '<input type="hidden" name="tool" value="'.TOOL_LEARNPATH.'">' .
- '<img src="../img/scormbuilder.gif" border="0" align="absmiddle" alt="scormbuilder" style="margin-top:-10px;">'.
- '<input type="submit" name="upload" value="Upload">' .
- '</form>'.
- "</td>" .
- "</tr>
- </table>";
- }
- echo '<table width="100%" border="0" cellspacing="2" class="data_table">';
- api_is_allowed_to_edit() ? $colspan = 9 : $colspan = 3;
- /*
- if ($curDirName) // if the $curDirName is empty, we're in the root point and we can't go to a parent dir
- {
- ?>
- <!-- parent dir -->
- <a href="<?php echo $_SERVER['PHP_SELF'].'?'.api_get_cidreq().'&openDir='.$cmdParentDir.'&subdirs=yes'; ?>">
- <img src="../img/parent.gif" border="0" align="absbottom" hspace="5" alt="parent" />
- <?php echo get_lang("Up"); ?></a>
- <?php
- }
- */
- if ($curDirPath)
- {
- if(substr($curDirPath,1,1)=='/'){
- $tmpcurDirPath=substr($curDirPath,1,strlen($curDirPath));
- }else{
- $tmpcurDirPath = $curDirPath;
- }
- ?>
- <!-- current dir name -->
- <tr>
- <td colspan="<?php echo $colspan ?>" align="left" bgcolor="#4171B5">
- <img src="../img/opendir.gif" align="absbottom" vspace="2" hspace="3" alt="open_dir" />
- <font color="#ffffff"><b><?php echo $tmpcurDirPath ?></b></font>
- </td>
- </tr>
- <?php
- }
- /* CURRENT DIRECTORY */
- echo '<tr bgcolor="'.$color2.'" align="center" valign="top">';
- echo '<td width="30%"><b>'.get_lang("Name").'</b></td>'."\n" .
- '<td width="10%"><b>'.get_lang("progress")."</b></td>\n";
- if (api_is_allowed_to_edit())
- {
- echo "<td><b>",get_lang("Description"),"</b></td>\n" .
- "<td><b>",get_lang("ExportShort"),"</b></td>\n",
- '<td width="25%"><b>',get_lang("Modify"),"</b></td>\n";
- }
- echo "</tr>\n";
- /*--------------------------------------
- DISPLAY SCORM LIST
- --------------------------------------*/
- $list = new LearnpathList(api_get_user_id());
- $flat_list = $list->get_flat_list();
- //var_dump($flat_list);
- if (is_array($flat_list))
- {
- $counter = 0;
- foreach ($flat_list as $id => $details)
- {
- $counter++;
- if (($counter % 2)==0) { $oddclass="row_odd"; } else { $oddclass="row_even"; }
-
- $url_start_lp = 'lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$id;
- $name = $details['lp_name'];
- $image='<img src="../img/scorm_logo.gif" border="0" align="absmiddle" alt="scorm">'."\n";
- $dsp_line = '<tr align="center" class="'.$oddclass.'">'."\n" .
- '<td align="left" valign="middle"> ' .
- '<a href="'.$url_start_lp.'" '.$style.'>' .
- $image . '</a> <a href="'.$url_start_lp.'" '.$style.'>' . $name . '</a>' .
- "</td>\n";
- //$dsp_desc='<td>'.$details['lp_desc'].'</td>'."\n";
- $dsp_desc = '';
-
- $dsp_export = '';
- $dsp_edit = '';
- $dsp_delete = '';
- $dsp_visible = '';
- //$dsp_progress = '<td>'.learnpath::get_progress_bar('%',learnpath::get_db_progress($id,api_get_user_id()),'%').'</td>';
- //temporarily removed progress bar because of display problems
- $dsp_progress = '<td style="padding-top:1em;">'.learnpath::get_db_progress($id,api_get_user_id(),'both').'</td>';
- if(api_is_allowed_to_edit())
- {
- $dsp_desc = '<td valign="middle" style="color: grey; padding-top:1em;"><em>'.$details['lp_maker'].'</em> '.$details['lp_proximity'].' '.$details['lp_encoding'].'</td>'."\n";
- $fileExtension=explode('.',$dspFileName);
- $fileExtension=strtolower($fileExtension[sizeof($fileExtension)-1]);
-
- /* export */
- //export not available for normal lps yet
- if($details['lp_type']==1){
- $dsp_export = '<td align="center">' .
- //"<a href='".$_SERVER['PHP_SELF']."?".api_get_cidreq()."&action=export&lp_id=$id'>" .
- "<img src=\"../img/save_zip.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
- //"</a>" .
- "";
- }elseif($details['lp_type']==2){
- $dsp_export = '<td align="center">' .
- "<a href='".$_SERVER['PHP_SELF']."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".replace_dangerous_char($name,'strict').".zip'>" .
- "<img src=\"../img/save_zip.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
- "</a>" .
- "";
- }else{
- $dsp_export = '<td align="center">' .
- //"<a href='".$_SERVER['PHP_SELF']."?".api_get_cidreq()."&action=export&lp_id=$id'>" .
- "<img src=\"../img/save_zip.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
- //"</a>" .
- "";
- }
- /* edit title and description */
-
- $dsp_edit = '<td align="center">' .
- '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$id.'"><img src="../img/edit.gif" border="0" title="'.get_lang('_edit_learnpath').'"></a>';
-
- /* DELETE COMMAND */
- $dsp_delete = "<a href=\"lp_controller.php?".api_get_cidreq()."&action=delete&lp_id=$id\" " .
- "onClick=\"return confirmation('".addslashes($dspFileName)."');\">" .
- "<img src=\"../img/delete.gif\" border=\"0\" title=\"".get_lang('_delete_learnpath')."\" />" .
- "</a>";
-
- /* VISIBILITY COMMAND */
-
- if ($details['lp_visibility'] == "i")
- {
- $dsp_visible = "<a href=\"".$_SERVER['PHP_SELF']."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=v\">" .
- "<img src=\"../img/invisible.gif\" border=\"0\" title=\"".get_lang('_publish')."\" />" .
- "</a>" .
- "";
- }
- else
- {
- $dsp_visible = "<a href='".$_SERVER['PHP_SELF']."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=i'>" .
- "<img src=\"../img/visible.gif\" border=\"0\" title=\"".get_lang('_no_publish')."\" />" .
- "</a>".
- "";
- }
- /* Default view mode settings (fullscreen/embedded) */
- if($details['lp_view_mode'] == 'fullscreen'){
- $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
- '<img src="scorm_fullscreen.gif" border="0" alt="View mode: embedded" title="Make mode embedded"/>' .
- '</a>';
- }else{
- $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
- '<img src="scorm_embed.gif" border="0" alt="View mode: fullscreen" title="Make mode fullscreen"/>' .
- '</a>';
- }
- /* Increase SCORM recording */
- if($details['lp_force_commit'] == 1){
- $dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' .
- '<img src="scorm_extra.gif" border="0" alt="Normal SCORM recordings" title="Make SCORM recordings normal"/>' .
- '</a>';
- }else{
- $dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' .
- '<img src="scorm_normal.gif" border="0" alt="Extra SCORM recordings" title="Make SCORM recordings extra"/>' .
- '</a>';
- }
- if($details['lp_prevent_reinit']==1){
- $dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_reinit&lp_id='.$id.'">' .
- '<img src="scorm_no_reinit.gif" border="0" alt="Allow reinit" title="Allow multiple attempts"/>' .
- '</a>';
- }else{
- $dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_reinit&lp_id='.$id.'">' .
- '<img src="scorm_reinit.gif" border="0" alt="Prevent reinit" title="Prevent multiple attempts"/>' .
- '</a>';
- }
- if($details['lp_type']==1){
- $dsp_build = '<a href="lp_controller.php?'.api_get_cidreq().'&action=build&lp_id='.$id.'"><img src="scorm_build.gif" border="0" title="Build"></a>';
- }else{
- $dsp_build = '<img src="scorm_build_disabled.gif" border="0" title="Build">';
- }
- if($details['lp_scorm_debug']==1){
- $dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">' .
- '<img src="../img/info.gif" height="25px" width="25px" border="0" alt="Hide debug" title="Hide debug"/>' .
- '</a>';
- }else{
- $dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">' .
- '<img src="../img/info_na.gif" height="25px" width="25px" border="0" alt="Show debug" title="Show debug"/>' .
- '</a>';
- }
-
- } // end if($is_allowedToEdit)
- //echo $dsp_line.$dsp_desc.$dsp_export.$dsp_edit.$dsp_delete.$dsp_visible;
- echo $dsp_line.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_delete.$dsp_visible.$dsp_default_view.$dsp_force_commit.$dsp_build.$dsp_reinit.$dsp_debug;
- echo "</tr>\n";
-
- } // end foreach ($flat_list)
- //TODO print some user-friendly message if counter is still = 0 to tell nothing can be displayd yet
- }// end if ( is_array($flat_list)
- echo "</table>";
- echo "<br/><br/>";
- /*
- ==============================================================================
- FOOTER
- ==============================================================================
- */
- Display::display_footer();
- ?>
|