public function init() { $modules = Manager::getModules(); $employeeAccess = $this->getModel()->access; foreach ($modules as $name => $translation) { $moduleName = "MODULE_" . strtoupper($name); $module = constant("\\Application\\Access\\Manager::" . $moduleName); $element = $this->createElement("select", $moduleName); $element->setLabel($translation)->addValidator("Int")->addFilter("Int")->setMultiOptions(Manager::getActions())->setValue(Manager::getValue($employeeAccess, $module)); $this->addElement($element); } $element = $this->createElement("checkbox", "GRANT_OPTION"); $element->setLabel("Nadawanie uprawnień")->addValidator("Int")->addFilter("Int")->setValue(Manager::hasGrantOption($employeeAccess)); $this->addElement($element); }
public function init() { $login = new Employees_SubForm_Login($this->getModel()); $login->setLegend("Dane do logowania"); $this->addSubForm($login, "login-form"); $basic = new Employees_SubForm_Basic($this->getModel()); $basic->setLegend("Dane personalne"); $this->addSubForm($basic, "basic"); $agreement = new Employees_SubForm_Agreement($this->getModel()); $agreement->setLegend("Umowa"); $this->addSubForm($agreement, "agreement"); $this->addTab("address-list", "Lista adresów", "employees/partials/address-list.phtml"); $this->addTab("document-list", "Lista dokumentów", "employees/partials/document-list.phtml"); $this->addTab("customers-list", "Lista klientów", "employees/partials/customers-list.phtml"); //$this->addTab("privileges-list", "Lista przywilejów", "employees/partials/privilege-list.phtml"); $this->addTab("trainings-list", "Szkolenia", "employees/partials/training-list.phtml"); $employee = \Zend_Auth::getInstance()->getIdentity(); if (Manager::hasGrantOption($employee->access)) { $access = new Employees_SubForm_Access($this->getModel()); $access->setLegend("Uprawnienia"); $this->addSubForm($access, "access"); } }