Skip to content

Commit

Permalink
MDL-19794 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 91599e5 commit e6db302
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 66 deletions.
2 changes: 1 addition & 1 deletion course/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

echo $OUTPUT->heading( get_string("deletedcourse", "", format_string($course->shortname)) );

print_continue("category.php?id=$course->category");
echo $OUTPUT->continue_button("category.php?id=$course->category");

echo $OUTPUT->footer();

Expand Down
2 changes: 1 addition & 1 deletion course/format/scorm/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
if (function_exists($moduleformat)) {
$moduleformat($USER,$course);
} else {
notify('The module '. $module. ' does not support single activity course format');
echo $OUTPUT->notification('The module '. $module. ' does not support single activity course format');
}
2 changes: 1 addition & 1 deletion course/format/social/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
forum_print_latest_discussions($course, $forum, 10, 'plain', '', false);

} else {
notify('Could not find or create a social forum here');
echo $OUTPUT->notification('Could not find or create a social forum here');
}
2 changes: 1 addition & 1 deletion course/import/activities/mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}

if (empty($options) && empty($creator)) {
notify(get_string('courseimportnotaught'));
echo $OUTPUT->notification(get_string('courseimportnotaught'));
return; // yay , this will pass control back to the file that included or required us.
}

Expand Down
12 changes: 6 additions & 6 deletions course/import/groups/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
//unset invalid courseid
if (isset($newgroup->idnumber)){
if (!$mycourse = $DB->get_record('course', array('idnumber'=>$newgroup->idnumber))) {
notify(get_string('unknowncourseidnumber', 'error', $newgroup->idnumber));
echo $OUTPUT->notification(get_string('unknowncourseidnumber', 'error', $newgroup->idnumber));
unset($newgroup->courseid);//unset so 0 doesnt' get written to database
}
$newgroup->courseid = $mycourse->id;
Expand All @@ -147,7 +147,7 @@

else if (isset($newgroup->coursename)){
if (!$mycourse = $DB->get_record('course', array('shortname', $newgroup->coursename))) {
notify(get_string('unknowncourse', 'error', $newgroup->coursename));
echo $OUTPUT->notification(get_string('unknowncourse', 'error', $newgroup->coursename));
unset($newgroup->courseid);//unset so 0 doesnt' get written to database
}
$newgroup->courseid = $mycourse->id;
Expand All @@ -168,21 +168,21 @@

///Users cannot upload groups in courses they cannot update.
if (!has_capability('moodle/course:managegroups', $newgrpcoursecontext)){
notify(get_string('nopermissionforcreation','group',$groupname));
echo $OUTPUT->notification(get_string('nopermissionforcreation','group',$groupname));

} else {
if ( $groupid = groups_get_group_by_name($newgroup->courseid, $groupname) || !($newgroup->id = groups_create_group($newgroup)) ) {

//Record not added - probably because group is already registered
//In this case, output groupname from previous registration
if ($groupid) {
notify("$groupname :".get_string('groupexistforcourse', 'error', $groupname));
echo $OUTPUT->notification("$groupname :".get_string('groupexistforcourse', 'error', $groupname));
} else {
notify(get_string('groupnotaddederror', 'error', $groupname));
echo $OUTPUT->notification(get_string('groupnotaddederror', 'error', $groupname));
}
}
else {
notify(get_string('groupaddedsuccesfully', 'group', $groupname));
echo $OUTPUT->notification(get_string('groupaddedsuccesfully', 'group', $groupname));
}
}
} //close courseid validity check
Expand Down
4 changes: 2 additions & 2 deletions course/import/groups/mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
print_heading_with_help($strimportgroups, 'uploadgroups');
$maxuploadsize = get_max_upload_file_size();
echo '<p align="center">';
print_simple_box_start('center','80%');
echo $OUTPUT->box_start();

// use formslib
include_once('import_form.php');
$mform_post = new course_import_groups_form($CFG->wwwroot.'/course/import/groups/index.php?id='.$id, array('maxuploadsize'=>$maxuploadsize));
$mform_post ->display();

print_simple_box_end();
echo $OUTPUT->box_end();

echo '</p>';

Expand Down
6 changes: 3 additions & 3 deletions course/importstudents.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

if (!$frm = data_submitted()) {
$note = get_string("importmetacoursenote");
print_simple_box($note, "center", "50%");
echo $OUTPUT->box($note);

/// A form was submitted so process the input

Expand Down Expand Up @@ -120,11 +120,11 @@
}
}

