Skip to content

Commit

Permalink
gradebook MDL-23750 category and item page had extra cells due to par…
Browse files Browse the repository at this point in the history
…tial refactoring
  • Loading branch information
Andrew Davis committed Aug 11, 2010
1 parent a26f25a commit 5174f3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion grade/edit/tree/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,8 @@ public function get_item_cell($item, $params) {
if ($params['itemtype'] != 'course' && $params['itemtype'] != 'category') {
$itemselect = '<input class="itemselect" type="checkbox" name="select_'.$params['eid'].'" onchange="toggleCategorySelector();"/>'; // TODO: convert to YUI handler
}
return '<td class="cell last selection">' . $itemselect . '</td>';
//html_writer::table() will wrap the item cell contents in a <TD> so don't do it here
return $itemselect;
}

public function is_hidden($mode='simple') {
Expand Down
8 changes: 8 additions & 0 deletions lib/outputcomponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,7 @@ public static function table(html_table $table) {

if (!empty($table->head)) {
$countcols = count($table->head);

$output .= html_writer::start_tag('thead', array()) . "\n";
$output .= html_writer::start_tag('tr', array()) . "\n";
$keys = array_keys($table->head);
Expand Down Expand Up @@ -1289,7 +1290,13 @@ public static function table(html_table $table) {
$keys2 = array_keys($row->cells);
$lastkey = end($keys2);

$gotlastkey = false; //flag for sanity checking
foreach ($row->cells as $key => $cell) {
if ($gotlastkey) {
//This should never happen. Why do we have a cell after the last cell?
mtrace("A cell with key ($key) was found after the last key ($lastkey)");
}

if (!($cell instanceof html_table_cell)) {
$mycell = new html_table_cell();
$mycell->text = $cell;
Expand All @@ -1307,6 +1314,7 @@ public static function table(html_table $table) {
$cell->attributes['class'] .= ' cell c' . $key;
if ($key == $lastkey) {
$cell->attributes['class'] .= ' lastcol';
$gotlastkey = true;
}
$tdstyle = '';
$tdstyle .= isset($table->align[$key]) ? $table->align[$key] : '';
Expand Down

0 comments on commit 5174f3c

Please sign in to comment.