luser->get_mailing($this->id); $form = new Nette\Application\UI\Form; # $form->addText('subject', "Subject"); $form->addTextArea('body', 'body', 80, 30) ->setAttribute('class', 'mceEditor') ->setDefaultValue($mailing->body); $form->addUpload('attachments', "Attachments", true); $form->addSubmit('save', "Save and continue"); $form->addSubmit('skip', "Skip for now") ->setValidationScope(false); $form->addProtection("protection token expired"); $form->onSuccess[] = [$this, 'BodyFormOK']; return $form; } public function BodyFormOK(Nette\Application\UI\Form $form, $values = '') { $values = $form->values; if($form['save']->submittedBy) { $mailing = $this->luser->get_mailing($this->id); $mailing->body = $values['body']; if (count($values['attachments'])>0) { $results = $mailing->addAttachments($values['attachments']); foreach($results as $result) { $this->FlashMessage($result); } } } $this->redirect(':User:Mailing:'); } public function renderDefault($id) { $luser = $this->luser; $this->template->mailing = $luser->get_mailing($id); } }