print_simple_box_start("center");
echo $OUTPUT->box_start();

include('importstudents.html');

print_simple_box_end();
echo $OUTPUT->box_end();

echo $OUTPUT->footer();

Expand Down
6 changes: 3 additions & 3 deletions course/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@
$deletedcourses = category_delete_full($deletecat, true);

foreach($deletedcourses as $course) {
notify(get_string('coursedeleted', '', $course->shortname), 'notifysuccess');
echo $OUTPUT->notification(get_string('coursedeleted', '', $course->shortname), 'notifysuccess');
}
notify(get_string('coursecategorydeleted', '', format_string($deletecat->name)), 'notifysuccess');
echo $OUTPUT->notification(get_string('coursecategorydeleted', '', format_string($deletecat->name)), 'notifysuccess');

} else {
category_delete_move($deletecat, $data->newparent, true);
Expand All @@ -138,7 +138,7 @@
set_config('defaultrequestcategory', $DB->get_field('course_categories', 'MIN(id)', array('parent'=>0)));
}

print_continue('index.php');
echo $OUTPUT->continue_button('index.php');

echo $OUTPUT->footer();
die;
Expand Down
38 changes: 19 additions & 19 deletions course/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per

if (!$logs = build_logs_array($course, $user, $date, $order, $page*$perpage, $perpage,
$modname, $modid, $modaction, $groupid)) {
notify("No logs found!");
echo $OUTPUT->notification("No logs found!");
echo $OUTPUT->footer();
exit;
}
Expand Down Expand Up @@ -395,7 +395,7 @@ function print_mnet_log($hostid, $course, $user=0, $date=0, $order="l.time ASC",

if (!$logs = build_mnet_logs_array($hostid, $course, $user, $date, $order, $page*$perpage, $perpage,
$modname, $modid, $modaction, $groupid)) {
notify("No logs found!");
echo $OUTPUT->notification("No logs found!");
echo $OUTPUT->footer();
exit;
}
Expand Down Expand Up @@ -824,7 +824,7 @@ function print_overview($courses) {
}
}
foreach ($courses as $course) {
print_simple_box_start('center', '100%', '', 5, "coursebox");
echo $OUTPUT->box_start("coursebox");
$linkcss = '';
if (empty($course->visible)) {
$linkcss = 'class="dimmed"';
Expand All @@ -835,7 +835,7 @@ function print_overview($courses) {
echo $html;
}
}
print_simple_box_end();
echo $OUTPUT->box_end();
}
}

