當前位置: 首頁>>代碼示例>>PHP>>正文


PHP question_engine_data_mapper::question_attempt_latest_state_view方法代碼示例

本文整理匯總了PHP中question_engine_data_mapper::question_attempt_latest_state_view方法的典型用法代碼示例。如果您正苦於以下問題:PHP question_engine_data_mapper::question_attempt_latest_state_view方法的具體用法?PHP question_engine_data_mapper::question_attempt_latest_state_view怎麽用?PHP question_engine_data_mapper::question_attempt_latest_state_view使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在question_engine_data_mapper的用法示例。


在下文中一共展示了question_engine_data_mapper::question_attempt_latest_state_view方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dotest_question_attempt_latest_state_view

    protected function dotest_question_attempt_latest_state_view() {
        global $DB;

        list($inlineview, $viewparams) = $this->dm->question_attempt_latest_state_view(
                'lateststate', $this->bothusages);

        $rawstates = $DB->get_records_sql("
                SELECT lateststate.questionattemptid,
                       qu.id AS questionusageid,
                       lateststate.slot,
                       lateststate.questionid,
                       lateststate.maxmark,
                       lateststate.sequencenumber,
                       lateststate.state
                  FROM {question_usages} qu
             LEFT JOIN $inlineview ON lateststate.questionusageid = qu.id
                 WHERE qu.id IN ({$this->usageids[0]}, {$this->usageids[1]})", $viewparams);

        $states = array();
        foreach ($rawstates as $state) {
            $states[$state->questionusageid][$state->slot] = $state;
            unset($state->questionattemptid);
            unset($state->questionusageid);
            unset($state->slot);
        }

        $state = $states[$this->usageids[0]][$this->allslots[0]];
        $this->assertEquals((object) array(
            'questionid'     => $this->sa->id,
            'maxmark'        => '5.0000000',
            'sequencenumber' => 2,
            'state'          => (string) question_state::$gradedright,
        ), $state);

        $state = $states[$this->usageids[0]][$this->allslots[1]];
        $this->assertEquals((object) array(
            'questionid'     => $this->essay->id,
            'maxmark'        => '10.0000000',
            'sequencenumber' => 2,
            'state'          => (string) question_state::$needsgrading,
        ), $state);

        $state = $states[$this->usageids[1]][$this->allslots[0]];
        $this->assertEquals((object) array(
            'questionid'     => $this->sa->id,
            'maxmark'        => '5.0000000',
            'sequencenumber' => 2,
            'state'          => (string) question_state::$gradedwrong,
        ), $state);

        $state = $states[$this->usageids[1]][$this->allslots[1]];
        $this->assertEquals((object) array(
            'questionid'     => $this->essay->id,
            'maxmark'        => '10.0000000',
            'sequencenumber' => 1,
            'state'          => (string) question_state::$gaveup,
        ), $state);
    }
開發者ID:verbazend,項目名稱:AWFA,代碼行數:58,代碼來源:question_engine_data_mapper_test.php

示例2: add_latest_state_join

    /**
     * Add the information about the latest state of the question with slot
     * $slot to the query.
     *
     * The extra information is added as a join to a
     * 'table' with alias qa$slot, with columns that are a union of
     * the columns of the question_attempts and question_attempts_states tables.
     *
     * @param int $slot the question to add information for.
     */
    protected function add_latest_state_join($slot) {
        $alias = 'qa' . $slot;

        $fields = $this->get_required_latest_state_fields($slot, $alias);
        if (!$fields) {
            return;
        }

        // This condition roughly filters the list of attempts to be considered.
        // It is only used in a subselect to help crappy databases (see MDL-30122)
        // therefore, it is better to use a very simple join, which may include
        // too many records, than to do a super-accurate join.
        $qubaids = new qubaid_join("{quiz_attempts} {$alias}quiza", "{$alias}quiza.uniqueid",
                "{$alias}quiza.quiz = :{$alias}quizid", array("{$alias}quizid" => $this->sql->params['quizid']));

        $dm = new question_engine_data_mapper();
        list($inlineview, $viewparams) = $dm->question_attempt_latest_state_view($alias, $qubaids);

        $this->sql->fields .= ",\n$fields";
        $this->sql->from .= "\nLEFT JOIN $inlineview ON " .
                "$alias.questionusageid = quiza.uniqueid AND $alias.slot = :{$alias}slot";
        $this->sql->params[$alias . 'slot'] = $slot;
        $this->sql->params = array_merge($this->sql->params, $viewparams);
    }
開發者ID:Jtgadbois,項目名稱:Pedadida,代碼行數:34,代碼來源:attemptsreport_table.php

示例3: add_latest_state_join

 /**
  * Add the information about the latest state of the question with slot
  * $slot to the query.
  *
  * The extra information is added as a join to a
  * 'table' with alias qa$slot, with columns that are a union of
  * the columns of the question_attempts and question_attempts_states tables.
  *
  * @param int $slot the question to add information for.
  */
 protected function add_latest_state_join($slot)
 {
     $alias = 'qa' . $slot;
     $fields = $this->get_required_latest_state_fields($slot, $alias);
     if (!$fields) {
         return;
     }
     $dm = new question_engine_data_mapper();
     $inlineview = $dm->question_attempt_latest_state_view($alias);
     $this->sql->fields .= ",\n{$fields}";
     $this->sql->from .= "\nLEFT JOIN {$inlineview} ON " . "{$alias}.questionusageid = quiza.uniqueid AND {$alias}.slot = :{$alias}slot";
     $this->sql->params[$alias . 'slot'] = $slot;
 }
開發者ID:sebastiansanio,項目名稱:tallerdeprogramacion2fiuba,代碼行數:23,代碼來源:attemptsreport.php


注:本文中的question_engine_data_mapper::question_attempt_latest_state_view方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。