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


PHP question_edit_form::data_preprocessing方法代码示例

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


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

示例1: data_preprocessing

    protected function data_preprocessing($question) {
        $question = parent::data_preprocessing($question);

        if (empty($question->options)) {
            return $question;
        }

        $question->responseformat = $question->options->responseformat;
        $question->responsefieldlines = $question->options->responsefieldlines;
        $question->attachments = $question->options->attachments;

        $draftid = file_get_submitted_draft_itemid('graderinfo');
        $question->graderinfo = array();
        $question->graderinfo['text'] = file_prepare_draft_area(
            $draftid,           // draftid
            $this->context->id, // context
            'qtype_essay',      // component
            'graderinfo',       // filarea
            !empty($question->id) ? (int) $question->id : null, // itemid
            $this->fileoptions, // options
            $question->options->graderinfo // text
        );
        $question->graderinfo['format'] = $question->options->graderinfoformat;
        $question->graderinfo['itemid'] = $draftid;
        $question->responselimitpolicy = $question->options->responselimitpolicy;
        $question->wordlimit = $question->options->wordlimit;
        $question->charlimit = $question->options->charlimit;

        return $question;
    }
开发者ID:nickkoeppen,项目名称:moodle,代码行数:30,代码来源:edit_essay_form.php

示例2: data_preprocessing

    protected function data_preprocessing($question) {
        $question = parent::data_preprocessing($question);
        $question = $this->data_preprocessing_answers($question);
        $question = $this->data_preprocessing_hints($question);

        return $question;
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:7,代码来源:edit_shortanswer_form.php

示例3: data_preprocessing

    protected function data_preprocessing($question) {
        $question = parent::data_preprocessing($question);
        $question = $this->data_preprocessing_combined_feedback($question, true);
        $question = $this->data_preprocessing_hints($question, true, true);

        if (empty($question->options)) {
            return $question;
        }

        $question->shuffleanswers = $question->options->shuffleanswers;

        $key = 0;
        foreach ($question->options->subquestions as $subquestion) {
            $question->subanswers[$key] = $subquestion->answertext;

            $draftid = file_get_submitted_draft_itemid('subquestions[' . $key . ']');
            $question->subquestions[$key] = array();
            $question->subquestions[$key]['text'] = file_prepare_draft_area(
                $draftid,           // draftid
                $this->context->id, // context
                'qtype_match',      // component
                'subquestion',      // filarea
                !empty($subquestion->id) ? (int) $subquestion->id : null, // itemid
                $this->fileoptions, // options
                $subquestion->questiontext // text
            );
            $question->subquestions[$key]['format'] = $subquestion->questiontextformat;
            $question->subquestions[$key]['itemid'] = $draftid;
            $key++;
        }

        return $question;
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:33,代码来源:edit_match_form.php

示例4: data_preprocessing

 protected function data_preprocessing($question)
 {
     $question = parent::data_preprocessing($question);
     if (empty($question->options)) {
         return $question;
     }
     $question->responseformat = $question->options->responseformat;
     $question->responsefieldlines = $question->options->responsefieldlines;
     $question->attachments = $question->options->attachments;
     $question->boardsize = $question->options->boardsize;
     //Set backimage details, and configure a draft area to accept any uploaded pictures
     //all this and this whole method does, is to load existing files into a filearea
     //so it is not called when creating a new question, only when editing an existing one
     //best to use file_get_submitted_draft_itemid - because copying questions gets weird otherwise
     //$draftitemid =$question->options->backimage;
     $draftitemid = file_get_submitted_draft_itemid('backimage');
     file_prepare_draft_area($draftitemid, $this->context->id, 'qtype_poodllrecording', 'backimage', !empty($question->id) ? (int) $question->id : null, array('subdirs' => 0, 'maxbytes' => 0, 'maxfiles' => 1));
     $question->backimage = $draftitemid;
     $draftid = file_get_submitted_draft_itemid('graderinfo');
     $question->graderinfo = array();
     $question->graderinfo['text'] = file_prepare_draft_area($draftid, $this->context->id, 'qtype_poodllrecording', 'graderinfo', !empty($question->id) ? (int) $question->id : null, $this->fileoptions, $question->options->graderinfo);
     $question->graderinfo['format'] = $question->options->graderinfoformat;
     $question->graderinfo['itemid'] = $draftid;
     return $question;
 }
开发者ID:laiello,项目名称:poodll.poodll2,代码行数:25,代码来源:edit_poodllrecording_form.php

示例5: data_preprocessing

 protected function data_preprocessing($question)
 {
     $question = parent::data_preprocessing($question);
     // set the default text for question
     if ('' == $question->questiontext['text']) {
         $question->questiontext['text'] = get_string('default_question_text', 'qtype_' . $this->qtype());
     }
     return $question;
 }
开发者ID:roomlane,项目名称:moodle-qtype_vdmarker,代码行数:9,代码来源:edit_vdmarker_form_base.php

示例6: data_preprocessing

 protected function data_preprocessing($question)
 {
     $question = parent::data_preprocessing($question);
     $question = $this->data_preprocessing_answers($question);
     $question = $this->data_preprocessing_hints($question);
     if (!empty($question->options)) {
         $question->usecase = $question->options->usecase;
     }
     return $question;
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:10,代码来源:edit_shortanswer_form.php

示例7: data_preprocessing

 protected function data_preprocessing($question)
 {
     $question = parent::data_preprocessing($question);
     $question = $this->data_preprocessing_answers($question, true);
     $question = $this->data_preprocessing_combined_feedback($question, true);
     $question = $this->data_preprocessing_hints($question, true, true);
     if (!empty($question->options)) {
         $question->single = $question->options->single;
         $question->shuffleanswers = $question->options->shuffleanswers;
         $question->qdifficulty = $question->options->qdifficulty;
     }
     return $question;
 }
开发者ID:edwinphillips,项目名称:turmultiplechoice_2.7,代码行数:13,代码来源:edit_turmultiplechoice_form.php

示例8: data_preprocessing

 protected function data_preprocessing($question)
 {
     global $PAGE;
     $path = '/question/type/' . $this->question->qtype;
     $question = parent::data_preprocessing($question);
     $question = $this->data_preprocessing_answers($question);
     $question = $this->data_preprocessing_hints($question);
     $PAGE->requires->jquery();
     $PAGE->requires->js($path . '/js/IPAcontrols.js', true);
     $PAGE->requires->js($path . '/js/IPAcontrols_buttons.js', true);
     $PAGE->requires->css($path . '/css/IPA_buttons.css', true);
     return $question;
 }
开发者ID:AMUFacultyOfEnglish,项目名称:MoodlePlugin,代码行数:13,代码来源:edit_transcription_form.php

示例9: data_preprocessing

 protected function data_preprocessing($question)
 {
     $question = parent::data_preprocessing($question);
     if (empty($question->options)) {
         return $question;
     }
     $question->responseformat = $question->options->responseformat;
     $question->responsefieldlines = $question->options->responsefieldlines;
     $question->attachments = $question->options->attachments;
     $draftid = file_get_submitted_draft_itemid('graderinfo');
     $question->graderinfo = array();
     $question->graderinfo['text'] = file_prepare_draft_area($draftid, $this->context->id, 'qtype_poodllrecording', 'graderinfo', !empty($question->id) ? (int) $question->id : null, $this->fileoptions, $question->options->graderinfo);
     $question->graderinfo['format'] = $question->options->graderinfoformat;
     $question->graderinfo['itemid'] = $draftid;
     return $question;
 }
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:16,代码来源:edit_poodllrecording_form.php

示例10: data_preprocessing

    public function data_preprocessing($question) {
        $question = parent::data_preprocessing($question);

        if (!empty($question->options->trueanswer)) {
            $trueanswer = $question->options->answers[$question->options->trueanswer];
            $question->correctanswer = ($trueanswer->fraction != 0);

            $draftid = file_get_submitted_draft_itemid('trueanswer');
            $answerid = $question->options->trueanswer;

            $question->feedbacktrue = array();
            $question->feedbacktrue['format'] = $trueanswer->feedbackformat;
            $question->feedbacktrue['text'] = file_prepare_draft_area(
                $draftid,             // draftid
                $this->context->id,   // context
                'question',           // component
                'answerfeedback',     // filarea
                !empty($answerid) ? (int) $answerid : null, // itemid
                $this->fileoptions,   // options
                $trueanswer->feedback // text
            );
            $question->feedbacktrue['itemid'] = $draftid;
        }

        if (!empty($question->options->falseanswer)) {
            $falseanswer = $question->options->answers[$question->options->falseanswer];

            $draftid = file_get_submitted_draft_itemid('falseanswer');
            $answerid = $question->options->falseanswer;

            $question->feedbackfalse = array();
            $question->feedbackfalse['format'] = $falseanswer->feedbackformat;
            $question->feedbackfalse['text'] = file_prepare_draft_area(
                $draftid,              // draftid
                $this->context->id,    // context
                'question',            // component
                'answerfeedback',      // filarea
                !empty($answerid) ? (int) $answerid : null, // itemid
                $this->fileoptions,    // options
                $falseanswer->feedback // text
            );
            $question->feedbackfalse['itemid'] = $draftid;
        }

        return $question;
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:46,代码来源:edit_truefalse_form.php

示例11: data_preprocessing

 protected function data_preprocessing($question)
 {
     $question = parent::data_preprocessing($question);
     $question = $this->data_preprocessing_combined_feedback($question, true);
     $question = $this->data_preprocessing_hints($question, true, true);
     if (!empty($question->options)) {
         $question->choose = $question->options->choose;
         $question->subcats = $question->options->subcats;
     }
     if (empty($question->name)) {
         $question->name = get_string('randomsamatch', 'qtype_randomsamatch');
     }
     if (empty($question->questiontext)) {
         $question->questiontext = get_string('randomsamatchintro', 'qtype_randomsamatch');
     }
     return $question;
 }
开发者ID:pzhu2004,项目名称:moodle,代码行数:17,代码来源:edit_randomsamatch_form.php

示例12: foreach

 function data_preprocessing($question)
 {
     $question = parent::data_preprocessing($question);
     $question = $this->data_preprocessing_combined_feedback($question, true);
     $question = $this->data_preprocessing_hints($question, true, true);
     if (empty($question->options)) {
         return $question;
     }
     $question->horizontal = $question->options->horizontal;
     $key = 0;
     foreach ($question->options->subquestions as $subquestion) {
         $question->subanswers[$key] = $subquestion->answertext;
         $draftid = file_get_submitted_draft_itemid('subquestions[' . $key . ']');
         $question->subquestions[$key] = array();
         $question->subquestions[$key]['text'] = file_prepare_draft_area($draftid, $this->context->id, 'qtype_order', 'subquestion', !empty($subquestion->id) ? (int) $subquestion->id : null, $this->fileoptions, $subquestion->questiontext);
         $question->subquestions[$key]['format'] = $subquestion->questiontextformat;
         $question->subquestions[$key]['itemid'] = $draftid;
         $key++;
     }
     return $question;
 }
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:21,代码来源:edit_order_form.php

示例13: data_preprocessing

 protected function data_preprocessing($question)
 {
     $question = parent::data_preprocessing($question);
     $question = $this->data_preprocessing_answers($question, true);
     $question = $this->data_preprocessing_hints($question, true, true);
     if (!empty($question->options->answers)) {
         $key = 0;
         foreach ($question->options->answers as $answer) {
             $question->correctanswer[$key] = $answer->fraction > 0;
             $key++;
         }
     }
     if (!empty($question->hints)) {
         $key = 0;
         foreach ($question->hints as $hint) {
             $question->hintshowchoicefeedback[$key] = !empty($hint->options);
             $key += 1;
         }
     }
     if (!empty($question->options)) {
         $question->shuffleanswers = $question->options->shuffleanswers;
         $question->answernumbering = $question->options->answernumbering;
         $question->shownumcorrect = $question->options->shownumcorrect;
         // Prepare feedback editor to display files in draft area.
         foreach (array('correctfeedback', 'incorrectfeedback') as $feedbackname) {
             $draftid = file_get_submitted_draft_itemid($feedbackname);
             $text = $question->options->{$feedbackname};
             $feedbackformat = $feedbackname . 'format';
             $format = $question->options->{$feedbackformat};
             $defaultvalues[$feedbackname] = array();
             $defaultvalues[$feedbackname]['text'] = file_prepare_draft_area($draftid, $this->context->id, 'question', $feedbackname, !empty($question->id) ? (int) $question->id : null, $this->fileoptions, $text);
             $defaultvalues[$feedbackname]['format'] = $format;
             $defaultvalues[$feedbackname]['itemid'] = $draftid;
         }
         // Prepare files code block ends.
         $question = (object) ((array) $question + $defaultvalues);
     }
     return $question;
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:39,代码来源:edit_multichoiceset_form.php

示例14: data_preprocessing

 protected function data_preprocessing($question)
 {
     global $CFG, $PAGE, $SESSION;
     $question = parent::data_preprocessing($question);
     $question = $this->data_preprocessing_answers($question);
     $question = $this->data_preprocessing_hints($question);
     if (!empty($question->options)) {
         $question->usecase = $question->options->usecase;
         $question->usehint = $question->options->usehint;
         $question->studentshowalternate = $question->options->studentshowalternate;
     } else {
         $key = 0;
         $default_values['fraction[' . $key . ']'] = 1;
         $question = (object) ((array) $question + $default_values);
     }
     // disable the score dropdown list for Answer 1 to make sure it remains at 100%
     // grade for Answer 1 will need to be automatically set to 1 in questiontype.php,  save_question_options($question)
     $i = 1;
     foreach ($this->_form->_elements as $element) {
         if ($element->_attributes['name'] == 'fraction[0]') {
             break;
         }
         $i++;
     }
     $this->_form->_elements[$i]->_attributes['disabled'] = 'disabled';
     return $question;
 }
开发者ID:rezeau,项目名称:moodle-qtype_regexp,代码行数:27,代码来源:edit_regexp_form.php

示例15: data_preprocessing

 public function data_preprocessing($question)
 {
     $question = parent::data_preprocessing($question);
     $question = $this->data_preprocessing_answers($question, false);
     $question = $this->data_preprocessing_combined_feedback($question, true);
     $question = $this->data_preprocessing_hints($question, true, true);
     if (isset($question->options)) {
         $question->synchronize = $question->options->synchronize;
         $question->single = $question->options->single;
         $question->answernumbering = $question->options->answernumbering;
         $question->shuffleanswers = $question->options->shuffleanswers;
     }
     return $question;
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:14,代码来源:edit_calculatedmulti_form.php


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