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


PHP question_type::initialise_question_instance方法代碼示例

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


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

示例1: initialise_question_instance

 protected function initialise_question_instance(question_definition $question, $questiondata)
 {
     parent::initialise_question_instance($question, $questiondata);
     $this->initialise_question_answers($question, $questiondata);
     $this->initialise_combined_feedback($question, $questiondata);
     $question->places = array();
     $counter = 1;
     foreach ($questiondata->options->answers as $choicedata) {
         /* fraction contains a 1 */
         if (strpos($choicedata->fraction, '1') !== false) {
             $question->places[$counter] = $choicedata->answer;
             $counter++;
         }
     }
     /* Will put empty places '' where there is no text content.
      * l for left delimiter r for right delimiter
      */
     $l = substr($question->delimitchars, 0, 1);
     $r = substr($question->delimitchars, 1, 1);
     $nonfieldregex = '/\\' . $l . '.*?\\' . $r . '/';
     $bits = preg_split($nonfieldregex, $question->questiontext, null, PREG_SPLIT_DELIM_CAPTURE);
     $question->textfragments[0] = array_shift($bits);
     $i = 1;
     while (!empty($bits)) {
         $question->textfragments[$i] = array_shift($bits);
         $i += 1;
     }
 }
開發者ID:dthies,項目名稱:moodle-qtype_gapfill,代碼行數:28,代碼來源:questiontype.php

示例2: initialise_question_instance

 protected function initialise_question_instance(question_definition $question, $questiondata)
 {
     parent::initialise_question_instance($question, $questiondata);
     $question->shufflechoices = $questiondata->options->shuffleanswers;
     $this->initialise_combined_feedback($question, $questiondata, true);
     $question->choices = array();
     $choiceindexmap = array();
     // Store the choices in arrays by group.
     foreach ($questiondata->options->drags as $dragdata) {
         $choice = $this->make_choice($dragdata);
         if (array_key_exists($choice->choice_group(), $question->choices)) {
             $question->choices[$choice->choice_group()][$dragdata->no] = $choice;
         } else {
             $question->choices[$choice->choice_group()][1] = $choice;
         }
         end($question->choices[$choice->choice_group()]);
         $choiceindexmap[$dragdata->no] = array($choice->choice_group(), key($question->choices[$choice->choice_group()]));
     }
     $question->places = array();
     $question->rightchoices = array();
     $i = 1;
     foreach ($questiondata->options->drops as $dropdata) {
         list($group, $choiceindex) = $choiceindexmap[$dropdata->choice];
         $dropdata->group = $group;
         $question->places[$dropdata->no] = $this->make_place($dropdata);
         $question->rightchoices[$dropdata->no] = $choiceindex;
     }
 }
開發者ID:ndunand,項目名稱:moodle-qtype_ddimageortext,代碼行數:28,代碼來源:questiontypebase.php

示例3: initialise_question_instance

 protected function initialise_question_instance(question_definition $question, $questiondata)
 {
     parent::initialise_question_instance($question, $questiondata);
     $question->responseformat = $questiondata->options->responseformat;
     $question->graderinfo = $questiondata->options->graderinfo;
     $question->graderinfoformat = $questiondata->options->graderinfoformat;
 }
開發者ID:nadavkav,項目名稱:Moodle2-Hebrew-plugins,代碼行數:7,代碼來源:questiontype.php

示例4: initialise_question_instance

 protected function initialise_question_instance(question_definition $question, $questiondata) {
     parent::initialise_question_instance($question, $questiondata);
     $question->responseformat = $questiondata->options->responseformat;
     $question->responsefieldlines = $questiondata->options->responsefieldlines;
     $question->attachments = $questiondata->options->attachments;
     $question->graderinfo = $questiondata->options->graderinfo;
     $question->graderinfoformat = $questiondata->options->graderinfoformat;
     $question->responselimitpolicy = $questiondata->options->responselimitpolicy;
     $question->wordlimit = $questiondata->options->wordlimit;
     $question->charlimit = $questiondata->options->charlimit;
 }
開發者ID:nickkoeppen,項目名稱:moodle,代碼行數:11,代碼來源:questiontype.php

