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

@ -166,7 +166,7 @@
// Display the table.
echo '<br />';
echo $OUTPUT->table($table);
echo html_writer::table($table);
// Finish the page
echo $OUTPUT->footer();

View file

@ -199,7 +199,7 @@ foreach ($overrides as $override) {
echo html_writer::start_tag('div', array('id' => 'quizoverrides'));
if (count($table->data)) {
echo $OUTPUT->table($table);
echo html_writer::table($table);
}
echo html_writer::start_tag('div', array('class' => 'buttons'));

View file

@ -195,7 +195,7 @@ class quiz_statistics_report extends quiz_default_report {
$questioninfotable = new html_table();
$questioninfotable->align = array('center', 'center');
$questioninfotable->width = '60%';
$questioninfotable->add_class('generaltable titlesleft');
$questioninfotable->attributes['class'] = 'generaltable titlesleft';
$questioninfotable->data = array();
$questioninfotable->data[] = array(get_string('modulename', 'quiz'), $quiz->name);
@ -206,7 +206,7 @@ class quiz_statistics_report extends quiz_default_report {
$questionstatstable = new html_table();
$questionstatstable->align = array('center', 'center');
$questionstatstable->width = '60%';
$questionstatstable->add_class('generaltable titlesleft');
$questionstatstable->attributes['class'] = 'generaltable titlesleft';
unset($datumfromtable['number']);
unset($datumfromtable['icon']);
@ -225,12 +225,12 @@ class quiz_statistics_report extends quiz_default_report {
$questionstatstable->data[] = array($labels[$item], $value);
}
echo $OUTPUT->heading(get_string('questioninformation', 'quiz_statistics'));
echo $OUTPUT->table($questioninfotable);
echo html_writer::table($questioninfotable);
echo $OUTPUT->box(format_text($question->questiontext, $question->questiontextformat).$actions, 'boxaligncenter generalbox boxwidthnormal mdl-align');
echo $OUTPUT->heading(get_string('questionstatistics', 'quiz_statistics'));
echo $OUTPUT->table($questionstatstable);
echo html_writer::table($questionstatstable);
} else {
$this->qtable->export_class_instance($this->table->export_class_instance());
@ -422,7 +422,7 @@ class quiz_statistics_report extends quiz_default_report {
$quizinformationtablehtml .= $OUTPUT->help_icon('tableexportformats', get_string('tableexportformats', 'table'));
$quizinformationtablehtml .= '</div></form>';
}
$quizinformationtablehtml .= $OUTPUT->table($quizinformationtable);
$quizinformationtablehtml .= html_writer::table($quizinformationtable);
if (!$this->table->is_downloading()){
echo $quizinformationtablehtml;
} elseif ($everything) {

View file

@ -77,7 +77,7 @@ echo $OUTPUT->heading($title);
/// Prepare the summary table header
$table = new html_table();
$table->add_class('generaltable quizsummaryofattempt boxaligncenter');
$table->attributes['class'] = 'generaltable quizsummaryofattempt boxaligncenter';
$table->head = array(get_string('question', 'quiz'), get_string('status', 'quiz'));
$table->align = array('left', 'left');
$table->size = array('', '');
@ -109,7 +109,7 @@ foreach ($attemptobj->get_question_iterator() as $number => $question) {
}
/// Print the summary table.
echo $OUTPUT->table($table);
echo html_writer::table($table);
/// countdown timer
echo $attemptobj->get_timer_html();

View file

@ -181,7 +181,7 @@
// Prepare table header
$table = new html_table();
$table->set_classes('generaltable quizattemptsummary');
$table->attributes['class'] = 'generaltable quizattemptsummary';
$table->head = array();
$table->align = array();
$table->size = array();
@ -298,7 +298,7 @@
$table->data[$attempt->attempt] = $row;
}
} // End of loop over attempts.
echo $OUTPUT->table($table);
echo html_writer::table($table);
}
/// Print information about the student's best score for this quiz if possible.