MDL-26425 tablelib ability for table_sql to add a class to the row based on the data.

This commit is contained in:
Tim Hunt
2011-03-28 17:12:26 +02:00
committed by Petr Skoda
parent 9f9324f408
commit 8fc52ccf46
+11 -1
View File
@@ -1290,12 +1290,22 @@ class table_sql extends flexible_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