public function init() { $this->setView(SP_Application::getView()); $this->addPrefixPath('SP_Form_Decorator', 'SP/Form/Decorator/', 'decorator'); $this->setDisableLoadDefaultDecorators(true); $this->setDecorators($this->formDecorators); $this->setElementDecorators($this->elementDecorators); }
public function initView() { if (null === $this->view) { $this->view = SP_Application::getView(); } $request = $this->getRequest(); $module = $request->getModuleName(); if ('default' !== $module) { $this->view->setScriptPath(SP_APP_PATH . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'views'); $this->view->addScriptPath(SP_APP_PATH . '/layouts'); } return $this->view; }
public function init() { $this->addPrefixPath('SP_Form_Decorator', 'SP/Form/Decorator/', 'decorator'); $this->_view = SP_Application::getView(); $this->setName('Form_Login'); $this->setAttrib('class', 'Form_Edit'); $this->setMethod('post')->setAction('/user/login'); $username = new Zend_Form_Element_Text('name'); $username->setLabel($this->getTranslator()->translate('UserName:'******'NotEmpty', true)->setView($this->getView()); $password = new Zend_Form_Element_Password('pwd'); $password->setLabel($this->getTranslator()->translate('Password:'******'NotEmpty')->setView($this->getView()); $btnLogin = new Zend_Form_Element_Submit('submit'); $btnLogin->setLabel($this->getTranslator()->_('Login'))->setView($this->getView()); $this->addElements(array($username, $password, $btnLogin)); $this->clearDecorators(); $this->setDecorators(array('FormElements', 'Form', array('OuterBox', array('attrs' => array('class' => 'form login_form'), 'title' => 'Login', 'placement' => 'PREPEND')))); $this->setElementDecorators(array('ViewHelper', array('data' => 'HtmlTag', array('tag' => 'div', 'class' => 'form_row')), array('Label', array('tag' => 'div', 'class' => 'form_label')))); $btnLogin->removeDecorator('Label'); }