============================================================================== */ /** * Script */ // name of the language file that needs to be included $language_file = "scormdocument"; //flag to allow for anonymous user - needs to be set before global.inc.php $use_anonymous = true; require('back_compat.inc.php'); include('learnpath_functions.inc.php'); include_once('scorm.lib.php'); $courseDir = api_get_course_path().'/scorm'; $baseWordDir = $courseDir; require_once('learnpathList.class.php'); require_once('learnpath.class.php'); require_once('learnpathItem.class.php'); // storing the tables names in variables. $tbl_document = Database::get_course_table(TABLE_SCORMDOC); $tbl_learnpath_main = Database::get_course_table(TABLE_LEARNPATH_MAIN); $tbl_tool = Database::get_course_table(TABLE_TOOL_LIST); $default_visibility="v"; $show_description_field=0; /** * Display initialisation and security checks */ //extra javascript functions for in html head: $htmlHeadXtra[] = ""; // Define the 'doc.inc.php' as language file //$nameTools = get_lang("Doc"); // When GET['learnpath_id'] is defined, it means that // a learnpath has been chosen, so we redirect to // learnpath_handler - we possibly lose the $dialogBox warning here if(!empty($_GET['learnpath_id'])) { header('location:../learnpath/learnpath_handler.php?' .'learnpath_id='.$_GET['learnpath_id']); exit(); } event_access_tool(TOOL_LEARNPATH); if (! $is_allowed_in_course) api_not_allowed(); /** * Now checks have been done, prepare the data to be displayed */ if(!empty($openDir)) { //prevent going higher than allowed in the hierarchy //if the requested dir is found inside the base course dir, use course dir //error_log($courseDir." against ".$openDir,0); if((strstr($courseDir,$openDir)===false) and (strstr($openDir,'.')===false) ){ $curDirPath = $openDir; }else{ $curDirPath = $courseDir; } } else { $curDirPath= $courseDir; } if ($curDirPath == "/" || $curDirPath == "\\" || strstr($curDirPath, "..")) { $curDirPath =""; // manage the root directory problem /* * The strstr($curDirPath, "..") prevent malicious users to go to the root directory */ } $curDirName = basename($curDirPath); $parentDir = dirname($curDirPath); if ($parentDir == "/" || $parentDir == "\\") { $parentDir =""; // manage the root directory problem } /* Search infos in the DB about the current directory the user is in */ $result = mysql_query ("SELECT * FROM $tbl_document WHERE path LIKE '".$curDirPath."/%' AND path NOT LIKE '".$curDirPath."/%/%'"); if ($result) while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $attribute['path' ][] = $row['path' ]; $attribute['visibility'][] = $row['visibility']; $attribute['comment' ][] = $row['comment' ]; } $fileList = get_scorm_paths_from_dir($baseWorkDir.$curDirPath,$attribute); if(!isset($fileList)){ die("
Wrong directory !
Please contact your platform administrator.
"); } /* * Sort alphabetically the File list */ if (is_array($fileList) && count($fileList)>0) { array_multisort($fileList['type'], $fileList['name'], $fileList['size'], $fileList['date'], $fileList['comment'],$fileList['visibility']); } /*---------------------------------------- CHECK BASE INTEGRITY --------------------------------------*/ /* commented until we know what it's for if ( is_array($attribute) && ( count($attribute['path']) > 0 ) ) { $queryClause = ' WHERE path IN ( "'.implode('" , "' , $attribute['path']).'" )'; api_sql_query("DELETE FROM $tbl_document ".$queryClause,__FILE__,__LINE__); api_sql_query("DELETE FROM $tbl_document WHERE comment LIKE '' AND visibility LIKE 'v'",__FILE__,__LINE__); // The second query clean the DB 'in case of' empty records (no comment an visibility=v) // These kind of records should'nt be there, but we never know... } // end if sizeof($attribute['path']) > 0 */ unset($attribute); /** * Display */ Display::display_header($nameTools,"Path"); $dspCurDirName = htmlentities($curDirName); $cmdCurDirPath = rawurlencode($curDirPath); $cmdParentDir = rawurlencode($parentDir); $ob_string = ''; 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()) { /*-------------------------------------- UPLOAD SECTION - displays file upload box --------------------------------------*/ echo "", "

", "

", "", get_lang('DownloadFile')," : ", "", " ", "

