public function postForm() { $tilmelding = new VIH_Model_LangtKursus_OnlineTilmelding($this->context->name()); if ($this->getForm()->validate()) { if (!$tilmelding->setStatus('tilmeldt')) { throw new Exception('Status kunne ikke sættes'); } if ($this->body('confirm')) { if (!$tilmelding->confirm()) { throw new Exception('Tilmelding ' . $tilmelding->getId() . ' kunne ikke bekr�ftes'); } if ($tilmelding->get('email')) { $historik = new VIH_Model_Historik('langekurser', $tilmelding->get('id')); if (!$tilmelding->sendEmail()) { if (!$historik->save(array('type' => 'kode', 'comment' => 'Bekræftelse på onlinetilmelding kunne ikke sendes'))) { throw new Exception('Historikken kunne ikke gemmes'); } throw new Exception('E-mailen kunne ikke sendes til ordre ' . $tilmelding->getId()); } else { if (!$historik->save(array('type' => 'kode', 'comment' => 'Bekræftelse på onlinetilmelding'))) { throw new Exception('Historikken kunne ikke gemmes'); } } } return new k_SeeOther($this->context->url('kvittering')); } } else { return $this->getForm()->toHTML(); } return $this->render(); }