|
|
|
@ -1497,7 +1497,7 @@ class learnpath { |
|
|
|
|
error_log('New LP - In learnpath::get_total_items_count_without_chapters()', 0); |
|
|
|
|
} |
|
|
|
|
$total = 0; |
|
|
|
|
foreach ($this->items as $temp => $temp2) { |
|
|
|
|
foreach ($this->items as $temp2) { |
|
|
|
|
if (!in_array($temp2->get_type(), array ( |
|
|
|
|
'dokeos_chapter', |
|
|
|
|
'chapter', |
|
|
|
@ -1536,6 +1536,7 @@ class learnpath { |
|
|
|
|
!empty($this->items[$this->last_item_seen]) && |
|
|
|
|
$this->items[$this->last_item_seen]->get_type() != 'dir' && |
|
|
|
|
$this->items[$this->last_item_seen]->get_type() != 'dokeos_chapter' |
|
|
|
|
//with this change (below) the LP will NOT go to the next item, it will take lp item we left |
|
|
|
|
//&& !$this->items[$this->last_item_seen]->is_done() |
|
|
|
|
) { |
|
|
|
|
|
|
|
|
@ -2693,7 +2694,7 @@ class learnpath { |
|
|
|
|
* Uses the table generated by get_toc() and returns an HTML-formatted string ready to display |
|
|
|
|
* @return string HTML TOC ready to display |
|
|
|
|
*/ |
|
|
|
|
public function get_html_toc() { |
|
|
|
|
public function get_html_toc($toc_list = null) { |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
$course_code = api_get_course_id(); |
|
|
|
|
$is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
|
|
|
@ -2704,7 +2705,9 @@ class learnpath { |
|
|
|
|
if ($this->debug > 0) { |
|
|
|
|
error_log('New LP - In learnpath::get_html_toc()', 0); |
|
|
|
|
} |
|
|
|
|
$list = $this->get_toc(); |
|
|
|
|
if (empty($toc_list)) { |
|
|
|
|
$toc_list = $this->get_toc(); |
|
|
|
|
} |
|
|
|
|
//echo $this->current; |
|
|
|
|
//$parent = $this->items[$this->current]->get_parent(); |
|
|
|
|
//if (empty($parent)) { $parent = $this->ordered_items[$this->items[$this->current]->get_previous_index()]; } |
|
|
|
@ -2741,7 +2744,7 @@ class learnpath { |
|
|
|
|
$color_counter = 0; |
|
|
|
|
$i = 0; |
|
|
|
|
|
|
|
|
|
foreach ($list as $item) { |
|
|
|
|
foreach ($toc_list as $item) { |
|
|
|
|
if ($this->debug > 2) { |
|
|
|
|
//error_log('New LP - learnpath::get_html_toc(): using item ' . $item['id'], 0); |
|
|
|
|
} |
|
|
|
@ -2795,7 +2798,7 @@ class learnpath { |
|
|
|
|
$title = Security::remove_XSS($title); |
|
|
|
|
if ($item['type'] != 'dokeos_chapter' && $item['type'] != 'dir' && $item['type'] != 'dokeos_module') { |
|
|
|
|
//$html .= "<a href='lp_controller.php?".api_get_cidreq()."&action=content&lp_id=".$this->get_id()."&item_id=".$item['id']."' target='lp_content_frame_name'>".$title."</a>" ; |
|
|
|
|
$url = $this->get_link('http', $item['id'], $list); |
|
|
|
|
$url = $this->get_link('http', $item['id'], $toc_list); |
|
|
|
|
//$html .= '<a href="'.$url.'" target="content_name" onClick="top.load_item('.$item['id'].',\''.$url.'\');">'.$title.'</a>' ; |
|
|
|
|
//$html .= '<a href="" onClick="top.load_item('.$item['id'].',\''.$url.'\');return false;">'.$title.'</a>' ; |
|
|
|
|
|
|
|
|
@ -2902,7 +2905,7 @@ class learnpath { |
|
|
|
|
$item_id = $this->get_current_item_id(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (empty ($item_id)) { |
|
|
|
|
if (empty($item_id)) { |
|
|
|
|
if ($this->debug > 2) { |
|
|
|
|
error_log('New LP - In learnpath::get_link() - no current item id found in learnpath object', 0); |
|
|
|
|
} |
|
|
|
@ -2955,7 +2958,12 @@ class learnpath { |
|
|
|
|
if (in_array($lp_item_type, array('quiz', 'document', 'link', 'forum', 'thread', 'student_publication'))) { |
|
|
|
|
$lp_type = 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($this->debug > 2) { |
|
|
|
|
error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0); |
|
|
|
|
error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Now go through the specific cases to get the end of the path. |
|
|
|
|
|
|
|
|
|
// @todo Use constants instead of int values. |
|
|
|
@ -2965,8 +2973,9 @@ class learnpath { |
|
|
|
|
$file = 'lp_content.php?type=dir'; |
|
|
|
|
} else { |
|
|
|
|
require_once 'resourcelinker.inc.php'; |
|
|
|
|
$file = rl_get_resource_link_for_learnpath(api_get_course_id(), $this->get_id(), $item_id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$file = rl_get_resource_link_for_learnpath(api_get_course_id(), $this->get_id(), $item_id); |
|
|
|
|
|
|
|
|
|
if ($this->debug > 0) { |
|
|
|
|
error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0); |
|
|
|
|
} |
|
|
|
@ -2983,9 +2992,15 @@ class learnpath { |
|
|
|
|
$lp_view_id = $this->get_view_id(); |
|
|
|
|
$prevent_reinit = $this->items[$this->current]->get_prevent_reinit(); |
|
|
|
|
|
|
|
|
|
if (empty($provided_toc)) { |
|
|
|
|
if (empty($provided_toc)) { |
|
|
|
|
if ($this->debug > 0) { |
|
|
|
|
error_log('In learnpath::get_link() Loading get_toc ', 0); |
|
|
|
|
} |
|
|
|
|
$list = $this->get_toc(); |
|
|
|
|
} else { |
|
|
|
|
if ($this->debug > 0) { |
|
|
|
|
error_log('In learnpath::get_link() Loading get_toc from "cache" ', 0); |
|
|
|
|
} |
|
|
|
|
$list = $provided_toc; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|