Moodle style fixes

Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
2018-10-22 03:55:15 +04:00
parent 99c835a63d
commit d8f5be6670
6 changed files with 124 additions and 124 deletions

View File

@ -36,24 +36,24 @@ require_once($CFG->libdir . '/tablelib.php');
*/
class local_webhooks_services_table extends table_sql {
/**
* @var string $main_page
* @var string $mainpage
*/
protected static $main_page = '/local/webhooks/index.php';
protected static $mainpage = '/local/webhooks/index.php';
/**
* @var string $editor_page
* @var string $editorpage
*/
protected static $editor_page = '/local/webhooks/service.php';
protected static $editorpage = '/local/webhooks/service.php';
/**
* Constructor.
*
* @param string $unique_id
* @param string $uniqueid
*
* @throws \coding_exception
*/
public function __construct($unique_id = '') {
parent::__construct($unique_id);
public function __construct($uniqueid = '') {
parent::__construct($uniqueid);
$this->define_table_columns();
$this->define_table_configs();
}
@ -61,12 +61,12 @@ class local_webhooks_services_table extends table_sql {
/**
* Query the database for results to display in the table.
*
* @param int $page_size
* @param boolean $use_initials_bar
* @param int $pagesize
* @param boolean $useinitialsbar
*
* @throws \dml_exception
*/
public function query_db($page_size = 0, $use_initials_bar = false) {
public function query_db($pagesize = 0, $useinitialsbar = false) {
$this->rawdata = local_webhooks_api::get_services(array(), $this->get_page_start(), $this->get_page_size());
}
@ -116,27 +116,27 @@ class local_webhooks_services_table extends table_sql {
public function col_actions($row) {
global $OUTPUT;
$hide_show_icon = 't/show';
$hide_show_string = new lang_string('enable', 'moodle');
$hideshowicon = 't/show';
$hideshowstring = new lang_string('enable', 'moodle');
if (!empty($row->status)) {
$hide_show_icon = 't/hide';
$hide_show_string = new lang_string('disable', 'moodle');
$hideshowicon = 't/hide';
$hideshowstring = new lang_string('disable', 'moodle');
}
/* Link for activation / deactivation */
$hide_show_link = new moodle_url(self::$main_page, array('hideshowid' => $row->id, 'sesskey' => sesskey()));
$hide_show_item = $OUTPUT->action_icon($hide_show_link, new pix_icon($hide_show_icon, $hide_show_string));
$hideshowlink = new moodle_url(self::$mainpage, array('hideshowid' => $row->id, 'sesskey' => sesskey()));
$hideshowitem = $OUTPUT->action_icon($hideshowlink, new pix_icon($hideshowicon, $hideshowstring));
/* Link for editing */
$edit_link = new moodle_url(self::$editor_page, array('serviceid' => $row->id, 'sesskey' => sesskey()));
$edit_item = $OUTPUT->action_icon($edit_link, new pix_icon('t/edit', new lang_string('edit', 'moodle')));
$editlink = new moodle_url(self::$editorpage, array('serviceid' => $row->id, 'sesskey' => sesskey()));
$edititem = $OUTPUT->action_icon($editlink, new pix_icon('t/edit', new lang_string('edit', 'moodle')));
/* Link to remove */
$delete_link = new moodle_url(self::$main_page, array('deleteid' => $row->id, 'sesskey' => sesskey()));
$delete_item = $OUTPUT->action_icon($delete_link, new pix_icon('t/delete', new lang_string('delete', 'moodle')));
$deletelink = new moodle_url(self::$mainpage, array('deleteid' => $row->id, 'sesskey' => sesskey()));
$deleteitem = $OUTPUT->action_icon($deletelink, new pix_icon('t/delete', new lang_string('delete', 'moodle')));
return $hide_show_item . $edit_item . $delete_item;
return $hideshowitem . $edititem . $deleteitem;
}
/**
@ -159,7 +159,7 @@ class local_webhooks_services_table extends table_sql {
* @throws \moodle_exception
*/
public function col_name($row) {
$link = new moodle_url(self::$editor_page, array('serviceid' => $row->id, 'sesskey' => sesskey()));
$link = new moodle_url(self::$editorpage, array('serviceid' => $row->id, 'sesskey' => sesskey()));
return html_writer::link($link, $row->name);
}