original_string: public function refresh_page_numbers_and_update_db() {
          global $DB;
          $this->check_can_be_edited();
  
          $slots = $this->refresh_page_numbers();
  
          // Record new page order.
          foreach ($slots as $slot) {
              $DB->set_field('quiz_slots', 'page', $slot->page,
                      array('id' => $slot->id));
          }
  
          return $slots;
      }
code: public function refresh_page_numbers_and_update_db() {
          global $DB;
          $this->check_can_be_edited();
  
          $slots = $this->refresh_page_numbers();
  
          // Record new page order.
          foreach ($slots as $slot) {
              $DB->set_field('quiz_slots', 'page', $slot->page,
                      array('id' => $slot->id));
          }
  
          return $slots;
      }
code_tokens: public function refresh_page_numbers_and_update_db ( ) { global $ DB ; $ this -> check_can_be_edited ( ) ; $ slots = $ this -> refresh_page_numbers ( ) ; // Record new page order. foreach ( $ slots as $ slot ) { $ DB -> set_field ( 'quiz_slots' , 'page' , $ slot -> page , array ( 'id' => $ slot -> id ) ) ; } return $ slots ; }
docstring: Refresh page numbering of quiz slots and save to the database.
  @param \stdClass $quiz the quiz object.
  @return \stdClass[] array of slot objects.
docstring_tokens: Refresh page numbering of quiz slots and save to the database .