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


PHP quiz_attempt::get_question_status方法代码示例

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


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

示例1: summary_table

    /**
     * Generates the table of summarydata
     *
     * @param quiz_attempt $attemptobj
     * @param mod_quiz_display_options $displayoptions
     */
    public function summary_table($attemptobj, $displayoptions) {
        // Prepare the summary table header.
        $table = new html_table();
        $table->attributes['class'] = 'generaltable quizsummaryofattempt boxaligncenter';
        $table->head = array(get_string('question', 'quiz'), get_string('status', 'quiz'));
        $table->align = array('left', 'left');
        $table->size = array('', '');
        $markscolumn = $displayoptions->marks >= question_display_options::MARK_AND_MAX;
        if ($markscolumn) {
            $table->head[] = get_string('marks', 'quiz');
            $table->align[] = 'left';
            $table->size[] = '';
        }
        $table->data = array();

        // Get the summary info for each question.
        $slots = $attemptobj->get_slots();
        foreach ($slots as $slot) {
            if (!$attemptobj->is_real_question($slot)) {
                continue;
            }
            $flag = '';
            if ($attemptobj->is_question_flagged($slot)) {
                $flag = html_writer::empty_tag('img', array('src' => $this->pix_url('i/flagged'),
                        'alt' => get_string('flagged', 'question'), 'class' => 'questionflag'));
            }
            if ($attemptobj->can_navigate_to($slot)) {
                $row = array(html_writer::link($attemptobj->attempt_url($slot),
                        $attemptobj->get_question_number($slot) . $flag),
                        $attemptobj->get_question_status($slot, $displayoptions->correctness));
            } else {
                $row = array($attemptobj->get_question_number($slot) . $flag,
                                $attemptobj->get_question_status($slot, $displayoptions->correctness));
            }
            if ($markscolumn) {
                $row[] = $attemptobj->get_question_mark($slot);
            }
            $table->data[] = $row;
            $table->rowclasses[] = $attemptobj->get_question_state_class(
                    $slot, $displayoptions->correctness);
        }

        // Print the summary table.
        $output = html_writer::table($table);

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

示例2: 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

示例3: array

    $table->head[] = get_string('marks', 'quiz');
    $table->align[] = 'left';
    $table->size[] = '';
}
$table->data = array();
/// Get the summary info for each question.
$questionids = $attemptobj->get_question_ids();
foreach ($attemptobj->get_question_iterator() as $number => $question) {
    if ($question->length == 0) {
        continue;
    }
    $flag = '';
    if ($attemptobj->is_question_flagged($question->id)) {
        $flag = ' <img src="' . $CFG->pixpath . '/i/flagged.png" alt="' . get_string('flagged', 'question') . '" class="questionflag" />';
    }
    $row = array('<a href="' . $attemptobj->attempt_url($question->id) . '">' . $number . $flag . '</a>', get_string($attemptobj->get_question_status($question->id), 'quiz'));
    if ($scorescolumn) {
        $row[] = $attemptobj->get_question_score($question->id);
    }
    $table->data[] = $row;
}
/// Print the summary table.
print_table($table);
/// countdown timer
echo $attemptobj->get_timer_html();
/// Finish attempt button.
echo "<div class=\"submitbtns mdl-align\">\n";
$options = array('attempt' => $attemptobj->get_attemptid(), 'finishattempt' => 1, 'timeup' => 0, 'questionids' => '', 'sesskey' => sesskey());
print_single_button($attemptobj->processattempt_url(), $options, get_string('finishattempt', 'quiz'), 'post', '', false, '', false, get_string('confirmclose', 'quiz'), 'responseform');
echo "</div>\n";
/// Finish the page
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:summary.php

示例4: summary_table

 /**
  * Generates the table of summarydata
  *
  * @param quiz_attempt $attemptobj
  * @param mod_quiz_display_options $displayoptions
  */
 public function summary_table($attemptobj, $displayoptions)
 {
     // Prepare the summary table header.
     $table = new html_table();
     $table->attributes['class'] = 'generaltable quizsummaryofattempt boxaligncenter';
     $table->head = array(get_string('question', 'quiz'), get_string('status', 'quiz'));
     $table->align = array('left', 'left');
     $table->size = array('', '');
     $markscolumn = $displayoptions->marks >= question_display_options::MARK_AND_MAX;
     if ($markscolumn) {
         $table->head[] = get_string('marks', 'quiz');
         $table->align[] = 'left';
         $table->size[] = '';
     }
     $tablewidth = count($table->align);
     $table->data = array();
     // Get the summary info for each question.
     $slots = $attemptobj->get_slots();
     foreach ($slots as $slot) {
         // Add a section headings if we need one here.
         $heading = $attemptobj->get_heading_before_slot($slot);
         if ($heading) {
             $cell = new html_table_cell(format_string($heading));
             $cell->header = true;
             $cell->colspan = $tablewidth;
             $table->data[] = array($cell);
         }
         // Don't display information items.
         if (!$attemptobj->is_real_question($slot)) {
             continue;
         }
         // Real question, show it.
         $flag = '';
         if ($attemptobj->is_question_flagged($slot)) {
             $flag = html_writer::empty_tag('img', array('src' => $this->pix_url('i/flagged'), 'alt' => get_string('flagged', 'question'), 'class' => 'questionflag icon-post'));
         }
         if ($attemptobj->can_navigate_to($slot)) {
             $row = array(html_writer::link($attemptobj->attempt_url($slot), $attemptobj->get_question_number($slot) . $flag), $attemptobj->get_question_status($slot, $displayoptions->correctness));
         } else {
             $row = array($attemptobj->get_question_number($slot) . $flag, $attemptobj->get_question_status($slot, $displayoptions->correctness));
         }
         if ($markscolumn) {
             $row[] = $attemptobj->get_question_mark($slot);
         }
         $table->data[] = $row;
         $table->rowclasses[] = 'quizsummary' . $slot . ' ' . $attemptobj->get_question_state_class($slot, $displayoptions->correctness);
     }
     // Print the summary table.
     $output = html_writer::table($table);
     return $output;
 }
开发者ID:elnata,项目名称:moodle,代码行数:57,代码来源:renderer.php

示例5: get_question_state_classes

 protected function get_question_state_classes($question)
 {
     // The current status of the question.
     $classes = $this->attemptobj->get_question_status($question->id);
     // Plus a marker for the current page.
     if ($this->showall || $question->_page == $this->page) {
         $classes .= ' thispage';
     }
     // Plus a marker for flagged questions.
     if ($this->attemptobj->is_question_flagged($question->id)) {
         $classes .= ' flagged';
     }
     return $classes;
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:14,代码来源:attemptlib.php


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