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_UserDashBoard_GroupContact
extends CRM_Contact_Page_View_UserDashBoard
{
20 * Called when action is browse.
22 public function browse() {
23 $count = CRM_Contact_BAO_GroupContact
::getContactGroup(
27 $this->_onlyPublicGroups
,
28 NULL, NULL, TRUE, TRUE
31 $in = CRM_Contact_BAO_GroupContact
::getContactGroup(
35 $this->_onlyPublicGroups
,
36 NULL, NULL, TRUE, TRUE
39 $pending = CRM_Contact_BAO_GroupContact
::getContactGroup(
43 $this->_onlyPublicGroups
,
44 NULL, NULL, TRUE, TRUE
47 $out = CRM_Contact_BAO_GroupContact
::getContactGroup(
51 $this->_onlyPublicGroups
,
52 NULL, NULL, TRUE, TRUE
55 $this->assign('groupCount', $count);
56 $this->assign_by_ref('groupIn', $in);
57 $this->assign_by_ref('groupPending', $pending);
58 $this->assign_by_ref('groupOut', $out);
62 * called when action is update.
68 public function edit($groupId = NULL) {
69 $this->assign('edit', $this->_edit
);
74 $action = CRM_Utils_Request
::retrieve('action', 'String',
75 CRM_Core_DAO
::$_nullObject,
79 if ($action == CRM_Core_Action
::DELETE
) {
80 $groupContactId = CRM_Utils_Request
::retrieve('gcid', 'Positive', CRM_Core_DAO
::$_nullObject, TRUE);
81 $status = CRM_Utils_Request
::retrieve('st', 'String', CRM_Core_DAO
::$_nullObject, TRUE);
82 if (is_numeric($groupContactId) && $status) {
83 CRM_Contact_Page_View_GroupContact
::del($groupContactId, $status, $this->_contactId
);
86 $url = CRM_Utils_System
::url('civicrm/user', "reset=1&id={$this->_contactId}");
87 CRM_Utils_System
::redirect($url);
90 $controller = new CRM_Core_Controller_Simple(
91 'CRM_Contact_Form_GroupContact',
92 ts("Contact's Groups"),
94 FALSE, FALSE, TRUE, FALSE
96 $controller->setEmbedded(TRUE);
98 $session = CRM_Core_Session
::singleton();
99 $session->pushUserContext(
100 CRM_Utils_System
::url('civicrm/user', "reset=1&id={$this->_contactId}"),
104 $controller->reset();
105 $controller->set('contactId', $this->_contactId
);
106 $controller->set('groupId', $groupId);
107 $controller->set('context', 'user');
108 $controller->set('onlyPublicGroups', $this->_onlyPublicGroups
);
109 $controller->process();
114 * The main function that is called when the page loads.
116 * It decides the which action has to be taken for the page.
118 public function run() {