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

PHP get_question_image函数代码示例

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

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



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

示例1: print_question

 function print_question(&$question, &$state, $number, $cmoptions, $options)
 {
     global $CFG;
     $isfinished = question_state_is_graded($state->last_graded) || $state->event == QUESTION_EVENTCLOSE;
     if (!empty($cmoptions->id)) {
         $cm = get_coursemodule_from_instance('quiz', $cmoptions->id);
         $cmorcourseid = '&cmid=' . $cm->id;
     } else {
         if (!empty($cmoptions->course)) {
             $cmorcourseid = '&courseid=' . $cmoptions->course;
         } else {
             error('Need to provide courseid or cmid to print_question.');
         }
     }
     // For editing teachers print a link to an editing popup window
     $editlink = '';
     if (question_has_capability_on($question, 'edit')) {
         $stredit = get_string('edit');
         $linktext = '<img src="' . $CFG->pixpath . '/t/edit.gif" alt="' . $stredit . '" />';
         $editlink = link_to_popup_window('/question/question.php?id=' . $question->id . $cmorcourseid, $stredit, $linktext, 450, 550, $stredit, '', true);
     }
     $questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions);
     $image = get_question_image($question);
     $generalfeedback = '';
     if ($isfinished && $options->generalfeedback) {
         $generalfeedback = $this->format_text($question->generalfeedback, $question->questiontextformat, $cmoptions);
     }
     include "{$CFG->dirroot}/question/type/description/question.html";
 }
开发者ID:r007,项目名称:PMoodle,代码行数:29,代码来源:questiontype.php


示例2: print_question_formulation_and_controls

 function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options)
 {
     global $CFG, $USER;
     static $htmleditorused = false;
     $answers =& $question->options->answers;
     $readonly = empty($options->readonly) ? '' : 'disabled="disabled"';
     // *RELIC of essay question type* Only use the rich text editor for the first poodllrecording question on a page.
     //  $usehtmleditor = can_use_html_editor() && !$htmleditorused;
     $formatoptions = new stdClass();
     $formatoptions->noclean = true;
     $formatoptions->para = false;
     $inputname = $question->name_prefix;
     $stranswer = get_string("answer", "quiz") . ': ';
     /// set question text and media
     $questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course);
     $image = get_question_image($question);
     // feedback handling
     $feedback = '';
     if ($options->feedback && !empty($answers)) {
         foreach ($answers as $answer) {
             $feedback = format_text($answer->feedback, '', $formatoptions, $cmoptions->course);
         }
     }
     // get response value
     if (isset($state->responses[''])) {
         //relic of essay question type
         //$value = stripslashes_safe($state->responses['']);
         $value = $state->responses[''];
     } else {
         $value = "";
     }
     // answer
     if (empty($options->readonly)) {
         // *RELIC of essay question type* the student needs to record their voice  or video so lets give them their recorder.
         // $answer = print_textarea($usehtmleditor, 18, 80, 630, 400, $inputname, $value, $cmoptions->course, true);
         $answer = fetchSimpleAudioRecorder('question/' . $question->id, $USER->id, $inputname, '') . '<input type="hidden" value="" id="' . $inputname . '" name="' . $inputname . '" />';
     } else {
         // it is read only, so just format the students answer and output it
         // *RELIC of essay question type*
         /*
           $safeformatoptions = new stdClass;
           $safeformatoptions->para = false;
           $answer = format_text($value, FORMAT_MOODLE,
                                 $safeformatoptions, $cmoptions->course);
         			$answer = '<div class="answerreview">' . $answer . '</div>';					  
         */
         //$answer = $value ;
         //this will show an audio player both to the grading teacher and to the student reviewing
         $answer = fetchSimpleAudioPlayer($value, 'rtmp', 250, 30, false);
     }
     include "{$CFG->dirroot}/question/type/poodllrecording/display.html";
     // *RELIC of essay question type*
     /*
             if ($usehtmleditor && empty($options->readonly)) {
                 use_html_editor($inputname);
                 $htmleditorused = true;
             }
     */
 }
开发者ID:laiello,项目名称:poodll,代码行数:59,代码来源:questiontype.php