Expand Down Expand Up @@ -1655,7 +1655,7 @@ function get_category_or_system_context($categoryid) {
* @param boolean $clearonly - only clear the modinfo fields, gets rebuild automatically on the fly
*/
function rebuild_course_cache($courseid=0, $clearonly=false) {
global $COURSE, $DB;
global $COURSE, $DB, $OUTPUT;

if ($clearonly) {
if (empty($courseid)) {
Expand Down Expand Up @@ -1685,7 +1685,7 @@ function rebuild_course_cache($courseid=0, $clearonly=false) {
foreach ($rs as $course) {
$modinfo = serialize(get_array_of_activities($course->id));
if (!$DB->set_field("course", "modinfo", $modinfo, array("id"=>$course->id))) {
notify("Could not cache module information for course '" . format_string($course->fullname) . "'!");
echo $OUTPUT->notification("Could not cache module information for course '" . format_string($course->fullname) . "'!");
}
// update cached global COURSE too ;-)
if ($course->id == $COURSE->id) {
Expand Down Expand Up @@ -2230,7 +2230,7 @@ function print_course($course, $highlightterms = '') {
* Over time this can include all sorts of information
*/
function print_my_moodle() {
global $USER, $CFG, $DB;
global $USER, $CFG, $DB, $OUTPUT;

if (empty($USER->id)) {
print_error('nopermissions', '', '', 'See My Moodle');
Expand Down Expand Up @@ -2284,9 +2284,9 @@ function print_my_moodle() {

} else {
if ($DB->count_records("course_categories") > 1) {
print_simple_box_start("center", "100%", "#FFFFFF", 5, "categorybox");
echo $OUTPUT->box_start("categorybox");
print_whole_category_list();
print_simple_box_end();
echo $OUTPUT->box_end();
} else {
print_courses(0);
}
Expand Down Expand Up @@ -2726,11 +2726,11 @@ function reorder_sections($sections, $origin_position, $target_position) {
* All parameters are objects
*/
function moveto_module($mod, $section, $beforemod=NULL) {
global $DB;
global $DB, $OUTPUT;

/// Remove original module from original section
if (! delete_mod_from_section($mod->id, $mod->section)) {
notify("Could not delete module from existing section");
echo $OUTPUT->notification("Could not delete module from existing section");
}

/// Update module itself if necessary
Expand Down Expand Up @@ -2979,7 +2979,7 @@ function print_groupmode_setting($form, $course=NULL) {
$select = html_select::make($choices, 'groupmode', $groupmode, false);
$select->disabled = $course->groupmodeforce;
echo $OUTPUT->select($select);
helpbutton('groupmode', get_string('groupmode'));
echo $OUTPUT->help_icon(moodle_help_icon::make('groupmode', get_string('groupmode')));
echo '</td></tr>';
}
}
Expand Down Expand Up @@ -3162,7 +3162,7 @@ function category_delete_full($category, $showfeedback=true) {
* @return bool status
*/
function category_delete_move($category, $newparentid, $showfeedback=true) {
global $CFG, $DB;
global $CFG, $DB, $OUTPUT;
require_once($CFG->libdir.'/gradelib.php');
require_once($CFG->libdir.'/questionlib.php');

Expand All @@ -3178,16 +3178,16 @@ function category_delete_move($category, $newparentid, $showfeedback=true) {

if ($courses = $DB->get_records('course', array('category'=>$category->id), 'sortorder ASC', 'id')) {
if (!move_courses(array_keys($courses), $newparentid)) {
notify("Error moving courses");
echo $OUTPUT->notification("Error moving courses");
return false;
}
notify(get_string('coursesmovedout', '', format_string($category->name)), 'notifysuccess');
echo $OUTPUT->notification(get_string('coursesmovedout', '', format_string($category->name)), 'notifysuccess');
}

// now delete anything that may depend on course category context
grade_course_category_delete($category->id, $newparentid, $showfeedback);
if (!question_delete_course_category($category, $newparentcat, $showfeedback)) {
notify(get_string('errordeletingquestionsfromcategory', 'question', $category), 'notifysuccess');
echo $OUTPUT->notification(get_string('errordeletingquestionsfromcategory', 'question', $category), 'notifysuccess');
return false;
}

Expand All @@ -3197,7 +3197,7 @@ function category_delete_move($category, $newparentid, $showfeedback=true) {

events_trigger('course_category_deleted', $category);

notify(get_string('coursecategorydeleted', '', format_string($category->name)), 'notifysuccess');
echo $OUTPUT->notification(get_string('coursecategorydeleted', '', format_string($category->name)), 'notifysuccess');

return true;
}
Expand All @@ -3209,15 +3209,15 @@ function category_delete_move($category, $newparentid, $showfeedback=true) {
* @param $courseids is an array of course ids
*/
function move_courses($courseids, $categoryid) {
global $CFG, $DB;
global $CFG, $DB, $OUTPUT;

if (!empty($courseids) and $category = $DB->get_record('course_categories', array('id'=>$categoryid))) {
$courseids = array_reverse($courseids);
$i = 1;

foreach ($courseids as $courseid) {
if (!$course = $DB->get_record("course", array("id"=>$courseid))) {
notify("Error finding course $courseid");
echo $OUTPUT->notification("Error finding course $courseid");
} else {
$course->category = $categoryid;
$course->sortorder = $category->sortorder + MAX_COURSES_IN_CATEGORY - $i++;
Expand Down
11 changes: 6 additions & 5 deletions course/mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@

print_header_simple($strdeletecheck, '', build_navigation(array(array('name'=>$strdeletecheck, 'link'=>'', 'type'=>'misc'))));

print_simple_box_start('center', '60%', '#FFAAAA', 20, 'noticebox');
// print_simple_box_start('center', '60%', '#FFAAAA', 20, 'noticebox');
echo $OUTPUT->box_start('noticebox');
notice_yesno($strdeletecheckfull, 'mod.php', $return, $optionsyes, $optionsno, 'post', 'get');
print_simple_box_end();
echo $OUTPUT->box_end();
echo $OUTPUT->footer();

exit;
Expand All @@ -86,18 +87,18 @@
$deleteinstancefunction = $cm->modname."_delete_instance";

if (!$deleteinstancefunction($cm->instance)) {
notify("Could not delete the $cm->modname (instance)");
echo $OUTPUT->notification("Could not delete the $cm->modname (instance)");
}

// remove all module files in case modules forget to do that
$fs = get_file_storage();
$fs->delete_area_files($modcontext->id);

if (!delete_course_module($cm->id)) {
notify("Could not delete the $cm->modname (coursemodule)");
echo $OUTPUT->notification("Could not delete the $cm->modname (coursemodule)");
}
if (!delete_mod_from_section($cm->id, $cm->section)) {
notify("Could not delete the $cm->modname from that section");
echo $OUTPUT->notification("Could not delete the $cm->modname from that section");
}

add_to_log($course->id, 'course', "delete mod",
Expand Down
8 changes: 4 additions & 4 deletions course/recent.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,12 @@

if (($activity->type == 'section') && ($param->sortby == 'default')) {
if ($inbox) {
print_simple_box_end();
echo $OUTPUT->box_end();
$spacer = new html_image();
$spacer->height = 30;
echo $OUTPUT->spacer($spacer) . '<br />';
}
print_simple_box_start('center', '90%');
echo $OUTPUT->box_start();
echo "<h2>$activity->name</h2>";
$inbox = true;

Expand Down Expand Up @@ -238,7 +238,7 @@
}

if (!$inbox) {
print_simple_box_start('center', '90%');
echo $OUTPUT->box_start();
$inbox = true;
}

Expand All @@ -251,7 +251,7 @@
}

if ($inbox) {
print_simple_box_end();
echo $OUTPUT->box_end();
}


Expand Down
6 changes: 3 additions & 3 deletions course/report/log/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,21 @@
case 'downloadascsv':
if (!print_log_csv($course, $user, $date, 'l.time DESC', $modname,
$modid, $modaction, $group)) {
notify("No logs found!");
echo $OUTPUT->notification("No logs found!");
echo $OUTPUT->footer();
}
exit;
case 'downloadasods':
if (!print_log_ods($course, $user, $date, 'l.time DESC', $modname,
$modid, $modaction, $group)) {
notify("No logs found!");
echo $OUTPUT->notification("No logs found!");
echo $OUTPUT->footer();
}
exit;
case 'downloadasexcel':
if (!print_log_xls($course, $user, $date, 'l.time DESC', $modname,
$modid, $modaction, $group)) {
notify("No logs found!");
echo $OUTPUT->notification("No logs found!");
echo $OUTPUT->footer();
}
exit;
Expand Down
Loading

0 comments on commit e6db302

Please sign in to comment.