]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19799 upgraded calls to print_table, print_single_button, print_user_picture...
authornicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 08:50:50 +0000 (08:50 +0000)
committernicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 08:50:50 +0000 (08:50 +0000)
16 files changed:
comment/lib.php
files/draftfiles.php
files/index.php
lib/adminlib.php
lib/commentlib.php
lib/deprecatedlib.php
lib/environmentlib.php
lib/formslib.php
lib/outputcomponents.php
lib/portfolio/exporter.php
lib/portfoliolib.php
lib/questionlib.php
lib/simpletest/filtersettingsperformancetester.php
lib/simpletestcoveragelib.php
lib/weblib.php
my/index.php

index 921c6df471ba8cde47cc47b0dc11f263ffe0d964..48187c69f55ecb54c969143b7a08f7a273352509 100644 (file)
@@ -82,7 +82,7 @@ class comment_manager {
         $this->perpage = 10;
         $count = $DB->count_records_sql('SELECT COUNT(*) FROM {comments} c');
         $comments = $this->get_comments($page);
-        $table = new stdclass;
+        $table = new html_table();
         $table->head = array ('<input type="checkbox" id="comment_select_all"/>', 'author', 'content', 'action');
         $table->align = array ('left', 'left', 'left', 'left');
         $table->width = "95%";
@@ -101,7 +101,7 @@ class comment_manager {
             }
             $table->data[] = array($checkbox, $c->username, $c->content, $action);
         } 
-        print_table($table);
+        echo $OUTPUT->table($table);
         echo $OUTPUT->paging_bar(moodle_paging_bar::make($count, $page, $this->perpage, $CFG->wwwroot.'/comment/index.php'));
     }
 
