Minor - format code.

1.9.x
Julio Montoya 10 years ago
parent eb87a3ccc6
commit bf43bc777b
  1. 9
      main/newscorm/aiccBlock.class.php
  2. 1
      main/newscorm/aiccItem.class.php
  3. 37
      main/newscorm/aiccObjective.class.php
  4. 35
      main/newscorm/aiccResource.class.php
  5. 8
      main/newscorm/aicc_api.php
  6. 4
      main/newscorm/blank.php
  7. 23
      main/newscorm/display_audiorecorder.php
  8. 23
      main/newscorm/download.php
  9. 4
      main/newscorm/index.php
  10. 133
      main/newscorm/learnpath.class.php
  11. 54
      main/newscorm/learnpathList.class.php
  12. 55
      main/newscorm/learnpath_functions.inc.php
  13. 12
      main/newscorm/lp_add.php
  14. 8
      main/newscorm/lp_ajax_save_item.php
  15. 32
      main/newscorm/lp_ajax_switch_item.php
  16. 54
      main/newscorm/lp_ajax_switch_item_toc.php
  17. 12
      main/newscorm/lp_list.php
  18. 15
      main/newscorm/lp_nav.php

@ -1,7 +1,10 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
require_once 'learnpathItem.class.php';
/** /**
* Class aiccBlock
* Class defining the Block elements in an AICC Course Structure file. * Class defining the Block elements in an AICC Course Structure file.
* *
* Container for the aiccResource class that deals with elemens from AICC Course Structure file * Container for the aiccResource class that deals with elemens from AICC Course Structure file
@ -9,7 +12,6 @@
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
* @license GNU/GPL * @license GNU/GPL
*/ */
require_once 'learnpathItem.class.php';
class aiccBlock extends learnpathItem class aiccBlock extends learnpathItem
{ {
public $identifier = ''; public $identifier = '';
@ -21,7 +23,8 @@ class aiccBlock extends learnpathItem
* @param string Type of construction needed ('db' or 'config', default = 'config') * @param string Type of construction needed ('db' or 'config', default = 'config')
* @param mixed Depending on the type given, DB id for the lp_item or parameters array * @param mixed Depending on the type given, DB id for the lp_item or parameters array
*/ */
function aiccBlock($type = 'config', $params) { function aiccBlock($type = 'config', $params)
{
if (isset($params)) { if (isset($params)) {
switch ($type) { switch ($type) {
case 'db': case 'db':
@ -32,7 +35,7 @@ class aiccBlock extends learnpathItem
foreach ($params as $a => $value) { foreach ($params as $a => $value) {
switch ($a) { switch ($a) {
case 'system_id': case 'system_id':
$this->identifier = strtolower($value); $this->identifier = strtolower($value);
break; break;
case 'member': case 'member':
if (strstr($value, ',') !== false) { if (strstr($value, ',') !== false) {

@ -4,6 +4,7 @@
require_once 'learnpathItem.class.php'; require_once 'learnpathItem.class.php';
/** /**
* Class aiccItem
* This class handles the elements from an AICC Descriptor file. * This class handles the elements from an AICC Descriptor file.
* Container for the aiccItem class that deals with AICC Assignable Units (AUs) * Container for the aiccItem class that deals with AICC Assignable Units (AUs)
* @package chamilo.learnpath * @package chamilo.learnpath

@ -4,6 +4,7 @@
require_once 'learnpathItem.class.php'; require_once 'learnpathItem.class.php';
/** /**
* Class aiccObjective
* Class defining the Block elements in an AICC Course Structure file. * Class defining the Block elements in an AICC Course Structure file.
* Container for the aiccResource class that deals with elemens from AICC Objectives file * Container for the aiccResource class that deals with elemens from AICC Objectives file
* @package chamilo.learnpath * @package chamilo.learnpath
@ -30,28 +31,28 @@ class aiccObjective extends learnpathItem
return false; return false;
case 'config': // Do the same as the default. case 'config': // Do the same as the default.
default: default:
foreach ($params as $a => $value) { foreach ($params as $a => $value) {
switch ($a) { switch ($a) {
case 'system_id': case 'system_id':
$this->identifier = strtolower($value); $this->identifier = strtolower($value);
break; break;
case 'member': case 'member':
if (strstr($value, ',') !== false) { if (strstr($value, ',') !== false) {
$temp = split(',', $value); $temp = split(',', $value);
foreach ($temp as $val) { foreach ($temp as $val) {
if (!empty($val)) { if (!empty($val)) {
$this->members[] = $val; $this->members[] = $val;
} }
} }
} }
break; break;
} }
} }
return true; return true;
} }
} }
return false; return false;
} }
} }

@ -21,7 +21,8 @@ class aiccResource
* @param string Type of construction needed ('db' or 'config', default = 'config') * @param string Type of construction needed ('db' or 'config', default = 'config')
* @param mixed Depending on the type given, DB id for the lp_item or parameters array * @param mixed Depending on the type given, DB id for the lp_item or parameters array
*/ */
public function aiccResource($type = 'config', $params) { public function aiccResource($type = 'config', $params)
{
if (isset($params)) { if (isset($params)) {
switch ($type) { switch ($type) {
@ -30,24 +31,24 @@ class aiccResource
return false; return false;
case 'config': // Do the same as the default. case 'config': // Do the same as the default.
default: default:
foreach ($params as $a => $value) { foreach ($params as $a => $value) {
switch ($a) { switch ($a) {
case 'system_id': case 'system_id':
$this->identifier = strtolower($value); $this->identifier = strtolower($value);
break; break;
case 'title': case 'title':
$this->title = $value; $this->title = $value;
case 'description': case 'description':
$this->description = $value; $this->description = $value;
break; break;
case 'developer_id': case 'developer_id':
$this->developer_id = $value; $this->developer_id = $value;
break; break;
} }
} }
return true; return true;
} }
} }
return false; return false;
} }
} }

@ -23,8 +23,6 @@
* made by another set of scripts. * made by another set of scripts.
*/ */
/* INIT SECTION */
// Flag to allow for anonymous user - needs to be set before global.inc.php. // Flag to allow for anonymous user - needs to be set before global.inc.php.
$use_anonymous = true; $use_anonymous = true;
@ -36,9 +34,9 @@ require_once 'learnpathItem.class.php';
require_once 'aicc.class.php'; require_once 'aicc.class.php';
// Is this needed? This is probabaly done in the header file. // Is this needed? This is probabaly done in the header file.
$file = $_SESSION['file']; $file = $_SESSION['file'];
$oLP = unserialize($_SESSION['lpobject']); $oLP = unserialize($_SESSION['lpobject']);
$oItem = $oLP->items[$oLP->current]; $oItem = $oLP->items[$oLP->current];
if (!is_object($oItem)) { if (!is_object($oItem)) {
error_log('New LP - scorm_api - Could not load oItem item', 0); error_log('New LP - scorm_api - Could not load oItem item', 0);
exit; exit;

@ -5,9 +5,7 @@
* @package chamilo.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
*/ */
/**
* Code
*/
$language_file = array('learnpath', 'document','exercice'); $language_file = array('learnpath', 'document','exercice');
// 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.

@ -7,9 +7,7 @@
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
* @license GNU/GPL * @license GNU/GPL
*/ */
/**
* Code
*/
// Flag to allow for anonymous user - needs to be set before global.inc.php. // Flag to allow for anonymous user - needs to be set before global.inc.php.
$use_anonymous = true; $use_anonymous = true;
@ -32,13 +30,12 @@ $scorm_css_header = true;
Display::display_reduced_header(); Display::display_reduced_header();
echo '<body dir="'.api_get_text_direction().'">'; echo '<body dir="'.api_get_text_direction().'">';
echo '<div id="audiorecorder"> ';
echo '<div id="audiorecorder"> '; $audio_recorder_studentview = 'true';
$audio_recorder_studentview = 'true'; $audio_recorder_item_id = $_SESSION['oLP']->current;
$audio_recorder_item_id = $_SESSION['oLP']->current; if (api_get_setting('service_visio', 'active') == 'true') {
if (api_get_setting('service_visio', 'active') == 'true') { require_once 'audiorecorder.inc.php';
require_once 'audiorecorder.inc.php'; }
} echo '</div>';
echo '</div>'; // end of audiorecorder include
// end of audiorecorder include echo '</body></html>';
echo '</body></html>';

@ -2,15 +2,10 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This file is responsible for passing requested documents to the browser. * This file is responsible for passing requested documents to the browser.
*
* @package chamilo.document * @package chamilo.document
*/ */
/**
* Code
* Many functions updated and moved to lib/document.lib.php
*/
session_cache_limiter('none');
session_cache_limiter('none');
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
@ -30,30 +25,30 @@ $doc_url = str_replace(' ', '+', $doc_url);
$doc_url = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), $doc_url); //echo $doc_url; $doc_url = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), $doc_url); //echo $doc_url;
if (strpos($doc_url,'../') OR strpos($doc_url,'/..')) { if (strpos($doc_url,'../') OR strpos($doc_url,'/..')) {
$doc_url = ''; $doc_url = '';
} }
$sys_course_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/scorm'; $sys_course_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/scorm';
$user_id = api_get_user_id(); $user_id = api_get_user_id();
if ($_SESSION['oLP']) { if ($_SESSION['oLP']) {
$lp_id = $_SESSION['oLP']->get_id(); $lp_id = $_SESSION['oLP']->get_id();
$lp_item_id = $_SESSION['oLP']->current; $lp_item_id = $_SESSION['oLP']->current;
$lp_item_info = new learnpathItem($lp_item_id); $lp_item_info = new learnpathItem($lp_item_id);
if (!empty($lp_item_info)) { if (!empty($lp_item_info)) {
//if (basename($lp_item_info->path) == basename($doc_url)) { //if (basename($lp_item_info->path) == basename($doc_url)) {
$visible = learnpath::is_lp_visible_for_student($lp_id, $user_id); $visible = learnpath::is_lp_visible_for_student($lp_id, $user_id);
if ($visible) { if ($visible) {
event_download($doc_url); event_download($doc_url);
if (Security::check_abs_path($sys_course_path.$doc_url, $sys_course_path.'/')) { if (Security::check_abs_path($sys_course_path.$doc_url, $sys_course_path.'/')) {
$full_file_name = $sys_course_path.$doc_url; $full_file_name = $sys_course_path.$doc_url;
DocumentManager::file_send_for_download($full_file_name); DocumentManager::file_send_for_download($full_file_name);
exit; exit;
} }
} }
//} //}
} }
} }
Display::display_error_message(get_lang('ProtectedDocument'));//api_not_allowed backbutton won't work. Display::display_error_message(get_lang('ProtectedDocument'));//api_not_allowed backbutton won't work.
exit; exit;

@ -5,9 +5,7 @@
* @package chamilo.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
*/ */
/**
* Code
*/
// Flag to allow for anonymous user - needs to be set before global.inc.php. // Flag to allow for anonymous user - needs to be set before global.inc.php.
$use_anonymous = true; $use_anonymous = true;

@ -74,26 +74,29 @@ class learnpath
public $course_info = array(); public $course_info = array();
/** /**
* Class constructor. Needs a database handler, a course code and a learnpath id from the database. * Constructor.
* Needs a database handler, a course code and a learnpath id from the database.
* Also builds the list of items into $this->items. * Also builds the list of items into $this->items.
* @param string $course Course code * @param string $course Course code
* @param integer $lp_id * @param integer $lp_id
* @param integer $user_id * @param integer $user_id
* @return boolean True on success, false on error * @return boolean True on success, false on error
*/ */
public function __construct($course, $lp_id, $user_id) public function __construct($course, $lp_id, $user_id)
{ {
$this->encoding = api_get_system_encoding(); $this->encoding = api_get_system_encoding();
if ($this->debug > 0) { error_log('New LP - In learnpath::__construct('.$course.','.$lp_id.','.$user_id.')', 0); } if ($this->debug > 0) {
error_log('New LP - In learnpath::__construct('.$course.','.$lp_id.','.$user_id.')', 0);
}
if (empty($course)) { if (empty($course)) {
$this->error = 'Course code is empty'; $this->error = 'Course code is empty';
return false; return false;
} else { } else {
$course_info = api_get_course_info($course); $course_info = api_get_course_info($course);
if (!empty($course_info)) { if (!empty($course_info)) {
$this->cc = $course_info['code']; $this->cc = $course_info['code'];
$this->course_info = $course_info; $this->course_info = $course_info;
$course_id = $course_info['real_id']; $course_id = $course_info['real_id'];
} else { } else {
$this->error = 'Course code does not exist in database.'; $this->error = 'Course code does not exist in database.';
return false; return false;
@ -110,31 +113,34 @@ class learnpath
// TODO: Make it flexible to use any course_code (still using env course code here). // TODO: Make it flexible to use any course_code (still using env course code here).
$lp_table = Database::get_course_table(TABLE_LP_MAIN); $lp_table = Database::get_course_table(TABLE_LP_MAIN);
$lp_id = intval($lp_id); $lp_id = intval($lp_id);
$sql = "SELECT * FROM $lp_table WHERE id = '$lp_id' AND c_id = $course_id"; $sql = "SELECT * FROM $lp_table
if ($this->debug > 2) { error_log('New LP - learnpath::__construct() '.__LINE__.' - Querying lp: '.$sql, 0); } WHERE id = '$lp_id' AND c_id = $course_id";
if ($this->debug > 2) {
error_log('New LP - learnpath::__construct() '.__LINE__.' - Querying lp: '.$sql, 0);
}
$res = Database::query($sql); $res = Database::query($sql);
if (Database::num_rows($res) > 0) { if (Database::num_rows($res) > 0) {
$this->lp_id = $lp_id; $this->lp_id = $lp_id;
$row = Database::fetch_array($res); $row = Database::fetch_array($res);
$this->type = $row['lp_type']; $this->type = $row['lp_type'];
$this->name = stripslashes($row['name']); $this->name = stripslashes($row['name']);
$this->proximity = $row['content_local']; $this->proximity = $row['content_local'];
$this->theme = $row['theme']; $this->theme = $row['theme'];
$this->maker = $row['content_maker']; $this->maker = $row['content_maker'];
$this->prevent_reinit = $row['prevent_reinit']; $this->prevent_reinit = $row['prevent_reinit'];
$this->seriousgame_mode = $row['seriousgame_mode']; $this->seriousgame_mode = $row['seriousgame_mode'];
$this->license = $row['content_license']; $this->license = $row['content_license'];
$this->scorm_debug = $row['debug']; $this->scorm_debug = $row['debug'];
$this->js_lib = $row['js_lib']; $this->js_lib = $row['js_lib'];
$this->path = $row['path']; $this->path = $row['path'];
$this->preview_image = $row['preview_image']; $this->preview_image = $row['preview_image'];
$this->author = $row['author']; $this->author = $row['author'];
$this->hide_toc_frame = $row['hide_toc_frame']; $this->hide_toc_frame = $row['hide_toc_frame'];
$this->lp_session_id = $row['session_id']; $this->lp_session_id = $row['session_id'];
$this->use_max_score = $row['use_max_score']; $this->use_max_score = $row['use_max_score'];
$this->created_on = $row['created_on']; $this->created_on = $row['created_on'];
$this->modified_on = $row['modified_on']; $this->modified_on = $row['modified_on'];
$this->ref = $row['ref']; $this->ref = $row['ref'];
if ($row['publicated_on'] != '0000-00-00 00:00:00') { if ($row['publicated_on'] != '0000-00-00 00:00:00') {
$this->publicated_on = $row['publicated_on']; $this->publicated_on = $row['publicated_on'];
@ -173,7 +179,6 @@ class learnpath
} }
// End of variables checking. // End of variables checking.
$session_id = api_get_session_id(); $session_id = api_get_session_id();
// Get the session condition for learning paths of the base + session. // Get the session condition for learning paths of the base + session.
$session = api_get_session_condition($session_id); $session = api_get_session_condition($session_id);
@ -194,11 +199,11 @@ class learnpath
error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - Found previous view', 0); error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - Found previous view', 0);
} }
$row = Database :: fetch_array($res); $row = Database :: fetch_array($res);
$this->attempt = $row['view_count']; $this->attempt = $row['view_count'];
$this->lp_view_id = $row['id']; $this->lp_view_id = $row['id'];
$this->last_item_seen = $row['last_item']; $this->last_item_seen = $row['last_item'];
$this->progress_db = $row['progress']; $this->progress_db = $row['progress'];
$this->lp_view_session_id = $row['session_id']; $this->lp_view_session_id = $row['session_id'];
} else { } else {
if ($this->debug > 2) { if ($this->debug > 2) {
error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - NOT Found previous view', 0); error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - NOT Found previous view', 0);
@ -358,7 +363,11 @@ class learnpath
} }
} }
$this->ordered_items = self::get_flat_ordered_items_list($this->get_id(), 0, $course_id); $this->ordered_items = self::get_flat_ordered_items_list(
$this->get_id(),
0,
$course_id
);
$this->max_ordered_items = 0; $this->max_ordered_items = 0;
foreach ($this->ordered_items as $index => $dummy) { foreach ($this->ordered_items as $index => $dummy) {
if ($index > $this->max_ordered_items && !empty($dummy)) { if ($index > $this->max_ordered_items && !empty($dummy)) {
@ -866,12 +875,12 @@ class learnpath
//if($this->items[$child]->status_is(array('completed','passed','succeeded'))) //if($this->items[$child]->status_is(array('completed','passed','succeeded')))
// Trying completing parents of failed and browsed items as well. // Trying completing parents of failed and browsed items as well.
if ($this->items[$child]->status_is(array( if ($this->items[$child]->status_is(array(
'completed', 'completed',
'passed', 'passed',
'succeeded', 'succeeded',
'browsed', 'browsed',
'failed' 'failed'
))) { ))) {
// Keep completion status to true. // Keep completion status to true.
} else { } else {
if ($this->debug > 2) { if ($this->debug > 2) {
@ -2001,15 +2010,15 @@ class learnpath
$extension = $file_info['extension']; // Extension only. $extension = $file_info['extension']; // Extension only.
if (!empty($_POST['ppt2lp']) && !in_array(strtolower($extension), array( if (!empty($_POST['ppt2lp']) && !in_array(strtolower($extension), array(
'dll', 'dll',
'exe' 'exe'
))) { ))) {
return 'oogie'; return 'oogie';
} }
if (!empty($_POST['woogie']) && !in_array(strtolower($extension), array( if (!empty($_POST['woogie']) && !in_array(strtolower($extension), array(
'dll', 'dll',
'exe' 'exe'
))) { ))) {
return 'woogie'; return 'woogie';
} }
@ -6044,16 +6053,16 @@ class learnpath
$path_parts = pathinfo($path_file); $path_parts = pathinfo($path_file);
// TODO: Correct the following naive comparisons, also, htm extension is missing. // TODO: Correct the following naive comparisons, also, htm extension is missing.
if (in_array($path_parts['extension'], array( if (in_array($path_parts['extension'], array(
'html', 'html',
'txt', 'txt',
'png', 'png',
'jpg', 'jpg',
'JPG', 'JPG',
'jpeg', 'jpeg',
'JPEG', 'JPEG',
'gif', 'gif',
'swf' 'swf'
))) { ))) {
$return .= $this->display_document($row['path'], true, true); $return .= $this->display_document($row['path'], true, true);
} }
break; break;
@ -8559,7 +8568,7 @@ class learnpath
<img src="' . api_get_path(WEB_IMG_PATH) . 'add.gif" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" /> <img src="' . api_get_path(WEB_IMG_PATH) . 'add.gif" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
</a> </a>
<a href="' . api_get_self() . '?'.api_get_cidreq().'&amp;action=add_item&amp;type=' . TOOL_FORUM . '&amp;forum_id=' . $forum['forum_id'] . '&amp;lp_id=' . $this->lp_id . '" style="vertical-align:middle">' . <a href="' . api_get_self() . '?'.api_get_cidreq().'&amp;action=add_item&amp;type=' . TOOL_FORUM . '&amp;forum_id=' . $forum['forum_id'] . '&amp;lp_id=' . $this->lp_id . '" style="vertical-align:middle">' .
Security :: remove_XSS($forum['forum_title']) . '</a>'; Security :: remove_XSS($forum['forum_title']) . '</a>';
$return .= '</li>'; $return .= '</li>';
@ -8573,7 +8582,7 @@ class learnpath
$return .= ' </a>'; $return .= ' </a>';
$return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY); $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
$return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=add_item&amp;type=' . TOOL_THREAD . '&amp;thread_id=' . $thread['thread_id'] . '&amp;lp_id=' . $this->lp_id . '">' . $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=add_item&amp;type=' . TOOL_THREAD . '&amp;thread_id=' . $thread['thread_id'] . '&amp;lp_id=' . $this->lp_id . '">' .
Security :: remove_XSS($thread['thread_title']) . '</a>'; Security :: remove_XSS($thread['thread_title']) . '</a>';
$return .= '</li>'; $return .= '</li>';
} }
} }

@ -2,22 +2,22 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* File containing the declaration of the learnpathList class. * Class learnpathList
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* This class is only a learning path list container with several practical methods for sorting the list and * This class is only a learning path list container with several practical methods for sorting the list and
* provide links to specific paths * provide links to specific paths
* @uses Database.lib.php to use the database * @uses Database.lib.php to use the database
* @uses learnpath.class.php to generate learnpath objects to get in the list * @uses learnpath.class.php to generate learnpath objects to get in the list
* @author Yannick Warnier <ywarnier@beeznest.org>
*
*/ */
class learnpathList class learnpathList
{ {
public $list = array(); // Holds a flat list of learnpaths data from the database. // Holds a flat list of learnpaths data from the database.
public $ref_list = array(); // Holds a list of references to the learnpaths objects (only filled by get_refs()). public $list = array();
public $alpha_list = array(); // Holds a flat list of learnpaths sorted by alphabetical name order. // Holds a list of references to the learnpaths objects (only filled by get_refs()).
public $ref_list = array();
// Holds a flat list of learnpaths sorted by alphabetical name order.
public $alpha_list = array();
public $course_code; public $course_code;
public $user_id; public $user_id;
public $refs_active = false; public $refs_active = false;
@ -26,9 +26,11 @@ class learnpathList
* This method is the constructor for the learnpathList. It gets a list of available learning paths from * This method is the constructor for the learnpathList. It gets a list of available learning paths from
* the database and creates the learnpath objects. This list depends on the user that is connected * the database and creates the learnpath objects. This list depends on the user that is connected
* (only displays) items if he has enough permissions to view them. * (only displays) items if he has enough permissions to view them.
* @param integer User ID * @param integer $user_id
* @param string Optional course code (otherwise we use api_get_course_id()) * @param string $course_code Optional course code (otherwise we use api_get_course_id())
* @param int Optional session id (otherwise we use api_get_session_id()) * @param int $session_id Optional session id (otherwise we use api_get_session_id())
* @param string $order_by
* @param string $check_publication_dates
* @return void * @return void
*/ */
public function __construct($user_id, $course_code = '', $session_id = null, $order_by = null, $check_publication_dates = false) public function __construct($user_id, $course_code = '', $session_id = null, $order_by = null, $check_publication_dates = false)
@ -57,7 +59,7 @@ class learnpathList
$order = "ORDER BY display_order ASC, name ASC"; $order = "ORDER BY display_order ASC, name ASC";
if (isset($order_by)) { if (isset($order_by)) {
$order = Database::parse_conditions(array('order'=>$order_by)); $order = Database::parse_conditions(array('order'=>$order_by));
} }
$now = api_get_utc_datetime(); $now = api_get_utc_datetime();
@ -104,9 +106,9 @@ class learnpathList
$vis = api_get_item_visibility(api_get_course_info($course_code), 'learnpath', $row['id'], $session_id); $vis = api_get_item_visibility(api_get_course_info($course_code), 'learnpath', $row['id'], $session_id);
if (!empty($row['created_on']) && $row['created_on'] != '0000-00-00 00:00:00') { if (!empty($row['created_on']) && $row['created_on'] != '0000-00-00 00:00:00') {
$row['created_on'] = $row['created_on']; $row['created_on'] = $row['created_on'];
} else { } else {
$row['created_on'] = ''; $row['created_on'] = '';
} }
if (!empty($row['modified_on']) && $row['modified_on'] != '0000-00-00 00:00:00') { if (!empty($row['modified_on']) && $row['modified_on'] != '0000-00-00 00:00:00') {
@ -141,7 +143,7 @@ class learnpathList
'lp_visibility' => $vis, 'lp_visibility' => $vis,
'lp_published' => $pub, 'lp_published' => $pub,
'lp_prevent_reinit' => $row['prevent_reinit'], 'lp_prevent_reinit' => $row['prevent_reinit'],
'seriousgame_mode' => $row['seriousgame_mode'], 'seriousgame_mode' => $row['seriousgame_mode'],
'lp_scorm_debug' => $row['debug'], 'lp_scorm_debug' => $row['debug'],
'lp_display_order' => $row['display_order'], 'lp_display_order' => $row['display_order'],
'lp_preview_image' => stripslashes($row['preview_image']), 'lp_preview_image' => stripslashes($row['preview_image']),
@ -153,8 +155,8 @@ class learnpathList
'expired_on' => $row['expired_on'] 'expired_on' => $row['expired_on']
); );
$names[$row['name']] = $row['id']; $names[$row['name']] = $row['id'];
} }
$this->alpha_list = asort($names); $this->alpha_list = asort($names);
} }
/** /**
@ -162,7 +164,8 @@ class learnpathList
* This applies a transformation internally on list and ref_list and returns a copy of the refs list * This applies a transformation internally on list and ref_list and returns a copy of the refs list
* @return array List of references to learnpath objects * @return array List of references to learnpath objects
*/ */
function get_refs() { function get_refs()
{
foreach ($this->list as $id => $dummy) { foreach ($this->list as $id => $dummy) {
$this->ref_list[$id] = new learnpath($this->course_code, $id, $this->user_id); $this->ref_list[$id] = new learnpath($this->course_code, $id, $this->user_id);
} }
@ -174,19 +177,20 @@ class learnpathList
* Gets a table of the different learnpaths we have at the moment * Gets a table of the different learnpaths we have at the moment
* @return array Learnpath info as [lp_id] => ([lp_type]=> ..., [lp_name]=>...,[lp_desc]=>...,[lp_path]=>...) * @return array Learnpath info as [lp_id] => ([lp_type]=> ..., [lp_name]=>...,[lp_desc]=>...,[lp_path]=>...)
*/ */
function get_flat_list() { function get_flat_list()
{
return $this->list; return $this->list;
} }
/** /**
* Gets a list of lessons of the given course_code and session_id * Gets a list of lessons of the given course_code and session_id
* This functions doesn't need user_id * This functions doesn't need user_id
* @param string Text code of the course * @param string $course_code Text code of the course
* @param int Id of session * @param int $session_id Id of session
* @return array List of lessons with lessons id as keys * @return array List of lessons with lessons id as keys
*/ */
static function get_course_lessons($course_code, $session_id) { static function get_course_lessons($course_code, $session_id)
$tbl_course_lp = Database::get_course_table(TABLE_LP_MAIN); {
$tbl_course_lp = Database::get_course_table(TABLE_LP_MAIN);
$course = api_get_course_info($course_code); $course = api_get_course_info($course_code);
//QUery //QUery
$sql = "SELECT * FROM $tbl_course_lp $sql = "SELECT * FROM $tbl_course_lp

@ -24,7 +24,6 @@
* @todo remove code duplication * @todo remove code duplication
*/ */
use \ChamiloSession as Session; use \ChamiloSession as Session;
/** /**
@ -33,9 +32,9 @@ use \ChamiloSession as Session;
* @return boolean True if item was deleted, false if not found or error * @return boolean True if item was deleted, false if not found or error
*/ */
function deleteitem($id) { function deleteitem($id) {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM); $tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM);
$tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER); $tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER);
// Get the display order for this item before it is deleted. // Get the display order for this item before it is deleted.
@ -54,10 +53,12 @@ function deleteitem($id) {
return false; return false;
} }
// Update the other items and chapters. // Update the other items and chapters.
$sql = "UPDATE $tbl_learnpath_item SET display_order = display_order-1 WHERE c_id = $course_id AND display_order > $display_order AND parent_item_id = $parent_item_id"; $sql = "UPDATE $tbl_learnpath_item SET display_order = display_order-1
$result = Database::query($sql); WHERE c_id = $course_id AND display_order > $display_order AND parent_item_id = $parent_item_id";
$sql = "UPDATE $tbl_learnpath_chapter SET display_order = display_order-1 WHERE c_id = $course_id AND display_order > $display_order AND parent_item_id = $parent_item_id"; Database::query($sql);
$result = Database::query($sql); $sql = "UPDATE $tbl_learnpath_chapter SET display_order = display_order-1
WHERE c_id = $course_id AND display_order > $display_order AND parent_item_id = $parent_item_id";
Database::query($sql);
return true; return true;
} }
@ -87,7 +88,7 @@ function deletemodule($parent_item_id) {
} }
// Get this chapter's display order. // Get this chapter's display order.
$sql = "SELECT display_order, parent_item_id FROM $tbl_learnpath_chapter $sql = "SELECT display_order, parent_item_id FROM $tbl_learnpath_chapter
WHERE c_id = $course_id AND id=$parent_item_id and lp_id=$learnpath_id"; WHERE c_id = $course_id AND id=$parent_item_id and lp_id=$learnpath_id";
$result = Database::query($sql); $result = Database::query($sql);
if (Database::num_rows($result) == 0) { if (Database::num_rows($result) == 0) {
@ -124,7 +125,7 @@ function deletepath($path_id) {
$tbl_learnpath_main = Database :: get_course_table(TABLE_LEARNPATH_MAIN); $tbl_learnpath_main = Database :: get_course_table(TABLE_LEARNPATH_MAIN);
$tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM); $tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM);
$tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER); $tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "DELETE FROM $tbl_learnpath_main WHERE c_id = $course_id AND lp_id='$path_id'"; $sql = "DELETE FROM $tbl_learnpath_main WHERE c_id = $course_id AND lp_id='$path_id'";
@ -151,7 +152,7 @@ function deletepath($path_id) {
function moveitem($direction, $id, $moduleid, $type = 'item') { function moveitem($direction, $id, $moduleid, $type = 'item') {
global $learnpath_id; global $learnpath_id;
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$tbl_learnpath_item = Database::get_course_table(TABLE_LEARNPATH_ITEM); $tbl_learnpath_item = Database::get_course_table(TABLE_LEARNPATH_ITEM);
$tbl_learnpath_chapter = Database::get_course_table(TABLE_LEARNPATH_CHAPTER); $tbl_learnpath_chapter = Database::get_course_table(TABLE_LEARNPATH_CHAPTER);
@ -221,7 +222,7 @@ function moveitem($direction, $id, $moduleid, $type = 'item') {
function movemodule($direction, $id) { function movemodule($direction, $id) {
global $learnpath_id; global $learnpath_id;
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$tbl_learnpath_chapter = Database::get_course_table(TABLE_LEARNPATH_CHAPTER); $tbl_learnpath_chapter = Database::get_course_table(TABLE_LEARNPATH_CHAPTER);
if ($direction == 'up') { if ($direction == 'up') {
$sortDirection = 'DESC'; $sortDirection = 'DESC';
@ -276,7 +277,7 @@ function movemodule($direction, $id) {
function insert_item($type = 'item', $name, $chapter_description = '', $parent_id = 0, $learnpath_id = 0, $params = null) { function insert_item($type = 'item', $name, $chapter_description = '', $parent_id = 0, $learnpath_id = 0, $params = null) {
$tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER); $tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER);
$tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM); $tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
// Getting the last order number from the chapters table, in this learnpath, for the parent chapter given. // Getting the last order number from the chapters table, in this learnpath, for the parent chapter given.
@ -295,10 +296,10 @@ function insert_item($type = 'item', $name, $chapter_description = '', $parent_i
$row = Database::fetch_array($result); $row = Database::fetch_array($result);
$last_item_order = $row['display_order']; $last_item_order = $row['display_order'];
$new_order = max($last_chapter_order, $last_item_order) + 1; $new_order = max($last_chapter_order, $last_item_order) + 1;
if ($type === 'chapter') { if ($type === 'chapter') {
$sql = "INSERT INTO $tbl_learnpath_chapter (c_id, lp_id, chapter_name, chapter_description, display_order) $sql = "INSERT INTO $tbl_learnpath_chapter (c_id, lp_id, chapter_name, chapter_description, display_order)
VALUES ( $course_id, VALUES ( $course_id,
'".domesticate($learnpath_id)."', '".domesticate($learnpath_id)."',
'".domesticate(htmlspecialchars($name))."', '".domesticate(htmlspecialchars($name))."',
'".domesticate(htmlspecialchars($chapter_description))."', '".domesticate(htmlspecialchars($chapter_description))."',
@ -309,7 +310,7 @@ function insert_item($type = 'item', $name, $chapter_description = '', $parent_i
} }
$id = Database :: insert_id(); $id = Database :: insert_id();
} elseif ($type === 'item') { } elseif ($type === 'item') {
$sql = "INSERT INTO $tbl_learnpath_item (c_id, parent_item_id, item_type, display_order) VALUES $sql = "INSERT INTO $tbl_learnpath_item (c_id, parent_item_id, item_type, display_order) VALUES
($course_id, '".domesticate($parent_id)."','".domesticate(htmlspecialchars($type))."', $new_order )"; ($course_id, '".domesticate($parent_id)."','".domesticate(htmlspecialchars($type))."', $new_order )";
$result = Database::query($sql); $result = Database::query($sql);
if ($result === false) { if ($result === false) {
@ -325,7 +326,7 @@ function insert_item($type = 'item', $name, $chapter_description = '', $parent_i
* @return array List of learnpath chapter titles * @return array List of learnpath chapter titles
*/ */
function array_learnpath_categories() { function array_learnpath_categories() {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
global $learnpath_id; global $learnpath_id;
$tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER); $tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER);
@ -645,7 +646,7 @@ function learnpath_items($itemid) {
global $xml_output; global $xml_output;
$tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM); $tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql_items = "SELECT parent_item_id FROM $tbl_lp_item WHERE c_id = $course_id AND id='$itemid'"; $sql_items = "SELECT parent_item_id FROM $tbl_lp_item WHERE c_id = $course_id AND id='$itemid'";
$moduleid_sql = Database::query($sql_items); $moduleid_sql = Database::query($sql_items);
@ -668,10 +669,10 @@ function learnpath_items($itemid) {
* @return array Table containing the chapters * @return array Table containing the chapters
*/ */
function learnpath_chapters($learnpath_id) { function learnpath_chapters($learnpath_id) {
global $xml_output, $learnpath_id; global $xml_output, $learnpath_id;
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql_items = "SELECT * FROM $tbl_lp_item WHERE c_id = $course_id AND lp_id='$learnpath_id' AND item_type='dokeos_chapter' ORDER BY display_order ASC"; $sql_items = "SELECT * FROM $tbl_lp_item WHERE c_id = $course_id AND lp_id='$learnpath_id' AND item_type='dokeos_chapter' ORDER BY display_order ASC";
//$sql_items = "SELECT * FROM $tbl_learnpath_chapter WHERE lp_id='$learnpath_id' ORDER BY display_order ASC"; //$sql_items = "SELECT * FROM $tbl_learnpath_chapter WHERE lp_id='$learnpath_id' ORDER BY display_order ASC";
@ -723,7 +724,7 @@ function prereqcheck($id_in_path) {
$tbl_learnpath_user = Database :: get_course_table(TABLE_LEARNPATH_USER); $tbl_learnpath_user = Database :: get_course_table(TABLE_LEARNPATH_USER);
$tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM); $tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM);
$tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER); $tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
// 2. Initialise return value. // 2. Initialise return value.
@ -848,10 +849,10 @@ function get_learnpath_tree($learnpath_id) {
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$tree = array(); $tree = array();
$chapters = array(); $chapters = array();
$all_items_by_chapter = array(); $all_items_by_chapter = array();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "SELECT * FROM $tbl_lp_item WHERE c_id = $course_id AND lp_id = ".$learnpath_id." AND item_type='dokeos_chapter' ORDER BY display_order"; $sql = "SELECT * FROM $tbl_lp_item WHERE c_id = $course_id AND lp_id = ".$learnpath_id." AND item_type='dokeos_chapter' ORDER BY display_order";
//error_log('New LP - learnpath_functions - get_learnpath_tree: '.$sql,0); //error_log('New LP - learnpath_functions - get_learnpath_tree: '.$sql,0);
$res = Database::query($sql); $res = Database::query($sql);
@ -1139,13 +1140,13 @@ function export_exercise($item_id) {
global $expdir, $_course, $_configuration, $_SESSION, $_SERVER, $language_interface, $langExerciseNotFound, $langQuestion, $langOk, $origin, $questionNum; global $expdir, $_course, $_configuration, $_SESSION, $_SERVER, $language_interface, $langExerciseNotFound, $langQuestion, $langOk, $origin, $questionNum;
$exerciseId = $item_id; $exerciseId = $item_id;
require_once '../exercice/testcategory.class.php'; require_once '../exercice/testcategory.class.php';
require_once '../exercice/exercise.class.php'; require_once '../exercice/exercise.class.php';
require_once '../exercice/question.class.php'; require_once '../exercice/question.class.php';
require_once '../exercice/answer.class.php'; require_once '../exercice/answer.class.php';
require_once '../exercice/exercise.lib.php'; require_once '../exercice/exercise.lib.php';
$TBL_EXERCISES = Database :: get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCISES = Database :: get_course_table(TABLE_QUIZ_TEST);
/* Clears the exercise session */ /* Clears the exercise session */
@ -1827,7 +1828,7 @@ function deldir($dir) {
* Basically, all this function does is put the scorm directory back into a zip file (like the one * Basically, all this function does is put the scorm directory back into a zip file (like the one
* that was most probably used to import the course at first) * that was most probably used to import the course at first)
* @deprecated this function is only called in the newscorm/scorm_admin.php which is deprecated * @deprecated this function is only called in the newscorm/scorm_admin.php which is deprecated
* *
* @param string Name of the SCORM path (or the directory under which it resides) * @param string Name of the SCORM path (or the directory under which it resides)
* @param array Not used right now. Should replace the use of global $_course * @param array Not used right now. Should replace the use of global $_course
* @return void * @return void
@ -1942,7 +1943,7 @@ function createimsmanifest($circle1_files, $learnpath_id) {
// Items list. // Items list.
$i = 0; $i = 0;
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$previous_item_id = '00'; $previous_item_id = '00';
while ($circle1_files[0][$i]) { while ($circle1_files[0][$i]) {
// Check whether we are in the border of two chapters. // Check whether we are in the border of two chapters.

@ -11,9 +11,7 @@
* *
* @package chamilo.learnpath * @package chamilo.learnpath
*/ */
/**
* Code
*/
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
api_protect_course_script(); api_protect_course_script();
@ -76,7 +74,7 @@ $learnpath_id = isset($_REQUEST['lp_id']) ? $_REQUEST['lp_id'] : null;
// Using the resource linker as a tool for adding resources to the learning path. // Using the resource linker as a tool for adding resources to the learning path.
if ($action == 'add' && $type == 'learnpathitem') { if ($action == 'add' && $type == 'learnpathitem') {
$htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>"; $htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
} }
if ((!$is_allowed_to_edit) || ($isStudentView)) { if ((!$is_allowed_to_edit) || ($isStudentView)) {
@ -95,9 +93,9 @@ if (isset($_SESSION['gradebook'])){
if (!empty($gradebook) && $gradebook=='view') { if (!empty($gradebook) && $gradebook=='view') {
$interbreadcrumb[]= array ( $interbreadcrumb[]= array (
'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook') 'name' => get_lang('ToolGradebook')
); );
} }
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths')); $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));

@ -2,8 +2,8 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This script contains the server part of the AJAX interaction process. The client part is located * This script contains the server part of the AJAX interaction process.
* in lp_api.php or other api's. * The client part is located * in lp_api.php or other api's.
* @package chamilo.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
*/ */
@ -415,8 +415,8 @@ function save_item(
$myStatus = $myStatusInDB; $myStatus = $myStatusInDB;
} }
$myTotal = $myLP->get_total_items_count_without_chapters(); $myTotal = $myLP->get_total_items_count_without_chapters();
$myComplete = $myLP->get_complete_items_count(); $myComplete = $myLP->get_complete_items_count();
$myProgressMode = $myLP->get_progress_bar_mode(); $myProgressMode = $myLP->get_progress_bar_mode();
$myProgressMode = $myProgressMode == '' ? '%' : $myProgressMode; $myProgressMode = $myProgressMode == '' ? '%' : $myProgressMode;

@ -184,19 +184,19 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
* -lms_view_id * -lms_view_id
* -lms_user_id * -lms_user_id
*/ */
$mytotal = $mylp->get_total_items_count_without_chapters(); $mytotal = $mylp->get_total_items_count_without_chapters();
$mycomplete = $mylp->get_complete_items_count(); $mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode(); $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(); $mynext = $mylp->get_next_item_id();
$myprevious = $mylp->get_previous_item_id(); $myprevious = $mylp->get_previous_item_id();
$myitemtype = $mylpi->get_type(); $myitemtype = $mylpi->get_type();
$mylesson_mode = $mylpi->get_lesson_mode(); $mylesson_mode = $mylpi->get_lesson_mode();
$mycredit = $mylpi->get_credit(); $mycredit = $mylpi->get_credit();
$mylaunch_data = $mylpi->get_launch_data(); $mylaunch_data = $mylpi->get_launch_data();
$myinteractions_count = $mylpi->get_interactions_count(); $myinteractions_count = $mylpi->get_interactions_count();
$myobjectives_count = $mylpi->get_objectives_count(); $myobjectives_count = $mylpi->get_objectives_count();
$mycore_exit = $mylpi->get_core_exit(); $mycore_exit = $mylpi->get_core_exit();
$return .= $return .=
//"saved_lesson_status='not attempted';" . //"saved_lesson_status='not attempted';" .
@ -237,4 +237,10 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
return $return; return $return;
} }
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']
);

@ -7,9 +7,7 @@
* @package chamilo.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
*/ */
/**
* Code
*/
// Flag to allow for anonymous user - needs to be set before global.inc.php. // Flag to allow for anonymous user - needs to be set before global.inc.php.
$use_anonymous = true; $use_anonymous = true;
@ -134,33 +132,33 @@ function switch_item_toc($lp_id, $user_id, $view_id, $current_item, $next_item)
$mycore_exit = $mylpi->get_core_exit(); $mycore_exit = $mylpi->get_core_exit();
$return .= $return .=
//"saved_lesson_status='not attempted';" . //"saved_lesson_status='not attempted';" .
"olms.lms_lp_id=".$lp_id.";" . "olms.lms_lp_id=".$lp_id.";" .
"olms.lms_item_id=".$new_item_id.";" . "olms.lms_item_id=".$new_item_id.";" .
"olms.lms_old_item_id=0;" . "olms.lms_old_item_id=0;" .
//"lms_been_synchronized=0;" . //"lms_been_synchronized=0;" .
"olms.lms_initialized=0;" . "olms.lms_initialized=0;" .
//"lms_total_lessons=".$mytotal.";" . //"lms_total_lessons=".$mytotal.";" .
//"lms_complete_lessons=".$mycomplete.";" . //"lms_complete_lessons=".$mycomplete.";" .
//"lms_progress_bar_mode='".$myprogress_mode."';" . //"lms_progress_bar_mode='".$myprogress_mode."';" .
"olms.lms_view_id=".$view_id.";" . "olms.lms_view_id=".$view_id.";" .
"olms.lms_user_id=".$user_id.";" . "olms.lms_user_id=".$user_id.";" .
"olms.next_item=".$new_item_id.";" . // This one is very important to replace possible literal strings. "olms.next_item=".$new_item_id.";" . // This one is very important to replace possible literal strings.
"olms.lms_next_item=".$mynext.";" . "olms.lms_next_item=".$mynext.";" .
"olms.lms_previous_item=".$myprevious.";" . "olms.lms_previous_item=".$myprevious.";" .
"olms.lms_item_type = '".$myitemtype."';" . "olms.lms_item_type = '".$myitemtype."';" .
"olms.lms_item_credit = '".$mycredit."';" . "olms.lms_item_credit = '".$mycredit."';" .
"olms.lms_item_lesson_mode = '".$mylesson_mode."';" . "olms.lms_item_lesson_mode = '".$mylesson_mode."';" .
"olms.lms_item_launch_data = '".$mylaunch_data."';" . "olms.lms_item_launch_data = '".$mylaunch_data."';" .
"olms.lms_item_interactions_count = '".$myinteractions_count."';" . "olms.lms_item_interactions_count = '".$myinteractions_count."';" .
"olms.lms_item_objectives_count = '".$myinteractions_count."';" . "olms.lms_item_objectives_count = '".$myinteractions_count."';" .
"olms.lms_item_core_exit = '".$mycore_exit."';" . "olms.lms_item_core_exit = '".$mycore_exit."';" .
"olms.asset_timer = 0;"; "olms.asset_timer = 0;";
$return .= "update_toc('unhighlight','".$current_item."');". $return .= "update_toc('unhighlight','".$current_item."');".
"update_toc('highlight','".$new_item_id."');". "update_toc('highlight','".$new_item_id."');".
"update_toc('$mylesson_status','".$new_item_id."');". "update_toc('$mylesson_status','".$new_item_id."');".
"update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');"; "update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
$mylp->set_error_msg(''); $mylp->set_error_msg('');
$mylp->prerequisites_match(); // Check the prerequisites are all complete. $mylp->prerequisites_match(); // Check the prerequisites are all complete.

@ -88,8 +88,8 @@ if ($is_allowed_to_edit) {
echo '<div class="actions">'; echo '<div class="actions">';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_lp">'.Display::return_icon('new_learnpath.png', get_lang('LearnpathAddLearnpath'), '', ICON_SIZE_MEDIUM).'</a>'. echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_lp">'.Display::return_icon('new_learnpath.png', get_lang('LearnpathAddLearnpath'), '', ICON_SIZE_MEDIUM).'</a>'.
str_repeat('&nbsp;', 3). str_repeat('&nbsp;', 3).
'<a href="../upload/index.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'">'.Display::return_icon('import_scorm.png', get_lang('UploadScorm'), '', ICON_SIZE_MEDIUM).'</a>'; '<a href="../upload/index.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'">'.Display::return_icon('import_scorm.png', get_lang('UploadScorm'), '', ICON_SIZE_MEDIUM).'</a>';
if (api_get_setting('service_ppt2lp', 'active') == 'true') { if (api_get_setting('service_ppt2lp', 'active') == 'true') {
echo str_repeat('&nbsp;', 3).'<a href="../upload/upload_ppt.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"> echo str_repeat('&nbsp;', 3).'<a href="../upload/upload_ppt.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'">
'.Display::return_icon('import_powerpoint.png', get_lang('PowerPointConvert'), '', ICON_SIZE_MEDIUM).'</a>'; '.Display::return_icon('import_powerpoint.png', get_lang('PowerPointConvert'), '', ICON_SIZE_MEDIUM).'</a>';
@ -214,7 +214,7 @@ if (!empty($flat_list)) {
} }
$dsp_line = '<tr align="center" class="'.$oddclass.'">'. $dsp_line = '<tr align="center" class="'.$oddclass.'">'.
'<td align="left" valign="top">'.$icon_learnpath.' '<td align="left" valign="top">'.$icon_learnpath.'
<a href="'.$url_start_lp.'">'.$my_title.'</a>'.$session_img.$extra."</td>"; <a href="'.$url_start_lp.'">'.$my_title.'</a>'.$session_img.$extra."</td>";
$dsp_desc = ''; $dsp_desc = '';
@ -255,7 +255,7 @@ if (!empty($flat_list)) {
// EDIT LP // EDIT LP
if ($current_session == $details['lp_session']) { if ($current_session == $details['lp_session']) {
$dsp_edit_lp = '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$id.'">'. $dsp_edit_lp = '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$id.'">'.
Display::return_icon('settings.png', get_lang('CourseSettings'), '', ICON_SIZE_SMALL).'</a>'; Display::return_icon('settings.png', get_lang('CourseSettings'), '', ICON_SIZE_SMALL).'</a>';
} else { } else {
$dsp_edit_lp = Display::return_icon('settings_na.png', get_lang('CourseSettings'), '', ICON_SIZE_SMALL); $dsp_edit_lp = Display::return_icon('settings_na.png', get_lang('CourseSettings'), '', ICON_SIZE_SMALL);
} }
@ -264,7 +264,7 @@ if (!empty($flat_list)) {
if ($current_session == $details['lp_session']) { if ($current_session == $details['lp_session']) {
if ($details['lp_type'] == 1 || $details['lp_type'] == 2) { if ($details['lp_type'] == 1 || $details['lp_type'] == 2) {
$dsp_build = '<a href="lp_controller.php?'.api_get_cidreq().'&amp;action=add_item&amp;type=step&amp;lp_id='.$id.'">'. $dsp_build = '<a href="lp_controller.php?'.api_get_cidreq().'&amp;action=add_item&amp;type=step&amp;lp_id='.$id.'">'.
Display::return_icon('edit.png', get_lang('LearnpathEditLearnpath'), '', ICON_SIZE_SMALL).'</a>'; Display::return_icon('edit.png', get_lang('LearnpathEditLearnpath'), '', ICON_SIZE_SMALL).'</a>';
} else { } else {
$dsp_build = Display::return_icon('edit_na.png', get_lang('LearnpathEditLearnpath'), '', ICON_SIZE_SMALL); $dsp_build = Display::return_icon('edit_na.png', get_lang('LearnpathEditLearnpath'), '', ICON_SIZE_SMALL);
} }
@ -457,7 +457,7 @@ if (!empty($flat_list)) {
} }
echo $dsp_line.$start_time.$end_time.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_edit_lp.$dsp_visible.$dsp_publish.$dsp_reinit. echo $dsp_line.$start_time.$end_time.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_edit_lp.$dsp_visible.$dsp_publish.$dsp_reinit.
$dsp_default_view.$dsp_debug.$dsp_disk.$copy.$lp_auto_lunch_icon.$export_icon.$dsp_delete.$dsp_order.$dsp_edit_close; $dsp_default_view.$dsp_debug.$dsp_disk.$copy.$lp_auto_lunch_icon.$export_icon.$dsp_delete.$dsp_order.$dsp_edit_close;
echo "</tr>"; echo "</tr>";
//counter for number of elements treated //counter for number of elements treated

@ -2,7 +2,8 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Script opened in an iframe and containing the learning path's navigation and progress bar * Script opened in an iframe and containing the
* learning path's navigation and progress bar
* @package chamilo.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
*/ */
@ -34,7 +35,6 @@ if (isset($_SESSION['lpobject'])) {
if (is_object($oLP)) { if (is_object($oLP)) {
$_SESSION['oLP'] = $oLP; $_SESSION['oLP'] = $oLP;
} else { } else {
//error_log('New LP - in lp_nav.php - SESSION[lpobject] is not object - dying',0);
die('Could not instanciate lp object'); die('Could not instanciate lp object');
} }
$display_mode = $_SESSION['oLP']->mode; $display_mode = $_SESSION['oLP']->mode;
@ -62,13 +62,12 @@ if (isset($_SESSION['lpobject'])) {
session_write_close(); session_write_close();
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer({ jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer({
success: function(player, node) { success: function(player, node) {
} }
});
}); });
});
</script> </script>
<span> <span>
<?php echo (!empty($mediaplayer)) ? $mediaplayer : '&nbsp;' ?> <?php echo (!empty($mediaplayer)) ? $mediaplayer : '&nbsp;' ?>

Loading…
Cancel
Save