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']
* @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.
* The first section (below) is the initialisation 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
*
* 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
* 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.
*/
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)
* @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() {
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)
*
* 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'
*/
public function get_lesson_mode() {
@ -647,7 +647,7 @@ class learnpathItem {
* 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
* 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 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
@ -1185,7 +1185,7 @@ class learnpathItem {
* @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 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
*/
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
* @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');
$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.
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
// Remove funny link parts.
$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
// 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.

@ -2,7 +2,7 @@
/* 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 Denes Nagy

@ -2,7 +2,7 @@
/* 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
*
* @author Patrick Cool

@ -2,7 +2,7 @@
/* 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 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();
$mylaunch_data = $mylpi->get_launch_data();
/*
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)
if ($mylpi->get_type() == 'asset') {
// 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';
$mylpi->set_status('completed');
$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();
$mylaunch_data = $mylpi->get_launch_data();
/*
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)
if ($mylpi->get_type() == 'asset') {
// 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';
$mylpi->set_status('completed');
$mylpi->save();

@ -2,7 +2,7 @@
/* 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 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();
$mylaunch_data = $mylpi->get_launch_data();
/*
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)
if ($mylpi->get_type() == 'asset') {
// 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';
$mylpi->set_status('completed');
$mylpi->save();

@ -2,7 +2,7 @@
/* 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 Denes Nagy

@ -2,7 +2,7 @@
/* 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 Denes Nagy

@ -2,7 +2,7 @@
/* 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 Denes Nagy

@ -1,45 +1,51 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script opened in an iframe and containing the learning path's table of contents
* @package chamilo.learnpath
* @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;
$language_file[] = "scormdocument";
$language_file[] = "scorm";
$language_file[] = "learnpath";
$language_file[] = 'scormdocument';
$language_file[] = 'scorm';
$language_file[] = 'learnpath';
require_once 'back_compat.inc.php';
require_once 'learnpath.class.php';
require_once 'scorm.class.php';
require_once 'aicc.class.php';
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']);
if(is_object($oLP)){
if (is_object($oLP)) {
$_SESSION['oLP'] = $oLP;
}else{
//error_log('New LP - in lp_toc.php - SESSION[lpobject] is not object - dying',0);
} else {
//error_log('New LP - in lp_toc.php - SESSION[lpobject] is not object - dying', 0);
die('Could not instanciate lp object');
}
}
$charset = $_SESSION['oLP']->encoding;
$htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
var dokeos_xajax_handler = window.parent.oxajax;
</script>';
$scorm_css_header=true;
$display_mode='';
$lp_theme_css=$_SESSION['oLP']->get_theme();
$scorm_css_header = true;
$display_mode = '';
$lp_theme_css = $_SESSION['oLP']->get_theme();
include_once '../inc/reduced_header.inc.php';
?>
<body>
<?php echo $_SESSION['oLP']->get_html_toc();?><br/>
<body dir="<?php echo api_get_text_direction(); ?>">
<?php echo $_SESSION['oLP']->get_html_toc();?><br />
</body>
</html>
<?php
if (!empty($_SESSION['oLP'])) {
$_SESSION['lpobject'] = serialize($_SESSION['oLP']);
}
?>

@ -1,74 +1,69 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script managing the learnpath upload. To best treat the uploaded file, make sure we can identify it.
* @package chamilo.learnpath
* @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;
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;
if ( empty($_POST['current_dir']) ) {
if (empty($_POST['current_dir'])) {
$current_dir = '';
} 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
* size set in php.ini, all variables from POST are cleared !
*/
if ($_SERVER['REQUEST_METHOD'] == 'POST'
&& count($_FILES)>0
&& !empty($_FILES['user_file']['name'])
)
{
if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_FILES) > 0 && !empty($_FILES['user_file']['name'])) {
// A file upload has been detected, now deal with the file...
//directory creation
// Directory creation.
$stopping_error = false;
$s=$_FILES['user_file']['name'];
//get name of the zip file without the extension
$s = $_FILES['user_file']['name'];
// Get name of the zip file without the extension.
$info = pathinfo($s);
$filename = $info['basename'];
$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';
$type = learnpath::get_package_type($_FILES['user_file']['tmp_name'],$_FILES['user_file']['name']);
switch($type){
$type = learnpath::get_package_type($_FILES['user_file']['tmp_name'], $_FILES['user_file']['name']);
switch ($type) {
case 'scorm':
require_once 'scorm.class.php';
$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
return api_failure::set_failure(api_failure::get_last_failure());
}
if(!empty($manifest)){
if (!empty($manifest)) {
$oScorm->parse_manifest($manifest);
$oScorm->import_manifest(api_get_course_id());
}else{
//show error message stored in $oScrom->error_msg
} else {
// Show error message stored in $oScrom->error_msg.
}
$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 = '';
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_maker($maker);
$oScorm->set_jslib('scorm_api.php');
@ -77,14 +72,14 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST'
require_once 'aicc.class.php';
$oAICC = new aicc();
$config_dir = $oAICC->import_package($_FILES['user_file']);
if(!empty($config_dir)){
if (!empty($config_dir)) {
$oAICC->parse_config_files($config_dir);
$oAICC->import_aicc(api_get_course_id());
}
$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 = '';
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_maker($maker);
$oAICC->set_jslib('aicc_api.php');
@ -106,44 +101,44 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST'
return api_failure::set_failure('not_a_learning_path');
}
} // end if is_uploaded_file
elseif($_SERVER['REQUEST_METHOD'] == 'POST')
{
//if file name given to get in claroline/upload/, try importing this way
elseif($_SERVER['REQUEST_METHOD'] == 'POST') {
// If file name given to get in claroline/upload/, try importing this way.
// A file upload has been detected, now deal with the file...
//directory creation
// Directory creation.
$stopping_error = false;
//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']);
//get name of the zip file without the extension
// 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']);
// Get name of the zip file without the extension
$info = pathinfo($s);
$filename = $info['basename'];
$extension = $info['extension'];
$file_base_name = str_replace('.'.$extension,'',$filename);
$new_dir = replace_dangerous_char(trim($file_base_name),'strict');
$file_base_name = str_replace('.'.$extension, '', $filename);
$new_dir = replace_dangerous_char(trim($file_base_name), 'strict');
require_once 'learnpath.class.php';
$type = learnpath::get_package_type($s,basename($s));
switch($type){
$type = learnpath::get_package_type($s, basename($s));
switch ($type) {
case 'scorm':
require_once 'scorm.class.php';
$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
return api_failure::set_failure(api_failure::get_last_failure());
}
if(!empty($manifest)){
if (!empty($manifest)) {
$oScorm->parse_manifest($manifest);
$oScorm->import_manifest(api_get_course_id());
}
$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 = '';
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_maker($maker);
$oScorm->set_jslib('scorm_api.php');
@ -151,15 +146,15 @@ elseif($_SERVER['REQUEST_METHOD'] == 'POST')
case 'aicc':
require_once 'aicc.class.php';
$oAICC = new aicc();
$config_dir = $oAICC->import_local_package($s,$current_dir);
if(!empty($config_dir)){
$config_dir = $oAICC->import_local_package($s, $current_dir);
if (!empty($config_dir)) {
$oAICC->parse_config_files($config_dir);
$oAICC->import_aicc(api_get_course_id());
}
$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 = '';
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_maker($maker);
$oAICC->set_jslib('aicc_api.php');
@ -169,4 +164,3 @@ elseif($_SERVER['REQUEST_METHOD'] == 'POST')
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
* This notice must stay intact for legal use
***********************************************/

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* 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
@ -10,15 +11,13 @@
* @author Denes Nagy, principal author
* @author Isthvan Mandak, several new features
* @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';
$this_section=SECTION_COURSES;
$this_section = SECTION_COURSES;
if ($lp_controller_touched != 1){
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();
// we set the encoding of the lp
// We set the encoding of the lp.
if (!empty($_SESSION['oLP']->encoding)) {
$charset = $_SESSION['oLP']->encoding;
} else {
@ -47,19 +46,19 @@ if (!empty($_SESSION['oLP']->encoding)) {
$oLearnpath = false;
$course_code = api_get_course_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;
//escape external variables
// Escape external variables.
/* 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' ) {
$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 language="javascript" type="text/javascript">
$(document).ready(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;
</script>';
$_SESSION['oLP']->error = '';
$lp_type = $_SESSION['oLP']->get_type();
$lp_item_id = $_SESSION['oLP']->get_current_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_item_id'] = $lp_item_id;
$_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);
}
unset($_SESSION['objExercise']);
unset($_SESSION['questionList']);
/**
* Get a link to the corresponding document
* Get a link to the corresponding document.
*/
if (!isset($src)) {
$src = '';
@ -99,39 +99,39 @@ if (!isset($src)) {
$_SESSION['oLP']->stop_previous_item();
$htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
$prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
if($prereq_check === true){
$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
if ($prereq_check === true) {
$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.
$file_info = pathinfo($src);
if (api_strtolower(substr($file_info['extension'], 0, 3) == 'pdf')) {
$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 {
$src = 'blank.php?error=prerequisites';
}
break;
case 2:
//save old if asset
$_SESSION['oLP']->stop_previous_item(); //save status manually if asset
// save old if asset
$_SESSION['oLP']->stop_previous_item(); // save status manually if asset
$htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
$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);
$_SESSION['oLP']->start_current_item(); //starts time counter manually if asset
}else{
$src = 'blank.php?error=prerequisites';
$_SESSION['oLP']->start_current_item(); // starts time counter manually if asset
} else {
$src = 'blank.php?error=prerequisites';
}
break;
case 3:
//aicc
$_SESSION['oLP']->stop_previous_item(); //save status manually if asset
// aicc
$_SESSION['oLP']->stop_previous_item(); // save status manually if asset
$htmlHeadXtra[] = '<script src="'.$_SESSION['oLP']->get_js_lib().'" type="text/javascript" language="javascript"></script>';
$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);
$_SESSION['oLP']->start_current_item(); //starts time counter manually if asset
}else{
$_SESSION['oLP']->start_current_item(); // starts time counter manually if asset
} else {
$src = 'blank.php';
}
break;
@ -144,13 +144,13 @@ $list = $_SESSION['oLP']->get_toc();
$type_quiz = false;
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;
}
}
$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'])) {
global $src;
$_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);
$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]."'";
Database::query($sql_upd_score);
}
}
if(intval($_GET['fb_type']) > 0) {
if (intval($_GET['fb_type']) > 0) {
$src = 'blank.php?msg=exerciseFinished';
} 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']);
@ -202,29 +202,31 @@ if ($type_quiz && !empty($_REQUEST['exeId']) && isset($_GET['lp_id']) && isset($
$_SESSION['oLP']->set_previous_item($lp_item_id);
$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;
$_setting['show_navigation_menu'] = 'false';
$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)
$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).
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>";
}
//not fullscreen mode
// Not in fullscreen mode.
require_once '../inc/reduced_header.inc.php';
//$displayAudioRecorder = (api_get_setting('service_visio','active')=='true') ? true : false;
//check if audio recorder needs to be in studentview
$course_id=$_SESSION["_course"]["id"];
if ($_SESSION["status"][$course_id]==5) {
//$displayAudioRecorder = (api_get_setting('service_visio', 'active') == 'true') ? true : false;
// Check if audio recorder needs to be in studentview.
$course_id = $_SESSION['_course']['id'];
if ($_SESSION['status'][$course_id] == 5) {
$audio_recorder_studentview = true;
} else {
$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;
?>
<body>
<body dir="<?php echo api_get_text_direction(); ?>">
<div id="learning_path_main" style="width:100%;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>
<tr>
<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>
<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>
</td>
</tr>
@ -277,7 +279,7 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
$scorm_css_header = true;
$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) {
global $lp_theme_css;
} else {
@ -290,7 +292,7 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$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."'";
$res_media= Database::query($sql);
@ -314,9 +316,9 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
</div>
<!-- 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"'); ?>
<div id="media" <?php echo $style_media ?>>
<?php echo (!empty($mediaplayer))?$mediaplayer:'&nbsp;' ?>
<?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; ?>>
<?php echo (!empty($mediaplayer)) ? $mediaplayer : '&nbsp;' ?>
</div>
<!-- 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%">
<?php
// 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>';
} else {
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 -->
</div>
<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;
</script>
<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() {
document.body.style.overflow = 'hidden';
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';
}
//loads the glossary library
// Loads the glossary library.
<?php
if (api_get_setting('show_glossary_in_extra_tools') == 'true') {
if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
@ -419,5 +421,5 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
</script>
</body>
<?php
//restore global setting
// Restore a global setting.
$_setting['show_navigation_menu'] = $save_setting;

@ -1,25 +1,26 @@
<?php
/* 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'])) {
// including the global file
/**
* This is a learning path creation and player tool in Chamilo - 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'])) {
// Including the global initialization file.
require_once '../inc/global.inc.php';
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']);
$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']) {
header("Location: ".urldecode(Security::remove_XSS($_GET['src'])));
exit;
@ -29,21 +30,20 @@ if(isset($_GET['src'])) {
}
}
/* INIT SECTION */
/* INIT SECTION */
$_SESSION['whereami'] = 'lp/build';
if(isset($_SESSION['oLP']) && isset($_GET['id'])) {
if (isset($_SESSION['oLP']) && isset($_GET['id'])) {
$_SESSION['oLP'] -> current = intval($_GET['id']);
}
$this_section=SECTION_COURSES;
api_protect_course_script();
/*
Libraries
*/
//the main_api.lib.php, database.lib.php and display.lib.php
//libraries are included by default
/* Libraries */
// The main_api.lib.php, database.lib.php and display.lib.php
// libraries are included by default.
require_once 'learnpath_functions.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
$language_file = "learnpath";
/* Header and action code */
/* Constants and variables */
$is_allowed_to_edit = api_is_allowed_to_edit(null,true);
/* Header and action code */
/* Constants and variables */
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$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'];
/*
$chapter_id = $_GET['chapter_id'];
@ -76,20 +75,18 @@ $moduleid = $_REQUEST['moduleid'];
$prereq = $_REQUEST['prereq'];
$type = $_REQUEST['type'];
*/
/*
MAIN CODE
*/
// using the resource linker as a tool for adding resources to the learning path
if ($action=="add" and $type=="learnpathitem")
{
/* MAIN CODE */
// Using the resource linker as a tool for adding resources to the learning path.
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>";
}
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');
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";
$result=Database::query($sql_query);
@ -97,33 +94,29 @@ $therow=Database::fetch_array($result);
//$admin_output = '';
/*
-----------------------------------------------------------
Course admin section
- 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'])){
$gradebook= $_SESSION['gradebook'];
if (isset($_SESSION['gradebook'])) {
$gradebook = $_SESSION['gradebook'];
}
if (!empty($gradebook) && $gradebook=='view') {
$interbreadcrumb[]= array (
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array (
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);
}
$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' => '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']}"));
//Theme calls
$show_learn_path=true;
$lp_theme_css=$_SESSION['oLP']->get_theme();
// Theme calls
$show_learn_path = true;
$lp_theme_css = $_SESSION['oLP']->get_theme();
Display::display_header(null,'Path');
//api_display_tool_title($therow['name']);
@ -154,14 +147,14 @@ function confirmation(name) {
//echo $admin_output;
/* DISPLAY SECTION */
/* DISPLAY SECTION */
echo $_SESSION['oLP']->build_action_menu();
echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
echo '<tr>';
echo '<td class="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 '</div>';
echo '</td>';
@ -171,6 +164,6 @@ echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
echo '</tr>';
echo '</table>';
/* FOOTER */
/* FOOTER */
Display::display_footer();
?>
Loading…
Cancel
Save