3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2016
33 class CRM_Group_Page_Group
extends CRM_Core_Page_Basic
{
34 protected $_sortByCharacter;
41 public function getBAOName() {
42 return 'CRM_Contact_BAO_Group';
46 * Define action links.
48 * self::$_links array of action links
50 public function &links() {
54 * Return class name of edit form.
58 public function editForm() {
59 return 'CRM_Group_Form_Edit';
63 * Return name of edit form.
67 public function editName() {
68 return ts('Edit Group');
72 * Return name of delete form.
76 public function deleteName() {
77 return 'Delete Group';
81 * Return user context uri to return to.
87 public function userContext($mode = NULL) {
88 return 'civicrm/group';
92 * Return user context uri params.
98 public function userContextParams($mode = NULL) {
99 return 'reset=1&action=browse';
103 * Make sure that the user has permission to access this group.
106 * The id of the object.
108 * Name or title of the object.
111 * the permission that the user has (or null)
113 public function checkPermission($id, $title) {
114 return CRM_Contact_BAO_Group
::checkPermission($id, $title);
118 * Re-implement browse.
120 * We need to do slightly different things for groups vs saved search groups, hence we
121 * re-implement browse from Page_Basic.
125 public function browse($action = NULL) {
126 $groupPermission = CRM_Core_Permission
::check('edit groups') ? CRM_Core_Permission
::EDIT
: CRM_Core_Permission
::VIEW
;
127 $this->assign('groupPermission', $groupPermission);
129 $showOrgInfo = FALSE;
132 $reservedPermission = CRM_Core_Permission
::check('administer reserved groups') ? CRM_Core_Permission
::EDIT
: CRM_Core_Permission
::VIEW
;
133 $this->assign('reservedPermission', $reservedPermission);
135 if (CRM_Core_Permission
::check('administer Multiple Organizations') &&
136 CRM_Core_Permission
::isMultisiteEnabled()
140 $this->assign('showOrgInfo', $showOrgInfo);
142 // Refresh smart group cache
143 if (!empty($_GET['update_smart_groups'])) {
144 CRM_Contact_BAO_GroupContactCache
::loadAll();
146 elseif (!CRM_Core_DAO
::singleValueQuery("SELECT id FROM civicrm_group_contact_cache LIMIT 1")) {
147 CRM_Core_Session
::setStatus(ts('Count data for smart groups is not currently calculated. You may click Update Smart Groups to generate it. Be aware this can cause significant server load'));
156 public function search() {
157 if ($this->_action
& (CRM_Core_Action
::ADD |
158 CRM_Core_Action
::UPDATE |
159 CRM_Core_Action
::DELETE
165 $form = new CRM_Core_Controller_Simple('CRM_Group_Form_Search', ts('Search Groups'), CRM_Core_Action
::ADD
);
166 $form->setEmbedded(TRUE);
167 $form->setParent($this);