当前位置: 首页>>代码示例>>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;未经允许,请勿转载。