Task #1765 - LP tool, cleaning files (9).

skala
Ivan Tcholakov 15 years ago
parent 6cd582b541
commit 778510d39c
  1. 2
      main/newscorm/aicc.class.php
  2. 2
      main/newscorm/aicc_hacp.php
  3. 10
      main/newscorm/learnpathItem.class.php
  4. 6
      main/newscorm/learnpath_functions.inc.php
  5. 2
      main/newscorm/lp_add.php
  6. 2
      main/newscorm/lp_add_item.php
  7. 2
      main/newscorm/lp_admin_view.php
  8. 4
      main/newscorm/lp_ajax_switch_item.php
  9. 4
      main/newscorm/lp_ajax_switch_item_toc.php
  10. 2
      main/newscorm/lp_build.php
  11. 4
      main/newscorm/lp_comm.server.php
  12. 2
      main/newscorm/lp_edit_item.php
  13. 2
      main/newscorm/lp_edit_item_prereq.php
  14. 2
      main/newscorm/lp_move_item.php
  15. 34
      main/newscorm/lp_toc.php
  16. 98
      main/newscorm/lp_upload.php
  17. 2
      main/newscorm/lp_view.lib.js
  18. 120
      main/newscorm/lp_view.php
  19. 99
      main/newscorm/lp_view_item.php

@ -323,7 +323,7 @@ class aicc extends learnpath {
} }
/** /**
* Imports a zip file (presumably AICC) into the Dokeos structure * Imports a zip file (presumably AICC) into the Chamilo structure
* @param string Zip file info as given by $_FILES['userFile'] * @param string Zip file info as given by $_FILES['userFile']
* @return string Absolute path to the AICC config files directory or empty string on error * @return string Absolute path to the AICC config files directory or empty string on error
*/ */

@ -16,7 +16,7 @@
* This script is divided into three sections. * This script is divided into three sections.
* The first section (below) is the initialisation part. * The first section (below) is the initialisation part.
* The second section is the AICC object part * The second section is the AICC object part
* The third section defines the event handlers for Dokeos' internal messaging * The third section defines the event handlers for Chamilo's internal messaging
* and frames refresh * and frames refresh
* *
* This script implements the HACP messaging for AICC. The API messaging is * This script implements the HACP messaging for AICC. The API messaging is

