print_header($site->fullname .':Error', $site->fullname .': Error 404', 'Error 404 - File not Found', '');
- print_simple_box('<p align="center">'. get_string('pagenotexist', 'error'). '<br />'.s($requesturi).'</p>', 'center');
+ echo $OUTPUT->box(get_string('pagenotexist', 'error'). '<br />'.s($requesturi), 'generalbox boxaligncenter');
if (isloggedin()) {
?>
</form>
<?php
} else {
- print_continue($CFG->wwwroot);
+ echo $OUTPUT->continue_button($CFG->wwwroot);
}
echo $OUTPUT->footer();
?>
if ($delete !== '' and $file = $fs->get_file($contextid, $filearea, $itemid, $filepath, $delete)) {
if (!data_submitted() or !confirm_sesskey()) {
print_header();
- notify(get_string('deletecheckwarning').': '.s($file->get_filepath().$file->get_filename()));
+ echo $OUTPUT->notification(get_string('deletecheckwarning').': '.s($file->get_filepath().$file->get_filename()));
$optionsno = array('itemid'=>$itemid, 'filepath'=>$filepath, 'subdirs'=>$subdirs);
$optionsyes = array('itemid'=>$itemid, 'filepath'=>$filepath, 'delete'=>$delete, 'sesskey'=>sesskey(), 'subdirs'=>$subdirs);
notice_yesno (get_string('deletecheckfiles'), 'draftfiles.php', 'draftfiles.php', $optionsyes, $optionsno, 'post', 'get');
print_header();
if ($notice !== '') {
- notify($notice);
+ echo $OUTPUT->notification($notice);
}
echo '<div class="areafiles">';
if ($file_info and $delete) {
if (!data_submitted() or !confirm_sesskey()) {
print_header();
- notify(get_string('deletecheckwarning').': '.$file_info->get_visible_name());
+ echo $OUTPUT->notification(get_string('deletecheckwarning').': '.$file_info->get_visible_name());
$parent_info = $file_info->get_parent();
$optionsno = $parent_info->get_params();
html_header($context, $file_info);
if ($error !== '') {
- notify($error);
+ echo $OUTPUT->notification($error);
}
displaydir($file_info);
// Do the main output.
print_header($title);
-print_simple_box_start();
+echo $OUTPUT->box_start();
print $output;
-print_simple_box_end();
+echo $OUTPUT->box_end();
// Display an error if necessary.
if (!$helpfound) {
- notify('Help file "'. $file .'" could not be found!');
+ echo $OUTPUT->notification('Help file "'. $file .'" could not be found!');
}
// End of page.
* @return boolean true if success, exception in case of any problems
*/
function update_capabilities($component='moodle') {
- global $DB;
+ global $DB, $OUTPUT;
$storedcaps = array();
//assign_capability will update rather than insert if capability exists
if (!assign_capability($capname, $rolecapability->permission,
$rolecapability->roleid, $rolecapability->contextid, true)){
- notify('Could not clone capabilities for '.$capname);
+ echo $OUTPUT->notification('Could not clone capabilities for '.$capname);
}
}
}
// we ignore legacy key if we have cloned permissions
} else if (isset($capdef['legacy']) && is_array($capdef['legacy']) &&
!assign_legacy_capabilities($capname, $capdef['legacy'])) {
- notify('Could not assign legacy capabilities for '.$capname);
+ echo $OUTPUT->notification('Could not assign legacy capabilities for '.$capname);
}
}
// Are there any capabilities that have been removed from the file
* @return void
*/
public function print_help_icon() {
- global $PAGE;
+ global $PAGE, $OUTPUT;
if ($this->is_enabled() && !$PAGE->user_is_editing() && isloggedin() && !isguestuser()) {
echo '<span id = "completionprogressid" class="completionprogress">'.get_string('yourprogress','completion').' ';
- helpbutton('completionicons',get_string('completionicons','completion'),'completion');
+ echo $OUTPUT->help_icon(moodle_help_icon::make('completionicons',get_string('completionicons','completion'),'completion'));
echo '</span>';
}
}
// before any action that may take longer time to finish.
function xmldb_main_upgrade($oldversion) {
- global $CFG, $THEME, $USER, $DB;
+ global $CFG, $THEME, $USER, $DB, $OUTPUT;
require_once($CFG->libdir.'/db/upgradelib.php'); // Core Upgrade-related functions
if ($guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW)) {
if (isset($guestroles[$role->id])) {
set_config('defaultuserroleid', null);
- notify('Guest role removed from "Default role for all users" setting, please select another role.', 'notifysuccess');
+ echo $OUTPUT->notification('Guest role removed from "Default role for all users" setting, please select another role.', 'notifysuccess');
}
}
} else {
}
if ($result && $oldversion < 2008051201) {
- notify('Increasing size of user idnumber field, this may take a while...', 'notifysuccess');
+ echo $OUTPUT->notification('Increasing size of user idnumber field, this may take a while...', 'notifysuccess');
upgrade_set_timeout(60*20); // this may take a while
/// Under MySQL and Postgres... detect old NULL contents and change them by correct empty string. MDL-14859
if ($result && $oldversion < 2009051200) {
/// Let's check the status of mandatory mnet_host records, fixing them
/// and moving "orphan" users to default localhost record. MDL-16879
- notify('Fixing mnet records, this may take a while...', 'notifysuccess');
+ echo $OUTPUT->notification('Fixing mnet records, this may take a while...', 'notifysuccess');
upgrade_fix_incorrect_mnethostids();
/// Main savepoint reached
* Internal function - do not use directly
*/
function upgrade_migrate_files_course($context, $path, $delete) {
- global $CFG;
+ global $CFG, $OUTPUT;
$fullpathname = $CFG->dataroot.'/'.$context->instanceid.$path;
if (!file_exists($fullpathname)) {
if ($item->isFile()) {
if (!$item->isReadable()) {
- notify(" File not readable, skipping: ".$fullpathname.$item->getFilename());
+ echo $OUTPUT->notification(" File not readable, skipping: ".$fullpathname.$item->getFilename());
continue;
}
* Unfortunately this function uses core file related functions - it might be necessary to tweak it if something changes there :-(
*/
function upgrade_migrate_files_blog() {
- global $DB, $CFG;
+ global $DB, $CFG, $OUTPUT;
$fs = get_file_storage();
}
if (!is_readable($pathname)) {
- notify(" File not readable, skipping: ".$pathname);
+ echo $OUTPUT->notification(" File not readable, skipping: ".$pathname);
continue;
}
/// Finally, if any error has happened, print the summary box
if (!$result) {
- print_simple_box($strenvironmenterrortodo, 'center', '', '', '', 'environmentbox errorbox');
+ echo $OUTPUT->box($strenvironmenterrortodo, 'environmentbox errorbox');
}
}
}
print_header();
-print_simple_box_start('center', '96%');
+echo $OUTPUT->box_start();
echo $OUTPUT->heading(get_string('editorhelptopics'));
echo('<li>'.$topics[$i].'</li>');
}
echo '</ul>';
-print_simple_box_end();
+echo $OUTPUT->box_end();
// End of page.
echo $OUTPUT->close_window_button();
global $CFG;
}
function toHtml() {
- return notify($this->_text, $this->_class, 'center', true);
+ global $OUTPUT;
+ return $OUTPUT->notification($this->_text, $this->_class);
}
/**
* @return boolean
*/
function process_profile_image($originalfile, $destination) {
- global $CFG;
+ global $CFG, $OUTPUT;
if(!(is_file($originalfile) && is_dir($destination))) {
return false;
return 1;
}
} else {
- notify('PHP has not been configured to support JPEG images. Please correct this.');
+ echo $OUTPUT->notification('PHP has not been configured to support JPEG images. Please correct this.');
}
return 0;
}
* @return boolean
*/
function upgrade_profile_image($id, $dir='users') {
- global $CFG;
+ global $CFG, $OUTPUT;
$im = ImageCreateFromJPEG($CFG->dataroot .'/'. $dir .'/'. $id .'/f1.jpg');
return 1;
}
} else {
- notify('PHP has not been configured to support JPEG images. Please correct this.');
+ echo $OUTPUT->notification('PHP has not been configured to support JPEG images. Please correct this.');
}
return 0;
}
* @param bool $showfeedback
*/
function remove_grade_letters($context, $showfeedback) {
- global $DB;
+ global $DB, $OUTPUT;
$strdeleted = get_string('deleted');
$DB->delete_records('grade_letters', array('contextid'=>$context->id));
if ($showfeedback) {
- notify($strdeleted.' - '.get_string('letters', 'grades'));
+ echo $OUTPUT->notification($strdeleted.' - '.get_string('letters', 'grades'));
}
}
/**
* @param bool $showfeedback print feedback
*/
function remove_course_grades($courseid, $showfeedback) {
- global $DB;
+ global $DB, $OUTPUT;
$strdeleted = get_string('deleted');
$course_category = grade_category::fetch_course_category($courseid);
$course_category->delete('coursedelete');
if ($showfeedback) {
- notify($strdeleted.' - '.get_string('grades', 'grades').', '.get_string('items', 'grades').', '.get_string('categories', 'grades'));
+ echo $OUTPUT->notification($strdeleted.' - '.get_string('grades', 'grades').', '.get_string('items', 'grades').', '.get_string('categories', 'grades'));
}
if ($outcomes = grade_outcome::fetch_all(array('courseid'=>$courseid))) {
}
$DB->delete_records('grade_outcomes_courses', array('courseid'=>$courseid));
if ($showfeedback) {
- notify($strdeleted.' - '.get_string('outcomes', 'grades'));
+ echo $OUTPUT->notification($strdeleted.' - '.get_string('outcomes', 'grades'));
}
if ($scales = grade_scale::fetch_all(array('courseid'=>$courseid))) {
}
}
if ($showfeedback) {
- notify($strdeleted.' - '.get_string('scales'));
+ echo $OUTPUT->notification($strdeleted.' - '.get_string('scales'));
}
$DB->delete_records('grade_settings', array('courseid'=>$courseid));
if ($showfeedback) {
- notify($strdeleted.' - '.get_string('settings', 'grades'));
+ echo $OUTPUT->notification($strdeleted.' - '.get_string('settings', 'grades'));
}
}
if (empty($USER->access['rsw'][$COURSE->context->path])) { // Normal guest
notice(get_string('guestsnotallowed', '', format_string($COURSE->fullname)), get_login_url());
} else {
- notify(get_string('guestsnotallowed', '', format_string($COURSE->fullname)));
+ echo $OUTPUT->notification(get_string('guestsnotallowed', '', format_string($COURSE->fullname)));
echo '<div class="notifyproblem">'.switchroles_form($COURSE->id).'</div>';
echo $OUTPUT->footer();
exit;
* @return user|flase A {@link $USER} object or false if error
*/
function authenticate_user_login($username, $password) {
- global $CFG, $DB;
+ global $CFG, $DB, $OUTPUT;
$authsenabled = get_enabled_auth_plugins();
include_once($CFG->dirroot .'/sso/'. $CFG->sso .'/lib.php');
if (function_exists('sso_user_login')) {
if (!sso_user_login($username, $password)) { // Perform the signon process
- notify('Second sign-on failed');
+ echo $OUTPUT->notification('Second sign-on failed');
}
}
}
* failed, but you have no way of knowing which.
*/
function delete_course($courseorid, $showfeedback = true) {
- global $CFG, $DB;
+ global $CFG, $DB, $OUTPUT;
$result = true;
if (is_object($courseorid)) {
if (!remove_course_contents($courseid, $showfeedback)) {
if ($showfeedback) {
- notify("An error occurred while deleting some of the course contents.");
+ echo $OUTPUT->notification("An error occurred while deleting some of the course contents.");
}
$result = false;
}
/// Delete all roles and overiddes in the course context
if (!delete_context(CONTEXT_COURSE, $courseid)) {
if ($showfeedback) {
- notify("An error occurred while deleting the main course context.");
+ echo $OUTPUT->notification("An error occurred while deleting the main course context.");
}
$result = false;
}
if (!fulldelete($CFG->dataroot.'/'.$courseid)) {
if ($showfeedback) {
- notify("An error occurred while deleting the course files.");
+ echo $OUTPUT->notification("An error occurred while deleting the course files.");
}
$result = false;
}
* failed, but you have no way of knowing which.
*/
function remove_course_contents($courseid, $showfeedback=true) {
- global $CFG, $DB;
+ global $CFG, $DB, $OUTPUT;
require_once($CFG->libdir.'/questionlib.php');
require_once($CFG->libdir.'/gradelib.php');
include_once($formatlib);
if (function_exists($formatdelete)) {
if ($showfeedback) {
- notify($strdeleted.' '.$format);
+ echo $OUTPUT->notification($strdeleted.' '.$format);
}
$formatdelete($course->id);
}
$count++;
} else {
- notify('Could not delete '. $modname .' instance '. $instance->id .' ('. format_string($instance->name) .')');
+ echo $OUTPUT->notification('Could not delete '. $modname .' instance '. $instance->id .' ('. format_string($instance->name) .')');
$result = false;
}
if ($cm) {
}
}
} else {
- notify('Function '.$moddelete.'() doesn\'t exist!');
+ echo $OUTPUT->notification('Function '.$moddelete.'() doesn\'t exist!');
$result = false;
}
}
}
if ($showfeedback) {
- notify($strdeleted .' '. $count .' x '. $modname);
+ echo $OUTPUT->notification($strdeleted .' '. $count .' x '. $modname);
}
}
} else {
foreach ($tablestoclear as $table => $col) {
if ($DB->delete_records($table, array($col=>$course->id))) {
if ($showfeedback) {
- notify($strdeleted . ' ' . $table);
+ echo $OUTPUT->notification($strdeleted . ' ' . $table);
}
} else {
$result = false;
$DB->delete_records("course_meta", array("parent_course"=>$course->id));
sync_metacourse($course->id); // have to do it here so the enrolments get nuked. sync_metacourses won't find it without the id.
if ($showfeedback) {
- notify("$strdeleted course_meta");
+ echo $OUTPUT->notification("$strdeleted course_meta");
}
} else {
if ($parents = $DB->get_records("course_meta", array("child_course"=>$course->id))) {
remove_from_metacourse($parent->parent_course,$parent->child_course); // this will do the unenrolments as well.
}
if ($showfeedback) {
- notify("$strdeleted course_meta");
+ echo $OUTPUT->notification("$strdeleted course_meta");
}
}
}
* @return string|false Returns full path to directory if successful, false if not
*/
function make_user_directory($userid, $test=false) {
- global $CFG;
+ global $CFG, $OUTPUT;
if (is_bool($userid) || $userid < 0 || !preg_match('/^[0-9]{1,10}$/', $userid) || $userid > 2147483647) {
if (!$test) {
- notify("Given userid was not a valid integer! (" . gettype($userid) . " $userid)");
+ echo $OUTPUT->notification("Given userid was not a valid integer! (" . gettype($userid) . " $userid)");
}
return false;
}
* @return array An associative array: userid=>array(basedir => $basedir, userfolder => $userfolder)
*/
function get_user_directories($only_non_empty=true, $legacy=false) {
- global $CFG;
+ global $CFG, $OUTPUT;
$rootdir = $CFG->dataroot."/user";
$dirlist[$userid] = array('basedir' => $rootdir, 'userfolder' => $userid);
}
} else {
- notify("no directories found under $rootdir");
+ echo $OUTPUT->notification("no directories found under $rootdir");
}
} else {
if ($grouplist =get_directory_list($rootdir, '', true, true, false)) { // directories will be in the form 0, 1000, 2000 etc...
}
}
} else {
- notify("$rootdir does not exist!");
+ echo $OUTPUT->notification("$rootdir does not exist!");
return false;
}
return $dirlist;
* @return bool|string
*/
function print_file_upload_error($filearray = '', $returnerror = false) {
-
+ global $OUTPUT;
if ($filearray == '' or !isset($filearray['error'])) {
if (empty($_FILES)) return false;
if ($returnerror) {
return $errmessage;
} else {
- notify($errmessage);
+ echo $OUTPUT->notification($errmessage);
return true;
}
* @return bool
*/
function moodle_needs_upgrading() {
- global $CFG, $DB;
+ global $CFG, $DB, $OUTPUT;
$version = null;
include_once($CFG->dirroot .'/version.php'); # defines $version and upgrades
foreach ($mods as $mod => $fullmod) {
$module = new object();
if (!is_readable($fullmod .'/version.php')) {
- notify('Module "'. $mod .'" is not readable - check permissions');
+ echo $OUTPUT->notification('Module "'. $mod .'" is not readable - check permissions');
continue;
}
include_once($fullmod .'/version.php'); # defines $module with version etc
* @uses HOURSECS
*/
function notify_login_failures() {
- global $CFG, $DB;
+ global $CFG, $DB, $OUTPUT;
$recip = get_users_from_config($CFG->notifyloginfailures, 'moodle/site:config');
parent::prepare();
}
+ /**
+ * This is a shortcut for creating a help_icon with only the 2 required params
+ * @param string $page The keyword that defines a help page
+ * @param string $text A descriptive text
+ * @return moodle_help_icon A moodle_help_icon object with the two common fields initialised.
+ */
+ public static function make($page, $text, $module='moodle', $linktext=false) {
+ $helpicon = new moodle_help_icon();
+ $helpicon->page = $page;
+ $helpicon->text = $text;
+ $helpicon->module = $module;
+ $helpicon->linktext = $linktext;
+ return $helpicon;
+ }
+
public static function make_scale_menu($courseid, $scale) {
$helpbutton = new moodle_help_icon();
$strscales = get_string('scales');
return true;
} else {
$this->print_header('configexport');
- print_simple_box_start();
+ echo $OUTPUT->box_start();
$mform->display();
- print_simple_box_end();
+ echo $OUTPUT->box_end();
echo $OUTPUT->footer();
return false;;
}
$yesurl = $CFG->wwwroot . '/portfolio/add.php?stage=' . PORTFOLIO_STAGE_QUEUEORWAIT;
$nourl = $CFG->wwwroot . '/portfolio/add.php?cancel=1';
$this->print_header('confirmexport');
- print_simple_box_start();
+ echo $OUTPUT->box_start();
echo $OUTPUT->heading(get_string('confirmsummary', 'portfolio'), 4);
$mainsummary = array();
if (!$this->instance->get_export_config('hideformat')) {
}
print_table($table);
notice_yesno($strconfirm, $yesurl, $nourl);
- print_simple_box_end();
+ echo $OUTPUT->box_end();
echo $OUTPUT->footer();
return false;
}
return;
}
- print_simple_box_start();
+ echo $OUTPUT->box_start();
echo $this->caller->heading_summary();
- print_simple_box_end();
+ echo $OUTPUT->box_end();
}
/**
global $CFG, $OUTPUT;
$title = get_string('exportexpired', 'portfolio');
print_header($title, $title, build_navigation(get_string('exportexpired', 'portfolio')));
- notify(get_string('exportexpireddesc', 'portfolio'));
- print_continue($CFG->wwwroot);
+ echo $OUTPUT->notification(get_string('exportexpireddesc', 'portfolio'));
+ echo $OUTPUT->continue_button($CFG->wwwroot);
echo $OUTPUT->footer();
exit;
}
*
*/
function portfolio_report_insane($insane, $instances=false, $return=false) {
+ global $OUTPUT;
if (empty($insane)) {
return;
}
$headerstr = get_string('somepluginsdisabled', 'portfolio');
}
- $output = notify($headerstr, 'notifyproblem', 'center', true);
+ $output = $OUTPUT->notification($headerstr, 'notifyproblem');
$table = new StdClass;
$table->head = array($pluginstr, '');
$table->data = array();
* @return boolean
*/
function question_delete_course_category($category, $newcategory, $feedback=true) {
- global $DB;
+ global $DB, $OUTPUT;
$context = get_context_instance(CONTEXT_COURSECAT, $category->id);
if (empty($newcategory)) {
$a = new stdClass;
$a->oldplace = print_context_name($context);
$a->newplace = print_context_name($newcontext);
- notify(get_string('movedquestionsandcategories', 'question', $a), 'notifysuccess');
+ echo $OUTPUT->notification(get_string('movedquestionsandcategories', 'question', $a), 'notifysuccess');
}
}
* or record that changes need to be made for a later regrade.
*/
function regrade_question_in_attempt($question, $attempt, $cmoptions, $verbose=false, $dryrun=false) {
- global $DB;
+ global $DB, $OUTPUT;
// load all states for this question in this attempt, ordered in sequence
if ($states = $DB->get_records('question_states',
$error = question_process_comment($question, $replaystate, $attempt,
$replaystate->manualcomment, $states[$j]->grade);
if (is_string($error)) {
- notify($error);
+ echo $OUTPUT->notification($error);
}
} else {
$replaystate->grade = $states[$j]->grade;
$a = new stdClass;
$a->qid = $question->id;
$a->stateid = $states[$j]->id;
- notify(get_string('errorduringregrade', 'question', $a));
+ echo $OUTPUT->notification(get_string('errorduringregrade', 'question', $a));
}
// We need rounding here because grades in the DB get truncated
// e.g. 0.33333 != 0.3333333, but we want them to be equal here
* error..
*/
function question_get_real_state($state){
+ global $OUTPUT;
$realstate = clone($state);
$matches = array();
if (!preg_match('|^random([0-9]+)-(.*)|', $state->answer, $matches)){
- notify(get_string('errorrandom', 'quiz_statistics'));
+ echo $OUTPUT->notification(get_string('errorrandom', 'quiz_statistics'));
return false;
} else {
$realstate->question = $matches[1];
}
flush();
populate_test_database($syscontext, 10, 100, 1000, 5000, 5000);
- notify('Test tables created.', 'notifysuccess');
+ echo $OUTPUT->notification('Test tables created.', 'notifysuccess');
} else if ($issetup == count($requiredtables)) {
- notify('Test tables are already set up.', 'notifysuccess');
+ echo $OUTPUT->notification('Test tables are already set up.', 'notifysuccess');
} else {
- notify('Something is wrong, please delete the test tables and try again.');
+ echo $OUTPUT->notification('Something is wrong, please delete the test tables and try again.');
}
break;
}
}
$issetup = 0;
- notify('Test tables dropped.', 'notifysuccess');
+ echo $OUTPUT->notification('Test tables dropped.', 'notifysuccess');
break;
case 'test':
if ($issetup != count($requiredtables)) {
- notify('Something is wrong, please delete the test tables and try again.');
+ echo $OUTPUT->notification('Something is wrong, please delete the test tables and try again.');
} else {
$contexts = $DB->get_records('context');
$numcalls = 1000;
}
function populate_test_database($syscontext, $numcategories, $numcourses, $nummodules, $numoverrides, $numconfigs) {
- global $DB;
+ global $DB, $OUTPUT;
set_time_limit(600);
$syscontext->id = $DB->insert_record('context', $syscontext);
$categoryparents[] = $context;
$categories[$context->id] = $context;
}
- notify('Created ' . $numcategories . ' course category contexts.', 'notifysuccess'); flush();
+ echo $OUTPUT->notification('Created ' . $numcategories . ' course category contexts.', 'notifysuccess'); flush();
// Course contexts.
$courses = array();
$context = insert_context(CONTEXT_COURSE, $i, $categories[array_rand($categories)]);
$courses[$context->id] = $context;
}
- notify('Created ' . $numcourses . ' course contexts.', 'notifysuccess'); flush();
+ echo $OUTPUT->notification('Created ' . $numcourses . ' course contexts.', 'notifysuccess'); flush();
// Activities contexts.
$mods = array();
}
}
$DB->commit_sql();
- notify('Created ' . $nummodules . ' module contexts.', 'notifysuccess'); flush();
+ echo $OUTPUT->notification('Created ' . $nummodules . ' module contexts.', 'notifysuccess'); flush();
$contexts = $categories + $courses + $mods;
filter_set_global_state($filter, $state);
$counts[$state]++;
}
- notify('Set global setting: ' . $counts[TEXTFILTER_DISABLED] . ' disabled, ' .
+ echo $OUTPUT->notification('Set global setting: ' . $counts[TEXTFILTER_DISABLED] . ' disabled, ' .
$counts[TEXTFILTER_OFF] . ' off and ' . $counts[TEXTFILTER_ON] . ' on.', 'notifysuccess'); flush();
// Local overrides.
}
}
$DB->commit_sql();
- notify('Set ' . $numoverrides . ' local overrides.', 'notifysuccess'); flush();
+ echo $OUTPUT->notification('Set ' . $numoverrides . ' local overrides.', 'notifysuccess'); flush();
// Local config.
$variablenames = array('frog' => 0, 'toad' => 0, 'elver' => 0, 'eft' => 0, 'tadpole' => 0);
}
}
$DB->commit_sql();
- notify('Set ' . $numconfigs . ' local configs.', 'notifysuccess'); flush();
+ echo $OUTPUT->notification('Set ' . $numconfigs . ' local configs.', 'notifysuccess'); flush();
}
function insert_context($contextlevel, $instanceid, $parent) {
array_pop($requiredlangs);
foreach ($requiredlangs as $lang) {
if (!isset($installedlangs[$lang])) {
- notify('You must install the following language packs to run these test: ' . implode(', ', $requiredlangs));
+ echo $OUTPUT->notification('You must install the following language packs to run these test: ' . implode(', ', $requiredlangs));
echo $OUTPUT->footer();
die;
}
$select = html_select::make($downloadoptions, 'download', $this->defaultdownloadformat, false);
$select->nothingvalue = '';
$html .= $OUTPUT->select($select);
- $html .= helpbutton('tableexportformats', get_string('tableexportformats', 'table'), 'moodle', true, false, '', true);
+ $html .= $OUTPUT->help_icon(moodle_help_icon::make('tableexportformats', get_string('tableexportformats', 'table')));
$html .= '</div></form>';
return $html;
upgrade_setup_debug(false);
ignore_user_abort(false);
if ($continueurl) {
- print_continue($continueurl);
+ echo $OUTPUT->continue_button($continueurl);
echo $OUTPUT->footer();
die;
}
* @param bool $installation true if installation, false menas upgrade
*/
function print_upgrade_part_end($plugin, $installation, $verbose) {
+ global $OUTPUT;
upgrade_started();
if ($installation) {
if (empty($plugin) or $plugin == 'moodle') {
}
}
if ($verbose) {
- notify(get_string('success'), 'notifysuccess');
+ echo $OUTPUT->notification(get_string('success'), 'notifysuccess');
print_upgrade_separator();
}
}
$cd->install();
}
}
- notify(get_string('success'), 'notifysuccess');
+ echo $OUTPUT->notification(get_string('success'), 'notifysuccess');
}
}
* @return boolean
*/
function preprocess_files() {
- global $CFG;
+ global $CFG, $OUTPUT;
foreach ($_FILES as $name => $file) {
$this->status = true; // only set it to true here so that we can check if this function has been called.
$a->name = $this->files[$name]['originalname'];
$a->problem = $this->files[$name]['uploadlog'];
if (!$this->config->silent) {
- notify(get_string('uploadfailednotrecovering','moodle',$a));
+ echo $OUTPUT->notification(get_string('uploadfailednotrecovering','moodle',$a));
}
else {
$this->notify .= '<br />'. get_string('uploadfailednotrecovering','moodle',$a);
} else if (count($this->files) == 1) {
if (!$this->config->silent and !$this->config->allownull) {
- notify($this->files[$name]['uploadlog']);
+ echo $OUTPUT->notification($this->files[$name]['uploadlog']);
} else {
$this->notify .= '<br />'. $this->files[$name]['uploadlog'];
}
* @return boolean status;
*/
function save_files($destination) {
- global $CFG, $USER;
+ global $CFG, $USER, $OUTPUT;
if (!$this->status) { // preprocess_files hasn't been run
$this->preprocess_files();
if (empty($savedsomething)) {
$this->status = false;
if ((empty($this->config->allownull) && !empty($this->inputname)) || (empty($this->inputname) && empty($this->config->allownullmultiple))) {
- notify(get_string('uploadnofilefound'));
+ echo $OUTPUT->notification(get_string('uploadnofilefound'));
}
return false;
}
* @param array $exceptions Full paths of files to KEEP.
*/
function delete_other_files($destination, $exceptions=null) {
+ global $OUTPUT;
$deletedsomething = false;
if ($filestodel = get_directory_list($destination)) {
foreach ($filestodel as $file) {
}
if ($deletedsomething) {
if (!$this->config->silent) {
- notify(get_string('uploadoldfilesdeleted'));
+ echo $OUTPUT->notification(get_string('uploadoldfilesdeleted'));
}
else {
$this->notify .= '<br />'. get_string('uploadoldfilesdeleted');
$SESSION->inserttextform = $form;
$SESSION->inserttextfield = $field;
- $imagetext = '<img src="' . $OUTPUT->old_icon_url('s/smiley') . '" alt="" class="emoticon" style="margin-left:3px; padding-right:1px;width:15px;height:15px;" />';
- $help = helpbutton('emoticons2', get_string('helpemoticons'), 'moodle', true, true, '', true, $imagetext);
+ $helpicon = moodle_help_icon::make('emoticons2', get_string('helpemoticons'), 'moodle', true);
+ $helpicon->image->src = $OUTPUT->old_icon_url('s/smiley');
+ $helpicon->image->add_class('emoticon');
+ $helpicon->style = "margin-left:3px; padding-right:1px;width:15px;height:15px;";
+ $help = $OUTPUT->help_icon($helpicon);
if (!$return){
echo $help;
} else {
}
echo $OUTPUT->box($message, 'generalbox', 'notice');
- print_continue($link);
+ echo $OUTPUT->continue_button($link);
echo $OUTPUT->footer();
exit(1); // general error code
/// TODO XXX: This is only a quick hack ... helpfile locations should be provided as part of the provider definition
if ($provider->component == 'moodle') {
- $helpbtn = helpbutton('moodle_'.$provider->name, $providername, 'message', true, false, '', true);
+ $helpbtn = $OUTPUT->help_icon(moodle_help_icon::make('moodle_'.$provider->name, $providername, 'message'));
} else {
- $helpbtn = helpbutton('message_'.$provider->name, $providername, basename($provider->component), true, false, '', true);
+ $helpbtn = $OUTPUT->help_icon(moodle_help_icon::make('message_'.$provider->name, $providername, basename($provider->component)));
}
echo '<tr><th align="right">'.$providername.$helpbtn.'</th><td colspan="'.$number_procs.'"></td></tr>'."\n";
function message_print_search_results($frm) {
- global $USER, $CFG, $DB;
+ global $USER, $CFG, $DB, $OUTPUT;
echo '<div class="mdl-align">';
echo '</table>';
} else {
- notify(get_string('nosearchresults', 'message'));
+ echo $OUTPUT->notification(get_string('nosearchresults', 'message'));
}
echo '</table>';
} else {
- notify(get_string('nosearchresults', 'message'));
+ echo $OUTPUT->notification(get_string('nosearchresults', 'message'));
}
/// what the ????, probably an empty search string, duh!
} else {
- notify(get_string('emptysearchstring', 'message'));
+ echo $OUTPUT->notification(get_string('emptysearchstring', 'message'));
}
echo '<br />';
//MW theres no easy way to log in seamlessly. We need the users unhashed password.
// It's a security risk to carry that in $SESSION so we put up login form.
print_header();
- notify('Your session has expired. Please log in again.');
+ echo $OUTPUT->notification('Your session has expired. Please log in again.');
?>
<form action="login.php" method="post" id="login">
<table border="0" align="center">