Trigger the attempt summary viewed event.

@param int $attemptid attempt id
@param array $preflightdata preflight required data (like passwords)
@return array of warnings and status result
@since Moodle 3.1
763751
public static function view_attempt_summary($attemptid, $preflightdata = array()) {

        $warnings = array();

        $params = array(
            'attemptid' => $attemptid,
            'preflightdata' => $preflightdata,
        );
        $params = self::validate_parameters(self::view_attempt_summary_parameters(), $params);
        list($attemptobj, $messages) = self::validate_attempt($params);

        // Log action.
        $attemptobj->fire_attempt_summary_viewed_event();

        $result = array();
        $result['status'] = true;
        $result['warnings'] = $warnings;
        return $result;
    }
150367
public function commentList($msg_data_id, $begin, $count, $type, $index = null) {
        if ($count > 50) {
            $count = 50;
        }
        $args = $this->getCommentList()->parameters(
            compact('msg_data_id', 'begin', 'count', 'type', 'index'))->json();
        if ($args['errcode'] != 0) {
            throw new Exception($args['errmsg']);
        }
        return $args;
    }
1095004
private function captureInput(array $eventData)
    {
        $inputData = [
            'text' => FallbackCommand::CMD,
        ];

        if (empty($eventData['replyToken'])) {
            throw new \InvalidArgumentException("Require `replyToken` to run.");
        }

        if (empty($eventData['source']['userId'])) {
            throw new \InvalidArgumentException("Require `userId` to run.");
        }

        $inputData['replyToken'] = $eventData['replyToken'];
        $inputData['userId'] = $eventData['source']['userId'];
        $type = strtolower(@$eventData['type']);

        switch ($type) {
            case Constants::REVEIVE_TYPE_FOLLOW:
                $inputData['text'] = ':follow';
                break;

            case Constants::REVEIVE_TYPE_MESSAGE:
                $inputData['text'] = $this->captureReceiveMessageText($eventData);
                break;

            default:
                throw new \RuntimeException("Unsupported event type `$type`.");
        }

        return new Input($inputData);
    }
944675
public function logProcessSucceed(ProcessId $processId, \DateTimeImmutable $finishedAt)
    {
        $data = [
            'finished_at' => $finishedAt->format(\DateTime::ISO8601),
            'status' => self::STATUS_SUCCEED,
        ];

        $entry = $this->loadProcessEntryIfExists($processId);

        if (is_null($entry)) {
            $this->insertNewEntry($processId, $data);
        } else {
            $this->updateEntry($processId, $data);
        }
    }
207334
func (e *Execution_ID) AttemptID() *Attempt_ID {
	return &Attempt_ID{Quest: e.Quest, Id: e.Attempt}
}
850120
public static function get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber) {
        $document = self::get_combined_document_for_attempt($assignment, $userid, $attemptnumber);

        if ($document->get_status() === combined_document::STATUS_COMPLETE) {
            // The combined document is already ready.
            return $document;
        } else {
            // Attempt to combined the files in the document.
            $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
            $document->combine_files($assignment->get_context()->id, $grade->id);
            return $document;
        }
    }
258233
public function getAttemptsLeftWithSameSession(string $sessionId): int
    {
        $attemptsLeft = ((int) $this->maxAttemptsForSessionId) - $this->enhancedAuthenticationMapper->fetchAttemptsWithSameSession($sessionId, $this->banTimeInSeconds);

        return \max(0, $attemptsLeft);
    }
418724
public function OnUncaughtErrorTriggered($errSeverity, $errMessage, $errFile, $errLine, array $errContext)
    {
        //@call
        if (0 === error_reporting()) {
            return false;
        }
        throw new PHPTriggerErrorException($errMessage, $errLine, $errFile, $errSeverity);
    }
139388
public function get_preflight_check_form(moodle_url $url, $attemptid) {
        // This form normally wants POST submissins. However, it also needs to
        // accept GET submissions. Since formslib is strict, we have to detect
        // which case we are in, and set the form property appropriately.
        $method = 'post';
        if (!empty($_GET['_qf__mod_quiz_preflight_check_form'])) {
            $method = 'get';
        }
        return new mod_quiz_preflight_check_form($url->out_omit_querystring(),
                array('rules' => $this->rules, 'quizobj' => $this->quizobj,
                      'attemptid' => $attemptid, 'hidden' => $url->params()), $method);
    }
601480
static function isEnabledAfterFailedLogin( $userID, $ignoreTrusted = false )
    {
        if ( !is_numeric( $userID ) )
            return true;

        $userObject = eZUser::fetch( $userID );
        if ( !$userObject )
            return true;

        $trustedUser = eZUser::isTrusted();
        // If user is trusted we should stop processing
        if ( $trustedUser and !$ignoreTrusted )
            return true;

        $maxNumberOfFailedLogin = eZUser::maxNumberOfFailedLogin();

        if ( $maxNumberOfFailedLogin == '0' )
            return true;

        $failedLoginAttempts = $userObject->failedLoginAttempts();
        if ( $failedLoginAttempts > $maxNumberOfFailedLogin )
            return false;

        return true;
    }
