public function actionIndex() { $success = false; $model = new EmailForm(); if (!empty($_POST['EmailForm'])) { $model->setAttributes($_POST['EmailForm']); if ($model->validate()) { $success = true; // handle form here } } $this->render('index', array('model' => $model, 'success' => $success)); }
function wfSpecialEmail() { global $wgRequest; $f = new EmailForm($wgRequest); $f->execute(); }
// monta o texto a ser exibido $output = "Nome: {$data->nome}\n"; $output .= "Email: {$data->email}\n"; $output .= "Título: {$data->titulo}\n"; $output .= "Mensagem: \n{$data->mensagem}"; // cria um objeto de texto $text = new TText('texto', 300); $text->setSize(290, 120); $text->setValue($output); // adiciona o objeto à janela $window->add($text); $window->show(); } /* * função onSend * exibe mensagem "Enviando dados..." */ function onSend() { // obtém os dados do formulário $data = $this->form->getData(); // atribui os dados de volta ao formulário $this->form->setData($data); // torna o formulário não-editável $this->form->setEditable(FALSE); // exibe mensagem ao usuário new TMessage('info', 'Enviando dados...'); } } $page = new EmailForm(); $page->show();
private function shareTree() { global $wrHostName, $wgLang, $wgUser, $IP; $link = 'http://' . $wrHostName . '/fte/index.php?userName='******'&treeName=' . urlencode($this->name); $primaryPage = $this->getPrimaryPage(); if ($primaryPage) { $link .= '&page=' . urlencode($primaryPage->getPrefixedText()); } $subject = wfMsg('sharetreesubject'); $text = wfMsg('sharetreetext', $link); $request = new FauxRequest(array('returnto' => $wgLang->specialPage('FamilyTree'), 'wpSubject' => $subject, 'wpText' => $text)); require_once "{$IP}/extensions/other/SpecialEmail.php"; $form = new EmailForm($request); $form->execute(); }