示例3: question_image2text

/**
* 获得试题图片合法地址
*
* @param   string   $content  需要替换图片的试题内容
* @param   string   $file     试题图片地址
* @param   string   $dir      试题图片目录  可选值: body 	   > 试题标题
                                                 desc 	   > 试题解析 
												  material > 资料题材料
												  tag      > TAG标签文本

* @return  array
*/
function question_image2text($content, $file, $dir = 'body')
{
    if (!$file || !$content) {
        return $content;
    }
    $files = get_question_image($file, $dir);
    $content = str_replace($files['files'], $files['imgs'], $content);
    return $content;
}
开发者ID:88659108,项目名称:tiku-system,代码行数:21,代码来源:function.php


示例4: print_question

 function print_question(&$question, &$state, $number, $cmoptions, $options)
 {
     global $CFG;
     $isfinished = question_state_is_graded($state->last_graded) || $state->event == QUESTION_EVENTCLOSE;
     // For editing teachers print a link to an editing popup window
     $editlink = $this->get_question_edit_link($question, $cmoptions, $options);
     $questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions);
     $image = get_question_image($question);
     $generalfeedback = '';
     if ($isfinished && $options->generalfeedback) {
         $generalfeedback = $this->format_text($question->generalfeedback, $question->questiontextformat, $cmoptions);
     }
     include "{$CFG->dirroot}/question/type/description/question.html";
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:14,代码来源:questiontype.php


示例5: print_question_formulation_and_controls

 function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options)
 {
     global $CFG;
     static $htmleditorused = false;
     $answers =& $question->options->answers;
     $readonly = empty($options->readonly) ? '' : 'disabled="disabled"';
     // Only use the rich text editor for the first essay question on a page.
     $usehtmleditor = can_use_html_editor() && !$htmleditorused;
     $formatoptions = new stdClass();
     $formatoptions->noclean = true;
     $formatoptions->para = false;
     $inputname = $question->name_prefix;
     $stranswer = get_string("answer", "quiz") . ': ';
     /// set question text and media
     $questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course);
     $image = get_question_image($question);
     // feedback handling
     $feedback = '';
     if ($options->feedback && !empty($answers)) {
         foreach ($answers as $answer) {
             $feedback = format_text($answer->feedback, '', $formatoptions, $cmoptions->course);
         }
     }
     // get response value
     if (isset($state->responses[''])) {
         $value = stripslashes_safe($state->responses['']);
     } else {
         $value = "";
     }
     // answer
     if (empty($options->readonly)) {
         // the student needs to type in their answer so print out a text editor
         $answer = print_textarea($usehtmleditor, 18, 80, 630, 400, $inputname, $value, $cmoptions->course, true);
     } else {
         // it is read only, so just format the students answer and output it
         $safeformatoptions = new stdClass();
         $safeformatoptions->para = false;
         $answer = format_text($value, FORMAT_MOODLE, $safeformatoptions, $cmoptions->course);
         $answer = '<div class="answerreview">' . $answer . '</div>';
     }
     include "{$CFG->dirroot}/question/type/essay/display.html";
     if ($usehtmleditor && empty($options->readonly)) {
         use_html_editor($inputname);
         $htmleditorused = true;
     }
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:46,代码来源:questiontype.php


示例6: print_question

 function print_question(&$question, &$state, $number, $cmoptions, $options)
 {
     global $CFG;
     $isfinished = question_state_is_graded($state->last_graded) || $state->event == QUESTION_EVENTCLOSE;
     // For editing teachers print a link to an editing popup window
     $editlink = '';
     if (has_capability('moodle/question:manage', get_context_instance(CONTEXT_COURSE, $cmoptions->course))) {
         $stredit = get_string('edit');
         $linktext = '<img src="' . $CFG->pixpath . '/t/edit.gif" alt="' . $stredit . '" />';
         $editlink = link_to_popup_window('/question/question.php?id=' . $question->id, $stredit, $linktext, 450, 550, $stredit, '', true);
     }
     $questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions);
     $image = get_question_image($question, $cmoptions->course);
     $generalfeedback = '';
     if ($isfinished && $options->generalfeedback) {
         $generalfeedback = $this->format_text($question->generalfeedback, $question->questiontextformat, $cmoptions);
     }
     include "{$CFG->dirroot}/question/type/description/question.html";
 }
