]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19794 upgraded calls to print_table, print_single_button, print_user_picture...
authornicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 08:40:19 +0000 (08:40 +0000)
committernicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 08:40:19 +0000 (08:40 +0000)
course/category.php
course/delete.php
course/import/activities/mod.php
course/index.php
course/lib.php
course/mod.php
course/pending.php
course/report/stats/report.php
course/reset.php
course/unenrol.php
course/user.php

index 5d0df0656863b29d23333c29985c4d89f0fa6e6e..2a6aa8a5c916e92380b735c610d1e67bb67cb9be 100644 (file)
     }
 
     if ($editingon && has_capability('moodle/category:manage', $context)) {
-        echo '<div class="buttons">';
+        echo $OUTPUT->container_start('buttons');
 
         // Print button to update this category
         $options = array('id' => $category->id);
-        print_single_button($CFG->wwwroot.'/course/editcategory.php', $options, get_string('editcategorythis'), 'get');
+        echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/course/editcategory.php', $options, get_string('editcategorythis'), 'get'));
 
         // Print button for creating new categories
         $options = array('parent' => $category->id);
-        print_single_button($CFG->wwwroot.'/course/editcategory.php', $options, get_string('addsubcategory'), 'get');
+        echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/course/editcategory.php', $options, get_string('addsubcategory'), 'get'));
 
-        echo '</div>';
+        echo $OUTPUT->container_end();
     }
 
 /// Print out all the sub-categories
         $options['id'] = $category->id;
         $options['resort'] = 'name';
         $options['sesskey'] = sesskey();
-        print_single_button('category.php', $options, get_string('resortcoursesbyname'), 'get');
+        echo $OUTPUT->button(html_form::make_button('category.php', $options, get_string('resortcoursesbyname'), 'get'));
     }
 
     if (has_capability('moodle/course:create', $context)) {
     /// Print button to create a new course
         unset($options);
         $options['category'] = $category->id;
-        print_single_button('edit.php', $options, get_string('addnewcourse'), 'get');
+        echo $OUTPUT->button(html_form::make_button('edit.php', $options, get_string('addnewcourse'), 'get'));
     }
 
     if (!empty($CFG->enablecourserequests) && $category->id == $CFG->enablecourserequests) {
index 843fe3a6cc7bc724ca02f17f8a277e94e9f605e7..b513b144c95644ef79d41593ac2bb9711798da81 100644 (file)
 
         print_header("$site->shortname: $strdeletecheck", $site->fullname, $navigation);
 
-        notice_yesno("$strdeletecoursecheck<br /><br />" . format_string($course->fullname) .
-                     " (" . format_string($course->shortname) . ")",
-                     "delete.php?id=$course->id&amp;delete=".md5($course->timemodified)."&amp;sesskey=".sesskey(),
-                     "category.php?id=$course->category");
+        $message = "$strdeletecoursecheck<br /><br />" . format_string($course->fullname) .  " (" . format_string($course->shortname) . ")";
+        echo $OUTPUT->confirm($message, "delete.php?id=$course->id&delete=".md5($course->timemodified), "category.php?id=$course->category");
 
         echo $OUTPUT->footer();
         exit;
index 36d5cc138660e96f6914ab583928533782e8e18b..805fe6b2fcae44bf54da397ba81aba5a51c4d355 100644 (file)
@@ -80,6 +80,7 @@
     if (!empty($fromcoursesearch) && !empty($creator)) {
         $totalcount = 0;
         $courses = get_courses_search(explode(" ",$fromcoursesearch),"fullname ASC",$page,50,$totalcount);
+        $table = new html_table();
         if (is_array($courses) and count($courses) > 0) {
             $table->data[] = array('<b>'.get_string('searchresults').'</b>','','');
             foreach ($courses as $scourse) {
@@ -94,6 +95,6 @@
         }
     }
     if (!empty($table)) {
-        print_table($table);
+        echo $OUTPUT->table($table);
     }
 ?>
index da44a214b46bdd5ecb6a20b80e474c3a1153ce95..e98d1b2536c8d86a2c6a26c14fcc767593e99e19 100644 (file)
             echo $OUTPUT->box_end();
         }
 
-        echo '<div class="buttons">';
+        echo $OUTPUT->container_start('buttons');
         if (has_capability('moodle/course:create', $systemcontext)) {
         /// Print link to create a new course
         /// Get the 1st available category
             $options = array('category' => $CFG->defaultrequestcategory);
-            print_single_button('edit.php', $options, get_string('addnewcourse'), 'get');
+            $form = html_form::make_button('edit.php', $options, get_string('addnewcourse'));
+            $form->method = 'get';
+            echo $OUTPUT->button($form);
         }
         print_course_request_buttons($systemcontext);
-        echo '</div>';
+        echo $OUTPUT->container_end();
         echo $OUTPUT->footer();
         exit;
     }
         // print create course link to first category
         $options = array();
         $options = array('category' => $CFG->defaultrequestcategory);
