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


PHP quiz_attempt::get_question_attempt方法代码示例

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


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

示例1: get_question_buttons

 /**
  * Get the buttons and section headings to go in the quiz navigation block.
  * @return renderable[] the buttons, possibly interleaved with section headings.
  */
 public function get_question_buttons()
 {
     $buttons = array();
     foreach ($this->attemptobj->get_slots() as $slot) {
         if ($heading = $this->attemptobj->get_heading_before_slot($slot)) {
             $buttons[] = new quiz_nav_section_heading(format_string($heading));
         }
         $qa = $this->attemptobj->get_question_attempt($slot);
         $showcorrectness = $this->options->correctness && $qa->has_marks();
         $button = new quiz_nav_question_button();
         $button->id = 'quiznavbutton' . $slot;
         $button->number = $this->attemptobj->get_question_number($slot);
         $button->stateclass = $qa->get_state_class($showcorrectness);
         $button->navmethod = $this->attemptobj->get_navigation_method();
         if (!$showcorrectness && $button->stateclass == 'notanswered') {
             $button->stateclass = 'complete';
         }
         $button->statestring = $this->get_state_string($qa, $showcorrectness);
         $button->page = $this->attemptobj->get_question_page($slot);
         $button->currentpage = $this->showall || $button->page == $this->page;
         $button->flagged = $qa->is_flagged();
         $button->url = $this->get_question_url($slot);
         if ($this->attemptobj->is_blocked_by_previous_question($slot)) {
             $button->url = null;
             $button->stateclass = 'blocked';
             $button->statestring = get_string('questiondependsonprevious', 'quiz');
         }
         $buttons[] = $button;
     }
     return $buttons;
 }
开发者ID:elie89,项目名称:moodle,代码行数:35,代码来源:attemptlib.php

示例2: get_question_buttons

 public function get_question_buttons()
 {
     $buttons = array();
     foreach ($this->attemptobj->get_slots() as $slot) {
         $qa = $this->attemptobj->get_question_attempt($slot);
         $showcorrectness = $this->options->correctness && $qa->has_marks();
         $button = new quiz_nav_question_button();
         $button->id = 'quiznavbutton' . $slot;
         $button->number = $this->attemptobj->get_question_number($slot);
         $button->stateclass = $qa->get_state_class($showcorrectness);
         $button->navmethod = $this->attemptobj->get_navigation_method();
         if (!$showcorrectness && $button->stateclass == 'notanswered') {
             $button->stateclass = 'complete';
         }
         $button->statestring = $this->get_state_string($qa, $showcorrectness);
         $button->currentpage = $this->attemptobj->get_question_page($slot) == $this->page;
         $button->flagged = $qa->is_flagged();
         $button->url = $this->get_question_url($slot);
         $buttons[] = $button;
     }
     return $buttons;
 }
开发者ID:eamador,项目名称:moodle-course-custom-fields,代码行数:22,代码来源:attemptlib.php

示例3: get_attempt_questions_data

 /**
  * Return questions information for a given attempt.
  *
  * @param  quiz_attempt  $attemptobj  the quiz attempt object
  * @param  bool  $review  whether if we are in review mode or not
  * @param  mixed  $page  string 'all' or integer page number
  * @return array array of questions including data
  */
 private static function get_attempt_questions_data(quiz_attempt $attemptobj, $review, $page = 'all')
 {
     global $PAGE;
     $questions = array();
     $contextid = $attemptobj->get_quizobj()->get_context()->id;
     $displayoptions = $attemptobj->get_display_options($review);
     $renderer = $PAGE->get_renderer('mod_quiz');
     foreach ($attemptobj->get_slots($page) as $slot) {
         $question = array('slot' => $slot, 'type' => $attemptobj->get_question_type_name($slot), 'page' => $attemptobj->get_question_page($slot), 'flagged' => $attemptobj->is_question_flagged($slot), 'html' => $attemptobj->render_question($slot, $review, $renderer) . $PAGE->requires->get_end_code());
         if ($attemptobj->is_real_question($slot)) {
             $question['number'] = $attemptobj->get_question_number($slot);
             $question['state'] = (string) $attemptobj->get_question_state($slot);
             $question['status'] = $attemptobj->get_question_status($slot, $displayoptions->correctness);
         }
         if ($displayoptions->marks >= question_display_options::MAX_ONLY) {
             $question['maxmark'] = $attemptobj->get_question_attempt($slot)->get_max_mark();
         }
         if ($displayoptions->marks >= question_display_options::MARK_AND_MAX) {
             $question['mark'] = $attemptobj->get_question_mark($slot);
         }
         $questions[] = $question;
     }
     return $questions;
 }
开发者ID:IFPBMoodle,项目名称:moodle,代码行数:32,代码来源:external.php

示例4: process_submitted_data

 protected function process_submitted_data()
 {
     global $DB;
     $qubaids = optional_param('qubaids', null, PARAM_SEQUENCE);
     $assumedslotforevents = optional_param('slot', null, PARAM_INT);
     if (!$qubaids) {
         return;
     }
     $qubaids = clean_param_array(explode(',', $qubaids), PARAM_INT);
     $attempts = $this->load_attempts_by_usage_ids($qubaids);
     $events = array();
     $transaction = $DB->start_delegated_transaction();
     foreach ($qubaids as $qubaid) {
         $attempt = $attempts[$qubaid];
         $attemptobj = new quiz_attempt($attempt, $this->quiz, $this->cm, $this->course);
         $attemptobj->process_submitted_actions(time());
         // Add the event we will trigger later.
         $params = array('objectid' => $attemptobj->get_question_attempt($assumedslotforevents)->get_question()->id, 'courseid' => $attemptobj->get_courseid(), 'context' => context_module::instance($attemptobj->get_cmid()), 'other' => array('quizid' => $attemptobj->get_quizid(), 'attemptid' => $attemptobj->get_attemptid(), 'slot' => $assumedslotforevents));
         $events[] = \mod_quiz\event\question_manually_graded::create($params);
     }
     $transaction->allow_commit();
     // Trigger events for all the questions we manually marked.
     foreach ($events as $event) {
         $event->trigger();
     }
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:26,代码来源:report.php


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