开发者ID:veritech,项目名称:pare-project,代码行数:19,代码来源:questiontype.php


示例7: print_question_formulation_and_controls

 function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options)
 {
     global $CFG;
     $answers =& $question->options->answers;
     $formatoptions = new stdClass();
     $formatoptions->noclean = true;
     $formatoptions->para = false;
     // Print formulation
     $questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course);
     $image = get_question_image($question);
     // Print each answer in a separate row if there are any
     $anss = array();
     if ($answers) {
         foreach ($answers as $answer) {
             $a = new stdClass();
             $a->text = format_text("{$answer->answer}", FORMAT_MOODLE, $formatoptions, $cmoptions->course);
             $anss[] = clone $a;
         }
     }
     include "{$CFG->dirroot}/question/type/missingtype/display.html";
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:21,代码来源:questiontype.php


示例8: print_question_formulation_and_controls

 function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options)
 {
     global $CFG;
     /// This implementation is also used by question type 'numerical'
     $readonly = empty($options->readonly) ? '' : 'readonly="readonly"';
     $formatoptions = new stdClass();
     $formatoptions->noclean = true;
     $formatoptions->para = false;
     $nameprefix = $question->name_prefix;
     /// Print question text and media
     $questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course);
     $image = get_question_image($question);
     $this->compute_feedbackperconditions($question, $state);
     /// Print input controls
     $values = array();
     $params = explode(",", $question->options->parameters);
     foreach ($params as &$param) {
         $param = trim($param);
         $paramparts = explode(" ", $param);
         $paramname = trim($paramparts[0]);
         $paramunity = trim($paramparts[1]);
         if (isset($state->responses[$paramname]) && $state->responses[$paramname] != '') {
             $value[$paramname] = ' value="' . s($state->responses[$paramname], true) . '" ';
         } else {
             $value[$paramname] = ' value="" ';
         }
         $inputname[$paramname] = ' name="' . $nameprefix . $paramname . '" ';
     }
     $feedback = '';
     $class = '';
     $feedbackimg = '';
     $feedbackperconditions = '';
     if ($options->feedback) {
         $class = question_get_feedback_class($state->raw_grade);
         $feedbackimg = question_get_feedback_image($state->raw_grade);
         $feedbackperconditions = $question->options->computedfeedbackperconditions;
     }
     include "{$CFG->dirroot}/question/type/multinumerical/display.html";
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:39,代码来源:questiontype.php


示例9: print_question_formulation_and_controls

 /**
  * Prints the main content of the question including any interactions
  */
 function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options)
 {
     global $CFG;
     $readonly = $options->readonly ? ' disabled="disabled"' : '';
     $formatoptions = new stdClass();
     $formatoptions->noclean = true;
     $formatoptions->para = false;
     // Print question formulation
     $questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course);
     $image = get_question_image($question);
     $answers =& $question->options->answers;
     $trueanswer =& $answers[$question->options->trueanswer];
     $falseanswer =& $answers[$question->options->falseanswer];
     $correctanswer = $trueanswer->fraction == 1 ? $trueanswer : $falseanswer;
     $trueclass = '';
     $falseclass = '';
     $truefeedbackimg = '';
     $falsefeedbackimg = '';
     // Work out which radio button to select (if any)
     if (isset($state->responses[''])) {
         $response = $state->responses[''];
     } else {
         $response = '';
     }
     $truechecked = $response == $trueanswer->id ? ' checked="checked"' : '';
     $falsechecked = $response == $falseanswer->id ? ' checked="checked"' : '';
     // Work out visual feedback for answer correctness.
     if ($options->feedback) {
         if ($truechecked) {
             $trueclass = question_get_feedback_class($trueanswer->fraction);
         } else {
             if ($falsechecked) {
                 $falseclass = question_get_feedback_class($falseanswer->fraction);
             }
         }
     }
     if ($options->feedback || $options->correct_responses) {
         if (isset($answers[$response])) {
             $truefeedbackimg = question_get_feedback_image($trueanswer->fraction, !empty($truechecked) && $options->feedback);
             $falsefeedbackimg = question_get_feedback_image($falseanswer->fraction, !empty($falsechecked) && $options->feedback);
         }
     }
     $inputname = ' name="' . $question->name_prefix . '" ';
     $trueid = $question->name_prefix . 'true';
     $falseid = $question->name_prefix . 'false';
     $radiotrue = '<input type="radio"' . $truechecked . $readonly . $inputname . 'id="' . $trueid . '" value="' . $trueanswer->id . '" /><label for="' . $trueid . '">' . s($trueanswer->answer) . '</label>';
     $radiofalse = '<input type="radio"' . $falsechecked . $readonly . $inputname . 'id="' . $falseid . '" value="' . $falseanswer->id . '" /><label for="' . $falseid . '">' . s($falseanswer->answer) . '</label>';
     $feedback = '';
     if ($options->feedback and isset($answers[$response])) {
         $chosenanswer = $answers[$response];
         $feedback = format_text($chosenanswer->feedback, true, $formatoptions, $cmoptions->course);
     }
     include "{$CFG->dirroot}/question/type/truefalse/display.html";
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:57,代码来源:questiontype.php


