本文整理匯總了PHP中quiz_get_review_options函數的典型用法代碼示例。如果您正苦於以下問題:PHP quiz_get_review_options函數的具體用法?PHP quiz_get_review_options怎麽用?PHP quiz_get_review_options使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了quiz_get_review_options函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_display_options
/**
* Wrapper that the correct mod_quiz_display_options for this quiz at the
* moment.
*
* @return question_display_options the render options for this user on this attempt.
*/
public function get_display_options($reviewing)
{
if ($reviewing) {
if (is_null($this->reviewoptions)) {
$this->reviewoptions = quiz_get_review_options($this->get_quiz(), $this->attempt, $this->quizobj->get_context());
if ($this->is_own_preview()) {
// It should always be possible for a teacher to review their
// own preview irrespective of the review options settings.
$this->reviewoptions->attempt = true;
}
}
return $this->reviewoptions;
} else {
$options = mod_quiz_display_options::make_from_quiz($this->get_quiz(), mod_quiz_display_options::DURING);
$options->flags = quiz_get_flag_option($this->attempt, $this->quizobj->get_context());
return $options;
}
}
示例2: view_table
/**
* Generates the table of data
*
* @param array $quiz Array contining quiz data
* @param int $context The page context ID
* @param mod_quiz_view_object $viewobj
*/
public function view_table($quiz, $context, $viewobj) {
$output = '';
if (!$viewobj->attempts) {
return $output;
}
$output .= $this->view_table_heading();
// Prepare table header
$table = new html_table();
$table->attributes['class'] = 'generaltable quizattemptsummary';
$table->head = array();
$table->align = array();
$table->size = array();
if ($viewobj->attemptcolumn) {
$table->head[] = get_string('attemptnumber', 'quiz');
$table->align[] = 'center';
$table->size[] = '';
}
$table->head[] = get_string('timecompleted', 'quiz');
$table->align[] = 'left';
$table->size[] = '';
if ($viewobj->markcolumn) {
$table->head[] = get_string('marks', 'quiz') . ' / ' .
quiz_format_grade($quiz, $quiz->sumgrades);
$table->align[] = 'center';
$table->size[] = '';
}
if ($viewobj->gradecolumn) {
$table->head[] = get_string('grade') . ' / ' .
quiz_format_grade($quiz, $quiz->grade);
$table->align[] = 'center';
$table->size[] = '';
}
if ($viewobj->canreviewmine) {
$table->head[] = get_string('review', 'quiz');
$table->align[] = 'center';
$table->size[] = '';
}
if ($viewobj->feedbackcolumn) {
$table->head[] = get_string('feedback', 'quiz');
$table->align[] = 'left';
$table->size[] = '';
}
if (isset($quiz->showtimetaken)) {
$table->head[] = get_string('timetaken', 'quiz');
$table->align[] = 'left';
$table->size[] = '';
}
// One row for each attempt
foreach ($viewobj->attempts as $attempt) {
$attemptoptions = quiz_get_review_options($quiz, $attempt, $context);
$row = array();
// Add the attempt number, making it a link, if appropriate.
if ($viewobj->attemptcolumn) {
if ($attempt->preview) {
$row[] = get_string('preview', 'quiz');
} else {
$row[] = $attempt->attempt;
}
}
// prepare strings for time taken and date completed
$timetaken = '';
$datecompleted = '';
if ($attempt->timefinish > 0) {
// attempt has finished
$timetaken = format_time($attempt->timefinish - $attempt->timestart);
$datecompleted = userdate($attempt->timefinish);
} else if (!$quiz->timeclose || $viewobj->timenow < $quiz->timeclose) {
// The attempt is still in progress.
$timetaken = format_time($viewobj->timenow - $attempt->timestart);
$datecompleted = get_string('inprogress', 'quiz');
} else {
$timetaken = format_time($quiz->timeclose - $attempt->timestart);
$datecompleted = userdate($quiz->timeclose);
}
$row[] = $datecompleted;
if ($viewobj->markcolumn) {
if ($attemptoptions->marks >= question_display_options::MARK_AND_MAX &&
$attempt->timefinish > 0) {
$row[] = quiz_format_grade($quiz, $attempt->sumgrades);
} else {
$row[] = '';
}
}
// Ouside the if because we may be showing feedback but not grades.
$attemptgrade = quiz_rescale_grade($attempt->sumgrades, $quiz, false);
if ($viewobj->gradecolumn) {
//.........這裏部分代碼省略.........
示例3: display_grading_interface
protected function display_grading_interface($slot, $questionid, $grade, $pagesize, $page, $shownames, $showidnumbers, $order, $counts)
{
global $OUTPUT;
if ($pagesize * $page >= $counts->{$grade}) {
$page = 0;
}
list($qubaids, $count) = $this->get_usage_ids_where_question_in_state($grade, $slot, $questionid, $order, $page, $pagesize);
$attempts = $this->load_attempts_by_usage_ids($qubaids);
// Prepare the form.
$hidden = array('id' => $this->cm->id, 'mode' => 'grading', 'slot' => $slot, 'qid' => $questionid, 'page' => $page);
if (array_key_exists('includeauto', $this->viewoptions)) {
$hidden['includeauto'] = $this->viewoptions['includeauto'];
}
$mform = new quiz_grading_settings_form($hidden, $counts, $shownames, $showidnumbers);
// Tell the form the current settings.
$settings = new stdClass();
$settings->grade = $grade;
$settings->pagesize = $pagesize;
$settings->order = $order;
$mform->set_data($settings);
// Print the heading and form.
echo question_engine::initialise_js();
$a = new stdClass();
$a->number = $this->questions[$slot]->number;
$a->questionname = format_string($counts->name);
echo $OUTPUT->heading(get_string('gradingquestionx', 'quiz_grading', $a), 3);
echo html_writer::tag('p', html_writer::link($this->list_questions_url(), get_string('backtothelistofquestions', 'quiz_grading')), array('class' => 'mdl-align'));
$mform->display();
// Paging info.
$a = new stdClass();
$a->from = $page * $pagesize + 1;
$a->to = min(($page + 1) * $pagesize, $count);
$a->of = $count;
echo $OUTPUT->heading(get_string('gradingattemptsxtoyofz', 'quiz_grading', $a), 3);
if ($count > $pagesize && $order != 'random') {
echo $OUTPUT->paging_bar($count, $page, $pagesize, $this->grade_question_url($slot, $questionid, $grade, false));
}
// Display the form with one section for each attempt.
$sesskey = sesskey();
$qubaidlist = implode(',', $qubaids);
echo html_writer::start_tag('form', array('method' => 'post', 'action' => $this->grade_question_url($slot, $questionid, $grade, $page), 'class' => 'mform', 'id' => 'manualgradingform')) . html_writer::start_tag('div') . html_writer::input_hidden_params(new moodle_url('', array('qubaids' => $qubaidlist, 'slots' => $slot, 'sesskey' => $sesskey)));
foreach ($qubaids as $qubaid) {
$attempt = $attempts[$qubaid];
$quba = question_engine::load_questions_usage_by_activity($qubaid);
$displayoptions = quiz_get_review_options($this->quiz, $attempt, $this->context);
$displayoptions->hide_all_feedback();
$displayoptions->history = question_display_options::HIDDEN;
$displayoptions->manualcomment = question_display_options::EDITABLE;
$heading = $this->get_question_heading($attempt, $shownames, $showidnumbers);
if ($heading) {
echo $OUTPUT->heading($heading, 4);
}
echo $quba->render_question($slot, $displayoptions, $this->questions[$slot]->number);
}
echo html_writer::tag('div', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('saveandnext', 'quiz_grading'))), array('class' => 'mdl-align')) . html_writer::end_tag('div') . html_writer::end_tag('form');
}
示例4: get_display_options
/**
* Wrapper that the correct mod_quiz_display_options for this quiz at the
* moment.
*
* @return question_display_options the render options for this user on this attempt.
*/
public function get_display_options($reviewing)
{
if ($reviewing) {
if (is_null($this->reviewoptions)) {
$this->reviewoptions = quiz_get_review_options($this->get_quiz(), $this->attempt, $this->quizobj->get_context());
}
return $this->reviewoptions;
} else {
$options = mod_quiz_display_options::make_from_quiz($this->get_quiz(), mod_quiz_display_options::DURING);
$options->flags = quiz_get_flag_option($this->attempt, $this->quizobj->get_context());
return $options;
}
}
示例5: quiz_get_recent_mod_activity
/**
* Returns all quiz graded users since a given time for specified quiz
*/
function quiz_get_recent_mod_activity(&$activities, &$index, $timestart,
$courseid, $cmid, $userid = 0, $groupid = 0) {
global $CFG, $COURSE, $USER, $DB;
require_once($CFG->dirroot . '/mod/quiz/locallib.php');
if ($COURSE->id == $courseid) {
$course = $COURSE;
} else {
$course = $DB->get_record('course', array('id' => $courseid));
}
$modinfo = get_fast_modinfo($course);
$cm = $modinfo->cms[$cmid];
$quiz = $DB->get_record('quiz', array('id' => $cm->instance));
if ($userid) {
$userselect = "AND u.id = :userid";
$params['userid'] = $userid;
} else {
$userselect = '';
}
if ($groupid) {
$groupselect = 'AND gm.groupid = :groupid';
$groupjoin = 'JOIN {groups_members} gm ON gm.userid=u.id';
$params['groupid'] = $groupid;
} else {
$groupselect = '';
$groupjoin = '';
}
$params['timestart'] = $timestart;
$params['quizid'] = $quiz->id;
if (!$attempts = $DB->get_records_sql("
SELECT qa.*,
u.firstname, u.lastname, u.email, u.picture, u.imagealt
FROM {quiz_attempts} qa
JOIN {user} u ON u.id = qa.userid
$groupjoin
WHERE qa.timefinish > :timestart
AND qa.quiz = :quizid
AND qa.preview = 0
$userselect
$groupselect
ORDER BY qa.timefinish ASC", $params)) {
return;
}
$context = context_module::instance($cm->id);
$accessallgroups = has_capability('moodle/site:accessallgroups', $context);
$viewfullnames = has_capability('moodle/site:viewfullnames', $context);
$grader = has_capability('mod/quiz:viewreports', $context);
$groupmode = groups_get_activity_groupmode($cm, $course);
if (is_null($modinfo->groups)) {
// Load all my groups and cache it in modinfo.
$modinfo->groups = groups_get_user_groups($course->id);
}
$usersgroups = null;
$aname = format_string($cm->name, true);
foreach ($attempts as $attempt) {
if ($attempt->userid != $USER->id) {
if (!$grader) {
// Grade permission required.
continue;
}
if ($groupmode == SEPARATEGROUPS and !$accessallgroups) {
if (is_null($usersgroups)) {
$usersgroups = groups_get_all_groups($course->id,
$attempt->userid, $cm->groupingid);
if (is_array($usersgroups)) {
$usersgroups = array_keys($usersgroups);
} else {
$usersgroups = array();
}
}
if (!array_intersect($usersgroups, $modinfo->groups[$cm->id])) {
continue;
}
}
}
$options = quiz_get_review_options($quiz, $attempt, $context);
$tmpactivity = new stdClass();
$tmpactivity->type = 'quiz';
$tmpactivity->cmid = $cm->id;
$tmpactivity->name = $aname;
$tmpactivity->sectionnum = $cm->sectionnum;
$tmpactivity->timestamp = $attempt->timefinish;
$tmpactivity->content = new stdClass();
//.........這裏部分代碼省略.........