Skip to content

Commit

Permalink
MDL-26425 tablelib ability for table_sql to add a class to the row ba…
Browse files Browse the repository at this point in the history
…sed on the data.
  • Loading branch information
timhunt committed Mar 27, 2011
1 parent abf7296 commit b08fb12
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/tablelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1245,11 +1245,21 @@ function build_table() {
if ($this->rawdata) {
foreach ($this->rawdata as $row) {
$formattedrow = $this->format_row($row);
$this->add_data_keyed($formattedrow);
$this->add_data_keyed($formattedrow,
$this->get_row_class($row));
}
}
}

/**
* Get any extra classes names to add to this row in the HTML.
* @param $row array the data for this row.
* @return string added to the class="" attribute of the tr.
*/
function get_row_class($row) {
return '';
}

/**
* This is only needed if you want to use different sql to count rows.
* Used for example when perhaps all db JOINS are not needed when counting
Expand Down

0 comments on commit b08fb12

Please sign in to comment.