Minor - format code, remove error_log

pull/2958/head
Julio Montoya 6 years ago
parent 145878b774
commit 9bc8f47b22
  1. 2
      main/extra/myStudents.php
  2. 20
      main/inc/lib/events.lib.php
  3. 11
      main/lp/aicc.class.php
  4. 7
      main/lp/aicc_hacp.php
  5. 342
      main/lp/learnpath.class.php
  6. 231
      main/lp/learnpathItem.class.php
  7. 6
      main/lp/lp_list.php
  8. 1
      main/lp/lp_save.php
  9. 4
      main/lp/openoffice_document.class.php
  10. 3
      main/lp/openoffice_presentation.class.php
  11. 3
      main/lp/scormItem.class.php
  12. 62
      main/mySpace/myStudents.php
  13. 3
      main/template/default/learnpath/list.tpl

@ -188,7 +188,7 @@ $course_quiz_answer = 'quiz_answer';
$course_student_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION); $course_student_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$TABLECALHORAIRE = Database:: get_course_table(TABLE_CAL_HORAIRE); $TABLECALHORAIRE = Database:: get_course_table(TABLE_CAL_HORAIRE);
if (isset($_GET['user_id']) && $_GET['user_id'] != "") { if (isset($_GET['user_id']) && $_GET['user_id'] != '') {
$user_id = intval($_GET['user_id']); $user_id = intval($_GET['user_id']);
} else { } else {
$user_id = api_get_user_id(); $user_id = api_get_user_id();

@ -1171,17 +1171,11 @@ class Event
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
} }
$track_e_exercises = Database::get_main_table( $track_e_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
TABLE_STATISTIC_TRACK_E_EXERCISES $track_attempts = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
); $recording_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$track_attempts = Database::get_main_table(
TABLE_STATISTIC_TRACK_E_ATTEMPT
);
$recording_table = Database::get_main_table(
TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING
);
//Make sure we have the exact lp_view_id // Make sure we have the exact lp_view_id
$sql = "SELECT id FROM $lp_view_table $sql = "SELECT id FROM $lp_view_table
WHERE WHERE
c_id = $course_id AND c_id = $course_id AND
@ -1243,15 +1237,15 @@ class Event
if (!empty($exe_list) && is_array($exe_list) && count($exe_list) > 0) { if (!empty($exe_list) && is_array($exe_list) && count($exe_list) > 0) {
$exeListString = implode(',', $exe_list); $exeListString = implode(',', $exe_list);
$sql = "DELETE FROM $track_e_exercises $sql = "DELETE FROM $track_e_exercises
WHERE exe_id IN ($exeListString)"; WHERE exe_id IN ($exeListString)";
Database::query($sql); Database::query($sql);
$sql = "DELETE FROM $track_attempts $sql = "DELETE FROM $track_attempts
WHERE exe_id IN ($exeListString)"; WHERE exe_id IN ($exeListString)";
Database::query($sql); Database::query($sql);
$sql = "DELETE FROM $recording_table $sql = "DELETE FROM $recording_table
WHERE exe_id IN ($exeListString)"; WHERE exe_id IN ($exeListString)";
Database::query($sql); Database::query($sql);
} }

