MDL-20204 fixed html-writer::tag() parameter order to match the rest of the api
authorPetr Skoda <skodak@moodle.org>
Thu, 18 Feb 2010 18:15:56 +0000 (18:15 +0000)
committerPetr Skoda <skodak@moodle.org>
Thu, 18 Feb 2010 18:15:56 +0000 (18:15 +0000)
18 files changed:
blocks/blog_menu/block_blog_menu.php
grade/report/grader/lib.php
lib/filelib.php
lib/navigationlib.php
lib/outputcomponents.php
lib/outputrenderers.php
lib/outputrequirementslib.php
mod/chat/gui_header_js/chatinput.php
mod/chat/gui_header_js/users.php
mod/choice/lib.php
mod/forum/renderer.php
mod/lesson/continue.php
mod/lesson/renderer.php
mod/scorm/report.php
mod/workshop/renderer.php
theme/anomaly/renderers.php
user/index.php
webservice/renderer.php

index beeb6e2..6ffa0a0 100755 (executable)
@@ -79,7 +79,7 @@ class block_blog_menu extends block_base {
 
         if (!empty($blogheaders['strview']) && $CFG->useblogassociations) {
             if ($blogheaders['url']->compare($PAGE->url) == URL_MATCH_EXACT) {
-                $menulist[] = html_writer::tag('span', array('class'=>'current'), $blogheaders['strview']);
+                $menulist[] = html_writer::tag('span', $blogheaders['strview'], array('class'=>'current'));
             } else {
                 $menulist[] = html_writer::link($blogheaders['url'], $blogheaders['strview']);
             }
index 4c041c2..a7e5378 100644 (file)
@@ -826,7 +826,7 @@ class grade_report_grader extends grade_report {
                 if (!$this->canviewhidden and $grade->is_hidden()) {
                     if (!empty($CFG->grade_hiddenasdate) and $grade->get_datesubmitted() and !$item->is_category_item() and !$item->is_course_item()) {
                         // the problem here is that we do not have the time when grade value was modified, 'timemodified' is general modification date for grade_grades records
-                        $itemcell->text = html_writer::tag('span', array('class'=>'datesubmitted'), userdate($grade->get_datesubmitted(),get_string('strftimedatetimeshort')));
+                        $itemcell->text = html_writer::tag('span', userdate($grade->get_datesubmitted(),get_string('strftimedatetimeshort')), array('class'=>'datesubmitted'));
                     } else {
                         $itemcell->text = '-';
                     }
@@ -858,7 +858,7 @@ class grade_report_grader extends grade_report {
                 }
 
                 if ($grade->is_excluded()) {
-                    $itemcell->text .= html_writer::tag('span', array('class'=>'excludedfloater'), get_string('excluded', 'grades'));
+                    $itemcell->text .= html_writer::tag('span', get_string('excluded', 'grades'), array('class'=>'excludedfloater'));
                 }
 
                 // Do not show any icons if no grade (no record in DB to match)
@@ -882,7 +882,7 @@ class grade_report_grader extends grade_report {
                 // or a drop down (for scales)
                 // grades in item of type grade category or course are not directly editable
                 if ($item->needsupdate) {
-                    $itemcell->text .= html_writer::tag('span', array('class'=>"gradingerror$hidden"), get_string('error'));
+                    $itemcell->text .= html_writer::tag('span', get_string('error'), array('class'=>"gradingerror$hidden"));
 
                 } else if ($USER->gradeediting[$this->courseid]) {
 
@@ -916,10 +916,10 @@ class grade_report_grader extends grade_report {
 
                             // invalid grade if gradeval < 1
                             if ($gradeval < 1) {
-                                $itemcell->text .= html_writer::tag('span', array('class'=>"gradevalue$hidden$gradepass"), '-');
+                                $itemcell->text .= html_writer::tag('span', '-', array('class'=>"gradevalue$hidden$gradepass"));
                             } else {
                                 $gradeval = $grade->grade_item->bounded_grade($gradeval); //just in case somebody changes scale
-                                $itemcell->text .= html_writer::tag('span', array('class'=>"gradevalue$hidden$gradepass"), $scales[$gradeval-1]);
+                                $itemcell->text .= html_writer::tag('span', $scales[$gradeval-1], array('class'=>"gradevalue$hidden$gradepass"));
                             }
                         } else {
                             // no such scale, throw error?
@@ -933,7 +933,7 @@ class grade_report_grader extends grade_report {
                                           . '" type="text" class="text" title="'. $strgrade .'" name="grade_'
                                           .$userid.'_' .$item->id.'" id="grade_'.$userid.'_'.$item->id.'" value="'.$value.'" />';
                         } else {
-                            $itemcell->text .= html_writer::tag('span', array('class'=>"gradevalue$hidden$gradepass"), format_float($gradeval, $decimalpoints));
+                            $itemcell->text .= html_writer::tag('span', format_float($gradeval, $decimalpoints), array('class'=>"gradevalue$hidden$gradepass"));
                         }
                     }
 
@@ -956,9 +956,9 @@ class grade_report_grader extends grade_report {
                     }
 
                     if ($item->needsupdate) {
-                        $itemcell->text .= html_writer::tag('span', array('class'=>"gradingerror$hidden$gradepass"), get_string('error'));
+                        $itemcell->text .= html_writer::tag('span', get_string('error'), array('class'=>"gradingerror$hidden$gradepass"));
                     } else {
-                        $itemcell->text .= html_writer::tag('span', array('class'=>"gradevalue$hidden$gradepass"), grade_format_gradevalue($gradeval, $item, true, $gradedisplaytype, null));
+                        $itemcell->text .= html_writer::tag('span', grade_format_gradevalue($gradeval, $item, true, $gradedisplaytype, null), array('class'=>"gradevalue$hidden$gradepass"));
                     }
                 }
 
index d288a04..2cfdc9c 100644 (file)
@@ -2102,7 +2102,7 @@ function file_modify_html_header($text) {
     if (filter_is_enabled('filter/mediaplugin')) {
         // this script is needed by most media filter plugins.
         $attributes = array('type'=>'text/javascript', 'src'=>$CFG->httpswwwroot . '/lib/ufo.js');
-        $ufo = html_writer::tag('script', $attributes, '') . "\n";
+        $ufo = html_writer::tag('script', '', $attributes) . "\n";
     }
 
     preg_match('/\<head\>|\<HEAD\>/', $text, $matches);
index f625711..82e1d2f 100644 (file)
@@ -413,7 +413,7 @@ class navigation_node {
             $icon = $OUTPUT->render($this->icon);
             $content = $icon.$content; // use CSS for spacing of icons
         } else if ($this->helpbutton !== null) {
-            $content = trim($this->helpbutton).html_writer::tag('span', array('class'=>'clearhelpbutton'), $content);
+            $content = trim($this->helpbutton).html_writer::tag('span', $content, array('class'=>'clearhelpbutton'));
         }
 
         if ($content === '') {
@@ -446,7 +446,7 @@ class navigation_node {
             if ($this->hidden) {
                 $attributes['class'] = 'dimmed_text';
             }
-            $content = html_writer::tag('span', $attributes, $content);
+            $content = html_writer::tag('span', $content, $attributes);
         }
 
         return $content;
@@ -2350,7 +2350,7 @@ class navbar extends navigation_node {
         if ($firstnode===true) {
             // If this is the first node add the class first and display the
             // navbar properties (normally sitename)
-            $output .= html_writer::tag('li', array('class'=>'first'), parent::content(true));
+            $output .= html_writer::tag('li', parent::content(true), array('class'=>'first'));
         }
         $count = 0;
         if (!is_array($navarray)) {
@@ -2390,7 +2390,7 @@ class navbar extends navigation_node {
                 }
                 if ($child->type !== navigation_node::TYPE_CATEGORY || !isset($CFG->navshowcategories) || !empty($CFG->navshowcategories)) {
                     // Now display the node
-                    $output .= html_writer::tag('li', null, $separator.' '.$child->content(true));
+                    $output .= html_writer::tag('li', $separator.' '.$child->content(true));
                 }
                 if (isset($oldaction)) {
                     $child->action = $oldaction;
index baeba86..69479c0 100644 (file)
@@ -602,11 +602,11 @@ class html_writer {
     /**
      * Outputs a tag with attributes and contents
      * @param string $tagname The name of tag ('a', 'img', 'span' etc.)
-     * @param array $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.)
      * @param string $contents What goes between the opening and closing tags
+     * @param array $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.)
      * @return string HTML fragment
      */
-    public static function tag($tagname, array $attributes = null, $contents) {
+    public static function tag($tagname, $contents, array $attributes = null) {
         return self::start_tag($tagname, $attributes) . $contents . self::end_tag($tagname);
     }
 
@@ -696,7 +696,7 @@ class html_writer {
     public static function link($url, $text, array $attributes = null) {
         $attributes = (array)$attributes;
         $attributes['href']  = $url;
-        return self::tag('a', $attributes, $text);
+        return self::tag('a', $text, $attributes);
     }
 
     /**
@@ -725,7 +725,7 @@ class html_writer {
         $output .= self::empty_tag('input', $attributes);
 
         if ($label !== '' and !is_null($label)) {
-            $output .= self::tag('label', array('for'=>$attributes['id']), $label);
+            $output .= self::tag('label', $label, array('for'=>$attributes['id']));
         }
 
         return $output;
@@ -805,7 +805,7 @@ class html_writer {
                 $output .= self::select_option($label, $value, $selected);
             }
         }
-        return self::tag('select', $attributes, $output);
+        return self::tag('select', $output, $attributes);
     }
 
     private static function select_option($label, $value, array $selected) {
@@ -815,7 +815,7 @@ class html_writer {
             $attributes['selected'] = 'selected';
         }
         $attributes['value'] = $value;
-        return self::tag('option', $attributes, $label);
+        return self::tag('option', $label, $attributes);
     }
 
     private static function select_optgroup($groupname, $options, array $selected) {
@@ -827,7 +827,7 @@ class html_writer {
         foreach ($options as $value=>$label) {
             $output .= self::select_option($label, $value, $selected);
         }
-        return self::tag('optgroup', $attributes, $output);
+        return self::tag('optgroup', $output, $attributes);
     }
 
     /**
@@ -889,7 +889,7 @@ class html_writer {
             $attributes['id'] = self::random_id('ts_');
         }
         $timerselector = self::select($timeunits, $name, $currentdate[$userdatetype], null, array('id'=>$attributes['id']));
-        $label = self::tag('label', array('for'=>$attributes['id'], 'class'=>'accesshide'), get_string(substr($type, 0, -1), 'form'));
+        $label = self::tag('label', get_string(substr($type, 0, -1), 'form'), array('for'=>$attributes['id'], 'class'=>'accesshide'));
 
         return $label.$timerselector;
     }
@@ -912,7 +912,7 @@ class html_writer {
             $output .= html_writer::end_tag('li') . "\n";
         }
 
-        return html_writer::tag($tag, $attributes, $output);
+        return html_writer::tag($tag, $output, $attributes);
     }
 
     /**
@@ -946,11 +946,11 @@ class html_writer {
     public static function script($jscode, $url=null) {
         if ($jscode) {
             $attributes = array('type'=>'text/javascript');
-            return self::tag('script', $attributes, "\n//<![CDATA[\n$jscode\n//]]>\n") . "\n";
+            return self::tag('script', "\n//<![CDATA[\n$jscode\n//]]>\n", $attributes) . "\n";
 
         } else if ($url) {
             $attributes = array('type'=>'text/javascript', 'src'=>$url);
-            return self::tag('script', $attributes, '') . "\n";
+            return self::tag('script', '', $attributes) . "\n";
 
         } else {
             return '';
index 7d96748..79d4ecf 100644 (file)
@@ -699,11 +699,10 @@ class core_renderer extends renderer_base {
         $controlshtml = array();
         foreach ($controls as $control) {
             $controlshtml[] = html_writer::tag('a', array('class' => 'icon',
-                    'title' => $control['caption'], 'href' => $control['url']),
-                    html_writer::empty_tag('img',  array('src' => $this->pix_url($control['icon'])->out(false),
-                    'alt' => $control['caption'])));
+                    html_writer::empty_tag('img',  array('src' => $this->pix_url($control['icon'])->out(false), 'alt' => $control['caption'])),
+                    'title' => $control['caption'], 'href' => $control['url']));
         }
-        return html_writer::tag('div', array('class' => 'commands'), implode('', $controlshtml));
+        return html_writer::tag('div', implode('', $controlshtml), array('class' => 'commands'));
     }
 
     /**
@@ -733,8 +732,8 @@ class core_renderer extends renderer_base {
             $output = '';
             $skipdest = '';
         } else {
-            $output = html_writer::tag('a', array('href' => '#sb-' . $bc->skipid, 'class' => 'skip-block'), get_string('skipa', 'access', $skiptitle));
-            $skipdest = html_writer::tag('span', array('id' => 'sb-' . $bc->skipid, 'class' => 'skip-block-to'), '');
+            $output = html_writer::tag('a', get_string('skipa', 'access', $skiptitle), array('href' => '#sb-' . $bc->skipid, 'class' => 'skip-block'));
+            $skipdest = html_writer::tag('span', '', array('id' => 'sb-' . $bc->skipid, 'class' => 'skip-block-to'));
         }
 
         $output .= html_writer::start_tag('div', $bc->attributes);
@@ -743,27 +742,25 @@ class core_renderer extends renderer_base {
 
         $title = '';
         if ($bc->title) {
-            $title = html_writer::tag('h2', null, $bc->title);
+            $title = html_writer::tag('h2', $bc->title, null);
         }
 
         if ($title || $controlshtml) {
-            $output .= html_writer::tag('div', array('class' => 'header'),
-                    html_writer::tag('div', array('class' => 'title'),
-                    $title . $controlshtml));
+            $output .= html_writer::tag('div', html_writer::tag('div', $title . $controlshtml, array('class' => 'title')), array('class' => 'header'));
         }
 
         $output .= html_writer::start_tag('div', array('class' => 'content'));
         $output .= $bc->content;
 
         if ($bc->footer) {
-            $output .= html_writer::tag('div', array('class' => 'footer'), $bc->footer);
+            $output .= html_writer::tag('div', $bc->footer, array('class' => 'footer'));
         }
 
         $output .= html_writer::end_tag('div');
         $output .= html_writer::end_tag('div');
 
         if ($bc->annotation) {
-            $output .= html_writer::tag('div', array('class' => 'blockannotation'), $bc->annotation);
+            $output .= html_writer::tag('div', $bc->annotation, array('class' => 'blockannotation'));
         }
         $output .= $skipdest;
 
@@ -801,14 +798,14 @@ class core_renderer extends renderer_base {
         foreach ($items as $key => $string) {
             $item = html_writer::start_tag('li', array('class' => 'r' . $row));
             if (!empty($icons[$key])) { //test if the content has an assigned icon
-                $item .= html_writer::tag('div', array('class' => 'icon column c0'), $icons[$key]);
+                $item .= html_writer::tag('div', $icons[$key], array('class' => 'icon column c0'));
             }
-            $item .= html_writer::tag('div', array('class' => 'column c1'), $string);
+            $item .= html_writer::tag('div', $string, array('class' => 'column c1'));
             $item .= html_writer::end_tag('li');
             $lis[] = $item;
             $row = 1 - $row; // Flip even/odd.
         }
-        return html_writer::tag('ul', array('class' => 'list'), implode("\n", $lis));
+        return html_writer::tag('ul', implode("\n", $lis), array('class' => 'list'));
     }
 
     /**
@@ -838,8 +835,7 @@ class core_renderer extends renderer_base {
      * @return string the HTML to be output.
      */
     public function block_move_target($target) {
-        return html_writer::tag('a', array('href' => $target->url, 'class' => 'blockmovetarget'),
-                html_writer::tag('span', array('class' => 'accesshide'), $target->text));
+        return html_writer::tag('a', html_writer::tag('span', array('class' => 'accesshide'), $target->text), array('href' => $target->url, 'class' => 'blockmovetarget'));
     }
 
     /**
@@ -890,7 +886,7 @@ class core_renderer extends renderer_base {
             }
         }
 
-        return html_writer::tag('a', $attributes, $link->text);
+        return html_writer::tag('a', $link->text, $attributes);
     }
 
 
@@ -958,8 +954,8 @@ class core_renderer extends renderer_base {
         }
 
         $output = $this->box_start('generalbox', 'notice');
-        $output .= html_writer::tag('p', array(), $message);
-        $output .= html_writer::tag('div', array('class' => 'buttons'), $this->render($continue) . $this->render($cancel));
+        $output .= html_writer::tag('p', $message);
+        $output .= html_writer::tag('div', $this->render($continue) . $this->render($cancel), array('class' => 'buttons'));
         $output .= $this->box_end();
         return $output;
     }
@@ -1020,7 +1016,7 @@ class core_renderer extends renderer_base {
         }
 
         // then div wrapper for xhtml strictness
-        $output = html_writer::tag('div', array(), $output);
+        $output = html_writer::tag('div', $output);
 
         // now the form itself around it
         $url = $button->url->out_omit_querystring(); // url without params
@@ -1030,10 +1026,10 @@ class core_renderer extends renderer_base {
         $attributes = array('method' => $button->method,
                             'action' => $url,
                             'id'     => $button->formid);
-        $output = html_writer::tag('form', $attributes, $output);
+        $output = html_writer::tag('form', $output, $attributes);
 
         // and finally one more wrapper with class
-        return html_writer::tag('div', array('class' => $button->class), $output);
+        return html_writer::tag('div', $output, array('class' => $button->class));
     }
 
     /**
@@ -1088,7 +1084,7 @@ class core_renderer extends renderer_base {
         }
 
         if ($select->label) {
-            $output .= html_writer::tag('label', array('for'=>$select->attributes['id']), $select->label);
+            $output .= html_writer::tag('label', $select->label, array('for'=>$select->attributes['id']));
         }
 
         if ($select->helpicon instanceof help_icon) {
@@ -1098,22 +1094,22 @@ class core_renderer extends renderer_base {
         $output .= html_writer::select($select->options, $select->name, $select->selected, $select->nothing, $select->attributes);
 
         $go = html_writer::empty_tag('input', array('type'=>'submit', 'value'=>get_string('go')));
-        $output .= html_writer::tag('noscript', array('style'=>'inline'), $go);
+        $output .= html_writer::tag('noscript', $go, array('style'=>'inline'));
 
         $nothing = empty($select->nothing) ? false : key($select->nothing);
         $this->page->requires->js_init_call('M.util.init_select_autosubmit', array($select->formid, $select->attributes['id'], $nothing));
 
         // then div wrapper for xhtml strictness
-        $output = html_writer::tag('div', array(), $output);
+        $output = html_writer::tag('div', $output);
 
         // now the form itself around it
         $formattributes = array('method' => $select->method,
                                 'action' => $select->url->out_omit_querystring(),
                                 'id'     => $select->formid);
-        $output = html_writer::tag('form', $formattributes, $output);
+        $output = html_writer::tag('form', $output, $formattributes);
 
         // and finally one more wrapper with class
-        return html_writer::tag('div', array('class' => $select->class), $output);
+        return html_writer::tag('div', $output, array('class' => $select->class));
     }
 
     /**
@@ -1155,7 +1151,7 @@ class core_renderer extends renderer_base {
         $output = '';
 
         if ($select->label) {
-            $output .= html_writer::tag('label', array('for'=>$select->attributes['id']), $select->label);
+            $output .= html_writer::tag('label', $select->label, array('for'=>$select->attributes['id']));
         }
 
         if ($select->helpicon instanceof help_icon) {
@@ -1166,22 +1162,22 @@ class core_renderer extends renderer_base {
         $output .= html_writer::select($select->urls, 'jump', $select->selected, $select->nothing, $select->attributes);
 
         $go = html_writer::empty_tag('input', array('type'=>'submit', 'value'=>get_string('go')));
-        $output .= html_writer::tag('noscript', array('style'=>'inline'), $go);
+        $output .= html_writer::tag('noscript', $go, array('style'=>'inline'));
 
         $nothing = empty($select->nothing) ? false : key($select->nothing);
         $output .= $this->page->requires->js_init_call('M.util.init_url_select', array($select->formid, $select->attributes['id'], $nothing));
 
         // then div wrapper for xhtml strictness
-        $output = html_writer::tag('div', array(), $output);
+        $output = html_writer::tag('div', $output);
 
         // now the form itself around it
         $formattributes = array('method' => 'post',
                                 'action' => new moodle_url('/course/jumpto.php'),
                                 'id'     => $select->formid);
-        $output = html_writer::tag('form', $formattributes, $output);
+        $output = html_writer::tag('form', $output, $formattributes);
 
         // and finally one more wrapper with class
-        return html_writer::tag('div', array('class' => $select->class), $output);
+        return html_writer::tag('div', $output, array('class' => $select->class));
     }
 
     /**
@@ -1203,7 +1199,7 @@ class core_renderer extends renderer_base {
             $attributes['id'] = $this->add_action_handler(new popup_action('click', $url));
         }
         
-        return html_writer::tag('a', $attributes, $icon.$text);
+        return html_writer::tag('a', $icon.$text, $attributes);
     }
 
     /**
@@ -1306,10 +1302,10 @@ class core_renderer extends renderer_base {
         $id = html_writer::random_id('helpicon');
         $attributes['id'] = $id;
         $this->add_action_handler(new popup_action('click', $url), $id);
-        $output = html_writer::tag('a', $attributes, $output);
+        $output = html_writer::tag('a', $output, $attributes);
 
         // and finally span
-        return html_writer::tag('span', array('class' => 'helplink'), $output);
+        return html_writer::tag('span', $output, array('class' => 'helplink'));
     }
 
     /**
@@ -1329,7 +1325,7 @@ class core_renderer extends renderer_base {
         $link = new moodle_url('/course/scales.php', array('id' => $courseid, 'list' => true, 'scaleid' => $scale->id));
         $action = new popup_action('click', $link->url, 'ratingscale');
 
-        return html_writer::tag('span', array('class' => 'helplink'), $this->action_link($link, $icon, $action));
+        return html_writer::tag('span', $this->action_link($link, $icon, $action), array('class' => 'helplink'));
     }
 
     /**
@@ -1467,7 +1463,7 @@ class core_renderer extends renderer_base {
             $this->add_action_handler(new popup_action('click', $url), $id);
         }
 
-        return html_writer::tag('a', $attributes, $output);
+        return html_writer::tag('a', $output, $attributes);
     }
 
     /**
@@ -1535,7 +1531,7 @@ class core_renderer extends renderer_base {
         if (empty($message)) {
             return '';
         }
-        return html_writer::tag('span', array('class' => 'error'), $message);
+        return html_writer::tag('span', $message, array('class' => 'error'));
     }
 
     /**
@@ -1620,8 +1616,7 @@ class core_renderer extends renderer_base {
      * @return string the HTML to output.
      */
     public function notification($message, $classes = 'notifyproblem') {
-        return html_writer::tag('div', array('class' =>
-                renderer_base::prepare_classes($classes)), clean_text($message));
+        return html_writer::tag('div', clean_text($message), array('class' => renderer_base::prepare_classes($classes)));
     }
 
     /**
@@ -1689,7 +1684,7 @@ class core_renderer extends renderer_base {
             }
         }
 
-        return html_writer::tag('div', array('class' => 'paging'), $output);
+        return html_writer::tag('div', $output, array('class' => 'paging'));
     }
 
     /**
@@ -1746,7 +1741,7 @@ class core_renderer extends renderer_base {
                 }
                 if ($table->rotateheaders) {
                     // we need to wrap the heading content
-                    $heading->text = html_writer::tag('span', null, $heading->text);
+                    $heading->text = html_writer::tag('span', $heading->text);
                 }
 
                 $attributes = array(
@@ -1759,7 +1754,7 @@ class core_renderer extends renderer_base {
                 if ($heading->header === true) {
                     $tagtype = 'th';
                 }
-                $output .= html_writer::tag($tagtype, $attributes, $heading->text) . "\n";
+                $output .= html_writer::tag($tagtype, $heading->text, $attributes) . "\n";
             }
             $output .= html_writer::end_tag('tr') . "\n";
             $output .= html_writer::end_tag('thead') . "\n";
@@ -1768,7 +1763,7 @@ class core_renderer extends renderer_base {
                 // For valid XHTML strict every table must contain either a valid tr
                 // or a valid tbody... both of which must contain a valid td
                 $output .= html_writer::start_tag('tbody', array('class' => renderer_base::prepare_classes($table->bodyclasses).' empty'));
-                $output .= html_writer::tag('tr', null, html_writer::tag('td', array('colspan'=>count($table->head)), ''));
+                $output .= html_writer::tag('tr', html_writer::tag('td', array('colspan'=>count($table->head)), ''));
                 $output .= html_writer::end_tag('tbody');
             }
         }
@@ -1781,8 +1776,7 @@ class core_renderer extends renderer_base {
 
             foreach ($table->data as $key => $row) {
                 if (($row === 'hr') && ($countcols)) {
-                    $output .= html_writer::tag('td', array('colspan' => $countcols),
-                                                 html_writer::tag('div', array('class' => 'tabledivider'), '')) . "\n";
+                    $output .= html_writer::tag('td', html_writer::tag('div', '', array('class' => 'tabledivider')), array('colspan' => $countcols)) . "\n";
                 } else {
                     // Convert array rows to html_table_rows and cell strings to html_table_cell objects
                     if (!($row instanceof html_table_row)) {
@@ -1843,7 +1837,7 @@ class core_renderer extends renderer_base {
                         if ($cell->header === true) {
                             $tagtype = 'th';
                         }
-                        $output .= html_writer::tag($tagtype, $tdattributes, $cell->text) . "\n";
+                        $output .= html_writer::tag($tagtype, $cell->text, $tdattributes) . "\n";
                     }
                 }
                 $output .= html_writer::end_tag('tr') . "\n";
@@ -1866,7 +1860,7 @@ class core_renderer extends renderer_base {
      * @return string the HTML to output.
      */
     public function skip_link_target($id = null) {
-        return html_writer::tag('span', array('id' => $id), '');
+        return html_writer::tag('span', '', array('id' => $id));
     }
 
     /**
@@ -1882,8 +1876,7 @@ class core_renderer extends renderer_base {
         if ($level < 1 or $level > 6) {
             throw new coding_exception('Heading level must be an integer between 1 and 6.');
         }
-        return html_writer::tag('h' . $level,
-                array('id' => $id, 'class' => renderer_base::prepare_classes($classes)), $text);
+        return html_writer::tag('h' . $level, $text, array('id' => $id, 'class' => renderer_base::prepare_classes($classes)));
     }
 
     /**
@@ -2000,14 +1993,14 @@ class core_renderer extends renderer_base {
             if (!empty($item->id)) {
                 $divattr['id'] = $item->id;
             }
-            $content = html_writer::tag('p', $divattr, $content) . $this->tree_block_contents($item->children);
+            $content = html_writer::tag('p', $content, $divattr) . $this->tree_block_contents($item->children);
             if (!empty($item->preceedwithhr) && $item->preceedwithhr===true) {
-                $content = html_writer::tag('hr', array(), null).$content;
+                $content = html_writer::empty_tag('hr') . $content;
             }
-            $content = html_writer::tag('li', $liattr, $content);
+            $content = html_writer::tag('li', $content, $liattr);
             $lis[] = $content;
         }
-        return html_writer::tag('ul', $attrs, implode("\n", $lis));
+        return html_writer::tag('ul', implode("\n", $lis), $attrs);
     }
 
     /**
index 73e9b20..d3083cc 100644 (file)
@@ -902,9 +902,9 @@ class page_requirements_manager {
         $attributes = array('class'=>'skip');
         foreach ($this->skiplinks as $url => $text) {
             $attributes['href'] = '#' . $url;
-            $links .= html_writer::tag('a', $attributes, $text);
+            $links .= html_writer::tag('a', $text, $attributes);
         }
-        $output = html_writer::tag('div', array('class'=>'skiplinks'), $links) . "\n";
+        $output = html_writer::tag('div', $links, array('class'=>'skiplinks')) . "\n";
 
         // then the clever trick for hiding of things not needed when JS works
         $output .= html_writer::script("document.body.className += ' jsenabled';") . "\n";
index ce27a92..3ae230b 100644 (file)
@@ -48,7 +48,7 @@ echo $OUTPUT->header();
 echo html_writer::start_tag('form', array('action'=>'../empty.php', 'method'=>'post', 'target'=>'empty', 'id'=>'inputForm', 'style'=>'margin:0'));
 echo html_writer::empty_tag('input', array('type'=>'text', 'id'=>'input_chat_message', 'name'=>'chat_message', 'size'=>'50', 'value'=>''));
 echo html_writer::empty_tag('input', array('type'=>'checkbox', 'id'=>'auto', 'checked'=>'checked', 'value'=>''));
-echo html_writer::tag('label', array('for'=>'auto'), get_string('autoscroll', 'chat'));
+echo html_writer::tag('label', get_string('autoscroll', 'chat'), array('for'=>'auto'));
 echo $OUTPUT->help_icon('chatting', get_string('helpchatting', 'chat'), 'chat', true);
 echo html_writer::end_tag('form');
 
index b117cd8..1b36979 100644 (file)
@@ -96,8 +96,8 @@ foreach ($chatusers as $chatuser) {
     $row[1]  = html_writer::start_tag('p');
     $row[1] .= html_writer::start_tag('font', array('size'=>'1'));
     $row[1] .= fullname($chatuser).'<br />';
-    $row[1] .= html_writer::tag('span', array('class'=>'dimmed_text'), $stridle . html_writer::tag('span', array('name'=>'uidles', 'id'=>'uidle'.$chatuser->id), $idle)).' ';
-    $row[1] .= html_writer::tag('a', array('href'=>new moodle_url('/mod/chat/gui_header_js/users.php', array('chat_sid'=>$chat_sid, 'beep'=>$chatuser->id))), $strbeep);
+    $row[1] .= html_writer::tag('span', $stridle . html_writer::tag('span', $idle, array('name'=>'uidles', 'id'=>'uidle'.$chatuser->id)), array('class'=>'dimmed_text')).' ';
+    $row[1] .= html_writer::tag('a', $strbeep, array('href'=>new moodle_url('/mod/chat/gui_header_js/users.php', array('chat_sid'=>$chat_sid, 'beep'=>$chatuser->id))));
     $row[1] .= html_writer::end_tag('font');
     $row[1] .= html_writer::end_tag('p');
     $table->data[] = $row;
@@ -105,7 +105,7 @@ foreach ($chatusers as $chatuser) {
 
 ob_start();
 echo $OUTPUT->header();
-echo html_writer::tag('div', array('style'=>'display:none'), html_writer::tag('a', array('href'=>$refreshurl, 'id'=>'refreshLink'), 'Refresh link'));
+echo html_writer::tag('div', html_writer::tag('a', 'Refresh link', array('href'=>$refreshurl, 'id'=>'refreshLink')), array('style'=>'display:none')); //TODO: localize
 echo $OUTPUT->table($table);
 echo $OUTPUT->footer();
 
index d731494..1834e13 100644 (file)
@@ -546,7 +546,7 @@ function choice_show_results($choice, $course, $cm, $allresponses, $forcepublish
                 echo '<a href="javascript:select_all_in(\'DIV\',null,\'tablecontainer\');">'.get_string('selectall', 'quiz').'</a> / ';
                 echo '<a href="javascript:deselect_all_in(\'DIV\',null,\'tablecontainer\');">'.get_string('selectnone', 'quiz').'</a> ';
                 echo '&nbsp;&nbsp;';
-                echo html_writer::tag('label', array('for'=>'menuaction'), get_string('withselected', 'quiz')); 
+                echo html_writer::tag('label', get_string('withselected', 'quiz'), array('for'=>'menuaction')); 
                 echo html_writer::select(array('delete' => get_string('delete')), 'action', '', array(''=>get_string('moveselectedcoursesto')), array('id'=>'menuaction'));
                 $PAGE->requires->js_init_call('M.util.init_select_autosubmit', array('attemptsform', 'menuaction', ''));
                 echo '<noscript id="noscriptmenuaction" style="display:inline">';
index f09d279..8053d18 100644 (file)
@@ -109,7 +109,7 @@ class mod_forum_renderer extends plugin_renderer_base {
      */
     public function subscribed_users(user_selector_base $existingusers) {
         $output  = $this->output->box_start('subscriberdiv boxaligncenter');
-        $output .= html_writer::tag('p', array(), get_string('forcessubscribe', 'forum'));
+        $output .= html_writer::tag('p', get_string('forcessubscribe', 'forum'));
         $output .= $existingusers->display(true);
         $output .= $this->output->box_end();
         return $output;
index 06edeb2..e4599f1 100644 (file)
@@ -176,7 +176,7 @@ if (isset($USER->modattempts[$lesson->id])) {
     $content .= html_writer::empty_tag('input', array('type'=>'hidden', 'nam'=>'id', 'value'=>$cm->id));
     $content .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'pageid', 'value'=>LESSON_EOL));
     $content .= html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'submit', 'value'=>get_string('savechanges', 'lesson')));
-    echo html_writer::tag('form', array('method'=>'get', 'target'=>$url), "<div>$content</div>");
+    echo html_writer::tag('form', "<div>$content</div>", array('method'=>'get', 'target'=>$url));
 }
 
 // Review button back
@@ -185,7 +185,7 @@ if ($lesson->review && !$result->correctanswer && !$result->noanswer && !$result
     $content = html_writer::empty_tag('input', array('type'=>'hidden', 'nam'=>'id', 'value'=>$cm->id));
     $content .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'pageid', 'value'=>$page->id));
     $content .= html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'submit', 'value'=>get_string('reviewquestionback', 'lesson')));
-    echo html_writer::tag('form', array('method'=>'get', 'target'=>$url), "<div>$content</div>");
+    echo html_writer::tag('form', "<div>$content</div>", array('method'=>'get', 'target'=>$url));
 }
 
 $url = new moodle_url('/mod/lesson/view.php', array('id'=>$cm->id, 'pageid'=>$result->newpageid));
index 5589df0..d0cd48e 100644 (file)
@@ -162,10 +162,10 @@ class mod_lesson_renderer extends plugin_renderer_base {
         $output .= $this->output->box_start('center');
 
         $yeslink = html_writer::link(new moodle_url('/mod/lesson/view.php', array('id'=>$this->page->cm->id, 'pageid'=>$lastpageseenid, 'startlastseen'=>'yes')), get_string('yes'));
-        $output .= html_writer::tag('span', array('class'=>'lessonbutton standardbutton'), $yeslink);
+        $output .= html_writer::tag('span', $yeslink, array('class'=>'lessonbutton standardbutton'));
 
         $nolink = html_writer::link(new moodle_url('/mod/lesson/view.php', array('id'=>$this->page->cm->id, 'pageid'=>$lesson->firstpageid, 'startlastseen'=>'no')), get_string('no'));
-        $output .= html_writer::tag('span', array('class'=>'lessonbutton standardbutton'), $nolink);
+        $output .= html_writer::tag('span', $nolink, array('class'=>'lessonbutton standardbutton'));
 
         $output .= $this->output->box_end();
         return $output;
@@ -577,7 +577,7 @@ class mod_lesson_renderer extends plugin_renderer_base {
         if ($class !== '') {
             $attributes['class'] = $class;
         }
-        $output = html_writer::tag('p', $attributes, $contents);
+        $output = html_writer::tag('p', $contents, $attributes);
     }
     /**
      * Returns HTML to display add_highscores_form
index fdeb0d3..36fe6d7 100755 (executable)
                     echo '<a href="javascript:select_all_in(\'DIV\',null,\'scormtablecontainer\');">'.get_string('selectall', 'quiz').'</a> / ';
                     echo '<a href="javascript:deselect_all_in(\'DIV\',null,\'scormtablecontainer\');">'.get_string('selectnone', 'quiz').'</a> ';
                     echo '&nbsp;&nbsp;';
-                    echo html_writer::tag('label', array('for'=>'menuaction'), get_string('withselected', 'quiz'));
+                    echo html_writer::tag('label', get_string('withselected', 'quiz'), array('for'=>'menuaction'));
                     echo html_writer::select(array('delete' => get_string('delete')), 'action', '', array(''=>'choosedots'), array('id'=>'menuaction'));
                     $PAGE->requires->js_init_call('M.util.init_select_autosubmit', array('attemptsform', 'menuaction', ''));
                     echo '<noscript id="noscriptmenuaction" style="disaply:inline">';
index 3d1c938..905d30d 100644 (file)
@@ -47,7 +47,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
         }
         $sty = empty($message->sty) ? 'info' : $message->sty;
 
-        $o = html_writer::tag('span', array(), $message->text);
+        $o = html_writer::tag('span', $message->text);
         $closer = html_writer::tag('a', array('href' => $this->page->url->out()),
                     get_string('messageclose', 'workshop'));
         $o .= $this->output->container($closer, 'status-message-closer');
@@ -85,7 +85,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
                     // do not display allocation debugging messages
                     continue;
                 }
-                $o .= html_writer::tag('li', array('class' => $class), $text) . "\n";
+                $o .= html_writer::tag('li', $text, array('class' => $class)) . "\n";
             }
             $o .= html_writer::end_tag('ul');
             $o .= $this->output->continue_button($this->page->url->out());
@@ -243,7 +243,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
 
             if ($format == "html") {
                 // this is the same as the code in the last else-branch
-                $outputfiles .= html_writer::tag('li', array('class' => $type), $linkhtml);
+                $outputfiles .= html_writer::tag('li', $linkhtml, array('class' => $type));
 
             } else if ($format == "text") {
                 $outputfiles .= $linktxt . "\n";
@@ -251,11 +251,11 @@ class mod_workshop_renderer extends plugin_renderer_base {
             } else {
                 if (in_array($type, array('image/gif', 'image/jpeg', 'image/png'))) {
                     $preview     = html_writer::empty_tag('img', array('src'=>$fileurl, 'alt'=>'', 'class'=>'preview'));
-                    $preview     = html_writer::tag('a', array('href'=>$fileurl), $preview);
+                    $preview     = html_writer::tag('a', $preview, array('href'=>$fileurl));
                     $outputimgs .= $this->output->container($preview);
                 } else {
                     // this is the same as the code in html if-branch
-                    $outputfiles .= html_writer::tag('li', array('class' => $type), $linkhtml);
+                    $outputfiles .= html_writer::tag('li', $linkhtml, array('class' => $type));
                 }
             }
         }
@@ -264,7 +264,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
             $outputimgs = $this->output->container($outputimgs, 'images');
         }
         if ($format !== "text") {
-            $outputfiles = html_writer::tag('ul', array('class' => 'files'), $outputfiles);
+            $outputfiles = html_writer::tag('ul', $outputfiles, array('class' => 'files'));
         }
         return $this->output->container($outputimgs . $outputfiles, 'attachments');
     }
@@ -368,7 +368,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
         $row = new html_table_row();
         $row->set_classes('phasetasks');
         foreach ($plan as $phasecode => $phase) {
-            $title = html_writer::tag('span', array(), $phase->title);
+            $title = html_writer::tag('span', $phase->title);
             $actions = '';
             foreach ($phase->actions as $action) {
                 switch ($action->type) {
@@ -422,10 +422,10 @@ class mod_workshop_renderer extends plugin_renderer_base {
             }
             $title = $this->output->container($title, 'title');
             $details = $this->output->container($task->details, 'details');
-            $out .= html_writer::tag('li', array('class' => $classes), $title . $details);
+            $out .= html_writer::tag('li', $title . $details, array('class' => $classes));
         }
         if ($out) {
-            $out = html_writer::tag('ul', array('class' => 'tasks'), $out);
+            $out = html_writer::tag('ul', $out, array('class' => 'tasks'));
         }
         return $out;
     }
@@ -591,7 +591,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
     protected function sortable_heading($text, $sortid=null, $sortby=null, $sorthow=null) {
         global $PAGE;
 
-        $out = html_writer::tag('span', array('class'=>'text'), $text);
+        $out = html_writer::tag('span', $text, array('class'=>'text'));
 
         if (!is_null($sortid)) {
             if ($sortby !== $sortid or $sorthow !== 'ASC') {
@@ -616,7 +616,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
     protected function grading_report_participant(stdclass $participant, array $userinfo) {
         $userid = $participant->userid;
         $out  = $this->output->user_picture($userinfo[$userid], array('courseid' => $this->page->course->id, 'size' => 35));
-        $out .= html_writer::tag('span', array(), fullname($userinfo[$userid]));
+        $out .= html_writer::tag('span', fullname($userinfo[$userid]));
 
         return $out;
     }
@@ -678,8 +678,8 @@ class mod_workshop_renderer extends plugin_renderer_base {
         if ($shownames) {
             $userid = $assessment->userid;
             $name   = $this->output->user_picture($userinfo[$userid], array('courseid' => $this->page->course->id, 'size' => 16));
-            $name  .= html_writer::tag('span', array('class' => 'fullname'), fullname($userinfo[$userid]));
-            $name   = $separator . html_writer::tag('span', array('class' => 'user'), $name);
+            $name  .= html_writer::tag('span', fullname($userinfo[$userid]), array('class' => 'fullname'));
+            $name   = $separator . html_writer::tag('span', $name, array('class' => 'user'));
         } else {
             $name   = '';
         }
index a40a480..e02f3bd 100644 (file)
@@ -30,8 +30,8 @@ class theme_anomaly_core_renderer extends core_renderer {
             $output = '';
             $skipdest = '';
         } else {
-            $output = html_writer::tag('a', array('href' => '#sb-' . $bc->skipid, 'class' => 'skip-block'), get_string('skipa', 'access', $skiptitle));
-            $skipdest = html_writer::tag('span', array('id' => 'sb-' . $bc->skipid, 'class' => 'skip-block-to'), '');
+            $output = html_writer::tag('a', get_string('skipa', 'access', $skiptitle), array('href' => '#sb-' . $bc->skipid, 'class' => 'skip-block'));
+            $skipdest = html_writer::tag('span', '', array('id' => 'sb-' . $bc->skipid, 'class' => 'skip-block-to'));
         }
 
         $output .= html_writer::start_tag('div', $bc->attributes);
@@ -45,20 +45,18 @@ class theme_anomaly_core_renderer extends core_renderer {
 
         $title = '';
         if ($bc->title) {
-            $title = html_writer::tag('h2', null, $bc->title);
+            $title = html_writer::tag('h2', $bc->title);
         }
 
         if ($title || $controlshtml) {
-            $output .= html_writer::tag('div', array('class' => 'header'),
-                    html_writer::tag('div', array('class' => 'title'),
-                    $title . $controlshtml));
+            $output .= html_writer::tag('div', html_writer::tag('div', $title . $controlshtml, array('class' => 'title')), array('class' => 'header'));
         }
 
         $output .= html_writer::start_tag('div', array('class' => 'content'));
         $output .= $bc->content;
 
         if ($bc->footer) {
-            $output .= html_writer::tag('div', array('class' => 'footer'), $bc->footer);
+            $output .= html_writer::tag('div', $bc->footer, array('class' => 'footer'));
         }
 
         $output .= html_writer::end_tag('div');
@@ -71,7 +69,7 @@ class theme_anomaly_core_renderer extends core_renderer {
         $output .= html_writer::end_tag('div');
 
         if ($bc->annotation) {
-            $output .= html_writer::tag('div', array('class' => 'blockannotation'), $bc->annotation);
+            $output .= html_writer::tag('div', $bc->annotation, array('class' => 'blockannotation'));
         }
         $output .= $skipdest;
 
index 5758db0..a583547 100644 (file)
         }
 
         echo $OUTPUT->help_icon("participantswithselectedusers", get_string("withselectedusers"));
-        echo html_writer::tag('label', array('for'=>'formactionid'), get_string("withselectedusers"));
+        echo html_writer::tag('label', get_string("withselectedusers"), array('for'=>'formactionid'));
         echo html_writer::select($displaylist, 'formaction', '', array(''=>'choosedots'), array('id'=>'formactionid'));
 
         echo '<input type="hidden" name="id" value="'.$course->id.'" />';
index 3945257..34d84bc 100644 (file)
@@ -310,7 +310,7 @@ EOF;
                                                                  !$printableformat,
                                                                  true);
             } else {
-                $documentationhtml .= html_writer::tag('strong', array(), $functionname);
+                $documentationhtml .= html_writer::tag('strong', $functionname);
                 $documentationhtml .= $br;
             }
 
@@ -479,7 +479,7 @@ EOF;
         $contents .= $br.$br;
         $contents .= html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'submit', 'value'=>get_string('wsdocumentation', 'webservice')));
         
-        $htmlloginpage .= html_writer::tag('form', array('method'=>'post', 'target'=>$target), "<div>$contents</div>");
+        $htmlloginpage .= html_writer::tag('form', "<div>$contents</div>", array('method'=>'post', 'target'=>$target));
 
         $htmlloginpage .= html_writer::end_tag('td');
         $htmlloginpage .= html_writer::end_tag('tr');