当前位置: 首页>>代码示例>>PHP>>正文


PHP question_type类代码示例

本文整理汇总了PHP中question_type的典型用法代码示例。如果您正苦于以下问题:PHP question_type类的具体用法?PHP question_type怎么用?PHP question_type使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了question_type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: save_question

 public function save_question($question, $form)
 {
     // Make very sure that descriptions can'e be created with a grade of
     // anything other than 0.
     $form->defaultmark = 0;
     return parent::save_question($question, $form);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:7,代码来源:questiontype.php

示例3: save_question_options

 public function save_question_options($question)
 {
     global $DB;
     $result = new stdClass();
     $context = $question->context;
     $question->feedbackperconditions = rtrim(str_replace("\r\n", "\n", $question->feedbackperconditions), "\n");
     $question->conditions = rtrim(str_replace("\r\n", "\n", $question->conditions), "\n");
     $parentresult = parent::save_question_options($question);
     if ($parentresult !== null) {
         // Parent function returns null if all is OK
         return $parentresult;
     }
     $this->save_hints($question);
     return $parentresult;
 }
开发者ID:ndunand,项目名称:moodle-qtype_multinumerical,代码行数:15,代码来源:questiontype.php

示例4: foreach

 function export_to_xml($question, qformat_xml $format, $extra = null)
 {
     global $COURSE;
     if ($extra !== null) {
         throw new coding_exception("coderunner:export_to_xml: Unexpected parameter");
     }
     // Copy the question so we can modify it for export
     // (Just in case the original gets used elsewhere).
     $questiontoexport = clone $question;
     $qtype = $question->options->coderunnertype;
     $coursecontext = context_course::instance($COURSE->id);
     $row = self::get_prototype($qtype, $coursecontext);
     // Clear all inherited fields equal in value to the corresponding Prototype field
     // (but only if this is not a prototype question itself)
     if ($questiontoexport->options->prototypetype == 0) {
         $noninheritedfields = $this->noninherited_fields();
         $extrafields = $this->extra_question_fields();
         foreach ($row as $field => $value) {
             if (in_array($field, $extrafields) && !in_array($field, $noninheritedfields) && $question->options->{$field} === $value) {
                 $questiontoexport->options->{$field} = null;
             }
         }
     }
     $expout = parent::export_to_xml($questiontoexport, $format, $extra);
     $expout .= "    <testcases>\n";
     foreach ($question->options->testcases as $testcase) {
         $useasexample = $testcase->useasexample ? 1 : 0;
         $hiderestiffail = $testcase->hiderestiffail ? 1 : 0;
         $mark = sprintf("%.7f", $testcase->mark);
         $expout .= "      <testcase useasexample=\"{$useasexample}\" hiderestiffail=\"{$hiderestiffail}\" mark=\"{$mark}\" >\n";
         foreach (array('testcode', 'stdin', 'expected', 'extra', 'display') as $field) {
             $exportedValue = $format->writetext($testcase->{$field}, 4);
             $expout .= "      <{$field}>\n        {$exportedValue}      </{$field}>\n";
         }
         $expout .= "    </testcase>\n";
     }
     // Add datafiles within the scope of the <testcases> element
     $fs = get_file_storage();
     $contextid = $question->contextid;
     $datafiles = $fs->get_area_files($contextid, 'qtype_coderunner', 'datafile', $question->id);
     $expout .= $format->write_files($datafiles);
     $expout .= "    </testcases>\n";
     return $expout;
 }
开发者ID:pac,项目名称:CodeRunner,代码行数:44,代码来源:questiontype.php

示例5: save_question

 public function save_question($question, $form) {
     $form->name = '';
     // Name is not a required field for random questions, but
     // parent::save_question Assumes that it is.
     return parent::save_question($question, $form);
 }
开发者ID:nottmoo,项目名称:moodle,代码行数:6,代码来源: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: delete_files

 protected function delete_files($questionid, $contextid)
 {
     $fs = get_file_storage();
     parent::delete_files($questionid, $contextid);
     $this->delete_files_in_answers($questionid, $contextid, true);
     $fs->delete_area_files($contextid, 'question', 'correctfeedback', $questionid);
     $fs->delete_area_files($contextid, 'question', 'incorrectfeedback', $questionid);
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:8,代码来源:questiontype.php

示例8: delete_files

    protected function delete_files($questionid, $contextid) {
        global $DB;
        $fs = get_file_storage();

        parent::delete_files($questionid, $contextid);

        $subquestionids = $DB->get_records_menu('question_match_sub',
                array('question' => $questionid), 'id', 'id,1');
        foreach ($subquestionids as $subquestionid => $notused) {
            $fs->delete_area_files($contextid, 'qtype_match', 'subquestion', $subquestionid);
        }

        $this->delete_files_in_combined_feedback($questionid, $contextid);
    }
开发者ID:nigeldaley,项目名称:moodle,代码行数:14,代码来源:questiontype.php

示例9: save_question

 public function save_question($question, $form)
 {
     $form->name = '';
     // In case someone set the question text to true/false in the old style, set it properly.
     if ($form->questiontext['text']) {
         $form->questiontext['text'] = '1';
     } else {
         $form->questiontext['text'] = '0';
     }
     $form->tags = array();
     // Name is not a required field for random questions, but
     // parent::save_question Assumes that it is.
     return parent::save_question($question, $form);
 }
开发者ID:abhilash1994,项目名称:moodle,代码行数:14,代码来源:questiontype.php

示例10: delete_files

 protected function delete_files($questionid, $contextid)
 {
     global $DB;
     $fs = get_file_storage();
     parent::delete_files($questionid, $contextid);
 }
开发者ID:jacac,项目名称:qtype_order,代码行数:6,代码来源:questiontype.php

示例11: make_question

 public function make_question($questiondata)
 {
     $question = parent::make_question($questiondata);
     $question->questiontext = html_writer::tag('div', get_string('missingqtypewarning', 'qtype_missingtype'), array('class' => 'warning missingqtypewarning')) . $question->questiontext;
     return $question;
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:6,代码来源:questiontype.php

示例12: save_question

 public function save_question($question, $form)
 {
     $form->name = '';
     $form->questiontextformat = FORMAT_MOODLE;
     $form->tags = array();
     // Name is not a required field for random questions, but
     // parent::save_question Assumes that it is.
     return parent::save_question($question, $form);
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:9,代码来源:questiontype.php

示例13: 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

示例14: delete_files

 protected function delete_files($questionid, $contextid)
 {
     global $DB;
     $fs = get_file_storage();
     parent::delete_files($questionid, $contextid);
     $subquestionids = $DB->get_records_menu('question_order_sub', array('question' => $questionid), 'id', 'id,1');
     foreach ($subquestionids as $subquestionid => $notused) {
         $fs->delete_area_files($contextid, 'qtype_order', 'subquestion', $subquestionid);
     }
     $fs->delete_area_files($contextid, 'qtype_multichoice', 'correctfeedback', $questionid);
     $fs->delete_area_files($contextid, 'qtype_multichoice', 'partiallycorrectfeedback', $questionid);
     $fs->delete_area_files($contextid, 'qtype_multichoice', 'incorrectfeedback', $questionid);
 }
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:13,代码来源:questiontype.php

示例15: delete_files

 protected function delete_files($questionid, $contextid)
 {
     parent::delete_files($questionid, $contextid);
     $fs = get_file_storage();
     $fs->delete_area_files($contextid, 'qtype_javaunittest', 'graderinfo', $questionid);
 }
开发者ID:printz81,项目名称:javaunittest,代码行数:6,代码来源:questiontype.php


注:本文中的question_type类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。