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


PHP question_attempt_step::get_qt_data方法代碼示例

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


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

示例1: summarise_hint

 public function summarise_hint(question_attempt_step $step, $hintkey)
 {
     $response = $step->get_qt_data();
     $hintkey = $this->adjust_hintkey($hintkey);
     $hintobj = $this->question->hint_object($hintkey, $step->get_qt_data());
     $hintdescription = $hintobj->hint_description();
     $a = new stdClass();
     $a->hint = $hintdescription;
     $a->response = $this->question->summarise_response($response);
     return get_string('hintused', 'qbehaviour_adaptivehintsnopenalties', $a);
 }
開發者ID:saylordotorg,項目名稱:moodle-qbehaviour_adaptivehintsnopenalties,代碼行數:11,代碼來源:behaviour.php

示例2: apply_attempt_state

 /**
  * When an in-progress {@link question_attempt} is re-loaded from the
  * database, this method is called so that the question can re-initialise
  * its internal state as needed by this attempt.
  *
  * For example, the multiple choice question type needs to set the order
  * of the choices to the order that was set up when start_attempt was called
  * originally. All the information required to do this should be in the
  * $step object, which is the first step of the question_attempt being loaded.
  *
  * @param question_attempt_step The first step of the {@link question_attempt}
  *      being loaded.
  */
 public function apply_attempt_state(\question_attempt_step $step)
 {
     global $DB;
     $attemptid = $this->get_attemptid_by_stepid($step->get_id());
     $this->usageid = $this->get_question_usageid($attemptid);
     // Retrive all vars initialized in start_attempt().
     foreach ($step->get_qt_data() as $name => $value) {
         if (substr($name, 0, 5) === '_var_') {
             $varid = substr($name, 5);
             $varname = $this->vars[$varid]->varname;
             $this->questiontext = str_replace('{$' . $varname . '}', $value, $this->questiontext);
             // Store vars (as array form) to be used later to get the correct response
             $this->varvalues[$varid] = explode(',', $value);
             if (!($values = $DB->get_field('qtype_programmedresp_val', 'varvalues', array('attemptid' => $this->usageid, 'varid' => $varid)))) {
                 // Add a new random value
                 $val = new stdClass();
                 $val->attemptid = $this->usageid;
                 $val->varid = $varid;
                 $val->varvalues = programmedresp_serialize($this->varvalues[$varid]);
                 if (!$DB->insert_record('qtype_programmedresp_val', $val)) {
                     print_error('errordb', 'qtype_programmedresp');
                 }
             }
         }
     }
 }
開發者ID:fontinixxl,項目名稱:moodle-qtype_linkerdesc,代碼行數:39,代碼來源:question.php

示例3: summarise_submit

 public function summarise_submit(question_attempt_step $step) {
     return get_string('submitted', 'question',
             $this->question->summarise_response($step->get_qt_data()));
 }
開發者ID:nigeli,項目名稱:moodle,代碼行數:4,代碼來源:behaviourbase.php

示例4: test_constructor_given_params

 public function test_constructor_given_params()
 {
     global $USER;
     $step = new question_attempt_step(array(), 123, 5);
     $this->assertEquals(123, $step->get_timecreated());
     $this->assertEquals(5, $step->get_user_id());
     $this->assertEquals(array(), $step->get_qt_data());
     $this->assertEquals(array(), $step->get_behaviour_data());
 }
開發者ID:jackdaniels79,項目名稱:moodle,代碼行數:9,代碼來源:questionattemptstep_test.php

示例5: apply_attempt_state

    public static function apply_attempt_state(
            qtype_calculated_question_with_expressions $question, question_attempt_step $step) {
        $values = array();
        foreach ($step->get_qt_data() as $name => $value) {
            if (substr($name, 0, 5) === '_var_') {
                $values[substr($name, 5)] = $value;
            }
        }

        $question->vs = new qtype_calculated_variable_substituter(
                $values, get_string('decsep', 'langconfig'));
        $question->calculate_all_expressions();
    }
開發者ID:nottmoo,項目名稱:moodle,代碼行數:13,代碼來源:question.php

示例6: do_grading

    protected function do_grading(question_attempt_step $responsesstep,
            question_attempt_pending_step $pendingstep) {
        if (!$this->question->is_gradable_response($responsesstep->get_qt_data())) {
            $pendingstep->set_state(question_state::$gaveup);

        } else {
            $response = $responsesstep->get_qt_data();
            list($fraction, $state) = $this->question->grade_response($response);

            if ($responsesstep->has_behaviour_var('certainty')) {
                $certainty = $responsesstep->get_behaviour_var('certainty');
            } else {
                $certainty = question_cbm::default_certainty();
                $pendingstep->set_behaviour_var('_assumedcertainty', $certainty);
            }

            $pendingstep->set_behaviour_var('_rawfraction', $fraction);
            $pendingstep->set_fraction(question_cbm::adjust_fraction($fraction, $certainty));
            $pendingstep->set_state($state);
            $pendingstep->set_new_response_summary(question_cbm::summary_with_certainty(
                    $this->question->summarise_response($response),
                    $responsesstep->get_behaviour_var('certainty')));
        }
        return question_attempt::KEEP;
    }
開發者ID:JP-Git,項目名稱:moodle,代碼行數:25,代碼來源:behaviour.php

示例7: summarise_helpme

 public function summarise_helpme(question_attempt_step $step)
 {
     return get_string('submittedwithhelp', 'qbehaviour_regexpadaptivewithhelp', $this->question->summarise_response_withhelp($step->get_qt_data()));
 }
開發者ID:rezeau,項目名稱:moodle-qbehaviour_regexpadaptivewithhelp,代碼行數:4,代碼來源:behaviour.php


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