From: Kurund Jalmi Date: Tue, 21 May 2013 00:45:02 +0000 (-0400) Subject: CRM-12466, added smart group pane X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=559865a0775aaf5c438aae5530923fd08d2996a2;p=civicrm-core.git CRM-12466, added smart group pane --- diff --git a/CRM/Contact/Page/View/ContactSmartGroup.php b/CRM/Contact/Page/View/ContactSmartGroup.php index 483045a8ef..0a32eaa1e2 100644 --- a/CRM/Contact/Page/View/ContactSmartGroup.php +++ b/CRM/Contact/Page/View/ContactSmartGroup.php @@ -34,6 +34,11 @@ */ class CRM_Contact_Page_View_ContactSmartGroup extends CRM_Core_Page { + /** + * @var int contact id + */ + public $_contactId; + /** * This function is called when action is browse * @@ -41,7 +46,7 @@ class CRM_Contact_Page_View_ContactSmartGroup extends CRM_Core_Page { * @access public */ function browse() { - $in = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Added'); + $in = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Added'); // keep track of all 'added' contact groups so we can remove them from the smart group // section @@ -53,8 +58,8 @@ class CRM_Contact_Page_View_ContactSmartGroup extends CRM_Core_Page { } $allGroup = CRM_Contact_BAO_GroupContactCache::contactGroup($this->_contactId); - $this->assign('groupSmart' , null); - $this->assign('groupParent', null); + $this->assign('groupSmart' , NULL); + $this->assign('groupParent', NULL); if (!empty($allGroup)) { $smart = $parent = array( ); @@ -84,11 +89,11 @@ class CRM_Contact_Page_View_ContactSmartGroup extends CRM_Core_Page { $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $this->assign('contactId', $this->_contactId); + $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); + $this->assign('displayName', $displayName); + // check logged in url permission CRM_Contact_Page_View::checkUserPermission($this); - - $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); - $this->assign('action', $this->_action); } /** diff --git a/CRM/Contact/Page/View/GroupContact.php b/CRM/Contact/Page/View/GroupContact.php index ab0b2accc8..152d3d261f 100644 --- a/CRM/Contact/Page/View/GroupContact.php +++ b/CRM/Contact/Page/View/GroupContact.php @@ -62,34 +62,10 @@ class CRM_Contact_Page_View_GroupContact extends CRM_Core_Page { $this->assign_by_ref('groupPending', $pending); $this->assign_by_ref('groupOut', $out); - /* - $allGroup = CRM_Contact_BAO_GroupContactCache::contactGroup($this->_contactId); - $this->assign('groupSmart' , null); - $this->assign('groupParent', null); - - if (!empty($allGroup)) { - $smart = $parent = array( ); - foreach ($allGroup['group'] as $group) { - // delete all smart groups which are also in static groups - if (isset($staticGroups[$group['id']])) { - continue; - } - if (empty($group['children'])) { - $smart[] = $group; - } - else { - $parent[] = $group; - } - } - - if (!empty($smart)) { - $this->assign_by_ref('groupSmart', $smart); - } - if (!empty($parent)) { - $this->assign_by_ref('groupParent', $parent); - } - } - */ + // get the info on contact smart groups + $contactSmartGroupSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, + 'contact_smart_group_display'); + $this->assign('contactSmartGroupSettings', $contactSmartGroupSettings); } /** diff --git a/CRM/Core/xml/Menu/Contact.xml b/CRM/Core/xml/Menu/Contact.xml index 391b2b7833..628a9a764f 100644 --- a/CRM/Core/xml/Menu/Contact.xml +++ b/CRM/Core/xml/Menu/Contact.xml @@ -184,6 +184,12 @@ Groups CRM_Contact_Page_View_GroupContact + + civicrm/contact/view/smartgroup + cid=%%cid%% + Smart Groups + CRM_Contact_Page_View_ContactSmartGroup + civicrm/contact/view/sunlight Sunlight diff --git a/templates/CRM/Contact/Page/View/ContactSmartGroup.tpl b/templates/CRM/Contact/Page/View/ContactSmartGroup.tpl index 830acee373..4208723f6a 100644 --- a/templates/CRM/Contact/Page/View/ContactSmartGroup.tpl +++ b/templates/CRM/Contact/Page/View/ContactSmartGroup.tpl @@ -24,9 +24,15 @@ +--------------------------------------------------------------------+ *}
+ {if !$groupSmart AND !$groupParent} +
+
+  {ts}This contact does not currently belong to any smart groups.{/ts} +
+ {/if} + {if $groupSmart}
-

{ts}Smart Groups{/ts}

{ts 1=$displayName}%1 is currently included in these Smart group(s) (e.g. saved searches).{/ts}
diff --git a/templates/CRM/Contact/Page/View/GroupContact.tpl b/templates/CRM/Contact/Page/View/GroupContact.tpl index ba6cd34470..e8183b0d9c 100644 --- a/templates/CRM/Contact/Page/View/GroupContact.tpl +++ b/templates/CRM/Contact/Page/View/GroupContact.tpl @@ -24,7 +24,7 @@ +--------------------------------------------------------------------+ *}
- {if $groupCount eq 0 AND ! $groupSmart AND ! $groupParent} + {if $groupCount eq 0}
 {ts}This contact does not currently belong to any groups.{/ts} @@ -81,7 +81,21 @@ {/strip} {/if} - + {if $contactSmartGroupSettings neq 3} +
+
+
+ {ts}Smart Groups{/ts} +
+ +
+
+
+ +
+ +
+ {/if} {if $groupPending}
@@ -166,4 +180,39 @@ {/strip} {/if} -
\ No newline at end of file +
+ + +{literal} + +{/literal} \ No newline at end of file