MDL-21652 html_table rendering refactored

* class html_component does not exist any more
* class html_table rendered via html_writer::table()
* html_table, html_table_row and html_table_cell have public $attributes property to set their CSS classes
* dropped rotateheaders feature, should be added again after more research of possible ways (<svg> is not nice IMHO)
* dropped possibility to define CSS classes for table heading, body and footer - can be easily done and better done using just table class and context
This commit is contained in:
David Mudrak 2010-03-20 22:15:54 +00:00
parent ad70376ce2
commit 16be897441
106 changed files with 565 additions and 677 deletions

View file

@ -116,7 +116,7 @@ foreach ($users as $k => $v) {
$checkbox
);
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo '<div style="width:100%;text-align:center;"><input type="submit" value="' . get_string('savechanges'). '" /></div></form>';
echo $OUTPUT->footer();

View file

@ -181,7 +181,7 @@ foreach ($_POST as $k => $v) {
$checkbox2);
}
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo "\n<div style=\"width:100%;text-align:center;\"><input type=\"submit\" value=\"".get_string('savechanges')."\" /></div>\n</form>\n";
echo $OUTPUT->footer();

View file

@ -171,7 +171,7 @@ foreach ($_POST as $k => $v) {
);
}
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo '<div style="width:100%;text-align:center;"><strong>';
echo get_string('extendperiod') . ' ';
echo html_writer::select($periodmenu, 'extendperiod');

View file

@ -214,7 +214,7 @@
/// Print settings and things in a table across the top
$controlstable = new html_table();
$controlstable->add_class('controls');
$controlstable->attributes['class'] = 'controls';
$controlstable->cellspacing = 0;
$controlstable->data[] = new html_table_row();
@ -318,23 +318,23 @@
$select = new single_select($baseurl, 'mode', $formatmenu, $mode, null, 'formatmenu');
$select->set_label(get_string('userlist'));
$userlistcell = new html_table_cell();
$userlistcell->add_class('right');
$userlistcell->attributes['class'] = 'right';
$userlistcell->text = $OUTPUT->render($select);
$controlstable->data[0]->cells[] = $userlistcell;
echo $OUTPUT->table($controlstable);
echo html_writer::table($controlstable);
if ($currentgroup and (!$isseparategroups or has_capability('moodle/site:accessallgroups', $context))) { /// Display info about the group
if ($group = groups_get_group($currentgroup)) {
if (!empty($group->description) or (!empty($group->picture) and empty($group->hidepicture))) {
$groupinfotable = new html_table();
$groupinfotable->add_class('groupinfobox');
$groupinfotable->attributes['class'] = 'groupinfobox';
$picturecell = new html_table_cell();
$picturecell->add_classes(array('left', 'side', 'picture'));
$picturecell->attributes['class'] = 'left side picture';
$picturecell->text = print_group_picture($group, $course->id, true, false, false);
$contentcell = new html_table_cell();
$contentcell->add_class('content');
$contentcell->attributes['class'] = 'content';
$contentcell->text = print_group_picture($group, $course->id, true, false, false);
$contentheading = $group->name;
@ -349,7 +349,7 @@
}
$contentcell->text = $OUTPUT->heading($contentheading, 3) . format_text($group->description, $group->descriptionformat);
$groupinfotable->data[] = new html_table_row(array($picturecell, $contentcell));
echo $OUTPUT->table($groupinfotable);
echo html_writer::table($groupinfotable);
}
}
}
@ -751,15 +751,15 @@
$hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields));
}
$table = new html_table();
$table->add_class('userinfobox');
$table->attributes['class'] = 'userinfobox';
$row = new html_table_row();
$row->cells[0] = new html_table_cell();
$row->cells[0]->add_class('left side');
$row->cells[0]->attributes['class'] = 'left side';
$row->cells[0]->text = $OUTPUT->user_picture($user, array('courseid'=>$course->id));
$row->cells[1] = new html_table_cell();
$row->cells[1]->add_class('content');
$row->cells[1]->attributes['class'] = 'content';
$row->cells[1]->text = $OUTPUT->container(fullname($user, has_capability('moodle/site:viewfullnames', $context)), 'username');
$row->cells[1]->text .= $OUTPUT->container_start('info');
@ -797,7 +797,7 @@
$row->cells[1]->text .= $OUTPUT->container_end();
$row->cells[2] = new html_table_cell();
$row->cells[2]->add_class('links');
$row->cells[2]->attributes['class'] = 'links';
$row->cells[2]->text = '';
$links = array();
@ -831,7 +831,7 @@
$row->cells[2]->text .= '<br /><input type="checkbox" name="user'.$user->id.'" /> ';
}
$table->data = array($row);
echo $OUTPUT->table($table);
echo html_writer::table($table);
}
} else {

View file

@ -175,7 +175,7 @@ switch ($action) {
$table->data[] = array($token->token, $token->name, $validuntil, $creatoratag, $reset);
}
$return .= $OUTPUT->table($table);
$return .= html_writer::table($table);
} else {
$return .= get_string('notoken', 'webservice');

View file

@ -119,7 +119,7 @@ if ($display) {
);
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->box_end();
}
echo $OUTPUT->footer();

View file

@ -101,7 +101,7 @@ if (count($queued) > 0) {
unset($e); // this could potentially be quite big, so free it.
}
echo $OUTPUT->heading(get_string('queuesummary', 'portfolio'));
echo $OUTPUT->table($table);
echo html_writer::table($table);
$somethingprinted = true;
}
// paging - get total count separately
@ -139,7 +139,7 @@ if ($logcount > 0) {
echo $OUTPUT->heading(get_string('logsummary', 'portfolio'));
$pagingbar = new paging_bar($logcount, $page, $perpage, $CFG->wwwroot . '/user/portfoliologs.php?');
echo $OUTPUT->render($pagingbar);
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->render($pagingbar);
$somethingprinted = true;
}

View file

@ -120,7 +120,7 @@ foreach ($categories as $category) {
$table->head = array(get_string('profilefield', 'admin'), get_string('edit'));
$table->align = array('left', 'right');
$table->width = '95%';
$table->add_class ('generaltable profilefield');
$table->attributes['class'] = 'generaltable profilefield';
$table->data = array();
if ($fields = $DB->get_records('user_info_field', array('categoryid'=>$category->id), 'sortorder ASC')) {
@ -131,7 +131,7 @@ foreach ($categories as $category) {
echo $OUTPUT->heading(format_string($category->name) .' '.profile_category_icons($category));
if (count($table->data)) {
echo $OUTPUT->table($table);
echo html_writer::table($table);
} else {
echo $OUTPUT->notification($strnofields);
}

View file

@ -83,7 +83,7 @@ foreach ($instances as $i) {
.get_string('settings', 'repository').'</a>' : '');
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->footer();