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

skala
Ivan Tcholakov 15 years ago
parent 4ddb34fef2
commit e08e95326c
  1. 88
      main/newscorm/lp_add.php
  2. 137
      main/newscorm/lp_add_item.php
  3. 188
      main/newscorm/lp_admin_view.php
  4. 54
      main/newscorm/lp_ajax_initialize.php
  5. 181
      main/newscorm/lp_ajax_last_update_status.php
  6. 42
      main/newscorm/lp_ajax_log.php
  7. 387
      main/newscorm/lp_ajax_save_item.php
  8. 51
      main/newscorm/lp_ajax_save_objectives.php
  9. 7
      main/newscorm/lp_ajax_start_timer.php
  10. 417
      main/newscorm/lp_ajax_switch_item.php
  11. 331
      main/newscorm/lp_ajax_switch_item_toc.php
  12. 9
      main/newscorm/lp_api.php

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php
*
@ -9,33 +10,27 @@
* @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update for new SCORM tool
* @package chamilo.learnpath
*/
/*
* INIT SECTION
*/
$this_section=SECTION_COURSES;
/* INIT SECTION */
$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.
include 'learnpath_functions.inc.php';
//include '../resourcelinker/resourcelinker.inc.php';
include 'resourcelinker.inc.php';
//rewrite the language file, sadly overwritten by resourcelinker.inc.php
// name of the language file that needs to be included
// Rewrite the language file, sadly overwritten by resourcelinker.inc.php.
// Name of the language file that needs to be included.
$language_file = 'learnpath';
/*
-----------------------------------------------------------
Header and action code
-----------------------------------------------------------
*/
/* Header and action code */
$currentstyle = api_get_setting('stylesheets');
//$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CODE_PATH).'css/'.$currentstyle.'/learnpath.css"/>';
//$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="learnpath.css" />'; //will be a merged with original learnpath.css
@ -49,12 +44,10 @@ $(document).ready(function () {
setFocus();
});
</script>';
/*
-----------------------------------------------------------
Constants and variables
-----------------------------------------------------------
*/
$is_allowed_to_edit = api_is_allowed_to_edit(null,true);
/* 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);
@ -64,35 +57,28 @@ $isStudentView = (int) $_REQUEST['isStudentView'];
$learnpath_id = (int) $_REQUEST['lp_id'];
$submit = $_POST['submit_button'];
/*
==============================================================================
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_add.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);
$therow=Database::fetch_array($result);
$result = Database::query($sql_query);
$therow = Database::fetch_array($result);
/*
-----------------------------------------------------------
Course admin section
- all the functions not available for students - always available in this case (page only shown to admin)
-----------------------------------------------------------
*/
if (isset($_SESSION['gradebook'])){
$gradebook= $_SESSION['gradebook'];
$gradebook = $_SESSION['gradebook'];
}
if (!empty($gradebook) && $gradebook=='view') {
@ -102,28 +88,27 @@ if (!empty($gradebook) && $gradebook=='view') {
);
}
$interbreadcrumb[]= array ("url"=>"lp_controller.php?action=list", "name"=> get_lang("_learning_path"));
$interbreadcrumb[]= array ("url"=>"#", "name"=> get_lang("_add_learnpath"));
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('_learning_path'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('_add_learnpath'));
Display::display_header(null,'Path');
Display::display_header(null, 'Path');
echo '<div class="actions">';
echo '<a href="lp_controller.php?cidReq='.$_course['sysCode'].'">'.Display::return_icon('scorm.gif',get_lang('ReturnToLearningPaths')).' '.get_lang('ReturnToLearningPaths').'</a>';
echo '<a href="lp_controller.php?cidReq='.$_course['sysCode'].'">'.Display::return_icon('scorm.gif', get_lang('ReturnToLearningPaths')).' '.get_lang('ReturnToLearningPaths').'</a>';
echo '</div>';
Display::display_normal_message(get_lang('AddLpIntro'),false);
Display::display_normal_message(get_lang('AddLpIntro'), false);
if ($_POST AND empty($_REQUEST['learnpath_name']))
{
if ($_POST AND empty($_REQUEST['learnpath_name'])) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
}
echo '<form method="post">';
// form title
// Form title
echo '<div class="row"><div class="form_header">'.get_lang('AddLpToStart').'</div></div>';
// title field
// Title field
echo '<div class="row">';
echo '<div class="label">';
echo '<label for="idTitle"><span class="form_required">*</span> '.get_lang('LPName').'</label>';
@ -133,7 +118,7 @@ echo '<input id="learnpath_title" name="learnpath_name" type="text" size="50" />
echo '</div>';
echo '</div>';
// submit button
// Submit button
echo '<div class="row">';
echo '<div class="label">';
echo '</div>';
@ -149,6 +134,5 @@ echo '<div class="label"></div>';
echo '<div class="formw"><span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small></div>';
echo '</div>';
// footer
// Footer
Display::display_footer();
?>

