Fixed table in the latest version of Moodle
Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
parent
9cf4fc575c
commit
27fe9e412b
@ -24,6 +24,8 @@
|
||||
|
||||
defined("MOODLE_INTERNAL") || die();
|
||||
|
||||
require_once(__DIR__ . "/../lib.php");
|
||||
|
||||
require_once($CFG->libdir . "/tablelib.php");
|
||||
|
||||
/**
|
||||
@ -58,11 +60,24 @@ class local_webhooks_table extends table_sql {
|
||||
$this->define_table_configs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the database for results to display in the table.
|
||||
*
|
||||
* @param number $pagesize
|
||||
* @param boolean $useinitialsbar
|
||||
*/
|
||||
public function query_db($pagesize, $useinitialsbar = false) {
|
||||
$listrecords = local_webhooks_get_list_records();
|
||||
$total = count($listrecords);
|
||||
|
||||
$this->pagesize($pagesize, $total);
|
||||
$this->rawdata = local_webhooks_get_list_records($this->get_page_start(), $this->get_page_size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the basic settings of the table.
|
||||
*/
|
||||
public function define_table_configs() {
|
||||
$this->set_sql("*", "{local_webhooks_service}", "1");
|
||||
$this->collapsible(false);
|
||||
$this->is_downloadable(false);
|
||||
$this->no_sorting("actions");
|
||||
@ -124,11 +139,16 @@ class local_webhooks_table extends table_sql {
|
||||
* Specifies the display of a column with events.
|
||||
*
|
||||
* @param object $row Data from the database.
|
||||
* @return string Displayed data.
|
||||
* @return number Displayed data.
|
||||
*/
|
||||
public function col_events($row) {
|
||||
$eventlist = local_webhooks_deserialization_data($row->events);
|
||||
return count($eventlist);
|
||||
$result = 0;
|
||||
|
||||
if (!empty($row->events)) {
|
||||
$result = count($row->events);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user