本文整理汇总了PHP中Zend_Controller_Request_Http::getCookie方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Http::getCookie方法的具体用法?PHP Zend_Controller_Request_Http::getCookie怎么用?PHP Zend_Controller_Request_Http::getCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Http
的用法示例。
在下文中一共展示了Zend_Controller_Request_Http::getCookie方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: captcha
public function captcha()
{
$request = new Zend_Controller_Request_Http();
$cookie = (int) $request->getCookie('sicaeuser');
if ($cookie >= 3) {
return '<div class="control-group">
<div class="controls captcha-img" style="text-align: center; border: 1px solid; width:285px;">
<img id="captcha" src="/usuario/captcha" alt="CAPTCHA Image" />
</div>
<div class="controls captcha-button">
<button title="Atualizar Imagem" class="btn btn-small" type="button" onclick="document.getElementById(\'captcha\').src = \'/usuario/captcha/id/\' + Math.random(); return false;">
<i class="icon-refresh"></i>
</button>
<object title="Ouvir" align="top" width="33" height="26" id="SecurImage_as3" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">
<param title="Ouvir" value="sameDomain" name="allowScriptAccess" />
<param title="Ouvir" value="false" name="allowFullScreen" />
<param title="Ouvir" value="/captcha/swf/securimage_play.swf?audio=/usuario/captcha-audio/&bgColor1=#f4f4f4&bgColor2=#f4f4f4&iconColor=#000&roundedCorner=4&borderWidth=1&borderColor=#d2d2d2" name="movie" />
<param title="Ouvir" value="high" name="quality" />
<param title="Ouvir" value="#f4f4f4" name="bgcolor" />
<embed title="Ouvir" align="" width="33" height="26" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowfullscreen="false" allowscriptaccess="sameDomain" name="SecurImage_as3" bgcolor="#ffffff" quality="high" src="/captcha/swf/securimage_play.swf?audio=/usuario/captcha-audio/&bgColor1=#f4f4f4&bgColor2=#f4f4f4&iconColor=#000&roundedCorner=4&borderWidth=1&borderColor=#d2d2d2" />
</object>
</div>
</div>
<div class="control-group">
<label class="control-label" for=captcha_code>* Código de segurança</label>
<div class="controls">
<input type="text" id="captcha_code" name="captcha_code" class="input-xlarge required" maxlength="7" />
</div>
</div>
';
}
}
示例2: testGetCookie
public function testGetCookie()
{
$_COOKIE['foo'] = 'bar';
$this->assertSame('bar', $this->_request->getCookie('foo'));
$this->assertEquals('foo', $this->_request->getCookie('BAR', 'foo'));
$this->assertEquals($_COOKIE, $this->_request->getCookie());
}
示例3: getCookie
/**
* @access public
* @param string $key Key to search for in $_COOKIE
* @param mixed $default Default value if $key is not found in $_COOKIE
* @param integer $filter Filter definition
* @param array $options Filter configuration
* @return mixed
*/
public function getCookie($key = null, $default = null, $filter = null, array $options = null)
{
$value = parent::getCookie($key, $default);
if ($filter !== null || $options !== null) {
$value = $this->_filter($value, $default, $filter, $options);
}
return $value;
}
示例4: _initLayout
protected function _initLayout()
{
$layout = Zend_Layout::startMvc();
Zend_Controller_Front::getInstance()->registerPlugin(new Module_LayoutPlugin());
$http = new Zend_Controller_Request_Http();
$viewSession = $http->getCookie('viewsite');
if (empty($viewSession)) {
Gravi_Service_ImochatService::SaveSiteView();
setcookie('viewsite', 'true', time() + 60 * 60, '/');
}
}
示例5: templateHook
public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
$modernStatisticModel = XenForo_Model::create('Brivium_ModernStatistic_Model_ModernStatistic');
if (is_null(self::$_dismissed)) {
self::$_dismissed = true;
if (!$modernStatisticModel->checkExclude()) {
self::$_dismissed = false;
}
}
if (!self::$_dismissed) {
$options = XenForo_Application::get('options');
$position = $options->BRMS_position;
if ($position != 'other') {
if ($hookName == $position) {
$ourTemplate = $template->create('BRMS_ModernStatistic', $template->getParams());
$contents .= $ourTemplate->render();
}
}
if ($options->BRMS_loadFirstTab) {
switch ($hookName) {
case 'brms_modern_statistic_first_tabs':
if (!empty($options->BRMS_tabsSelector)) {
$tabId = -1;
$xenAddons = XenForo_Application::get('addOns');
$userId = XenForo_Visitor::getUserId();
foreach ($options->BRMS_tabsSelector as $key => $tab) {
if (!empty($tab['active']) && ($tab['kind'] != 'resource' || $modernStatisticModel->checkXenForoResourceAddon()) && ($tab['type'] != 'my_threads' || !empty($userId))) {
$tabId = $key;
break;
}
}
if ($tabId != -1) {
$limit = 0;
$limitOptions = $options->BRMS_itemLimit;
if (!empty($limitOptions['enabled'])) {
$request = new Zend_Controller_Request_Http();
$limit = $request->getCookie('brmsNumberEntry');
}
$viewParams = $modernStatisticModel->getStatistics($tabId, $limit ? $limit : 0);
$newTemplate = $template->create($viewParams['template'], $template->getParams());
$newTemplate->setParams($viewParams);
$contents = $newTemplate->render();
}
}
break;
}
}
}
// NO!
self::_templateHook($hookName, $contents, $hookParams, $template);
}
示例6: visitorSetup
public static function visitorSetup(XenForo_Visitor &$visitor)
{
$options = XenForo_Application::get('options');
$locations = $options->BRTC_locations;
if (empty($locations) || !is_array($locations)) {
$locations = array();
}
$localtion = '';
if ($visitor['user_id'] && !empty($visitor['location'])) {
$localtion = $visitor['location'];
} else {
$cookiePrefix = XenForo_Application::get('config')->cookie->prefix;
$request = new Zend_Controller_Request_Http();
$localtion = $request->getCookie($cookiePrefix . 'location');
//prd($localtion);
}
if (!isset($locations[$localtion]) || !$localtion) {
$localtion = '';
}
$visitor['location'] = $localtion;
}
示例7: shouldShowNews
/**
* Tells whether shows news to user
* @return bool
*/
public function shouldShowNews()
{
return time() < $this->_newsTo && $this->_appVersion != $this->_request->getCookie($this->getNewsCookieName());
}
示例8: getPublicSession
/**
* This simply gets public session, from cookies if necessary.
*
* @param Zend_Controller_Request_Http $request
*
* @return XenForo_Session
*/
public static function getPublicSession(Zend_Controller_Request_Http $request)
{
$class = XenForo_Application::resolveDynamicClass('XenForo_Session');
/** @var $session XenForo_Session */
$session = new $class();
$session->start();
if (!$session->sessionExists()) {
$cookiePrefix = XenForo_Application::get('config')->cookie->prefix;
$userCookie = $request->getCookie($cookiePrefix . 'user');
if ($userCookie) {
/** @var $userModel XenForo_Model_User */
$userModel = XenForo_Model::create('XenForo_Model_User');
if ($userId = $userModel->loginUserByRememberCookie($userCookie)) {
$user = $userModel->getUserById($userId, array('join' => XenForo_Model_User::FETCH_USER_FULL));
$userModel->setUserRememberCookie($user['user_id']);
$session->userLogin($user['user_id'], $user['password_date']);
} else {
XenForo_Helper_Cookie::deleteCookie('user', true);
}
}
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
$session->set('userAgent', $_SERVER['HTTP_USER_AGENT']);
$session->set('robotId', $session->getRobotId($_SERVER['HTTP_USER_AGENT']));
}
if (!empty($_SERVER['HTTP_REFERER'])) {
$session->set('referer', $_SERVER['HTTP_REFERER']);
$session->set('fromSearch', $session->isSearchReferer($_SERVER['HTTP_REFERER']));
}
}
return $session;
}
示例9: renderModernStatistics
public function renderModernStatistics($modernStatisticIds, $loadedTemplates, $templateParams, XenForo_Template_Abstract $template)
{
$renderedContents = '';
$statisticObj = XenForo_Application::get('brmsModernStatistics');
$request = new Zend_Controller_Request_Http();
$visitor = XenForo_Visitor::getInstance()->toArray();
$userId = $visitor['user_id'];
$visitorPerferences = !empty($visitor['brms_statistic_perferences']) ? @unserialize($visitor['brms_statistic_perferences']) : array();
foreach ($modernStatisticIds as $modernStatisticId) {
$modernStatistic = $statisticObj->{$modernStatisticId};
if (!empty($modernStatistic['active'])) {
if (!empty($modernStatistic['allow_user_setting']) && !empty($visitorPerferences[$modernStatisticId])) {
continue;
}
if (!empty($modernStatistic['modernCriteria']) && !$this->validateStatisticCriteria($modernStatistic['modernCriteria'], $loadedTemplates, $templateParams)) {
$renderedContents .= '';
continue;
}
$rendered = false;
if (!empty($modernStatistic['enable_cache']) && !empty($modernStatistic['cache_time'])) {
$cacheTime = max(1, $modernStatistic['cache_time']);
$lastUpdate = XenForo_Application::$time - $cacheTime * 60;
$cachedStatistic = $this->getModernCacheDataForUserId($modernStatisticId, $userId, $lastUpdate);
if (!empty($cachedStatistic['cache_html'])) {
if (isset($templateParams['visitorStyle']['style_id'])) {
$styleId = $templateParams['visitorStyle']['style_id'];
if (!empty($modernStatistic['styleSettings']) && !empty($modernStatistic['styleSettings'][$styleId])) {
if ($modernStatistic['styleSettings'][$styleId] == 'dark') {
if (!strpos($cachedStatistic['cache_html'], 'BRMSContainerDark')) {
$cachedStatistic['cache_html'] = str_replace('BRMSContainer', 'BRMSContainer BRMSContainerDark', $cachedStatistic['cache_html']);
}
} else {
$cachedStatistic['cache_html'] = str_replace('BRMSContainerDark', '', $cachedStatistic['cache_html']);
}
}
}
$renderedContents .= $cachedStatistic['cache_html'];
$rendered = true;
}
}
if (!$rendered) {
$newTemplate = $template->create('BRMS_ModernStatistic', $template->getParams());
$tabCacheHtmls = array();
$tabCacheParams = array();
if (!empty($modernStatistic['load_fisrt_tab']) && !empty($modernStatistic['tabData'])) {
$tabId = -1;
foreach ($modernStatistic['tabData'] as $key => $tab) {
if ($tab['type'] != 'my_threads' || !empty($userId)) {
$tabId = $key;
break;
}
}
if ($tabId != -1) {
if (!empty($modernStatistic['itemLimit']['enabled'])) {
$limit = $request->getCookie('brmsNumberEntry' . $modernStatisticId);
}
$firstTabParams = $this->getStatisticTabParams($modernStatisticId, $tabId, $userId, $limit, false);
if (!empty($firstTabParams['tabParams'])) {
$firstTabTemplate = $template->create($firstTabParams['template'], $template->getParams());
$firstTabTemplate->setParams($firstTabParams['tabParams']);
$firstTabTemplate->setParam('modernStatistic', $modernStatistic);
$firstTabHtml = $firstTabTemplate->render();
$tabCacheHtmls[$tabId] = $firstTabHtml;
$tabCacheParams[$tabId] = $firstTabParams['tabParams'];
$newTemplate->setParam('firstTabHtml', $firstTabHtml);
}
}
}
$templateParams = $template->getParams();
if (!empty($modernStatistic['style_display']) && $modernStatistic['style_display'] == 'dark') {
$modernStatistic['displayStyle'] = 'BRMSContainerDark';
}
if (isset($templateParams['visitorStyle']['style_id'])) {
$styleId = $templateParams['visitorStyle']['style_id'];
if (!empty($modernStatistic['styleSettings']) && !empty($modernStatistic['styleSettings'][$styleId])) {
if ($modernStatistic['styleSettings'][$styleId] == 'dark') {
$modernStatistic['displayStyle'] = 'BRMSContainerDark';
} else {
$modernStatistic['displayStyle'] = '';
}
}
}
$newTemplate->setParam('modernStatistic', $modernStatistic);
$modernHtml = $newTemplate->render();
if (!empty($modernStatistic['enable_cache'])) {
$this->saveCacheForStatistic($modernStatisticId, $userId, $modernHtml, $modernStatistic, $tabCacheHtmls, $tabCacheParams);
}
$renderedContents .= $modernHtml;
}
}
}
return $renderedContents;
}
示例10: getCookie
/**
* Gets the specified cookie. This automatically adds the necessary prefix.
*
* @param string $name Cookie name without prefix
* @param Zend_Controller_Request_Http $request
*
* @return string|array|false False if cookie isn't found
*/
public static function getCookie($name, Zend_Controller_Request_Http $request = null)
{
$name = XenForo_Application::get('config')->cookie->prefix . $name;
if ($request) {
return $request->getCookie($name, false);
} else {
if (isset($_COOKIE[$name])) {
return $_COOKIE[$name];
} else {
return false;
}
}
}
示例11: indexAction
public function indexAction()
{
//$mail = new TS_Mail_Gmail();
/*$mail = new TS_Mail_Netart();
$mail->send(array(
'to' => 'hyou.tm@gmail.com',
'subject' => 'Płatność on-line',
'body' => "Płatność została zakończona powodzeniem. Abonament ważny do."
));*/
// action body
$Polecamy = new Application_Model_DbTable_Artykuly();
$select = $Polecamy->select('id', 'nadtytul', 'tytul', 'abstrakt', 'foto_mini', 'foto_podpis', 'ile_czytany', 'data_publikacji', 'ocena', 'patronat', 'tresc2', 'czy_wideo', 'tylko_w_ts', 'w_regionie_sie_mowi')->where('id_nadkategorii = ?', 9)->where('czy_wyswietlac = ?', "y")->where('czy_wazna = ?', "y")->where('data_publikacji <= ?', new Zend_Db_Expr('NOW()'))->order('data_publikacji DESC')->limit(3);
$this->view->polecamy = $Polecamy->fetchAll($select);
foreach ($this->view->polecamy as $i => $polecamy) {
$id_polecamy[] = $polecamy['id'];
}
//echo $select->__toString();
// przestawianie starych glownych na polecamy
$where = array('czy_wyswietlac = ?' => "y", 'data_publikacji <= ?' => new Zend_Db_Expr('NOW()'), 'id_nadkategorii = ?' => 9, 'id NOT IN (?)' => $id_polecamy);
$Polecamy->update(array('id_nadkategorii' => 2), $where);
//--
$zasiegInfPub = 30;
$limitInf = 5;
$limitPub = 5;
$Ustawienia = new Application_Model_DbTable_Ustawienia();
$select = $Ustawienia->select(array('id', 'wartosc'))->where('id = ?', 30)->Orwhere('id = ?', 31)->order('id ASC');
$limity = $Ustawienia->fetchAll($select);
$limitInf = $limity[0]->wartosc;
$limitPub = $limity[1]->wartosc;
$Informacje = new Application_Model_DbTable_Artykuly();
$select = $Informacje->select(array('id', 'nadtytul', 'tytul', 'abstrakt', 'foto_mini', 'foto_podpis', 'ile_czytany', 'data_publikacji', 'ocena', 'patronat', 'tresc2', 'czy_wideo', 'tylko_w_ts', 'w_regionie_sie_mowi'))->where('(id_nadkategorii = 1 OR id_nadkategorii=9)')->where('czy_wyswietlac = ?', "y")->where('czy_wazna = ?', "y")->where('data_publikacji <= ?', new Zend_Db_Expr('NOW()'))->where('id NOT in (?)', $id_polecamy)->order('data_publikacji DESC')->limit($zasiegInfPub);
$this->view->informacje = $Informacje->blokadaSortowania($Informacje->fetchAll($select), $limitInf, "info");
$Publicystyka = new Application_Model_DbTable_Artykuly();
$select = $Publicystyka->select('id', 'nadtytul', 'tytul', 'abstrakt', 'foto_mini', 'foto_podpis', 'ile_czytany', 'data_publikacji', 'ocena', 'patronat', 'tresc2', 'czy_wideo', 'tylko_w_ts', 'w_regionie_sie_mowi')->where('id_nadkategorii = 2 OR id_nadkategorii = 20')->where('czy_wyswietlac = ?', "y")->where('czy_wazna = ?', "y")->where('data_publikacji <= ?', new Zend_Db_Expr('NOW()'))->order('data_publikacji DESC')->limit($zasiegInfPub);
$this->view->publicystyka = $Publicystyka->blokadaSortowania($Publicystyka->fetchAll($select), $limitPub, "pub");
//echo $select->__toString();
$Komentarze = new Application_Model_DbTable_Komentarze();
$this->view->komentarze = $Komentarze;
$Galeria = new Application_Model_DbTable_ArtykulyGaleria();
$this->view->galeria = $Galeria;
$Pytanie = new Application_Model_DbTable_AnkietyPytania();
$select = $Pytanie->select(array('id', 'pytanie'))->where('czy_wyswietlac = ?', 't')->where('sekcja = ?', 'lewa')->where('rodzaj = ?', 'normal')->order('kolejnosc DESC')->order('data_dodania DESC')->order('pytanie ASC')->limit(1);
//echo $select->__toString();
$this->view->pytanie = $Pytanie->fetchAll($select);
$cookieSonda = Zend_Controller_Request_Http::getCookie("sonda");
if (!isset($cookieSonda) || isset($cookieSonda) && intval($cookieSonda) != intval($this->view->pytanie[0]->id)) {
$this->view->formularzsondy = true;
$this->view->fsonda = new Application_Form_Sonda();
} else {
$this->view->formularzsondy = false;
$Odpowiedzi = new Application_Model_DbTable_AnkietyOdpowiedzi();
$select = $Odpowiedzi->select()->where('id_pytania = ?', $this->view->pytanie[0]->id)->order('kolejnosc ASC');
//echo $select->__toString();
$this->view->odpowiedzi = $Odpowiedzi->fetchAll($select);
$Odpowiedzi = new Application_Model_DbTable_AnkietyOdpowiedzi();
$select = $Odpowiedzi->select()->from('ts_ankiety_odpowiedzi_pl', array('id', 'odpowiedz', 'SUM(ile_glosow) AS suma'))->where('id_pytania = ?', $this->view->pytanie[0]->id)->group('id_pytania')->order('kolejnosc ASC');
//echo $select->__toString();
$this->view->sumaOdpowiedzi = $Odpowiedzi->fetchAll($select);
}
/**/
//$mail = new TS_Mail_Netart();
//$mail->mailNewPassword("hyou.tm@gmail.com", 'czary mary');
}
示例12: inneAction
public function inneAction()
{
// INNE
$this->view->tag = $this->getRequest()->getParam("tag");
$this->view->rok = intval($this->getRequest()->getParam("rok"));
$Artykuly = new Application_Model_DbTable_Artykuly();
$select = $Artykuly->select($Artykuly, array('id', 'data_publikacji', 'tytul', 'abstrakt', 'tresc1', 'tresc2', 'ile_czytany', 'id_kategorii', 'id_nadkategorii', 'foto_mini', 'foto_podpis', 'ocena', 'tresc2', 'czy_wideo'))->where('id_nadkategorii = ' . intval(20))->where('czy_wyswietlac = ?', 'y')->where('czy_wazna = ?', 'y')->where('data_publikacji >= ?', $this->view->rok . '-00-00 00:00:00')->where('data_publikacji <= ?', intval($this->view->rok + 1) . '-00-00 00:00:00')->order('data_publikacji DESC');
//echo $select;
$this->view->artykuly = $this->__db1->fetchAll($select);
$paginatorArtykuly = Zend_Paginator::factory($this->view->artykuly);
$paginatorArtykuly->setItemCountPerPage(20)->setCurrentPageNumber($this->_getParam('page', 1));
$this->view->paginatorArtykuly = $paginatorArtykuly;
$Komentarze = new Application_Model_DbTable_Komentarze();
$this->view->komentarze = $Komentarze;
$Galeria = new Application_Model_DbTable_ArtykulyGaleria();
$this->view->galeria = $Galeria;
// Sonda
$Pytanie = new Application_Model_DbTable_AnkietyPytania();
$select = $Pytanie->select(array('id', 'pytanie'))->where('czy_wyswietlac = ?', 't')->where('sekcja = ?', 'lewa')->where('rodzaj = ?', 'normal')->order('kolejnosc DESC')->order('data_dodania DESC')->order('pytanie ASC')->limit(1);
//echo $select->__toString();
$this->view->pytanie = $Pytanie->fetchAll($select);
$cookieSonda = Zend_Controller_Request_Http::getCookie("sonda");
if (!isset($cookieSonda) || isset($cookieSonda) && intval($cookieSonda) != intval($this->view->pytanie[0]->id)) {
$this->view->formularzsondy = true;
$this->view->fsonda = new Application_Form_Sonda();
} else {
$this->view->formularzsondy = false;
$Odpowiedzi = new Application_Model_DbTable_AnkietyOdpowiedzi();
$select = $Odpowiedzi->select()->where('id_pytania = ?', $this->view->pytanie[0]->id)->order('kolejnosc ASC');
//echo $select->__toString();
$this->view->odpowiedzi = $Odpowiedzi->fetchAll($select);
$Odpowiedzi = new Application_Model_DbTable_AnkietyOdpowiedzi();
$select = $Odpowiedzi->select()->from('ts_ankiety_odpowiedzi_pl', array('id', 'odpowiedz', 'SUM(ile_glosow) AS suma'))->where('id_pytania = ?', $this->view->pytanie[0]->id)->group('id_pytania')->order('kolejnosc ASC');
//echo $select->__toString();
$this->view->sumaOdpowiedzi = $Odpowiedzi->fetchAll($select);
}
/* sonda */
}
示例13: getPublicSession
/**
* This simply gets public session, from cookies if necessary.
*
* @param Zend_Controller_Request_Http $request
*
* @return XenForo_Session
*/
public static function getPublicSession(Zend_Controller_Request_Http $request)
{
$session = new XenForo_Session();
$session->start();
if (!$session->sessionExists()) {
$cookiePrefix = XenForo_Application::get('config')->cookie->prefix;
$userCookie = $request->getCookie($cookiePrefix . 'user');
if ($userCookie) {
if ($userId = XenForo_Model::create('XenForo_Model_User')->loginUserByRememberCookie($userCookie)) {
$session->changeUserId($userId);
} else {
XenForo_Helper_Cookie::deleteCookie('user', true);
}
}
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
$session->set('userAgent', $_SERVER['HTTP_USER_AGENT']);
$session->set('isRobot', self::isRobot($_SERVER['HTTP_USER_AGENT']));
}
if (!empty($_SERVER['HTTP_REFERER'])) {
$session->set('referer', $_SERVER['HTTP_REFERER']);
$session->set('fromSearch', self::isSearchReferer($_SERVER['HTTP_REFERER']));
}
}
return $session;
}
示例14: getCredential
public static function getCredential(Zend_Controller_Request_Http $request)
{
return self::decodeValue($request->getCookie(self::getCredentialCookieName()), self::$prefixCredential);
}
示例15: contactAction
public function contactAction()
{
$request = new Zend_Controller_Request_Http();
$user_id = $request->getCookie('user_id');
if (!isset($user_id) || !$user_id || empty($user_id)) {
$this->_redirect('user/login');
}
$form = new Application_Form_Contacts();
$this->view->form = $form;
$modelConfig = new Application_Model_Configs();
$tutorConfig = $modelConfig->getConfigDetail("dang-ky-tim-gia-su");
$urlRedirect = '/news/detail/id/' . $tutorConfig['ConfigValue'];
$this->view->urlRedirect = $urlRedirect;
$getMail = false;
/* Proccess data post*/
if ($this->_request->isPost()) {
$formData = $this->_request->getPost();
if ($form->isValid($formData)) {
$data = $_POST;
$data['UserId'] = $user_id;
if (isset($data['ContactId'])) {
unset($data['ContactId']);
}
$contactModel = new Application_Model_Contacts();
if ($contactModel->add($data)) {
$this->_redirect($urlRedirect);
}
} else {
$msgVN = array("is required and can't be empty" => 'Không được để trống', 'is no valid email address in the basic format local-part@hostname' => 'Email không hợp lệ');
$messageStatus = 'danger/Có lỗi xảy ra. Chú ý thông tin những ô sau đây:';
$messages = array();
foreach ($form->getMessages() as $fieldName => $message) {
$message = end($message);
$key = substr(strstr($message, " "), 1);
if (in_array($key, array_keys($msgVN))) {
$message = $msgVN[$key];
}
$messages[$fieldName] = $message;
}
$this->view->messages = $messages;
$this->view->messageStatus = $messageStatus;
}
}
}