function add() { // Is logged in? $this->session = new Session(); if (!$this->session->get('email') && !$this->session->get('id')) { die(redirect('')); } $r = new Realm(); $r = $r->find_all(); $ml = new Mon_log(); $ml = $ml->find_all(); $rids = array(); foreach ($r as $realm) { $rids[$realm->id] = $realm->org_name; } $mls = array(); foreach ($ml as $m) { $mls[$m->id] = $m->ts_scheduled; } if ($_POST["action"] == "addmonrealm") { $data = $_POST; unset($data["action"]); unset($data["addmonrealm"]); $data["ts"] = date("c"); // Let's store directly ISO 860 timestamps $m = new Mon_realm($data); $m->save(); } pass_var("rids", $rids); pass_var("mls", $mls); pass_var('title', "Add Monitor Realm"); pass_var('message', "Add Monitor Realm"); }