@ -283,7 +283,7 @@ class learnpathItem {
/** /**
* Gets the credit information (rather scorm-stuff) based on current status and reinit * Gets the credit information (rather scorm-stuff) based on current status and reinit
* autorization. Credit tells the sco(content) if Dokeos will record the data it is sent (credit) or not (no-credit) * autorization. Credit tells the sco(content) if Chamilo will record the data it is sent (credit) or not (no-credit)
* @return string 'credit' or 'no-credit'. Defaults to 'credit' because if we don't know enough about this item, it's probably because it was never used before. * @return string 'credit' or 'no-credit'. Defaults to 'credit' because if we don't know enough about this item, it's probably because it was never used before.
*/ */
public function get_credit() { public function get_credit() {
@ -479,7 +479,7 @@ class learnpathItem {
/** /**
* Gets the launch_data field found in imsmanifests (this is SCORM- or AICC-related, really) * Gets the launch_data field found in imsmanifests (this is SCORM- or AICC-related, really)
* @return string Launch data as found in imsmanifest and stored in Dokeos (read only). Defaults to ''. * @return string Launch data as found in imsmanifest and stored in Chamilo (read only). Defaults to ''.
*/ */
public function get_launch_data() { public function get_launch_data() {
if (self::debug > 0) { error_log('New LP - In learnpathItem::get_launch_data()', 0); } if (self::debug > 0) { error_log('New LP - In learnpathItem::get_launch_data()', 0); }
@ -501,7 +501,7 @@ class learnpathItem {
/** /**
* Gets the lesson_mode (scorm feature, but might be used by aicc as well as dokeos paths) * Gets the lesson_mode (scorm feature, but might be used by aicc as well as dokeos paths)
* *
* The "browse" mode is not supported yet (because there is no such way of seeing a sco in Dokeos) * The "browse" mode is not supported yet (because there is no such way of seeing a sco in Chamilo)
* @return string 'browse','normal' or 'review'. Defaults to 'normal' * @return string 'browse','normal' or 'review'. Defaults to 'normal'
*/ */
public function get_lesson_mode() { public function get_lesson_mode() {
@ -647,7 +647,7 @@ class learnpathItem {
* The list will generally include pictures, flash objects, java applets, or any other * The list will generally include pictures, flash objects, java applets, or any other
* stuff included in the source of the current item. The current item is expected * stuff included in the source of the current item. The current item is expected
* to be an HTML file. If it is not, then the function will return and empty list. * to be an HTML file. If it is not, then the function will return and empty list.
* @param string type (one of the Dokeos tools) - optional (otherwise takes the current item's type) * @param string type (one of the Chamilo tools) - optional (otherwise takes the current item's type)
* @param string path (absolute file path) - optional (otherwise takes the current item's path) * @param string path (absolute file path) - optional (otherwise takes the current item's path)
* @param int level of recursivity we're in * @param int level of recursivity we're in
* @return array List of file paths. An additional field containing 'local' or 'remote' helps determine if the file should be copied into the zip or just linked * @return array List of file paths. An additional field containing 'local' or 'remote' helps determine if the file should be copied into the zip or just linked
@ -1185,7 +1185,7 @@ class learnpathItem {
* @param string The prerequisites string as it figures in imsmanifest.xml * @param string The prerequisites string as it figures in imsmanifest.xml
* @param Array Array of items in the current learnpath object. Although we're in the learnpathItem object, it's necessary to have a list of all items to be able to check the current item's prerequisites * @param Array Array of items in the current learnpath object. Although we're in the learnpathItem object, it's necessary to have a list of all items to be able to check the current item's prerequisites
* @param Array List of references (the "ref" column in the lp_item table) that are strings used in the expression of prerequisites. * @param Array List of references (the "ref" column in the lp_item table) that are strings used in the expression of prerequisites.
* @param integer The user ID. In some cases like Dokeos quizzes, it's necessary to have the user ID to query other tables (like the results of quizzes) * @param integer The user ID. In some cases like Chamilo quizzes, it's necessary to have the user ID to query other tables (like the results of quizzes)
* @return boolean True if the list of prerequisites given is entirely satisfied, false otherwise * @return boolean True if the list of prerequisites given is entirely satisfied, false otherwise
*/ */
public function parse_prereq($prereqs_string, $items, $refs_list, $user_id) { public function parse_prereq($prereqs_string, $items, $refs_list, $user_id) {

@ -1161,7 +1161,7 @@ function exporttofile($filename, $LPname, $LPid, $content) {
} }
/** /**
* This function exports the given Dokeos test * This function exports the given Chamilo test
* @param integer Test ID * @param integer Test ID
* @return string The test itself as an HTML string * @return string The test itself as an HTML string
*/ */
@ -1378,7 +1378,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
$LPname = display_addedresource_link_in_learnpath($item_type, $item_id, '', $id, 'builder', 'nolink'); $LPname = display_addedresource_link_in_learnpath($item_type, $item_id, '', $id, 'builder', 'nolink');
$expcontent = "<!-- $expcontent = "<!--
This is an exported file from Dokeos Learning Path belonging to a Scorm compliant content package. This is an exported file from Chamilo Learning Path belonging to a Scorm compliant content package.
Do not modify or replace individually. Do not modify or replace individually.
Export module author : Denes Nagy <darkden@evk.bke.hu> Export module author : Denes Nagy <darkden@evk.bke.hu>
@ -1718,7 +1718,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
$src = str_replace('mp3player.swf?son=', '', $src); //mp3 $src = str_replace('mp3player.swf?son=', '', $src); //mp3
// Remove funny link parts. // Remove funny link parts.
$src = str_replace('?0', '', $src); //mp3 $src = str_replace('?0', '', $src); //mp3
// The previous lines are used when creating docs with Dokeos Document tool's htmlarea. // The previous lines are used when creating docs with Chamilo Document tool's htmlarea.
// Rows marked by 'mp3' are needed because the mp3 plugin inserts the swf-mp3 links in a very strange way // Rows marked by 'mp3' are needed because the mp3 plugin inserts the swf-mp3 links in a very strange way
// and we can decode them with those 3 lines, hoping this will not cause errors in case of other htmls, // and we can decode them with those 3 lines, hoping this will not cause errors in case of other htmls,
// created by any other software. // created by any other software.

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php * This is a learning path creation and player tool in Chamilo - previously learnpath_handler.php
* *
* @author Patrick Cool * @author Patrick Cool
* @author Denes Nagy * @author Denes Nagy

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This is a learning path creation and player tool in Dokeos - previously * This is a learning path creation and player tool in Chamilo - previously
* learnpath_handler.php * learnpath_handler.php
* *
* @author Patrick Cool * @author Patrick Cool

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php * This is a learning path creation and player tool in Chamilo - previously learnpath_handler.php
* *
* @author Patrick Cool * @author Patrick Cool
* @author Denes Nagy * @author Denes Nagy

@ -123,8 +123,8 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
$mymax_time_allowed = $mylpi->get_max_time_allowed(); $mymax_time_allowed = $mylpi->get_max_time_allowed();
$mylaunch_data = $mylpi->get_launch_data(); $mylaunch_data = $mylpi->get_launch_data();
/* /*
if($mylpi->get_type() == 'asset'){ if ($mylpi->get_type() == 'asset') {
//temporary measure to save completion of an asset. Later on, Dokeos should trigger something on unload, maybe... (even though that would mean the last item cannot be completed) // Temporary measure to save completion of an asset. Later on, Chamilo should trigger something on unload, maybe... (even though that would mean the last item cannot be completed)
$mylesson_status = 'completed'; $mylesson_status = 'completed';
$mylpi->set_status('completed'); $mylpi->set_status('completed');
$mylpi->save(); $mylpi->save();

@ -115,8 +115,8 @@ function switch_item_toc($lp_id, $user_id, $view_id, $current_item, $next_item)
$mymax_time_allowed = $mylpi->get_max_time_allowed(); $mymax_time_allowed = $mylpi->get_max_time_allowed();
$mylaunch_data = $mylpi->get_launch_data(); $mylaunch_data = $mylpi->get_launch_data();
/* /*
if($mylpi->get_type() == 'asset'){ if ($mylpi->get_type() == 'asset') {
//temporary measure to save completion of an asset. Later on, Dokeos should trigger something on unload, maybe... (even though that would mean the last item cannot be completed) // Temporary measure to save completion of an asset. Later on, Chamilo should trigger something on unload, maybe... (even though that would mean the last item cannot be completed)
$mylesson_status = 'completed'; $mylesson_status = 'completed';
$mylpi->set_status('completed'); $mylpi->set_status('completed');
$mylpi->save(); $mylpi->save();

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php * This is a learning path creation and player tool in Chamilo - previously learnpath_handler.php
* *
* @author Patrick Cool * @author Patrick Cool
* @author Denes Nagy * @author Denes Nagy

@ -335,8 +335,8 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
$mymax_time_allowed = $mylpi->get_max_time_allowed(); $mymax_time_allowed = $mylpi->get_max_time_allowed();
$mylaunch_data = $mylpi->get_launch_data(); $mylaunch_data = $mylpi->get_launch_data();
/* /*
if($mylpi->get_type() == 'asset'){ if ($mylpi->get_type() == 'asset') {
//temporary measure to save completion of an asset. Later on, Dokeos should trigger something on unload, maybe... (even though that would mean the last item cannot be completed) // Temporary measure to save completion of an asset. Later on, Chamilo should trigger something on unload, maybe... (even though that would mean the last item cannot be completed)
$mylesson_status = 'completed'; $mylesson_status = 'completed';
$mylpi->set_status('completed'); $mylpi->set_status('completed');
$mylpi->save(); $mylpi->save();

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php * This is a learning path creation and player tool in Chamilo - previously learnpath_handler.php
* *
* @author Patrick Cool * @author Patrick Cool
* @author Denes Nagy * @author Denes Nagy

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php * This is a learning path creation and player tool in Chamilo - previously learnpath_handler.php
* *
* @author Patrick Cool * @author Patrick Cool
* @author Denes Nagy * @author Denes Nagy

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php * This is a learning path creation and player tool in Chamilo - previously learnpath_handler.php
* *
* @author Patrick Cool * @author Patrick Cool
* @author Denes Nagy * @author Denes Nagy

@ -1,45 +1,51 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Script opened in an iframe and containing the learning path's table of contents * Script opened in an iframe and containing the learning path's table of contents
* @package chamilo.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
*/ */
//flag to allow for anonymous user - needs to be set before global.inc.php
// Flag to allow for anonymous user - needs to be set before global.inc.php.
$use_anonymous = true; $use_anonymous = true;
$language_file[] = "scormdocument";
$language_file[] = "scorm"; $language_file[] = 'scormdocument';
$language_file[] = "learnpath"; $language_file[] = 'scorm';
$language_file[] = 'learnpath';
require_once 'back_compat.inc.php'; require_once 'back_compat.inc.php';
require_once 'learnpath.class.php'; require_once 'learnpath.class.php';
require_once 'scorm.class.php'; require_once 'scorm.class.php';
require_once 'aicc.class.php'; require_once 'aicc.class.php';
if (isset($_SESSION['lpobject'])) { if (isset($_SESSION['lpobject'])) {
//if($debug>0) error_log('New LP - in lp_toc.php - SESSION[lpobject] is defined',0); //if ($debug > 0) error_log('New LP - in lp_toc.php - SESSION[lpobject] is defined', 0);
$oLP = unserialize($_SESSION['lpobject']); $oLP = unserialize($_SESSION['lpobject']);
if(is_object($oLP)){ if (is_object($oLP)) {
$_SESSION['oLP'] = $oLP; $_SESSION['oLP'] = $oLP;
}else{ } else {
//error_log('New LP - in lp_toc.php - SESSION[lpobject] is not object - dying',0); //error_log('New LP - in lp_toc.php - SESSION[lpobject] is not object - dying', 0);
die('Could not instanciate lp object'); die('Could not instanciate lp object');
} }
} }
$charset = $_SESSION['oLP']->encoding; $charset = $_SESSION['oLP']->encoding;
$htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript"> $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
var dokeos_xajax_handler = window.parent.oxajax; var dokeos_xajax_handler = window.parent.oxajax;
</script>'; </script>';
$scorm_css_header=true;
$display_mode=''; $scorm_css_header = true;
$lp_theme_css=$_SESSION['oLP']->get_theme(); $display_mode = '';
$lp_theme_css = $_SESSION['oLP']->get_theme();
include_once '../inc/reduced_header.inc.php'; include_once '../inc/reduced_header.inc.php';
?> ?>
<body> <body dir="<?php echo api_get_text_direction(); ?>">
<?php echo $_SESSION['oLP']->get_html_toc();?><br/> <?php echo $_SESSION['oLP']->get_html_toc();?><br />
</body> </body>
</html> </html>
<?php <?php
if (!empty($_SESSION['oLP'])) { if (!empty($_SESSION['oLP'])) {
$_SESSION['lpobject'] = serialize($_SESSION['oLP']); $_SESSION['lpobject'] = serialize($_SESSION['oLP']);
} }
?>

@ -1,74 +1,69 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Script managing the learnpath upload. To best treat the uploaded file, make sure we can identify it. * Script managing the learnpath upload. To best treat the uploaded file, make sure we can identify it.
* @package chamilo.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
*/ */
/**
* Script initialisations // Flag to allow for anonymous user - needs to be set before global.inc.php.
*/
//flag to allow for anonymous user - needs to be set before global.inc.php
$use_anonymous = true; $use_anonymous = true;
require_once 'back_compat.inc.php'; require_once 'back_compat.inc.php';
$course_dir = api_get_course_path().'/scorm'; $course_dir = api_get_course_path().'/scorm';
$course_sys_dir = api_get_path(SYS_COURSE_PATH).$course_dir; $course_sys_dir = api_get_path(SYS_COURSE_PATH).$course_dir;
if ( empty($_POST['current_dir']) ) { if (empty($_POST['current_dir'])) {
$current_dir = ''; $current_dir = '';
} else { } else {
$current_dir = replace_dangerous_char(trim($_POST['current_dir']),'strict'); $current_dir = replace_dangerous_char(trim($_POST['current_dir']), 'strict');
} }
$uncompress = 1; $uncompress = 1;
//error_log('New LP - lp_upload.php',0); //error_log('New LP - lp_upload.php', 0);
/* /*
* check the request method in place of a variable from POST * Check the request method in place of a variable from POST
* because if the file size exceed the maximum file upload * because if the file size exceed the maximum file upload
* size set in php.ini, all variables from POST are cleared ! * size set in php.ini, all variables from POST are cleared !
*/ */
if ($_SERVER['REQUEST_METHOD'] == 'POST' if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_FILES) > 0 && !empty($_FILES['user_file']['name'])) {
&& count($_FILES)>0
&& !empty($_FILES['user_file']['name'])
)
{
// A file upload has been detected, now deal with the file... // A file upload has been detected, now deal with the file...
//directory creation
// Directory creation.
$stopping_error = false; $stopping_error = false;
$s=$_FILES['user_file']['name']; $s = $_FILES['user_file']['name'];
//get name of the zip file without the extension // Get name of the zip file without the extension.
$info = pathinfo($s); $info = pathinfo($s);
$filename = $info['basename']; $filename = $info['basename'];
$extension = $info['extension']; $extension = $info['extension'];
$file_base_name = str_replace('.'.$extension,'',$filename); $file_base_name = str_replace('.'.$extension, '', $filename);
$new_dir = replace_dangerous_char(trim($file_base_name),'strict'); $new_dir = replace_dangerous_char(trim($file_base_name), 'strict');
require_once 'learnpath.class.php'; require_once 'learnpath.class.php';
$type = learnpath::get_package_type($_FILES['user_file']['tmp_name'],$_FILES['user_file']['name']); $type = learnpath::get_package_type($_FILES['user_file']['tmp_name'], $_FILES['user_file']['name']);
switch($type){ switch ($type) {
case 'scorm': case 'scorm':
require_once 'scorm.class.php'; require_once 'scorm.class.php';
$oScorm = new scorm(); $oScorm = new scorm();
$manifest = $oScorm->import_package($_FILES['user_file'],$current_dir); $manifest = $oScorm->import_package($_FILES['user_file'], $current_dir);
if (!$manifest) { //if api_set_failure if (!$manifest) { //if api_set_failure
return api_failure::set_failure(api_failure::get_last_failure()); return api_failure::set_failure(api_failure::get_last_failure());
} }
if(!empty($manifest)){ if (!empty($manifest)) {
$oScorm->parse_manifest($manifest); $oScorm->parse_manifest($manifest);
$oScorm->import_manifest(api_get_course_id()); $oScorm->import_manifest(api_get_course_id());
}else{ } else {
//show error message stored in $oScrom->error_msg // Show error message stored in $oScrom->error_msg.
} }
$proximity = ''; $proximity = '';
if(!empty($_REQUEST['content_proximity'])){$proximity = Database::escape_string($_REQUEST['content_proximity']);} if (!empty($_REQUEST['content_proximity'])) { $proximity = Database::escape_string($_REQUEST['content_proximity']); }
$maker = ''; $maker = '';
if(!empty($_REQUEST['content_maker'])){$maker = Database::escape_string($_REQUEST['content_maker']);} if (!empty($_REQUEST['content_maker'])) { $maker = Database::escape_string($_REQUEST['content_maker']); }
$oScorm->set_proximity($proximity); $oScorm->set_proximity($proximity);
$oScorm->set_maker($maker); $oScorm->set_maker($maker);
$oScorm->set_jslib('scorm_api.php'); $oScorm->set_jslib('scorm_api.php');
@ -77,14 +72,14 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST'
require_once 'aicc.class.php'; require_once 'aicc.class.php';
$oAICC = new aicc(); $oAICC = new aicc();
$config_dir = $oAICC->import_package($_FILES['user_file']); $config_dir = $oAICC->import_package($_FILES['user_file']);
if(!empty($config_dir)){ if (!empty($config_dir)) {
$oAICC->parse_config_files($config_dir); $oAICC->parse_config_files($config_dir);
$oAICC->import_aicc(api_get_course_id()); $oAICC->import_aicc(api_get_course_id());
} }
$proximity = ''; $proximity = '';
if(!empty($_REQUEST['content_proximity'])){$proximity = Database::escape_string($_REQUEST['content_proximity']);} if (!empty($_REQUEST['content_proximity'])) { $proximity = Database::escape_string($_REQUEST['content_proximity']); }
$maker = ''; $maker = '';
if(!empty($_REQUEST['content_maker'])){$maker = Database::escape_string($_REQUEST['content_maker']);} if (!empty($_REQUEST['content_maker'])) { $maker = Database::escape_string($_REQUEST['content_maker']); }
$oAICC->set_proximity($proximity); $oAICC->set_proximity($proximity);
$oAICC->set_maker($maker); $oAICC->set_maker($maker);
$oAICC->set_jslib('aicc_api.php'); $oAICC->set_jslib('aicc_api.php');
@ -106,44 +101,44 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST'
return api_failure::set_failure('not_a_learning_path'); return api_failure::set_failure('not_a_learning_path');
} }
} // end if is_uploaded_file } // end if is_uploaded_file
elseif($_SERVER['REQUEST_METHOD'] == 'POST') elseif($_SERVER['REQUEST_METHOD'] == 'POST') {
{ // If file name given to get in claroline/upload/, try importing this way.
//if file name given to get in claroline/upload/, try importing this way
// A file upload has been detected, now deal with the file... // A file upload has been detected, now deal with the file...
//directory creation
// Directory creation.
$stopping_error = false; $stopping_error = false;
//escape path with basename so it can only be directly into the claroline/upload directory // Escape path with basename so it can only be directly into the claroline/upload directory.
$s=api_get_path(SYS_ARCHIVE_PATH).basename($_POST['file_name']); $s = api_get_path(SYS_ARCHIVE_PATH).basename($_POST['file_name']);
//get name of the zip file without the extension // Get name of the zip file without the extension
$info = pathinfo($s); $info = pathinfo($s);
$filename = $info['basename']; $filename = $info['basename'];
$extension = $info['extension']; $extension = $info['extension'];
$file_base_name = str_replace('.'.$extension,'',$filename); $file_base_name = str_replace('.'.$extension, '', $filename);
$new_dir = replace_dangerous_char(trim($file_base_name),'strict'); $new_dir = replace_dangerous_char(trim($file_base_name), 'strict');
require_once 'learnpath.class.php'; require_once 'learnpath.class.php';
$type = learnpath::get_package_type($s,basename($s)); $type = learnpath::get_package_type($s, basename($s));
switch($type){ switch ($type) {
case 'scorm': case 'scorm':
require_once 'scorm.class.php'; require_once 'scorm.class.php';
$oScorm = new scorm(); $oScorm = new scorm();
$manifest = $oScorm->import_local_package($s,$current_dir); $manifest = $oScorm->import_local_package($s, $current_dir);
if ($manifest === false ) { //if api_set_failure if ($manifest === false ) { //if api_set_failure
return api_failure::set_failure(api_failure::get_last_failure()); return api_failure::set_failure(api_failure::get_last_failure());
} }
if(!empty($manifest)){ if (!empty($manifest)) {
$oScorm->parse_manifest($manifest); $oScorm->parse_manifest($manifest);
$oScorm->import_manifest(api_get_course_id()); $oScorm->import_manifest(api_get_course_id());
} }
$proximity = ''; $proximity = '';
if(!empty($_REQUEST['content_proximity'])){$proximity = Database::escape_string($_REQUEST['content_proximity']);} if (!empty($_REQUEST['content_proximity'])) { $proximity = Database::escape_string($_REQUEST['content_proximity']); }
$maker = ''; $maker = '';
if(!empty($_REQUEST['content_maker'])){$maker = Database::escape_string($_REQUEST['content_maker']);} if (!empty($_REQUEST['content_maker'])) {$maker = Database::escape_string($_REQUEST['content_maker']); }
$oScorm->set_proximity($proximity); $oScorm->set_proximity($proximity);
$oScorm->set_maker($maker); $oScorm->set_maker($maker);
$oScorm->set_jslib('scorm_api.php'); $oScorm->set_jslib('scorm_api.php');
@ -151,15 +146,15 @@ elseif($_SERVER['REQUEST_METHOD'] == 'POST')
case 'aicc': case 'aicc':
require_once 'aicc.class.php'; require_once 'aicc.class.php';
$oAICC = new aicc(); $oAICC = new aicc();
$config_dir = $oAICC->import_local_package($s,$current_dir); $config_dir = $oAICC->import_local_package($s, $current_dir);
if(!empty($config_dir)){ if (!empty($config_dir)) {
$oAICC->parse_config_files($config_dir); $oAICC->parse_config_files($config_dir);
$oAICC->import_aicc(api_get_course_id()); $oAICC->import_aicc(api_get_course_id());
} }
$proximity = ''; $proximity = '';
if(!empty($_REQUEST['content_proximity'])){$proximity = Database::escape_string($_REQUEST['content_proximity']);} if (!empty($_REQUEST['content_proximity'])) { $proximity = Database::escape_string($_REQUEST['content_proximity']); }
$maker = ''; $maker = '';
if(!empty($_REQUEST['content_maker'])){$maker = Database::escape_string($_REQUEST['content_maker']);} if (!empty($_REQUEST['content_maker'])) { $maker = Database::escape_string($_REQUEST['content_maker']); }
$oAICC->set_proximity($proximity); $oAICC->set_proximity($proximity);
$oAICC->set_maker($maker); $oAICC->set_maker($maker);
$oAICC->set_jslib('aicc_api.php'); $oAICC->set_jslib('aicc_api.php');
@ -169,4 +164,3 @@ elseif($_SERVER['REQUEST_METHOD'] == 'POST')
return api_failure::set_failure('not_a_learning_path'); return api_failure::set_failure('not_a_learning_path');
} }
} }
?>

@ -1,5 +1,5 @@
/*********************************************** /***********************************************
* IFrame SSI script II- <EFBFBD> Dynamic Drive DHTML code library (http://www.dynamicdrive.com) * IFrame SSI script II- Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts * Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use * This notice must stay intact for legal use
***********************************************/ ***********************************************/

@ -1,5 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This file was originally the copy of document.php, but many modifications happened since then ; * This file was originally the copy of document.php, but many modifications happened since then ;
* the direct file view is not needed anymore, if the user uploads a scorm zip file, a directory * the direct file view is not needed anymore, if the user uploads a scorm zip file, a directory
@ -10,15 +11,13 @@
* @author Denes Nagy, principal author * @author Denes Nagy, principal author
* @author Isthvan Mandak, several new features * @author Isthvan Mandak, several new features
* @author Roan Embrechts, code improvements and refactoring * @author Roan Embrechts, code improvements and refactoring
* @license GNU/GPL - See Dokeos license directory for details * @license GNU/GPL - See Chamilo license directory for details
*/ */
/**
* Script /* INIT SECTION */
*/
/* INIT SECTION */
$_SESSION['whereami'] = 'lp/view'; $_SESSION['whereami'] = 'lp/view';
$this_section=SECTION_COURSES; $this_section = SECTION_COURSES;
if ($lp_controller_touched != 1){ if ($lp_controller_touched != 1){
header('location: lp_controller.php?action=view&item_id='.$_REQUEST['item_id']); header('location: lp_controller.php?action=view&item_id='.$_REQUEST['item_id']);
@ -37,7 +36,7 @@ require_once 'learnpathItem.class.php';
if (!$is_allowed_in_course) api_not_allowed(); if (!$is_allowed_in_course) api_not_allowed();
// we set the encoding of the lp // We set the encoding of the lp.
if (!empty($_SESSION['oLP']->encoding)) { if (!empty($_SESSION['oLP']->encoding)) {
$charset = $_SESSION['oLP']->encoding; $charset = $_SESSION['oLP']->encoding;
} else { } else {
@ -47,19 +46,19 @@ if (!empty($_SESSION['oLP']->encoding)) {
$oLearnpath = false; $oLearnpath = false;
$course_code = api_get_course_id(); $course_code = api_get_course_id();
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$platform_theme = api_get_setting('stylesheets'); // plataform's css $platform_theme = api_get_setting('stylesheets'); // Plataform's css.
$my_style = $platform_theme; $my_style = $platform_theme;
//escape external variables // Escape external variables.
/* Header */ /* Header */
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>';
if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setting('show_glossary_in_documents') == 'isautomatic' ) { if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setting('show_glossary_in_documents') == 'isautomatic' ) {
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>'; $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>'; $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
} }
$htmlHeadXtra[] = '<script language="javascript" type="text/javascript"> $htmlHeadXtra[] = '<script language="javascript" type="text/javascript">
$(document).ready(function (){ $(document).ready(function (){
$("div#log_content_cleaner").bind("click", function(){ $("div#log_content_cleaner").bind("click", function(){
@ -72,25 +71,26 @@ $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
var dokeos_xajax_handler = window.oxajax; var dokeos_xajax_handler = window.oxajax;
</script>'; </script>';
$_SESSION['oLP']->error = ''; $_SESSION['oLP']->error = '';
$lp_type = $_SESSION['oLP']->get_type(); $lp_type = $_SESSION['oLP']->get_type();
$lp_item_id = $_SESSION['oLP']->get_current_item_id(); $lp_item_id = $_SESSION['oLP']->get_current_item_id();
//$lp_item_id = learnpath::escape_string($_GET['item_id']); //$lp_item_id = learnpath::escape_string($_GET['item_id']);
//$_SESSION['oLP']->set_current_item($lp_item_id); // already done by lp_controller.php //$_SESSION['oLP']->set_current_item($lp_item_id); // Already done by lp_controller.php.
//Prepare variables for the test tool (just in case) - honestly, this should disappear later on // Prepare variables for the test tool (just in case) - honestly, this should disappear later on.
$_SESSION['scorm_view_id'] = $_SESSION['oLP']->get_view_id(); $_SESSION['scorm_view_id'] = $_SESSION['oLP']->get_view_id();
$_SESSION['scorm_item_id'] = $lp_item_id; $_SESSION['scorm_item_id'] = $lp_item_id;
$_SESSION['lp_mode'] = $_SESSION['oLP']->mode; $_SESSION['lp_mode'] = $_SESSION['oLP']->mode;
//reinit exercises variables to avoid spacename clashes (see exercise tool)
if(isset($exerciseResult) or isset($_SESSION['exerciseResult'])) { // Reinit exercises variables to avoid spacename clashes (see exercise tool)
if (isset($exerciseResult) || isset($_SESSION['exerciseResult'])) {
api_session_unregister($exerciseResult); api_session_unregister($exerciseResult);
} }
unset($_SESSION['objExercise']); unset($_SESSION['objExercise']);
unset($_SESSION['questionList']); unset($_SESSION['questionList']);
/** /**
* Get a link to the corresponding document * Get a link to the corresponding document.
*/ */
if (!isset($src)) { if (!isset($src)) {
$src = ''; $src = '';
@ -99,39 +99,39 @@ if (!isset($src)) {
$_SESSION['oLP']->stop_previous_item(); $_SESSION['oLP']->stop_previous_item();
$htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>'; $htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
$prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id); $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
if($prereq_check === true){ if ($prereq_check === true) {
$src = $_SESSION['oLP']->get_link('http',$lp_item_id); $src = $_SESSION['oLP']->get_link('http', $lp_item_id);
//Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP //Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP.
$file_info = pathinfo($src); $file_info = pathinfo($src);
if (api_strtolower(substr($file_info['extension'], 0, 3) == 'pdf')) { if (api_strtolower(substr($file_info['extension'], 0, 3) == 'pdf')) {
$src = 'lp_view_item.php?src='.$src; $src = 'lp_view_item.php?src='.$src;
} }
$_SESSION['oLP']->start_current_item(); //starts time counter manually if asset $_SESSION['oLP']->start_current_item(); // starts time counter manually if asset
} else { } else {
$src = 'blank.php?error=prerequisites'; $src = 'blank.php?error=prerequisites';
} }
break; break;
case 2: case 2:
//save old if asset // save old if asset
$_SESSION['oLP']->stop_previous_item(); //save status manually if asset $_SESSION['oLP']->stop_previous_item(); // save status manually if asset
$htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>'; $htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
$prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id); $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
if($prereq_check === true){ if ($prereq_check === true) {
$src = $_SESSION['oLP']->get_link('http',$lp_item_id); $src = $_SESSION['oLP']->get_link('http',$lp_item_id);
$_SESSION['oLP']->start_current_item(); //starts time counter manually if asset $_SESSION['oLP']->start_current_item(); // starts time counter manually if asset
}else{ } else {
$src = 'blank.php?error=prerequisites'; $src = 'blank.php?error=prerequisites';
} }
break; break;
case 3: case 3:
//aicc // aicc
$_SESSION['oLP']->stop_previous_item(); //save status manually if asset $_SESSION['oLP']->stop_previous_item(); // save status manually if asset
$htmlHeadXtra[] = '<script src="'.$_SESSION['oLP']->get_js_lib().'" type="text/javascript" language="javascript"></script>'; $htmlHeadXtra[] = '<script src="'.$_SESSION['oLP']->get_js_lib().'" type="text/javascript" language="javascript"></script>';
$prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id); $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
if($prereq_check === true){ if ($prereq_check === true) {
$src = $_SESSION['oLP']->get_link('http',$lp_item_id); $src = $_SESSION['oLP']->get_link('http',$lp_item_id);
$_SESSION['oLP']->start_current_item(); //starts time counter manually if asset $_SESSION['oLP']->start_current_item(); // starts time counter manually if asset
}else{ } else {
$src = 'blank.php'; $src = 'blank.php';
} }
break; break;
@ -144,13 +144,13 @@ $list = $_SESSION['oLP']->get_toc();
$type_quiz = false; $type_quiz = false;
foreach($list as $toc) { foreach($list as $toc) {
if ($toc['id'] == $lp_item_id && ($toc['type']=='quiz') ) { if ($toc['id'] == $lp_item_id && ($toc['type']=='quiz')) {
$type_quiz = true; $type_quiz = true;
} }
} }
$autostart = 'true'; $autostart = 'true';
// update status,total_time from lp_item_view table when you finish the exercises in learning path // Update status, total_time from lp_item_view table when you finish the exercises in learning path.
if ($type_quiz && !empty($_REQUEST['exeId']) && isset($_GET['lp_id']) && isset($_GET['lp_item_id'])) { if ($type_quiz && !empty($_REQUEST['exeId']) && isset($_GET['lp_id']) && isset($_GET['lp_item_id'])) {
global $src; global $src;
$_SESSION['oLP']->items[$_SESSION['oLP']->current]->write_to_db(); $_SESSION['oLP']->items[$_SESSION['oLP']->current]->write_to_db();
@ -185,13 +185,13 @@ if ($type_quiz && !empty($_REQUEST['exeId']) && isset($_GET['lp_id']) && isset($
$res_last_attempt = Database::query($sql_last_attempt); $res_last_attempt = Database::query($sql_last_attempt);
$row_last_attempt = Database::fetch_row($res_last_attempt); $row_last_attempt = Database::fetch_row($res_last_attempt);
if (Database::num_rows($res_last_attempt)>0) { if (Database::num_rows($res_last_attempt) > 0) {
$sql_upd_score = "UPDATE $TBL_LP_ITEM_VIEW SET score = $score,total_time = $mytime WHERE id='".$row_last_attempt[0]."'"; $sql_upd_score = "UPDATE $TBL_LP_ITEM_VIEW SET score = $score,total_time = $mytime WHERE id='".$row_last_attempt[0]."'";
Database::query($sql_upd_score); Database::query($sql_upd_score);
} }
} }
if(intval($_GET['fb_type']) > 0) { if (intval($_GET['fb_type']) > 0) {
$src = 'blank.php?msg=exerciseFinished'; $src = 'blank.php?msg=exerciseFinished';
} else { } else {
$src = api_get_path(WEB_CODE_PATH).'exercice/exercise_show.php?id='.Security::remove_XSS($_REQUEST['exeId']).'&origin=learnpath&learnpath_id='.Security::remove_XSS($_GET['lp_id']).'&learnpath_item_id='.Security::remove_XSS($_GET['lp_id']).'&fb_type='.Security::remove_XSS($_GET['fb_type']); $src = api_get_path(WEB_CODE_PATH).'exercice/exercise_show.php?id='.Security::remove_XSS($_REQUEST['exeId']).'&origin=learnpath&learnpath_id='.Security::remove_XSS($_GET['lp_id']).'&learnpath_item_id='.Security::remove_XSS($_GET['lp_id']).'&fb_type='.Security::remove_XSS($_GET['fb_type']);
@ -202,29 +202,31 @@ if ($type_quiz && !empty($_REQUEST['exeId']) && isset($_GET['lp_id']) && isset($
$_SESSION['oLP']->set_previous_item($lp_item_id); $_SESSION['oLP']->set_previous_item($lp_item_id);
$nameTools = Security :: remove_XSS(api_convert_encoding($_SESSION['oLP']->get_name(), $charset, api_get_system_encoding())); $nameTools = Security :: remove_XSS(api_convert_encoding($_SESSION['oLP']->get_name(), $charset, api_get_system_encoding()));
$save_setting = api_get_setting("show_navigation_menu"); $save_setting = api_get_setting('show_navigation_menu');
global $_setting; global $_setting;
$_setting['show_navigation_menu'] = 'false'; $_setting['show_navigation_menu'] = 'false';
$scorm_css_header=true; $scorm_css_header = true;
$lp_theme_css=$_SESSION['oLP']->get_theme(); //sets the css theme of the LP this call is also use at the frames (toc, nav, message) $lp_theme_css = $_SESSION['oLP']->get_theme(); // Sets the css theme of the LP this call is also use at the frames (toc, nav, message).
if($_SESSION['oLP']->mode == 'fullscreen') { if ($_SESSION['oLP']->mode == 'fullscreen') {
$htmlHeadXtra[] = "<script>window.open('$src','content_id','toolbar=0,location=0,status=0,scrollbars=1,resizable=1');</script>"; $htmlHeadXtra[] = "<script>window.open('$src','content_id','toolbar=0,location=0,status=0,scrollbars=1,resizable=1');</script>";
} }
//not fullscreen mode
// Not in fullscreen mode.
require_once '../inc/reduced_header.inc.php'; require_once '../inc/reduced_header.inc.php';
//$displayAudioRecorder = (api_get_setting('service_visio','active')=='true') ? true : false; //$displayAudioRecorder = (api_get_setting('service_visio', 'active') == 'true') ? true : false;
//check if audio recorder needs to be in studentview // Check if audio recorder needs to be in studentview.
$course_id=$_SESSION["_course"]["id"]; $course_id = $_SESSION['_course']['id'];
if ($_SESSION["status"][$course_id]==5) { if ($_SESSION['status'][$course_id] == 5) {
$audio_recorder_studentview = true; $audio_recorder_studentview = true;
} else { } else {
$audio_recorder_studentview = false; $audio_recorder_studentview = false;
} }
//set flag to ensure lp_header.php is loaded by this script (flag is unset in lp_header.php) // Set flag to ensure lp_header.php is loaded by this script (flag is unset in lp_header.php).
$_SESSION['loaded_lp_view'] = true; $_SESSION['loaded_lp_view'] = true;
?> ?>
<body> <body dir="<?php echo api_get_text_direction(); ?>">
<div id="learning_path_main" style="width:100%;height:100%;" > <div id="learning_path_main" style="width:100%;height:100%;" >
<div id="learning_path_left_zone" style="float:left;width:280px;height:100%"> <div id="learning_path_left_zone" style="float:left;width:280px;height:100%">
@ -234,10 +236,10 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
<table> <table>
<tr> <tr>
<td> <td>
<a href="lp_controller.php?action=return_to_course_homepage&<?php echo api_get_cidreq(); ?>" target="_self" onclick="window.parent.API.save_asset();"><img src="../img/lp_arrow.gif" /></a> <a href="lp_controller.php?action=return_to_course_homepage&<?php echo api_get_cidreq(); ?>" target="_self" onclick="javascript: window.parent.API.save_asset();"><img src="../img/lp_arrow.gif" /></a>
</td> </td>
<td> <td>
<a class="link" href="lp_controller.php?action=return_to_course_homepage&<?php echo api_get_cidreq(); ?>" target="_self" onclick="window.parent.API.save_asset();"> <a class="link" href="lp_controller.php?action=return_to_course_homepage&<?php echo api_get_cidreq(); ?>" target="_self" onclick="javascript: window.parent.API.save_asset();">
<?php echo api_convert_encoding(get_lang('CourseHomepageLink'), $charset, api_get_system_encoding()); ?></a> <?php echo api_convert_encoding(get_lang('CourseHomepageLink'), $charset, api_get_system_encoding()); ?></a>
</td> </td>
</tr> </tr>
@ -277,7 +279,7 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
$scorm_css_header = true; $scorm_css_header = true;
$lp_theme_css = $_SESSION['oLP']->get_theme(); $lp_theme_css = $_SESSION['oLP']->get_theme();
//Setting up the CSS theme if exists // Setting up the CSS theme if exists.
if (!empty ($lp_theme_css) && !empty ($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) { if (!empty ($lp_theme_css) && !empty ($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
global $lp_theme_css; global $lp_theme_css;
} else { } else {
@ -290,7 +292,7 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$show_audioplayer = false; $show_audioplayer = false;
// getting all the information about the item // Getting all the information about the item.
$sql = "SELECT audio FROM " . $tbl_lp_item . " WHERE lp_id = '" . $_SESSION['oLP']->lp_id."'"; $sql = "SELECT audio FROM " . $tbl_lp_item . " WHERE lp_id = '" . $_SESSION['oLP']->lp_id."'";
$res_media= Database::query($sql); $res_media= Database::query($sql);
@ -314,9 +316,9 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
</div> </div>
<!-- media player layaout --> <!-- media player layaout -->
<?php $style_media = (($show_audioplayer)?' style= "position:relative;top:10px;left:10px;margin:8px;font-size:32pt;height:20px;"':'style="height:15px"'); ?> <?php $style_media = (($show_audioplayer) ? ' style= "position:relative;top:10px;left:10px;margin:8px;font-size:32pt;height:20px;"' : 'style="height:15px"'); ?>
<div id="media" <?php echo $style_media ?>> <div id="media" <?php echo $style_media; ?>>
<?php echo (!empty($mediaplayer))?$mediaplayer:'&nbsp;' ?> <?php echo (!empty($mediaplayer)) ? $mediaplayer : '&nbsp;' ?>
</div> </div>
<!-- end media player layaout --> <!-- end media player layaout -->
@ -346,7 +348,7 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
<div id="learning_path_right_zone" style="margin-left:282px;height:100%"> <div id="learning_path_right_zone" style="margin-left:282px;height:100%">
<?php <?php
// hub 26-05-2010 Fullscreen or not fullscreen // hub 26-05-2010 Fullscreen or not fullscreen
if($_SESSION['oLP']->mode == 'fullscreen') { if ($_SESSION['oLP']->mode == 'fullscreen') {
echo '<iframe id="content_id_blank" name="content_name_blank" src="blank.php" border="0" frameborder="0" style="width:100%;height:600px" ></iframe>'; echo '<iframe id="content_id_blank" name="content_name_blank" src="blank.php" border="0" frameborder="0" style="width:100%;height:600px" ></iframe>';
} else { } else {
echo '<iframe id="content_id" name="content_name" src="'.$src.'" border="0" frameborder="0" style="width:100%;height:600px" ></iframe>'; echo '<iframe id="content_id" name="content_name" src="'.$src.'" border="0" frameborder="0" style="width:100%;height:600px" ></iframe>';
@ -356,11 +358,11 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
<!-- end right Zone --> <!-- end right Zone -->
</div> </div>
<script language="JavaScript" type="text/javascript"> <script language="JavaScript" type="text/javascript">
// Need to be called after the <head> to be sure window.oxajax is defined // Need to be called after the <head> to be sure window.oxajax is defined.
//var dokeos_xajax_handler = window.oxajax; //var dokeos_xajax_handler = window.oxajax;
</script> </script>
<script language="JavaScript" type="text/javascript"> <script language="JavaScript" type="text/javascript">
// resize right and left pane to full height (HUB 20-05-2010) // Resize right and left pane to full height (HUB 20-05-2010).
function updateContentHeight() { function updateContentHeight() {
document.body.style.overflow = 'hidden'; document.body.style.overflow = 'hidden';
var IE = window.navigator.appName.match(/microsoft/i); var IE = window.navigator.appName.match(/microsoft/i);
@ -381,7 +383,7 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
document.getElementById('content_id').style.height = innerHauteur + 'px'; document.getElementById('content_id').style.height = innerHauteur + 'px';
} }
//loads the glossary library // Loads the glossary library.
<?php <?php
if (api_get_setting('show_glossary_in_extra_tools') == 'true') { if (api_get_setting('show_glossary_in_extra_tools') == 'true') {
if (api_get_setting('show_glossary_in_documents') == 'ismanual') { if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
@ -419,5 +421,5 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
</script> </script>
</body> </body>
<?php <?php
//restore global setting // Restore a global setting.
$_setting['show_navigation_menu'] = $save_setting; $_setting['show_navigation_menu'] = $save_setting;

@ -1,25 +1,26 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/**
* This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php
*
* @author Patrick Cool
* @author Denes Nagy
* @author Roan Embrechts, refactoring and code cleaning
* @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update for new SCORM tool
* @package chamilo.learnpath
*/
//Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP /**
if(isset($_GET['src'])) { * This is a learning path creation and player tool in Chamilo - previously learnpath_handler.php
// including the global file *
* @author Patrick Cool
* @author Denes Nagy
* @author Roan Embrechts, refactoring and code cleaning
* @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update for new SCORM tool
* @package chamilo.learnpath
*/
// Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP.
if (isset($_GET['src'])) {
// Including the global initialization file.
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
api_protect_course_script(); api_protect_course_script();
//get parameter only came from lp_view.php // Get parameter only came from lp_view.php.
$url_info = parse_url($_GET['src']); $url_info = parse_url($_GET['src']);
$real_url_info = parse_url(api_get_path(WEB_PATH)); $real_url_info = parse_url(api_get_path(WEB_PATH));
//the host must be the same // The host must be the same.
if ($url_info['host'] == $real_url_info['host']) { if ($url_info['host'] == $real_url_info['host']) {
header("Location: ".urldecode(Security::remove_XSS($_GET['src']))); header("Location: ".urldecode(Security::remove_XSS($_GET['src'])));
exit; exit;
@ -29,21 +30,20 @@ if(isset($_GET['src'])) {
} }
} }
/* INIT SECTION */
/* INIT SECTION */
$_SESSION['whereami'] = 'lp/build'; $_SESSION['whereami'] = 'lp/build';
if(isset($_SESSION['oLP']) && isset($_GET['id'])) { if (isset($_SESSION['oLP']) && isset($_GET['id'])) {
$_SESSION['oLP'] -> current = intval($_GET['id']); $_SESSION['oLP'] -> current = intval($_GET['id']);
} }
$this_section=SECTION_COURSES; $this_section=SECTION_COURSES;
api_protect_course_script(); api_protect_course_script();
/* /* Libraries */
Libraries
*/ // The main_api.lib.php, database.lib.php and display.lib.php
//the main_api.lib.php, database.lib.php and display.lib.php // libraries are included by default.
//libraries are included by default
require_once 'learnpath_functions.inc.php'; require_once 'learnpath_functions.inc.php';
//include '../resourcelinker/resourcelinker.inc.php'; //include '../resourcelinker/resourcelinker.inc.php';
@ -52,16 +52,15 @@ require_once 'resourcelinker.inc.php';
// name of the language file that needs to be included // name of the language file that needs to be included
$language_file = "learnpath"; $language_file = "learnpath";
/* Header and action code */
/* Header and action code */ /* Constants and variables */
/* Constants and variables */ $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$is_allowed_to_edit = api_is_allowed_to_edit(null,true);
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN); $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW); $tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW);
$isStudentView = (empty($_REQUEST['isStudentView'])?0:(int) $_REQUEST['isStudentView']); $isStudentView = (empty($_REQUEST['isStudentView']) ? 0 : (int) $_REQUEST['isStudentView']);
$learnpath_id = (int) $_REQUEST['lp_id']; $learnpath_id = (int) $_REQUEST['lp_id'];
/* /*
$chapter_id = $_GET['chapter_id']; $chapter_id = $_GET['chapter_id'];
@ -76,20 +75,18 @@ $moduleid = $_REQUEST['moduleid'];
$prereq = $_REQUEST['prereq']; $prereq = $_REQUEST['prereq'];
$type = $_REQUEST['type']; $type = $_REQUEST['type'];
*/ */
/*
MAIN CODE /* MAIN CODE */
*/
// using the resource linker as a tool for adding resources to the learning path // Using the resource linker as a tool for adding resources to the learning path.
if ($action=="add" and $type=="learnpathitem") if ($action == 'add' && $type == 'learnpathitem') {
{
$htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>"; $htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
} }
if ( (! $is_allowed_to_edit) or ($isStudentView) ) if ((!$is_allowed_to_edit) || ($isStudentView)) {
{
error_log('New LP - User not authorized in lp_view_item.php'); error_log('New LP - User not authorized in lp_view_item.php');
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id); header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
} }
//from here on, we are admin because of the previous condition, so don't check anymore // From here on, we are admin because of the previous condition, so don't check anymore.
$sql_query = "SELECT * FROM $tbl_lp WHERE id = $learnpath_id"; $sql_query = "SELECT * FROM $tbl_lp WHERE id = $learnpath_id";
$result=Database::query($sql_query); $result=Database::query($sql_query);
@ -97,33 +94,29 @@ $therow=Database::fetch_array($result);
//$admin_output = ''; //$admin_output = '';
/* /*
-----------------------------------------------------------
Course admin section Course admin section
- all the functions not available for students - always available in this case (page only shown to admin) - all the functions not available for students - always available in this case (page only shown to admin)
-----------------------------------------------------------
*/ */
/* SHOWING THE ADMIN TOOLS */
/* SHOWING THE ADMIN TOOLS */
/* prerequisites setting end */ if (isset($_SESSION['gradebook'])) {
if (isset($_SESSION['gradebook'])){ $gradebook = $_SESSION['gradebook'];
$gradebook= $_SESSION['gradebook'];
} }
if (!empty($gradebook) && $gradebook=='view') { if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[]= array ( $interbreadcrumb[] = array (
'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook') 'name' => get_lang('ToolGradebook')
); );
} }
$interbreadcrumb[]= array ("url"=>"lp_controller.php?action=list", "name"=> get_lang("_learning_path")); $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('_learning_path'));
$interbreadcrumb[]= array ("url"=>api_get_self()."?action=build&lp_id=$learnpath_id", "name" => stripslashes("{$therow['name']}")); $interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}"));
//Theme calls // Theme calls
$show_learn_path=true; $show_learn_path = true;
$lp_theme_css=$_SESSION['oLP']->get_theme(); $lp_theme_css = $_SESSION['oLP']->get_theme();
Display::display_header(null,'Path'); Display::display_header(null,'Path');
//api_display_tool_title($therow['name']); //api_display_tool_title($therow['name']);
@ -154,14 +147,14 @@ function confirmation(name) {
//echo $admin_output; //echo $admin_output;
/* DISPLAY SECTION */ /* DISPLAY SECTION */
echo $_SESSION['oLP']->build_action_menu(); echo $_SESSION['oLP']->build_action_menu();
echo '<table cellpadding="0" cellspacing="0" class="lp_build">'; echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
echo '<tr>'; echo '<tr>';
echo '<td class="tree">'; echo '<td class="tree">';
echo '<div class="lp_tree">'; echo '<div class="lp_tree">';
//build the tree with the menu items in it // Build the tree with the menu items in it.
echo $_SESSION['oLP']->build_tree(); echo $_SESSION['oLP']->build_tree();
echo '</div>'; echo '</div>';
echo '</td>'; echo '</td>';
@ -171,6 +164,6 @@ echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';
/* FOOTER */ /* FOOTER */
Display::display_footer(); Display::display_footer();
?>
Loading…
Cancel
Save