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


PHP question_type::get_question_options方法代码示例

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


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

示例1: get_question_options

 public function get_question_options($question)
 {
     global $CFG, $DB, $OUTPUT;
     parent::get_question_options($question);
     // Get the question answers and their respective tolerances
     // Note: question_numerical is an extension of the answer table rather than
     //       the question table as is usually the case for qtype
     //       specific tables.
     if (!($question->options->answers = $DB->get_records_sql("SELECT a.*, n.tolerance " . "FROM {question_answers} a, " . "     {question_numerical} n " . "WHERE a.question = ? " . "    AND   a.id = n.answer " . "ORDER BY a.id ASC", array($question->id)))) {
         echo $OUTPUT->notification('Error: Missing question answer for numerical question ' . $question->id . '!');
         return false;
     }
     $question->hints = $DB->get_records('question_hints', array('questionid' => $question->id), 'id ASC');
     $this->get_numerical_units($question);
     // Get_numerical_options() need to know if there are units
     // to set correctly default values.
     $this->get_numerical_options($question);
     // If units are defined we strip off the default unit from the answer, if
     // it is present. (Required for compatibility with the old code and DB).
     if ($defaultunit = $this->get_default_numerical_unit($question)) {
         foreach ($question->options->answers as $key => $val) {
             $answer = trim($val->answer);
             $length = strlen($defaultunit->unit);
             if ($length && substr($answer, -$length) == $defaultunit->unit) {
                 $question->options->answers[$key]->answer = substr($answer, 0, strlen($answer) - $length);
             }
         }
     }
     return true;
 }
开发者ID:abhilash1994,项目名称:moodle,代码行数:30,代码来源:questiontype.php