index 9f9fe292deb5b271b7c75d1b6d235b62373e6825..11dd043f0484ad07334030599356933ea87e106e 100644 (file)
@@ -102,7 +102,7 @@ if ($delete !== '' and $file = $fs->get_file($contextid, $filearea, $itemid, $fi
         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');
+        echo $OUTPUT->confirm(get_string('deletecheckfiles'), new moodle_url('draftfiles.php', $optionsyes), new moodle_url('draftfiles.php', $optionsno));
         echo $OUTPUT->footer();
         die;
 
index 913b44449dd4e1f8b47d939cbdc6657a4f5fb53c..d67b6094717eb07dae070a15b8a527d2d4428e39 100644 (file)
@@ -117,7 +117,7 @@ if ($file_info and $delete) {
         $optionsyes['delete'] = 1;
         $optionsyes['sesskey'] = sesskey();
 
-        notice_yesno (get_string('deletecheckfiles'), 'index.php', 'index.php', $optionsyes, $optionsno, 'post', 'get');
+        echo $OUTPUT->confirm(get_string('deletecheckfiles'), new moodle_url( 'index.php', $optionsyes),  new moodle_url('index.php', $optionsno));
         echo $OUTPUT->footer();
         die;
     }
index 273433ed28e942af65931c633ac5f446f5ccecf3..10c9efd9074de4db3c5cf9814aecc0eb90b5420e 100644 (file)
@@ -4550,7 +4550,7 @@ class admin_setting_manageauths extends admin_setting {
         $return = $OUTPUT->heading(get_string('actauthhdr', 'auth'), 3, 'main');
         $return .= $OUTPUT->box_start('generalbox authsui');
 
-        $table = new object();
+        $table = new html_table();
         $table->head  = array($txt->name, $txt->enable, $txt->updown, $txt->settings);
         $table->align = array('left', 'center', 'center', 'center');
         $table->width = '90%';
@@ -4620,7 +4620,7 @@ class admin_setting_manageauths extends admin_setting {
             // add a row to the table
             $table->data[] =array($displayname, $hideshow, $updown, $settings);
         }
-        $return .= print_table($table, true);
+        $return .= $OUTPUT->table($table);
         $return .= get_string('configauthenticationplugins', 'admin').'<br />'.get_string('tablenosave', 'filters');
         $return .= $OUTPUT->box_end();
         return highlight($query, $return);
@@ -4727,7 +4727,7 @@ class admin_setting_manageeditors extends admin_setting {
         $return = $OUTPUT->heading(get_string('acteditorshhdr', 'editor'), 3, 'main', true);
         $return .= $OUTPUT->box_start('generalbox editorsui');
 
-        $table = new object();
+        $table = new html_table();
         $table->head  = array($txt->name, $txt->enable, $txt->updown, $txt->settings);
         $table->align = array('left', 'center', 'center', 'center');
         $table->width = '90%';
@@ -4784,7 +4784,7 @@ class admin_setting_manageeditors extends admin_setting {
             // add a row to the table
             $table->data[] =array($displayname, $hideshow, $updown, $settings);
         }
-        $return .= print_table($table, true);
+        $return .= $OUTPUT->table($table);
         $return .= get_string('configeditorplugins', 'editor').'<br />'.get_string('tablenosave', 'filters');
         $return .= $OUTPUT->box_end();
         return highlight($query, $return);
@@ -4939,7 +4939,7 @@ class admin_setting_manageportfolio extends admin_setting {
         $output .= portfolio_report_insane($insane, null, true);
         $output .= portfolio_report_insane($insaneinstances, $instances, true);
 
-        $table = new StdClass;
+        $table = new html_table();
         $table->head = array($namestr, $pluginstr, '');
         $table->data = array();
 
@@ -4959,7 +4959,7 @@ class admin_setting_manageportfolio extends admin_setting {
             }
         }
 
-        $output .= print_table($table, true);
+        $output .= $OUTPUT->table($table);
 
         $instancehtml = '<br /><br />' . get_string('addnewportfolio', 'portfolio') . ': <br /><br />';
         $addable = 0;
@@ -5047,7 +5047,7 @@ function admin_externalpage_setup($section, $extrabutton = '',
  * @param string $focus focus element
  */
 function admin_externalpage_print_header($focus='') {
-    global $CFG, $PAGE, $SITE, $THEME;
+    global $CFG, $PAGE, $SITE, $THEME, $OUTPUT;
 
     if (!is_string($focus)) {
         $focus = ''; // BC compatibility, there used to be adminroot parameter
@@ -5079,7 +5079,7 @@ function admin_externalpage_print_header($focus='') {
             $caption = get_string('blocksediton');
             $options['adminedit'] = 'on';
         }
-        $buttons = print_single_button($PAGE->url->out(false), $options, $caption, 'get', '', true);
+        $buttons = $OUTPUT->button(html_form::make_button($PAGE->url->out(false), $options, $caption, 'get'));
     }
 
     $navlinks = array();
@@ -5793,7 +5793,7 @@ class admin_setting_managerepository extends admin_setting {
         $instances = repository::get_types();
         $instancesnumber = count($instances);
         $alreadyplugins = array();
-        $table = new StdClass;
+        $table = new html_table();
         $table->head = array($namestr, $updownstr, $hiddenstr, $deletestr, $settingsstr);
         $table->align = array('left', 'center', 'center','center','center');
         $table->data = array();
@@ -5865,7 +5865,7 @@ class admin_setting_managerepository extends admin_setting {
                 $alreadyplugins[] = $i->get_typename();
             }
         }
-        $output .= print_table($table, true);
+        $output .= $OUTPUT->table($table);
         $instancehtml = '<div><h3>';
         $instancehtml .= get_string('addplugin', 'repository');
         $instancehtml .= '</h3><ul>';
@@ -5941,7 +5941,7 @@ class admin_setting_managewsprotocols extends admin_setting {
         $hiddenstr = get_string('hiddenshow', 'repository');
         require_once("../webservice/lib.php");
         $protocols = webservice_lib::get_list_protocols();
-        $table = new StdClass;
+        $table = new html_table();
         $table->head = array($namestr, $hiddenstr, $settingsstr);
         $table->align = array('left', 'center', 'center');
         $table->data = array();
@@ -5971,7 +5971,7 @@ class admin_setting_managewsprotocols extends admin_setting {
                 $table->rowclasses[] = '';
             }
         }
-        $output = print_table($table, true);
+        $output = $OUTPUT->table($table);
 
         return highlight($query, $output);
     }
@@ -6027,7 +6027,7 @@ class admin_setting_managewsusersettings extends admin_setting {
         //search all web service users
         $users = get_users(true, '', false, null, 'firstname ASC','', '', '', 1000);
 
-        $table = new StdClass;
+        $table = new html_table();
         $table->head = array('username', 'whitelist');
         $table->align = array('left', 'center');
         $table->data = array();
@@ -6044,7 +6044,7 @@ class admin_setting_managewsusersettings extends admin_setting {
             }
         }
 
-        $output .= print_table($table, true);
+        $output .= $OUTPUT->table($table);
         return highlight($query, $output);
     }
 }
index bac55742966f03f95f2b6fc659c219dfe1c7fcdf..32e64df7dbed9886ffdaa7d0f571fb78966884a9 100644 (file)
@@ -388,9 +388,7 @@ EOD;
                 $user->lastname  = $c->lastname;
                 $user->imagealt  = $c->imagealt;
                 $c->content = format_text($c->content, $c->format);
-                $userpic = new moodle_user_picture();
-                $userpic->user = $user;
-                $userpic->courseid = $this->course->id;
+                $userpic = moodle_user_picture::make($user, $this->course->id);
                 $userpic->link = true;
                 $userpic->size = 18;
                 $userpic->alttext = true;
@@ -443,7 +441,7 @@ EOD;
      * @return mixed
      */
     public function add($content) {
-        global $CFG, $DB, $USER;
+        global $CFG, $DB, $USER, $OUTPUT;
         if (empty($this->postcap)) {
             return COMMENT_ERROR_INSUFFICIENT_CAPS;
         }
@@ -471,7 +469,9 @@ EOD;
             $newcmt->time = userdate($now, get_string('strftimerecent', 'langconfig'));
             $newcmt->username = fullname($USER);
             $newcmt->content = format_text($newcmt->content);
-            $newcmt->avatar = print_user_picture($USER, $this->course->id, NULL, 16, true);
+            $userpic = moodle_user_picture::make($USER, $this->course->id);
+            $userpic->size = 16;
+            $newcmt->avatar = $OUTPUT->user_picture($userpic);
             return $newcmt;
         } else {
             return COMMENT_ERROR_DB;
index 780421e3284cd6e37528c9ceb331b8f257cf0df7..dd67345f5d93cd49cda520ac82baa8159573e5e9 100644 (file)
@@ -2401,7 +2401,7 @@ function blocks_move_block($page, &$instance, $destpos, $destweight=NULL, $pinne
 function print_table($table, $return=false) {
     global $OUTPUT;
     // TODO MDL-19755 turn debugging on once we migrate the current core code to use the new API
-    // debugging('print_table() has been deprecated. Please change your code to use $OUTPUT->table().');
+    debugging('print_table() has been deprecated. Please change your code to use $OUTPUT->table().');
     $newtable = new html_table();
     foreach ($table as $property => $value) {
         if (property_exists($newtable, $property)) {
@@ -2589,7 +2589,7 @@ function print_single_button($link, $options, $label='OK', $method='get', $notus
         $return=false, $tooltip='', $disabled = false, $jsconfirmmessage='', $formid = '') {
     global $OUTPUT;
 
-    // debugging('print_single_button() has been deprecated. Please change your code to use $OUTPUT->button().');
+    debugging('print_single_button() has been deprecated. Please change your code to use $OUTPUT->button().');
 
     // Cast $options to array
     $options = (array) $options;
@@ -2679,7 +2679,7 @@ function print_file_picture($path, $courseid=0, $height='', $width='', $link='',
 function print_user_picture($user, $courseid, $picture=NULL, $size=0, $return=false, $link=true, $target='', $alttext=true) {
     global $CFG, $DB, $OUTPUT;
 
-    // debugging('print_user_picture() has been deprecated. Please change your code to use $OUTPUT->user_picture($user, $courseid).');
+    debugging('print_user_picture() has been deprecated. Please change your code to use $OUTPUT->user_picture($user, $courseid).');
 
     $userpic = new moodle_user_picture();
     $userpic->user = $user;
@@ -2802,7 +2802,7 @@ function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $v
  * @return string|void Depending on value of $return
  */
 function helpbutton($page, $title, $module='moodle', $image=true, $linktext=false, $text='', $return=false, $imagetext='') {
-    // debugging('helpbutton() has been deprecated. Please change your code to use $OUTPUT->help_icon().');
+    debugging('helpbutton() has been deprecated. Please change your code to use $OUTPUT->help_icon().');
 
     global $OUTPUT;
 
@@ -2967,21 +2967,14 @@ function print_paging_bar($totalcount, $page, $perpage, $baseurl, $pagevar='page
  */
 function notice_yesno($message, $linkyes, $linkno, $optionsyes=NULL, $optionsno=NULL, $methodyes='post', $methodno='post') {
 
-    // debugging('notice_yesno() has been deprecated. Please change your code to use $OUTPUT->confirm($message, $buttoncontinue, $buttoncancel).');
+    debugging('notice_yesno() has been deprecated. Please change your code to use $OUTPUT->confirm($message, $buttoncontinue, $buttoncancel).');
 
     global $OUTPUT;
 
-    $formcontinue = new html_form();
-    $formcontinue->url = new moodle_url($linkyes, $optionsyes);
-    $formcontinue->button->text = get_string('yes');
-    $formcontinue->method = $methodyes;
+    $buttoncontinue = html_form::make_button($linkyes, $optionsyes, get_string('yes'), $methodyes);
+    $buttoncancel   = html_form::make_button($linkno, $optionsno, get_string('no'), $methodno);
 
-    $formcancel = new html_form();
-    $formcancel->url = new moodle_url($linkno, $optionsno);
-    $formcancel->button->text = get_string('no');
-    $formcancel->method = $methodno;
-
-    echo $OUTPUT->confirm($message, $formcontinue, $formcancel);
+    echo $OUTPUT->confirm($message, $buttoncontinue, $buttoncancel);
 }
 
 /**
@@ -3428,7 +3421,7 @@ function print_checkbox ($name, $value, $checked = true, $label = '', $alt = '',
  */
 function print_textfield ($name, $value, $alt = '',$size=50,$maxlength=0, $return=false) {
 
-    // debugging('print_textfield() has been deprecated. Please change your code to use $OUTPUT->textfield($field).');
+    debugging('print_textfield() has been deprecated. Please change your code to use $OUTPUT->textfield($field).');
 
     global $OUTPUT;
 
index 80ea1b89ed477d299337fbe5aea31f60dbb2be51..df4df27cb5d57a2f3b2ca06ba6a2ad6256242a6b 100644 (file)
@@ -168,23 +168,23 @@ function print_moodle_environment($result, $environment_results) {
     $strrestricted = get_string('restricted');
     $strenvironmenterrortodo = get_string('environmenterrortodo', 'admin');
 /// Table headers
-    $servertable = new stdClass;//table for server checks
+    $servertable = new html_table();//table for server checks
     $servertable->head  = array ($strname, $strinfo, $strreport, $strstatus);
     $servertable->align = array ('center', 'center', 'left', 'center');
     $servertable->wrap  = array ('nowrap', '', '', 'nowrap');
     $servertable->size  = array ('10', 10, '100%', '10');
     $servertable->width = '90%';
-    $servertable->class = 'environmenttable generaltable';
+    $servertable->add_class('environmenttable generaltable');
 
     $serverdata = array('ok'=>array(), 'warn'=>array(), 'error'=>array());
 
-    $othertable = new stdClass;//table for custom checks
+    $othertable = new html_table();//table for custom checks
     $othertable->head  = array ($strinfo, $strreport, $strstatus);
     $othertable->align = array ('center', 'left', 'center');
     $othertable->wrap  = array ('', '', 'nowrap');
     $othertable->size  = array (10, '100%', '10');
     $othertable->width = '90%';
-    $othertable->class = 'environmenttable generaltable';
+    $othertable->add_class('environmenttable generaltable');
 
     $otherdata = array('ok'=>array(), 'warn'=>array(), 'error'=>array());
 
@@ -309,10 +309,10 @@ function print_moodle_environment($result, $environment_results) {
 
 /// Print table
     echo $OUTPUT->heading(get_string('serverchecks', 'admin'));
-    print_table($servertable);
+    echo $OUTPUT->table($servertable);
     if (count($othertable->data)){
         echo $OUTPUT->heading(get_string('customcheck', 'admin'));
-        print_table($othertable);
+        echo $OUTPUT->table($othertable);
     }
 
 /// Finally, if any error has happened, print the summary box
index 6a689fdde73120b8e187ecacfdb945546a5c7f4d..907cb7c1ed303769d42c1974082f9b67e222bc3f 100644 (file)
@@ -1330,17 +1330,24 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
      * @param string $function
      */
     function setHelpButton($elementname, $button, $suppresscheck=false, $function='helpbutton'){
+        global $OUTPUT;
         if (array_key_exists($elementname, $this->_elementIndex)){
             //_elements has a numeric index, this code accesses the elements by name
             $element=&$this->_elements[$this->_elementIndex[$elementname]];
-            if (method_exists($element, 'setHelpButton')){
-                $element->setHelpButton($button, $function);
-            }else{
-                $a=new object();
-                $a->name=$element->getName();
-                $a->classname=get_class($element);
-                print_error('nomethodforaddinghelpbutton', 'form', '', $a);
+            $buttonparams = array('page', 'text', 'module', 'image', 'linktext', 'text', 'return', 'imagetext');
+            $helpiconoptions = array('page' => null, 'text' => null, 'module' => 'moodle', 'image' => null, 'linktext' => false);
+
+            foreach ($button as $key => $val) {
+                if (isset($button[$key])) {
+                    $helpiconoptions[$buttonparams[$key]] = $val;
+                }
             }
+            $helpicon = moodle_help_icon::make($helpiconoptions['page'], $helpiconoptions['text'], $helpiconoptions['module'], $helpiconoptions['linktext']);
+            if (!$helpiconoptions['image']) {
+                $helpicon->image = false;
+            }
+
+            $element->_helpbutton = $OUTPUT->help_icon($helpicon);
         }elseif (!$suppresscheck){
             print_error('nonexistentformelements', 'form', '', $elementname);
         }
index 48a475137060038152e723a61d2dbe2ec9a96885..b1278facb145596e426611fe32f71d725abd5419 100644 (file)
@@ -74,7 +74,9 @@ class moodle_html_component {
      * @return array the class names as an array.
      */
     public static function clean_classes($classes) {
-        if (is_array($classes)) {
+        if (empty($classes)) {
+            return '';
+        } else if (is_array($classes)) {
             return $classes;
         } else {
             return explode(' ', trim($classes));
@@ -1424,6 +1426,14 @@ class html_form extends moodle_html_component {
 
         parent::prepare();
     }
+
+    public static function make_button($url, $options, $label='OK', $method='post') {
+        $form = new html_form();
+        $form->url = new moodle_url($url, $options);
+        $form->button->text = $label;
+        $form->method = $method;
+        return $form;
+    }
 }
 
 /**
@@ -1845,6 +1855,13 @@ class moodle_user_picture extends moodle_html_component {
 
         parent::prepare();
     }
+
+    public static function make($user, $courseid) {
+        $userpic = new moodle_user_picture();
+        $userpic->user = $user;
+        $userpic->courseid = $courseid;
+        return $userpic;
+    }
 }
 
 /**
index cc761705401620011637bc4fbc2746cc45432566..2713743e1f241981054c5025e4d54c019fc2fc89 100644 (file)
@@ -410,13 +410,13 @@ class portfolio_exporter {
             $isummary = array();
         }
         $mainsummary = array_merge($mainsummary, $csummary, $isummary);
-        $table = new StdClass;
+        $table = new html_table();
         $table->data = array();
         foreach ($mainsummary as $string => $value) {
             $table->data[] = array($string, $value);
         }
-        print_table($table);
-        notice_yesno($strconfirm, $yesurl, $nourl);
+        echo $OUTPUT->table($table);
+        echo $OUTPUT->confirm($strconfirm, $yesurl, $nourl);
         echo $OUTPUT->box_end();
         echo $OUTPUT->footer();
         return false;
index 9e7117c80418f317c3db5ba0310a6749ca7b8426..0288fb47e014b5facdd2c223a54da299bf3f880a 100644 (file)
@@ -753,7 +753,7 @@ function portfolio_report_insane($insane, $instances=false, $return=false) {
     }
 
     $output = $OUTPUT->notification($headerstr, 'notifyproblem');
-    $table = new StdClass;
+    $table = new html_table();
     $table->head = array($pluginstr, '');
     $table->data = array();
     foreach ($insane as $plugin => $reason) {
@@ -766,7 +766,7 @@ function portfolio_report_insane($insane, $instances=false, $return=false) {
         }
         $table->data[] = array($name, get_string($reason, 'portfolio_' . $plugin));
     }
-    $output .= print_table($table, true);
+    $output .= $OUTPUT->table($table);
     $output .= '<br /><br /><br />';
 
     if ($return) {
index 28fb0c26daf2e5fea9dc59561ab95593b61835d6..7d882c88957457d67f2e5ade4b678d527e2674d5 100644 (file)
@@ -635,7 +635,7 @@ function delete_question($questionid) {
  * @return boolean
  */
 function question_delete_course($course, $feedback=true) {
-    global $DB;
+    global $DB, $OUTPUT;
 
     //To store feedback to be showed at the end of the process
     $feedbackdata   = array();
@@ -669,10 +669,10 @@ function question_delete_course($course, $feedback=true) {
         }
         //Inform about changes performed if feedback is enabled
         if ($feedback) {
-            $table = new stdClass;
+            $table = new html_table();
             $table->head = array(get_string('category','quiz'), get_string('action'));
             $table->data = $feedbackdata;
-            print_table($table);
+            echo $OUTPUT->table($table);
         }
     }
     return true;
@@ -735,10 +735,10 @@ function question_delete_course_category($category, $newcategory, $feedback=true
 
         // Output feedback if requested.
         if ($feedback and $feedbackdata) {
-            $table = new stdClass;
+            $table = new html_table();
             $table->head = array(get_string('questioncategory','question'), get_string('action'));
             $table->data = $feedbackdata;
-            print_table($table);
+            echo $OUTPUT->table($table);
         }
 
     } else {
@@ -801,7 +801,7 @@ function question_save_from_deletion($questionids, $newcontextid, $oldplace, $ne
  * @return boolean
  */
 function question_delete_activity($cm, $feedback=true) {
-    global $DB;
+    global $DB, $OUTPUT;
 
     //To store feedback to be showed at the end of the process
     $feedbackdata   = array();
@@ -832,10 +832,10 @@ function question_delete_activity($cm, $feedback=true) {
         }
         //Inform about changes performed if feedback is enabled
         if ($feedback) {
-            $table = new stdClass;
+            $table = new html_table();
             $table->head = array(get_string('category','quiz'), get_string('action'));
             $table->data = $feedbackdata;
-            print_table($table);
+            echo $OUTPUT->table($table);
         }
     }
     return true;
index e079b5619024f6bdc3c2e1739cc6deb6e2617cb3..04f9ab8c522bb62410ac95f12c932a678017fae3 100644 (file)
@@ -110,11 +110,21 @@ if ($issetup == count($requiredtables)) {
 
 $DB = $realdb;
 
-echo '<div>';
-print_single_button($baseurl, array('action' => 'setup'), 'Set up test tables', 'get', '', false, '', $issetup > 0);
-print_single_button($baseurl, array('action' => 'teardown'), 'Drop test tables', 'get', '', false, '', $issetup == 0);
-print_single_button($baseurl, array('action' => 'test'), 'Run tests', 'get', '', false, '', $issetup != count($requiredtables));
-echo '</div>';
+echo $OUTPUT->container_start();
+
+$form = html_form::make_button($baseurl, array('action' => 'setup'), 'Set up test tables', 'get');
+$form->button->disabled = $issetup > 0;
+echo $OUTPUT->button($form);
+
+$form = html_form::make_button($baseurl, array('action' => 'teardown'), 'Drop test tables', 'get');
+$form->button->disabled = $issetup == 0;
+echo $OUTPUT->button($form);
+
+$form = html_form::make_button($baseurl, array('action' => 'test'), 'Run tests', 'get');
+$form->button->disabled = $issetup != count($requiredtables);
+echo $OUTPUT->button($form);
+
+echo $OUTPUT->container_end();
 
 echo $OUTPUT->footer();
 
index d1eeac90f92296be1bac0e634c656b0fb40dc9f9..1a65ba6f4cc295130f50320d969583feb59db69a 100644 (file)
@@ -430,10 +430,10 @@ class moodle_coverage_reporter extends HtmlCoverageReporter {
             if ($data = unserialize(file_get_contents($serfilepath))) {
                 // return one table with all the totals (we avoid individual file results here)
                 $result = '';
-                $table = new object();
+                $table = new html_table();
                 $table->align = array('right', 'left');
                 $table->tablealign = 'center';
-                $table->class = 'codecoveragetable';
+                $table->add_class('codecoveragetable');
                 $table->id = 'codecoveragetable_' . $type;
                 $table->rowclasses = array('label', 'value');
                 $table->data = array(
@@ -450,7 +450,7 @@ class moodle_coverage_reporter extends HtmlCoverageReporter {
                 $result .= $OUTPUT->heading($data->title, 3, 'main codecoverageheading');
                 $result .= $OUTPUT->heading('<a href="' . $url . '" onclick="javascript:window.open(' . "'" . $url . "'" . ');return false;"' .
                                    ' title="">' . get_string('codecoveragecompletereport', 'simpletest') . '</a>', 4, 'main codecoveragelink');
-                $result .= print_table($table, true);
+                $result .= $OUTPUT->table($table);
 
                 return $OUTPUT->box($result, 'generalbox boxwidthwide boxaligncenter codecoveragebox', '', true);
             }
index d1c95af7feb1caf9a91f237205264eb07d87f12c..b4787f2f7e489712affc82d1db69ca2542d5e136 100644 (file)
@@ -2657,8 +2657,7 @@ function switchroles_form($courseid) {
         $options['sesskey'] = sesskey();
         $options['switchrole'] = 0;
 
-        return print_single_button($CFG->wwwroot.'/course/view.php', $options,
-                                   get_string('switchrolereturn'), 'post', '_self', true);
+        return $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/course/view.php', $options, get_string('switchrolereturn')));
     }
 
     if (has_capability('moodle/role:switchroles', $context)) {
index 21d92a3da72dc7fdb27d903e3bf6d9e3c1a5245b..43f650cb0f40d2769413e75c47b760e18033708e 100644 (file)
@@ -11,8 +11,7 @@
 
     if (isguest()) {
         print_header($strmymoodle);
-        notice_yesno(get_string('noguest', 'my') . '<br /><br />' .
-                get_string('liketologin'), get_login_url(), $CFG->wwwroot);
+        echo $OUTPUT->confirm(get_string('noguest', 'my') . '<br /><br />' . get_string('liketologin'), get_login_url(), $CFG->wwwroot);
         echo $OUTPUT->footer();
         die;
     }