[svn r11290] Fix bug with navigation in LP in display mode

Fix bug with progression in LP
Fix other minor bugs
skala
Julian Prud'homme 18 years ago
parent c79ba9d207
commit 087fa0c146
  1. 37
      main/newscorm/learnpath.class.php
  2. 4
      main/newscorm/lp_comm.server.php

@ -1620,7 +1620,7 @@ class learnpath {
//if($this->items[$id]->status_is(array('completed','passed','succeeded'))){ //if($this->items[$id]->status_is(array('completed','passed','succeeded'))){
//Trying failed and browsed considered "progressed" as well //Trying failed and browsed considered "progressed" as well
if($this->items[$id]->status_is(array('completed','passed','succeeded','browsed','failed'))){ if($this->items[$id]->status_is(array('completed','passed','succeeded','browsed','failed'))&&$this->items[$id]->get_type()!='dokeos_chapter'&&$this->items[$id]->get_type()!='dir'){
$i++; $i++;
@ -1655,6 +1655,19 @@ class learnpath {
{ {
if($this->debug>0){error_log('New LP - In learnpath::get_total_items_count()',0);} if($this->debug>0){error_log('New LP - In learnpath::get_total_items_count()',0);}
return count($this->items); return count($this->items);
}
/**
* Gets the total number of items available for viewing in this SCORM but without chapters
* @return integer The total no-chapters number of items
*/
function get_total_items_count_without_chapters()
{
if($this->debug>0){error_log('New LP - In learnpath::get_total_items_count_without_chapters()',0);}
$total=0;
foreach($this->items as $temp=>$temp2){
if($temp2->get_type() != 'dokeos_chapter') $total++;
}
return $total;
} }
/** /**
* Gets the first element URL. * Gets the first element URL.
@ -1962,7 +1975,7 @@ class learnpath {
if($this->debug>2){error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]['type'],0);} if($this->debug>2){error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]['type'],0);}
while(!empty($this->ordered_items[$index]) AND $this->items[$this->ordered_items[$index]]->get_type() == 'dir' AND $index < $this->max_ordered_items) while(!empty($this->ordered_items[$index]) AND ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') AND $index < $this->max_ordered_items)
{ {
@ -2084,7 +2097,7 @@ class learnpath {
$index --; $index --;
while(isset($this->ordered_items[$index]) AND $this->items[$this->ordered_items[$index]]->get_type() == 'dir') while(isset($this->ordered_items[$index]) AND ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter'))
{ {
@ -2229,7 +2242,7 @@ class learnpath {
{ {
if($this->debug>0){error_log('New LP - In learnpath::get_progress_bar_text()',0);} if($this->debug>0){error_log('New LP - In learnpath::get_progress_bar_text()',0);}
if(empty($mode)){$mode = $this->progress_bar_mode;} if(empty($mode)){$mode = $this->progress_bar_mode;}
$total_items = $this->get_total_items_count(); $total_items = $this->get_total_items_count_without_chapters();
if($this->debug>2){error_log('New LP - Total items available in this learnpath: '.$total_items,0);} if($this->debug>2){error_log('New LP - Total items available in this learnpath: '.$total_items,0);}
$i = $this->get_complete_items_count(); $i = $this->get_complete_items_count();
if($this->debug>2){error_log('New LP - Items completed so far: '.$i,0);} if($this->debug>2){error_log('New LP - Items completed so far: '.$i,0);}
@ -5533,13 +5546,19 @@ function display_thread_form($action = 'add', $id = 0, $extra_info = '')
$explode = explode('.', $row['title']); $explode = explode('.', $row['title']);
for($i = 0; $i < count($explode) - 1; $i++) if(count($explode)>1){
$item_title .= $explode[$i]; for($i = 0; $i < count($explode) - 1; $i++)
$item_title .= $explode[$i];
}
else{
$item_title=$row['title'];
}
$item_title = str_replace('_', ' ', $item_title); $item_title = str_replace('_', ' ', $item_title);
if(empty($item_title)) if(empty($item_title))
{ {
$path_parts = pathinfo($row['path']); $path_parts = pathinfo($row['path']);
$item_title = stripslashes($path_parts['filename']); $item_title = stripslashes($path_parts['filename']);
} }

@ -130,7 +130,7 @@ function save_item($lp_id,$user_id,$view_id,$item_id,$score=-1,$max=-1,$min=-1,$
$mylp->save_item($item_id,false); $mylp->save_item($item_id,false);
$mytotal = $mylp->get_total_items_count(); $mytotal = $mylp->get_total_items_count_without_chapters();
$mycomplete = $mylp->get_complete_items_count(); $mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode(); $myprogress_mode = $mylp->get_progress_bar_mode();
$myprogress_mode = ($myprogress_mode==''?'%':$myprogress_mode); $myprogress_mode = ($myprogress_mode==''?'%':$myprogress_mode);
@ -291,7 +291,7 @@ function switch_item_details($lp_id,$user_id,$view_id,$current_item,$next_item)
* -lms_view_id * -lms_view_id
* -lms_user_id * -lms_user_id
*/ */
$mytotal = $mylp->get_total_items_count(); $mytotal = $mylp->get_total_items_count_without_chapters();
$mycomplete = $mylp->get_complete_items_count(); $mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode(); $myprogress_mode = $mylp->get_progress_bar_mode();
$myprogress_mode = ($myprogress_mode==''?'%':$myprogress_mode); $myprogress_mode = ($myprogress_mode==''?'%':$myprogress_mode);

Loading…
Cancel
Save