示例5: initialise_question_instance

 protected function initialise_question_instance(question_definition $question, $questiondata)
 {
     parent::initialise_question_instance($question, $questiondata);
     $question->responseformat = $questiondata->options->responseformat;
     $question->responsefieldlines = $questiondata->options->responsefieldlines;
     $question->attachments = $questiondata->options->attachments;
     $question->graderinfo = $questiondata->options->graderinfo;
     $question->graderinfoformat = $questiondata->options->graderinfoformat;
     $question->responsetemplate = $questiondata->options->responsetemplate;
     $question->responsetemplateformat = $questiondata->options->responsetemplateformat;
 }
開發者ID:EmmanuelYupit,項目名稱:educursos,代碼行數:11,代碼來源:questiontype.php

示例6: initialise_question_instance

 /**
  * Initialise the common question_definition fields.
  * 
  * @param question_definition $question the question_definition we are creating.
  * @param object $questiondata the question data loaded from the database.
  */
 protected function initialise_question_instance(question_definition $question, $questiondata)
 {
     parent::initialise_question_instance($question, $questiondata);
     $question->rows = $questiondata->options->rows;
     $question->cols = $questiondata->options->cols;
     $question->weights = $questiondata->options->weights;
     $question->grademethod = $questiondata->options->grademethod;
     $question->multiple = $questiondata->options->multiple;
 }
開發者ID:sunilwebaccess,項目名稱:moodle-question-matrix,代碼行數:15,代碼來源:questiontype.php

