Forráskód Böngészése

[svn r11290] Fix bug with navigation in LP in display mode
Fix bug with progression in LP
Fix other minor bugs

Julian Prud'homme 18 éve
szülő
commit
087fa0c146
2 módosított fájl, 30 hozzáadás és 11 törlés
  1. 28 9
      main/newscorm/learnpath.class.php
  2. 2 2
      main/newscorm/lp_comm.server.php

+ 28 - 9
main/newscorm/learnpath.class.php

@@ -1620,7 +1620,7 @@ class learnpath {
 
     		//if($this->items[$id]->status_is(array('completed','passed','succeeded'))){
     		//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++;
 
@@ -1655,6 +1655,19 @@ class learnpath {
     {
 		if($this->debug>0){error_log('New LP - In learnpath::get_total_items_count()',0);}
     	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.
@@ -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);}
 
-    	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 --;
 
-	    	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(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);}
     	$i = $this->get_complete_items_count();
 		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']);
 			
-			for($i = 0; $i < count($explode) - 1; $i++)
-				$item_title .= $explode[$i];
+			if(count($explode)>1){
+				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))
-			{				
-				$path_parts = pathinfo($row['path']);
+			{
+				$path_parts = pathinfo($row['path']);
 				$item_title = stripslashes($path_parts['filename']);
 			}
 			

+ 2 - 2
main/newscorm/lp_comm.server.php

@@ -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);
 	
-	$mytotal = $mylp->get_total_items_count();
+	$mytotal = $mylp->get_total_items_count_without_chapters();
 	$mycomplete = $mylp->get_complete_items_count();
 	$myprogress_mode = $mylp->get_progress_bar_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_user_id
 	 */
-	$mytotal = $mylp->get_total_items_count();
+	$mytotal = $mylp->get_total_items_count_without_chapters();
 	$mycomplete = $mylp->get_complete_items_count();
 	$myprogress_mode = $mylp->get_progress_bar_mode();
 	$myprogress_mode = ($myprogress_mode==''?'%':$myprogress_mode);