original_string: public static function get_combined_review_options($quizid, $userid = 0) {
          global $DB, $USER;
  
          $warnings = array();
  
          $params = array(
              'quizid' => $quizid,
              'userid' => $userid,
          );
          $params = self::validate_parameters(self::get_combined_review_options_parameters(), $params);
  
          list($quiz, $course, $cm, $context) = self::validate_quiz($params['quizid']);
  
          // Default value for userid.
          if (empty($params['userid'])) {
              $params['userid'] = $USER->id;
          }
  
          $user = core_user::get_user($params['userid'], '*', MUST_EXIST);
          core_user::require_active_user($user);
  
          // Extra checks so only users with permissions can view other users attempts.
          if ($USER->id != $user->id) {
              require_capability('mod/quiz:viewreports', $context);
          }
  
          $attempts = quiz_get_user_attempts($quiz->id, $user->id, 'all', true);
  
          $result = array();
          $result['someoptions'] = [];
          $result['alloptions'] = [];
  
          list($someoptions, $alloptions) = quiz_get_combined_reviewoptions($quiz, $attempts);
  
          foreach (array('someoptions', 'alloptions') as $typeofoption) {
              foreach ($$typeofoption as $key => $value) {
                  $result[$typeofoption][] = array(
                      "name" => $key,
                      "value" => (!empty($value)) ? $value : 0
                  );
              }
          }
  
          $result['warnings'] = $warnings;
          return $result;
      }
code: public static function get_combined_review_options($quizid, $userid = 0) {
          global $DB, $USER;
  
          $warnings = array();
  
          $params = array(
              'quizid' => $quizid,
              'userid' => $userid,
          );
          $params = self::validate_parameters(self::get_combined_review_options_parameters(), $params);
  
          list($quiz, $course, $cm, $context) = self::validate_quiz($params['quizid']);
  
          // Default value for userid.
          if (empty($params['userid'])) {
              $params['userid'] = $USER->id;
          }
  
          $user = core_user::get_user($params['userid'], '*', MUST_EXIST);
          core_user::require_active_user($user);
  
          // Extra checks so only users with permissions can view other users attempts.
          if ($USER->id != $user->id) {
              require_capability('mod/quiz:viewreports', $context);
          }
  
          $attempts = quiz_get_user_attempts($quiz->id, $user->id, 'all', true);
  
          $result = array();
          $result['someoptions'] = [];
          $result['alloptions'] = [];
  
          list($someoptions, $alloptions) = quiz_get_combined_reviewoptions($quiz, $attempts);
  
          foreach (array('someoptions', 'alloptions') as $typeofoption) {
              foreach ($$typeofoption as $key => $value) {
                  $result[$typeofoption][] = array(
                      "name" => $key,
                      "value" => (!empty($value)) ? $value : 0
                  );
              }
          }
  
          $result['warnings'] = $warnings;
          return $result;
      }
code_tokens: public static function get_combined_review_options ( $ quizid , $ userid = 0 ) { global $ DB , $ USER ; $ warnings = array ( ) ; $ params = array ( 'quizid' => $ quizid , 'userid' => $ userid , ) ; $ params = self :: validate_parameters ( self :: get_combined_review_options_parameters ( ) , $ params ) ; list ( $ quiz , $ course , $ cm , $ context ) = self :: validate_quiz ( $ params [ 'quizid' ] ) ; // Default value for userid. if ( empty ( $ params [ 'userid' ] ) ) { $ params [ 'userid' ] = $ USER -> id ; } $ user = core_user :: get_user ( $ params [ 'userid' ] , '*' , MUST_EXIST ) ; core_user :: require_active_user ( $ user ) ; // Extra checks so only users with permissions can view other users attempts. if ( $ USER -> id != $ user -> id ) { require_capability ( 'mod/quiz:viewreports' , $ context ) ; } $ attempts = quiz_get_user_attempts ( $ quiz -> id , $ user -> id , 'all' , true ) ; $ result = array ( ) ; $ result [ 'someoptions' ] = [ ] ; $ result [ 'alloptions' ] = [ ] ; list ( $ someoptions , $ alloptions ) = quiz_get_combined_reviewoptions ( $ quiz , $ attempts ) ; foreach ( array ( 'someoptions' , 'alloptions' ) as $ typeofoption ) { foreach ( $ $ typeofoption as $ key => $ value ) { $ result [ $ typeofoption ] [ ] = array ( "name" => $ key , "value" => ( ! empty ( $ value ) ) ? $ value : 0 ) ; } } $ result [ 'warnings' ] = $ warnings ; return $ result ; }
docstring: Combines the review options from a number of different quiz attempts.
  
  @param int $quizid quiz instance id
  @param int $userid user id (empty for current user)
  @return array of warnings and the review options
  @since Moodle 3.1
docstring_tokens: Combines the review options from a number of different quiz attempts .