'doNew', 'insert' => 'doInsert', 'thanks' => 'doThanks', ); /** * @var Member */ var $DBObj; protected $_templatePath; protected $_emailOptions = array(); function exec(&$Doc) { $this->Doc = $Doc; $this->DBObj = new Member(); parent::exec(); } function setFormTitle() { return false; } function doInsert() { $form = $this->_getNewForm(); if ($form->validate()) { $data = $form->exportValues(); require_once('app/Member/MemberAuth.php'); $data['member'] = MemberAuth::getSessionData(); $this->_sendEmailNotification($data); $this->redirect(BASE_URL . '/' . CURR_PAGE_FULL . '?action=thanks'); } else { $form->exec(); } return true; } protected function _sendEmailNotification($data) { Constant::set('DEBUG', false); $this->Doc->assign('item', $data); $this->Doc->setMainTpl($this->_templatePath . '/email.tpl'); require_once('app/Settings/Settings.php'); $from = Settings::get('admin_email_from'); $html = $this->Doc->fetch(); $subject = Qs_Array::get($this->_emailOptions, 'subject'); $to = Settings::getAdminEmails(); return $this->_sendMail(compact('subject', 'from', 'html', 'to')); } function doThanks() { $item = array( 'tpl' => BASE_PATH . '/tpl/' . $this->_templatePath . '/thanks.tpl' ); $this->Doc->addContent($item); require_once('class/Const.php'); Constant::set('DEBUG', false); } }