From 4f34a6db0f139370544730f539ff981124441f4b Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Oct 2017 17:41:16 +0400 Subject: Refactoring the class displaying the form of the editor --- classes/forms.php | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) (limited to 'classes/forms.php') diff --git a/classes/forms.php b/classes/forms.php index 6fb9972..2e38e70 100644 --- a/classes/forms.php +++ b/classes/forms.php @@ -63,46 +63,34 @@ class service_edit_form extends moodleform { $mform =& $this->_form; /* Form heading */ - $mform->addElement("header", "editserviceheader", - new lang_string("service", "webservice")); + $mform->addElement("header", "editserviceheader", new lang_string("service", "webservice")); /* Name of the service */ - $mform->addElement("text", "title", - new lang_string("name", "moodle"), - array("size" => 60)); - $mform->setType("title", PARAM_NOTAGS); + $mform->addElement("text", "title", new lang_string("name", "moodle"), array("size" => 60)); $mform->addRule("title", null, "required"); + $mform->setType("title", PARAM_NOTAGS); /* Callback address */ - $mform->addElement("text", "url", - new lang_string("url", "moodle"), - array("size" => 60)); - $mform->setType("url", PARAM_URL); + $mform->addElement("text", "url", new lang_string("url", "moodle"), array("size" => 60)); $mform->addRule("url", null, "required"); + $mform->setType("url", PARAM_URL); /* Enabling the service */ - $mform->addElement("advcheckbox", "enable", - new lang_string("enable", "moodle")); + $mform->addElement("advcheckbox", "enable", new lang_string("enable", "moodle")); $mform->setType("enable", PARAM_BOOL); $mform->setDefault("enable", 1); $mform->setAdvanced("enable"); /* Token */ - $mform->addElement("text", "token", - new lang_string("token", "webservice"), - array("size" => 60)); + $mform->addElement("text", "token", new lang_string("token", "webservice"), array("size" => 60)); $mform->setType("token", PARAM_NOTAGS); /* Content type */ - $mform->addElement("select", "type", "Content type", - array( - "json" => "application/json", - "x-www-form-urlencoded" => "application/x-www-form-urlencoded")); + $mform->addElement("select", "type", "Content type", array("json" => "application/json", "x-www-form-urlencoded" => "application/x-www-form-urlencoded")); $mform->setAdvanced("type"); /* Form heading */ - $mform->addElement("header", "editserviceheaderevent", - new lang_string("edulevel", "moodle")); + $mform->addElement("header", "editserviceheaderevent", new lang_string("edulevel", "moodle")); /* List of events */ $eventlist = report_eventlist_list_generator::get_all_events_list(true); @@ -110,8 +98,7 @@ class service_edit_form extends moodleform { /* Formation of the list of elements */ foreach ($eventlist as $event) { - $events[$event["component"]][] =& - $mform->createElement("checkbox", $event["eventname"], $event["eventname"]); + $events[$event["component"]][] =& $mform->createElement("checkbox", $event["eventname"], $event["eventname"]); } /* Displays groups of items */ -- cgit v1.2.3