3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 class CRM_ACL_Form_EntityRole
extends CRM_Admin_Form
{
20 * Build the form object.
22 public function buildQuickForm() {
23 parent
::buildQuickForm();
25 if ($this->_action
& CRM_Core_Action
::DELETE
) {
29 $aclRoles = ['' => ts('- select -')] + CRM_Core_OptionGroup
::values('acl_role');
30 $this->add('select', 'acl_role_id', ts('ACL Role'),
34 $label = ts('Assigned to');
35 $group = ['' => ts('- select group -')] + CRM_Core_PseudoConstant
::staticGroup(FALSE, 'Access');
36 $this->add('select', 'entity_id', $label, $group, TRUE, ['class' => 'crm-select2 huge']);
38 $this->add('checkbox', 'is_active', ts('Enabled?'));
42 * Process the form submission.
44 public function postProcess() {
45 CRM_ACL_BAO_Cache
::resetCache();
47 if ($this->_action
& CRM_Core_Action
::DELETE
) {
48 CRM_ACL_BAO_EntityRole
::del($this->_id
);
49 CRM_Core_Session
::setStatus(ts('Selected Entity Role has been deleted.'), ts('Record Deleted'), 'success');
52 $params = $this->controller
->exportValues($this->_name
);
54 $params['id'] = $this->_id
;
57 $params['entity_table'] = 'civicrm_group';
58 CRM_ACL_BAO_EntityRole
::create($params);