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
/* For licensing terms, see /license.txt */
require_once 'learnpathItem.class.php';
/**
* Class aiccBlock
* 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
@ -9,7 +12,6 @@
* @author Yannick Warnier <ywarnier@beeznest.org>
* @license GNU/GPL
*/
require_once 'learnpathItem.class.php';
class aiccBlock extends learnpathItem
{
public $identifier = '';
@ -21,7 +23,8 @@ class aiccBlock extends learnpathItem
* @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
*/
function aiccBlock($type = 'config', $params) {
function aiccBlock($type = 'config', $params)
{
if (isset($params)) {
switch ($type) {
case 'db':
@ -32,7 +35,7 @@ class aiccBlock extends learnpathItem
foreach ($params as $a => $value) {
switch ($a) {
case 'system_id':
$this->identifier = strtolower($value);
$this->identifier = strtolower($value);
break;
case 'member':
if (strstr($value, ',') !== false) {

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

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

@ -21,7 +21,8 @@ class aiccResource
* @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
*/
public function aiccResource($type = 'config', $params) {
public function aiccResource($type = 'config', $params)
{
if (isset($params)) {
switch ($type) {
@ -30,24 +31,24 @@ class aiccResource
return false;
case 'config': // Do the same as the default.
default:
foreach ($params as $a => $value) {
switch ($a) {
case 'system_id':
$this->identifier = strtolower($value);
break;
case 'title':
$this->title = $value;
case 'description':
$this->description = $value;
break;
case 'developer_id':
$this->developer_id = $value;
break;
}
}
foreach ($params as $a => $value) {
switch ($a) {
case 'system_id':
$this->identifier = strtolower($value);
break;
case 'title':
$this->title = $value;
case 'description':
$this->description = $value;
break;
case 'developer_id':
$this->developer_id = $value;
break;
}
}
return true;
}
}
return false;
}
}
}

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

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

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

@ -2,15 +2,10 @@
/* For licensing terms, see /license.txt */
/**
* This file is responsible for passing requested documents to the browser.
*
* @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';
$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;
if (strpos($doc_url,'../') OR strpos($doc_url,'/..')) {
$doc_url = '';
$doc_url = '';
}
$sys_course_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/scorm';
$user_id = api_get_user_id();
if ($_SESSION['oLP']) {
$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);
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);
if ($visible) {
event_download($doc_url);
event_download($doc_url);
if (Security::check_abs_path($sys_course_path.$doc_url, $sys_course_path.'/')) {
$full_file_name = $sys_course_path.$doc_url;
DocumentManager::file_send_for_download($full_file_name);
exit;
}
}
//}
}
//}
}
}
Display::display_error_message(get_lang('ProtectedDocument'));//api_not_allowed backbutton won't work.
exit;
exit;

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

@ -74,26 +74,29 @@ class learnpath
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.
* @param string $course Course code
* @param integer $lp_id
* @param integer $user_id
* @return boolean True on success, false on error
* @param string $course Course code
* @param integer $lp_id
* @param integer $user_id
* @return boolean True on success, false on error
*/
public function __construct($course, $lp_id, $user_id)
{
$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)) {
$this->error = 'Course code is empty';
return false;
} else {
$course_info = api_get_course_info($course);
if (!empty($course_info)) {
$this->cc = $course_info['code'];
$this->course_info = $course_info;
$course_id = $course_info['real_id'];
$this->cc = $course_info['code'];
$this->course_info = $course_info;
$course_id = $course_info['real_id'];
} else {
$this->error = 'Course code does not exist in database.';
return false;
@ -110,31 +113,34 @@ class learnpath
// 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_id = intval($lp_id);
$sql = "SELECT * FROM $lp_table WHERE id = '$lp_id' AND c_id = $course_id";
if ($this->debug > 2) { error_log('New LP - learnpath::__construct() '.__LINE__.' - Querying lp: '.$sql, 0); }
$sql = "SELECT * FROM $lp_table
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);
if (Database::num_rows($res) > 0) {
$this->lp_id = $lp_id;
$row = Database::fetch_array($res);
$this->type = $row['lp_type'];
$this->name = stripslashes($row['name']);
$this->proximity = $row['content_local'];
$this->theme = $row['theme'];
$this->maker = $row['content_maker'];
$this->prevent_reinit = $row['prevent_reinit'];
$this->lp_id = $lp_id;
$row = Database::fetch_array($res);
$this->type = $row['lp_type'];
$this->name = stripslashes($row['name']);
$this->proximity = $row['content_local'];
$this->theme = $row['theme'];
$this->maker = $row['content_maker'];
$this->prevent_reinit = $row['prevent_reinit'];
$this->seriousgame_mode = $row['seriousgame_mode'];
$this->license = $row['content_license'];
$this->scorm_debug = $row['debug'];
$this->js_lib = $row['js_lib'];
$this->path = $row['path'];
$this->preview_image = $row['preview_image'];
$this->author = $row['author'];
$this->hide_toc_frame = $row['hide_toc_frame'];
$this->lp_session_id = $row['session_id'];
$this->use_max_score = $row['use_max_score'];
$this->created_on = $row['created_on'];
$this->modified_on = $row['modified_on'];
$this->ref = $row['ref'];
$this->license = $row['content_license'];
$this->scorm_debug = $row['debug'];
$this->js_lib = $row['js_lib'];
$this->path = $row['path'];
$this->preview_image = $row['preview_image'];
$this->author = $row['author'];
$this->hide_toc_frame = $row['hide_toc_frame'];
$this->lp_session_id = $row['session_id'];
$this->use_max_score = $row['use_max_score'];
$this->created_on = $row['created_on'];
$this->modified_on = $row['modified_on'];
$this->ref = $row['ref'];
if ($row['publicated_on'] != '0000-00-00 00:00:00') {
$this->publicated_on = $row['publicated_on'];
@ -173,7 +179,6 @@ class learnpath
}
// End of variables checking.
$session_id = api_get_session_id();
// Get the session condition for learning paths of the base + session.
$session = api_get_session_condition($session_id);
@ -194,11 +199,11 @@ class learnpath
error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - Found previous view', 0);
}
$row = Database :: fetch_array($res);
$this->attempt = $row['view_count'];
$this->lp_view_id = $row['id'];
$this->last_item_seen = $row['last_item'];
$this->progress_db = $row['progress'];
$this->lp_view_session_id = $row['session_id'];
$this->attempt = $row['view_count'];
$this->lp_view_id = $row['id'];
$this->last_item_seen = $row['last_item'];
$this->progress_db = $row['progress'];
$this->lp_view_session_id = $row['session_id'];
} else {
if ($this->debug > 2) {
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;
foreach ($this->ordered_items as $index => $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')))
// Trying completing parents of failed and browsed items as well.
if ($this->items[$child]->status_is(array(
'completed',
'passed',
'succeeded',
'browsed',
'failed'
))) {
'completed',
'passed',
'succeeded',
'browsed',
'failed'
))) {
// Keep completion status to true.
} else {
if ($this->debug > 2) {
@ -2001,15 +2010,15 @@ class learnpath
$extension = $file_info['extension']; // Extension only.
if (!empty($_POST['ppt2lp']) && !in_array(strtolower($extension), array(
'dll',
'exe'
))) {
'dll',
'exe'
))) {
return 'oogie';
}
if (!empty($_POST['woogie']) && !in_array(strtolower($extension), array(
'dll',
'exe'
))) {
'dll',
'exe'
))) {
return 'woogie';
}
@ -6044,16 +6053,16 @@ class learnpath
$path_parts = pathinfo($path_file);
// TODO: Correct the following naive comparisons, also, htm extension is missing.
if (in_array($path_parts['extension'], array(
'html',
'txt',
'png',
'jpg',
'JPG',
'jpeg',
'JPEG',
'gif',
'swf'
))) {
'html',
'txt',
'png',
'jpg',
'JPG',
'jpeg',
'JPEG',
'gif',
'swf'
))) {
$return .= $this->display_document($row['path'], true, true);
}
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" />
</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">' .
Security :: remove_XSS($forum['forum_title']) . '</a>';
Security :: remove_XSS($forum['forum_title']) . '</a>';
$return .= '</li>';
@ -8573,7 +8582,7 @@ class learnpath
$return .= ' </a>';
$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 . '">' .
Security :: remove_XSS($thread['thread_title']) . '</a>';
Security :: remove_XSS($thread['thread_title']) . '</a>';
$return .= '</li>';
}
}

@ -2,22 +2,22 @@
/* For licensing terms, see /license.txt */
/**
* File containing the declaration of the learnpathList class.
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Class learnpathList
* This class is only a learning path list container with several practical methods for sorting the list and
* provide links to specific paths
* @uses Database.lib.php to use the database
* @uses learnpath.class.php to generate learnpath objects to get in the list
* @author Yannick Warnier <ywarnier@beeznest.org>
*
*/
class learnpathList
{
public $list = array(); // 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 $alpha_list = array(); // Holds a flat list of learnpaths sorted by alphabetical name order.
// Holds a flat list of learnpaths data from the database.
public $list = array();
// 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 $user_id;
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
* 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.
* @param integer User ID
* @param string Optional course code (otherwise we use api_get_course_id())
* @param int Optional session id (otherwise we use api_get_session_id())
* @param integer $user_id
* @param string $course_code Optional course code (otherwise we use api_get_course_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
*/
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";
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();
@ -104,9 +106,9 @@ class learnpathList
$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') {
$row['created_on'] = $row['created_on'];
$row['created_on'] = $row['created_on'];
} else {
$row['created_on'] = '';
$row['created_on'] = '';
}
if (!empty($row['modified_on']) && $row['modified_on'] != '0000-00-00 00:00:00') {
@ -141,7 +143,7 @@ class learnpathList
'lp_visibility' => $vis,
'lp_published' => $pub,
'lp_prevent_reinit' => $row['prevent_reinit'],
'seriousgame_mode' => $row['seriousgame_mode'],
'seriousgame_mode' => $row['seriousgame_mode'],
'lp_scorm_debug' => $row['debug'],
'lp_display_order' => $row['display_order'],
'lp_preview_image' => stripslashes($row['preview_image']),
@ -153,8 +155,8 @@ class learnpathList
'expired_on' => $row['expired_on']
);
$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
* @return array List of references to learnpath objects
*/
function get_refs() {
function get_refs()
{
foreach ($this->list as $id => $dummy) {
$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
* @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;
}
/**
* Gets a list of lessons of the given course_code and session_id
* This functions doesn't need user_id
* @param string Text code of the course
* @param int Id of session
* @param string $course_code Text code of the course
* @param int $session_id Id of session
* @return array List of lessons with lessons id as keys
*/
static function get_course_lessons($course_code, $session_id) {
$tbl_course_lp = Database::get_course_table(TABLE_LP_MAIN);
static function get_course_lessons($course_code, $session_id)
{
$tbl_course_lp = Database::get_course_table(TABLE_LP_MAIN);
$course = api_get_course_info($course_code);
//QUery
$sql = "SELECT * FROM $tbl_course_lp

@ -24,7 +24,6 @@
* @todo remove code duplication
*/
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
*/
function deleteitem($id) {
$course_id = api_get_course_int_id();
$tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM);
$tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER);
// Get the display order for this item before it is deleted.
@ -54,10 +53,12 @@ function deleteitem($id) {
return false;
}
// 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";
$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";
$result = Database::query($sql);
$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";
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;
}
@ -87,7 +88,7 @@ function deletemodule($parent_item_id) {
}
// 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";
$result = Database::query($sql);
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_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM);
$tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER);
$course_id = api_get_course_int_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') {
global $learnpath_id;
$course_id = api_get_course_int_id();
$tbl_learnpath_item = Database::get_course_table(TABLE_LEARNPATH_ITEM);
$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) {
global $learnpath_id;
$course_id = api_get_course_int_id();
$tbl_learnpath_chapter = Database::get_course_table(TABLE_LEARNPATH_CHAPTER);
if ($direction == 'up') {
$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) {
$tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER);
$tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM);
$course_id = api_get_course_int_id();
// 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);
$last_item_order = $row['display_order'];
$new_order = max($last_chapter_order, $last_item_order) + 1;
if ($type === 'chapter') {
$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(htmlspecialchars($name))."',
'".domesticate(htmlspecialchars($chapter_description))."',
@ -309,7 +310,7 @@ function insert_item($type = 'item', $name, $chapter_description = '', $parent_i
}
$id = Database :: insert_id();
} 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 )";
$result = Database::query($sql);
if ($result === false) {
@ -325,7 +326,7 @@ function insert_item($type = 'item', $name, $chapter_description = '', $parent_i
* @return array List of learnpath chapter titles
*/
function array_learnpath_categories() {
$course_id = api_get_course_int_id();
$course_id = api_get_course_int_id();
global $learnpath_id;
$tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER);
@ -645,7 +646,7 @@ function learnpath_items($itemid) {
global $xml_output;
$tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM);
$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'";
$moduleid_sql = Database::query($sql_items);
@ -668,10 +669,10 @@ function learnpath_items($itemid) {
* @return array Table containing the chapters
*/
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);
$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_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_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM);
$tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER);
$course_id = api_get_course_int_id();
// 2. Initialise return value.
@ -848,10 +849,10 @@ function get_learnpath_tree($learnpath_id) {
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$tree = array();
$chapters = array();
$chapters = array();
$all_items_by_chapter = array();
$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";
//error_log('New LP - learnpath_functions - get_learnpath_tree: '.$sql,0);
$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;
$exerciseId = $item_id;
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/answer.class.php';
require_once '../exercice/exercise.lib.php';
$TBL_EXERCISES = Database :: get_course_table(TABLE_QUIZ_TEST);
/* 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
* 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
*
*
* @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
* @return void
@ -1942,7 +1943,7 @@ function createimsmanifest($circle1_files, $learnpath_id) {
// Items list.
$i = 0;
$course_id = api_get_course_int_id();
$previous_item_id = '00';
while ($circle1_files[0][$i]) {
// Check whether we are in the border of two chapters.

@ -11,9 +11,7 @@
*
* @package chamilo.learnpath
*/
/**
* Code
*/
$this_section = SECTION_COURSES;
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.
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)) {
@ -95,9 +93,9 @@ if (isset($_SESSION['gradebook'])){
if (!empty($gradebook) && $gradebook=='view') {
$interbreadcrumb[]= array (
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));

@ -2,8 +2,8 @@
/* For licensing terms, see /license.txt */
/**
* This script contains the server part of the AJAX interaction process. The client part is located
* in lp_api.php or other api's.
* This script contains the server part of the AJAX interaction process.
* The client part is located * in lp_api.php or other api's.
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
@ -415,8 +415,8 @@ function save_item(
$myStatus = $myStatusInDB;
}
$myTotal = $myLP->get_total_items_count_without_chapters();
$myComplete = $myLP->get_complete_items_count();
$myTotal = $myLP->get_total_items_count_without_chapters();
$myComplete = $myLP->get_complete_items_count();
$myProgressMode = $myLP->get_progress_bar_mode();
$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_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();
$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();
$myobjectives_count = $mylpi->get_objectives_count();
$mycore_exit = $mylpi->get_core_exit();
$return .=
//"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;
}
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
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Code
*/
// Flag to allow for anonymous user - needs to be set before global.inc.php.
$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();
$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;";
//"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');";
"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.

@ -88,8 +88,8 @@ if ($is_allowed_to_edit) {
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>'.
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>';
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>';
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.'">
'.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.'">'.
'<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>";
$dsp_desc = '';
@ -255,7 +255,7 @@ if (!empty($flat_list)) {
// EDIT LP
if ($current_session == $details['lp_session']) {
$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 {
$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 ($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.'">'.
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 {
$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.
$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>";
//counter for number of elements treated

@ -2,7 +2,8 @@
/* 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
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
@ -34,7 +35,6 @@ if (isset($_SESSION['lpobject'])) {
if (is_object($oLP)) {
$_SESSION['oLP'] = $oLP;
} else {
//error_log('New LP - in lp_nav.php - SESSION[lpobject] is not object - dying',0);
die('Could not instanciate lp object');
}
$display_mode = $_SESSION['oLP']->mode;
@ -62,13 +62,12 @@ if (isset($_SESSION['lpobject'])) {
session_write_close();
?>
<script type="text/javascript">
$(document).ready(function() {
jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer({
success: function(player, node) {
}
$(document).ready(function() {
jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer({
success: function(player, node) {
}
});
});
});
</script>
<span>
<?php echo (!empty($mediaplayer)) ? $mediaplayer : '&nbsp;' ?>

Loading…
Cancel
Save