private function onAdd() { $form = $this->formAdd(); if (false !== ($error = $form->validate($this->module))) { return $error . $this->templateAdd(); } $termin = new Konzert_Termin(array('kt_id' => 0, 'kt_date' => $form->getVar('date'), 'kt_time' => $form->getVar('time'), 'kt_city' => $form->getVar('city'), 'kt_prog' => $form->getVar('prog'), 'kt_tickets' => $form->getVar('tickets'), 'kt_location' => $form->getVar('location'), 'kt_options' => Konzert_Termin::ENABLED)); if (false === $termin->insert()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)) . $this->templateAdd(); } return $this->module->message('msg_t_added'); }
private function formEdit(Konzert_Termin $termin) { $data = array(); $data['date'] = array(GWF_Form::DATE_FUTURE, $termin->getVar('kt_date'), $this->module->lang('th_date'), '', GWF_Date::LEN_DAY); $data['time'] = array(GWF_Form::TIME, $termin->getVar('kt_time'), $this->module->lang('th_time')); $data['prog'] = array(GWF_Form::STRING, $termin->getVar('kt_prog'), $this->module->lang('th_prog')); $data['city'] = array(GWF_Form::STRING, $termin->getVar('kt_city'), $this->module->lang('th_city')); $data['location'] = array(GWF_Form::STRING, $termin->getVar('kt_location'), $this->module->lang('th_location')); $data['tickets'] = array(GWF_Form::STRING, $termin->getVar('kt_tickets'), $this->module->lang('th_tickets')); $data['enabled'] = array(GWF_Form::CHECKBOX, $termin->isEnabled(), $this->module->lang('th_enabled')); $data['edit'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_edit')); return new GWF_Form($this, $data); }