715905
public function handleRequest()
    {
        // test if user has selected an idp or idp can be deremine automatically somehow.
        $this->start();

        // no choice possible. Show discovery service page
        $idpList = $this->getIdPList();
        if (isset($this->originalsp['disco.addInstitutionApp'])
            && $this->originalsp['disco.addInstitutionApp'] === true
        ) {
            $idpList = $this->filterAddInstitutionList($idpList);
        } else {
            $idpList = $this->filterList($idpList);
        }
        $preferredIdP = $this->getRecommendedIdP();
        $preferredIdP = array_key_exists($preferredIdP, $idpList)
            ? $preferredIdP : null;

        if (sizeof($idpList) === 1) {
            $idp = array_keys($idpList)[0];
            $url = Disco::buildContinueUrl(
                $this->spEntityId,
                $this->returnURL,
                $this->returnIdParam,
                $idp
            );
            Logger::info('perun.Disco: Only one Idp left. Redirecting automatically. IdP: '
                . $idp);
            HTTP::redirectTrustedURL($url);
        }

        $t = new DiscoTemplate($this->config);
        $t->data['originalsp'] = $this->originalsp;
        $t->data['idplist'] = $this->idplistStructured($idpList);
        $t->data['preferredidp'] = $preferredIdP;
        $t->data['entityID'] = $this->spEntityId;
        $t->data['return'] = $this->returnURL;
        $t->data['returnIDParam'] = $this->returnIdParam;
        $t->data['AuthnContextClassRef'] = $this->authnContextClassRef;
        $t->show();
    }
340552
function onSDPDescription(id,rtcId,data)
    {
        if(scope._servConn.useRTC)
        {
            if(scope.hasWebRTCSupport())
            {
                var peer   = getOrCreatePeer(id);
                peer.rtcId = rtcId;
                peer.onServerMessage(JSON.parse(data));
            }
            else
            {
                scope._servConn.sendRTCState(false,id);
            }
        }
    }
1096404
public function notifySubscribers(string $eventId, array $eventData)
    {
        /** @var SubscriberInterface $subscriber */
        foreach ($this->getSubscribers() as $subscriber) {
            $subscriber->handleEvent($eventId, $eventData);
        }
    }
442057
private function processBeginRequestRecord(int $requestId, ?string $contentData): void
    {
        if (isset($this->requests[$requestId])) {
            throw new ProtocolException('Unexpected FCGI_BEGIN_REQUEST record');
        }

        $contentFormat = 'nrole/Cflags/x5';

        $content = unpack($contentFormat, $contentData);

        $keepAlive = DaemonInterface::FCGI_KEEP_CONNECTION & $content['flags'];

        $this->requests[$requestId] = [
            'keepAlive' => $keepAlive,
            'stdin'     => fopen('php://temp', 'r+'),
            'params'    => [],
        ];

        if ($this->shutdown) {
            $this->endRequest($requestId, 0, DaemonInterface::FCGI_OVERLOADED);

            return;
        }

        if (DaemonInterface::FCGI_RESPONDER !== $content['role']) {
            $this->endRequest($requestId, 0, DaemonInterface::FCGI_UNKNOWN_ROLE);

            return;
        }
    }
1184392
@Override
	public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
			throws IOException {
		final String requestURI = request.getRequestURI();
		UserAuthentication userAuth = null;
		User user = null;

		if (requestURI.endsWith(OPENID_ACTION)) {
			Authentication oidAuth = super.attemptAuthentication(request, response);

			if (oidAuth == null) {
				// hang on... redirecting to openid provider
				return null;
			} else {
				//success!
				AuthenticatedUserDetails userDetails = (AuthenticatedUserDetails) oidAuth.getPrincipal();
				userAuth = new UserAuthentication(userDetails);
				user = userDetails.getUser();
			}
		}

		return SecurityUtils.checkIfActive(userAuth, user, true);
	}
7238
def perform_preflight_check(self):
        
        failures = []
        if not os.access(self.mount_path_base, os.W_OK):
            msg = ("Mount path `{path}` doesn't exist or is not writable"
                   " by the current user.")
            failures.append(msg.format(
                path = self.mount_path_base
            ))
        if which('sshfs') is None:
            msg = ("SSHFS (http://fuse.sourceforge.net/sshfs.html)"
                   " does not seem to be installed.")
            failures.append(msg)

        return len(failures) == 0, failures
945735
public function load_question_attempt_step($stepid) {
        $records = $this->db->get_recordset_sql("
SELECT
    quba.contextid,
    COALESCE(q.qtype, 'missingtype') AS qtype,
    qas.id AS attemptstepid,
    qas.questionattemptid,
    qas.sequencenumber,
    qas.state,
    qas.fraction,
    qas.timecreated,
    qas.userid,
    qasd.name,
    qasd.value

FROM      {question_attempt_steps}     qas
JOIN      {question_attempts}          qa   ON qa.id              = qas.questionattemptid
JOIN      {question_usages}            quba ON quba.id            = qa.questionusageid
LEFT JOIN {question}                   q    ON q.id               = qa.questionid
LEFT JOIN {question_attempt_step_data} qasd ON qasd.attemptstepid = qas.id

WHERE
    qas.id = :stepid
        ", array('stepid' => $stepid));

        if (!$records->valid()) {
            throw new coding_exception('Failed to load question_attempt_step ' . $stepid);
        }

        $step = question_attempt_step::load_from_records($records, $stepid);
        $records->close();

        return $step;
    }