From: nicolasconnault Date: Tue, 18 Aug 2009 05:16:08 +0000 (+0000) Subject: MDL-19813 Upgraded calls to helpbutton, print_simple_box* and notify X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=825116fb22f0a7188638758e68d0937bc4326f61;p=moodle.git MDL-19813 Upgraded calls to helpbutton, print_simple_box* and notify --- diff --git a/mod/quiz/comment.php b/mod/quiz/comment.php index 68658969cc..3aa5154e37 100644 --- a/mod/quiz/comment.php +++ b/mod/quiz/comment.php @@ -45,12 +45,12 @@ /// 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. diff --git a/mod/quiz/edit.php b/mod/quiz/edit.php index d69b6639e2..a9277b728e 100644 --- a/mod/quiz/edit.php +++ b/mod/quiz/edit.php @@ -106,8 +106,7 @@ function module_specific_controls($totalnumber, $recurse, $category, $cmid, $cmo $out .= ''; $out .= ' '; - $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; @@ -521,8 +520,7 @@ if ($quiz_reordertool) { echo ''; } 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; diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php index 6076e68784..eeeafb748f 100644 --- a/mod/quiz/editlib.php +++ b/mod/quiz/editlib.php @@ -640,7 +640,7 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete = true, * @param unknown_type $hasattempts */ function quiz_print_pagecontrols($quiz, $pageurl, $page, $hasattempts) { - global $CFG; + global $CFG, $OUTPUT; static $randombuttoncount = 0; $randombuttoncount++; echo '
'; @@ -678,7 +678,7 @@ function quiz_print_pagecontrols($quiz, $pageurl, $page, $hasattempts) {
- + help_icon(moodle_help_icon::make('random', get_string('random', 'quiz'), 'quiz')); ?> "; } @@ -750,12 +750,12 @@ function quiz_print_singlequestion($question, $returnurl, $quiz) { * @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 '
'; 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; } @@ -859,11 +859,11 @@ function quiz_print_singlequestion_reordertool($question, $returnurl, $quiz) { * @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( @@ -1136,7 +1136,7 @@ class quiz_question_bank_view extends question_bank_view { * the last value used +1. */ function quiz_print_grading_form($quiz, $pageurl, $tabindex) { - global $USER; + global $USER, $OUTPUT; $strsave = get_string('save', 'quiz'); echo "
"; echo '
'; @@ -1147,7 +1147,7 @@ function quiz_print_grading_form($quiz, $pageurl, $tabindex) { echo '"; echo ''; echo ''; - helpbutton('maxgrade', get_string('maximumgrade'), 'quiz'); + echo $OUTPUT->help_icon(moodle_help_icon::make('maxgrade', get_string('maximumgrade'), 'quiz')); echo '
'; echo "
\n"; return $tabindex + 1; diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index 00cd7d7061..eafe14f008 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -559,7 +559,7 @@ function quiz_set_grade($newgrade, &$quiz) { */ function quiz_save_best_grade($quiz, $userid = null, $attempts = array()) { global $DB; - global $USER; + global $USER, $OUTPUT; if (empty($userid)) { $userid = $USER->id; @@ -568,7 +568,7 @@ function quiz_save_best_grade($quiz, $userid = null, $attempts = array()) { 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; } } diff --git a/mod/quiz/report/grading/report.php b/mod/quiz/report/grading/report.php index d7c34255c1..c3b29f379a 100644 --- a/mod/quiz/report/grading/report.php +++ b/mod/quiz/report/grading/report.php @@ -61,7 +61,7 @@ class quiz_grading_report extends quiz_default_report { // 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; } @@ -135,7 +135,7 @@ class quiz_grading_report extends quiz_default_report { // 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 @@ -145,9 +145,9 @@ class quiz_grading_report extends quiz_default_report { } 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'); } } } @@ -160,15 +160,15 @@ class quiz_grading_report extends quiz_default_report { 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(); @@ -226,7 +226,7 @@ class quiz_grading_report extends quiz_default_report { * Finnish documenting **/ function view_question($quiz, $question, $totalattempts, $ungraded) { - global $CFG, $DB; + global $CFG, $DB, $OUTPUT; $usercount = count($this->users); @@ -319,7 +319,7 @@ class quiz_grading_report extends quiz_default_report { $table->print_html(); echo '
'; } else { - notify(get_string('noattemptstoshow', 'quiz')); + echo $OUTPUT->notification(get_string('noattemptstoshow', 'quiz')); } } @@ -416,7 +416,7 @@ class quiz_grading_report extends quiz_default_report { echo '
'. ''; } else { - notify(get_string('noattemptstoshow', 'quiz')); + echo $OUTPUT->notification(get_string('noattemptstoshow', 'quiz')); } } diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 0490f0fd30..2f21b1b7a7 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -189,10 +189,10 @@ class quiz_overview_report extends quiz_default_report { } $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()) { @@ -426,7 +426,7 @@ class quiz_overview_report extends quiz_default_report { 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 @@ -509,7 +509,7 @@ class quiz_overview_report extends quiz_default_report { 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 diff --git a/mod/quiz/report/responses/report.php b/mod/quiz/report/responses/report.php index 813f551a22..2e0babcc53 100644 --- a/mod/quiz/report/responses/report.php +++ b/mod/quiz/report/responses/report.php @@ -17,7 +17,7 @@ class quiz_responses_report extends quiz_default_report { * 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); @@ -150,10 +150,10 @@ class quiz_responses_report extends quiz_default_report { } $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()) { diff --git a/mod/quiz/report/statistics/qstats.php b/mod/quiz/report/statistics/qstats.php index ef3509d105..3b5adc9845 100644 --- a/mod/quiz/report/statistics/qstats.php +++ b/mod/quiz/report/statistics/qstats.php @@ -172,7 +172,7 @@ class qstats{ } function process_states(){ - global $DB; + global $DB, $OUTPUT; set_time_limit(0); $subquestionstats = array(); foreach ($this->states as $state){ @@ -210,7 +210,7 @@ class qstats{ $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); @@ -296,4 +296,4 @@ class qstats{ return $this->sumofgradevariance; } } -?> \ No newline at end of file +?> diff --git a/mod/quiz/report/statistics/report.php b/mod/quiz/report/statistics/report.php index 771d45dec3..e39bbd0de8 100644 --- a/mod/quiz/report/statistics/report.php +++ b/mod/quiz/report/statistics/report.php @@ -103,7 +103,7 @@ class quiz_statistics_report extends quiz_default_report { groups_print_activity_menu($cm, $reporturl->out()); echo '
'; if ($currentgroup && !$groupstudents){ - notify(get_string('nostudentsingroup', 'quiz_statistics')); + echo $OUTPUT->notification(get_string('nostudentsingroup', 'quiz_statistics')); } } } @@ -422,7 +422,7 @@ class quiz_statistics_report extends quiz_default_report { $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 .= ''; } $quizinformationtablehtml .= print_table($quizinformationtable, true); diff --git a/mod/quiz/report/statistics/statistics_table.php b/mod/quiz/report/statistics/statistics_table.php index 61596e08d5..5d4efa3f37 100644 --- a/mod/quiz/report/statistics/statistics_table.php +++ b/mod/quiz/report/statistics/statistics_table.php @@ -141,11 +141,12 @@ class quiz_report_statistics_table extends flexible_table { 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 '
'.$negcovar.'
'; } else { return $negcovar; diff --git a/mod/quiz/reviewquestion.php b/mod/quiz/reviewquestion.php index f13abdaf6a..fd126ae636 100644 --- a/mod/quiz/reviewquestion.php +++ b/mod/quiz/reviewquestion.php @@ -25,18 +25,18 @@ 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(); } } diff --git a/mod/quiz/view.php b/mod/quiz/view.php index 2ea3c72ecd..4f7c5da837 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -124,7 +124,7 @@ /// If they are not enrolled in this course in a good enough role, tell them to enrol. if (!($canattempt || $canpreview || $canreviewmine)) { echo $OUTPUT->box('

' . get_string('youneedtoenrol', 'quiz') . "

\n\n

" . - print_continue($CFG->wwwroot . '/course/view.php?id=' . $course->id, true) . + $OUTPUT->continue_button($CFG->wwwroot . '/course/view.php?id=' . $course->id) . "

\n", 'generalbox', 'notice'); echo $OUTPUT->footer(); exit; @@ -380,7 +380,7 @@ 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();