/** * Gets a data table for the model * @param string $formAction URL where the table form will point to * @return zibo\library\html\table\Table */ protected function getTable($formAction) { $table = parent::getTable($formAction); $table->addDecorator(new ZebraDecorator(new PermissionDecorator($this->request->getBasePath() . '/' . self::ACTION_EDIT . '/'))); return $table; }
/** * Gets a data table for the model * @param string $formAction URL where the table form will point to * @return zibo\library\html\table\ExtendedTable */ protected function getTable($formAction) { $table = parent::getTable($formAction); $table->addDecorator(new ZebraDecorator(new UserDecorator($this->request->getBasePath() . '/' . self::ACTION_EDIT . '/'))); if ($this->user && !$this->user->isSuperUser()) { $query = $table->getModelQuery(); $query->setDistinct(true); $query->addCondition('{roles.isSuperRole} = 0 OR {roles.isSuperRole} IS NULL'); $hiddenRoleIds = $this->getHiddenRoleIds(); if ($hiddenRoleIds) { foreach ($hiddenRoleIds as $roleId) { $query->addCondition('{roles.id} <> %1%', $roleId); } } } return $table; }