original_string: public function jumpto_is_correct($pageid, $jumpto) {
          global $DB;
  
          // first test the special values
          if (!$jumpto) {
              // same page
              return false;
          } elseif ($jumpto == LESSON_NEXTPAGE) {
              return true;
          } elseif ($jumpto == LESSON_UNSEENBRANCHPAGE) {
              return true;
          } elseif ($jumpto == LESSON_RANDOMPAGE) {
              return true;
          } elseif ($jumpto == LESSON_CLUSTERJUMP) {
              return true;
          } elseif ($jumpto == LESSON_EOL) {
              return true;
          }
  
          $pages = $this->load_all_pages();
          $apageid = $pages[$pageid]->nextpageid;
          while ($apageid != 0) {
              if ($jumpto == $apageid) {
                  return true;
              }
              $apageid = $pages[$apageid]->nextpageid;
          }
          return false;
      }
code: public function jumpto_is_correct($pageid, $jumpto) {
          global $DB;
  
          // first test the special values
          if (!$jumpto) {
              // same page
              return false;
          } elseif ($jumpto == LESSON_NEXTPAGE) {
              return true;
          } elseif ($jumpto == LESSON_UNSEENBRANCHPAGE) {
              return true;
          } elseif ($jumpto == LESSON_RANDOMPAGE) {
              return true;
          } elseif ($jumpto == LESSON_CLUSTERJUMP) {
              return true;
          } elseif ($jumpto == LESSON_EOL) {
              return true;
          }
  
          $pages = $this->load_all_pages();
          $apageid = $pages[$pageid]->nextpageid;
          while ($apageid != 0) {
              if ($jumpto == $apageid) {
                  return true;
              }
              $apageid = $pages[$apageid]->nextpageid;
          }
          return false;
      }
code_tokens: public function jumpto_is_correct ( $ pageid , $ jumpto ) { global $ DB ; // first test the special values if ( ! $ jumpto ) { // same page return false ; } elseif ( $ jumpto == LESSON_NEXTPAGE ) { return true ; } elseif ( $ jumpto == LESSON_UNSEENBRANCHPAGE ) { return true ; } elseif ( $ jumpto == LESSON_RANDOMPAGE ) { return true ; } elseif ( $ jumpto == LESSON_CLUSTERJUMP ) { return true ; } elseif ( $ jumpto == LESSON_EOL ) { return true ; } $ pages = $ this -> load_all_pages ( ) ; $ apageid = $ pages [ $ pageid ] -> nextpageid ; while ( $ apageid != 0 ) { if ( $ jumpto == $ apageid ) { return true ; } $ apageid = $ pages [ $ apageid ] -> nextpageid ; } return false ; }
docstring: Determines if a jumpto value is correct or not.
  
  returns true if jumpto page is (logically) after the pageid page or
  if the jumpto value is a special value.  Returns false in all other cases.
  
  @param int $pageid Id of the page from which you are jumping from.
  @param int $jumpto The jumpto number.
  @return boolean True or false after a series of tests.
docstring_tokens: Determines if a jumpto value is correct or not .