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
19 * Page for displaying list of contact Subtypes.
21 class CRM_Admin_Page_ContactType
extends CRM_Core_Page_Basic
{
23 public $useLivePageJS = TRUE;
26 * The action links that we need to display for the browse screen.
30 public static $_links = NULL;
38 public function getBAOName() {
39 return 'CRM_Contact_BAO_ContactType';
46 * (reference) of action links
48 public function &links() {
49 if (!(self
::$_links)) {
51 CRM_Core_Action
::UPDATE
=> [
53 'url' => 'civicrm/admin/options/subtype',
54 'qs' => 'action=update&id=%%id%%&reset=1',
55 'title' => ts('Edit Contact Type'),
57 CRM_Core_Action
::DISABLE
=> [
58 'name' => ts('Disable'),
59 'ref' => 'crm-enable-disable',
60 'title' => ts('Disable Contact Type'),
62 CRM_Core_Action
::ENABLE
=> [
63 'name' => ts('Enable'),
64 'ref' => 'crm-enable-disable',
65 'title' => ts('Enable Contact Type'),
67 CRM_Core_Action
::DELETE
=> [
68 'name' => ts('Delete'),
69 'url' => 'civicrm/admin/options/subtype',
70 'qs' => 'action=delete&id=%%id%%',
71 'title' => ts('Delete Contact Type'),
81 public function run() {
82 $action = CRM_Utils_Request
::retrieve('action', 'String', $this, FALSE, 0);
83 $this->assign('action', $action);
84 $id = CRM_Utils_Request
::retrieve('id', 'Positive', $this, FALSE, 0);
92 * Browse contact types.
94 public function browse() {
95 $rows = CRM_Contact_BAO_ContactType
::contactTypeInfo(TRUE);
96 foreach ($rows as $key => $value) {
98 if (!empty($value['is_reserved'])) {
99 $mask = CRM_Core_Action
::UPDATE
;
102 $mask -= CRM_Core_Action
::DELETE
- 2;
103 if (!empty($value['is_active'])) {
104 $mask -= CRM_Core_Action
::ENABLE
;
107 $mask -= CRM_Core_Action
::DISABLE
;
110 $rows[$key]['action'] = CRM_Core_Action
::formLink(self
::links(), $mask,
111 ['id' => $value['id']],
114 'contactType.manage.action',
119 $this->assign('rows', $rows);
123 * Get name of edit form.
126 * Classname of edit form.
128 public function editForm() {
129 return 'CRM_Admin_Form_ContactType';
133 * Get edit form name.
138 public function editName() {
139 return 'Contact Types';
150 public function userContext($mode = NULL) {
151 return 'civicrm/admin/options/subtype';