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_Contact_Page_View_ContactSmartGroup
extends CRM_Core_Page
{
27 * Called when action is browse.
29 public function browse() {
30 $in = CRM_Contact_BAO_GroupContact
::getContactGroup($this->_contactId
, 'Added');
32 // keep track of all 'added' contact groups so we can remove them from the smart group
36 foreach ($in as $group) {
37 $staticGroups[$group['group_id']] = 1;
41 $allGroup = CRM_Contact_BAO_GroupContactCache
::contactGroup($this->_contactId
);
42 $this->assign('groupSmart', NULL);
43 $this->assign('groupParent', NULL);
45 if (!empty($allGroup)) {
46 $smart = $parent = [];
47 foreach ($allGroup['group'] as $group) {
48 // delete all smart groups which are also in static groups
49 if (isset($staticGroups[$group['id']])) {
52 if (empty($group['children'])) {
61 $this->assign_by_ref('groupSmart', $smart);
63 if (!empty($parent)) {
64 $this->assign_by_ref('groupParent', $parent);
69 public function preProcess() {
70 $this->_contactId
= (int) CRM_Utils_Request
::retrieve('cid', 'Positive', $this, TRUE);
71 $this->assign('contactId', $this->_contactId
);
73 $displayName = CRM_Contact_BAO_Contact
::displayName($this->_contactId
);
74 $this->assign('displayName', $displayName);
76 // check logged in url permission
77 CRM_Contact_Page_View
::checkUserPermission($this);
81 * the main function that is called
82 * when the page loads, it decides the which action has
83 * to be taken for the page.
87 public function run() {