_doc->display404(); } protected function _doUserAutocompleteAjax() { $query = Qs_Request::getRequestValue('term'); $this->_displayJson($this->_getDataObj()->getUser4Autocomplete($query)); } protected function _sendGiftCardMail() { $send = $this->_getDataObj()->getData('send'); $this->_getDataObj()->clearData(); $data = $this->_getDataObj()->getData(); if ($send == 'y' && !empty($data)) { $userObj = new App_User_Admin_Obj(); $userObj->setPrimaryKey($data['userId']); $mailData = array( 'cardCode' => $data['cardCode'], 'cardValue' => money_format('%i', $data['cardValue']), 'expirationDate' => date('m/d/Y', strtotime($data['expirationDate'])), 'created' => date('m/d/Y', strtotime($data['added'])), 'firstName' => $userObj->getData('firstName'), 'lastName' => $userObj->getData('lastName'), 'email' => $userObj->getData('email'), ); $mailOptions = array( 'to' => $mailData['email'], 'body' => App_Settings_Obj::get($this->_settingsPrefix . 'Body'), 'subject' => App_Settings_Obj::get($this->_settingsPrefix . 'Subject'), 'from' => App_Settings_Obj::getEmailFrom($this->_settingsPrefix . 'From') ); if (empty($mailOptions['to']) || empty($mailOptions['body'])) { return false; } $placeholders = array(); foreach ($mailData as $field => $value) { $placeholders['{' . $field . '}'] = htmlspecialchars($value); } $mailOptions['body'] = str_replace(array_keys($placeholders), $placeholders, $mailOptions['body']); $this->_sendMail($mailOptions); $this->_setBackMessage($this->getConfig('itemName') . ' has been sent to ' . $mailData['email'] . '' ); $this->_getDataObj()->update(array('statusId' => static::CARD_STATUS_SEND)); } return $this; } protected function _postUpdate() { $this->_sendGiftCardMail(); return parent::_postUpdate(); } protected function _postInsert() { $this->_sendGiftCardMail(); return parent::_postInsert(); } protected function _doGenerateCode() { $this->_doc->display404(); } protected function _doGenerateCodeAjax() { $this->_displayJson(array('code' => $this->_getDataObj()->generateCode())); } }