MDL-19794 Upgraded calls to helpbutton, print_simple_box* and notify

This commit is contained in:
nicolasconnault 2009-08-18 04:58:26 +00:00
parent 91599e5f4a
commit e6db30260f
19 changed files with 67 additions and 66 deletions

View File

@ -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();

View File

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

View File

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

View File

@ -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.
}

View File

@ -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;
@ -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;
@ -168,7 +168,7 @@
///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)) ) {
@ -176,13 +176,13 @@
//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

View File

@ -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>';

View File

@ -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
@ -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();

View File

@ -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);
@ -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;

View File

@ -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;
}
@ -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;
}
@ -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"';
@ -835,7 +835,7 @@ function print_overview($courses) {
echo $html;
}
}
print_simple_box_end();
echo $OUTPUT->box_end();
}
}
@ -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)) {
@ -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) {
@ -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');
@ -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);
}
@ -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
@ -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>';
}
}
@ -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');
@ -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;
}
@ -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;
}
@ -3209,7 +3209,7 @@ 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);
@ -3217,7 +3217,7 @@ function move_courses($courseids, $categoryid) {
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++;

View File

@ -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;
@ -86,7 +87,7 @@
$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
@ -94,10 +95,10 @@
$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",

View File

@ -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;
@ -238,7 +238,7 @@
}
if (!$inbox) {
print_simple_box_start('center', '90%');
echo $OUTPUT->box_start();
$inbox = true;
}
@ -251,7 +251,7 @@
}
if ($inbox) {
print_simple_box_end();
echo $OUTPUT->box_end();
}

View File

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

View File

@ -126,7 +126,7 @@
echo $OUTPUT->select(html_select::make($roleoptions,'roleid',$roleid,false));
echo '<label for="menuaction">'.get_string('showactions').'</label>'."\n";
echo $OUTPUT->select(html_select::make($actionoptions,'action',$action,false));
helpbutton('participationreport',get_string('participationreport'));
echo $OUTPUT->help_icon(moodle_help_icon::make('participationreport',get_string('participationreport')));
echo '<input type="submit" value="'.get_string('go').'" />'."\n</div></form>\n";
$baseurl = $CFG->wwwroot.'/course/report/participation/index.php?id='.$course->id.'&amp;roleid='
@ -281,7 +281,7 @@
$select->label = get_string("withselectedusers");
$select->add_action('change', 'conditionalsubmit', array('formid' => 'studentsform'));
echo $OUTPUT->select($select);
helpbutton("participantswithselectedusers", get_string("withselectedusers"));
echo $OUTPUT->help_icon(moodle_help_icon::make("participantswithselectedusers", get_string("withselectedusers")));
echo '<input type="submit" value="' . get_string('ok') . '" />'."\n";
echo '</div>'."\n";
echo '</form>'."\n";

View File

@ -100,7 +100,7 @@
$stats = $DB->get_records_sql($sql, $params);
if (empty($stats)) {
notify(get_string('statsnodata'));
echo $OUTPUT->notification(get_string('statsnodata'));
} else {

View File

@ -67,7 +67,7 @@ if ($mform->is_cancelled()) {
$table->data = $data;
print_table($table);
print_continue('view.php?id='.$course->id); // Back to course page
echo $OUTPUT->continue_button('view.php?id='.$course->id); // Back to course page
echo $OUTPUT->footer();
exit;
}
@ -76,7 +76,7 @@ if ($mform->is_cancelled()) {
print_header($course->fullname.': '.$strresetcourse, $course->fullname.': '.$strresetcourse, $navigation);
echo $OUTPUT->heading($strresetcourse);
print_simple_box(get_string('resetinfo'), 'center', '60%');
echo $OUTPUT->box(get_string('resetinfo'));
$mform->display();
echo $OUTPUT->footer();

View File

@ -34,13 +34,13 @@
$scalemenu = make_menu_from_list($scale->scale);
print_simple_box_start("center");
echo $OUTPUT->box_start();
echo $OUTPUT->heading($scale->name);
echo "<center>";
echo $OUTPUT->select(html_select::make($scalemenu));
echo "</center>";
echo text_to_html($scale->description);
print_simple_box_end();
echo $OUTPUT->box_end();
echo $OUTPUT->close_window_button();
echo $OUTPUT->footer();
exit;
@ -60,13 +60,13 @@
foreach ($scales as $scale) {
$scalemenu = make_menu_from_list($scale->scale);
print_simple_box_start("center");
echo $OUTPUT->box_start();
echo $OUTPUT->heading($scale->name);
echo "<center>";
echo $OUTPUT->select(html_select::make($scalemenu));
echo "</center>";
echo text_to_html($scale->description);
print_simple_box_end();
echo $OUTPUT->box_end();
echo "<hr />";
}
@ -83,13 +83,13 @@
foreach ($scales as $scale) {
$scalemenu = make_menu_from_list($scale->scale);
print_simple_box_start("center");
echo $OUTPUT->box_start();
echo $OUTPUT->heading($scale->name);
echo "<center>";
echo $OUTPUT->select(html_select::make($scalemenu));
echo $OUTPUT->select(html_select::make($scalemenu, ''));
echo "</center>";
echo text_to_html($scale->description);
print_simple_box_end();
echo $OUTPUT->box_end();
echo "<hr />";
}
}

View File

@ -69,7 +69,7 @@
}
if ($course) {
if (! $DB->set_field("course", "visible", $visible, array("id"=>$course->id))) {
notify("Could not update that course!");
echo $OUTPUT->notification("Could not update that course!");
}
}
}
@ -101,7 +101,7 @@
$navigation = build_navigation($navlinks);
print_header("$site->fullname : $strsearch", $site->fullname, $navigation, "", "");
print_simple_box_start("center");
echo $OUTPUT->box_start();
echo "<center>";
echo "<br />";
print_course_search("", false, "plain");
@ -109,7 +109,7 @@
print_string("searchhelp");
echo "</p>";
echo "</center>";
print_simple_box_end();
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
exit;
}

View File

@ -164,7 +164,7 @@
$statsstatus = stats_check_uptodate($course->id);
if ($statsstatus !== NULL) {
notify ($statsstatus);
echo $OUTPUT->notification($statsstatus);
}
$earliestday = $DB->get_field_sql('SELECT timeend FROM {stats_user_daily} ORDER BY timeend');

View File

@ -123,7 +123,7 @@
if (!empty($section)) {
if (!empty($move) and confirm_sesskey()) {
if (!move_section($course, $section, $move)) {
notify('An error occurred while moving a section');
echo $OUTPUT->notification('An error occurred while moving a section');
}
}
}