Knowing what is next?

Re: Knowing what is next?

by Chris Berri -
Number of replies: 0

I'm not sure about that.  Here is what I did..

in mod/lesson/view.php where the end of lesson button is printed I added this:

$test1=explode('}', $course->modinfo);
 //find out where in the course topic we are and what is next

 foreach($test1 as $test) {
    $line=explode('"', $test); 


//pos 5 is the id   //pos 13 is the section num.  //pos 9 is the module
if(($check)&&($line[13]==$section)) {
   //if another lesson ....    
 if($line[9]=='lesson') {
          $id2=$line[5];
          echo "<p align=\"center\"><a href=\"view.php?id=$id2&action=navigation\">Next  Lesson</a></p>"; exit;
    } 

//else, if a quiz..
     else if($line[9]=='quiz') {
          $id2=$line[5];
          echo "<p align=\"center\"><a href=\"../quiz/view.php?id=$id2\">Take this Module Assessment</a></p>"; exit; }
    }

//if what is next is the next topic, just give the main menu link.
    if(($check)&&($line[13]!=$section)) exit; 

//if we find our lesson, grab the section id and set the check for the next resource.    
    if($id==$line[5]) { 
        $check=true; $section=$line[13];
    }
} //close the foreach loop.