@ -1,41 +1,38 @@
<?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
* @author Julio Montoya - Improving the list of templates
* @package chamilo.learnpath
*/
* 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
* @author Julio Montoya - Improving the list of templates
* @package chamilo.learnpath
*/
/*
INIT SECTION
*/
$this_section=SECTION_COURSES;
/* INIT SECTION */
$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.
include 'learnpath_functions.inc.php';
//include '../resourcelinker/resourcelinker.inc.php';
include 'resourcelinker.inc.php';
//rewrite the language file, sadly overwritten by resourcelinker.inc.php
// name of the language file that needs to be included
// Rewrite the language file, sadly overwritten by resourcelinker.inc.php.
// Name of the language file that needs to be included.
$language_file = 'learnpath';
/*
Header and action code
*/
/* Header and action code */
$htmlHeadXtra[] = '
<script type="text/javascript">
@ -117,11 +114,10 @@ function InnerDialogLoaded() {
</script>';
$htmlHeadXtra[] = $_SESSION['oLP']->create_js();
/*
Constants and variables
*/
$is_allowed_to_edit = api_is_allowed_to_edit(null,true);
/* 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);
@ -143,60 +139,60 @@ $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_add_item.php');
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
exit;
}
//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);
$therow=Database::fetch_array($result);
$result = Database::query($sql_query);
$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
*/
if (isset($_SESSION['gradebook'])){
$gradebook= $_SESSION['gradebook'];
/* SHOWING THE ADMIN TOOLS */
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']}"));
switch($_GET['type']) {
case 'chapter':
$interbreadcrumb[]= array ("url"=>"#", "name" => get_lang("NewChapter"));
break;
$interbreadcrumb[]= array ('url' => '#', 'name' => get_lang('NewChapter'));
break;
default:
$interbreadcrumb[]= array ("url"=>"#", "name" => get_lang("NewStep"));
break;
$interbreadcrumb[]= array ('url' => '#', 'name' => get_lang('NewStep'));
break;
}
//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');
Display::display_header(null, 'Path');
//api_display_tool_title($therow['name']);
$suredel = trim(get_lang('AreYouSureToDelete'));
@ -228,28 +224,27 @@ 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">';
// show the template list
if (isset($_GET['type']) && $_GET['type']=='document' && !isset($_GET['file'])) {
// Show the template list.
if (isset($_GET['type']) && $_GET['type'] == 'document' && !isset($_GET['file'])) {
$count_items = count($_SESSION['oLP']->ordered_items);
$style = ($count_items > 12)?' style="height:250px;width:230px;overflow-x : auto; overflow-y : scroll;" ':' class="lp_tree" ';
$style = ($count_items > 12) ? ' style="height:250px;width:230px;overflow-x : auto; overflow-y : scroll;" ' : ' class="lp_tree" ';
echo '<div '.$style.'>';
//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>';
// show the template list
echo '<p style="border-bottom:1px solid #999999; margin:0; padding:2px;"></p>'; //line
// Show the template list.
echo '<p style="border-bottom:1px solid #999999; margin:0; padding:2px;"></p>';
echo '<br />';
echo '<div id="frmModel" style="display:block; height:890px;width:100px; position:relative;"></div>';
} else {
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>';
}
@ -257,7 +252,7 @@ echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
echo '</td>';
echo '<td class="workspace">';
if(isset($new_item_id) && is_numeric($new_item_id)) {
if (isset($new_item_id) && is_numeric($new_item_id)) {
switch($_GET['type']) {
case 'chapter':
echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']);
@ -297,10 +292,10 @@ echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
} else {
switch($_GET['type']) {
case 'chapter':
echo $_SESSION['oLP']->display_item_form($_GET['type'], get_lang("EnterDataNewChapter"));
echo $_SESSION['oLP']->display_item_form($_GET['type'], get_lang('EnterDataNewChapter'));
break;
case 'module':
echo $_SESSION['oLP']->display_item_form($_GET['type'], get_lang("EnterDataNewModule"));
echo $_SESSION['oLP']->display_item_form($_GET['type'], get_lang('EnterDataNewModule'));
break;
case 'document':
if(isset($_GET['file']) && is_numeric($_GET['file'])) {
@ -336,8 +331,6 @@ echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
echo '</tr>';
echo '</table>';
/*
FOOTER
*/
/* FOOTER */
Display::display_footer();
?>

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php
*
@ -10,33 +11,26 @@
* @package chamilo.learnpath
*/
/*
* INIT SECTION
*/
$this_section=SECTION_COURSES;
/* INIT SECTION */
$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.
include 'learnpath_functions.inc.php';
//include '../resourcelinker/resourcelinker.inc.php';
include 'resourcelinker.inc.php';
//rewrite the language file, sadly overwritten by resourcelinker.inc.php
// Rewrite the language file, sadly overwritten by resourcelinker.inc.php.
$language_file = "learnpath";
/*
-----------------------------------------------------------
Constants and variables
-----------------------------------------------------------
*/
$is_allowed_to_edit = api_is_allowed_to_edit(null,true);
/* 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);
@ -58,62 +52,52 @@ $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' and $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_admin_view.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);
$therow=Database::fetch_array($result);
$result = Database::query($sql_query);
$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 */
/*==================================================
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' => 'lp_controller.php?action=list', 'name' => get_lang('_learning_path'));
$interbreadcrumb[]= array ("url"=>api_get_self()."?action=admin_view&lp_id=$learnpath_id", "name" => stripslashes("{$therow['name']}"));
$interbreadcrumb[] = array('url' => api_get_self()."?action=admin_view&lp_id=$learnpath_id", "name" => stripslashes("{$therow['name']}"));
//Theme calls
$show_learn_path=true;
$lp_theme_css=$_SESSION['oLP']->get_theme();
Display::display_header(null,'Path');
// Theme calls.
$show_learn_path = true;
$lp_theme_css = $_SESSION['oLP']->get_theme();
Display::display_header(null, 'Path');
//api_display_tool_title($therow['name']);
$suredel = trim(get_lang('AreYouSureToDelete'));
@ -143,22 +127,14 @@ function confirmation(name)
</script>
<?php
/*
-----------------------------------------------------------
DISPLAY SECTION
-----------------------------------------------------------
*/
/* DISPLAY SECTION */
switch($_GET['action'])
{
switch ($_GET['action']) {
case 'edit_item':
if(isset($is_success) && $is_success === true)
{
Display::display_confirmation_message(get_lang("_learnpath_item_edited"));
}
else
{
if (isset($is_success) && $is_success === true) {
Display::display_confirmation_message(get_lang('_learnpath_item_edited'));
} else {
echo $_SESSION['oLP']->display_edit_item($_GET['id']);
}
@ -166,24 +142,22 @@ switch($_GET['action'])
case 'delete_item':
if(isset($is_success) && $is_success === true)
{
Display::display_confirmation_message(get_lang("_learnpath_item_deleted"));
if (isset($is_success) && $is_success === true) {
Display::display_confirmation_message(get_lang('_learnpath_item_deleted'));
}
break;
}
// POST action handling (uploading mp3, deleting mp3)
if (isset($_POST['save_audio']))
{
// deleting the audio fragments
foreach ($_POST as $key=>$value) {
if (substr($key,0,9) == 'removemp3') {
$lp_items_to_remove_audio[] = str_ireplace('removemp3','',$key);
// removing the audio from the learning path item
if (isset($_POST['save_audio'])) {
// Deleting the audio fragments.
foreach ($_POST as $key => $value) {
if (substr($key, 0, 9) == 'removemp3') {
$lp_items_to_remove_audio[] = str_ireplace('removemp3', '', $key);
// Removing the audio from the learning path item.
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$in = implode(',',$lp_items_to_remove_audio);
$in = implode(',', $lp_items_to_remove_audio);
}
}
if (count($lp_items_to_remove_audio)>0) {
@ -191,59 +165,55 @@ if (isset($_POST['save_audio']))
$result = Database::query($sql);
}
// uploading the audio files
foreach ($_FILES as $key=>$value)
{
if (substr($key,0,7) == 'mp3file' AND !empty($_FILES[$key]['tmp_name']))
{
// the id of the learning path item
$lp_item_id = str_ireplace('mp3file','',$key);
// Uploading the audio files.
foreach ($_FILES as $key => $value) {
if (substr($key, 0, 7) == 'mp3file' AND !empty($_FILES[$key]['tmp_name'])) {
// The id of the learning path item.
$lp_item_id = str_ireplace('mp3file', '', $key);
// create the audio folder if it does not exist yet
// Create the audio folder if it does not exist yet.
global $_course;
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
if(!is_dir($filepath.'audio'))
{
if (!is_dir($filepath.'audio')) {
mkdir($filepath.'audio', api_get_permissions_for_new_directories());
$audio_id=add_document($_course,'/audio','folder',0,'audio');
api_item_property_update($_course, TOOL_DOCUMENT, $audio_id, 'FolderCreated', api_get_user_id(),null,null,null,null,api_get_session_id());
$audio_id = add_document($_course, '/audio', 'folder', 0, 'audio');
api_item_property_update($_course, TOOL_DOCUMENT, $audio_id, 'FolderCreated', api_get_user_id(), null, null, null, null, api_get_session_id());
}
// check if file already exits into document/audio/
// Check if file already exits into document/audio/
$file_name = $_FILES[$key]['name'];
$file_name=stripslashes($file_name);
//add extension to files without one (if possible)
$file_name = add_ext_on_mime($file_name,$_FILES[$key]['type']);
$file_name = stripslashes($file_name);
// Add extension to files without one (if possible).
$file_name = add_ext_on_mime($file_name, $_FILES[$key]['type']);
$clean_name = replace_dangerous_char($file_name);
//no "dangerous" files
// No "dangerous" files.
$clean_name = disable_dangerous_file($clean_name);
$check_file_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/audio/'.$clean_name;
// if the file exists we generate a new name
// If the file exists we generate a new name.
if (file_exists($check_file_path)) {
$filename_components = explode('.',$clean_name);
// gettting the extension of the file
$file_extension = $filename_components[count($filename_components)-1];
// adding something random to prevent overwriting
$filename_components[count($filename_components)-1] = time();
// reconstructing the new filename
$filename_components = explode('.', $clean_name);
// Gettting the extension of the file.
$file_extension = $filename_components[count($filename_components) - 1];
// Adding something random to prevent overwriting.
$filename_components[count($filename_components) - 1] = time();
// Reconstructing the new filename.
$clean_name = implode($filename_components) .'.'.$file_extension;
// using the new name in the $_FILES superglobal
// Using the new name in the $_FILES superglobal.
$_FILES[$key]['name'] = $clean_name;
}
// upload the file in the documents tool
// Upload the file in the documents tool.
include_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
$file_path = handle_uploaded_document($_course, $_FILES[$key],api_get_path(SYS_COURSE_PATH).$_course['path'].'/document','/audio',api_get_user_id(),'','','','','',false);
$file_path = handle_uploaded_document($_course, $_FILES[$key], api_get_path(SYS_COURSE_PATH).$_course['path'].'/document','/audio', api_get_user_id(), '', '', '', '', '', false);
// getting the filename only
$file_components = explode('/',$file_path);
$file = $file_components[count($file_components)-1];
// Getting the filename only.
$file_components = explode('/', $file_path);
$file = $file_components[count($file_components) - 1];
// store the mp3 file in the lp_item table
// Store the mp3 file in the lp_item table.
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$sql_insert_audio = "UPDATE $tbl_lp_item SET audio = '".Database::escape_string($file)."' WHERE id = '".Database::escape_string($lp_item_id)."'";
Database::query($sql_insert_audio);
@ -256,10 +226,6 @@ if (isset($_POST['save_audio']))
echo $_SESSION['oLP']->overview();
/*
==============================================================================
FOOTER
==============================================================================
*/
/* FOOTER */
Display::display_footer();
?>

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script contains the server part of the xajax interaction process. The client part is located
* in lp_api.php or other api's.
@ -8,14 +9,15 @@
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Script
*/
//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;
// name of the language file that needs to be included
// Name of the language file that needs to be included.
$language_file[] = 'learnpath';
require_once 'back_compat.inc.php';
/**
* Get one item's details
* @param integer LP ID
@ -24,11 +26,10 @@ require_once 'back_compat.inc.php';
* @param integer Current item ID
* @param integer New item ID
*/
function initialize_item($lp_id,$user_id,$view_id,$next_item)
{
function initialize_item($lp_id, $user_id, $view_id, $next_item) {
$debug = 0;
$return = '';
if ($debug>0) {error_log('In initialize_item('.$lp_id.','.$user_id.','.$view_id.','.$next_item.')',0);}
if ($debug > 0) { error_log('In initialize_item('.$lp_id.','.$user_id.','.$view_id.','.$next_item.')', 0); }
//$objResponse = new xajaxResponse();
/*$item_id may be one of:
* -'next'
@ -45,21 +46,21 @@ function initialize_item($lp_id,$user_id,$view_id,$next_item)
require_once 'aiccItem.class.php';
$mylp = '';
if (isset($_SESSION['lpobject'])) {
if ($debug>1) {error_log('////$_SESSION[lpobject] is set',0);}
if ($debug > 1) { error_log('////$_SESSION[lpobject] is set', 0); }
$oLP =& unserialize($_SESSION['lpobject']);
if (!is_object($oLP)) {
if($debug>1){error_log(print_r($oLP,true),0);}
if($debug>2){error_log('////Building new lp',0);}
if ($debug > 1) { error_log(print_r($oLP,true), 0); }
if ($debug > 2) { error_log('////Building new lp', 0); }
unset($oLP);
$code = api_get_course_id();
$mylp = & new learnpath($code,$lp_id,$user_id);
} else {
if($debug>1){error_log('////Reusing session lp',0);}
if ($debug > 1) { error_log('////Reusing session lp', 0); }
$mylp = & $oLP;
}
}
$mylp->set_current_item($next_item);
if ($debug>1) {error_log('In initialize_item() - new item is '.$next_item,0);}
if ($debug > 1) { error_log('In initialize_item() - new item is '.$next_item, 0); }
$mylp->start_current_item(true);
/*
if ($mylp->force_commit) {
@ -68,11 +69,11 @@ function initialize_item($lp_id,$user_id,$view_id,$next_item)
*/
//$objResponse->addAlert(api_get_path(REL_CODE_PATH).'newscorm/learnpathItem.class.php');
if (is_object($mylp->items[$next_item])) {
if($debug>1){error_log('In initialize_item - recovering existing item object '.$next_item,0);}
if ($debug > 1) { error_log('In initialize_item - recovering existing item object '.$next_item, 0); }
$mylpi = & $mylp->items[$next_item];
} else {
if($debug>1){error_log('In initialize_item - generating new item object '.$next_item,0);}
$mylpi =& new learnpathItem($next_item,$user_id);
if ($debug > 1) { error_log('In initialize_item - generating new item object '.$next_item, 0); }
$mylpi =& new learnpathItem($next_item, $user_id);
$mylpi->set_lp_view($view_id);
}
/*
@ -86,11 +87,11 @@ function initialize_item($lp_id,$user_id,$view_id,$next_item)
*/
$myscore = $mylpi->get_score();
$mymax = $mylpi->get_max();
if($mymax===''){$mymax="''";}
if ($mymax === '') { $mymax = "''"; }
$mymin = $mylpi->get_min();
$mylesson_status = $mylpi->get_status();
$mylesson_location = $mylpi->get_lesson_location();
$mytotal_time = $mylpi->get_scorm_time('js',null,true);
$mytotal_time = $mylpi->get_scorm_time('js', null, true);
$mymastery_score = $mylpi->get_mastery_score();
$mymax_time_allowed = $mylpi->get_max_time_allowed();
$mylaunch_data = $mylpi->get_launch_data();
@ -99,11 +100,11 @@ function initialize_item($lp_id,$user_id,$view_id,$next_item)
$mylesson_location = $mylpi->get_lesson_location();
$myic = $mylpi->get_interactions_count();
$myistring = '';
for ($i=0;$i<$myic;$i++) {
for ($i = 0; $i < $myic; $i++) {
$myistring .= ",[".$i.",'','','','','','','']";
}
if (!empty($myistring)) {
$myistring = substr($myistring,1);
$myistring = substr($myistring, 1);
}
$return .=
"olms.score=".$myscore.";" .
@ -135,7 +136,7 @@ function initialize_item($lp_id,$user_id,$view_id,$next_item)
$mytotal = $mylp->get_total_items_count_without_chapters();
$mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode();
$myprogress_mode = ($myprogress_mode==''?'%':$myprogress_mode);
$myprogress_mode = ($myprogress_mode == '' ? '%' : $myprogress_mode);
$mynext = $mylp->get_next_item_id();
$myprevious = $mylp->get_previous_item_id();
$myitemtype = $mylpi->get_type();
@ -153,7 +154,7 @@ function initialize_item($lp_id,$user_id,$view_id,$next_item)
"olms.lms_initialized=0;" .
"olms.lms_view_id=".$view_id.";" .
"olms.lms_user_id=".$user_id.";" .
"olms.next_item=".$next_item.";" . //this one is very important to replace possible literal strings
"olms.next_item=".$next_item.";" . // This one is very important to replace possible literal strings.
"olms.lms_next_item=".$mynext.";" .
"olms.lms_previous_item=".$myprevious.";" .
"olms.lms_item_type = '".$myitemtype."';" .
@ -166,10 +167,11 @@ function initialize_item($lp_id,$user_id,$view_id,$next_item)
"olms.asset_timer = 0;";
$mylp->set_error_msg('');
$mylp->prerequisites_match(); //check the prerequisites are all complete
if($debug>1){error_log('Prereq_match() returned '.htmlentities($mylp->error),0);}
//$_SESSION['scorm_item_id'] = $new_item_id;//Save the new item ID for the exercise tool to use
$mylp->prerequisites_match(); // Check the prerequisites are all complete.
if ($debug > 1) { error_log('Prereq_match() returned '.htmlentities($mylp->error), 0); }
//$_SESSION['scorm_item_id'] = $new_item_id; // Save the new item ID for the exercise tool to use/
//$_SESSION['lpobject'] = serialize($mylp);
return $return;
}
echo initialize_item($_POST['lid'],$_POST['uid'],$_POST['vid'],$_POST['iid']);
echo initialize_item($_POST['lid'], $_POST['uid'], $_POST['vid'], $_POST['iid']);

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script contains the server part of the xajax interaction process. The
* client part is located in lp_api.php or other api's.
@ -19,11 +20,15 @@
* @package chamilo.learnpath
* @author Yannick Warnier <yannick.warnier@beeznest.com>
*/
//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;
// name of the language file that needs to be included
// Name of the language file that needs to be included.
$language_file[] = 'learnpath';
require_once 'back_compat.inc.php';
/**
* Writes an item's new values into the database and returns the operation result
* @param integer Learnpath ID
@ -32,95 +37,93 @@ require_once 'back_compat.inc.php';
* @param integer Item ID
* @return string JavaScript operations to execute as soon as returned
*/
function last_update_status($lp_id,$user_id,$view_id,$item_id)
{
error_log(__LINE__);
global $_configuration;
$debug=0;
$return = '';
if($debug>0){error_log('In last_update_status('.$lp_id.','.$user_id.','.$view_id.','.$item_id.')',0);}
require_once 'learnpath.class.php';
require_once 'scorm.class.php';
require_once 'learnpathItem.class.php';
require_once 'scormItem.class.php';
$mylp = '';
if(isset($_SESSION['lpobject']))
{
if($debug>1){error_log('////$_SESSION[lpobject] is set',0);}
$oLP =& unserialize($_SESSION['lpobject']);
if(!is_object($oLP)){
if($debug>2){error_log(print_r($oLP,true),0);}
if($debug>2){error_log('////Building new lp',0);}
unset($oLP);
$code = api_get_course_id();
$mylp = & new learnpath($code,$lp_id,$user_id);
}else{
if($debug>2){error_log('////Reusing session lp',0);}
$mylp = & $oLP;
}
}
error_log(__LINE__);
function last_update_status($lp_id, $user_id, $view_id, $item_id) {
error_log(__LINE__);
global $_configuration;
$debug = 0;
$return = '';
if ($debug > 0) { error_log('In last_update_status('.$lp_id.','.$user_id.','.$view_id.','.$item_id.')', 0); }
require_once 'learnpath.class.php';
require_once 'scorm.class.php';
require_once 'learnpathItem.class.php';
require_once 'scormItem.class.php';
$mylp = '';
if (isset($_SESSION['lpobject'])) {
if ($debug > 1) { error_log('////$_SESSION[lpobject] is set', 0); }
$oLP =& unserialize($_SESSION['lpobject']);
if (!is_object($oLP)) {
if ($debug > 2) { error_log(print_r($oLP, true), 0); }
if ($debug > 2) { error_log('////Building new lp', 0); }
unset($oLP);
$code = api_get_course_id();
$mylp = & new learnpath($code,$lp_id,$user_id);
} else {
if ($debug > 2) { error_log('////Reusing session lp', 0); }
$mylp = & $oLP;
}
}
error_log(__LINE__);
// this function should only be used for SCORM paths
if ($mylp->get_type()!=2) {
return;
}
$prereq_check = $mylp->prerequisites_match($item_id);
$mystatus = '';
if ($prereq_check === true) {
error_log(__LINE__);
//launch the prerequisites check and set error if needed
$mylpi =& $mylp->items[$item_id];
// This function should only be used for SCORM paths.
if ($mylp->get_type() != 2) {
return;
}
$prereq_check = $mylp->prerequisites_match($item_id);
$mystatus = '';
if ($prereq_check === true) {
error_log(__LINE__);
// Launch the prerequisites check and set error if needed.
$mylpi =& $mylp->items[$item_id];
$mystatus_in_db = $mylpi->get_status(true);
error_log($mystatus_in_db);
if ($mystatus_in_db == 'not attempted' or $mystatus_in_db == '') {
error_log(__LINE__);
$mystatus = 'completed';
$mastery_score = $mylpi->get_mastery_score();
if ($mastery_score != -1) {
error_log(__LINE__);
$score = $mylpi->get_score();
if ($score != 0 && $score >= $mastery_score) {
error_log(__LINE__);
$mystatus = 'passed';
} else {
error_log(__LINE__);
$mystatus = 'failed';
}
}
error_log(__LINE__);
$mylpi->set_status($mystatus);
$mylp->save_item($item_id,false);
} else {
error_log(__LINE__);
return $return;
}
} else {
error_log(__LINE__);
return $return;
}
error_log(__LINE__);
$mytotal = $mylp->get_total_items_count_without_chapters();
$mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode();
$myprogress_mode = ($myprogress_mode==''?'%':$myprogress_mode);
$return .= "update_toc('".$mystatus."','".$item_id."','no');";
error_log('Return is now '.$return);
$update_list = $mylp->get_update_queue();
foreach ($update_list as $my_upd_id => $my_upd_status) {
if ($my_upd_id != $item_id) { //only update the status from other items (i.e. parents and brothers), do not update current as we just did it already
$return .= "update_toc('".$my_upd_status."','".$my_upd_id."','no');";
}
}
$return .= "update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
$return .="update_stats();";
return $return;
//return $objResponse;
$mystatus_in_db = $mylpi->get_status(true);
error_log($mystatus_in_db);
if ($mystatus_in_db == 'not attempted' or $mystatus_in_db == '') {
error_log(__LINE__);
$mystatus = 'completed';
$mastery_score = $mylpi->get_mastery_score();
if ($mastery_score != -1) {
error_log(__LINE__);
$score = $mylpi->get_score();
if ($score != 0 && $score >= $mastery_score) {
error_log(__LINE__);
$mystatus = 'passed';
} else {
error_log(__LINE__);
$mystatus = 'failed';
}
}
error_log(__LINE__);
$mylpi->set_status($mystatus);
$mylp->save_item($item_id, false);
} else {
error_log(__LINE__);
return $return;
}
} else {
error_log(__LINE__);
return $return;
}
error_log(__LINE__);
$mytotal = $mylp->get_total_items_count_without_chapters();
$mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode();
$myprogress_mode = ($myprogress_mode==''?'%':$myprogress_mode);
$return .= "update_toc('".$mystatus."','".$item_id."','no');";
error_log('Return is now '.$return);
$update_list = $mylp->get_update_queue();
foreach ($update_list as $my_upd_id => $my_upd_status) {
if ($my_upd_id != $item_id) { // Only update the status from other items (i.e. parents and brothers), do not update current as we just did it already.
$return .= "update_toc('".$my_upd_status."','".$my_upd_id."','no');";
}
}
$return .= "update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
$return .="update_stats();";
return $return;
//return $objResponse;
}
error_log(__LINE__);
echo last_update_status(
$_REQUEST['lid'],
$_REQUEST['uid'],
$_REQUEST['vid'],
$_REQUEST['iid']);
$_REQUEST['lid'],
$_REQUEST['uid'],
$_REQUEST['vid'],
$_REQUEST['iid']);

@ -1,4 +1,6 @@
<?php //$id$
<?php
/* For licensing terms, see /license.txt */
/**
* This script contains the server part of the xajax interaction process. The client part is located
* in lp_api.php or other api's.
@ -7,32 +9,34 @@
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Script
*/
//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;
// name of the language file that needs to be included
// Name of the language file that needs to be included.
$language_file[] = 'learnpath';
require_once 'back_compat.inc.php';
/**
* Write a log with the current message
* @param string Message
* @param int Debug level (if 0, do not log)
*/
function lp_ajax_log($msg, $level) {
$debug = 0;
$return = '';
if ($debug>0) {error_log('In log('.$msg.')',0);}
if ($level == 0) {
//error_log('Logging level too low, not writing files in '.__FILE__);
$debug = 0;
$return = '';
if ($debug > 0) {error_log('In log('.$msg.')', 0); }
if ($level == 0) {
//error_log('Logging level too low, not writing files in '.__FILE__);
return $return;
}
$msg = str_replace('<br />', "\r\n", $msg);
$file = sys_get_temp_dir().DIRECTORY_SEPARATOR.session_id().'.'.date('Ymd').'-'.api_get_user_id().'.scorm.log';
$fh = @fopen($file, 'a');
@fwrite($fh,'['.date('Y-m-d H:m:s').'] '.$msg."\r\n");
@fclose($fh);
return $return;
}
$msg = str_replace('<br />',"\r\n", $msg);
$file = sys_get_temp_dir().DIRECTORY_SEPARATOR.session_id().'.'.date('Ymd').'-'.api_get_user_id().'.scorm.log';
$fh = @fopen($file,'a');
@fwrite($fh,'['.date('Y-m-d H:m:s').'] '.$msg."\r\n");
@fclose($fh);
return $return;
}
echo lp_ajax_log($_POST['msg'],$_POST['debug']);
echo lp_ajax_log($_POST['msg'], $_POST['debug']);

@ -1,4 +1,6 @@
<?php //$id$
<?php
/* For licensing terms, see /license.txt */
/**
* This script contains the server part of the xajax interaction process. The client part is located
* in lp_api.php or other api's.
@ -6,14 +8,15 @@
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Script
*/
//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;
// name of the language file that needs to be included
// Name of the language file that needs to be included.
$language_file[] = 'learnpath';
require_once 'back_compat.inc.php';
/**
* Writes an item's new values into the database and returns the operation result
* @param integer Learnpath ID
@ -30,210 +33,198 @@ require_once 'back_compat.inc.php';
* @param array Interactions array
* @param string Core exit SCORM string
*/
function save_item($lp_id,$user_id,$view_id,$item_id,$score=-1,$max=-1,$min=-1,$status='',$time=0,$suspend='',$location='',$interactions=array(),$core_exit='none')
{
global $_configuration;
$debug=0;
$return = '';
if($debug>0){error_log('In save_item('.$lp_id.','.$user_id.','.$view_id.','.$item_id.','.$score.','.$max.','.$min.',"'.$status.'",'.$time.',"'.$suspend.'","'.$location.'","'.(count($interactions)>0?$interactions[0]:'').'","'.$core_exit.'")',0);}
//$objResponse = new xajaxResponse();
require_once 'learnpath.class.php';
require_once 'scorm.class.php';
require_once 'aicc.class.php';
require_once 'learnpathItem.class.php';
require_once 'scormItem.class.php';
require_once 'aiccItem.class.php';
$mylp = '';
if(isset($_SESSION['lpobject']))
{
if($debug>1){error_log('////$_SESSION[lpobject] is set',0);}
$oLP =& unserialize($_SESSION['lpobject']);
if(!is_object($oLP)){
if($debug>2){error_log(print_r($oLP,true),0);}
if($debug>2){error_log('////Building new lp',0);}
unset($oLP);
$code = api_get_course_id();
$mylp = & new learnpath($code,$lp_id,$user_id);
}else{
if($debug>2){error_log('////Reusing session lp',0);}
$mylp = & $oLP;
}
}
//$objResponse->addAlert(api_get_path(REL_CODE_PATH).'newscorm/learnpathItem.class.php');
if (!is_a($mylp,'learnpath')) { return ''; }
function save_item($lp_id, $user_id, $view_id, $item_id, $score = -1, $max = -1, $min = -1, $status = '', $time = 0, $suspend = '', $location = '', $interactions = array(), $core_exit = 'none') {
global $_configuration;
$debug = 0;
$return = '';
if ($debug > 0) { error_log('In save_item('.$lp_id.','.$user_id.','.$view_id.','.$item_id.','.$score.','.$max.','.$min.',"'.$status.'",'.$time.',"'.$suspend.'","'.$location.'","'.(count($interactions) > 0 ? $interactions[0] : '').'","'.$core_exit.'")', 0); }
//$objResponse = new xajaxResponse();
require_once 'learnpath.class.php';
require_once 'scorm.class.php';
require_once 'aicc.class.php';
require_once 'learnpathItem.class.php';
require_once 'scormItem.class.php';
require_once 'aiccItem.class.php';
$mylp = '';
if (isset($_SESSION['lpobject'])) {
if ($debug > 1) { error_log('////$_SESSION[lpobject] is set', 0); }
$oLP =& unserialize($_SESSION['lpobject']);
if (!is_object($oLP)) {
if ($debug > 2) { error_log(print_r($oLP,true), 0); }
if ($debug > 2) { error_log('////Building new lp', 0); }
unset($oLP);
$code = api_get_course_id();
$mylp = & new learnpath($code, $lp_id, $user_id);
} else {
if ($debug > 2) { error_log('////Reusing session lp', 0); }
$mylp = & $oLP;
}
}
//$objResponse->addAlert(api_get_path(REL_CODE_PATH).'newscorm/learnpathItem.class.php');
if (!is_a($mylp, 'learnpath')) { return ''; }
$prereq_check = $mylp->prerequisites_match($item_id);
if($prereq_check === true) //launch the prerequisites check and set error if needed
{
$prereq_check = $mylp->prerequisites_match($item_id);
if ($prereq_check === true) { // Launch the prerequisites check and set error if needed.
$mylpi =& $mylp->items[$item_id];
//$mylpi->set_lp_view($view_id);
if(isset($max) && $max!=-1)
{
$mylpi->max_score=$max;
$mylpi->set_max_score($max);
}
if(isset($min) && $min!=-1 && $min != 'undefined')
{
$mylpi->min_score=$min;
}
if(isset($score) && $score!=-1)
{
if($debug>1){error_log('Calling set_score('.$score.') from xajax',0);}
$mylpi->set_score($score);
if($debug>1){error_log('Done calling set_score from xajax - now '.$mylpi->get_score(),0);}
}
if(isset($status) && $status!='' && $status!='undefined')
{
if($debug>1){error_log('Calling set_status('.$status.') from xajax',0);}
$mylpi->set_status($status);
if($debug>1){error_log('Done calling set_status from xajax - now '.$mylpi->get_status(false),0);}
}
// hack to set status to completed for hotpotatoes if score > 80%
if ($mylpi->get_type()=='hotpotatoes') {
if ((empty($status) || $status == 'undefined' || $status == 'not attempted') && $max>0) {
if (($score/$max) > 0.8) {
$mystatus = 'completed';
if($debug>1){error_log('Calling set_status('.$mystatus.') from xajax for hotpotatoes',0);}
$mylpi->set_status($mystatus);
if($debug>1){error_log('Done calling set_status from xajax for hotpotatoes - now '.$mylpi->get_status(false),0);}
}
} elseif ($status == 'completed' && $max>0 && ($score/$max)<0.8) {
$mystatus = 'failed';
if($debug>1){error_log('Calling set_status('.$mystatus.') from xajax for hotpotatoes',0);}
$mylpi->set_status($mystatus);
if($debug>1){error_log('Done calling set_status from xajax for hotpotatoes - now '.$mylpi->get_status(false),0);}
}
}
if(isset($time) && $time!='' && $time!='undefined')
{
//if big integer, then it's a timestamp, otherwise it's normal scorm time
if($debug>1){error_log('Calling set_time('.$time.') from xajax',0);}
if($time == intval(strval($time)) && $time>1000000){
$real_time = time() - $time;
//$real_time += $mylpi->get_total_time();
$mylpi->set_time($real_time,'int');
}else{
$mylpi->set_time($time);
}
if($debug>1){error_log('Done calling set_time from xajax - now '.$mylpi->get_total_time(),0);}
} else {
$time = $mylpi->get_total_time();
}
if(isset($suspend) && $suspend!='' && $suspend!='undefined')
{
$mylpi->current_data = $suspend;//escapetxt($suspend);
}
if(isset($location) && $location!='' && $location!='undefined')
{
$mylpi->set_lesson_location($location);
}
//deal with interactions provided in arrays in the following format
//id(0), type(1), time(2), weighting(3),correct_responses(4),student_response(5),result(6),latency(7)
if(is_array($interactions) && count($interactions)>0){
foreach($interactions as $index=>$interaction){
//$mylpi->add_interaction($index,$interactions[$index]);
//fix DT#4444
$clean_interaction = str_replace('@.|@',',',$interactions[$index]);
$mylpi->add_interaction($index,$clean_interaction);
}
}
if($core_exit != 'undefined') {
$mylpi->set_core_exit($core_exit);
}
$mylp->save_item($item_id,false);
}else{
//return $objResponse;
return $return;
}
$mystatus_in_db = $mylpi->get_status(true);
if ($mystatus_in_db<>'completed' && $mystatus_in_db<>'passed' && $mystatus_in_db<>'browsed') {
$mystatus_in_memory = $mylpi->get_status(false);
if ($mystatus_in_memory<>$mystatus_in_db) {
$mystatus=$mystatus_in_memory;
} else {
$mystatus=$mystatus_in_db;
}
} else {
$mystatus=$mystatus_in_db;
}
$mytotal = $mylp->get_total_items_count_without_chapters();
$mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode();
$myprogress_mode = ($myprogress_mode==''?'%':$myprogress_mode);
//$mylpi->write_to_db();
$_SESSION['lpobject'] = serialize($mylp);
if($mylpi->get_type()!='sco')
{ //if this object's JS status has not been updated by the SCORM API, update now
//$objResponse->addScript("lesson_status='".$mystatus."';");
$return .= "olms.lesson_status='".$mystatus."';";
}
//$objResponse->addScript("update_toc('".$mystatus."','".$item_id."');");
$return .= "update_toc('".$mystatus."','".$item_id."');";
$update_list = $mylp->get_update_queue();
foreach($update_list as $my_upd_id => $my_upd_status)
{
if($my_upd_id != $item_id){ //only update the status from other items (i.e. parents and brothers), do not update current as we just did it already
//$objResponse->addScript("update_toc('".$my_upd_status."','".$my_upd_id."');");
$return .= "update_toc('".$my_upd_status."','".$my_upd_id."');";
}
}
//$objResponse->addScript("update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');");
$return .= "update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
$mylpi =& $mylp->items[$item_id];
//$mylpi->set_lp_view($view_id);
if (isset($max) && $max != -1) {
$mylpi->max_score = $max;
$mylpi->set_max_score($max);
}
if (isset($min) && $min != -1 && $min != 'undefined') {
$mylpi->min_score = $min;
}
if (isset($score) && $score != -1) {
if ($debug > 1) { error_log('Calling set_score('.$score.') from xajax', 0); }
$mylpi->set_score($score);
if ($debug > 1) { error_log('Done calling set_score from xajax - now '.$mylpi->get_score(), 0); }
}
if (isset($status) && $status != '' && $status != 'undefined') {
if ($debug > 1) { error_log('Calling set_status('.$status.') from xajax', 0); }
$mylpi->set_status($status);
if ($debug > 1) { error_log('Done calling set_status from xajax - now '.$mylpi->get_status(false), 0); }
}
// Hack to set status to completed for hotpotatoes if score > 80%.
if ($mylpi->get_type() == 'hotpotatoes') {
if ((empty($status) || $status == 'undefined' || $status == 'not attempted') && $max > 0) {
if (($score/$max) > 0.8) {
$mystatus = 'completed';
if ($debug > 1) { error_log('Calling set_status('.$mystatus.') from xajax for hotpotatoes', 0); }
$mylpi->set_status($mystatus);
if ($debug > 1) { error_log('Done calling set_status from xajax for hotpotatoes - now '.$mylpi->get_status(false), 0); }
}
} elseif ($status == 'completed' && $max > 0 && ($score/$max) < 0.8) {
$mystatus = 'failed';
if ($debug > 1) { error_log('Calling set_status('.$mystatus.') from xajax for hotpotatoes', 0); }
$mylpi->set_status($mystatus);
if ($debug > 1) { error_log('Done calling set_status from xajax for hotpotatoes - now '.$mylpi->get_status(false), 0); }
}
}
if (isset($time) && $time!='' && $time!='undefined') {
// If big integer, then it's a timestamp, otherwise it's normal scorm time.
if ($debug > 1) { error_log('Calling set_time('.$time.') from xajax', 0); }
if ($time == intval(strval($time)) && $time > 1000000) {
$real_time = time() - $time;
//$real_time += $mylpi->get_total_time();
$mylpi->set_time($real_time, 'int');
} else {
$mylpi->set_time($time);
}
if ($debug > 1) { error_log('Done calling set_time from xajax - now '.$mylpi->get_total_time(), 0); }
} else {
$time = $mylpi->get_total_time();
}
if (isset($suspend) && $suspend != '' && $suspend != 'undefined') {
$mylpi->current_data = $suspend; //escapetxt($suspend);
}
if (isset($location) && $location != '' && $location!='undefined') {
$mylpi->set_lesson_location($location);
}
// Deal with interactions provided in arrays in the following format:
// id(0), type(1), time(2), weighting(3), correct_responses(4), student_response(5), result(6), latency(7)
if (is_array($interactions) && count($interactions) > 0) {
foreach ($interactions as $index => $interaction) {
//$mylpi->add_interaction($index,$interactions[$index]);
//fix DT#4444
$clean_interaction = str_replace('@.|@', ',', $interactions[$index]);
$mylpi->add_interaction($index, $clean_interaction);
}
}
if ($core_exit != 'undefined') {
$mylpi->set_core_exit($core_exit);
}
$mylp->save_item($item_id, false);
} else {
//return $objResponse;
return $return;
}
$mystatus_in_db = $mylpi->get_status(true);
if ($mystatus_in_db != 'completed' && $mystatus_in_db != 'passed' && $mystatus_in_db != 'browsed') {
$mystatus_in_memory = $mylpi->get_status(false);
if ($mystatus_in_memory != $mystatus_in_db) {
$mystatus = $mystatus_in_memory;
} else {
$mystatus = $mystatus_in_db;
}
} else {
$mystatus = $mystatus_in_db;
}
$mytotal = $mylp->get_total_items_count_without_chapters();
$mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode();
$myprogress_mode = ($myprogress_mode == '' ? '%' : $myprogress_mode);
//$mylpi->write_to_db();
$_SESSION['lpobject'] = serialize($mylp);
if ($mylpi->get_type() != 'sco') {
// If this object's JS status has not been updated by the SCORM API, update now.
//$objResponse->addScript("lesson_status='".$mystatus."';");
$return .= "olms.lesson_status='".$mystatus."';";
}
//$objResponse->addScript("update_toc('".$mystatus."','".$item_id."');");
$return .= "update_toc('".$mystatus."','".$item_id."');";
$update_list = $mylp->get_update_queue();
foreach ($update_list as $my_upd_id => $my_upd_status) {
if ($my_upd_id != $item_id){ // Only update the status from other items (i.e. parents and brothers), do not update current as we just did it already.
//$objResponse->addScript("update_toc('".$my_upd_status."','".$my_upd_id."');");
$return .= "update_toc('".$my_upd_status."','".$my_upd_id."');";
}
}
//$objResponse->addScript("update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');");
$return .= "update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
if($debug>0){
//$objResponse->addScript("logit_lms('Saved data for item ".$item_id.", user ".$user_id." (status=".$mystatus.")',2);");
$return .= "logit_lms('Saved data for item ".$item_id.", user ".$user_id." (status=".$mystatus.")',2);";
if($debug>1){error_log('End of save_item()',0);}
}
if ($debug > 0) {
//$objResponse->addScript("logit_lms('Saved data for item ".$item_id.", user ".$user_id." (status=".$mystatus.")',2);");
$return .= "logit_lms('Saved data for item ".$item_id.", user ".$user_id." (status=".$mystatus.")',2);";
if ($debug > 1) { error_log('End of save_item()', 0); }
}
if($_configuration['tracking_enabled'] && !isset($_SESSION['login_as']))
{ // if $_SESSION['login_as'] is set, then the user is an admin logged as the user
if ($_configuration['tracking_enabled'] && !isset($_SESSION['login_as'])) {
// If $_SESSION['login_as'] is set, then the user is an admin logged as the user.
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sql_last_connection="SELECT login_id, login_date FROM $tbl_track_login WHERE login_user_id='".api_get_user_id()."' ORDER BY login_date DESC LIMIT 0,1";
$sql_last_connection = "SELECT login_id, login_date FROM $tbl_track_login WHERE login_user_id='".api_get_user_id()."' ORDER BY login_date DESC LIMIT 0,1";
$q_last_connection=Database::query($sql_last_connection);
if(Database::num_rows($q_last_connection) > 0) {
$current_time=date('Y-m-d H:i:s');
$row = Database::fetch_array($q_last_connection);
$i_id_last_connection=$row['login_id'];
$s_sql_update_logout_date="UPDATE $tbl_track_login SET logout_date='".$current_time."' WHERE login_id='$i_id_last_connection'";
Database::query($s_sql_update_logout_date);
}
}
$q_last_connection = Database::query($sql_last_connection);
if (Database::num_rows($q_last_connection) > 0) {
$current_time = date('Y-m-d H:i:s');
$row = Database::fetch_array($q_last_connection);
$i_id_last_connection = $row['login_id'];
$s_sql_update_logout_date = "UPDATE $tbl_track_login SET logout_date='".$current_time."' WHERE login_id='$i_id_last_connection'";
Database::query($s_sql_update_logout_date);
}
}
if ($mylp->get_type()==2) {
$return .="update_stats();";
if ($mylp->get_type() == 2) {
$return .= "update_stats();";
}
return $return;
//return $objResponse;
return $return;
//return $objResponse;
}
$interactions = array();
if(isset($_REQUEST['interact'])) {
if (isset($_REQUEST['interact'])) {
if (is_array($_REQUEST['interact'])) {
foreach($_REQUEST['interact'] as $idx=>$interac)
{
$interactions[$idx] = split(',',substr($interac,1,-1));
if(!isset($interactions[$idx][7])){ //make sure there are 7 elements
$interactions[$idx][7]='';
}
}
}
foreach ($_REQUEST['interact'] as $idx => $interac) {
$interactions[$idx] = split(',', substr($interac, 1, -1));
if(!isset($interactions[$idx][7])){ // Make sure there are 7 elements.
$interactions[$idx][7] = '';
}
}
}
}
echo save_item(
$_REQUEST['lid'],
$_REQUEST['uid'],
$_REQUEST['vid'],
$_REQUEST['iid'],
$_REQUEST['s'],
$_REQUEST['max'],
$_REQUEST['min'],
$_REQUEST['status'],
$_REQUEST['t'],
$_REQUEST['suspend'],
$_REQUEST['loc'],
$interactions,
$_REQUEST['core_exit']);
$_REQUEST['lid'],
$_REQUEST['uid'],
$_REQUEST['vid'],
$_REQUEST['iid'],
$_REQUEST['s'],
$_REQUEST['max'],
$_REQUEST['min'],
$_REQUEST['status'],
$_REQUEST['t'],
$_REQUEST['suspend'],
$_REQUEST['loc'],
$interactions,
$_REQUEST['core_exit']);

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script contains the server part of the xajax interaction process. The client part is located
* in lp_api.php or other api's.
@ -7,14 +8,15 @@
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Script
*/
//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;
// name of the language file that needs to be included
// Name of the language file that needs to be included.
$language_file[] = 'learnpath';
require_once 'back_compat.inc.php';
/**
* Writes an item's new values into the database and returns the operation result
* @param integer Learnpath ID
@ -23,12 +25,11 @@ require_once 'back_compat.inc.php';
* @param integer Item ID
* @param array Objectives array
*/
function save_objectives($lp_id,$user_id,$view_id,$item_id,$objectives=array())
{
function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = array()) {
global $_configuration;
$debug=0;
$debug = 0;
$return = '';
if($debug>0){error_log('In xajax_save_objectives('.$lp_id.','.$user_id.','.$view_id.','.$item_id.',"'.(count($objectives)>0?count($objectives):'').'")',0);}
if ($debug > 0) { error_log('In xajax_save_objectives('.$lp_id.','.$user_id.','.$view_id.','.$item_id.',"'.(count($objectives) > 0 ? count($objectives) : '').'")', 0); }
//$objResponse = new xajaxResponse();
require_once 'learnpath.class.php';
require_once 'scorm.class.php';
@ -37,26 +38,25 @@ function save_objectives($lp_id,$user_id,$view_id,$item_id,$objectives=array())
require_once 'scormItem.class.php';
require_once 'aiccItem.class.php';
$mylp = '';
if(isset($_SESSION['lpobject']))
{
if($debug>1){error_log('////$_SESSION[lpobject] is set',0);}
if (isset($_SESSION['lpobject'])) {
if ($debug > 1) { error_log('////$_SESSION[lpobject] is set', 0); }
$oLP =& unserialize($_SESSION['lpobject']);
if(!is_object($oLP)){
if($debug>2){error_log(print_r($oLP,true),0);}
if($debug>2){error_log('////Building new lp',0);}
if (!is_object($oLP)) {
if ($debug > 2) { error_log(print_r($oLP,true), 0); }
if ($debug > 2) { error_log('////Building new lp', 0); }
unset($oLP);
$code = api_get_course_id();
$mylp = & new learnpath($code,$lp_id,$user_id);
$mylp = & new learnpath($code, $lp_id, $user_id);
}else{
if($debug>2){error_log('////Reusing session lp',0);}
if ($debug > 2) { error_log('////Reusing session lp', 0); }
$mylp = & $oLP;
}
}
$mylpi =& $mylp->items[$item_id];
//error_log(__FILE__.' '.__LINE__.' '.print_r($objectives,true),0);
//error_log(__FILE__.' '.__LINE__.' '.print_r($objectives,true), 0);
if(is_array($objectives) && count($objectives)>0){
foreach($objectives as $index=>$objective){
//error_log(__FILE__.' '.__LINE__.' '.$objectives[$index][0],0);
//error_log(__FILE__.' '.__LINE__.' '.$objectives[$index][0], 0);
$mylpi->add_objective($index,$objectives[$index]);
}
$mylpi->write_objectives_to_db();
@ -65,15 +65,14 @@ function save_objectives($lp_id,$user_id,$view_id,$item_id,$objectives=array())
return $return;
}
$objectives = array();
if(isset($_REQUEST['objectives'])) {
if (isset($_REQUEST['objectives'])) {
if (is_array($_REQUEST['objectives'])) {
foreach($_REQUEST['objectives'] as $idx=>$ob)
{
$objectives[$idx] = split(',',substr($ob,1,-1));
if(!isset($objectives[$idx][4])){ //make sure there are 7 elements
$objectives[$idx][4]='';
foreach ($_REQUEST['objectives'] as $idx => $ob) {
$objectives[$idx] = split(',', substr($ob, 1, -1));
if (!isset($objectives[$idx][4])) { // Make sure there are 7 elements.
$objectives[$idx][4] = '';
}
}
}
}
echo save_objectives($_REQUEST['lid'],$_REQUEST['uid'],$_REQUEST['vid'],$_REQUEST['iid'],$objectives);
echo save_objectives($_REQUEST['lid'], $_REQUEST['uid'], $_REQUEST['vid'], $_REQUEST['iid'], $objectives);

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script contains the server part of the xajax interaction process. The client part is located
* in lp_api.php or other api's.
@ -7,17 +8,17 @@
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Start a timer and hand it back to the JS by assigning the current time (of start) to
* var asset_timer
* @return string JavaScript time intializer
*/
function start_timer()
{
function start_timer() {
//$objResponse = new xajaxResponse();
$time = time();
//$objResponse->addScript("asset_timer='$time';asset_timer_total=0;");
//return $objResponse;
return "olms.asset_timer='$time';olms.asset_timer_total=0;";
}
echo start_timer();
echo start_timer();

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script contains the server part of the xajax interaction process. The client part is located
* in lp_api.php or other api's.
@ -7,14 +8,15 @@
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Script
*/
//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;
// name of the language file that needs to be included
// Name of the language file that needs to be included
$language_file[] = 'learnpath';
require_once 'back_compat.inc.php';
/**
* Get one item's details
* @param integer LP ID
@ -23,209 +25,208 @@ require_once 'back_compat.inc.php';
* @param integer Current item ID
* @param integer New item ID
*/
function switch_item_details($lp_id,$user_id,$view_id,$current_item,$next_item)
{
$debug=0;
$return = '';
if($debug>0){error_log('In xajax_switch_item_details('.$lp_id.','.$user_id.','.$view_id.','.$current_item.','.$next_item.')',0);}
//$objResponse = new xajaxResponse();
/*$item_id may be one of:
* -'next'
* -'previous'
* -'first'
* -'last'
* - a real item ID
*/
require_once 'learnpath.class.php';
require_once 'scorm.class.php';
require_once 'aicc.class.php';
require_once 'learnpathItem.class.php';
require_once 'scormItem.class.php';
require_once 'aiccItem.class.php';
$mylp = '';
if(isset($_SESSION['lpobject']))
{
if($debug>1){error_log('////$_SESSION[lpobject] is set',0);}
$oLP =& unserialize($_SESSION['lpobject']);
if(!is_object($oLP)){
if($debug>1){error_log(print_r($oLP,true),0);}
if($debug>2){error_log('////Building new lp',0);}
unset($oLP);
$code = api_get_course_id();
$mylp = & new learnpath($code,$lp_id,$user_id);
}else{
if($debug>1){error_log('////Reusing session lp',0);}
$mylp = & $oLP;
}
}
$new_item_id = 0;
switch($next_item){
case 'next':
$mylp->set_current_item($current_item);
$mylp->next();
$new_item_id = $mylp->get_current_item_id();
if($debug>1){error_log('In {next} - next item is '.$new_item_id.'(current: '.$current_item.')',0);}
break;
case 'previous':
$mylp->set_current_item($current_item);
$mylp->previous();
$new_item_id = $mylp->get_current_item_id();
if($debug>1){error_log('In {previous} - next item is '.$new_item_id.'(current: '.$current_item.')',0);}
break;
case 'first':
$mylp->set_current_item($current_item);
$mylp->first();
$new_item_id = $mylp->get_current_item_id();
if($debug>1){error_log('In {first} - next item is '.$new_item_id.'(current: '.$current_item.')',0);}
break;
case 'last':
break;
default:
//should be filtered to check it's not hacked
if($next_item == $current_item){
//if we're opening the same item again
$mylp->items[$current_item]->restart();
}
$new_item_id = $next_item;
$mylp->set_current_item($new_item_id);
if($debug>1){error_log('In {default} - next item is '.$new_item_id.'(current: '.$current_item.')',0);}
break;
}
$mylp->start_current_item(true);
if($mylp->force_commit){
$mylp->save_current();
}
//$objResponse->addAlert(api_get_path(REL_CODE_PATH).'newscorm/learnpathItem.class.php');
if(is_object($mylp->items[$new_item_id])){
$mylpi = & $mylp->items[$new_item_id];
}else{
if($debug>1){error_log('In switch_item_details - generating new item object',0);}
$mylpi =& new learnpathItem($new_item_id,$user_id);
$mylpi->set_lp_view($view_id);
}
/*
* now get what's needed by the SCORM API:
* -score
* -max
* -min
* -lesson_status
* -session_time
* -suspend_data
*/
$myscore = $mylpi->get_score();
$mymax = $mylpi->get_max();
if($mymax===''){$mymax="''";}
$mymin = $mylpi->get_min();
$mylesson_status = $mylpi->get_status();
$mylesson_location = $mylpi->get_lesson_location();
$mytotal_time = $mylpi->get_scorm_time('js');
$mymastery_score = $mylpi->get_mastery_score();
$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)
$mylesson_status = 'completed';
$mylpi->set_status('completed');
$mylpi->save();
}
*/
$mysession_time = $mylpi->get_total_time();
$mysuspend_data = $mylpi->get_suspend_data();
$mylesson_location = $mylpi->get_lesson_location();
$myic = $mylpi->get_interactions_count();
$myistring = '';
for ($i=0;$i<$myic;$i++) {
$myistring .= ",[".$i.",'','','','','','','']";
}
if (!empty($myistring)) {
$myistring = substr($myistring,1);
}
/*
* The following lines should reinitialize the values for the SCO
* However, due to many complications, we are now relying more on the
* LMSInitialize() call and its underlying lp_ajax_initialize.php call
* so this code is technically deprecated (but the change of item_id should
* remain). However, due to numerous technical issues with SCORM, we prefer
* leaving it as a double-lock security. If removing, please test carefully
* with both SCORM and dokeos learning path tracking.
*/
$return .=
"olms.score=".$myscore.";" .
"olms.max=".$mymax.";" .
"olms.min=".$mymin.";" .
"olms.lesson_status='".$mylesson_status."';" .
"olms.lesson_location='".$mylesson_location."';" .
"olms.session_time='".$mysession_time."';" .
"olms.suspend_data='".$mysuspend_data."';" .
"olms.total_time = '".$mytotal_time."';" .
"olms.mastery_score = '".$mymastery_score."';" .
"olms.max_time_allowed = '".$mymax_time_allowed."';" .
"olms.launch_data = '".$mylaunch_data."';" .
"olms.interactions = new Array(".$myistring.");" .
"olms.item_objectives = new Array();" .
"olms.G_lastError = 0;" .
"olms.G_LastErrorMessage = 'No error';" ;
/*
* and re-initialise the rest
* -lms_lp_id
* -lms_item_id
* -lms_old_item_id
* -lms_new_item_id
* -lms_initialized
* -lms_progress_bar_mode
* -lms_view_id
* -lms_user_id
*/
$mytotal = $mylp->get_total_items_count_without_chapters();
$mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode();
$myprogress_mode = ($myprogress_mode==''?'%':$myprogress_mode);
$mynext = $mylp->get_next_item_id();
$myprevious = $mylp->get_previous_item_id();
$myitemtype = $mylpi->get_type();
$mylesson_mode = $mylpi->get_lesson_mode();
$mycredit = $mylpi->get_credit();
$mylaunch_data = $mylpi->get_launch_data();
$myinteractions_count = $mylpi->get_interactions_count();
$myobjectives_count = $mylpi->get_objectives_count();
$mycore_exit = $mylpi->get_core_exit();
function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_item) {
$debug = 0;
$return = '';
if ($debug > 0) { error_log('In xajax_switch_item_details('.$lp_id.','.$user_id.','.$view_id.','.$current_item.','.$next_item.')', 0); }
//$objResponse = new xajaxResponse();
/*$item_id may be one of:
* -'next'
* -'previous'
* -'first'
* -'last'
* - a real item ID
*/
require_once 'learnpath.class.php';
require_once 'scorm.class.php';
require_once 'aicc.class.php';
require_once 'learnpathItem.class.php';
require_once 'scormItem.class.php';
require_once 'aiccItem.class.php';
$mylp = '';
if (isset($_SESSION['lpobject'])) {
if ($debug > 1) { error_log('////$_SESSION[lpobject] is set', 0); }
$oLP =& unserialize($_SESSION['lpobject']);
if (!is_object($oLP)) {
if ($debug > 1) { error_log(print_r($oLP,true), 0); }
if ($debug > 2) { error_log('////Building new lp', 0); }
unset($oLP);
$code = api_get_course_id();
$mylp = & new learnpath($code,$lp_id,$user_id);
} else {
if ($debug > 1) { error_log('////Reusing session lp', 0); }
$mylp = & $oLP;
}
}
$new_item_id = 0;
switch ($next_item) {
case 'next':
$mylp->set_current_item($current_item);
$mylp->next();
$new_item_id = $mylp->get_current_item_id();
if ($debug > 1) { error_log('In {next} - next item is '.$new_item_id.'(current: '.$current_item.')', 0); }
break;
case 'previous':
$mylp->set_current_item($current_item);
$mylp->previous();
$new_item_id = $mylp->get_current_item_id();
if ($debug > 1) { error_log('In {previous} - next item is '.$new_item_id.'(current: '.$current_item.')', 0); }
break;
case 'first':
$mylp->set_current_item($current_item);
$mylp->first();
$new_item_id = $mylp->get_current_item_id();
if ($debug > 1) { error_log('In {first} - next item is '.$new_item_id.'(current: '.$current_item.')', 0); }
break;
case 'last':
break;
default:
// Should be filtered to check it's not hacked.
if($next_item == $current_item){
// If we're opening the same item again.
$mylp->items[$current_item]->restart();
}
$new_item_id = $next_item;
$mylp->set_current_item($new_item_id);
if ($debug > 1) { error_log('In {default} - next item is '.$new_item_id.'(current: '.$current_item.')', 0); }
break;
}
$mylp->start_current_item(true);
if ($mylp->force_commit) {
$mylp->save_current();
}
//$objResponse->addAlert(api_get_path(REL_CODE_PATH).'newscorm/learnpathItem.class.php');
if (is_object($mylp->items[$new_item_id])) {
$mylpi = & $mylp->items[$new_item_id];
} else {
if ($debug > 1) { error_log('In switch_item_details - generating new item object', 0); }
$mylpi =& new learnpathItem($new_item_id, $user_id);
$mylpi->set_lp_view($view_id);
}
/*
* now get what's needed by the SCORM API:
* -score
* -max
* -min
* -lesson_status
* -session_time
* -suspend_data
*/
$myscore = $mylpi->get_score();
$mymax = $mylpi->get_max();
if ($mymax === '') { $mymax = "''"; }
$mymin = $mylpi->get_min();
$mylesson_status = $mylpi->get_status();
$mylesson_location = $mylpi->get_lesson_location();
$mytotal_time = $mylpi->get_scorm_time('js');
$mymastery_score = $mylpi->get_mastery_score();
$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)
$mylesson_status = 'completed';
$mylpi->set_status('completed');
$mylpi->save();
}
*/
$mysession_time = $mylpi->get_total_time();
$mysuspend_data = $mylpi->get_suspend_data();
$mylesson_location = $mylpi->get_lesson_location();
$myic = $mylpi->get_interactions_count();
$myistring = '';
for ($i = 0; $i < $myic; $i++) {
$myistring .= ",[".$i.",'','','','','','','']";
}
if (!empty($myistring)) {
$myistring = substr($myistring, 1);
}
/*
* The following lines should reinitialize the values for the SCO
* However, due to many complications, we are now relying more on the
* LMSInitialize() call and its underlying lp_ajax_initialize.php call
* so this code is technically deprecated (but the change of item_id should
* remain). However, due to numerous technical issues with SCORM, we prefer
* leaving it as a double-lock security. If removing, please test carefully
* with both SCORM and dokeos learning path tracking.
*/
$return .=
"olms.score=".$myscore.";" .
"olms.max=".$mymax.";" .
"olms.min=".$mymin.";" .
"olms.lesson_status='".$mylesson_status."';" .
"olms.lesson_location='".$mylesson_location."';" .
"olms.session_time='".$mysession_time."';" .
"olms.suspend_data='".$mysuspend_data."';" .
"olms.total_time = '".$mytotal_time."';" .
"olms.mastery_score = '".$mymastery_score."';" .
"olms.max_time_allowed = '".$mymax_time_allowed."';" .
"olms.launch_data = '".$mylaunch_data."';" .
"olms.interactions = new Array(".$myistring.");" .
"olms.item_objectives = new Array();" .
"olms.G_lastError = 0;" .
"olms.G_LastErrorMessage = 'No error';" ;
/*
* and re-initialise the rest
* -lms_lp_id
* -lms_item_id
* -lms_old_item_id
* -lms_new_item_id
* -lms_initialized
* -lms_progress_bar_mode
* -lms_view_id
* -lms_user_id
*/
$mytotal = $mylp->get_total_items_count_without_chapters();
$mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode();
$myprogress_mode = ($myprogress_mode == '' ? '%' : $myprogress_mode);
$mynext = $mylp->get_next_item_id();
$myprevious = $mylp->get_previous_item_id();
$myitemtype = $mylpi->get_type();
$mylesson_mode = $mylpi->get_lesson_mode();
$mycredit = $mylpi->get_credit();
$mylaunch_data = $mylpi->get_launch_data();
$myinteractions_count = $mylpi->get_interactions_count();
$myobjectives_count = $mylpi->get_objectives_count();
$mycore_exit = $mylpi->get_core_exit();
$return .=
//"saved_lesson_status='not attempted';" .
"olms.lms_lp_id=".$lp_id.";" .
"olms.lms_item_id=".$new_item_id.";" .
"olms.lms_old_item_id=0;" .
//"lms_been_synchronized=0;" .
"olms.lms_initialized=0;" .
//"lms_total_lessons=".$mytotal.";" .
//"lms_complete_lessons=".$mycomplete.";" .
//"lms_progress_bar_mode='".$myprogress_mode."';" .
"olms.lms_view_id=".$view_id.";" .
"olms.lms_user_id=".$user_id.";" .
"olms.next_item=".$new_item_id.";" . //this one is very important to replace possible literal strings
"olms.lms_next_item=".$mynext.";" .
"olms.lms_previous_item=".$myprevious.";" .
"olms.lms_item_type = '".$myitemtype."';" .
"olms.lms_item_credit = '".$mycredit."';" .
"olms.lms_item_lesson_mode = '".$mylesson_mode."';" .
"olms.lms_item_launch_data = '".$mylaunch_data."';" .
"olms.lms_item_interactions_count = '".$myinteractions_count."';" .
"olms.lms_item_objectives_count = '".$myinteractions_count."';" .
"olms.lms_item_core_exit = '".$mycore_exit."';" .
"olms.asset_timer = 0;";
//);
$return .= "update_toc('unhighlight','".$current_item."');".
"update_toc('highlight','".$new_item_id."');".
"update_toc('$mylesson_status','".$new_item_id."');".
"update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
$return .=
//"saved_lesson_status='not attempted';" .
"olms.lms_lp_id=".$lp_id.";" .
"olms.lms_item_id=".$new_item_id.";" .
"olms.lms_old_item_id=0;" .
//"lms_been_synchronized=0;" .
"olms.lms_initialized=0;" .
//"lms_total_lessons=".$mytotal.";" .
//"lms_complete_lessons=".$mycomplete.";" .
//"lms_progress_bar_mode='".$myprogress_mode."';" .
"olms.lms_view_id=".$view_id.";" .
"olms.lms_user_id=".$user_id.";" .
"olms.next_item=".$new_item_id.";" . // This one is very important to replace possible literal strings.
"olms.lms_next_item=".$mynext.";" .
"olms.lms_previous_item=".$myprevious.";" .
"olms.lms_item_type = '".$myitemtype."';" .
"olms.lms_item_credit = '".$mycredit."';" .
"olms.lms_item_lesson_mode = '".$mylesson_mode."';" .
"olms.lms_item_launch_data = '".$mylaunch_data."';" .
"olms.lms_item_interactions_count = '".$myinteractions_count."';" .
"olms.lms_item_objectives_count = '".$myinteractions_count."';" .
"olms.lms_item_core_exit = '".$mycore_exit."';" .
"olms.asset_timer = 0;";
$mylp->set_error_msg('');
$mylp->prerequisites_match(); //check the prerequisites are all complete
if($debug>1){error_log('Prereq_match() returned '.htmlentities($mylp->error),0);}
$_SESSION['scorm_item_id'] = $new_item_id;//Save the new item ID for the exercise tool to use
$_SESSION['lpobject'] = serialize($mylp);
return $return;
//return $objResponse;
$return .= "update_toc('unhighlight','".$current_item."');".
"update_toc('highlight','".$new_item_id."');".
"update_toc('$mylesson_status','".$new_item_id."');".
"update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
$mylp->set_error_msg('');
$mylp->prerequisites_match(); // Check the prerequisites are all complete.
if ($debug > 1) { error_log('Prereq_match() returned '.htmlentities($mylp->error), 0); }
$_SESSION['scorm_item_id'] = $new_item_id; // Save the new item ID for the exercise tool to use.
$_SESSION['lpobject'] = serialize($mylp);
return $return;
//return $objResponse;
}
echo switch_item_details($_REQUEST['lid'],$_REQUEST['uid'],$_REQUEST['vid'],$_REQUEST['iid'],$_REQUEST['next']);
echo switch_item_details($_REQUEST['lid'], $_REQUEST['uid'], $_REQUEST['vid'], $_REQUEST['iid'], $_REQUEST['next']);

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script contains the server part of the xajax interaction process. The client part is located
* in lp_api.php or other api's.
@ -7,14 +8,15 @@
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Script
*/
//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;
// name of the language file that needs to be included
// Name of the language file that needs to be included.
$language_file[] = 'learnpath';
require_once 'back_compat.inc.php';
/**
* Get one item's details
* @param integer LP ID
@ -23,165 +25,164 @@ require_once 'back_compat.inc.php';
* @param integer Current item ID
* @param integer New item ID
*/
function switch_item_toc($lp_id,$user_id,$view_id,$current_item,$next_item)
{
$debug=0;
$return = '';
if($debug>0){error_log('In xajax_switch_item_toc('.$lp_id.','.$user_id.','.$view_id.','.$current_item.','.$next_item.')',0);}
require_once 'learnpath.class.php';
require_once 'scorm.class.php';
require_once 'aicc.class.php';
require_once 'learnpathItem.class.php';
require_once 'scormItem.class.php';
require_once 'aiccItem.class.php';
$mylp = '';
if(isset($_SESSION['lpobject']))
{
if($debug>1){error_log('////$_SESSION[lpobject] is set',0);}
$oLP =& unserialize($_SESSION['lpobject']);
if(!is_object($oLP)){
if($debug>1){error_log(print_r($oLP,true),0);}
if($debug>2){error_log('////Building new lp',0);}
unset($oLP);
$code = api_get_course_id();
$mylp = & new learnpath($code,$lp_id,$user_id);
}else{
if($debug>1){error_log('////Reusing session lp',0);}
$mylp = & $oLP;
}
}
$new_item_id = 0;
switch($next_item){
case 'next':
$mylp->set_current_item($current_item);
$mylp->next();
$new_item_id = $mylp->get_current_item_id();
if($debug>1){error_log('In {next} - next item is '.$new_item_id.'(current: '.$current_item.')',0);}
break;
case 'previous':
$mylp->set_current_item($current_item);
$mylp->previous();
$new_item_id = $mylp->get_current_item_id();
if($debug>1){error_log('In {previous} - next item is '.$new_item_id.'(current: '.$current_item.')',0);}
break;
case 'first':
$mylp->set_current_item($current_item);
$mylp->first();
$new_item_id = $mylp->get_current_item_id();
if($debug>1){error_log('In {first} - next item is '.$new_item_id.'(current: '.$current_item.')',0);}
break;
case 'last':
break;
default:
//should be filtered to check it's not hacked
if($next_item == $current_item){
//if we're opening the same item again
$mylp->items[$current_item]->restart();
}
$new_item_id = $next_item;
$mylp->set_current_item($new_item_id);
if($debug>1){error_log('In {default} - next item is '.$new_item_id.'(current: '.$current_item.')',0);}
break;
}
$mylp->start_current_item(true);
if($mylp->force_commit){
$mylp->save_current();
}
//$objResponse->addAlert(api_get_path(REL_CODE_PATH).'newscorm/learnpathItem.class.php');
if(is_object($mylp->items[$new_item_id])){
$mylpi = & $mylp->items[$new_item_id];
}else{
if($debug>1){error_log('In switch_item_details - generating new item object',0);}
$mylpi =& new learnpathItem($new_item_id,$user_id);
$mylpi->set_lp_view($view_id);
}
/*
* now get what's needed by the SCORM API:
* -score
* -max
* -min
* -lesson_status
* -session_time
* -suspend_data
*/
$myscore = $mylpi->get_score();
$mymax = $mylpi->get_max();
if($mymax===''){$mymax="''";}
$mymin = $mylpi->get_min();
$mylesson_status = $mylpi->get_status();
$mylesson_location = $mylpi->get_lesson_location();
$mytotal_time = $mylpi->get_scorm_time('js');
$mymastery_score = $mylpi->get_mastery_score();
$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)
$mylesson_status = 'completed';
$mylpi->set_status('completed');
$mylpi->save();
}
*/
$mysession_time = $mylpi->get_total_time();
$mysuspend_data = $mylpi->get_suspend_data();
$mylesson_location = $mylpi->get_lesson_location();
$myic = $mylpi->get_interactions_count();
$myistring = '';
for ($i=0;$i<$myic;$i++) {
$myistring .= ",[".$i.",'','','','','','','']";
}
if (!empty($myistring)) {
$myistring = substr($myistring,1);
}
$mytotal = $mylp->get_total_items_count_without_chapters();
$mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode();
$myprogress_mode = ($myprogress_mode==''?'%':$myprogress_mode);
$mynext = $mylp->get_next_item_id();
$myprevious = $mylp->get_previous_item_id();
$myitemtype = $mylpi->get_type();
$mylesson_mode = $mylpi->get_lesson_mode();
$mycredit = $mylpi->get_credit();
$mylaunch_data = $mylpi->get_launch_data();
$myinteractions_count = $mylpi->get_interactions_count();
$myobjectives_count = $mylpi->get_objectives_count();
$mycore_exit = $mylpi->get_core_exit();
function switch_item_toc($lp_id, $user_id, $view_id, $current_item, $next_item) {
$debug = 0;
$return = '';
if ($debug > 0) { error_log('In xajax_switch_item_toc('.$lp_id.','.$user_id.','.$view_id.','.$current_item.','.$next_item.')', 0); }
require_once 'learnpath.class.php';
require_once 'scorm.class.php';
require_once 'aicc.class.php';
require_once 'learnpathItem.class.php';
require_once 'scormItem.class.php';
require_once 'aiccItem.class.php';
$mylp = '';
if (isset($_SESSION['lpobject'])) {
if ($debug > 1) { error_log('////$_SESSION[lpobject] is set', 0); }
$oLP =& unserialize($_SESSION['lpobject']);
if (!is_object($oLP)) {
if ($debug > 1) { error_log(print_r($oLP, true), 0); }
if ($debug > 2) { error_log('////Building new lp', 0); }
unset($oLP);
$code = api_get_course_id();
$mylp = & new learnpath($code,$lp_id,$user_id);
} else {
if ($debug > 1) { error_log('////Reusing session lp', 0); }
$mylp = & $oLP;
}
}
$new_item_id = 0;
switch ($next_item) {
case 'next':
$mylp->set_current_item($current_item);
$mylp->next();
$new_item_id = $mylp->get_current_item_id();
if ($debug > 1) { error_log('In {next} - next item is '.$new_item_id.'(current: '.$current_item.')', 0); }
break;
case 'previous':
$mylp->set_current_item($current_item);
$mylp->previous();
$new_item_id = $mylp->get_current_item_id();
if ($debug > 1) { error_log('In {previous} - next item is '.$new_item_id.'(current: '.$current_item.')', 0); }
break;
case 'first':
$mylp->set_current_item($current_item);
$mylp->first();
$new_item_id = $mylp->get_current_item_id();
if ($debug > 1) { error_log('In {first} - next item is '.$new_item_id.'(current: '.$current_item.')', 0); }
break;
case 'last':
break;
default:
// Should be filtered to check it's not hacked
if($next_item == $current_item){
// If we're opening the same item again.
$mylp->items[$current_item]->restart();
}
$new_item_id = $next_item;
$mylp->set_current_item($new_item_id);
if ($debug > 1) { error_log('In {default} - next item is '.$new_item_id.'(current: '.$current_item.')', 0); }
break;
}
$mylp->start_current_item(true);
if ($mylp->force_commit) {
$mylp->save_current();
}
//$objResponse->addAlert(api_get_path(REL_CODE_PATH).'newscorm/learnpathItem.class.php');
if (is_object($mylp->items[$new_item_id])) {
$mylpi = & $mylp->items[$new_item_id];
} else {
if ($debug > 1) { error_log('In switch_item_details - generating new item object', 0); }
$mylpi =& new learnpathItem($new_item_id, $user_id);
$mylpi->set_lp_view($view_id);
}
/*
* now get what's needed by the SCORM API:
* -score
* -max
* -min
* -lesson_status
* -session_time
* -suspend_data
*/
$myscore = $mylpi->get_score();
$mymax = $mylpi->get_max();
if ($mymax === '') { $mymax = "''"; }
$mymin = $mylpi->get_min();
$mylesson_status = $mylpi->get_status();
$mylesson_location = $mylpi->get_lesson_location();
$mytotal_time = $mylpi->get_scorm_time('js');
$mymastery_score = $mylpi->get_mastery_score();
$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)
$mylesson_status = 'completed';
$mylpi->set_status('completed');
$mylpi->save();
}
*/
$mysession_time = $mylpi->get_total_time();
$mysuspend_data = $mylpi->get_suspend_data();
$mylesson_location = $mylpi->get_lesson_location();
$myic = $mylpi->get_interactions_count();
$myistring = '';
for ($i = 0; $i < $myic; $i++) {
$myistring .= ",[".$i.",'','','','','','','']";
}
if (!empty($myistring)) {
$myistring = substr($myistring, 1);
}
$mytotal = $mylp->get_total_items_count_without_chapters();
$mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode();
$myprogress_mode = ($myprogress_mode == '' ? '%' : $myprogress_mode);
$mynext = $mylp->get_next_item_id();
$myprevious = $mylp->get_previous_item_id();
$myitemtype = $mylpi->get_type();
$mylesson_mode = $mylpi->get_lesson_mode();
$mycredit = $mylpi->get_credit();
$mylaunch_data = $mylpi->get_launch_data();
$myinteractions_count = $mylpi->get_interactions_count();
$myobjectives_count = $mylpi->get_objectives_count();
$mycore_exit = $mylpi->get_core_exit();
$return .=
//"saved_lesson_status='not attempted';" .
"olms.lms_lp_id=".$lp_id.";" .
"olms.lms_item_id=".$new_item_id.";" .
"olms.lms_old_item_id=0;" .
//"lms_been_synchronized=0;" .
"olms.lms_initialized=0;" .
//"lms_total_lessons=".$mytotal.";" .
//"lms_complete_lessons=".$mycomplete.";" .
//"lms_progress_bar_mode='".$myprogress_mode."';" .
"olms.lms_view_id=".$view_id.";" .
"olms.lms_user_id=".$user_id.";" .
"olms.next_item=".$new_item_id.";" . // This one is very important to replace possible literal strings.
"olms.lms_next_item=".$mynext.";" .
"olms.lms_previous_item=".$myprevious.";" .
"olms.lms_item_type = '".$myitemtype."';" .
"olms.lms_item_credit = '".$mycredit."';" .
"olms.lms_item_lesson_mode = '".$mylesson_mode."';" .
"olms.lms_item_launch_data = '".$mylaunch_data."';" .
"olms.lms_item_interactions_count = '".$myinteractions_count."';" .
"olms.lms_item_objectives_count = '".$myinteractions_count."';" .
"olms.lms_item_core_exit = '".$mycore_exit."';" .
"olms.asset_timer = 0;";
$return .= "update_toc('unhighlight','".$current_item."');".
"update_toc('highlight','".$new_item_id."');".
"update_toc('$mylesson_status','".$new_item_id."');".
"update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
$return .=
//"saved_lesson_status='not attempted';" .
"olms.lms_lp_id=".$lp_id.";" .
"olms.lms_item_id=".$new_item_id.";" .
"olms.lms_old_item_id=0;" .
//"lms_been_synchronized=0;" .
"olms.lms_initialized=0;" .
//"lms_total_lessons=".$mytotal.";" .
//"lms_complete_lessons=".$mycomplete.";" .
//"lms_progress_bar_mode='".$myprogress_mode."';" .
"olms.lms_view_id=".$view_id.";" .
"olms.lms_user_id=".$user_id.";" .
"olms.next_item=".$new_item_id.";" . //this one is very important to replace possible literal strings
"olms.lms_next_item=".$mynext.";" .
"olms.lms_previous_item=".$myprevious.";" .
"olms.lms_item_type = '".$myitemtype."';" .
"olms.lms_item_credit = '".$mycredit."';" .
"olms.lms_item_lesson_mode = '".$mylesson_mode."';" .
"olms.lms_item_launch_data = '".$mylaunch_data."';" .
"olms.lms_item_interactions_count = '".$myinteractions_count."';" .
"olms.lms_item_objectives_count = '".$myinteractions_count."';" .
"olms.lms_item_core_exit = '".$mycore_exit."';" .
"olms.asset_timer = 0;";
//);
$return .= "update_toc('unhighlight','".$current_item."');".
"update_toc('highlight','".$new_item_id."');".
"update_toc('$mylesson_status','".$new_item_id."');".
"update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
$mylp->set_error_msg('');
$mylp->prerequisites_match(); // Check the prerequisites are all complete.
if ($debug > 1) { error_log('Prereq_match() returned '.htmlentities($mylp->error), 0); }
$_SESSION['scorm_item_id'] = $new_item_id; // Save the new item ID for the exercise tool to use.
$_SESSION['lpobject'] = serialize($mylp);
return $return;
//return $objResponse;
}
$mylp->set_error_msg('');
$mylp->prerequisites_match(); //check the prerequisites are all complete
if($debug>1){error_log('Prereq_match() returned '.htmlentities($mylp->error),0);}
$_SESSION['scorm_item_id'] = $new_item_id;//Save the new item ID for the exercise tool to use
$_SESSION['lpobject'] = serialize($mylp);
return $return;
//return $objResponse;
}
echo switch_item_toc($_POST['lid'],$_POST['uid'],$_POST['vid'],$_POST['iid'],$_POST['next']);
echo switch_item_toc($_POST['lid'], $_POST['uid'], $_POST['vid'], $_POST['iid'], $_POST['next']);

@ -1,19 +1,18 @@
<?php
/* For licensing terms, see /license.txt */
/**
* DEPRECATED (temporarily left here)
* Script that displays the footer frame for lp_view.php
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Script
*/
//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';
//require_once 'lp_comm.common.php'; //xajax functions
//require_once 'lp_comm.common.php'; // xajax functions
//$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/')."\n";
//$htmlHeadXtra[] = '<script language="javascript">var myxajax = window.parent.oxajax;</script>';
include_once '../inc/reduced_header.inc.php';

Loading…
Cancel
Save