Skip to content
Snippets Groups Projects
Commit 926dcf00 authored by Kurund Jalmi's avatar Kurund Jalmi
Browse files

more work on CRM-12466, added new files for contact smart group

parent 13d0ffc3
No related branches found
No related tags found
No related merge requests found
......@@ -483,7 +483,8 @@ AND civicrm_group_contact.group_id = $groupID ";
SELECT gc.group_id, gc.contact_id, g.title, g.children, g.description
FROM civicrm_group_contact_cache gc
INNER JOIN civicrm_group g ON g.id = gc.group_id
WHERE gc.contact_id IN ($contactIDString)
WHERE g.saved_search_id IS NOT NULL AND
gc.contact_id IN ($contactIDString)
$hiddenClause
ORDER BY gc.contact_id, g.children
";
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2013
* $Id$
*
*/
class CRM_Contact_Page_View_ContactSmartGroup extends CRM_Core_Page {
/**
* This function is called when action is browse
*
* return null
* @access public
*/
function browse() {
$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
$staticGroups = array();
if (!empty($in)) {
foreach ($in as $group) {
$staticGroups[$group['group_id']] = 1;
}
}
$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);
}
}
}
function preProcess() {
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->assign('contactId', $this->_contactId);
// 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);
}
/**
* This function is the main function that is called
* when the page loads, it decides the which action has
* to be taken for the page.
*
* return null
* @access public
*/
function run() {
$this->preProcess();
$this->browse();
return parent::run();
}
}
\ No newline at end of file
......@@ -62,6 +62,7 @@ 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);
......@@ -88,6 +89,7 @@ class CRM_Contact_Page_View_GroupContact extends CRM_Core_Page {
$this->assign_by_ref('groupParent', $parent);
}
}
*/
}
/**
......
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<div class="view-content">
{if $groupSmart}
<div class="ht-one"></div>
<h3>{ts}Smart Groups{/ts}</h3>
<div class="description">
{ts 1=$displayName}%1 is currently included in these Smart group(s) (e.g. saved searches).{/ts}
</div>
{strip}
<table id="smart_group" class="display">
<thead>
<tr>
<th>{ts}Group{/ts}</th>
<th>{ts}Description{/ts}</th>
</tr>
</thead>
{foreach from=$groupSmart item=row}
<tr id="grp_{$row.id}" class="{cycle values="odd-row,even-row"}">
<td class="bold">
<a href="{crmURL p='civicrm/group/search' q="reset=1&force=1&context=smog&gid=`$row.id`"}">
{$row.title}
</a>
</td>
<td>{$row.description}</td>
</tr>
{/foreach}
</table>
{/strip}
{/if}
{if $groupParent}
<div class="ht-one"></div>
<h3>{ts}Parent Groups{/ts}</h3>
<div class="description">
{ts 1=$displayName}%1 is included in these Parent group(s) based on belonging to group(s) which are their
children.{/ts}
</div>
{strip}
<table id="parent_group" class="display">
<thead>
<tr>
<th>{ts}Group{/ts}</th>
</tr>
</thead>
{foreach from=$groupParent item=row}
<tr id="grp_{$row.id}" class="{cycle values="odd-row,even-row"}">
<td class="bold">
<a href="{crmURL p='civicrm/group/search' q="reset=1&force=1&context=smog&gid=`$row.id`"}">
{$row.title}
</a>
</td>
</tr>
{/foreach}
</table>
{/strip}
{/if}
</div>
......@@ -81,62 +81,9 @@
{/strip}
{/if}
{if $groupSmart}
<div class="ht-one"></div>
<h3>{ts}Smart Groups{/ts}</h3>
<div class="description">
{ts 1=$displayName}%1 is currently included in these Smart group(s) (e.g. saved searches).{/ts}
</div>
{strip}
<table id="smart_group" class="display">
<thead>
<tr>
<th>{ts}Group{/ts}</th>
<th>{ts}Description{/ts}</th>
</tr>
</thead>
{foreach from=$groupSmart item=row}
<tr id="grp_{$row.id}" class="{cycle values="odd-row,even-row"}">
<td class="bold">
<a href="{crmURL p='civicrm/group/search' q="reset=1&force=1&context=smog&gid=`$row.id`"}">
{$row.title}
</a>
</td>
<td>{$row.description}</td>
</tr>
{/foreach}
</table>
{/strip}
{/if}
{if $groupParent}
<div class="ht-one"></div>
<h3>{ts}Parent Groups{/ts}</h3>
<div class="description">
{ts 1=$displayName}%1 is included in these Parent group(s) based on belonging to group(s) which are their
children.{/ts}
</div>
{strip}
<table id="parent_group" class="display">
<thead>
<tr>
<th>{ts}Group{/ts}</th>
</tr>
</thead>
{foreach from=$groupParent item=row}
<tr id="grp_{$row.id}" class="{cycle values="odd-row,even-row"}">
<td class="bold">
<a href="{crmURL p='civicrm/group/search' q="reset=1&force=1&context=smog&gid=`$row.id`"}">
{$row.title}
</a>
</td>
</tr>
{/foreach}
</table>
{/strip}
{/if}
{if $groupPending }
{if $groupPending}
<div class="ht-one"></div>
<h3 class="status-pending">{ts}Pending{/ts}</h3>
<div class="description">{ts}Joining these group(s) is pending confirmation by this contact.{/ts}</div>
......@@ -219,5 +166,4 @@
</table>
{/strip}
{/if}
</div>
</div>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment