Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-26425 tablelib ability for table_sql to add a class to the row ba…

…sed on the data.
  • Loading branch information...
commit 8fc52ccf461958d650f5f71912be2d53ceb336ef 1 parent 9f9324f
Tim Hunt timhunt authored skodak committed
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/tablelib.php
12 lib/tablelib.php
View
@@ -1290,13 +1290,23 @@ 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
* records. You don't need to call this function the count_sql
Please sign in to comment.
Something went wrong with that request. Please try again.