示例10: wrsqz_print_question_formulation_and_controls

/**
 * Prints the question body. Since standard moodle question functions set up
 * variables and prints html in the same function, we cannot call these functions.
 * So, the most code of this function (specially the type-specific part) is copied
 * from the standard moodle question types.
 * **/
function wrsqz_print_question_formulation_and_controls($questionType, $dbType, &$question, &$state, &$cmoptions, &$options) {
	//COMMON VARIABLES:
  global $CFG, $QTYPES;
  //1. Question text
  $formatoptions = new stdClass;
  $formatoptions->noclean = true;
  $formatoptions->para = false;

  $questiontext = format_text($question->questiontext, $question->questiontextformat,
                              $formatoptions, $cmoptions->course);

  //2. Question image
  $image = get_question_image($question);

  //3. name & strings
  $inputname = $question->name_prefix;
  $stranswer = get_string("answer", "quiz").': ';

  //4. WIRIS CAS applet
  $wirisCASApplet = '';
  $wirisCASForComputationsEnabled = !empty($question->options->wiris->options['wirisCASForComputations']);
  if($wirisCASForComputationsEnabled){
    $wirisCASContent = '';
    if (!empty($state->responses['wirisCASHidden'])) {
      $wirisCASContent = htmlentities(stripslashes_safe($state->responses['wirisCASHidden']), ENT_QUOTES, 'UTF-8');
      unset($state->responses['wirisCASHidden']);
    }else if(!empty($question->options->wiris->options['hiddenInitialCASValue'])){
      $wirisCASContent = htmlentities(stripslashes_safe($question->options->wiris->options['hiddenInitialCASValue']), ENT_QUOTES, 'UTF-8');
    }
    $wirisCASApplet = wrsqz_wirisCASAppletHTML($inputname, $wirisCASContent, false, 630, 300);
    require_js(array('yui_yahoo', 'yui_dom-event'));
    require_js(array($CFG->wwwroot.'/wiris-quizzes/js/wiris-quizzes.js',$CFG->wwwroot.'/wiris-quizzes/js/constants.js.php'));
  }
  
  //ANSWER FIELDS & FEEDBACK: QUESTION-TYPE specific
  if($questionType == 'essay'){
    // Response
    if (isset($state->responses[''])) {
      $value = stripslashes_safe($state->responses['']);
    }else{
      $value = "";
    }
    //answer
    if($wirisCASForComputationsEnabled){
      $wirisCASForComputations = $question->options->wiris->options['wirisCASForComputations'];
    }else{
      $wirisCASForComputations = '0';
    }
    //replace answer by an applet
    if($wirisCASForComputations == '2'){
      $answer = $wirisCASApplet;
      $answer .= '<input type="hidden" name="'.$inputname.'" id="edit-'.$inputname.'"/>';
      $wirisCASApplet = '';
    }else{
      if (empty($options->readonly)) {
        static $htmleditorused = false;
        $usehtmleditor = can_use_html_editor() && !$htmleditorused;
        // the student needs to type in their answer so print out a text editor
        echo '<!-- yes we can: '.$usehtmleditor.'-->';
        $answer = print_textarea($usehtmleditor, 18, 80, 630, 400, $inputname, $value, $cmoptions->course, true);
      }else{
        //it is read only, so just format the students answer and output it
        $safeformatoptions = new stdClass;
        $safeformatoptions->para = false;
        $answer = format_text($value, FORMAT_MOODLE, $safeformatoptions, $cmoptions->course);
        $answer = '<div class="answerreview">' . $answer . '</div>';
      }
      if($wirisCASForComputationsEnabled){
        $wirisCASApplet = '<tr><td>'.$wirisCASApplet.'</td></tr>';
      }
    }
    
    // feedback handling
    $feedback = '';
    if ($options->feedback && !empty($answers)) {
      foreach ($answers as $answer) {
        $feedback = format_text($answer->feedback, '', $formatoptions, $cmoptions->course);
      }
    }
    
  }else if($questionType == 'match'){
    $subquestions   = $state->options->subquestions;
    $correctanswers = $QTYPES[$question->qtype]->get_correct_responses($question, $state);
    $answers        = array(); // Answer choices formatted ready for output.
    $allanswers     = array(); // This and the next used to detect identical answers
    $answerids      = array(); // and adjust ids.
    $responses      = &$state->responses;

    // Prepare a list of answers, removing duplicates.
    foreach ($subquestions as $subquestion) {
      foreach ($subquestion->options->answers as $ans) {
        $allanswers[$ans->id] = $ans->answer;
        if (!in_array($ans->answer, $answers)) {
          $answers[$ans->id] = strip_tags(format_string($ans->answer, false));
//.........这里部分代码省略.........
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:101,代码来源:libquestiontype.php


示例11: print_question_formulation_and_controls

 function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options)
 {
     global $CFG, $OUTPUT;
     $subquestions = $state->options->subquestions;
     $correctanswers = $this->get_correct_responses($question, $state);
     $nameprefix = $question->name_prefix;
     $answers = array();
     // Answer choices formatted ready for output.
     $allanswers = array();
     // This and the next used to detect identical answers
     $answerids = array();
     // and adjust ids.
     $responses =& $state->responses;
     // Prepare a list of answers, removing duplicates.
     foreach ($subquestions as $subquestion) {
         foreach ($subquestion->options->answers as $ans) {
             $allanswers[$ans->id] = $ans->answer;
             if (!in_array($ans->answer, $answers)) {
                 $answers[$ans->id] = strip_tags(format_string($ans->answer, false));
                 $answerids[$ans->answer] = $ans->id;
             }
         }
     }
     // Fix up the ids of any responses that point the the eliminated duplicates.
     foreach ($responses as $subquestionid => $ignored) {
         if ($responses[$subquestionid]) {
             $responses[$subquestionid] = $answerids[$allanswers[$responses[$subquestionid]]];
         }
     }
     foreach ($correctanswers as $subquestionid => $ignored) {
         $correctanswers[$subquestionid] = $answerids[$allanswers[$correctanswers[$subquestionid]]];
     }
     // Shuffle the answers
     $answers = draw_rand_array($answers, count($answers));
     // Print formulation
     $questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions);
     $image = get_question_image($question);
     // Print the input controls
     foreach ($subquestions as $key => $subquestion) {
         if ($subquestion->questiontext !== '' && !is_null($subquestion->questiontext)) {
             // Subquestion text:
             $a = new stdClass();
             $a->text = $this->format_text($subquestion->questiontext, $question->questiontextformat, $cmoptions);
             // Drop-down list:
             $menuname = $nameprefix . $subquestion->id;
             $response = isset($state->responses[$subquestion->id]) ? $state->responses[$subquestion->id] : '0';
             $a->class = ' ';
             $a->feedbackimg = ' ';
             if ($options->readonly and $options->correct_responses) {
                 if (isset($correctanswers[$subquestion->id]) and $correctanswers[$subquestion->id] == $response) {
                     $correctresponse = 1;
                 } else {
                     $correctresponse = 0;
                 }
                 if ($options->feedback && $response) {
                     $a->class = question_get_feedback_class($correctresponse);
                     $a->feedbackimg = question_get_feedback_image($correctresponse);
                 }
             }
             $select = html_select::make($answers, $menuname, $response);
             $select->disabled = $options->readonly;
             $a->control = $OUTPUT->select($select);
             // Neither the editing interface or the database allow to provide
             // fedback for this question type.
             // However (as was pointed out in bug bug 3294) the randomsamatch
             // type which reuses this method can have feedback defined for
             // the wrapped shortanswer questions.
             //if ($options->feedback
             // && !empty($subquestion->options->answers[$responses[$key]]->feedback)) {
             //    print_comment($subquestion->options->answers[$responses[$key]]->feedback);
             //}
             $anss[] = $a;
         }
     }
     include "{$CFG->dirroot}/question/type/match/display.html";
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:76,代码来源:questiontype.php


示例12: print_question_formulation_and_controls

 /**
  * @desc Prints the question. Calls question_webwork_derived, and prints out the html associated with derivedid.
  * @param $question object The question object to print.
  * @param $state object The state of the responses for the question.
  * @param $cmoptions object Options containing course ID.
  * @param $options object
  */
 function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options)
 {
     global $CFG, $USER;
     $readonly = empty($options->readonly) ? '' : 'disabled="disabled"';
     //Formulate question image and text
     $questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions);
     $image = get_question_image($question, $cmoptions->course);
     $derivationid = $state->responses['derivationid'];
     $derivation = get_record('question_webwork_derived', 'id', $derivationid);
     $unparsedhtml = base64_decode($derivation->html);
     //partial answers
     $showPartiallyCorrectAnswers = $question->grading;
     //new array keyed by field
     $fieldhash = $state->responses['answers'];
     $answerfields = array();
     $parser = new HtmlParser($unparsedhtml);
     $currentselect = "";
     while ($parser->parse()) {
         //change some attributes of html tags for moodle compliance
         if ($parser->iNodeType == NODE_TYPE_ELEMENT) {
             $nodename = $parser->iNodeName;
             $name = $parser->iNodeAttributes['name'];
             //handle generic change of node's attribute name
             if ($nodename == "INPUT" || $nodename == "SELECT" || $nodename == "TEXTAREA") {
                 $parser->iNodeAttributes['name'] = 'resp' . $question->id . '_' . $name;
                 if ($state->event == QUESTION_EVENTGRADE && isset($fieldhash[$name])) {
                     if ($showPartiallyCorrectAnswers) {
                         $parser->iNodeAttributes['class'] = $parser->iNodeAttributes['class'] . ' ' . question_get_feedback_class($fieldhash[$name]['score']);
                     }
                 }
                 if (!strstr($name, 'previous')) {
                     $answerfields[$name] = $fieldhash[$name];
                 }
             }
             //handle specific change
             if ($nodename == "INPUT") {
                 //put submitted value into field
                 if (isset($fieldhash[$name])) {
                     $parser->iNodeAttributes['value'] = $fieldhash[$name]['answer'];
                 }
             } else {
                 if ($nodename == "SELECT") {
                     $currentselect = $name;
                 } else {
                     if ($nodename == "OPTION") {
                         if ($parser->iNodeAttributes['value'] == $fieldhash[$currentselect]['answer']) {
                             $parser->iNodeAttributes['selected'] = '1';
                         }
                     } else {
                         if ($nodename == "TEXTAREA") {
                         }
                     }
                 }
             }
         }
         $problemhtml .= $parser->printTag();
     }
     //for the seed form field
     $qid = $question->id;
     $seed = $state->responses['seed'];
     //if the student has answered
     include "{$CFG->dirroot}/question/type/webwork/display.html";
 }
开发者ID:bjornbe,项目名称:wwassignment,代码行数:70,代码来源:questiontype.php


示例13: print_question_formulation_and_controls

 /**
  * Format question display
  */
 function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options)
 {
     global $CFG;
     require_once $CFG->libdir . '/formslib.php';
     $readonly = empty($options->readonly) ? '' : 'disabled="disabled"';
     static $htmleditorused = false;
     // Print formulation
     $questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions);
     $image = get_question_image($question);
     $maxbytes = $question->options->maxbytes;
     $showessay = $question->options->essay;
     $answers =& $question->options->answers;
     $readonly = empty($options->readonly) ? '' : 'disabled="disabled"';
     // Only use the rich text editor for the first essay question on a page.
     $usehtmleditor = can_use_html_editor() && !$htmleditorused;
     $formatoptions = new stdClass();
     $formatoptions->noclean = true;
     $formatoptions->para = false;
     $inputname = $question->name_prefix;
     /// set question text and media
     $questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course);
     // get essay response value
     if (isset($state->responses[''])) {
         $value = stripslashes_safe($state->responses['']);
     } else {
         $value = "";
     }
     // essay answer
     $answer = '';
     if ($showessay) {
         if (empty($options->readonly)) {
             // the student needs to type in their answer so print out a text editor
             $answer = print_textarea($usehtmleditor, 18, 80, 630, 400, $inputname, $value, $cmoptions->course, true);
         } else {
             // it is read only, so just format the students answer and output it
             $safeformatoptions = new stdClass();
             $safeformatoptions->para = false;
             $answer = format_text($value, FORMAT_MOODLE, $safeformatoptions, $cmoptions->course);
         }
     }
     // set the file input form
     $struploadform = upload_print_form_fragment(1, array($question->name_prefix . "file"), null, false, null, 0, $maxbytes, true);
     // set file upload feedback and display of uploaded file
     $uploadfeedback = '';
     if (isset($state->uploadfeedback)) {
         $uploadfeedback = $state->uploadfeedback;
     }
     $struploadedfile = '';
     $currentfile = get_student_answer($state->attempt, $question->id);
     if ($currentfile) {
         $struploadedfile = get_string('answer', 'quiz') . ': ' . $currentfile;
     }
     // string prompts for form
     if ($currentfile) {
         $struploadfile = get_string('uploadnew', 'qtype_fileresponse');
     } else {
         $struploadfile = get_string('uploadafile');
     }
     $strmaxsize = get_string('maximumupload') . ' ' . display_size($maxbytes);
     include "{$CFG->dirroot}/question/type/fileresponse/display.html";
     if ($usehtmleditor) {
         use_html_editor($inputname);
         $htmleditorused = true;
     }
 }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:68,代码来源:questiontype.php


