original_string: public function repaginate_the_rest($quizslots, $slotfrom, $type, $dbupdate = true) {
          global $DB;
          if (!$quizslots) {
              return null;
          }
          $newslots = array();
          foreach ($quizslots as $slot) {
              if ($type == self::LINK) {
                  if ($slot->slot <= $slotfrom) {
                      continue;
                  }
                  $slot->page = $slot->page - 1;
              } else if ($type == self::UNLINK) {
                  if ($slot->slot <= $slotfrom - 1) {
                      continue;
                  }
                  $slot->page = $slot->page + 1;
              }
              // Update DB.
              if ($dbupdate) {
                  $DB->update_record('quiz_slots', $slot);
              }
              $newslots[$slot->id] = $slot;
          }
          return $newslots;
      }
code: public function repaginate_the_rest($quizslots, $slotfrom, $type, $dbupdate = true) {
          global $DB;
          if (!$quizslots) {
              return null;
          }
          $newslots = array();
          foreach ($quizslots as $slot) {
              if ($type == self::LINK) {
                  if ($slot->slot <= $slotfrom) {
                      continue;
                  }
                  $slot->page = $slot->page - 1;
              } else if ($type == self::UNLINK) {
                  if ($slot->slot <= $slotfrom - 1) {
                      continue;
                  }
                  $slot->page = $slot->page + 1;
              }
              // Update DB.
              if ($dbupdate) {
                  $DB->update_record('quiz_slots', $slot);
              }
              $newslots[$slot->id] = $slot;
          }
          return $newslots;
      }
code_tokens: public function repaginate_the_rest ( $ quizslots , $ slotfrom , $ type , $ dbupdate = true ) { global $ DB ; if ( ! $ quizslots ) { return null ; } $ newslots = array ( ) ; foreach ( $ quizslots as $ slot ) { if ( $ type == self :: LINK ) { if ( $ slot -> slot <= $ slotfrom ) { continue ; } $ slot -> page = $ slot -> page - 1 ; } else if ( $ type == self :: UNLINK ) { if ( $ slot -> slot <= $ slotfrom - 1 ) { continue ; } $ slot -> page = $ slot -> page + 1 ; } // Update DB. if ( $ dbupdate ) { $ DB -> update_record ( 'quiz_slots' , $ slot ) ; } $ newslots [ $ slot -> id ] = $ slot ; } return $ newslots ; }
docstring: Repaginate the rest.
  @param stdClass[] $quizslots
  @param int $slotfrom
  @param int $type
  @param bool $dbupdate
  @return stdClass[]
docstring_tokens: Repaginate the rest .