original_string: public static function get_attempt_review($attemptid, $page = -1) {
          global $PAGE;
  
          $warnings = array();
  
          $params = array(
              'attemptid' => $attemptid,
              'page' => $page,
          );
          $params = self::validate_parameters(self::get_attempt_review_parameters(), $params);
  
          list($attemptobj, $displayoptions) = self::validate_attempt_review($params);
  
          if ($params['page'] !== -1) {
              $page = $attemptobj->force_page_number_into_range($params['page']);
          } else {
              $page = 'all';
          }
  
          // Prepare the output.
          $result = array();
          $result['attempt'] = $attemptobj->get_attempt();
          $result['questions'] = self::get_attempt_questions_data($attemptobj, true, $page, true);
  
          $result['additionaldata'] = array();
          // Summary data (from behaviours).
          $summarydata = $attemptobj->get_additional_summary_data($displayoptions);
          foreach ($summarydata as $key => $data) {
              // This text does not need formatting (no need for external_format_[string|text]).
              $result['additionaldata'][] = array(
                  'id' => $key,
                  'title' => $data['title'], $attemptobj->get_quizobj()->get_context()->id,
                  'content' => $data['content'],
              );
          }
  
          // Feedback if there is any, and the user is allowed to see it now.
          $grade = quiz_rescale_grade($attemptobj->get_attempt()->sumgrades, $attemptobj->get_quiz(), false);
  
          $feedback = $attemptobj->get_overall_feedback($grade);
          if ($displayoptions->overallfeedback && $feedback) {
              $result['additionaldata'][] = array(
                  'id' => 'feedback',
                  'title' => get_string('feedback', 'quiz'),
                  'content' => $feedback,
              );
          }
  
          $result['grade'] = $grade;
          $result['warnings'] = $warnings;
          return $result;
      }
code: public static function get_attempt_review($attemptid, $page = -1) {
          global $PAGE;
  
          $warnings = array();
  
          $params = array(
              'attemptid' => $attemptid,
              'page' => $page,
          );
          $params = self::validate_parameters(self::get_attempt_review_parameters(), $params);
  
          list($attemptobj, $displayoptions) = self::validate_attempt_review($params);
  
          if ($params['page'] !== -1) {
              $page = $attemptobj->force_page_number_into_range($params['page']);
          } else {
              $page = 'all';
          }
  
          // Prepare the output.
          $result = array();
          $result['attempt'] = $attemptobj->get_attempt();
          $result['questions'] = self::get_attempt_questions_data($attemptobj, true, $page, true);
  
          $result['additionaldata'] = array();
          // Summary data (from behaviours).
          $summarydata = $attemptobj->get_additional_summary_data($displayoptions);
          foreach ($summarydata as $key => $data) {
              // This text does not need formatting (no need for external_format_[string|text]).
              $result['additionaldata'][] = array(
                  'id' => $key,
                  'title' => $data['title'], $attemptobj->get_quizobj()->get_context()->id,
                  'content' => $data['content'],
              );
          }
  
          // Feedback if there is any, and the user is allowed to see it now.
          $grade = quiz_rescale_grade($attemptobj->get_attempt()->sumgrades, $attemptobj->get_quiz(), false);
  
          $feedback = $attemptobj->get_overall_feedback($grade);
          if ($displayoptions->overallfeedback && $feedback) {
              $result['additionaldata'][] = array(
                  'id' => 'feedback',
                  'title' => get_string('feedback', 'quiz'),
                  'content' => $feedback,
              );
          }
  
          $result['grade'] = $grade;
          $result['warnings'] = $warnings;
          return $result;
      }
code_tokens: public static function get_attempt_review ( $ attemptid , $ page = - 1 ) { global $ PAGE ; $ warnings = array ( ) ; $ params = array ( 'attemptid' => $ attemptid , 'page' => $ page , ) ; $ params = self :: validate_parameters ( self :: get_attempt_review_parameters ( ) , $ params ) ; list ( $ attemptobj , $ displayoptions ) = self :: validate_attempt_review ( $ params ) ; if ( $ params [ 'page' ] !== - 1 ) { $ page = $ attemptobj -> force_page_number_into_range ( $ params [ 'page' ] ) ; } else { $ page = 'all' ; } // Prepare the output. $ result = array ( ) ; $ result [ 'attempt' ] = $ attemptobj -> get_attempt ( ) ; $ result [ 'questions' ] = self :: get_attempt_questions_data ( $ attemptobj , true , $ page , true ) ; $ result [ 'additionaldata' ] = array ( ) ; // Summary data (from behaviours). $ summarydata = $ attemptobj -> get_additional_summary_data ( $ displayoptions ) ; foreach ( $ summarydata as $ key => $ data ) { // This text does not need formatting (no need for external_format_[string|text]). $ result [ 'additionaldata' ] [ ] = array ( 'id' => $ key , 'title' => $ data [ 'title' ] , $ attemptobj -> get_quizobj ( ) -> get_context ( ) -> id , 'content' => $ data [ 'content' ] , ) ; } // Feedback if there is any, and the user is allowed to see it now. $ grade = quiz_rescale_grade ( $ attemptobj -> get_attempt ( ) -> sumgrades , $ attemptobj -> get_quiz ( ) , false ) ; $ feedback = $ attemptobj -> get_overall_feedback ( $ grade ) ; if ( $ displayoptions -> overallfeedback && $ feedback ) { $ result [ 'additionaldata' ] [ ] = array ( 'id' => 'feedback' , 'title' => get_string ( 'feedback' , 'quiz' ) , 'content' => $ feedback , ) ; } $ result [ 'grade' ] = $ grade ; $ result [ 'warnings' ] = $ warnings ; return $ result ; }
docstring: Returns review information for the given finished attempt, can be used by users or teachers.
  
  @param int $attemptid attempt id
  @param int $page page number, empty for all the questions in all the pages
  @return array of warnings and the attempt data, feedback and questions
  @since Moodle 3.1
  @throws  moodle_exception
  @throws  moodle_quiz_exception
docstring_tokens: Returns review information for the given finished attempt can be used by users or teachers .