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

@ -118,6 +118,6 @@ foreach ($modinfo->instances['assignment'] as $cm) {
echo "<br />";
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->footer();

View file

@ -79,7 +79,7 @@ $table->data = array(
'<a id="choosetheme" href="###">'.get_string('themes').' ▶</a>'
)
);
echo $OUTPUT->box($OUTPUT->table($table), '', 'chat-input-area');
echo $OUTPUT->box(html_writer::table($table), '', 'chat-input-area');
echo $OUTPUT->box('', '', 'chat-notify');
echo $OUTPUT->footer();

View file

@ -106,7 +106,7 @@ foreach ($chatusers as $chatuser) {
ob_start();
echo $OUTPUT->header();
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 html_writer::table($table);
echo $OUTPUT->footer();
//

View file

@ -83,7 +83,7 @@ foreach ($chats as $chat) {
echo '<br />';
echo $OUTPUT->table($table);
echo html_writer::table($table);
/// Finish the page

View file

@ -94,7 +94,7 @@
}
}
echo "<br />";
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->footer();

View file

@ -298,7 +298,7 @@ if (($mode == 'new') && (!empty($newtype)) && confirm_sesskey()) { ///
);
}
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
}

View file

@ -141,6 +141,6 @@ foreach ($datas as $data) {
}
echo "<br />";
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->footer();

View file

@ -108,7 +108,7 @@ foreach ($feedbacks as $feedback) {
echo "<br />";
echo $OUTPUT->table($table);
echo html_writer::table($table);
/// Finish the page

View file

@ -54,7 +54,7 @@ if (!$folders = get_all_instances_in_course('folder', $course)) {
}
$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);
@ -93,6 +93,6 @@ foreach ($folders as $folder) {
format_module_intro('folder', $folder, $cm->id));
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->footer();

View file

@ -421,12 +421,12 @@ if (!isguestuser()) {
if ($generalforums) {
echo $OUTPUT->heading(get_string('generalforums', 'forum'));
echo $OUTPUT->table($generaltable);
echo html_writer::table($generaltable);
}
if ($learningforums) {
echo $OUTPUT->heading(get_string('learningforums', 'forum'));
echo $OUTPUT->table($learningtable);
echo html_writer::table($learningtable);
}
echo $OUTPUT->footer();

View file

@ -51,22 +51,22 @@ class mod_forum_renderer extends plugin_renderer_base {
$existingcell = new html_table_cell();
$existingcell->text = $existinguc->display(true);
$existingcell->set_classes(array('existing'));
$existingcell->attributes['class'] = 'existing';
$actioncell = new html_table_cell();
$actioncell->text = html_writer::start_tag('div', array());
$actioncell->text .= html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'subscribe', 'value'=>$this->page->theme->larrow.' '.get_string('add'), 'class'=>'actionbutton'));
$actioncell->text .= html_writer::empty_tag('br', array());
$actioncell->text .= html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'unsubscribe', 'value'=>$this->page->theme->rarrow.' '.get_string('remove'), 'class'=>'actionbutton'));
$actioncell->text .= html_writer::end_tag('div', array());
$actioncell->set_classes(array('actions'));
$actioncell->attributes['class'] = 'actions';
$potentialcell = new html_table_cell();
$potentialcell->text = $potentialuc->display(true);
$potentialcell->set_classes(array('potential'));
$potentialcell->attributes['class'] = 'potential';
$table = new html_table();
$table->set_classes(array('subscribertable','boxaligncenter'));
$table->attributes['class'] = 'subscribertable boxaligncenter';
$table->data = array(new html_table_row(array($existingcell, $actioncell, $potentialcell)));
$output .= $this->output->table($table);
$output .= html_writer::table($table);
$output .= html_writer::end_tag('form');
return $output;
@ -95,7 +95,7 @@ class mod_forum_renderer extends plugin_renderer_base {
foreach ($users as $user) {
$table->data[] = array($this->output->user_picture($user, array('courseid'=>$course->id)), fullname($user), $user->email);
}
$output .= $this->output->table($table);
$output .= html_writer::table($table);
}
return $output;
}
@ -116,4 +116,4 @@ class mod_forum_renderer extends plugin_renderer_base {
}
}
}

View file