-        print_single_button('edit.php', $options, get_string('addnewcourse'), 'get');
+        $form = html_form::make_button('edit.php', $options, get_string('addnewcourse'));
+        $form->method = 'get';
+        echo $OUTPUT->button($form);
     }
 
     // Print button for creating new categories
     if (has_capability('moodle/category:manage', $systemcontext)) {
         $options = array();
         $options['parent'] = 0;
-        print_single_button('editcategory.php', $options, get_string('addnewcategory'), 'get');
+        $form = html_form::make_button('editcategory.php', $options, get_string('addnewcategory'));
+        $form->method = 'get';
+        echo $OUTPUT->button($form);
     }
 
     print_course_request_buttons($systemcontext);
index 8b15ab81152a68679508827452e21513e7ccfbd8..f6370139aef97a032f9744ba2fb4a8f09a9bbc2f 100644 (file)
@@ -2003,17 +2003,19 @@ function print_category_info($category, $depth, $showcourses = false) {
  * @param object $systemcontext the system context.
  */
 function print_course_request_buttons($systemcontext) {
-    global $CFG, $DB;
+    global $CFG, $DB, $OUTPUT;
     if (empty($CFG->enablecourserequests)) {
         return;
     }
     if (isloggedin() && !isguestuser() && !has_capability('moodle/course:create', $systemcontext) && has_capability('moodle/course:request', $systemcontext)) {
     /// Print a button to request a new course
-        print_single_button('request.php', NULL, get_string('requestcourse'), 'get');
+        echo $OUTPUT->button(html_form::make_button('request.php', NULL, get_string('requestcourse'), 'get'));
     }
     /// Print a button to manage pending requests
     if (has_capability('moodle/site:approvecourse', $systemcontext)) {
-        print_single_button('pending.php', NULL, get_string('coursespending'), 'get', '_self', false, '', !$DB->record_exists('course_request', array()));
+        $form = html_form::make_button('pending.php', NULL, get_string('coursespending'), 'get');
+        $form->button->disabled = !$DB->record_exists('course_request', array());
+        echo $OUTPUT->button($form);
     }
 }
 
@@ -2036,7 +2038,7 @@ function can_edit_in_category($categoryid = 0) {
  *      to see it.
  */
 function update_category_button($categoryid = 0) {
-    global $CFG, $PAGE;
+    global $CFG, $PAGE, $OUTPUT;
 
     // Check permissions.
     if (!can_edit_in_category($categoryid)) {
@@ -2060,7 +2062,7 @@ function update_category_button($categoryid = 0) {
     } else {
         $page = 'index.php';
     }
-    return print_single_button($CFG->wwwroot . '/course/' . $page, $options, $label, 'get', '', true);
+    return $OUTPUT->button(html_form::make_button($CFG->wwwroot . '/course/' . $page, $options, $label, 'get'));
 }
 
 /**
@@ -2106,7 +2108,7 @@ function print_courses($category) {
             $options = array();
             $options['category'] = $category->id;
             echo '<div class="addcoursebutton">';
-            print_single_button($CFG->wwwroot.'/course/edit.php', $options, get_string("addnewcourse"));
+            echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/course/edit.php', $options, get_string("addnewcourse")));
             echo '</div>';
         }
     }
@@ -2278,7 +2280,7 @@ function print_my_moodle() {
             echo "<table width=\"100%\"><tr><td align=\"center\">";
             print_course_search("", false, "short");
             echo "</td><td align=\"center\">";
-            print_single_button("$CFG->wwwroot/course/index.php", NULL, get_string("fulllistofcourses"), "get");
+            echo $OUTPUT->button(html_form::make_button("$CFG->wwwroot/course/index.php", NULL, get_string("fulllistofcourses"), "get"));
             echo "</td></tr></table>\n";
         }
 
index efb582e8e80f55730ddfe3fb5dae716adb4a47d4..5a4c73a6579bdfc89085e9d317e4e340ba637d80 100644 (file)
@@ -69,7 +69,9 @@
 
             // print_simple_box_start('center', '60%', '#FFAAAA', 20, 'noticebox');
             echo $OUTPUT->box_start('noticebox');
-            notice_yesno($strdeletecheckfull, 'mod.php', $return, $optionsyes, $optionsno, 'post', 'get');
+            $formcontinue = html_form::make_button('mod.php', $optionsyes, get_string('yes'));
+            $formcancel = html_form::make_button($return, $optionsno, get_string('no'), 'get');
+            echo $OUTPUT->confirm($strdeletecheckfull, $formcontinue, $formcancel);
             echo $OUTPUT->box_end();
             echo $OUTPUT->footer();
 
index 4162a8204f3a35045b40a97bb94f3488844c976a..de6fc3be9b30abf845ab26e8beb5ccec45dcb2c3 100644 (file)
         echo $OUTPUT->heading(get_string('coursespending'));
 
     /// Build a table of all the requests.
-        $table->class = 'pendingcourserequests generaltable';
+        $table = new html_table();
+        $table->add_class('pendingcourserequests generaltable');
         $table->align = array('center', 'center', 'center', 'center', 'center', 'center', 'center');
         $table->head = array('&nbsp;', get_string('shortname'), get_string('fullname'),
                 get_string('requestedby'), get_string('summary'), get_string('requestreason'), get_string('action'));
             $row[] = fullname($requester);
             $row[] = format_string($course->summary);
             $row[] = format_string($course->reason);
-            $row[] = print_single_button($baseurl, array('approve' => $course->id, 'sesskey' => sesskey()), get_string('approve'), 'get', '', true) .
-                    print_single_button($baseurl, array('reject' => $course->id), get_string('rejectdots'), 'get', '', true);
+            $row[] = $OUTPUT->button(html_form::make_button($baseurl, array('approve' => $course->id, 'sesskey' => sesskey()), get_string('approve'), 'get')) .
+                    $OUTPUT->button(html_form::make_button($baseurl, array('reject' => $course->id), get_string('rejectdots'), 'get'));
 
         /// Add the row to the table.
             $table->data[] = $row;
         }
 
     /// Display the table.
-        print_table($table);
+        echo $OUTPUT->table($table);
 
     /// Message about name collisions, if necessary.
         if (!empty($collision)) {
     }
 
 /// Finish off the page.
-    print_single_button($CFG->wwwroot . '/course/index.php', array(), get_string('backtocourselisting'));
+    echo $OUTPUT->button(html_form::make_button($CFG->wwwroot . '/course/index.php', array(), get_string('backtocourselisting')));
     echo $OUTPUT->footer();
 ?>
index 6ec63ca0b70ecc4dec2bd350fa381507a82397bf..53a9a2cecdce5874240da1f368b0d5d9224eb91b 100644 (file)
@@ -21,6 +21,7 @@
         print_error('nostatstodisplay', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
     }
 
+    $table = new html_table();
     $table->width = 'auto';
 
     if ($mode == STATS_MODE_DETAILED) {
@@ -66,7 +67,7 @@
         .'<div>'."\n"
         .'<input type="hidden" name="mode" value="'.$mode.'" />'."\n";
 
-    print_table($table);
+    echo $OUTPUT->table($table);
 
     echo '</div>';
     echo '</form>';
                 }
             }
 
-            $table = new StdClass;
+            $table = new html_table();
             $table->align = array('left','center','center','center');
             $param->table = str_replace('user_','',$param->table);
             switch ($param->table) {
                 $lastrecord[] = $lastlink;
                 $table->data[] = $lastrecord;
             }
-            print_table($table);
+            echo $OUTPUT->table($table);
         }
     }
 
index 460252e09b83f83ab7105865952ecde4b70ccde5..15b68184dc30a880a9cba92506f1e1c949c8cfac 100755 (executable)
@@ -59,13 +59,13 @@ if ($mform->is_cancelled()) {
             $data[] = $line;
         }
 
-        $table = new object();
+        $table = new html_table();
         $table->head  = array(get_string('resetcomponent'), get_string('resettask'), get_string('resetstatus'));
         $table->size  = array('20%', '40%', '40%');
         $table->align = array('left', 'left', 'left');
         $table->width = '80%';
         $table->data  = $data;
-        print_table($table);
+        echo $OUTPUT->table($table);
 
         echo $OUTPUT->continue_button('view.php?id='.$course->id);  // Back to course page
         echo $OUTPUT->footer();
index 9a095553eda27213cd9941c37652016bf1117138..cd1070fa181c0aac226131028392f4a4bd60e8e2 100644 (file)
             print_error('nousers');
         }
         $strunenrolsure  = get_string('unenrolsure', '', fullname($user, true));
-        notice_yesno($strunenrolsure, "unenrol.php?id=$id&amp;user=$user->id&amp;confirm=yes&amp;sesskey=".sesskey(),
-                                      $_SERVER['HTTP_REFERER']);
+        echo $OUTPUT->confirm($strunenrolsure, "unenrol.php?id=$id&user=$user->id&confirm=yes", $PAGE->url);
     } else {
         $strunenrolsure  = get_string('unenrolsure', '', get_string("yourself"));
-        notice_yesno($strunenrolsure, "unenrol.php?id=$id&amp;confirm=yes&amp;sesskey=".sesskey(),
-                                      $_SERVER['HTTP_REFERER']);
+        echo $OUTPUT->confirm($strunenrolsure, "unenrol.php?id=$id&confirm=yes", $PAGE->url);
     }
 
     echo $OUTPUT->footer();
index 3f7d265578355b7d4e0dc0f120e67bd0b5f99846..2f3e8e3103389e09d97bc738f756f18154ac4721 100644 (file)
             // What the heck is this about?   -- MD
             $stats = stats_fix_zeros($stats,$param->timeafter,$param->table,(!empty($param->line2)),(!empty($param->line3)));
 
-            $table = new object();
+            $table = new html_table();
             $table->align = array('left','center','center','center');
             $param->table = str_replace('user_','',$param->table);
             switch ($param->table) {
                 $a[] = $stat->line3;
                 $table->data[] = $a;
             }
-            print_table($table);
+            echo $OUTPUT->table($table);
             break;
 
         case "outline" :