public function run() { if (($mannschaft = Gateway_Base::factory('mannschaft')->findOne($_REQUEST['Id'])) === false) { $mannschaft = new Mannschaft(); } $GLOBALS['Smarty']->assign('Mannschaft', $mannschaft); }
public function update($person) { if (is_null($person->id) && is_null($person->person->id)) { throw new Error('Keine ID angegeben!'); } $id = $person->id; $old = $this->findOne($id); if (!$old) { throw new Error("Person mit der ID '" . $id . "' nicht gefunden!"); } foreach ($person->person as $key => $value) { if (!($key == 'id')) { $old->person->{$key} = $value; } } $doc = json_encode($old->person); return parent::update('people', $id, $doc); }
/** * Deletes a person by id * * @url DELETE /$id */ public function deletePerson($id = null) { // TODO: param check $result = Gateway_Base::factory('people')->delete($id); if ($result === false) { http_response_code(403); } return ["result" => $result]; }
public function Authenticate($username, $password) { // Default: Authentication through DB // implement other methods here return Gateway_Base::factory('user')->authenticate($username, $password); }