@ -128,7 +128,7 @@ foreach ($glossarys as $glossary) {
echo "<br />";
echo $OUTPUT->table($table);
echo html_writer::table($table);
/// Finish the page

View file

@ -399,7 +399,7 @@
echo "<br />";
echo $OUTPUT->table($table);
echo html_writer::table($table);
// Finish the page
echo $OUTPUT->footer();

View file

@ -54,7 +54,7 @@ if (!$imscps = get_all_instances_in_course('imscp', $course)) {
}
$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);
@ -93,6 +93,6 @@ foreach ($imscps as $imscp) {
format_module_intro('imscp', $imscp, $cm->id));
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->footer();

View file

@ -296,7 +296,7 @@ switch ($mode) {
// Setup table
$table = new html_table();
$table->head = array(get_string('name'), get_string('essays', 'lesson'), get_string('email', 'lesson'));
$table->set_classes(array('standardtable', 'generaltable'));
$table->attributes['class'] = 'standardtable generaltable';
$table->align = array('left', 'left', 'left');
$table->wrap = array('nowrap', 'nowrap', '');
@ -356,7 +356,7 @@ switch ($mode) {
$table->data[] = array(' ', ' ', $emailalllink);
echo $OUTPUT->table($table);
echo html_writer::table($table);
break;
case 'grade':
// Grading form

View file

@ -208,7 +208,7 @@ switch ($mode) {
break;
}
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
}
if (!has_capability('mod/lesson:manage', $context)) { // teachers don't need the links

View file

@ -116,5 +116,5 @@ foreach ($lessons as $lesson) {
$table->data[] = array ($link, $lesson->grade, $due);
}
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->footer();

View file

@ -235,7 +235,7 @@ function lesson_user_complete($course, $user, $mod, $lesson) {
if ($npages) {
$table->data[] = array($retry + 1, $npages, $ncorrect, userdate($timeseen));
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->box_end();
}

View file

@ -228,7 +228,7 @@ class mod_lesson_renderer extends plugin_renderer_base {
$pageid = $page->nextpageid;
}
return $this->output->table($table);
return html_writter::table($table);
}
/**
@ -292,7 +292,7 @@ class mod_lesson_renderer extends plugin_renderer_base {
$pagetable = $page->display_answers($pagetable);
$content .= $this->output->table($pagetable);
$content .= html_writer::table($pagetable);
if ($canedit) {
$content .= $this->add_page_links($lesson, $pageid);
@ -539,16 +539,16 @@ class mod_lesson_renderer extends plugin_renderer_base {
if ($progress != 0) { // some browsers do not repsect the 0 width.
$cells[0] = new html_table_cell();
$cells[0]->style = 'width:'.$progress.'%';
$cells[0]->set_classes('progress_bar_completed');
$cells[0]->attributes['class'] = 'progress_bar_completed';
$cells[0]->text = ' ';
}
$cells[] = '<div class="progress_bar_token"></div>';
$table = new html_table();
$table->set_classes(array('progress_bar_table', 'center'));
$table->attributes['class'] = 'progress_bar_table';
$table->data = array(new html_table_row($cells));
return $this->output->box($this->output->table($table), 'progress_bar');
return $this->output->box(html_writer::table($table), 'progress_bar');
}
/**
@ -599,4 +599,4 @@ class mod_lesson_renderer extends plugin_renderer_base {
$output .= $this->output->box_end();
return $output;
}
}
}

View file

@ -221,10 +221,10 @@ if ($action == 'reportoverview') {
// set up the table object
$table->head = array(get_string('name'), get_string('attempts', 'lesson'), get_string('highscore', 'lesson'));
$table->align = array("center", "left", "left");
$table->wrap = array("nowrap", "nowrap", "nowrap");
$table->set_classes(array('standardtable', 'generaltable'));
$table->size = array("*", "70%", "*");
$table->align = array('center', 'left', 'left');
$table->wrap = array('nowrap', 'nowrap', 'nowrap');
$table->attributes['class'] = 'standardtable generaltable';
$table->size = array(null, '70%', null);
// print out the $studentdata array
// going through each student that has attempted the lesson, so, each student should have something to be displayed
@ -299,7 +299,7 @@ if ($action == 'reportoverview') {
<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />\n
<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n";
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
if (has_capability('mod/lesson:edit', $context)) {
$checklinks = '<a href="javascript: checkall();">'.get_string('selectall').'</a> / ';
$checklinks .= '<a href="javascript: checknone();">'.get_string('deselectall').'</a>';
@ -344,12 +344,12 @@ if ($action == 'reportoverview') {
$stattable->head = array(get_string('averagescore', 'lesson'), get_string('averagetime', 'lesson'),
get_string('highscore', 'lesson'), get_string('lowscore', 'lesson'),
get_string('hightime', 'lesson'), get_string('lowtime', 'lesson'));
$stattable->align = array("center", "center", "center", "center", "center", "center");
$stattable->wrap = array("nowrap", "nowrap", "nowrap", "nowrap", "nowrap", "nowrap");
$stattable->set_classes(array('standardtable', 'generaltable'));
$stattable->align = array('center', 'center', 'center', 'center', 'center', 'center');
$stattable->wrap = array('nowrap', 'nowrap', 'nowrap', 'nowrap', 'nowrap', 'nowrap');
$stattable->attributes['class'] = 'standardtable generaltable';
$stattable->data[] = array($avescore.'%', $avetime, $highscore.'%', $lowscore.'%', $hightime, $lowtime);
echo $OUTPUT->table($stattable);
echo html_writer::table($stattable);
} else if ($action == 'reportdetail') {
/**************************************************************************
this action is for a student detailed view and for the general detailed view
@ -475,8 +475,8 @@ if ($action == 'reportoverview') {
echo $OUTPUT->heading(get_string('attempt', 'lesson', $try+1));
$table->head = array();
$table->align = array("right", "left");
$table->set_classes(array('compacttable', 'generaltable'));
$table->align = array('right', 'left');
$table->attributes['class'] = 'compacttable generaltable';
$params = array("lessonid"=>$lesson->id, "userid"=>$userid);
if (!$grades = $DB->get_records_select("lesson_grades", "lessonid = :lessonid and userid = :userid", $params, "completed", "*", $try, 1)) {
@ -509,16 +509,16 @@ if ($action == 'reportoverview') {
$table->data[] = array(get_string('rawgrade', 'lesson').':', $gradeinfo->earned.'/'.$gradeinfo->total);
$table->data[] = array(get_string("grade", "lesson").":", $grade."%");
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
// Don't want this class for later tables
$table->set_classes(array());
$table->attributes['class'] = '';
}
$table->align = array("left", "left");
$table->size = array("70%", "*");
$table->set_classes(array('compacttable', 'generaltable'));
$table->align = array('left', 'left');
$table->size = array('70%', null);
$table->attributes['class'] = 'compacttable generaltable';
foreach ($answerpages as $page) {
unset($table->data);
@ -554,7 +554,7 @@ if ($action == 'reportoverview') {
} else {
$table->data[] = array(0, " ");
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
}
} else {
print_error('unknowaction');

View file

@ -54,7 +54,7 @@ if (!$pages = get_all_instances_in_course('page', $course)) {
}
$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);
@ -94,6 +94,6 @@ foreach ($pages as $page) {
format_module_intro('page', $page, $cm->id));
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->footer();

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.

View file

@ -54,7 +54,7 @@ if (!$resources = get_all_instances_in_course('resource', $course)) {
}
$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);
@ -100,6 +100,6 @@ foreach ($resources as $resource) {
format_module_intro('resource', $resource, $cm->id));
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->footer();

View file

@ -96,7 +96,7 @@
echo "<br />";
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->footer();

View file

@ -198,7 +198,7 @@
if (has_capability('mod/scorm:deleteresponses',$contextmodule)) {
echo '<form id="attemptsform" method="post" action="'.$FULLSCRIPT.'" onsubmit="var menu = document.getElementById(\'menuaction\'); return (menu.options[menu.selectedIndex].value == \'delete\' ? \''.addslashes_js(get_string('deleteattemptcheck','quiz')).'\' : true);">';
echo '<input type="hidden" name="id" value="'.$id.'">';
echo $OUTPUT->table($table);
echo html_writer::table($table);
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;';
@ -210,7 +210,7 @@
echo '<input type="submit" value="'.get_string('go').'" /></div></noscript>';
echo '</form>';
} else {
echo $OUTPUT->table($table);
echo html_writer::table($table);
}
echo '</div>';
} else {
@ -272,7 +272,7 @@
}
$table->data[] = $row;
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
}
}
} else {
@ -347,7 +347,7 @@
}
if ($existelements) {
echo '<h3>'.get_string('general','scorm').'</h3>';
echo $OUTPUT->table($table);
echo html_writer::table($table);
}
// Print Interactions data
@ -389,7 +389,7 @@
}
if ($existinteraction) {
echo '<h3>'.get_string('interactions','scorm').'</h3>';
echo $OUTPUT->table($table);
echo html_writer::table($table);
}
// Print Objectives data
@ -433,7 +433,7 @@
}
if ($existobjective) {
echo '<h3>'.get_string('objectives','scorm').'</h3>';
echo $OUTPUT->table($table);
echo html_writer::table($table);
}
$table = new html_table();
$table->head = array(get_string('element','scorm'), get_string('value','scorm'));
@ -461,7 +461,7 @@
}
if ($existelements) {
echo '<h3>'.get_string('othertracks','scorm').'</h3>';
echo $OUTPUT->table($table);
echo html_writer::table($table);
}
echo $OUTPUT->box_end();
} else {

View file

@ -80,7 +80,7 @@
}
echo "<br />";
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->footer();

View file

@ -191,7 +191,7 @@ function survey_user_complete($course, $user, $mod, $survey) {
}
$table->data[] = array("<b>$questiontext</b>", $answertext);
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
} else {
@ -475,7 +475,7 @@ function survey_print_all_responses($cmid, $results, $courseid) {
userdate($a->time));
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
}
/**

View file

@ -302,7 +302,7 @@
$table->data[] = array($contents);
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->spacer(array('height'=>30)); // should be done with CSS instead
}
@ -354,7 +354,7 @@
}
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
break;
@ -440,7 +440,7 @@
$table->head = array(get_string($question->text, "survey"));
$table->align = array ("left");
$table->data[] = array(s($answer->answer1)); // no html here, just plain text
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->spacer(30);
}
}

View file

@ -115,7 +115,7 @@
$table->head = array(get_string($question->text, "survey"));
$table->align = array ("left");
$table->data[] = array(s($answer->answer1));//no html here, just plain text
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->spacer(clone($spacer)) . '<br />';
}
}

View file

@ -54,7 +54,7 @@ if (!$urls = get_all_instances_in_course('url', $course)) {
}
$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);
@ -100,6 +100,6 @@ foreach ($urls as $url) {
format_module_intro('url', $url, $cm->id));
}
echo $OUTPUT->table($table);
echo html_writer::table($table);
echo $OUTPUT->footer();

View file

@ -101,7 +101,7 @@
echo "<br />";
echo $OUTPUT->table($table);
echo html_writer::table($table);
/// Finish the page

View file

@ -14,7 +14,7 @@
<input type="hidden" name="wikipage" value="<?php print $wikipage?>" />
<?php
$remove_table=wiki_admin_remove_list($form->listall);
echo $OUTPUT->table($remove_table);
echo html_writer::table($remove_table);
?>
<div class="boxaligncenter">
<?php

View file

@ -11,7 +11,7 @@
<input type="hidden" name="wikipage" value="<?php print $wikipage?>" />
<?php
$pageflags_table=wiki_admin_setpageflags_list($pageflagstatus);
echo $OUTPUT->table($pageflags_table);
echo html_writer::table($pageflags_table);
?>
<br />
<div class="boxaligncenter">

View file

@ -11,7 +11,7 @@
<input type="hidden" name="wikipage" value="<?php print $wikipage?>" />
<?php
$strip_table=wiki_admin_strip_list($form->pagestostrip, $form->version, $err);
echo $OUTPUT->table($strip_table);
echo html_writer::table($strip_table);
?>
<div class="boxaligncenter">
<?php

View file

@ -54,7 +54,7 @@ class workshopallocation_manual_renderer extends plugin_renderer_base {
$reviewers = array_map('fullname', $reviewers);
$table = new html_table();
$table->set_classes('allocations');
$table->attributes['class'] = 'allocations';
$table->head = array(get_string('participantreviewedby', 'workshop'),
get_string('participant', 'workshop'),
get_string('participantrevierof', 'workshop'));
@ -77,7 +77,7 @@ class workshopallocation_manual_renderer extends plugin_renderer_base {
$table->data[] = $row;
}
return $this->output->container($this->output->table($table), 'manual-allocator');
return $this->output->container(html_writer::table($table), 'manual-allocator');
}
/**

View file

@ -362,11 +362,11 @@ class mod_workshop_renderer extends plugin_renderer_base {
throw new coding_exception('you must provide the prepared user plan to be rendered');
}
$table = new html_table();
$table->set_classes('userplan');
$table->attributes['class'] = 'userplan';
$table->head = array();
$table->colclasses = array();
$row = new html_table_row();
$row->set_classes('phasetasks');
$row->attributes['class'] = 'phasetasks';
foreach ($plan as $phasecode => $phase) {
$title = html_writer::tag('span', $phase->title);
$actions = '';
@ -394,7 +394,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
}
$table->data = array($row);
return $this->output->table($table);
return html_writer::table($table);
}
/**
@ -450,7 +450,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
}
$table = new html_table();
$table->set_classes('grading-report');
$table->attributes['class'] = 'grading-report';
$sortbyfirstname = $this->sortable_heading(get_string('firstname'), 'firstname', $options->sortby, $options->sorthow);
$sortbylastname = $this->sortable_heading(get_string('lastname'), 'lastname', $options->sortby, $options->sorthow);
@ -509,7 +509,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
$cell = new html_table_cell();
$cell->text = $this->grading_report_participant($participant, $userinfo);
$cell->rowspan = $numoftrs;
$cell->add_class('participant');
$cell->attributes['class'] = 'participant';
$row->cells[] = $cell;
}
// column #2 - submission - spans over all rows
@ -517,7 +517,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
$cell = new html_table_cell();
$cell->text = $this->grading_report_submission($participant);
$cell->rowspan = $numoftrs;
$cell->add_class('submission');
$cell->attributes['class'] = 'submission';
$row->cells[] = $cell;
}
// column #3 - received grades
@ -528,11 +528,11 @@ class mod_workshop_renderer extends plugin_renderer_base {
$cell->text = $this->grading_report_assessment($assessment, $options->showreviewernames, $userinfo,
get_string('gradereceivedfrom', 'workshop'));
$cell->rowspan = $spanreceived;
$cell->add_class('receivedgrade');
$cell->attributes['class'] = 'receivedgrade';
if (is_null($assessment) or is_null($assessment->grade)) {
$cell->add_class('null');
$cell->attributes['class'] .= ' null';
} else {
$cell->add_class('notnull');
$cell->attributes['class'] .= ' notnull';
}
$row->cells[] = $cell;
}
@ -541,7 +541,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
$cell = new html_table_cell();
$cell->text = $this->grading_report_grade($participant->submissiongrade, $participant->submissiongradeover);
$cell->rowspan = $numoftrs;
$cell->add_class('submissiongrade');
$cell->attributes['class'] = 'submissiongrade';
$row->cells[] = $cell;
}
// column #5 - given grades
@ -552,11 +552,11 @@ class mod_workshop_renderer extends plugin_renderer_base {
$cell->text = $this->grading_report_assessment($assessment, $options->showauthornames, $userinfo,
get_string('gradegivento', 'workshop'));
$cell->rowspan = $spangiven;
$cell->add_class('givengrade');
$cell->attributes['class'] = 'givengrade';
if (is_null($assessment) or is_null($assessment->grade)) {
$cell->add_class('null');
$cell->attributes['class'] .= ' null';
} else {
$cell->add_class('notnull');
$cell->attributes['class'] .= ' notnull';
}
$row->cells[] = $cell;
}
@ -565,7 +565,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
$cell = new html_table_cell();
$cell->text = $this->grading_report_grade($participant->gradinggrade);
$cell->rowspan = $numoftrs;
$cell->add_class('gradinggrade');
$cell->attributes['class'] = 'gradinggrade';
$row->cells[] = $cell;
}
@ -573,7 +573,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
}
}
return $this->output->table($table);
return html_writer::table($table);
}
/**