示例7: initialise_question_instance

 protected function initialise_question_instance(question_definition $question, $questiondata)
 {
     parent::initialise_question_instance($question, $questiondata);
     $availablesaquestions = $this->get_available_saquestions_from_category($question->category, $questiondata->options->subcats);
     $question->shufflestems = false;
     $question->stems = array();
     $question->choices = array();
     $question->right = array();
     $this->initialise_combined_feedback($question, $questiondata);
     $question->questionsloader = new qtype_randomsamatch_question_loader($availablesaquestions, $questiondata->options->choose);
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:11,代碼來源:questiontype.php

示例8: initialise_question_instance

    protected function initialise_question_instance(question_definition $question, $questiondata) {
        parent::initialise_question_instance($question, $questiondata);

        $question->shufflestems = $questiondata->options->shuffleanswers;
        $this->initialise_combined_feedback($question, $questiondata, true);

        $question->stems = array();
        $question->choices = array();
        $question->right = array();

        foreach ($questiondata->options->subquestions as $matchsub) {
            $ans = $matchsub->answertext;
            $key = array_search($matchsub->answertext, $question->choices);
            if ($key === false) {
                $key = $matchsub->id;
                $question->choices[$key] = $matchsub->answertext;
            }

            if ($matchsub->questiontext !== '') {
                $question->stems[$matchsub->id] = $matchsub->questiontext;
                $question->stemformat[$matchsub->id] = $matchsub->questiontextformat;
                $question->right[$matchsub->id] = $key;
            }
        }
    }
開發者ID:nigeldaley,項目名稱:moodle,代碼行數:25,代碼來源:questiontype.php

示例9: initialise_question_instance

    protected function initialise_question_instance(question_definition $question, $questiondata) {
        question_type::initialise_question_instance($question, $questiondata);

        $question->shuffleanswers = $questiondata->options->shuffleanswers;
        $question->answernumbering = $questiondata->options->answernumbering;
        if (!empty($questiondata->options->layout)) {
            $question->layout = $questiondata->options->layout;
        } else {
            $question->layout = qtype_multichoice_single_question::LAYOUT_VERTICAL;
        }

        $question->synchronised = $questiondata->options->synchronize;

        $this->initialise_combined_feedback($question, $questiondata, true);
        $this->initialise_question_answers($question, $questiondata);

        foreach ($questiondata->options->answers as $a) {
            $question->answers[$a->id]->correctanswerlength = $a->correctanswerlength;
            $question->answers[$a->id]->correctanswerformat = $a->correctanswerformat;
        }

        $question->datasetloader = new qtype_calculated_dataset_loader($questiondata->id);
    }
開發者ID:JP-Git,項目名稱:moodle,代碼行數:23,代碼來源:questiontype.php

示例10: initialise_question_instance

 protected function initialise_question_instance(question_definition $question, $questiondata)
 {
     parent::initialise_question_instance($question, $questiondata);
     $question->shuffleanswers = $questiondata->options->shuffleanswers;
     $question->answernumbering = $questiondata->options->answernumbering;
     if (!empty($questiondata->options->layout)) {
         $question->layout = $questiondata->options->layout;
     } else {
         $question->layout = qtype_multichoice_single_question::LAYOUT_VERTICAL;
     }
     $question->correctfeedback = $questiondata->options->correctfeedback;
     $question->correctfeedbackformat = $questiondata->options->correctfeedbackformat;
     $question->incorrectfeedback = $questiondata->options->incorrectfeedback;
     $question->incorrectfeedbackformat = $questiondata->options->incorrectfeedbackformat;
     $question->shownumcorrect = $questiondata->options->shownumcorrect;
     $this->initialise_question_answers($question, $questiondata, false);
 }
開發者ID:parksandwildlife,項目名稱:learning,代碼行數:17,代碼來源:questiontype.php

示例11: initialise_question_instance

 protected function initialise_question_instance(question_definition $question, $questiondata)
 {
     // TODO.
     parent::initialise_question_instance($question, $questiondata);
 }
開發者ID:edwinp-catalyst-eu,項目名稱:moodle-qtype_TEMPLATE,代碼行數:5,代碼來源:questiontype.php

示例12: initialise_question_instance

 protected function initialise_question_instance(question_definition $question, $questiondata)
 {
     parent::initialise_question_instance($question, $questiondata);
     $question->usecase = $questiondata->options->usecase;
     $question->usehint = $questiondata->options->usehint;
     $question->studentshowalternate = $questiondata->options->studentshowalternate;
     $this->initialise_question_answers($question, $questiondata);
     $qid = $question->id;
 }
開發者ID:rezeau,項目名稱:moodle-qtype_regexp,代碼行數:9,代碼來源:questiontype.php

示例13: initialise_question_instance

 protected function initialise_question_instance(question_definition $question, $questiondata)
 {
     parent::initialise_question_instance($question, $questiondata);
     global $DB;
     $answers = $questiondata->options->answers;
     $question->generalfeedback = $answers[$questiondata->options->answer]->feedback;
     $question->generalfeedbackformat = $answers[$questiondata->options->answer]->feedbackformat;
     $question->answerid = $questiondata->options->answer;
     //$question->rightanswer = 10;
     $getanswers = $DB->get_records('question_answers', array('question' => $question->id), 'id ASC');
     $answerval = array_shift($getanswers);
     if ($answerval) {
         $question->rightanswer = $answerval->answer;
     }
     $getanswers = $DB->get_records('question_classdiagram', array('question' => $question->id), 'id ASC');
     $answerval = array_shift($getanswers);
     if ($answerval) {
         $question->class_marks = $answerval->class_marks;
         $question->class_name_marks = $answerval->class_name_marks;
         $question->class_attribute_marks = $answerval->class_attribute_marks;
         $question->class_extra_marks = $answerval->class_extra_marks;
         $question->association_marks = $answerval->association_marks;
         $question->association_type_marks = $answerval->association_type_marks;
         $question->association_cardinality_marks = $answerval->association_cardinality_marks;
         $question->association_extra_marks = $answerval->association_extra_marks;
         $question->generalization_marks = $answerval->generalization_marks;
         $question->generalization_type_marks = $answerval->generalization_type_marks;
         $question->generalization_extra_marks = $answerval->generalization_extra_marks;
     }
 }
開發者ID:nupurgarg1211,項目名稱:QuestionTypePluginForMoodle,代碼行數:30,代碼來源:questiontype.php

示例14: initialise_question_instance

 protected function initialise_question_instance(question_definition $question, $questiondata)
 {
     parent::initialise_question_instance($question, $questiondata);
     $question->shuffleanswers = $questiondata->options->shuffleanswers;
     $question->qdifficulty = $questiondata->options->qdifficulty;
     if (!empty($questiondata->options->layout)) {
         $question->layout = $questiondata->options->layout;
     } else {
         $question->layout = qtype_turmultiplechoice_single_question::LAYOUT_VERTICAL;
     }
     $this->initialise_combined_feedback($question, $questiondata, true);
     $this->initialise_question_answers($question, $questiondata, false);
 }
開發者ID:edwinphillips,項目名稱:turmultiplechoice_2.2,代碼行數:13,代碼來源:questiontype.php

示例15: initialise_question_instance

 protected function initialise_question_instance(question_definition $question, $questiondata)
 {
     parent::initialise_question_instance($question, $questiondata);
     foreach ($questiondata->options as $field => $value) {
         if (!isset($question->{$field})) {
             $question->{$field} = $value;
         }
     }
 }
開發者ID:pac,項目名稱:CodeRunner,代碼行數:9,代碼來源:questiontype.php


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