diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php
index f01affff5a..13457dab14 100755
--- a/main/install/configuration.dist.php
+++ b/main/install/configuration.dist.php
@@ -399,6 +399,11 @@ ALTER TABLE c_tool CHANGE name name LONGTEXT NOT NULL;
-- Only with allow_portfolio_tool enabled
ALTER TABLE portfolio CHANGE title title LONGTEXT NOT NULL;
ALTER TABLE portfolio_category CHANGE title title LONGTEXT NOT NULL;
+
+New changes:
+
+ALTER TABLE c_lp CHANGE name name LONGTEXT NOT NULL;
+ALTER TABLE c_lp_item CHANGE title title LONGTEXT NOT NULL;
--
*/
// $_configuration['save_titles_as_html'] = false;
diff --git a/main/lp/learnpath.class.php b/main/lp/learnpath.class.php
index 9c565a6ac4..3befff3ca3 100755
--- a/main/lp/learnpath.class.php
+++ b/main/lp/learnpath.class.php
@@ -253,11 +253,6 @@ class learnpath
ORDER BY parent_item_id, display_order";
$res = Database::query($sql);
- if ($debug) {
- error_log('learnpath::__construct() '.__LINE__.' - query lp items: '.$sql);
- error_log('-- Start while--');
- }
-
$lp_item_id_list = [];
while ($row = Database::fetch_array($res)) {
$lp_item_id_list[] = $row['iid'];
@@ -342,10 +337,6 @@ class learnpath
}
}
- if ($debug) {
- error_log('learnpath::__construct() '.__LINE__.' ----- end while ----');
- }
-
if (!empty($lp_item_id_list)) {
$lp_item_id_list_to_string = implode("','", $lp_item_id_list);
if (!empty($lp_item_id_list_to_string)) {
@@ -359,14 +350,6 @@ class learnpath
lp_view_id = ".$this->lp_view_id." AND
lp_item_id IN ('".$lp_item_id_list_to_string."')
ORDER BY view_count DESC ";
-
- if ($debug) {
- error_log(
- 'learnpath::__construct() - Selecting item_views: '.$sql,
- 0
- );
- }
-
$status_list = [];
$res = Database::query($sql);
while ($row = Database:: fetch_array($res)) {
@@ -503,9 +486,6 @@ class learnpath
$userId = 0
) {
$course_id = $this->course_info['real_id'];
- if ($this->debug > 0) {
- error_log('In learnpath::add_item('.$parent.','.$previous.','.$type.','.$id.','.$title.')');
- }
if (empty($course_id)) {
// Sometimes Oogie doesn't catch the course info but sets $this->cc
$this->course_info = api_get_course_info($this->cc);
@@ -527,7 +507,7 @@ class learnpath
WHERE
c_id = $course_id AND
lp_id = ".$this->get_id()." AND
- parent_item_id = ".$parent;
+ parent_item_id = $parent ";
$res_count = Database::query($sql);
$row = Database::fetch_array($res_count);
@@ -618,9 +598,6 @@ class learnpath
$new_item_id = Database::insert($tbl_lp_item, $params);
if ($new_item_id) {
- if ($this->debug > 2) {
- error_log('Inserting dir/chapter: '.$new_item_id, 0);
- }
$sql = "UPDATE $tbl_lp_item SET id = iid WHERE iid = $new_item_id";
Database::query($sql);
@@ -3201,14 +3178,8 @@ class learnpath
*/
public function get_toc()
{
- if ($this->debug > 0) {
- error_log('learnpath::get_toc()', 0);
- }
$toc = [];
foreach ($this->ordered_items as $item_id) {
- if ($this->debug > 2) {
- error_log('learnpath::get_toc(): getting info for item '.$item_id, 0);
- }
// TODO: Change this link generation and use new function instead.
$toc[] = [
'id' => $item_id,
@@ -3221,9 +3192,6 @@ class learnpath
'parent' => $this->items[$item_id]->get_parent(),
];
}
- if ($this->debug > 2) {
- error_log('In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0);
- }
return $toc;
}
@@ -3452,7 +3420,7 @@ class learnpath
}
$dirTypes = self::getChapterTypes();
- $mycurrentitemid = $this->get_current_item_id();
+ $currentItemId = $this->get_current_item_id();
$list = [];
$classStatus = [
'not attempted' => 'scorm_not_attempted',
@@ -3496,7 +3464,7 @@ class learnpath
$subtree['title'] = $title;
$subtree['class'] = $classStyle.' '.$cssStatus;
$subtree['url'] = $this->get_link('http', $subtree['id'], $tree);
- $subtree['current_id'] = $mycurrentitemid;
+ $subtree['current_id'] = $currentItemId;
}
$list[] = $subtree;
}
@@ -3514,14 +3482,11 @@ class learnpath
*/
public function getListArrayToc($toc_list = [])
{
- if ($this->debug > 0) {
- error_log('In learnpath::get_html_toc()', 0);
- }
if (empty($toc_list)) {
$toc_list = $this->get_toc();
}
// Temporary variables.
- $mycurrentitemid = $this->get_current_item_id();
+ $currentItemId = $this->get_current_item_id();
$list = [];
$arrayList = [];
$classStatus = [
@@ -3585,7 +3550,7 @@ class learnpath
} else {
$list['title'] = stripslashes($title);
$list['url'] = $this->get_link('http', $item['id'], $toc_list);
- $list['current_id'] = $mycurrentitemid;
+ $list['current_id'] = $currentItemId;
}
$arrayList[] = $list;
}
@@ -6197,9 +6162,6 @@ class learnpath
*/
public function tree_array($array)
{
- if ($this->debug > 1) {
- error_log('In learnpath::tree_array()', 0);
- }
$array = $this->sort_tree_array($array);
$this->create_tree_array($array);
}
@@ -6354,34 +6316,7 @@ class learnpath
public function processBuildMenuElements($update_audio = 'false')
{
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
- $course_id = api_get_course_int_id();
- $table = Database::get_course_table(TABLE_LP_ITEM);
-
- $sql = "SELECT * FROM $table
- WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
-
- $result = Database::query($sql);
- $arrLP = [];
- while ($row = Database::fetch_array($result)) {
- $arrLP[] = [
- 'id' => $row['iid'],
- 'item_type' => $row['item_type'],
- 'title' => Security::remove_XSS($row['title']),
- 'path' => $row['path'],
- 'description' => Security::remove_XSS($row['description']),
- 'parent_item_id' => $row['parent_item_id'],
- 'previous_item_id' => $row['previous_item_id'],
- 'next_item_id' => $row['next_item_id'],
- 'max_score' => $row['max_score'],
- 'min_score' => $row['min_score'],
- 'mastery_score' => $row['mastery_score'],
- 'prerequisite' => $row['prerequisite'],
- 'display_order' => $row['display_order'],
- 'audio' => $row['audio'],
- 'prerequisite_max_score' => $row['prerequisite_max_score'],
- 'prerequisite_min_score' => $row['prerequisite_min_score'],
- ];
- }
+ $arrLP = $this->getItemsForForm();
$this->tree_array($arrLP);
$arrLP = isset($this->arrMenu) ? $this->arrMenu : [];
@@ -6812,7 +6747,6 @@ class learnpath
*/
public function return_new_tree($update_audio = 'false', $drop_element_here = false)
{
- $return = '';
$result = $this->processBuildMenuElements($update_audio);
$list = '