Skip to content

Commit

Permalink
MDL-19799 Upgraded calls to helpbutton, print_simple_box* and notify
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasconnault committed Aug 18, 2009
1 parent 362874d commit aa9a686
Show file tree
Hide file tree
Showing 27 changed files with 133 additions and 110 deletions.
4 changes: 2 additions & 2 deletions error/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

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()) {
?>
Expand All @@ -61,7 +61,7 @@
</form>
<?php
} else {
print_continue($CFG->wwwroot);
echo $OUTPUT->continue_button($CFG->wwwroot);
}
echo $OUTPUT->footer();
?>
4 changes: 2 additions & 2 deletions files/draftfiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
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');
Expand All @@ -120,7 +120,7 @@
print_header();

if ($notice !== '') {
notify($notice);
echo $OUTPUT->notification($notice);
}

echo '<div class="areafiles">';
Expand Down
4 changes: 2 additions & 2 deletions files/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
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();
Expand All @@ -136,7 +136,7 @@
html_header($context, $file_info);

if ($error !== '') {
notify($error);
echo $OUTPUT->notification($error);
}

displaydir($file_info);
Expand Down
6 changes: 3 additions & 3 deletions help.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@

// 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.
Expand Down
6 changes: 3 additions & 3 deletions lib/accesslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3269,7 +3269,7 @@ function reset_role_capabilities($roleid) {
* @return boolean true if success, exception in case of any problems
*/
function update_capabilities($component='moodle') {
global $DB;
global $DB, $OUTPUT;

$storedcaps = array();

Expand Down Expand Up @@ -3332,7 +3332,7 @@ function update_capabilities($component='moodle') {
//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);
}
}
}
Expand All @@ -3341,7 +3341,7 @@ function update_capabilities($component='moodle') {
// 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
Expand Down
4 changes: 2 additions & 2 deletions lib/completionlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ public function is_enabled($cm=null) {
* @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>';
}
}
Expand Down
8 changes: 4 additions & 4 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// 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

Expand Down Expand Up @@ -113,7 +113,7 @@ function xmldb_main_upgrade($oldversion) {
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 {
Expand All @@ -125,7 +125,7 @@ function xmldb_main_upgrade($oldversion) {
}

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
Expand Down Expand Up @@ -2141,7 +2141,7 @@ function xmldb_main_upgrade($oldversion) {
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
Expand Down
8 changes: 4 additions & 4 deletions lib/db/upgradelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function upgrade_migrate_files_courses() {
* 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)) {
Expand Down Expand Up @@ -114,7 +114,7 @@ function upgrade_migrate_files_course($context, $path, $delete) {

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;
}

Expand Down Expand Up @@ -168,7 +168,7 @@ function upgrade_migrate_files_course($context, $path, $delete) {
* 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();

Expand Down Expand Up @@ -199,7 +199,7 @@ function upgrade_migrate_files_blog() {
}

if (!is_readable($pathname)) {
notify(" File not readable, skipping: ".$pathname);
echo $OUTPUT->notification(" File not readable, skipping: ".$pathname);
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/environmentlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ function print_moodle_environment($result, $environment_results) {

/// 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');
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/form/editorhelp.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

}
print_header();
print_simple_box_start('center', '96%');
echo $OUTPUT->box_start();
echo $OUTPUT->heading(get_string('editorhelptopics'));


Expand All @@ -64,7 +64,7 @@
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;
Expand Down
3 changes: 2 additions & 1 deletion lib/form/warning.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ function setHelpButton($helpbuttonargs, $function='helpbutton'){
}

function toHtml() {
return notify($this->_text, $this->_class, 'center', true);
global $OUTPUT;
return $OUTPUT->notification($this->_text, $this->_class);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions lib/gdlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function save_profile_image($id, $userform, $dir='user') {
* @return boolean
*/
function process_profile_image($originalfile, $destination) {
global $CFG;
global $CFG, $OUTPUT;

if(!(is_file($originalfile) && is_dir($destination))) {
return false;
Expand Down Expand Up @@ -263,7 +263,7 @@ function process_profile_image($originalfile, $destination) {
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;
}
Expand All @@ -278,7 +278,7 @@ function process_profile_image($originalfile, $destination) {
* @return boolean
*/
function upgrade_profile_image($id, $dir='users') {
global $CFG;
global $CFG, $OUTPUT;

$im = ImageCreateFromJPEG($CFG->dataroot .'/'. $dir .'/'. $id .'/f1.jpg');

Expand Down Expand Up @@ -333,7 +333,7 @@ function upgrade_profile_image($id, $dir='users') {
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;
}
Expand Down
14 changes: 7 additions & 7 deletions lib/gradelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1112,13 +1112,13 @@ function grade_update_mod_grades($modinstance, $userid=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'));
}
}
/**
Expand All @@ -1129,14 +1129,14 @@ function remove_grade_letters($context, $showfeedback) {
* @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))) {
Expand All @@ -1146,7 +1146,7 @@ function remove_course_grades($courseid, $showfeedback) {
}
$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))) {
Expand All @@ -1155,12 +1155,12 @@ function remove_course_grades($courseid, $showfeedback) {
}
}
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'));
}
}

Expand Down
Loading

0 comments on commit aa9a686

Please sign in to comment.