public function render(\Zend_View_Interface $view = null) { $request = \Zend_Controller_Front::getInstance()->getRequest(); $hasPrivilege = \Application\Controller\Plugin\Privileges::hasPrivilige($request, Manager::ACTION_UPDATE); if ($hasPrivilege) { $element = $this->createElement("submit", "submit"); $element->setLabel("Zapisz")->setIgnore(true)->setDecorators(array("ViewHelper", array("HtmlTag", array("tag" => "div", "class" => "input-line buttons")))); $this->addElement($element); } return parent::render($view); }
public function render(\Zend_View_Interface $view = null) { $request = \Zend_Controller_Front::getInstance()->getRequest(); $hasPrivilege = \Application\Controller\Plugin\Privileges::hasPrivilige($request, Manager::ACTION_UPDATE); foreach ($this->getElements() as $name => $element) { if ($element instanceof \Zend_Form_Element_File) { $element->setDecorators($this->getElementDecoratorsForFile()); } if ($hasPrivilege == false) { $element->setAttrib('readonly', true); $element->setAttrib('class', 'readonly'); } } return parent::renderWithoutSubmitButton($view); }