diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index fcb3cf5cf4..7b45543c06 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -223,6 +223,7 @@ class learnpath { if ($this->debug > 2) { error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - query lp items: ' . $sql, 0); + error_log('-- Start while--', 0); } $lp_item_id_list = array(); @@ -263,7 +264,13 @@ class learnpath { break; case 1: default: + if ($this->debug > 2) { + error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - calling learnpathItem', 0); + } $oItem = new learnpathItem($row['id'], $user_id, $course_id, $row); + if ($this->debug > 2) { + error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - end calling learnpathItem', 0); + } if (is_object($oItem)) { $my_item_id = $oItem->get_id(); //$oItem->set_lp_view($this->lp_view_id); // Moved down to when we are sure the item_view exists. @@ -302,6 +309,10 @@ class learnpath { } } + if ($this->debug > 2) { + error_log('New LP - learnpath::__construct() ' . __LINE__ . ' ----- end while ----', 0); + } + if (!empty($lp_item_id_list)) { $lp_item_id_list_to_string = implode("','", $lp_item_id_list); @@ -2609,10 +2620,7 @@ class learnpath { } $toc = $varname.' = new Array();'; //echo "
".print_r($this->items,true)."
"; - foreach ($this->ordered_items as $item_id) { - if ($this->debug > 2) { - error_log('New LP - learnpath::get_items_details_as_js(): getting info for item ' . $item_id, 0); - } + foreach ($this->ordered_items as $item_id) { $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';"; } if ($this->debug > 2) { diff --git a/main/newscorm/learnpathItem.class.php b/main/newscorm/learnpathItem.class.php index 008dc22eb1..92b270225f 100644 --- a/main/newscorm/learnpathItem.class.php +++ b/main/newscorm/learnpathItem.class.php @@ -76,18 +76,15 @@ class learnpathItem { // Get items table. if (!isset($user_id)) { $user_id = api_get_user_id(); } if (self::debug > 0) { error_log("New LP - In learnpathItem constructor: id: $id user_id: $user_id course_id: $course_id item_content: $item_content", 0); } - - if (empty($course_id)) { - $course_id = api_get_course_int_id(); - } else { - $course_id = intval($course_id); - } - - $items_table = Database::get_course_table(TABLE_LP_ITEM); - $this->course_id = api_get_course_int_id(); $id = intval($id); if (empty($item_content)) { + $items_table = Database::get_course_table(TABLE_LP_ITEM); + if (empty($course_id)) { + $course_id = api_get_course_int_id(); + } else { + $course_id = intval($course_id); + } $sql = "SELECT * FROM $items_table WHERE c_id = $course_id AND id = $id"; //error_log('New LP - Creating item object from DB: '.$sql, 0); $res = Database::query($sql); @@ -1141,10 +1138,8 @@ class learnpathItem { * @return string The item type (can be doc, dir, sco, asset) */ public function get_type() { - $res = 'asset'; - if (self::debug > 0) { error_log('New LP - In learnpathItem::get_type() on item '.$this->db_id, 0); } - if (!empty($this->type)) { - //error_log('In item::get_type() - returning '.$this->type, 0); + $res = 'asset'; + if (!empty($this->type)) { $res = $this->type; } if (self::debug > 2) { error_log('New LP - In learnpathItem::get_type() - Returning '.$res.' for item '.$this->db_id, 0); } diff --git a/main/newscorm/lp_view.php b/main/newscorm/lp_view.php index 52516878d3..89cbdf0174 100644 --- a/main/newscorm/lp_view.php +++ b/main/newscorm/lp_view.php @@ -476,3 +476,7 @@ if (Database::num_rows($res_media) > 0) {