original_string: public static function view_attempt($attemptid, $page, $preflightdata = array()) {
  
          $warnings = array();
  
          $params = array(
              'attemptid' => $attemptid,
              'page' => $page,
              'preflightdata' => $preflightdata,
          );
          $params = self::validate_parameters(self::view_attempt_parameters(), $params);
          list($attemptobj, $messages) = self::validate_attempt($params);
  
          // Log action.
          $attemptobj->fire_attempt_viewed_event();
  
          // Update attempt page, throwing an exception if $page is not valid.
          if (!$attemptobj->set_currentpage($params['page'])) {
              throw new moodle_quiz_exception($attemptobj->get_quizobj(), 'Out of sequence access');
          }
  
          $result = array();
          $result['status'] = true;
          $result['warnings'] = $warnings;
          return $result;
      }
code: public static function view_attempt($attemptid, $page, $preflightdata = array()) {
  
          $warnings = array();
  
          $params = array(
              'attemptid' => $attemptid,
              'page' => $page,
              'preflightdata' => $preflightdata,
          );
          $params = self::validate_parameters(self::view_attempt_parameters(), $params);
          list($attemptobj, $messages) = self::validate_attempt($params);
  
          // Log action.
          $attemptobj->fire_attempt_viewed_event();
  
          // Update attempt page, throwing an exception if $page is not valid.
          if (!$attemptobj->set_currentpage($params['page'])) {
              throw new moodle_quiz_exception($attemptobj->get_quizobj(), 'Out of sequence access');
          }
  
          $result = array();
          $result['status'] = true;
          $result['warnings'] = $warnings;
          return $result;
      }
code_tokens: public static function view_attempt ( $ attemptid , $ page , $ preflightdata = array ( ) ) { $ warnings = array ( ) ; $ params = array ( 'attemptid' => $ attemptid , 'page' => $ page , 'preflightdata' => $ preflightdata , ) ; $ params = self :: validate_parameters ( self :: view_attempt_parameters ( ) , $ params ) ; list ( $ attemptobj , $ messages ) = self :: validate_attempt ( $ params ) ; // Log action. $ attemptobj -> fire_attempt_viewed_event ( ) ; // Update attempt page, throwing an exception if $page is not valid. if ( ! $ attemptobj -> set_currentpage ( $ params [ 'page' ] ) ) { throw new moodle_quiz_exception ( $ attemptobj -> get_quizobj ( ) , 'Out of sequence access' ) ; } $ result = array ( ) ; $ result [ 'status' ] = true ; $ result [ 'warnings' ] = $ warnings ; return $ result ; }
docstring: Trigger the attempt viewed event.
  
  @param int $attemptid attempt id
  @param int $page page number
  @param array $preflightdata preflight required data (like passwords)
  @return array of warnings and status result
  @since Moodle 3.1
docstring_tokens: Trigger the attempt viewed event .