Namespace changes, outagedb changed to used static methods instead on singleton, utils renamed to outagelib (better name when using the 'use' directive). Issue #1

This commit is contained in:
Daniel Thee Roperto
2016-09-02 11:55:17 +10:00
parent 5f4ea51fcc
commit 2cf9afb5c5
13 changed files with 83 additions and 119 deletions

View File

@@ -23,24 +23,23 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use \auth_outage\outage;
use \auth_outage\outageutils;
use \auth_outage\outagedb;
use \auth_outage\outageform;
use auth_outage\models\outage;
use auth_outage\outagedb;
use auth_outage\outagelib;
require_once('../../config.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->libdir . '/formslib.php');
outageutils::pagesetup();
outagelib::pagesetup();
$mform = new outageform();
$mform = new \auth_outage\forms\outage\edit();
if ($mform->is_cancelled()) {
redirect('/auth/outage/list.php');
} else if ($fromform = $mform->get_data()) {
$fromform = outageutils::parseformdata($fromform);
$fromform = outagelib::parseformdata($fromform);
$outage = new outage($fromform);
$id = outagedb::get()->save($outage);
$id = outagedb::save($outage);
redirect('/auth/outage/list.php#auth_outage_id=' . $id);
}