public function buildPermissions() { $options = []; $options['clearSelect'] = true; $options['select'][] = \Rebond\Core\Permission\Data::getList(['id', 'title']); $options['where'][] = 'permission.status IN (0,1)'; $options['order'][] = 'permission.title'; $items = \Rebond\Core\Permission\Data::loadAll($options); $options['clearSelect'] = true; $options['select'][] = \Rebond\Core\RolePermission\Data::getList(['permission_id']); $permissions = \Rebond\Core\RolePermission\Data::loadAllByRoleId($this->getModel()->getId()); $selectedValues = []; if (isset($permissions)) { foreach ($permissions as $permission) { $selectedValues[] = $permission->getPermissionId(); } } return Util\Form::buildCheckboxList('permission' . $this->unique, $items, 'id', 'title', $selectedValues); }
public function buildPermission() { $options = []; $options['clearSelect'] = true; $options['select'][] = \Rebond\Core\Permission\Data::getList(['id', 'title']); $models = \Rebond\Core\Permission\Data::loadAll($options); return Util\Form::buildDropdownList('permissionId' . $this->unique, $models, 'id', 'title', $this->getModel()->getPermissionId(), $this->permissionValidator['foreignKey']); }