示例14: print_question_formulation_and_controls

 function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options)
 {
     global $CFG;
     /// This implementation is also used by question type 'numerical'
     $readonly = empty($options->readonly) ? '' : 'readonly="readonly"';
     $formatoptions = new stdClass();
     $formatoptions->noclean = true;
     $formatoptions->para = false;
     $nameprefix = $question->name_prefix;
     /// Print question text and media
     $questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course);
     $image = get_question_image($question, $cmoptions->course);
     /// Print input controls
     if (isset($state->responses['']) && $state->responses[''] != '') {
         $value = ' value="' . s($state->responses[''], true) . '" ';
     } else {
         $value = ' value="" ';
     }
     $inputname = ' name="' . $nameprefix . '" ';
     $feedback = '';
     $class = '';
     $feedbackimg = '';
     if ($options->feedback) {
         $class = question_get_feedback_class(0);
         $feedbackimg = question_get_feedback_image(0);
         foreach ($question->options->answers as $answer) {
             if ($this->test_response($question, $state, $answer)) {
                 // Answer was correct or partially correct.
                 $class = question_get_feedback_class($answer->fraction);
                 $feedbackimg = question_get_feedback_image($answer->fraction);
                 if ($answer->feedback) {
                     $feedback = format_text($answer->feedback, true, $formatoptions, $cmoptions->course);
                 }
                 break;
             }
         }
     }
     /// Removed correct answer, to be displayed later MDL-7496
     include "{$CFG->dirroot}/question/type/shortanswer/display.html";
 }
开发者ID:veritech,项目名称:pare-project,代码行数:40,代码来源:questiontype.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_question_options函数代码示例发布时间:2022-05-15
下一篇:
PHP get_question_id函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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