• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP question_type类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了question_type类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: print_qtype_to_add_option

/**
 * Private function used by the preceding one.
 * @param question_type $qtype the question type.
 */
function print_qtype_to_add_option($qtype) {
    echo '<div class="qtypeoption">' . "\n";
    echo '<label for="' . $qtype->plugin_name() . '">';
    echo '<input type="radio" name="qtype" id="' . $qtype->plugin_name() .
            '" value="' . $qtype->name() . '" />';
    echo '<span class="qtypename">';
    $fakequestion = new stdClass();
    $fakequestion->qtype = $qtype->name();
    echo print_question_icon($fakequestion);
    echo $qtype->menu_name() . '</span><span class="qtypesummary">' .
            get_string('pluginnamesummary', $qtype->plugin_name());
    echo "</span></label>\n";
    echo "</div>\n";
}
开发者ID:verbazend,项目名称:AWFA,代码行数:18,代码来源:editlib.php


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


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


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


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


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


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


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


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


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


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


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


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


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


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


示例17: delete_files

 protected function delete_files($questionid, $contextid)
 {
     parent::delete_files($questionid, $contextid);
     $this->delete_files_in_hints($questionid, $contextid);
 }
开发者ID:abhilash1994,项目名称:moodle,代码行数:5,代码来源:questiontype.php


示例18: export_to_xml

 public function export_to_xml($question, qformat_xml $format, $extra = null)
 {
     $output = parent::export_to_xml($question, $format);
     $output .= '    <delimitchars>' . $question->options->delimitchars . "</delimitchars>\n";
     $output .= '    <answerdisplay>' . $question->options->answerdisplay . "</answerdisplay>\n";
     $output .= '    <casesensitive>' . $question->options->casesensitive . "</casesensitive>\n";
     $output .= '    <noduplicates>' . $question->options->casesensitive . "</noduplicates>\n";
     $output .= $format->write_combined_feedback($question->options, $question->id, $question->contextid);
     return $output;
 }
开发者ID:dthies,项目名称:moodle-qtype_gapfill,代码行数:10,代码来源:questiontype.php


示例19: delete_question

 public function delete_question($questionid, $contextid)
 {
     global $DB;
     $DB->delete_records('question_randomsamatch', array('question' => $questionid));
     parent::delete_question($questionid, $contextid);
 }
开发者ID:helenagarcia90,项目名称:moodle,代码行数:6,代码来源:questiontype.php


示例20:

 /**
  * Add styles.css to the page's header
  */
 function get_html_head_contributions(&$question, &$state)
 {
     return parent::get_html_head_contributions($question, $state);
 }
开发者ID:sunilwebaccess,项目名称:moodle-question-matrix,代码行数:7,代码来源:questiontype.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP question_usage_by_activity类代码示例发布时间:2022-05-23
下一篇:
PHP question_state类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap