mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
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:
parent
ad70376ce2
commit
16be897441
106 changed files with 565 additions and 677 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue