本文整理汇总了PHP中question_engine::initialise_js方法的典型用法代码示例。如果您正苦于以下问题:PHP question_engine::initialise_js方法的具体用法?PHP question_engine::initialise_js怎么用?PHP question_engine::initialise_js使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_engine
的用法示例。
在下文中一共展示了question_engine::initialise_js方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_question_html_head_contributions
/**
* Initialise the JS etc. required by one question.
* @param int $questionid the question id.
*/
public function get_question_html_head_contributions($slot)
{
return $this->quba->render_question_head_html($slot) . question_engine::initialise_js();
}
示例2: get_string
$displaynumber = 'i';
}
$restartdisabled = '';
$finishdisabled = '';
$filldisabled = '';
if ($quba->get_question_state($slot)->is_finished()) {
$finishdisabled = ' disabled="disabled"';
$filldisabled = ' disabled="disabled"';
}
if (!$previewid) {
$restartdisabled = ' disabled="disabled"';
}
// Output
$title = get_string('previewquestion', 'question', format_string($question->name));
$headtags = question_engine::initialise_js() . $quba->render_question_head_html($slot);
$PAGE->set_title($title);
$PAGE->set_heading($title);
echo $OUTPUT->header();
// Start the question form.
echo '<form method="post" action="' . $actionurl .
'" enctype="multipart/form-data" id="responseform">', "\n";
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />', "\n";
echo '<input type="hidden" name="slots" value="' . $slot . '" />', "\n";
// Output the question.
echo $quba->render_question($slot, $options, $displaynumber);
echo '<p class="notifytiny">' . get_string('behaviourbeingused', 'question',
question_engine::get_behaviour_name(
示例3: print_error
// Check the access rules.
$accessmanager = $attemptobj->get_access_manager(time());
$accessmanager->setup_attempt_page($PAGE);
// Complete masquerading as the mod-quiz-attempt page. Must be done after setup_attempt_page.
$PAGE->set_pagetype('mod-quiz-attempt');
// Get the renderer.
$output = $PAGE->get_renderer('mod_quiz');
$messages = $accessmanager->prevent_access();
if (!$attemptobj->is_preview_user() && $messages) {
print_error('attempterror', 'quiz', $attemptobj->view_url(), $output->access_messages($messages));
}
if ($accessmanager->is_preflight_check_required($attemptobj->get_attemptid())) {
redirect($attemptobj->start_attempt_url(null, $page));
}
// Initialise the JavaScript.
question_engine::initialise_js();
$PAGE->requires->js_module(quiz_get_js_module());
$autosaveperiod = get_config('quiz', 'autosaveperiod');
if (!$autosaveperiod) {
// Offline mode only works with autosave, so if it is off for normal quizzes,
// use a sensible default.
$autosaveperiod = 60;
}
$PAGE->requires->yui_module('moodle-quizaccess_offlinemode-autosave', 'M.quizaccess_offlinemode.autosave.init', array($autosaveperiod));
$PAGE->requires->yui_module('moodle-quizaccess_offlinemode-navigation', 'M.quizaccess_offlinemode.navigation.init', array($page));
if (!empty($USER->idnumber)) {
$user = '-i' . $USER->idnumber;
} else {
$user = '-u' . $USER->id;
}
$emergencysavefilename = clean_filename(format_string($attemptobj->get_quiz_name()) . $user . '-a' . $attemptid . '-d197001010000.attemptdata');
示例4: 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');
}
示例5: get_html_head_contributions
/**
* Initialize the head contributions from the question engine
*
* @return string
*/
public function get_html_head_contributions()
{
$result = '';
// get the slots ids from the quba layout
$slots = explode(',', $this->attempt->qubalayout);
// next load the slot headhtml and initialize question engine js
foreach ($slots as $slot) {
$result .= $this->quba->render_question_head_html($slot);
}
$result .= \question_engine::initialise_js();
return $result;
}