Last active
December 14, 2015 21:59
-
-
Save tamboer/5155151 to your computer and use it in GitHub Desktop.
Some common Zend controller actions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function common() { | |
Zend_Controller_Front::getInstance()->getBaseUrl(); | |
//$this->_helper->layout()->setLayout('nomenulayoutwide'); | |
$this->getHelper('layout')->disableLayout(); | |
$this->_helper->_layout->setLayout('login'); | |
$this->_helper->redirector('list'); | |
$this->redirecturl = "configuration/user/list/"; | |
$this->_redirect($this->redirecturl); | |
$this->_helper->viewRenderer->setNoRender(TRUE); | |
$id = $this->getRequest()->getParam("id_user"); | |
//Push it into the view from the controller. E.g. | |
$this->view->controller = $this->_request->getControllerName();// in your action method | |
//Or pull it from the front controller singleton. E.g. | |
$controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName(); | |
$this->getRequest()->getControllerName(); | |
Zend_Controller_Front::getInstance()->getRequest()->getControllerName(); | |
$translate = Zend_Registry::get('Zend_Translate');//check in bootstrap if it was set as 'Zend_Translate' | |
$translate->translate("home"); | |
} | |
public function languageAction() { | |
$this->_helper->viewRenderer->setNoRender(TRUE); | |
$language = $this->getRequest()->getParam("lang"); | |
$translate = new Zend_Translate( | |
array( | |
"adapter" => "Zend_Translate_Adapter_Csv", | |
"content" => APPLICATION_PATH . "/configs/" . $language . ".csv" | |
) | |
); | |
$userSession = new Zend_Session_Namespace("user"); | |
$userSession->language = $language; | |
Zend_Registry::set('Zend_Translate', $translate); | |
$this->_redirect($_SERVER['HTTP_REFERER']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment