From d8f5be667076ed3236b69125c1562337cf6f5fd2 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 22 Oct 2018 03:55:15 +0400 Subject: Moodle style fixes Signed-off-by: Valentin Popov --- classes/ui_forms_plugin.php | 52 ++++++++++++++++++++++---------------------- classes/ui_tables_plugin.php | 44 ++++++++++++++++++------------------- 2 files changed, 48 insertions(+), 48 deletions(-) (limited to 'classes') diff --git a/classes/ui_forms_plugin.php b/classes/ui_forms_plugin.php index 2e60b90..dd5d599 100644 --- a/classes/ui_forms_plugin.php +++ b/classes/ui_forms_plugin.php @@ -36,10 +36,10 @@ require_once($CFG->libdir . '/formslib.php'); */ class local_webhooks_service_edit_form extends moodleform { /** - * @param string $base_url + * @param string $baseurl */ - public function __construct($base_url) { - parent::__construct($base_url); + public function __construct($baseurl) { + parent::__construct($baseurl); } /** @@ -48,55 +48,55 @@ class local_webhooks_service_edit_form extends moodleform { * @throws \coding_exception */ protected function definition() { - $m_form =& $this->_form; + $mform =& $this->_form; $size = array('size' => 60); /* Form heading */ - $m_form->addElement('header', 'edit-service-header-main', new lang_string('service', 'webservice')); + $mform->addElement('header', 'edit-service-header-main', new lang_string('service', 'webservice')); /* Name of the service */ - $m_form->addElement('text', 'name', new lang_string('name', 'moodle'), $size); - $m_form->addRule('name', null, 'required'); - $m_form->setType('name', PARAM_RAW); + $mform->addElement('text', 'name', new lang_string('name', 'moodle'), $size); + $mform->addRule('name', null, 'required'); + $mform->setType('name', PARAM_RAW); /* Callback address */ - $m_form->addElement('text', 'point', new lang_string('url', 'moodle'), $size); - $m_form->addRule('point', null, 'required'); - $m_form->setType('point', PARAM_URL); + $mform->addElement('text', 'point', new lang_string('url', 'moodle'), $size); + $mform->addRule('point', null, 'required'); + $mform->setType('point', PARAM_URL); /* Enabling the service */ - $m_form->addElement('advcheckbox', 'status', new lang_string('enable', 'moodle')); - $m_form->setType('status', PARAM_BOOL); - $m_form->setDefault('status', 1); - $m_form->setAdvanced('status'); + $mform->addElement('advcheckbox', 'status', new lang_string('enable', 'moodle')); + $mform->setType('status', PARAM_BOOL); + $mform->setDefault('status', 1); + $mform->setAdvanced('status'); /* Token */ - $m_form->addElement('text', 'token', new lang_string('token', 'webservice'), $size); - $m_form->addRule('token', null, 'required'); - $m_form->setType('token', PARAM_RAW); + $mform->addElement('text', 'token', new lang_string('token', 'webservice'), $size); + $mform->addRule('token', null, 'required'); + $mform->setType('token', PARAM_RAW); /* Content type */ - $content_type = array( + $contenttype = array( 'application/json' => 'application/json', 'application/x-www-form-urlencoded' => 'application/x-www-form-urlencoded', ); - $m_form->addElement('select', 'header', 'Content-Type', $content_type); - $m_form->setAdvanced('header'); + $mform->addElement('select', 'header', 'Content-Type', $contenttype); + $mform->setAdvanced('header'); /* Form heading */ - $m_form->addElement('header', 'edit-service-header-event', new lang_string('edulevel', 'moodle')); + $mform->addElement('header', 'edit-service-header-event', new lang_string('edulevel', 'moodle')); /* List of events */ - $event_list = report_eventlist_list_generator::get_all_events_list(true); + $eventlist = report_eventlist_list_generator::get_all_events_list(true); $events = array(); - foreach ($event_list as $event) { - $events[$event['component']][] =& $m_form->createElement('checkbox', $event['eventname'], $event['eventname']); + foreach ($eventlist as $event) { + $events[$event['component']][] =& $mform->createElement('checkbox', $event['eventname'], $event['eventname']); } foreach ($events as $key => $event) { - $m_form->addGroup($event, 'events', $key, '
', true); + $mform->addGroup($event, 'events', $key, '
', true); } /* Control Panel */ diff --git a/classes/ui_tables_plugin.php b/classes/ui_tables_plugin.php index d08d3db..f65d3fe 100644 --- a/classes/ui_tables_plugin.php +++ b/classes/ui_tables_plugin.php @@ -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); } -- cgit v1.2.3