@ -72,10 +72,6 @@ class aicc extends learnpath
*/ */
public function open($id) public function open($id)
{ {
// Redefine parent method.
if ($this->debug > 0) {
error_log('In aicc::open()', 0);
}
} }
/** /**
@ -675,9 +671,6 @@ class aicc extends learnpath
public function set_author($author = '') public function set_author($author = '')
{ {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if ($this->debug > 0) {
error_log('In aicc::set_author('.$author.') method', 0);
}
$lp = $this->get_id(); $lp = $this->get_id();
if ($lp != 0) { if ($lp != 0) {
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN); $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
@ -686,9 +679,9 @@ class aicc extends learnpath
Database::query($sql); Database::query($sql);
return true; return true;
} else {
return false;
} }
return false;
} }
/** /**

@ -161,22 +161,18 @@ if (!empty($_REQUEST['command'])) {
break; break;
} }
} }
//error_log('In '.__FILE__.', '.__LINE__.' - aicc data is '.$hacp_aicc_data, 0);
// Treat the incoming request: // Treat the incoming request:
$aicc = new aicc(); $aicc = new aicc();
$msg_array = $aicc->parse_ini_string_quotes_safe($hacp_aicc_data, ['core_lesson', 'core_vendor']); $msg_array = $aicc->parse_ini_string_quotes_safe($hacp_aicc_data, ['core_lesson', 'core_vendor']);
//error_log('Message is now in this form: '.print_r($msg_array, true), 0);
foreach ($msg_array as $key => $dummy) { foreach ($msg_array as $key => $dummy) {
switch (strtolower($key)) { switch (strtolower($key)) {
case 'core': case 'core':
foreach ($msg_array[$key] as $subkey => $value) { foreach ($msg_array[$key] as $subkey => $value) {
switch (strtolower($subkey)) { switch (strtolower($subkey)) {
case 'lesson_location': case 'lesson_location':
//error_log('Setting lesson_location to '.$value, 0);
$oItem->set_lesson_location($value); $oItem->set_lesson_location($value);
break; break;
case 'lesson_status': case 'lesson_status':
//error_log('Setting lesson_status to '.$value, 0);
// Sometimes values are sent abbreviated // Sometimes values are sent abbreviated
switch ($value) { switch ($value) {
case 'C': case 'C':
@ -201,11 +197,9 @@ if (!empty($_REQUEST['command'])) {
$oItem->set_status($value); $oItem->set_status($value);
break; break;
case 'score': case 'score':
//error_log('Setting lesson_score to '.$value, 0);
$oItem->set_score($value); $oItem->set_score($value);
break; break;
case 'time': case 'time':
//error_log('Setting lesson_time to '.$value, 0);
if (strpos($value, ':') !== false) { if (strpos($value, ':') !== false) {
$oItem->set_time($value, 'scorm'); $oItem->set_time($value, 'scorm');
} else { } else {
@ -216,7 +210,6 @@ if (!empty($_REQUEST['command'])) {
} }
break; break;
case 'core_lesson': case 'core_lesson':
//error_log('Setting suspend_data to '.print_r($msg_array[$key], true), 0);
$oItem->current_data = $msg_array[$key]; $oItem->current_data = $msg_array[$key];
break; break;
case 'comments': case 'comments':

@ -356,7 +356,7 @@ class learnpath
FROM $itemViewTable FROM $itemViewTable
WHERE WHERE
c_id = $course_id AND c_id = $course_id AND
lp_view_id = ".$this->lp_view_id." AND lp_view_id = ".$this->get_view_id()." AND
lp_item_id IN ('".$lp_item_id_list_to_string."') lp_item_id IN ('".$lp_item_id_list_to_string."')
ORDER BY view_count DESC "; ORDER BY view_count DESC ";
@ -1604,7 +1604,7 @@ class learnpath
/** /**
* Gets all the chapters belonging to the same parent as the item/chapter given * Gets all the chapters belonging to the same parent as the item/chapter given
* Can also be called as abstract method. * Can also be called as abstract method.
* * @deprecated not used
* @param int $id Item ID * @param int $id Item ID
* *
* @return array A list of all the "brother items" (or an empty array on failure) * @return array A list of all the "brother items" (or an empty array on failure)
@ -1612,9 +1612,6 @@ class learnpath
public function getSiblingDirectories($id) public function getSiblingDirectories($id)
{ {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if ($this->debug > 0) {
error_log('In learnpath::getSiblingDirectories()', 0);
}
if (empty($id) || $id != strval(intval($id))) { if (empty($id) || $id != strval(intval($id))) {
return []; return [];
@ -1649,7 +1646,7 @@ class learnpath
/** /**
* Gets all the items belonging to the same parent as the item given * Gets all the items belonging to the same parent as the item given
* Can also be called as abstract method. * Can also be called as abstract method.
* * @deprecated not used
* @param int $id Item ID * @param int $id Item ID
* *
* @return array A list of all the "brother items" (or an empty array on failure) * @return array A list of all the "brother items" (or an empty array on failure)
@ -1657,9 +1654,6 @@ class learnpath
public function get_brother_items($id) public function get_brother_items($id)
{ {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if ($this->debug > 0) {
error_log('In learnpath::get_brother_items('.$id.')', 0);
}
if (empty($id) || $id != strval(intval($id))) { if (empty($id) || $id != strval(intval($id))) {
return []; return [];
@ -1722,9 +1716,6 @@ class learnpath
*/ */
public function get_complete_items_count($failedStatusException = false) public function get_complete_items_count($failedStatusException = false)
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_complete_items_count()', 0);
}
$i = 0; $i = 0;
$completedStatusList = [ $completedStatusList = [
'completed', 'completed',
@ -1757,14 +1748,8 @@ class learnpath
public function get_current_item_id() public function get_current_item_id()
{ {
$current = 0; $current = 0;
if ($this->debug > 0) {
error_log('In learnpath::get_current_item_id()', 0);
}
if (!empty($this->current)) { if (!empty($this->current)) {
$current = $this->current; $current = (int) $this->current;
}
if ($this->debug > 2) {
error_log('In learnpath::get_current_item_id() - Returning '.$current, 0);
} }
return $current; return $current;
@ -1792,10 +1777,6 @@ class learnpath
*/ */
public function get_total_items_count() public function get_total_items_count()
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_total_items_count()', 0);
}
return count($this->items); return count($this->items);
} }
@ -1806,9 +1787,6 @@ class learnpath
*/ */
public function getTotalItemsCountWithoutDirs() public function getTotalItemsCountWithoutDirs()
{ {
if ($this->debug > 0) {
error_log('In learnpath::getTotalItemsCountWithoutDirs()', 0);
}
$total = 0; $total = 0;
$typeListNotToCount = self::getChapterTypes(); $typeListNotToCount = self::getChapterTypes();
foreach ($this->items as $temp2) { foreach ($this->items as $temp2) {
@ -1912,7 +1890,7 @@ class learnpath
} }
$info = ''; $info = '';
$item_id = intval($item_id); $item_id = (int) $item_id;
if (!empty($item_id) && is_object($this->items[$item_id])) { if (!empty($item_id) && is_object($this->items[$item_id])) {
//if item is defined, return values from DB //if item is defined, return values from DB
@ -1975,10 +1953,10 @@ class learnpath
public function get_id() public function get_id()
{ {
if (!empty($this->lp_id)) { if (!empty($this->lp_id)) {
return $this->lp_id; return (int) $this->lp_id;
} else {
return 0;
} }
return 0;
} }
/** /**
@ -1988,10 +1966,7 @@ class learnpath
*/ */
public function get_last() public function get_last()
{ {
if ($this->debug > 0) { // This is just in case the lesson doesn't cointain a valid scheme, just to avoid "Notices"
error_log('In learnpath::get_last()', 0);
}
//This is just in case the lesson doesn't cointain a valid scheme, just to avoid "Notices"
if (count($this->ordered_items) > 0) { if (count($this->ordered_items) > 0) {
$this->index = count($this->ordered_items) - 1; $this->index = count($this->ordered_items) - 1;
@ -2030,9 +2005,6 @@ class learnpath
*/ */
public function get_navigation_bar($idBar = null, $display = null) public function get_navigation_bar($idBar = null, $display = null)
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_navigation_bar()', 0);
}
if (empty($idBar)) { if (empty($idBar)) {
$idBar = 'control-top'; $idBar = 'control-top';
} }
@ -2287,10 +2259,10 @@ class learnpath
} }
} }
} else { } else {
// There is no previous item.
if ($this->debug > 2) { if ($this->debug > 2) {
error_log('get_previous_index() - there was no previous index available, reusing '.$index, 0); error_log('get_previous_index() - there was no previous index available, reusing '.$index, 0);
} }
// There is no previous item.
} }
return $index; return $index;
@ -2303,9 +2275,6 @@ class learnpath
*/ */
public function get_previous_item_id() public function get_previous_item_id()
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_previous_item_id()', 0);
}
$new_index = $this->get_previous_index(); $new_index = $this->get_previous_index();
return $this->ordered_items[$new_index]; return $this->ordered_items[$new_index];
@ -2805,14 +2774,11 @@ class learnpath
*/ */
public function get_progress_bar_mode() public function get_progress_bar_mode()
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_progress_bar_mode()', 0);
}
if (!empty($this->progress_bar_mode)) { if (!empty($this->progress_bar_mode)) {
return $this->progress_bar_mode; return $this->progress_bar_mode;
} else {
return '%';
} }
return '%';
} }
/** /**
@ -2822,14 +2788,11 @@ class learnpath
*/ */
public function get_theme() public function get_theme()
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_theme()', 0);
}
if (!empty($this->theme)) { if (!empty($this->theme)) {
return $this->theme; return $this->theme;
} else {
return '';
} }
return '';
} }
/** /**
@ -2839,14 +2802,11 @@ class learnpath
*/ */
public function get_lp_session_id() public function get_lp_session_id()
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_lp_session_id()', 0);
}
if (!empty($this->lp_session_id)) { if (!empty($this->lp_session_id)) {
return (int) $this->lp_session_id; return (int) $this->lp_session_id;
} else {
return 0;
} }
return 0;
} }
/** /**
@ -2856,14 +2816,11 @@ class learnpath
*/ */
public function get_preview_image() public function get_preview_image()
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_preview_image()', 0);
}
if (!empty($this->preview_image)) { if (!empty($this->preview_image)) {
return $this->preview_image; return $this->preview_image;
} else {
return '';
} }
return '';
} }
/** /**
@ -2909,14 +2866,11 @@ class learnpath
*/ */
public function get_author() public function get_author()
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_author()', 0);
}
if (!empty($this->author)) { if (!empty($this->author)) {
return $this->author; return $this->author;
} else {
return '';
} }
return '';
} }
/** /**
@ -3053,9 +3007,6 @@ class learnpath
*/ */
public function get_items_status_list() public function get_items_status_list()
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_items_status_list()', 0);
}
$list = []; $list = [];
foreach ($this->ordered_items as $item_id) { foreach ($this->ordered_items as $item_id) {
$list[] = [ $list[] = [
@ -3245,9 +3196,6 @@ class learnpath
*/ */
public function get_toc() public function get_toc()
{ {
if ($this->debug > 0) {
error_log('learnpath::get_toc()', 0);
}
$toc = []; $toc = [];
foreach ($this->ordered_items as $item_id) { foreach ($this->ordered_items as $item_id) {
if ($this->debug > 2) { if ($this->debug > 2) {
@ -3282,16 +3230,10 @@ class learnpath
*/ */
public function get_items_details_as_js($varname = 'olms.lms_item_types') public function get_items_details_as_js($varname = 'olms.lms_item_types')
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_items_details_as_js()', 0);
}
$toc = $varname.' = new Array();'; $toc = $varname.' = new Array();';
foreach ($this->ordered_items as $item_id) { foreach ($this->ordered_items as $item_id) {
$toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';"; $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
} }
if ($this->debug > 2) {
error_log('In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0);
}
return $toc; return $toc;
} }
@ -3306,15 +3248,9 @@ class learnpath
public function get_type($get_name = false) public function get_type($get_name = false)
{ {
$res = false; $res = false;
if ($this->debug > 0) {
error_log('In learnpath::get_type()', 0);
}
if (!empty($this->type) && (!$get_name)) { if (!empty($this->type) && (!$get_name)) {
$res = $this->type; $res = $this->type;
} }
if ($this->debug > 2) {
error_log('In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0);
}
return $res; return $res;
} }
@ -3410,9 +3346,6 @@ class learnpath
*/ */
public function getParentToc($tree) public function getParentToc($tree)
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_html_toc()', 0);
}
if (empty($tree)) { if (empty($tree)) {
$tree = $this->get_toc(); $tree = $this->get_toc();
} }
@ -3488,9 +3421,6 @@ class learnpath
*/ */
public function getChildrenToc($tree, $id, $parent = true) public function getChildrenToc($tree, $id, $parent = true)
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_html_toc()', 0);
}
if (empty($tree)) { if (empty($tree)) {
$tree = $this->get_toc(); $tree = $this->get_toc();
} }
@ -3558,9 +3488,6 @@ class learnpath
*/ */
public function getListArrayToc($toc_list = []) public function getListArrayToc($toc_list = [])
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_html_toc()', 0);
}
if (empty($toc_list)) { if (empty($toc_list)) {
$toc_list = $this->get_toc(); $toc_list = $this->get_toc();
} }
@ -3673,16 +3600,14 @@ class learnpath
*/ */
public function get_maker() public function get_maker()
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_maker()', 0);
}
if (!empty($this->maker)) { if (!empty($this->maker)) {
return $this->maker; return $this->maker;
} else {
return '';
} }
return '';
} }
/** /**
* Gets the learnpath name/title. * Gets the learnpath name/title.
* *
@ -3690,14 +3615,11 @@ class learnpath
*/ */
public function get_name() public function get_name()
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_name()', 0);
}
if (!empty($this->name)) { if (!empty($this->name)) {
return $this->name; return $this->name;
} else {
return 'N/A';
} }
return 'N/A';
} }
/** /**
@ -4061,9 +3983,6 @@ class learnpath
*/ */
public function get_view($attempt_num = 0) public function get_view($attempt_num = 0)
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_view()', 0);
}
$search = ''; $search = '';
// Use $attempt_num to enable multi-views management (disabled so far). // Use $attempt_num to enable multi-views management (disabled so far).
if ($attempt_num != 0 && intval(strval($attempt_num)) == $attempt_num) { if ($attempt_num != 0 && intval(strval($attempt_num)) == $attempt_num) {
@ -4109,14 +4028,11 @@ class learnpath
*/ */
public function get_view_id() public function get_view_id()
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_view_id()', 0);
}
if (!empty($this->lp_view_id)) { if (!empty($this->lp_view_id)) {
return $this->lp_view_id; return (int) $this->lp_view_id;
} else {
return 0;
} }
return 0;
} }
/** /**
@ -4126,10 +4042,6 @@ class learnpath
*/ */
public function get_update_queue() public function get_update_queue()
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_update_queue()', 0);
}
return $this->update_queue; return $this->update_queue;
} }
@ -4140,14 +4052,10 @@ class learnpath
*/ */
public function get_user_id() public function get_user_id()
{ {
if ($this->debug > 0) {
error_log('In learnpath::get_user_id()', 0);
}
if (!empty($this->user_id)) { if (!empty($this->user_id)) {
return $this->user_id; return (int) $this->user_id;
} else {
return false;
} }
return false;
} }
/** /**
@ -4157,9 +4065,6 @@ class learnpath
*/ */
public function has_audio() public function has_audio()
{ {
if ($this->debug > 1) {
error_log('In learnpath::has_audio()', 0);
}
$has = false; $has = false;
foreach ($this->items as $i => $item) { foreach ($this->items as $i => $item) {
if (!empty($this->items[$i]->audio)) { if (!empty($this->items[$i]->audio)) {
@ -4595,9 +4500,6 @@ class learnpath
*/ */
public function previous() public function previous()
{ {
if ($this->debug > 0) {
error_log('In learnpath::previous()', 0);
}
$this->last = $this->get_current_item_id(); $this->last = $this->get_current_item_id();
$this->items[$this->last]->save( $this->items[$this->last]->save(
false, false,
@ -5167,7 +5069,7 @@ class learnpath
error_log('Saving current item ('.$this->current.') for later review', 0); error_log('Saving current item ('.$this->current.') for later review', 0);
} }
$sql = "UPDATE $table SET $sql = "UPDATE $table SET
last_item = ".intval($this->get_current_item_id())." last_item = ".$this->get_current_item_id()."
WHERE WHERE
c_id = $course_id AND c_id = $course_id AND
lp_id = ".$this->get_id()." AND lp_id = ".$this->get_id()." AND
@ -5192,9 +5094,6 @@ class learnpath
user_id = ".$this->get_user_id()." ".$session_condition; user_id = ".$this->get_user_id()." ".$session_condition;
// Ignore errors as some tables might not have the progress field just yet. // Ignore errors as some tables might not have the progress field just yet.
Database::query($sql); Database::query($sql);
if ($debug) {
error_log($sql);
}
$this->progress_db = $progress; $this->progress_db = $progress;
} }
} }
@ -5254,10 +5153,6 @@ class learnpath
*/ */
public function set_encoding($enc = 'UTF-8') public function set_encoding($enc = 'UTF-8')
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_encoding()', 0);
}
$enc = api_refine_encoding_id($enc); $enc = api_refine_encoding_id($enc);
if (empty($enc)) { if (empty($enc)) {
$enc = api_get_system_encoding(); $enc = api_get_system_encoding();
@ -5287,21 +5182,18 @@ class learnpath
*/ */
public function set_jslib($lib = '') public function set_jslib($lib = '')
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_jslib()', 0);
}
$lp = $this->get_id(); $lp = $this->get_id();
if ($lp != 0) { if ($lp != 0) {
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN); $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
$lib = Database::escape_string($lib);
$sql = "UPDATE $tbl_lp SET js_lib = '$lib' $sql = "UPDATE $tbl_lp SET js_lib = '$lib'
WHERE iid = $lp"; WHERE iid = $lp";
$res = Database::query($sql); $res = Database::query($sql);
return $res; return $res;
} else {
return false;
} }
return false;
} }
/** /**
@ -5313,9 +5205,6 @@ class learnpath
*/ */
public function set_maker($name = '') public function set_maker($name = '')
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_maker()', 0);
}
if (empty($name)) { if (empty($name)) {
return false; return false;
} }
@ -5325,9 +5214,6 @@ class learnpath
$sql = "UPDATE $table SET $sql = "UPDATE $table SET
content_maker = '".Database::escape_string($this->maker)."' content_maker = '".Database::escape_string($this->maker)."'
WHERE iid = $lp_id"; WHERE iid = $lp_id";
if ($this->debug > 2) {
error_log('lp updated with new content_maker : '.$this->maker, 0);
}
Database::query($sql); Database::query($sql);
return true; return true;
@ -5342,9 +5228,6 @@ class learnpath
*/ */
public function set_name($name = null) public function set_name($name = null)
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_name()', 0);
}
if (empty($name)) { if (empty($name)) {
return false; return false;
} }
@ -5355,9 +5238,6 @@ class learnpath
$sql = "UPDATE $lp_table SET $sql = "UPDATE $lp_table SET
name = '".Database::escape_string($this->name)."' name = '".Database::escape_string($this->name)."'
WHERE iid = $lp_id"; WHERE iid = $lp_id";
if ($this->debug > 2) {
error_log('lp updated with new name : '.$this->name, 0);
}
$result = Database::query($sql); $result = Database::query($sql);
// If the lp is visible on the homepage, change his name there. // If the lp is visible on the homepage, change his name there.
if (Database::affected_rows($result)) { if (Database::affected_rows($result)) {
@ -5372,9 +5252,9 @@ class learnpath
Database::query($sql); Database::query($sql);
return true; return true;
} else {
return false;
} }
return false;
} }
/** /**
@ -5464,18 +5344,12 @@ class learnpath
*/ */
public function set_theme($name = '') public function set_theme($name = '')
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_theme()', 0);
}
$this->theme = $name; $this->theme = $name;
$table = Database::get_course_table(TABLE_LP_MAIN); $table = Database::get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id(); $lp_id = $this->get_id();
$sql = "UPDATE $table $sql = "UPDATE $table
SET theme = '".Database::escape_string($this->theme)."' SET theme = '".Database::escape_string($this->theme)."'
WHERE iid = $lp_id"; WHERE iid = $lp_id";
if ($this->debug > 2) {
error_log('lp updated with new theme : '.$this->theme, 0);
}
Database::query($sql); Database::query($sql);
return true; return true;
@ -5490,19 +5364,12 @@ class learnpath
*/ */
public function set_preview_image($name = '') public function set_preview_image($name = '')
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_preview_image()', 0);
}
$this->preview_image = $name; $this->preview_image = $name;
$table = Database::get_course_table(TABLE_LP_MAIN); $table = Database::get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id(); $lp_id = $this->get_id();
$sql = "UPDATE $table SET $sql = "UPDATE $table SET
preview_image = '".Database::escape_string($this->preview_image)."' preview_image = '".Database::escape_string($this->preview_image)."'
WHERE iid = $lp_id"; WHERE iid = $lp_id";
if ($this->debug > 2) {
error_log('lp updated with new preview image : '.$this->preview_image, 0);
}
Database::query($sql); Database::query($sql);
return true; return true;
@ -5517,17 +5384,11 @@ class learnpath
*/ */
public function set_author($name = '') public function set_author($name = '')
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_author()', 0);
}
$this->author = $name; $this->author = $name;
$table = Database::get_course_table(TABLE_LP_MAIN); $table = Database::get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id(); $lp_id = $this->get_id();
$sql = "UPDATE $table SET author = '".Database::escape_string($name)."' $sql = "UPDATE $table SET author = '".Database::escape_string($name)."'
WHERE iid = $lp_id"; WHERE iid = $lp_id";
if ($this->debug > 2) {
error_log('lp updated with new preview author : '.$this->author, 0);
}
Database::query($sql); Database::query($sql);
return true; return true;
@ -5542,9 +5403,6 @@ class learnpath
*/ */
public function set_hide_toc_frame($hide) public function set_hide_toc_frame($hide)
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_hide_toc_frame()', 0);
}
if (intval($hide) == $hide) { if (intval($hide) == $hide) {
$this->hide_toc_frame = $hide; $this->hide_toc_frame = $hide;
$table = Database::get_course_table(TABLE_LP_MAIN); $table = Database::get_course_table(TABLE_LP_MAIN);
@ -5558,9 +5416,9 @@ class learnpath
Database::query($sql); Database::query($sql);
return true; return true;
} else {
return false;
} }
return false;
} }
/** /**
@ -5572,17 +5430,11 @@ class learnpath
*/ */
public function set_prerequisite($prerequisite) public function set_prerequisite($prerequisite)
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_prerequisite()', 0);
}
$this->prerequisite = (int) $prerequisite; $this->prerequisite = (int) $prerequisite;
$table = Database::get_course_table(TABLE_LP_MAIN); $table = Database::get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id(); $lp_id = $this->get_id();
$sql = "UPDATE $table SET prerequisite = '".$this->prerequisite."' $sql = "UPDATE $table SET prerequisite = '".$this->prerequisite."'
WHERE iid = $lp_id"; WHERE iid = $lp_id";
if ($this->debug > 2) {
error_log('lp updated with new preview requisite : '.$this->requisite, 0);
}
Database::query($sql); Database::query($sql);
return true; return true;
@ -5597,9 +5449,6 @@ class learnpath
*/ */
public function set_proximity($name = '') public function set_proximity($name = '')
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_proximity()', 0);
}
if (empty($name)) { if (empty($name)) {
return false; return false;
} }
@ -5610,9 +5459,6 @@ class learnpath
$sql = "UPDATE $table SET $sql = "UPDATE $table SET
content_local = '".Database::escape_string($name)."' content_local = '".Database::escape_string($name)."'
WHERE iid = $lp_id"; WHERE iid = $lp_id";
if ($this->debug > 2) {
error_log('lp updated with new proximity : '.$this->proximity, 0);
}
Database::query($sql); Database::query($sql);
return true; return true;
@ -5640,9 +5486,6 @@ class learnpath
*/ */
public function set_use_max_score($use_max_score = 1) public function set_use_max_score($use_max_score = 1)
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_use_max_score()', 0);
}
$use_max_score = (int) $use_max_score; $use_max_score = (int) $use_max_score;
$this->use_max_score = $use_max_score; $this->use_max_score = $use_max_score;
$table = Database::get_course_table(TABLE_LP_MAIN); $table = Database::get_course_table(TABLE_LP_MAIN);
@ -5650,10 +5493,6 @@ class learnpath
$sql = "UPDATE $table SET $sql = "UPDATE $table SET
use_max_score = '".$this->use_max_score."' use_max_score = '".$this->use_max_score."'
WHERE iid = $lp_id"; WHERE iid = $lp_id";
if ($this->debug > 2) {
error_log('lp updated with new use_max_score : '.$this->use_max_score, 0);
}
Database::query($sql); Database::query($sql);
return true; return true;
@ -5670,10 +5509,6 @@ class learnpath
*/ */
public function set_expired_on($expired_on) public function set_expired_on($expired_on)
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_expired_on()', 0);
}
$em = Database::getManager(); $em = Database::getManager();
/** @var CLp $lp */ /** @var CLp $lp */
$lp = $em $lp = $em
@ -5694,10 +5529,6 @@ class learnpath
$em->persist($lp); $em->persist($lp);
$em->flush(); $em->flush();
if ($this->debug > 2) {
error_log('lp updated with new expired_on : '.$this->expired_on, 0);
}
return true; return true;
} }
@ -5712,10 +5543,6 @@ class learnpath
*/ */
public function set_publicated_on($publicated_on) public function set_publicated_on($publicated_on)
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_expired_on()', 0);
}
$em = Database::getManager(); $em = Database::getManager();
/** @var CLp $lp */ /** @var CLp $lp */
$lp = $em $lp = $em
@ -5735,10 +5562,6 @@ class learnpath
$em->persist($lp); $em->persist($lp);
$em->flush(); $em->flush();
if ($this->debug > 2) {
error_log('lp updated with new publicated_on : '.$this->publicated_on, 0);
}
return true; return true;
} }
@ -5749,17 +5572,11 @@ class learnpath
*/ */
public function set_modified_on() public function set_modified_on()
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_expired_on()', 0);
}
$this->modified_on = api_get_utc_datetime(); $this->modified_on = api_get_utc_datetime();
$table = Database::get_course_table(TABLE_LP_MAIN); $table = Database::get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id(); $lp_id = $this->get_id();
$sql = "UPDATE $table SET modified_on = '".$this->modified_on."' $sql = "UPDATE $table SET modified_on = '".$this->modified_on."'
WHERE iid = $lp_id"; WHERE iid = $lp_id";
if ($this->debug > 2) {
error_log('lp updated with new expired_on : '.$this->modified_on, 0);
}
Database::query($sql); Database::query($sql);
return true; return true;
@ -5901,9 +5718,6 @@ class learnpath
*/ */
public function update_default_view_mode() public function update_default_view_mode()
{ {
if ($this->debug > 0) {
error_log('In learnpath::update_default_view_mode()', 0);
}
$table = Database::get_course_table(TABLE_LP_MAIN); $table = Database::get_course_table(TABLE_LP_MAIN);
$sql = "SELECT * FROM $table $sql = "SELECT * FROM $table
WHERE iid = ".$this->get_id(); WHERE iid = ".$this->get_id();
@ -5932,10 +5746,6 @@ class learnpath
$this->mode = $view_mode; $this->mode = $view_mode;
return $view_mode; return $view_mode;
} else {
if ($this->debug > 2) {
error_log('Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0);
}
} }
return -1; return -1;
@ -5948,9 +5758,6 @@ class learnpath
*/ */
public function update_default_scorm_commit() public function update_default_scorm_commit()
{ {
if ($this->debug > 0) {
error_log('In learnpath::update_default_scorm_commit()', 0);
}
$lp_table = Database::get_course_table(TABLE_LP_MAIN); $lp_table = Database::get_course_table(TABLE_LP_MAIN);
$sql = "SELECT * FROM $lp_table $sql = "SELECT * FROM $lp_table
WHERE iid = ".$this->get_id(); WHERE iid = ".$this->get_id();
@ -5971,10 +5778,6 @@ class learnpath
$this->force_commit = $force_return; $this->force_commit = $force_return;
return $force_return; return $force_return;
} else {
if ($this->debug > 2) {
error_log('Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0);
}
} }
return -1; return -1;
@ -6023,9 +5826,6 @@ class learnpath
*/ */
public function update_reinit() public function update_reinit()
{ {
if ($this->debug > 0) {
error_log('In learnpath::update_reinit()', 0);
}
$lp_table = Database::get_course_table(TABLE_LP_MAIN); $lp_table = Database::get_course_table(TABLE_LP_MAIN);
$sql = "SELECT * FROM $lp_table $sql = "SELECT * FROM $lp_table
WHERE iid = ".$this->get_id(); WHERE iid = ".$this->get_id();
@ -6044,10 +5844,6 @@ class learnpath
$this->prevent_reinit = $force; $this->prevent_reinit = $force;
return $force; return $force;
} else {
if ($this->debug > 2) {
error_log('Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0);
}
} }
return -1; return -1;
@ -6165,9 +5961,6 @@ class learnpath
*/ */
public function set_seriousgame_mode() public function set_seriousgame_mode()
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_seriousgame_mode()', 0);
}
$lp_table = Database::get_course_table(TABLE_LP_MAIN); $lp_table = Database::get_course_table(TABLE_LP_MAIN);
$sql = "SELECT * FROM $lp_table $sql = "SELECT * FROM $lp_table
WHERE iid = ".$this->get_id(); WHERE iid = ".$this->get_id();
@ -6186,10 +5979,6 @@ class learnpath
$this->seriousgame_mode = $force; $this->seriousgame_mode = $force;
return $force; return $force;
} else {
if ($this->debug > 2) {
error_log('Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0);
}
} }
return -1; return -1;
@ -6202,9 +5991,6 @@ class learnpath
*/ */
public function update_scorm_debug() public function update_scorm_debug()
{ {
if ($this->debug > 0) {
error_log('In learnpath::update_scorm_debug()', 0);
}
$lp_table = Database::get_course_table(TABLE_LP_MAIN); $lp_table = Database::get_course_table(TABLE_LP_MAIN);
$sql = "SELECT * FROM $lp_table $sql = "SELECT * FROM $lp_table
WHERE iid = ".$this->get_id(); WHERE iid = ".$this->get_id();
@ -6223,10 +6009,6 @@ class learnpath
$this->scorm_debug = $force; $this->scorm_debug = $force;
return $force; return $force;
} else {
if ($this->debug > 2) {
error_log('Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0);
}
} }
return -1; return -1;
@ -6241,9 +6023,6 @@ class learnpath
*/ */
public function tree_array($array) public function tree_array($array)
{ {
if ($this->debug > 1) {
error_log('In learnpath::tree_array()', 0);
}
$array = $this->sort_tree_array($array); $array = $this->sort_tree_array($array);
$this->create_tree_array($array); $this->create_tree_array($array);
} }
@ -6260,10 +6039,6 @@ class learnpath
*/ */
public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = []) public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = [])
{ {
if ($this->debug > 1) {
error_log('In learnpath::create_tree_array())', 0);
}
if (is_array($array)) { if (is_array($array)) {
for ($i = 0; $i < count($array); $i++) { for ($i = 0; $i < count($array); $i++) {
if ($array[$i]['parent_item_id'] == $parent) { if ($array[$i]['parent_item_id'] == $parent) {
@ -6336,10 +6111,6 @@ class learnpath
*/ */
public function overview() public function overview()
{ {
if ($this->debug > 0) {
error_log('In learnpath::overview()', 0);
}
$return = ''; $return = '';
$update_audio = isset($_GET['updateaudio']) ? $_GET['updateaudio'] : null; $update_audio = isset($_GET['updateaudio']) ? $_GET['updateaudio'] : null;
@ -7132,7 +6903,6 @@ class learnpath
$lp_name = $this->name; $lp_name = $this->name;
} }
$creatorId = empty($creatorId) ? api_get_user_id() : $creatorId; $creatorId = empty($creatorId) ? api_get_user_id() : $creatorId;
$folder = self::generate_learning_path_folder($course, $creatorId); $folder = self::generate_learning_path_folder($course, $creatorId);
// Limits title size // Limits title size
@ -7256,7 +7026,6 @@ class learnpath
// stripslashes() before calling api_replace_dangerous_char() because $_POST['title'] // stripslashes() before calling api_replace_dangerous_char() because $_POST['title']
// is already escaped twice when it gets here. // is already escaped twice when it gets here.
$originalTitle = !empty($title) ? $title : $_POST['title']; $originalTitle = !empty($title) ? $title : $_POST['title'];
if (!empty($title)) { if (!empty($title)) {
$title = api_replace_dangerous_char(stripslashes($title)); $title = api_replace_dangerous_char(stripslashes($title));
@ -7284,7 +7053,6 @@ class learnpath
); );
// Change the path of mp3 to absolute. // Change the path of mp3 to absolute.
// The first regexp deals with :// urls. // The first regexp deals with :// urls.
$content = preg_replace( $content = preg_replace(
"|(flashvars=\"file=)([^:/]+)/|", "|(flashvars=\"file=)([^:/]+)/|",
@ -11917,7 +11685,6 @@ class learnpath
$current_dir = str_replace('\\', '/', $current_dir); $current_dir = str_replace('\\', '/', $current_dir);
$file_path = realpath($current_dir.$doc_info[0]); $file_path = realpath($current_dir.$doc_info[0]);
$file_path = str_replace('\\', '/', $file_path); $file_path = str_replace('\\', '/', $file_path);
//error_log($file_path.' <-> '.$main_path, 0);
if (strstr($file_path, $main_path) !== false) { if (strstr($file_path, $main_path) !== false) {
// The calculated real path is really inside Chamilo's root path. // The calculated real path is really inside Chamilo's root path.
// Reduce file path to what's under the DocumentRoot. // Reduce file path to what's under the DocumentRoot.
@ -12439,9 +12206,6 @@ EOD;
public function select_previous_item_id() public function select_previous_item_id()
{ {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if ($this->debug > 0) {
error_log('In learnpath::select_previous_item_id()', 0);
}
$table_lp_item = Database::get_course_table(TABLE_LP_ITEM); $table_lp_item = Database::get_course_table(TABLE_LP_ITEM);
// Get the max order of the items // Get the max order of the items
@ -12532,17 +12296,14 @@ EOD;
public function clear_prerequisites() public function clear_prerequisites()
{ {
$course_id = $this->get_course_int_id(); $course_id = $this->get_course_int_id();
if ($this->debug > 0) {
error_log('In learnpath::clear_prerequisites()', 0);
}
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$lp_id = $this->get_id(); $lp_id = $this->get_id();
//Cleaning prerequisites // Cleaning prerequisites
$sql = "UPDATE $tbl_lp_item SET prerequisite = '' $sql = "UPDATE $tbl_lp_item SET prerequisite = ''
WHERE c_id = $course_id AND lp_id = $lp_id"; WHERE c_id = $course_id AND lp_id = $lp_id";
Database::query($sql); Database::query($sql);
//Cleaning mastery score for exercises // Cleaning mastery score for exercises
$sql = "UPDATE $tbl_lp_item SET mastery_score = '' $sql = "UPDATE $tbl_lp_item SET mastery_score = ''
WHERE c_id = $course_id AND lp_id = $lp_id AND item_type = 'quiz'"; WHERE c_id = $course_id AND lp_id = $lp_id AND item_type = 'quiz'";
Database::query($sql); Database::query($sql);
@ -12881,6 +12642,21 @@ EOD;
return false; return false;
} }
/**
* @return int
*/
public function getCurrentAttempt()
{
$attempt = $this->getItem($this->get_current_item_id());
if ($attempt) {
$attemptId = $attempt->get_attempt_id();
return $attemptId;
}
return 0;
}
/** /**
* @return int * @return int
*/ */
@ -12927,9 +12703,6 @@ EOD;
*/ */
public function setSubscribeUsers($value) public function setSubscribeUsers($value)
{ {
if ($this->debug > 0) {
error_log('In learnpath::set_subscribe_users()', 0);
}
$this->subscribeUsers = (int) $value; $this->subscribeUsers = (int) $value;
$table = Database::get_course_table(TABLE_LP_MAIN); $table = Database::get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id(); $lp_id = $this->get_id();
@ -13428,10 +13201,6 @@ EOD;
*/ */
public function isFirstOrLastItem($currentItemId) public function isFirstOrLastItem($currentItemId)
{ {
if ($this->debug > 0) {
error_log('In learnpath::isFirstOrLastItem('.$currentItemId.')', 0);
}
$lpItemId = []; $lpItemId = [];
$typeListNotToVerify = self::getChapterTypes(); $typeListNotToVerify = self::getChapterTypes();
@ -13483,9 +13252,6 @@ EOD;
*/ */
public function setAccumulateScormTime($value) public function setAccumulateScormTime($value)
{ {
if ($this->debug > 0) {
error_log('In learnpath::setAccumulateScormTime()', 0);
}
$this->accumulateScormTime = (int) $value; $this->accumulateScormTime = (int) $value;
$lp_table = Database::get_course_table(TABLE_LP_MAIN); $lp_table = Database::get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id(); $lp_id = $this->get_id();

@ -211,9 +211,6 @@ class learnpathItem
*/ */
public function add_child($item) public function add_child($item)
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::add_child()', 0);
}
if (!empty($item)) { if (!empty($item)) {
// Do not check in DB as we expect the call to come from the // Do not check in DB as we expect the call to come from the
// learnpath class which should be aware of any fake. // learnpath class which should be aware of any fake.
@ -302,9 +299,6 @@ class learnpathItem
$sql = "DELETE FROM $lp_item_view $sql = "DELETE FROM $lp_item_view
WHERE c_id = $course_id AND lp_item_id = ".$this->db_id; WHERE c_id = $course_id AND lp_item_id = ".$this->db_id;
if (self::DEBUG > 0) {
error_log('Deleting from lp_item_view: '.$sql, 0);
}
Database::query($sql); Database::query($sql);
$sql = "SELECT * FROM $lp_item $sql = "SELECT * FROM $lp_item
@ -317,9 +311,6 @@ class learnpathItem
$sql = "DELETE FROM $lp_item $sql = "DELETE FROM $lp_item
WHERE iid = ".$this->db_id; WHERE iid = ".$this->db_id;
Database::query($sql); Database::query($sql);
if (self::DEBUG > 0) {
error_log('Deleting from lp_item: '.$sql);
}
if (api_get_setting('search_enabled') == 'true') { if (api_get_setting('search_enabled') == 'true') {
if (!is_null($this->search_did)) { if (!is_null($this->search_did)) {
@ -338,9 +329,6 @@ class learnpathItem
*/ */
public function drop_child($item) public function drop_child($item)
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::drop_child()', 0);
}
if (!empty($item)) { if (!empty($item)) {
foreach ($this->children as $index => $child) { foreach ($this->children as $index => $child) {
if ($child == $item) { if ($child == $item) {
@ -357,23 +345,10 @@ class learnpathItem
*/ */
public function get_attempt_id() public function get_attempt_id()
{ {
if (self::DEBUG > 0) {
error_log(
'learnpathItem::get_attempt_id() on item '.$this->db_id,
0
);
}
$res = 1; $res = 1;
if (!empty($this->attempt_id)) { if (!empty($this->attempt_id)) {
$res = (int) $this->attempt_id; $res = (int) $this->attempt_id;
} }
if (self::DEBUG > 0) {
error_log(
'New LP - End of learnpathItem::get_attempt_id() on item '.
$this->db_id.' - Returning '.$res,
0
);
}
return $res; return $res;
} }
@ -385,9 +360,6 @@ class learnpathItem
*/ */
public function get_children() public function get_children()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_children()', 0);
}
$list = []; $list = [];
foreach ($this->children as $child) { foreach ($this->children as $child) {
if (!empty($child)) { if (!empty($child)) {
@ -459,14 +431,10 @@ class learnpathItem
*/ */
public function get_current_start_time() public function get_current_start_time()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_current_start_time()', 0);
}
if (empty($this->current_start_time)) { if (empty($this->current_start_time)) {
return time(); return time();
} else {
return $this->current_start_time;
} }
return $this->current_start_time;
} }
/** /**
@ -476,9 +444,6 @@ class learnpathItem
*/ */
public function get_description() public function get_description()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_description()', 0);
}
if (empty($this->description)) { if (empty($this->description)) {
return ''; return '';
} }
@ -551,9 +516,6 @@ class learnpathItem
*/ */
public function get_id() public function get_id()
{ {
if (self::DEBUG > 1) {
error_log('learnpathItem::get_id()', 0);
}
if (!empty($this->db_id)) { if (!empty($this->db_id)) {
return $this->db_id; return $this->db_id;
} }
@ -609,9 +571,6 @@ class learnpathItem
*/ */
public function get_interactions_count($checkdb = false) public function get_interactions_count($checkdb = false)
{ {
if (self::DEBUG > 1) {
error_log('learnpathItem::get_interactions_count()', 0);
}
$return = 0; $return = 0;
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -686,9 +645,6 @@ class learnpathItem
*/ */
public function get_objectives_count() public function get_objectives_count()
{ {
if (self::DEBUG > 1) {
error_log('learnpathItem::get_objectives_count()', 0);
}
$res = 0; $res = 0;
if (!empty($this->objectives_count)) { if (!empty($this->objectives_count)) {
$res = $this->objectives_count; $res = $this->objectives_count;
@ -706,9 +662,6 @@ class learnpathItem
*/ */
public function get_launch_data() public function get_launch_data()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_launch_data()', 0);
}
if (!empty($this->launch_data)) { if (!empty($this->launch_data)) {
return str_replace( return str_replace(
["\r", "\n", "'"], ["\r", "\n", "'"],
@ -728,9 +681,6 @@ class learnpathItem
*/ */
public function get_lesson_location() public function get_lesson_location()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_lesson_location()', 0);
}
if (!empty($this->lesson_location)) { if (!empty($this->lesson_location)) {
return str_replace( return str_replace(
["\r", "\n", "'"], ["\r", "\n", "'"],
@ -772,9 +722,6 @@ class learnpathItem
*/ */
public function get_level() public function get_level()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_level()', 0);
}
if (empty($this->level)) { if (empty($this->level)) {
return 0; return 0;
} }
@ -787,14 +734,11 @@ class learnpathItem
*/ */
public function get_mastery_score() public function get_mastery_score()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_mastery_score()', 0);
}
if (isset($this->mastery_score)) { if (isset($this->mastery_score)) {
return $this->mastery_score; return $this->mastery_score;
} else {
return -1;
} }
return -1;
} }
/** /**
@ -804,9 +748,6 @@ class learnpathItem
*/ */
public function get_max() public function get_max()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_max()', 0);
}
if ($this->type == 'sco') { if ($this->type == 'sco') {
if (isset($this->view_max_score) && if (isset($this->view_max_score) &&
!empty($this->view_max_score) && !empty($this->view_max_score) &&
@ -841,14 +782,11 @@ class learnpathItem
*/ */
public function get_max_time_allowed() public function get_max_time_allowed()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_max_time_allowed()', 0);
}
if (!empty($this->max_time_allowed)) { if (!empty($this->max_time_allowed)) {
return $this->max_time_allowed; return $this->max_time_allowed;
} else {
return '';
} }
return '';
} }
/** /**
@ -858,14 +796,11 @@ class learnpathItem
*/ */
public function get_min() public function get_min()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_min()', 0);
}
if (!empty($this->min_score)) { if (!empty($this->min_score)) {
return $this->min_score; return $this->min_score;
} else {
return 0;
} }
return 0;
} }
/** /**
@ -875,9 +810,6 @@ class learnpathItem
*/ */
public function get_parent() public function get_parent()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_parent()', 0);
}
if (!empty($this->parent)) { if (!empty($this->parent)) {
return $this->parent; return $this->parent;
} }
@ -892,9 +824,6 @@ class learnpathItem
*/ */
public function get_path() public function get_path()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_path()', 0);
}
if (empty($this->path)) { if (empty($this->path)) {
return ''; return '';
} }
@ -909,14 +838,11 @@ class learnpathItem
*/ */
public function get_prereq_string() public function get_prereq_string()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_prereq_string()', 0);
}
if (!empty($this->prereq_string)) { if (!empty($this->prereq_string)) {
return $this->prereq_string; return $this->prereq_string;
} else {
return '';
} }
return '';
} }
/** /**
@ -976,9 +902,6 @@ class learnpathItem
*/ */
public function get_seriousgame_mode() public function get_seriousgame_mode()
{ {
if (self::DEBUG > 2) {
error_log('learnpathItem::get_seriousgame_mode()', 0);
}
if (!isset($this->seriousgame_mode)) { if (!isset($this->seriousgame_mode)) {
if (!empty($this->lp_id)) { if (!empty($this->lp_id)) {
$table = Database::get_course_table(TABLE_LP_MAIN); $table = Database::get_course_table(TABLE_LP_MAIN);
@ -987,13 +910,7 @@ class learnpathItem
WHERE iid = ".$this->lp_id; WHERE iid = ".$this->lp_id;
$res = Database::query($sql); $res = Database::query($sql);
if (Database::num_rows($res) < 1) { if (Database::num_rows($res) < 1) {
$this->error = "Could not find parent learnpath in learnpath table"; $this->error = 'Could not find parent learnpath in learnpath table';
if (self::DEBUG > 2) {
error_log(
'New LP - End of learnpathItem::get_seriousgame_mode() - Returning false',
0
);
}
return false; return false;
} else { } else {
@ -1004,12 +921,6 @@ class learnpathItem
$this->seriousgame_mode = 0; //SeriousGame mode is always off by default $this->seriousgame_mode = 0; //SeriousGame mode is always off by default
} }
} }
if (self::DEBUG > 2) {
error_log(
'New LP - End of learnpathItem::get_seriousgame_mode() - Returned '.$this->seriousgame_mode,
0
);
}
return $this->seriousgame_mode; return $this->seriousgame_mode;
} }
@ -1563,19 +1474,10 @@ class learnpathItem
*/ */
public function get_score() public function get_score()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_score()', 0);
}
$res = 0; $res = 0;
if (!empty($this->current_score)) { if (!empty($this->current_score)) {
$res = $this->current_score; $res = $this->current_score;
} }
if (self::DEBUG > 1) {
error_log(
'New LP - Out of learnpathItem::get_score() - returning '.$res,
0
);
}
return $res; return $res;
} }
@ -1672,9 +1574,6 @@ class learnpathItem
*/ */
public function get_suspend_data() public function get_suspend_data()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_suspend_data()', 0);
}
// TODO: Improve cleaning of breaklines ... it works but is it really // TODO: Improve cleaning of breaklines ... it works but is it really
// a beautiful way to do it ? // a beautiful way to do it ?
if (!empty($this->current_data)) { if (!empty($this->current_data)) {
@ -1683,9 +1582,9 @@ class learnpathItem
['\r', '\n', "\\'"], ['\r', '\n', "\\'"],
$this->current_data $this->current_data
); );
} else {
return '';
} }
return '';
} }
/** /**
@ -1794,9 +1693,6 @@ class learnpathItem
*/ */
public function get_title() public function get_title()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_title()', 0);
}
if (empty($this->title)) { if (empty($this->title)) {
return ''; return '';
} }
@ -1958,12 +1854,6 @@ class learnpathItem
if (!empty($this->type)) { if (!empty($this->type)) {
$res = $this->type; $res = $this->type;
} }
if (self::DEBUG > 2) {
error_log(
'learnpathItem::get_type() - Returning '.$res.' for item '.$this->db_id,
0
);
}
return $res; return $res;
} }
@ -1975,14 +1865,11 @@ class learnpathItem
*/ */
public function get_view_count() public function get_view_count()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::get_view_count()', 0);
}
if (!empty($this->attempt_id)) { if (!empty($this->attempt_id)) {
return $this->attempt_id; return $this->attempt_id;
} else {
return 0;
} }
return 0;
} }
/** /**
@ -2032,9 +1919,6 @@ class learnpathItem
*/ */
public function isRestartAllowed() public function isRestartAllowed()
{ {
if (self::DEBUG > 2) {
error_log('learnpathItem::isRestartAllowed()', 0);
}
$restart = 1; $restart = 1;
$mystatus = $this->get_status(true); $mystatus = $this->get_status(true);
if ($this->get_prevent_reinit() > 0) { if ($this->get_prevent_reinit() > 0) {
@ -2106,9 +1990,6 @@ class learnpathItem
*/ */
public function output() public function output()
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::output()', 0);
}
if (!empty($this->path) and is_file($this->path)) { if (!empty($this->path) and is_file($this->path)) {
$output = ''; $output = '';
$output .= file_get_contents($this->path); $output .= file_get_contents($this->path);
@ -3071,9 +2952,6 @@ class learnpathItem
*/ */
public function set_attempt_id($num) public function set_attempt_id($num)
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::set_attempt_id()', 0);
}
if ($num == strval(intval($num)) && $num >= 0) { if ($num == strval(intval($num)) && $num >= 0) {
$this->attempt_id = $num; $this->attempt_id = $num;
@ -3112,9 +2990,6 @@ class learnpathItem
*/ */
public function set_description($string = '') public function set_description($string = '')
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::set_description()', 0);
}
if (!empty($string)) { if (!empty($string)) {
$this->description = $string; $this->description = $string;
} }
@ -3129,9 +3004,6 @@ class learnpathItem
*/ */
public function set_lesson_location($location) public function set_lesson_location($location)
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::set_lesson_location()', 0);
}
if (isset($location)) { if (isset($location)) {
$this->lesson_location = $location; $this->lesson_location = $location;
@ -3148,12 +3020,7 @@ class learnpathItem
*/ */
public function set_level($int = 0) public function set_level($int = 0)
{ {
if (self::DEBUG > 0) { $this->level = (int) $int;
error_log('learnpathItem::set_level('.$int.')', 0);
}
if (!empty($int) && $int == strval(intval($int))) {
$this->level = $int;
}
} }
/** /**
@ -3168,34 +3035,21 @@ class learnpathItem
*/ */
public function set_lp_view($lp_view_id, $course_id = null) public function set_lp_view($lp_view_id, $course_id = null)
{ {
$lp_view_id = intval($lp_view_id); $lp_view_id = (int) $lp_view_id;
$course_id = (int) $course_id;
if (empty($course_id)) { if (empty($course_id)) {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
} else {
$course_id = intval($course_id);
} }
$lpItemId = $this->get_id(); $lpItemId = $this->get_id();
if (empty($lpItemId)) { if (empty($lpItemId)) {
if (self::DEBUG > 0) {
error_log(
'learnpathItem::set_lp_view('.$lp_view_id.') $lpItemId is empty',
0
);
}
return false; return false;
} }
if (empty($lp_view_id)) { if (empty($lp_view_id)) {
if (self::DEBUG > 0) {
error_log(
'learnpathItem::set_lp_view('.$lp_view_id.') $lp_view_id is empty',
0
);
}
return false; return false;
} }
@ -3211,8 +3065,8 @@ class learnpathItem
$sql = "SELECT * FROM $item_view_table $sql = "SELECT * FROM $item_view_table
WHERE WHERE
c_id = $course_id AND c_id = $course_id AND
lp_item_id = ".$lpItemId." AND lp_item_id = $lpItemId AND
lp_view_id = ".$lp_view_id." lp_view_id = $lp_view_id
ORDER BY view_count DESC"; ORDER BY view_count DESC";
if (self::DEBUG > 2) { if (self::DEBUG > 2) {
@ -3262,19 +3116,13 @@ class learnpathItem
c_id = $course_id AND c_id = $course_id AND
lp_iv_id = '".$this->db_item_view_id."'"; lp_iv_id = '".$this->db_item_view_id."'";
$this->objectives_count = 0;
$res = Database::query($sql); $res = Database::query($sql);
if ($res !== false) { if ($res !== false) {
$this->objectives_count = Database::num_rows($res); $this->objectives_count = Database::num_rows($res);
} else {
$this->objectives_count = 0;
} }
} }
// End
if (self::DEBUG > 2) {
error_log('New LP - End of learnpathItem::set_lp_view()', 0);
}
return true; return true;
} }
@ -3285,9 +3133,6 @@ class learnpathItem
*/ */
public function set_path($string = '') public function set_path($string = '')
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::set_path()', 0);
}
if (!empty($string)) { if (!empty($string)) {
$this->path = $string; $this->path = $string;
} }
@ -3304,13 +3149,9 @@ class learnpathItem
*/ */
public function set_prevent_reinit($prevent) public function set_prevent_reinit($prevent)
{ {
if (self::DEBUG > 0) { $this->prevent_reinit = 0;
error_log('learnpathItem::set_prevent_reinit()', 0);
}
if ($prevent) { if ($prevent) {
$this->prevent_reinit = 1; $this->prevent_reinit = 1;
} else {
$this->prevent_reinit = 0;
} }
} }
@ -3370,19 +3211,8 @@ class learnpathItem
*/ */
public function set_max_score($score) public function set_max_score($score)
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::set_max_score('.$score.')', 0);
}
if (is_int($score) || $score == '') { if (is_int($score) || $score == '') {
$this->view_max_score = $score; $this->view_max_score = $score;
if (self::DEBUG > 1) {
error_log(
'learnpathItem::set_max_score() - '.
'Updated object score of item '.$this->db_id.
' to '.$this->view_max_score,
0
);
}
return true; return true;
} }
@ -3547,9 +3377,6 @@ class learnpathItem
*/ */
public function set_title($string = '') public function set_title($string = '')
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::set_title()', 0);
}
if (!empty($string)) { if (!empty($string)) {
$this->title = $string; $this->title = $string;
} }
@ -3562,9 +3389,6 @@ class learnpathItem
*/ */
public function set_type($string = '') public function set_type($string = '')
{ {
if (self::DEBUG > 0) {
error_log('learnpathItem::set_type()', 0);
}
if (!empty($string)) { if (!empty($string)) {
$this->type = $string; $this->type = $string;
} }
@ -4594,11 +4418,12 @@ class learnpathItem
public function getForumThread($lpCourseId, $lpSessionId = 0) public function getForumThread($lpCourseId, $lpSessionId = 0)
{ {
$lpSessionId = (int) $lpSessionId; $lpSessionId = (int) $lpSessionId;
$lpCourseId = (int) $lpCourseId;
$forumThreadTable = Database::get_course_table(TABLE_FORUM_THREAD); $forumThreadTable = Database::get_course_table(TABLE_FORUM_THREAD);
$itemProperty = Database::get_course_table(TABLE_ITEM_PROPERTY); $itemProperty = Database::get_course_table(TABLE_ITEM_PROPERTY);
$fakeFrom = "$forumThreadTable ft $fakeFrom = "$forumThreadTable ft INNER JOIN $itemProperty ip ";
INNER JOIN $itemProperty ip ";
if ($lpSessionId == 0) { if ($lpSessionId == 0) {
$fakeFrom .= " $fakeFrom .= "
@ -4624,7 +4449,7 @@ class learnpathItem
'ip.visibility != ? AND ' => 2, 'ip.visibility != ? AND ' => 2,
'ip.tool = ? AND ' => TOOL_FORUM_THREAD, 'ip.tool = ? AND ' => TOOL_FORUM_THREAD,
'ft.session_id = ? AND ' => $lpSessionId, 'ft.session_id = ? AND ' => $lpSessionId,
'ft.c_id = ? AND ' => intval($lpCourseId), 'ft.c_id = ? AND ' => $lpCourseId,
'(ft.lp_item_id = ? OR (ft.thread_title = ? AND ft.lp_item_id = ?))' => [ '(ft.lp_item_id = ? OR (ft.thread_title = ? AND ft.lp_item_id = ?))' => [
intval($this->db_id), intval($this->db_id),
"{$this->title} - {$this->db_id}", "{$this->title} - {$this->db_id}",
@ -4653,11 +4478,13 @@ class learnpathItem
{ {
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$currentForumId = (int) $currentForumId;
$em = Database::getManager(); $em = Database::getManager();
$threadRepo = $em->getRepository('ChamiloCourseBundle:CForumThread'); $threadRepo = $em->getRepository('ChamiloCourseBundle:CForumThread');
$forumThread = $threadRepo->findOneBy([ $forumThread = $threadRepo->findOneBy([
'threadTitle' => "{$this->title} - {$this->db_id}", 'threadTitle' => "{$this->title} - {$this->db_id}",
'forumId' => (int) $currentForumId, 'forumId' => $currentForumId,
]); ]);
if (!$forumThread) { if (!$forumThread) {
@ -4666,7 +4493,7 @@ class learnpathItem
store_thread( store_thread(
$forumInfo, $forumInfo,
[ [
'forum_id' => intval($currentForumId), 'forum_id' => $currentForumId,
'thread_id' => 0, 'thread_id' => 0,
'gradebook' => 0, 'gradebook' => 0,
'post_title' => "{$this->name} - {$this->db_id}", 'post_title' => "{$this->name} - {$this->db_id}",

@ -43,9 +43,6 @@ function confirmation(name) {
$nameTools = get_lang('LearningPaths'); $nameTools = get_lang('LearningPaths');
Event::event_access_tool(TOOL_LEARNPATH); Event::event_access_tool(TOOL_LEARNPATH);
/**
* Display.
*/
/* Require the search widget and prepare the header with its stuff. */ /* Require the search widget and prepare the header with its stuff. */
if (api_get_setting('search_enabled') === 'true') { if (api_get_setting('search_enabled') === 'true') {
require api_get_path(LIBRARY_PATH).'search/search_widget.php'; require api_get_path(LIBRARY_PATH).'search/search_widget.php';
@ -121,7 +118,6 @@ if ($is_allowed_to_edit) {
$token = Security::get_token(); $token = Security::get_token();
/* DISPLAY SCORM LIST */
$categoriesTempList = learnpath::getCategories(api_get_course_int_id()); $categoriesTempList = learnpath::getCategories(api_get_course_int_id());
$categoryTest = new CLpCategory(); $categoryTest = new CLpCategory();
$categoryTest->setId(0); $categoryTest->setId(0);
@ -693,7 +689,7 @@ foreach ($categories as $item) {
} }
/* DEBUG */ /* DEBUG */
if ($test_mode == 'test' || api_is_platform_admin()) { if ($test_mode === 'test' || api_is_platform_admin()) {
if ($details['lp_scorm_debug'] == 1) { if ($details['lp_scorm_debug'] == 1) {
$dsp_debug = Display::url( $dsp_debug = Display::url(
Display::return_icon( Display::return_icon(

@ -15,7 +15,6 @@ use ChamiloSession as Session;
* Initialization is to be done by lp_controller.php. * Initialization is to be done by lp_controller.php.
* Switching within the field to update. * Switching within the field to update.
*/ */
error_log('New LP - Loaded lp_save : '.$_SERVER['REQUEST_URI'].' from '.$_SERVER['HTTP_REFERER'], 0);
?> ?>
<!DOCTYPE html <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

@ -33,9 +33,6 @@ abstract class OpenofficeDocument extends learnpath
*/ */
public function __construct($course_code = null, $resource_id = null, $user_id = null) public function __construct($course_code = null, $resource_id = null, $user_id = null)
{ {
if ($this->debug > 0) {
error_log('In OpenofficeDocument::OpenofficeDocument()', 0);
}
if (!empty($course_code) && !empty($resource_id) && !empty($user_id)) { if (!empty($course_code) && !empty($resource_id) && !empty($user_id)) {
parent::__construct($course_code, $resource_id, $user_id); parent::__construct($course_code, $resource_id, $user_id);
} }
@ -378,7 +375,6 @@ abstract class OpenofficeDocument extends learnpath
]; ];
try { try {
//error_log('['.time().'] Calling wsConvertPpt webservice on ' . $ppt2lp_host);
$result = $client->__call('wsConvertPpt', ['pptData' => $params]); $result = $client->__call('wsConvertPpt', ['pptData' => $params]);
} catch (Exception $e) { } catch (Exception $e) {
error_log('['.time().'] Chamilo SOAP call error: '.$e->getMessage()); error_log('['.time().'] Chamilo SOAP call error: '.$e->getMessage());

@ -50,8 +50,6 @@ class OpenofficePresentation extends OpenofficeDocument
slide name (with accents) || file name (without accents) || all slide text (to be indexed). slide name (with accents) || file name (without accents) || all slide text (to be indexed).
*/ */
list($slide_name, $file_name, $slide_body) = explode('||', $file); list($slide_name, $file_name, $slide_body) = explode('||', $file);
//error_log('Treating '.$file_name.' from '.__FUNCTION__);
// Filename is utf8 encoded, but when we decode, some chars are not translated (like quote &rsquo;). // Filename is utf8 encoded, but when we decode, some chars are not translated (like quote &rsquo;).
// so we remove these chars by translating it in htmlentities and the reconvert it in want charset. // so we remove these chars by translating it in htmlentities and the reconvert it in want charset.
$slide_name = api_htmlentities($slide_name, ENT_COMPAT, $this->original_charset); $slide_name = api_htmlentities($slide_name, ENT_COMPAT, $this->original_charset);
@ -67,7 +65,6 @@ class OpenofficePresentation extends OpenofficeDocument
} }
if (!is_file($this->base_work_dir.$dir.$file_name) or filesize($this->base_work_dir.$dir.$file_name) == 0) { if (!is_file($this->base_work_dir.$dir.$file_name) or filesize($this->base_work_dir.$dir.$file_name) == 0) {
//error_log($this->base_work_dir.$dir.$file_name . ' is not a file or is 0');
continue; continue;
} }

@ -189,8 +189,5 @@ class scormItem extends learnpathItem
parent::save($from_outside, $prereqs_complete); parent::save($from_outside, $prereqs_complete);
// Under certain conditions, the scorm_contact should not be set, because no scorm signal was sent. // Under certain conditions, the scorm_contact should not be set, because no scorm signal was sent.
$this->scorm_contact = true; $this->scorm_contact = true;
if (!$this->scorm_contact) {
//error_log('New LP - was expecting SCORM message but none received', 0);
}
} }
} }

@ -112,46 +112,46 @@ if (!empty($details)) {
]; ];
} }
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => "../user/user.php?cidReq=".$course_code, 'url' => '../user/user.php?cidReq='.$course_code,
'name' => get_lang("Users"), 'name' => get_lang('Users'),
]; ];
} else { } else {
if ($origin === 'tracking_course') { if ($origin === 'tracking_course') {
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => "../tracking/courseLog.php?cidReq=".$course_code.'&id_session='.api_get_session_id(), 'url' => '../tracking/courseLog.php?cidReq='.$course_code.'&id_session='.api_get_session_id(),
'name' => get_lang("Tracking"), 'name' => get_lang('Tracking'),
]; ];
} else { } else {
if ($origin === 'resume_session') { if ($origin === 'resume_session') {
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => "../session/session_list.php", 'url' => '../session/session_list.php',
'name' => get_lang('SessionList'), 'name' => get_lang('SessionList'),
]; ];
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => "../session/resume_session.php?id_session=".$sessionId, 'url' => '../session/resume_session.php?id_session='.$sessionId,
'name' => get_lang('SessionOverview'), 'name' => get_lang('SessionOverview'),
]; ];
} else { } else {
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => api_is_student_boss() ? "#" : "index.php", 'url' => api_is_student_boss() ? '#' : 'index.php',
'name' => get_lang('MySpace'), 'name' => get_lang('MySpace'),
]; ];
if (!empty($coachId)) { if (!empty($coachId)) {
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => "student.php?id_coach=".$coachId, 'url' => 'student.php?id_coach='.$coachId,
'name' => get_lang("CoachStudents"), 'name' => get_lang('CoachStudents'),
]; ];
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => "myStudents.php?student=".$student_id.'&id_coach='.$coachId, 'url' => 'myStudents.php?student='.$student_id.'&id_coach='.$coachId,
'name' => get_lang("StudentDetails"), 'name' => get_lang('StudentDetails'),
]; ];
} else { } else {
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => "student.php", 'url' => 'student.php',
'name' => get_lang('MyStudents'), 'name' => get_lang('MyStudents'),
]; ];
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => "myStudents.php?student=".$student_id, 'url' => 'myStudents.php?student='.$student_id,
'name' => get_lang('StudentDetails'), 'name' => get_lang('StudentDetails'),
]; ];
} }
@ -167,36 +167,36 @@ if (!empty($details)) {
]; ];
if (!empty($sessionId)) { if (!empty($sessionId)) {
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => "../session/resume_session.php?id_session=".$sessionId, 'url' => '../session/resume_session.php?id_session='.$sessionId,
'name' => get_lang('SessionOverview'), 'name' => get_lang('SessionOverview'),
]; ];
} }
} elseif ($origin === 'teacher_details') { } elseif ($origin === 'teacher_details') {
$this_section = SECTION_TRACKING; $this_section = SECTION_TRACKING;
$interbreadcrumb[] = ['url' => "index.php", 'name' => get_lang('MySpace')]; $interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('MySpace')];
$interbreadcrumb[] = ['url' => "teachers.php", 'name' => get_lang('Teachers')]; $interbreadcrumb[] = ['url' => 'teachers.php', 'name' => get_lang('Teachers')];
$nameTools = $user_info['complete_name']; $nameTools = $user_info['complete_name'];
} else { } else {
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => api_is_student_boss() ? "#" : "index.php", 'url' => api_is_student_boss() ? '#' : 'index.php',
'name' => get_lang('MySpace'), 'name' => get_lang('MySpace'),
]; ];
if (!empty($coachId)) { if (!empty($coachId)) {
if ($sessionId) { if ($sessionId) {
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => "student.php?id_coach=".$coachId."&id_session=".$sessionId, 'url' => 'student.php?id_coach='.$coachId.'&id_session='.$sessionId,
'name' => get_lang("CoachStudents"), 'name' => get_lang('CoachStudents'),
]; ];
} else { } else {
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => "student.php?id_coach=".$coachId, 'url' => 'student.php?id_coach='.$coachId,
'name' => get_lang("CoachStudents"), 'name' => get_lang('CoachStudents'),
]; ];
} }
} else { } else {
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => "student.php", 'url' => 'student.php',
'name' => get_lang("MyStudents"), 'name' => get_lang('MyStudents'),
]; ];
} }
} }
@ -516,12 +516,12 @@ switch ($action) {
} }
break; break;
case 'reset_lp': case 'reset_lp':
$lp_id = isset($_GET['lp_id']) ? intval($_GET['lp_id']) : ''; $lp_id = isset($_GET['lp_id']) ? (int) $_GET['lp_id'] : '';
$check = true; $check = true;
if (api_is_allowed_to_edit() && if (!empty($lp_id) &&
!empty($lp_id) &&
!empty($student_id) && !empty($student_id) &&
api_is_allowed_to_edit() &&
Security::check_token('get') Security::check_token('get')
) { ) {
Event::delete_student_lp_events( Event::delete_student_lp_events(
@ -533,9 +533,7 @@ switch ($action) {
// @todo delete the stats.track_e_exercises records. // @todo delete the stats.track_e_exercises records.
// First implement this http://support.chamilo.org/issues/1334 // First implement this http://support.chamilo.org/issues/1334
Display::addFlash( Display::addFlash(Display::return_message(get_lang('LPWasReset'), 'success'));
Display::return_message(get_lang('LPWasReset'), 'success')
);
Security::clear_token(); Security::clear_token();
} }
break; break;
@ -898,7 +896,7 @@ $userInfo['student_score'] = $score;
$userInfo['student_progress'] = $avg_student_progress; $userInfo['student_progress'] = $avg_student_progress;
$userInfo['first_connection'] = $first_connection_date; $userInfo['first_connection'] = $first_connection_date;
$userInfo['last_connection'] = $last_connection_date; $userInfo['last_connection'] = $last_connection_date;
if ($details == 'true') { if ($details === 'true') {
$userInfo['time_spent_course'] = $time_spent_on_the_course; $userInfo['time_spent_course'] = $time_spent_on_the_course;
} }
@ -1107,8 +1105,7 @@ if (empty($details)) {
if (empty($session_info)) { if (empty($session_info)) {
$isSubscribed = CourseManager::is_user_subscribed_in_course( $isSubscribed = CourseManager::is_user_subscribed_in_course(
$student_id, $student_id,
$courseCodeItem, $courseCodeItem
false
); );
} else { } else {
$isSubscribed = CourseManager::is_user_subscribed_in_course( $isSubscribed = CourseManager::is_user_subscribed_in_course(
@ -1420,7 +1417,6 @@ if (empty($details)) {
foreach ($flat_list as $learnpath) { foreach ($flat_list as $learnpath) {
$lpIdList[] = $learnpath['iid']; $lpIdList[] = $learnpath['iid'];
$lp_id = $learnpath['lp_old_id']; $lp_id = $learnpath['lp_old_id'];
$lp_name = $learnpath['lp_name']; $lp_name = $learnpath['lp_name'];
$any_result = false; $any_result = false;

@ -398,7 +398,6 @@
role="tabpanel" aria-labelledby="heading-{{ lp_data.category.getId() }}"> role="tabpanel" aria-labelledby="heading-{{ lp_data.category.getId() }}">
<div class="panel-body"> <div class="panel-body">
{% if lp_data.lp_list %} {% if lp_data.lp_list %}
{% if is_allowed_to_edit %} {% if is_allowed_to_edit %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-hover table-striped"> <table class="table table-hover table-striped">
@ -449,7 +448,6 @@
</td> </td>
{% endif %} {% endif %}
{% endif %} {% endif %}
<td> <td>
{{ row.action_build }} {{ row.action_build }}
{{ row.action_edit }} {{ row.action_edit }}
@ -500,7 +498,6 @@
</div> </div>
</div> </div>
</div> </div>
{% endif %} {% endif %}
<!-- end view block accordeon --> <!-- end view block accordeon -->
{% endif %} {% endif %}

Loading…
Cancel
Save