當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。