/// If success, notify and print a close button.
if (!is_string($error)) {
- notify(get_string('changessaved'), 'notifysuccess');
+ echo $OUTPUT->notification(get_string('changessaved'), 'notifysuccess');
close_window(2, true);
}
/// Otherwise, display the error and fall throug to re-display the form.
- notify($error);
+ echo $OUTPUT->notification($error);
}
/// Print the comment form.
$out .= '<input type="hidden" name="categoryid" value="' . $category->id . '" />';
$out .= ' <input type="submit" name="addrandom" value="'.
$straddtoquiz.'" '.$disabled.' />';
- $out .= helpbutton('random', get_string('random', 'quiz'), 'quiz',
- true, false, '', true);
+ $out .= $OUTPUT->help_icon(moodle_help_icon::make('random', get_string('random', 'quiz'), 'quiz'));
}
}
return $out;
echo '</div>';
}
echo $OUTPUT->heading($pagetitle.": ".$quiz->name, 2);
-helpbutton('editconcepts', get_string('basicideasofquiz', 'quiz'), 'quiz',
- true, get_string('basicideasofquiz', 'quiz'));
+echo $OUTPUT->help_icon(moodle_help_icon::make('editconcepts', get_string('basicideasofquiz', 'quiz'), 'quiz', get_string('basicideasofquiz', 'quiz')));
quiz_print_status_bar($quiz);
$tabindex = 0;
* @param unknown_type $hasattempts
*/
function quiz_print_pagecontrols($quiz, $pageurl, $page, $hasattempts) {
- global $CFG;
+ global $CFG, $OUTPUT;
static $randombuttoncount = 0;
$randombuttoncount++;
echo '<div class="pagecontrols">';
</div>
</form>
</div>
- <?php helpbutton('random', get_string('random', 'quiz'), 'quiz', true, false, ''); ?>
+ <?php echo $OUTPUT->help_icon(moodle_help_icon::make('random', get_string('random', 'quiz'), 'quiz')); ?>
<?php
echo "\n</div>";
}
* @param boolean $quiz_qbanktool Indicate to this function if the question bank window open
*/
function quiz_print_randomquestion(&$question, &$pageurl, &$quiz, $quiz_qbanktool) {
- global $DB, $QTYPES, $THEME;
+ global $DB, $QTYPES, $THEME, $OUTPUT;
check_theme_arrows();
echo '<div class="quiz_randomquestion">';
if (!$category = $DB->get_record('question_categories', array('id' => $question->category))) {
- notify('Random question category not found!');
+ echo $OUTPUT->notification('Random question category not found!');
return;
}
* @param object $quiz The quiz in the context of which the question is being displayed
*/
function quiz_print_randomquestion_reordertool(&$question, &$pageurl, &$quiz) {
- global $DB, $QTYPES;
+ global $DB, $QTYPES, $OUTPUT;
// Load the category, and the number of available questions in it.
if (!$category = $DB->get_record('question_categories', array('id' => $question->category))) {
- notify('Random question category not found!');
+ echo $OUTPUT->notification('Random question category not found!');
return;
}
$questioncount = count($QTYPES['random']->get_usable_questions_from_category(
* the last value used +1.
*/
function quiz_print_grading_form($quiz, $pageurl, $tabindex) {
- global $USER;
+ global $USER, $OUTPUT;
$strsave = get_string('save', 'quiz');
echo "<form method=\"post\" action=\"edit.php\"><div>";
echo '<fieldset class="invisiblefieldset" style="display: block;">';
echo '<label for="inputmaxgrade">' . get_string('maximumgradex', '', $a) . "</label>";
echo '<input type="hidden" name="savechanges" value="save" />';
echo '<input type="submit" value="' . $strsave . '" />';
- helpbutton('maxgrade', get_string('maximumgrade'), 'quiz');
+ echo $OUTPUT->help_icon(moodle_help_icon::make('maxgrade', get_string('maximumgrade'), 'quiz'));
echo '</fieldset>';
echo "</div></form>\n";
return $tabindex + 1;
*/
function quiz_save_best_grade($quiz, $userid = null, $attempts = array()) {
global $DB;
- global $USER;
+ global $USER, $OUTPUT;
if (empty($userid)) {
$userid = $USER->id;
if (!$attempts){
// Get all the attempts made by the user
if (!$attempts = quiz_get_user_attempts($quiz->id, $userid)) {
- notify('Could not find any user attempts');
+ echo $OUTPUT->notification('Could not find any user attempts');
return false;
}
}
// Check permissions
$this->context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (!has_capability('mod/quiz:grade', $this->context)) {
- notify(get_string('gradingnotallowed', 'quiz_grading'));
+ echo $OUTPUT->notification(get_string('gradingnotallowed', 'quiz_grading'));
return true;
}
// the following will update the state and attempt
$error = question_process_comment($question, $state, $attempt, $response['comment'], $response['grade']);
if (is_string($error)) {
- notify($error);
+ echo $OUTPUT->notification($error);
$allok = false;
} else if ($state->changed) {
// If the state has changed save it and update the quiz grade
}
if ($allok) {
- notify(get_string('changessaved', 'quiz'), 'notifysuccess');
+ echo $OUTPUT->notification(get_string('changessaved', 'quiz'), 'notifysuccess');
} else {
- notify(get_string('changessavedwitherrors', 'quiz'), 'notifysuccess');
+ echo $OUTPUT->notification(get_string('changessavedwitherrors', 'quiz'), 'notifysuccess');
}
}
}
if(empty($this->users)) {
if ($currentgroup){
- notify(get_string('nostudentsingroup'));
+ echo $OUTPUT->notification(get_string('nostudentsingroup'));
} else {
- notify(get_string('nostudentsyet'));
+ echo $OUTPUT->notification(get_string('nostudentsyet'));
}
return true;
}
$qattempts = quiz_get_total_qas_graded_and_ungraded($quiz, array_keys($gradeableqs), array_keys($this->users));
if(empty($qattempts)) {
- notify(get_string('noattemptstoshow', 'quiz'));
+ echo $OUTPUT->notification(get_string('noattemptstoshow', 'quiz'));
return true;
}
$qmenu = array();
* Finnish documenting
**/
function view_question($quiz, $question, $totalattempts, $ungraded) {
- global $CFG, $DB;
+ global $CFG, $DB, $OUTPUT;
$usercount = count($this->users);
$table->print_html();
echo '</div>';
} else {
- notify(get_string('noattemptstoshow', 'quiz'));
+ echo $OUTPUT->notification(get_string('noattemptstoshow', 'quiz'));
}
}
echo '<div class="boxaligncenter"><input type="submit" value="'.get_string('savechanges').'" /></div>'.
'</form>';
} else {
- notify(get_string('noattemptstoshow', 'quiz'));
+ echo $OUTPUT->notification(get_string('noattemptstoshow', 'quiz'));
}
}
}
$nostudents = false;
if (!$students){
- notify(get_string('nostudentsyet'));
+ echo $OUTPUT->notification(get_string('nostudentsyet'));
$nostudents = true;
}else if ($currentgroup && !$groupstudents){
- notify(get_string('nostudentsingroup'));
+ echo $OUTPUT->notification(get_string('nostudentsingroup'));
$nostudents = true;
}
if (!$table->is_downloading()) {
function regrade_all($dry, $quiz, $groupstudents){
global $DB, $OUTPUT;
if (!has_capability('mod/quiz:regrade', $this->context)) {
- notify(get_string('regradenotallowed', 'quiz'));
+ echo $OUTPUT->notification(get_string('regradenotallowed', 'quiz'));
return true;
}
// Fetch all attempts
function regrade_all_needed($quiz, $groupstudents){
global $DB, $OUTPUT;
if (!has_capability('mod/quiz:regrade', $this->context)) {
- notify(get_string('regradenotallowed', 'quiz'));
+ echo $OUTPUT->notification(get_string('regradenotallowed', 'quiz'));
return;
}
// Fetch all attempts that need regrading
* Display the report.
*/
function display($quiz, $cm, $course) {
- global $CFG, $COURSE, $DB, $PAGE;
+ global $CFG, $COURSE, $DB, $PAGE, $OUTPUT;
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
}
$nostudents = false;
if (!$students){
- notify(get_string('nostudentsyet'));
+ echo $OUTPUT->notification(get_string('nostudentsyet'));
$nostudents = true;
}else if ($currentgroup && !$groupstudents){
- notify(get_string('nostudentsingroup'));
+ echo $OUTPUT->notification(get_string('nostudentsingroup'));
$nostudents = true;
}
if (!$table->is_downloading()) {
}
function process_states(){
- global $DB;
+ global $DB, $OUTPUT;
set_time_limit(0);
$subquestionstats = array();
foreach ($this->states as $state){
$this->subquestions[$qid]->maxgrade = $this->subquestions[$qid]->_stats->maxgrade;
$this->_initial_question_walker($this->subquestions[$qid]->_stats);
if ($subquestionstats[$qid]->differentweights){
- notify(get_string('erroritemappearsmorethanoncewithdifferentweight', 'quiz_statistics', $this->subquestions[$qid]->name));
+ echo $OUTPUT->notification(get_string('erroritemappearsmorethanoncewithdifferentweight', 'quiz_statistics', $this->subquestions[$qid]->name));
}
if ($this->subquestions[$qid]->_stats->usedin){
sort($this->subquestions[$qid]->_stats->usedin, SORT_NUMERIC);
return $this->sumofgradevariance;
}
}
-?>
\ No newline at end of file
+?>
groups_print_activity_menu($cm, $reporturl->out());
echo '<br />';
if ($currentgroup && !$groupstudents){
- notify(get_string('nostudentsingroup', 'quiz_statistics'));
+ echo $OUTPUT->notification(get_string('nostudentsingroup', 'quiz_statistics'));
}
}
}
$select = html_select::make($downloadoptions, 'download', $this->table->defaultdownloadformat, false);
$select->nothingvalue = '';
$quizinformationtablehtml .= $OUTPUT->select($select);;
- $quizinformationtablehtml .= helpbutton('tableexportformats', get_string('tableexportformats', 'table'), 'moodle', true, false, '', true);
+ $quizinformationtablehtml .= $OUTPUT->help_icon(moodle_help_icon::make('tableexportformats', get_string('tableexportformats', 'table')));
$quizinformationtablehtml .= '</div></form>';
}
$quizinformationtablehtml .= print_table($quizinformationtable, true);
return quiz_report_scale_sumgrades_as_percentage($question->_stats->maxgrade, $this->quiz);
}
function col_effective_weight($question){
+ global $OUTPUT;
if (!$question->_stats->subquestion){
if ($question->_stats->negcovar){
$negcovar = get_string('negcovar', 'quiz_statistics');
if (!$this->is_downloading()){
- $negcovar .= helpbutton('negcovar', $negcovar, 'quiz_statistics', true, false, '', true);
+ $negcovar .= $OUTPUT->help_icon(moodle_help_icon::make('negcovar', $negcovar, 'quiz_statistics'));
return '<div class="negcovar">'.$negcovar.'</div>';
} else {
return $negcovar;
if (!$attemptobj->has_capability('mod/quiz:viewreports')) {
/// Can't review during the attempt - send them back to the attempt page.
if (!$attemptobj->is_finished()) {
- notify(get_string('cannotreviewopen', 'quiz'));
+ echo $OUTPUT->notification(get_string('cannotreviewopen', 'quiz'));
echo $OUTPUT->close_window_button();
}
/// Can't review other users' attempts.
if (!$attemptobj->is_own_attempt()) {
- notify(get_string('notyourattempt', 'quiz'));
+ echo $OUTPUT->notification(get_string('notyourattempt', 'quiz'));
echo $OUTPUT->close_window_button();
}
/// Can't review unless Students may review -> Responses option is turned on.
if (!$options->responses) {
$accessmanager = $attemptobj->get_access_manager(time());
- notify($accessmanager->cannot_review_message($attemptobj->get_review_options()));
+ echo $OUTPUT->notification($accessmanager->cannot_review_message($attemptobj->get_review_options()));
echo $OUTPUT->close_window_button();
}
}
/// If they are not enrolled in this course in a good enough role, tell them to enrol.
if (!($canattempt || $canpreview || $canreviewmine)) {
echo $OUTPUT->box('<p>' . get_string('youneedtoenrol', 'quiz') . "</p>\n\n<p>" .
- print_continue($CFG->wwwroot . '/course/view.php?id=' . $course->id, true) .
+ $OUTPUT->continue_button($CFG->wwwroot . '/course/view.php?id=' . $course->id) .
"</p>\n", 'generalbox', 'notice');
echo $OUTPUT->footer();
exit;
if ($buttontext) {
$accessmanager->print_start_attempt_button($canpreview, $buttontext, $unfinished);
} else {
- print_continue($CFG->wwwroot . '/course/view.php?id=' . $course->id);
+ echo $OUTPUT->continue_button($CFG->wwwroot . '/course/view.php?id=' . $course->id);
}
echo $OUTPUT->box_end();