示例2: get_question_options

 public function get_question_options($question)
 {
     global $DB;
     parent::get_question_options($question);
     $question->options = $DB->get_record('qtype_randomsamatch_options', array('questionid' => $question->id));
     return true;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:7,代码来源:questiontype.php

示例3: get_question_options

 public function get_question_options($question) {
     global $DB;
     parent::get_question_options($question);
     $question->options = $DB->get_record('question_match', array('question' => $question->id));
     $question->options->subquestions = $DB->get_records('question_match_sub',
             array('question' => $question->id), 'id ASC');
     return true;
 }
开发者ID:nigeldaley,项目名称:moodle,代码行数:8,代码来源:questiontype.php

示例4: get_question_options

 public function get_question_options($question)
 {
     global $DB;
     $dbprefix = 'qtype_' . $this->name();
     $question->options = $DB->get_record($dbprefix, array('questionid' => $question->id), '*', MUST_EXIST);
     $question->options->drags = $DB->get_records($dbprefix . '_drags', array('questionid' => $question->id), 'no ASC', '*');
     $question->options->drops = $DB->get_records($dbprefix . '_drops', array('questionid' => $question->id), 'no ASC', '*');
     parent::get_question_options($question);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:9,代码来源:questiontypebase.php

示例5: get_question_options

 public function get_question_options($question)
 {
     global $DB;
     $question->options = $DB->get_record('qtype_poodllrecording_opts', array('questionid' => $question->id), '*', MUST_EXIST);
     parent::get_question_options($question);
 }
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:6,代码来源:questiontype.php

示例6: array

 function get_question_options($question)
 {
     parent::get_question_options($question);
     $matrix = self::retrieve_matrix($question->id);
     if ($matrix) {
         $question->options->rows = $matrix->rows;
         $question->options->cols = $matrix->cols;
         $question->options->weights = $matrix->weights;
         $question->options->grademethod = $matrix->grademethod;
         $question->options->multiple = $matrix->multiple;
         $question->options->renderer = $matrix->renderer;
     } else {
         $question->options->rows = array();
         $question->options->cols = array();
         $question->options->weights = array(array());
         $question->options->grademethod = self::defaut_grading()->get_name();
         $question->options->multiple = true;
     }
     return true;
 }
开发者ID:sunilwebaccess,项目名称:moodle-question-matrix,代码行数:20,代码来源:questiontype.php

示例7: get_question_options

 public function get_question_options($question)
 {
     global $DB, $OUTPUT;
     $question->options = $DB->get_record('qtype_multichoiceset_options', array('questionid' => $question->id), '*', MUST_EXIST);
     parent::get_question_options($question);
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:6,代码来源:questiontype.php

示例8: get_question_options

 public function get_question_options($question)
 {
     global $DB;
     parent::get_question_options($question);
     $question->options = $DB->get_record('qtype_stack_options', array('questionid' => $question->id), '*', MUST_EXIST);
     $question->inputs = $DB->get_records('qtype_stack_inputs', array('questionid' => $question->id), 'name', 'name, id, questionid, type, tans, boxsize, strictsyntax, insertstars, ' . 'syntaxhint, forbidwords, allowwords, forbidfloat, requirelowestterms, ' . 'checkanswertype, mustverify, showvalidation, options');
     $question->prts = $DB->get_records('qtype_stack_prts', array('questionid' => $question->id), 'name', 'name, id, questionid, value, autosimplify, feedbackvariables, firstnodename');
     $noders = $DB->get_recordset('qtype_stack_prt_nodes', array('questionid' => $question->id), 'prtname, ' . $DB->sql_cast_char2int('nodename'));
     foreach ($noders as $node) {
         $question->prts[$node->prtname]->nodes[$node->nodename] = $node;
     }
     $noders->close();
     $question->deployedseeds = $DB->get_fieldset_sql('
             SELECT seed
               FROM {qtype_stack_deployed_seeds}
              WHERE questionid = ?
           ORDER BY id', array($question->id));
     return true;
 }
开发者ID:profcab,项目名称:moodle-qtype_stack,代码行数:19,代码来源:questiontype.php

示例9: get_question_options

 public function get_question_options($question)
 {
     global $DB;
     $question->options = $DB->get_record('question_' . $this->name(), array('questionid' => $question->id), '*', MUST_EXIST);
     parent::get_question_options($question);
 }
开发者ID:ndunand,项目名称:moodle-qtype_gapselect,代码行数:6,代码来源:questiontypebase.php

示例10: get_question_options

 public function get_question_options($question)
 {
     global $CFG, $DB, $OUTPUT;
     parent::get_question_options($question);
     if ($question->options->prototypetype != 0) {
         // Question prototype?
         // Yes. It's 100% customised with nothing to inherit.
         $question->options->customise = True;
     } else {
         // Add to the question all the inherited fields from the question's prototype
         // record that have not been overridden (i.e. that are null) by this
         // instance. If any of the inherited fields are modified (i.e. any
         // (extra field not in the noninheritedFields list), the 'customise'
         // field is set. This is used only to display the customisation panel.
         $qtype = $question->options->coderunnertype;
         $context = $this->question_context($question);
         $row = $this->get_prototype($qtype, $context);
         $question->options->customise = False;
         // Starting assumption
         $noninheritedfields = $this->noninherited_fields();
         foreach ($row as $field => $value) {
             $isinheritedfield = !in_array($field, $noninheritedfields);
             if ($isinheritedfield) {
                 if (isset($question->options->{$field}) && $question->options->{$field} !== null && $question->options->{$field} !== '' && $question->options->{$field} != $value) {
                     $question->options->customise = True;
                     // An inherited field has been changed
                 } else {
                     $question->options->{$field} = $value;
                 }
             }
         }
         if (!isset($question->options->sandbox)) {
             $question->options->sandbox = null;
         }
         if (!isset($question->options->grader)) {
             $question->options->grader = null;
         }
         if (!isset($question->options->sandboxparams) || trim($question->options->sandboxparams) === '') {
             $question->options->sandboxparams = null;
         }
     }
     // Add in any testcases (expect none for built-in prototypes)
     if (!($question->options->testcases = $DB->get_records('question_coderunner_tests', array('questionid' => $question->id), 'id ASC'))) {
         if ($question->options->prototypetype == 0 && $question->options->grader !== 'qtype_coderunner_combinator_template_grader') {
             throw new coderunner_exception("Failed to load testcases for question id {$question->id}");
         } else {
             // Question prototypes may not have testcases
             $question->options->testcases = array();
         }
     }
     return true;
 }
开发者ID:pac,项目名称:CodeRunner,代码行数:52,代码来源:questiontype.php

示例11: get_question_options

 public function get_question_options($question)
 {
     global $DB;
     $question->options = $DB->get_record($this->get_table_name(), array('questionid' => $question->id), '*', MUST_EXIST);
     return question_type::get_question_options($question);
 }
开发者ID:kikkomep,项目名称:moodle.omero-qtypes,代码行数:6,代码来源:questiontype_base.php


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