/** * IS: Parameter name, email, subject terdeklarasi * FS: Mengirimkan ke viewer: success * Desc: Fungsi untuk melakukan mengirimkan email kepada administrator dan * melakukan penyimpanan data di tabel Contact * * @param Zend_Request $request */ private function _sendMessage($request) { // Model $contactSubject = new Model_DbTable_ContactSubject(); $contactDb = new Model_DbTable_Contact(); // Data $fromName = $this->_getParam('name'); $fromEmail = $this->_getParam('email'); $subject = '[Budaya Indonesia] New comment with topic: ' . $contactSubject->getNameById($this->_getParam('subject')); if (APPLICATION_ENV == 'development') { $to = array('*****@*****.**'); } // Jika email tidak diblacklist //$sendEmail = parent::_sendEmail($msg, $fromName, $fromEmail, $subject, $to); $contactDb->insertContact($request->getPost()); $this->view->success = true; // if ($sendEmail) { // Masukkan data ke tabel // } }
/** * IS: Parameter realname, email terdeklarasi * FS: Mengirimkan ke viewer: registerSuccess * Desc: Fungsi untuk melakukan proses registrasi seperti memasukkan data user * baru dan pengiriman email aktivasi * * @param Zend_Request $request */ private function _register($request) { // Model $userModel = new Model_User(); // Data $activationKey = mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand(); $activationMsg = $userModel->getActivationMessage($this->view->baseUrl(), $this->_getParam('realname'), $this->_getParam('email'), $activationKey); // Send Email $fromName = 'Visit Indonesia'; $fromEmail = '*****@*****.**'; $subject = 'Activation Required'; $sendEmail = parent::_sendEmail($activationMsg, $fromName, $fromEmail, $subject, $this->_getParam('email')); if ($sendEmail) { // Model $userDb = new Model_DbTable_User(); // Data insert $userDb->insertUser($request->getPost(), $activationKey); // View $this->view->registerSuccess = true; } }