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

@ -95,6 +95,6 @@
}
}
if (!empty($table)) {
echo $OUTPUT->table($table);
echo html_writer::table($table);
}

View file

@ -419,7 +419,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
$table->data[] = $row;
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->paging_bar($totalcount, $page, $perpage, "$url&perpage=$perpage");
}

View file

@ -99,7 +99,7 @@ if (empty($pending)) {
/// Build a table of all the requests.
$table = new html_table();
$table->add_class('pendingcourserequests generaltable');
$table->attributes['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'));
@ -135,7 +135,7 @@ if (empty($pending)) {
}
/// Display the table.
echo $OUTPUT->table($table);
echo html_writer::table($table);
/// Message about name collisions, if necessary.
if (!empty($collision)) {
@ -145,4 +145,4 @@ if (empty($pending)) {
/// Finish off the page.
echo $OUTPUT->single_button($CFG->wwwroot . '/course/index.php', get_string('backtocourselisting'));
echo $OUTPUT->footer();
echo $OUTPUT->footer();

View file

@ -47,7 +47,7 @@
echo $OUTPUT->container(get_string('computedfromlogs', 'admin', userdate($logstart)), 'loginfo');
$outlinetable = new html_table();
$outlinetable->add_class('generaltable boxaligncenter');
$outlinetable->attributes['class'] = 'generaltable boxaligncenter';
$outlinetable->cellpadding = 5;
$outlinetable->id = 'outlinetable';
$outlinetable->head = array($stractivity, $strviews);
@ -82,7 +82,7 @@
}
if ($prevsecctionnum != $sectionnum) {
$sectionrow = new html_table_row();
$sectionrow->add_class('section');
$sectionrow->attributes['class'] = 'section';
$sectioncell = new html_table_cell();
$sectioncell->colspan = count($outlinetable->head);
@ -105,7 +105,7 @@
$reportrow = new html_table_row();
$activitycell = new html_table_cell();
$activitycell->add_class('activity');
$activitycell->attributes['class'] = 'activity';
$activityicon = $OUTPUT->pix_icon('icon', $modulename, $cm->modname, array('class'=>'icon'));
@ -119,7 +119,7 @@
$reportrow->cells[] = $activitycell;
$numviewscell = new html_table_cell();
$numviewscell->add_class('numviews');
$numviewscell->attributes['class'] = 'numviews';
if (!empty($views[$cm->id]->numviews)) {
$numviewscell->text = $views[$cm->id]->numviews;
@ -131,7 +131,7 @@
if ($CFG->useblogassociations) {
$blogcell = new html_table_cell();
$blogcell->add_class('blog');
$blogcell->attributes['class'] = 'blog';
if ($blogcount = blog_get_associated_count($course->id, $cm->id)) {
$blogcell->text = html_writer::link('/blog/index.php?modid='.$cm->id, $blogcount);
} else {
@ -142,7 +142,7 @@
if ($showlastaccess) {
$lastaccesscell = new html_table_cell();
$lastaccesscell->add_class('lastaccess');
$lastaccesscell->attributes['class'] = 'lastaccess';
if (isset($views[$cm->id]->lasttime)) {
$timeago = format_time(time() - $views[$cm->id]->lasttime);
@ -153,7 +153,7 @@
$outlinetable->data[] = $reportrow;
}
}
echo $OUTPUT->table($outlinetable);
echo html_writer::table($outlinetable);
echo $OUTPUT->footer();

View file

@ -67,7 +67,7 @@
.'<div>'."\n"
.'<input type="hidden" name="mode" value="'.$mode.'" />'."\n";
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo '</div>';
echo '</form>';
@ -221,7 +221,7 @@
$lastrecord[] = $lastlink;
$table->data[] = $lastrecord;
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
}
}

View file

@ -87,7 +87,7 @@ if ($mform->is_cancelled()) {
$table->align = array('left', 'left', 'left');
$table->width = '80%';
$table->data = $data;
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->continue_button('view.php?id='.$course->id); // Back to course page
echo $OUTPUT->footer();

View file

@ -89,7 +89,7 @@ if (!$cms) {
}
$table = new html_table();
$table->set_classes(array('generaltable', 'mod_index'));
$table->attributes['class'] = 'generaltable mod_index';
if ($course->format == 'weeks') {
$table->head = array ($strweek, $strname, $strintro);
@ -137,6 +137,6 @@ foreach ($cms as $cm) {
format_module_intro('resource', $resource, $cm->id));
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->footer();

View file

@ -256,7 +256,7 @@ switch ($mode) {
$a[] = $stat->line3;
$table->data[] = $a;
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
break;
case "outline" :