diff options
author | Valentin Popov <info@valentineus.link> | 2018-10-22 02:14:31 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2018-10-22 02:48:04 +0300 |
commit | 99c835a63d806874e943273dfb0afa3465fe1d92 (patch) | |
tree | 1df85c1a1d573040ac90fcabe83acbd559ee51fe /classes | |
parent | 14e5a16a338405b6dd7c38916ae362501e0d4ff6 (diff) | |
download | local_webhooks-99c835a63d806874e943273dfb0afa3465fe1d92.tar.xz local_webhooks-99c835a63d806874e943273dfb0afa3465fe1d92.zip |
Correction of implicit style errors
Signed-off-by: Valentin Popov <info@valentineus.link>
Diffstat (limited to 'classes')
-rw-r--r-- | classes/task/process_events_task.php | 9 | ||||
-rw-r--r-- | classes/ui_forms_plugin.php | 56 | ||||
-rw-r--r-- | classes/ui_tables_plugin.php | 48 |
3 files changed, 57 insertions, 56 deletions
diff --git a/classes/task/process_events_task.php b/classes/task/process_events_task.php index 02e54a2..46f5ea5 100644 --- a/classes/task/process_events_task.php +++ b/classes/task/process_events_task.php @@ -24,11 +24,11 @@ namespace local_webhooks\task; +defined('MOODLE_INTERNAL') || die(); + global $CFG; -require_once $CFG->dirroot . '/local/webhooks/lib.php'; - -defined('MOODLE_INTERNAL') || die(); +require_once($CFG->dirroot . '/local/webhooks/lib.php'); /** * Class process_events_task @@ -60,7 +60,8 @@ class process_events_task extends \core\task\adhoc_task { $curl->setHeader(array('Content-Type: ' . $service->header)); $curl->post($service->point, json_encode($event)); - // TODO: Mark the log + // TODO: Mark the log. + $curl->getResponse(); } } diff --git a/classes/ui_forms_plugin.php b/classes/ui_forms_plugin.php index 6c9a070..2e60b90 100644 --- a/classes/ui_forms_plugin.php +++ b/classes/ui_forms_plugin.php @@ -24,8 +24,8 @@ defined('MOODLE_INTERNAL') || die(); -require_once $CFG->dirroot . '/local/webhooks/lib.php'; -require_once $CFG->libdir . '/formslib.php'; +require_once($CFG->dirroot . '/local/webhooks/lib.php'); +require_once($CFG->libdir . '/formslib.php'); /** * Description editing form definition. @@ -36,10 +36,10 @@ require_once $CFG->libdir . '/formslib.php'; */ class local_webhooks_service_edit_form extends moodleform { /** - * @param string $baseUrl + * @param string $base_url */ - public function __construct($baseUrl) { - parent::__construct($baseUrl); + public function __construct($base_url) { + parent::__construct($base_url); } /** @@ -48,55 +48,55 @@ class local_webhooks_service_edit_form extends moodleform { * @throws \coding_exception */ protected function definition() { - $mForm =& $this->_form; + $m_form =& $this->_form; $size = array('size' => 60); /* Form heading */ - $mForm->addElement('header', 'editserviceheadermain', new lang_string('service', 'webservice')); + $m_form->addElement('header', 'edit-service-header-main', new lang_string('service', 'webservice')); /* Name of the service */ - $mForm->addElement('text', 'name', new lang_string('name', 'moodle'), $size); - $mForm->addRule('name', null, 'required'); - $mForm->setType('name', PARAM_RAW); + $m_form->addElement('text', 'name', new lang_string('name', 'moodle'), $size); + $m_form->addRule('name', null, 'required'); + $m_form->setType('name', PARAM_RAW); /* Callback address */ - $mForm->addElement('text', 'point', new lang_string('url', 'moodle'), $size); - $mForm->addRule('point', null, 'required'); - $mForm->setType('point', PARAM_URL); + $m_form->addElement('text', 'point', new lang_string('url', 'moodle'), $size); + $m_form->addRule('point', null, 'required'); + $m_form->setType('point', PARAM_URL); /* Enabling the service */ - $mForm->addElement('advcheckbox', 'status', new lang_string('enable', 'moodle')); - $mForm->setType('status', PARAM_BOOL); - $mForm->setDefault('status', 1); - $mForm->setAdvanced('status'); + $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'); /* Token */ - $mForm->addElement('text', 'token', new lang_string('token', 'webservice'), $size); - $mForm->addRule('token', null, 'required'); - $mForm->setType('token', PARAM_RAW); + $m_form->addElement('text', 'token', new lang_string('token', 'webservice'), $size); + $m_form->addRule('token', null, 'required'); + $m_form->setType('token', PARAM_RAW); /* Content type */ - $contentType = array( + $content_type = array( 'application/json' => 'application/json', 'application/x-www-form-urlencoded' => 'application/x-www-form-urlencoded', ); - $mForm->addElement('select', 'header', 'Content-Type', $contentType); - $mForm->setAdvanced('header'); + $m_form->addElement('select', 'header', 'Content-Type', $content_type); + $m_form->setAdvanced('header'); /* Form heading */ - $mForm->addElement('header', 'editserviceheaderevent', new lang_string('edulevel', 'moodle')); + $m_form->addElement('header', 'edit-service-header-event', new lang_string('edulevel', 'moodle')); /* List of events */ - $eventList = report_eventlist_list_generator::get_all_events_list(true); + $event_list = report_eventlist_list_generator::get_all_events_list(true); $events = array(); - foreach ($eventList as $event) { - $events[$event['component']][] =& $mForm->createElement('checkbox', $event['eventname'], $event['eventname']); + foreach ($event_list as $event) { + $events[$event['component']][] =& $m_form->createElement('checkbox', $event['eventname'], $event['eventname']); } foreach ($events as $key => $event) { - $mForm->addGroup($event, 'events', $key, '<br />', true); + $m_form->addGroup($event, 'events', $key, '<br />', true); } /* Control Panel */ diff --git a/classes/ui_tables_plugin.php b/classes/ui_tables_plugin.php index ecc0c52..d08d3db 100644 --- a/classes/ui_tables_plugin.php +++ b/classes/ui_tables_plugin.php @@ -24,8 +24,8 @@ defined('MOODLE_INTERNAL') || die(); -require_once $CFG->dirroot . '/local/webhooks/lib.php'; -require_once $CFG->libdir . '/tablelib.php'; +require_once($CFG->dirroot . '/local/webhooks/lib.php'); +require_once($CFG->libdir . '/tablelib.php'); /** * Display the list of services table. @@ -36,24 +36,24 @@ require_once $CFG->libdir . '/tablelib.php'; */ class local_webhooks_services_table extends table_sql { /** - * @var string $mainPage + * @var string $main_page */ - protected static $mainPage = '/local/webhooks/index.php'; + protected static $main_page = '/local/webhooks/index.php'; /** - * @var string $editorPage + * @var string $editor_page */ - protected static $editorPage = '/local/webhooks/service.php'; + protected static $editor_page = '/local/webhooks/service.php'; /** * Constructor. * - * @param string $uniqueId + * @param string $unique_id * * @throws \coding_exception */ - public function __construct($uniqueId = '') { - parent::__construct($uniqueId); + public function __construct($unique_id = '') { + parent::__construct($unique_id); $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 $pageSize - * @param boolean $useInitialsBar + * @param int $page_size + * @param boolean $use_initials_bar * * @throws \dml_exception */ - public function query_db($pageSize = 0, $useInitialsBar = false) { + public function query_db($page_size = 0, $use_initials_bar = 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; - $hideShowIcon = 't/show'; - $hideShowString = new lang_string('enable', 'moodle'); + $hide_show_icon = 't/show'; + $hide_show_string = new lang_string('enable', 'moodle'); if (!empty($row->status)) { - $hideShowIcon = 't/hide'; - $hideShowString = new lang_string('disable', 'moodle'); + $hide_show_icon = 't/hide'; + $hide_show_string = new lang_string('disable', 'moodle'); } /* Link for activation / deactivation */ - $hideShowLink = new moodle_url(self::$mainPage, array('hideshowid' => $row->id, 'sesskey' => sesskey())); - $hideShowItem = $OUTPUT->action_icon($hideShowLink, new pix_icon($hideShowIcon, $hideShowString)); + $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)); /* Link for editing */ - $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'))); + $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'))); /* Link to remove */ - $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'))); + $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'))); - return $hideShowItem . $editItem . $deleteItem; + return $hide_show_item . $edit_item . $delete_item; } /** @@ -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::$editorPage, array('serviceid' => $row->id, 'sesskey' => sesskey())); + $link = new moodle_url(self::$editor_page, array('serviceid' => $row->id, 'sesskey' => sesskey())); return html_writer::link($link, $row->name); } |