當前位置: 首頁>>代碼示例>>PHP>>正文


PHP question_attempt::get_last_step_with_qt_var方法代碼示例

本文整理匯總了PHP中question_attempt::get_last_step_with_qt_var方法的典型用法代碼示例。如果您正苦於以下問題:PHP question_attempt::get_last_step_with_qt_var方法的具體用法?PHP question_attempt::get_last_step_with_qt_var怎麽用?PHP question_attempt::get_last_step_with_qt_var使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在question_attempt的用法示例。


在下文中一共展示了question_attempt::get_last_step_with_qt_var方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: formulation_and_controls

 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     $question = $qa->get_question();
     $responseoutput = $question->get_format_renderer($this->page);
     // Answer field.
     $step = $qa->get_last_step_with_qt_var('answer');
     if (empty($options->readonly)) {
         $answer = $responseoutput->response_area_input('answer', $qa, $step, $question->responsefieldlines, $options->context);
     } else {
         $answer = $responseoutput->response_area_read_only('answer', $qa, $step, $question->responsefieldlines, $options->context);
     }
     $files = '';
     if ($question->attachments) {
         if (empty($options->readonly)) {
             $files = $this->files_input($qa, $question->attachments, $options);
         } else {
             $files = $this->files_read_only($qa, $options);
         }
     }
     $result = '';
     $result .= html_writer::tag('div', $question->format_questiontext($qa), array('class' => 'qtext'));
     $result .= html_writer::start_tag('div', array('class' => 'ablock'));
     $result .= html_writer::tag('div', $answer, array('class' => 'answer'));
     $result .= html_writer::tag('div', $files, array('class' => 'attachments'));
     $result .= html_writer::end_tag('div');
     return $result;
 }
開發者ID:rama1712,項目名稱:moodle,代碼行數:27,代碼來源:renderer.php

示例2: formulation_and_controls

 /**
  * Generates the web-side when te student is attempting the question. This is the side which is showed with the
  * question text and the response field
  */
 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     global $DB;
     $question = $qa->get_question();
     $responseoutput = $question->get_format_renderer($this->page);
     // Answer field.
     $step = $qa->get_last_step_with_qt_var('answer');
     // Get the question options to show the question text
     $question->options = $DB->get_record('qtype_javaunittest_options', array('questionid' => $question->id));
     $studentscode = $question->options->givencode;
     if (empty($options->readonly)) {
         $answer = $responseoutput->response_area_input('answer', $qa, $step, $question->responsefieldlines, $options->context, $studentscode);
     } else {
         $answer = $responseoutput->response_area_read_only('answer', $qa, $step, $question->responsefieldlines, $options->context, $studentscode);
     }
     // Generate the html code which will be showed
     $result = '';
     $result .= html_writer::tag('div', $question->format_questiontext($qa), array('class' => 'qtext'));
     $result .= html_writer::start_tag('div', array('class' => 'ablock'));
     $result .= html_writer::tag('div', $answer, array('class' => 'answer'));
     $result .= html_writer::end_tag('div');
     return $result;
 }
開發者ID:printz81,項目名稱:javaunittest,代碼行數:27,代碼來源:renderer.php

示例3: update_answers_single

 /**
  *
  *
  * @param array                              $answers The overall answers array that handles the count of answers
  * @param \question_attempt                  $qa
  * @param \qtype_multichoice_single_question $questiondef
  *
  */
 protected function update_answers_single(&$answers, $qa, $questiondef)
 {
     // get the latest step that has an answer
     $lastanswerstep = $qa->get_last_step_with_qt_var('answer');
     if ($lastanswerstep->has_qt_var('answer')) {
         // may not as if the step doesn't exist get last step will return empty read only step
         // get the student answer from the last answer step
         // along with the answers within the
         $answerorder = $questiondef->get_order($qa);
         $response = $lastanswerstep->get_qt_data();
         // make sure the response answer actually exists in the order
         if (array_key_exists($response['answer'], $answerorder)) {
             $studentanswer = $questiondef->answers[$answerorder[$response['answer']]];
             // update the count of the answerid on the answers array
             if (isset($answers[$studentanswer->id])) {
                 $current = (int) $answers[$studentanswer->id];
                 $answers[$studentanswer->id] = $current + 1;
             } else {
                 $answers[$studentanswer->id] = 1;
             }
         }
     }
 }
開發者ID:agarnav,項目名稱:moodle-mod_activequiz,代碼行數:31,代碼來源:multichoice.php


注:本文中的question_attempt::get_last_step_with_qt_var方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。