"; /*-------------------------------------- DIALOG BOX SECTION --------------------------------------*/ if ($dialogBox) { Display::display_normal_message($dialogBox); } echo "", "
", "scormbuilder".get_lang('_add_learnpath')."    ", "", "",get_lang("CreateDir"),"
"; } echo ""; 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   "; echo "\n", "\n"; if (api_is_allowed_to_edit()) { echo "\n", "\n"; } echo "\n"; /*-------------------------------------- DISPLAY SCORM LIST --------------------------------------*/ if ($fileList) { $counter=0; while (list($fileKey, $fileName) = each ($fileList['name'])) { $counter++; if (($counter % 2)==0) { $oddclass="row_odd"; } else { $oddclass="row_even"; } if ($fileList['type'][$fileKey] == A_FILE) continue; // RH: added $dspFileName = htmlentities($fileName); $cmdFileName = rawurlencode($curDirPath."/".$fileName); if ($fileList['visibility'][$fileKey] == "i") { if (api_is_allowed_to_edit()) { $style=" class='invisible'"; } else { continue; // skip the display of this file } } else { $style=""; } $manifestRoute = $baseWorkDir.$curDirPath."/".$fileName.'/imsmanifest.xml'; $plantyndir1 = $baseWorkDir.$curDirPath."/".$fileName.'/LMS'; $plantyndir2 = $baseWorkDir.$curDirPath."/".$fileName.'/REF'; $plantyndir3 = $baseWorkDir.$curDirPath."/".$fileName.'/SCO'; $aiccdir = $baseWorkDir.$curDirPath."/".$fileName.'/aicc'; $indexRoute1 = $indexRoute2 = $indexRouteA = ''; if ((file_exists($plantyndir1)) and (file_exists($plantyndir2)) and (file_exists($plantyndir3))) { $indexRoute1 = $baseWorkDir.$curDirPath."/".$fileName.'/index.htm'; $indexRoute2 = $baseWorkDir.$curDirPath."/".$fileName.'/index.html'; } if (file_exists($aiccdir)) { $indexRouteA = $baseWorkDir.$curDirPath."/".$fileName.'/start.htm'; } if (file_exists($indexRoute1)) { $urlFileName = api_get_self().'?'.api_get_cidreq().'&openDir='.$cmdFileName.'&indexRoute=index.htm'; $image="scorm"; } elseif (file_exists($indexRoute2)) { $urlFileName = api_get_self().'?'.api_get_cidreq().'&openDir='.$cmdFileName.'&indexRoute=index.html'; $image="scorm"; } elseif (file_exists($indexRouteA)) { $urlFileName = api_get_self().'?'.api_get_cidreq().'&openDir='.$cmdFileName.'&indexRoute=start.htm'; $image="scorm"; } elseif (file_exists($manifestRoute)) { $urlFileName = api_get_self().'?'.api_get_cidreq().'&openDir='.$cmdFileName; $image="scorm"; } else { $urlFileName = api_get_self().'?'.api_get_cidreq().'&subdirs=yes&openDir='.$cmdFileName; $image="scorm"; } if ($curDirPath) { $sqlpath=$curDirPath."/".$fileList['name'][$fileKey].""; } else { $sqlpath="/".$fileList['name'][$fileKey].""; } $sql="SELECT name FROM $tbl_document WHERE ((path='$sqlpath') and (filetype='folder'))"; $result=api_sql_query($sql,__FILE__,__LINE__); $row=mysql_fetch_array($result); if ($row['name']) { $name=$row['name']; } else { $name=$dspFileName; } echo "\n", "\n"; /* NB : Before tracking implementation the url above was simply * "" */ $desc=$fileList['comment'][$fileKey]; /* DESCRIPTION */ echo "\n"; if(api_is_allowed_to_edit()) { $fileExtension=explode('.',$dspFileName); $fileExtension=strtolower($fileExtension[sizeof($fileExtension)-1]); /* export */ echo "\n"; } // end each ($fileList) }// end if ( $fileList) //display learning paths if (!$curDirPath) { echo ""; $sql="select * from $tbl_learnpath_main"; $result=api_sql_query($sql,__FILE__,__LINE__); $counter=0; while ($row=mysql_fetch_array($result)) { $counter++; if (($counter % 2)==0) { $oddclass="row_odd"; } else { $oddclass="row_even"; } $id=$row["learnpath_id"]; $sql2="SELECT * FROM $tbl_learnpath_main where learnpath_id=$id"; $result2=api_sql_query($sql2,__FILE__,__LINE__); $row2=mysql_fetch_array($result2); $name=$row2['learnpath_name']; $sql3="SELECT * FROM $tbl_tool where (name=\"$name\" and image='scormbuilder.gif')"; $result3=api_sql_query($sql3,__FILE__,__LINE__); $row3=mysql_fetch_array($result3); if ((api_is_allowed_to_edit()) or ((!api_is_allowed_to_edit()) and ($row3["visibility"] == '1'))) { $row['learnpath_name']=str_replace(' ',' ',$row['learnpath_name']); if ($row3["visibility"] != '1') { $style=' class="invisible"'; } else { $style=''; } echo "\n", "", ""; } if(api_is_allowed_to_edit()) { //no init of $circle1 here echo ""; } echo ""; } } echo "
open_dir
",get_lang("Name"),"",get_lang("Description"),"",get_lang("ExportShort"),"",get_lang("Modify"),"
 ", "", "",$image," ",$name,"", "$desc", ""; /* edit title and description */ echo "", ""; /* DELETE COMMAND */ echo "", "", ""; /* VISIBILITY COMMAND */ if ($fileList['visibility'][$fileKey] == "i") { echo "", "", ""; } else { echo "", "", ""; } } // end if($is_allowedToEdit) echo "
 
 ", "", "scormbuilder ", "{$row['learnpath_name']} {$row['learnpath_description']}"; echo ""; echo ""; if (($row3["visibility"])=='1') { echo "\"".get_lang('_no_publish')."\""; } else { echo "\"".get_lang('_publish')."\""; } echo "
"; // echo ""; /* *** end of the div opened earlier, if needed then uncomment*/ echo "

"; /* ============================================================================== FOOTER ============================================================================== */ Display::display_footer(); ?>