]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19794 Upgraded calls to helpbutton, print_simple_box* and notify
authornicolasconnault <nicolasconnault>
Tue, 18 Aug 2009 04:58:26 +0000 (04:58 +0000)
committernicolasconnault <nicolasconnault>
Tue, 18 Aug 2009 04:58:26 +0000 (04:58 +0000)
19 files changed:
course/delete.php
course/format/scorm/format.php
course/format/social/format.php
course/import/activities/mod.php
course/import/groups/index.php
course/import/groups/mod.php
course/importstudents.php
course/index.php
course/lib.php
course/mod.php
course/recent.php
course/report/log/index.php
course/report/participation/index.php
course/report/stats/report.php
course/reset.php
course/scales.php
course/search.php
course/user.php
course/view.php

index bfc3acf33e90bfdb3a9f50013fb2d22a1e06ef3a..843fe3a6cc7bc724ca02f17f8a277e94e9f605e7 100644 (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();
 
index 37032b5eefab551c5d44bb762487b8ba3eff2da2..d92ea4f2f2ce62df58221c06d0fd0cd92e3d9645 100644 (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');
     }
index b3ab1faf2a635c8fb5688c1080a7bd67ee040a75..659ae065b6433166eaf93a4c3fb0756b586df27d 100644 (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');
     }
index 944aa1a2a474abe5eefb8bf950545f9b2313175d..36d5cc138660e96f6914ab583928533782e8e18b 100644 (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.
     }
 
index 0c2d97980197eb848de5b7447a8d815b7bad9ac9..478e12f4fc69e242687d3256a27c433c6bf42518 100755 (executable)
                 //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;
 
                 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;
 
                     ///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
index 141a639a9b952d5146bc6f3f88f4f34622cf90ed..df47c707d8356cb7ad4c9b551f9f048c099bbf19 100644 (file)
     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>';
 
index dc56aa2f072df24e659f673d3e705eaf2ac77bc5..9ac1efd2c840fe9c837b055cc2b87cc894ec5f05 100644 (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
 
         }
     }
 
-    print_simple_box_start("center");
+    echo $OUTPUT->box_start();
 
     include('importstudents.html');
 
-    print_simple_box_end();
+    echo $OUTPUT->box_end();
 
     echo $OUTPUT->footer();
 
index 48fcba31605a5dae85ce4719841c446076e718dc..da44a214b46bdd5ecb6a20b80e474c3a1153ce95 100644 (file)
             $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);
             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;
index 71c1fb057fdbc034061952464f28863e8e6e475a..8b15ab81152a68679508827452e21513e7ccfbd8 100644 (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++;
index e73795613d6e272f8d301b1afe0c6e90f00a3cb7..efb582e8e80f55730ddfe3fb5dae716adb4a47d4 100644 (file)
 
             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
         $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",
index dd1af297e38ef13a787b5405ba024139ecffbd1b..ced879bf65264d3696eace561527c874ab884a6a 100644 (file)
 
             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;
 
                 }
 
                 if (!$inbox) {
-                    print_simple_box_start('center', '90%');
+                    echo $OUTPUT->box_start();
                     $inbox = true;
                 }
 
         }
 
         if ($inbox) {
-            print_simple_box_end();
+            echo $OUTPUT->box_end();
         }
 
 
index 299f8c5713a7fcdcf1c8a26111dcc4b5108889c2..9b5c2839bbf385157f38547b8a546a356f6b1ad3 100644 (file)
             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;
index 846376df8ff9c3d96e6635948ff8e48dc978bcec..b01ffbc37d8a19da53514c4b618e8f75b2853043 100644 (file)
     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='
         $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";
index 274039c36b4a67aba799133697f7c8097d34546f..6ec63ca0b70ecc4dec2bd350fa381507a82397bf 100644 (file)
         $stats = $DB->get_records_sql($sql, $params);
 
         if (empty($stats)) {
-            notify(get_string('statsnodata'));
+            echo $OUTPUT->notification(get_string('statsnodata'));
 
         } else {
 
index c91e09846bb15869b10ea3d3af65d47f6baa850d..460252e09b83f83ab7105865952ecde4b70ccde5 100755 (executable)
@@ -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();
index adbcba7868c9c10aa8cffa7430ef2f224cb5d35a..8c44d7daf6fbd07d1135d889087bbc65883416ea 100644 (file)
 
                 $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;
         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 />";
         }
 
         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 />";
         }
     }
index 780cc961756d487c36775932a4cd5d1821102935..e9f82b0d9e86868c76a86d6c915ae8062a3b5a86 100644 (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!");
                 }
             }
         }
         $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");
         print_string("searchhelp");
         echo "</p>";
         echo "</center>";
-        print_simple_box_end();
+        echo $OUTPUT->box_end();
         echo $OUTPUT->footer();
         exit;
     }
index 82267b738cfecaab2fb3c8ed9af21f2c3f549615..3f7d265578355b7d4e0dc0f120e67bd0b5f99846 100644 (file)
 
             $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');
index 72936683ccf0a05d3dcc13dbacc076a9de449624..a17f966a08f93efdd451265a42ad208a482043c7 100644 (file)
         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');
                 }
             }
         }