diff options
author | Valentin Popov <info@valentineus.link> | 2018-03-11 21:31:15 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2018-03-11 21:31:15 +0300 |
commit | 27fe9e412b8135638c9298e38e6fcca3094cc53e (patch) | |
tree | ba42d06bb982cc94d79a11ff2bc7192431db3de9 | |
parent | 9cf4fc575c8790fc0d079f021817d35a7b42de56 (diff) | |
download | local_webhooks-27fe9e412b8135638c9298e38e6fcca3094cc53e.tar.xz local_webhooks-27fe9e412b8135638c9298e38e6fcca3094cc53e.zip |
Fixed table in the latest version of Moodle
Signed-off-by: Valentin Popov <info@valentineus.link>
-rw-r--r-- | classes/webhooks_table.php | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/classes/webhooks_table.php b/classes/webhooks_table.php index 9598e8d..3e97a17 100644 --- a/classes/webhooks_table.php +++ b/classes/webhooks_table.php @@ -24,6 +24,8 @@ defined("MOODLE_INTERNAL") || die(); +require_once(__DIR__ . "/../lib.php"); + require_once($CFG->libdir . "/tablelib.php"); /** @@ -59,10 +61,23 @@ class local_webhooks_table extends table_sql { } /** + * 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; } /** |