X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContact%2FBAO%2FGroupNesting.php;h=d6ad7f296e6f2ecc2645c24edadb947e3d6446b1;hb=bdd49e3826fad29cc02081b07a81eda3455d126a;hp=d6bb5c2f6317e45abb7a7d4b04b0e9e0f3e5c8a1;hpb=87d422669cee2e65706fe72821613ad846cd0adb;p=civicrm-core.git diff --git a/CRM/Contact/BAO/GroupNesting.php b/CRM/Contact/BAO/GroupNesting.php index d6bb5c2f63..d6ad7f296e 100644 --- a/CRM/Contact/BAO/GroupNesting.php +++ b/CRM/Contact/BAO/GroupNesting.php @@ -1,7 +1,7 @@ _styleLabels = $styleLabels; $this->_styleIndent = $styleIndent; @@ -61,7 +61,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen /** * @param $sortOrder */ - function setSortOrder($sortOrder) { + public function setSortOrder($sortOrder) { switch ($sortOrder) { case 'ASC': case 'DESC': @@ -79,14 +79,14 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen /** * @return string */ - function getSortOrder() { + public function getSortOrder() { return self::$_sortOrder; } /** * @return int */ - function getCurrentNestingLevel() { + public function getCurrentNestingLevel() { return count($this->_parentStack); } @@ -95,7 +95,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * which is the first group (according to _sortOrder) that * has no parent groups */ - function rewind() { + public function rewind() { $this->_parentStack = array(); // calling _getNextParentlessGroup w/ no arguments // makes it return the first parentless group @@ -105,7 +105,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen $this->_alreadyStyled = FALSE; } - function current() { + public function current() { if ($this->_styleLabels && $this->valid() && !$this->_alreadyStyled @@ -127,7 +127,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen /** * @return string */ - function key() { + public function key() { $group = &$this->_current; $ids = array(); foreach ($this->_parentStack as $parentGroup) { @@ -144,7 +144,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen /** * @return CRM_Contact_BAO_Group|null */ - function next() { + public function next() { $currentGroup = &$this->_current; $childGroup = $this->_getNextChildGroup($currentGroup); if ($childGroup) { @@ -178,7 +178,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen /** * @return bool */ - function valid() { + public function valid() { if ($this->_current) { return TRUE; } @@ -192,7 +192,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return CRM_Contact_BAO_Group|null */ - function _getNextParentlessGroup(&$group = NULL) { + public function _getNextParentlessGroup(&$group = NULL) { $lastParentlessGroup = $this->_lastParentlessGroup; $nextGroup = new CRM_Contact_BAO_Group(); $nextGroup->order_by = 'title ' . self::$_sortOrder; @@ -220,7 +220,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return CRM_Contact_BAO_Group|null */ - function _getNextChildGroup(&$parentGroup, &$group = NULL) { + public function _getNextChildGroup(&$parentGroup, &$group = NULL) { $children = self::getChildGroupIds($parentGroup->id); if (count($children) > 0) { // we have child groups, so get the first one based on _sortOrder @@ -251,7 +251,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return CRM_Contact_BAO_Group|null */ - function _getNextSiblingGroup(&$group) { + public function _getNextSiblingGroup(&$group) { $parentGroup = end($this->_parentStack); if ($parentGroup) { $nextGroup = $this->_getNextChildGroup($parentGroup, $group); @@ -282,9 +282,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * * @return void - * @access public */ - static function add($parentID, $childID) { + public static function add($parentID, $childID) { // TODO: Add checks here to make sure invalid nests can't be created $dao = new CRM_Contact_DAO_GroupNesting(); $query = "REPLACE INTO civicrm_group_nesting (child_group_id, parent_group_id) VALUES ($childID,$parentID);"; @@ -301,9 +300,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return void * - * @access public */ - static function remove($parentID, $childID) { + public static function remove($parentID, $childID) { $dao = new CRM_Contact_DAO_GroupNesting(); $query = "DELETE FROM civicrm_group_nesting WHERE child_group_id = $childID AND parent_group_id = $parentID"; $dao->query($query); @@ -318,9 +316,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return void * - * @access public */ - static function removeAllParentForChild($childID) { + public static function removeAllParentForChild($childID) { $dao = new CRM_Contact_DAO_GroupNesting(); $query = "DELETE FROM civicrm_group_nesting WHERE child_group_id = $childID"; $dao->query($query); @@ -335,9 +332,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return boolean True if association is found, false otherwise. * - * @access public */ - static function isParentChild($parentID, $childID) { + public static function isParentChild($parentID, $childID) { $dao = new CRM_Contact_DAO_GroupNesting(); $query = "SELECT id FROM civicrm_group_nesting WHERE child_group_id = $childID AND parent_group_id = $parentID"; $dao->query($query); @@ -355,9 +351,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return boolean True if 1 or more child groups are found, false otherwise. * - * @access public */ - static function hasChildGroups($groupId) { + public static function hasChildGroups($groupId) { $dao = new CRM_Contact_DAO_GroupNesting(); $query = "SELECT child_group_id FROM civicrm_group_nesting WHERE parent_group_id = $groupId LIMIT 1"; //print $query . "\n

"; @@ -376,9 +371,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return boolean True if 1 or more parent groups are found, false otherwise. * - * @access public */ - static function hasParentGroups($groupId) { + public static function hasParentGroups($groupId) { $dao = new CRM_Contact_DAO_GroupNesting(); $query = "SELECT parent_group_id FROM civicrm_group_nesting WHERE child_group_id = $groupId LIMIT 1"; $dao->query($query); @@ -397,9 +391,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return boolean True if $checkGroupId points to a group that is a parent of one of the $groupIds groups, false otherwise. * - * @access public */ - static function isParentGroup($groupIds, $checkGroupId) { + public static function isParentGroup($groupIds, $checkGroupId) { if (!is_array($groupIds)) { $groupIds = array($groupIds); } @@ -428,9 +421,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return boolean True if $checkGroupId points to a group that is a child of one of the $groupIds groups, false otherwise. * - * @access public */ - static function isChildGroup($groupIds, $checkGroupId) { + public static function isChildGroup($groupIds, $checkGroupId) { if (!is_array($groupIds)) { $groupIds = array($groupIds); @@ -461,9 +453,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return boolean True if $checkGroupId points to a group that is an ancestor of one of the $groupIds groups, false otherwise. * - * @access public */ - static function isAncestorGroup($groupIds, $checkGroupId) { + public static function isAncestorGroup($groupIds, $checkGroupId) { if (!is_array($groupIds)) { $groupIds = array($groupIds); } @@ -501,9 +492,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return boolean True if $checkGroupId points to a group that is a descendent of one of the $groupIds groups, false otherwise. * - * @access public */ - static function isDescendentGroup($groupIds, $checkGroupId) { + public static function isDescendentGroup($groupIds, $checkGroupId) { if (!is_array($groupIds)) { $groupIds = array($groupIds); } @@ -541,7 +531,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return array $groupIdArray List of groupIds that represent the requested group and its ancestors@access public */ - static function getAncestorGroupIds($groupIds, $includeSelf = TRUE) { + public static function getAncestorGroupIds($groupIds, $includeSelf = TRUE) { if (!is_array($groupIds)) { $groupIds = array($groupIds); } @@ -576,7 +566,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * @param bool $includeSelf * @return \An $groupArray List of ancestor groups@access public */ - static function getAncestorGroups($groupIds, $includeSelf = TRUE) { + public static function getAncestorGroups($groupIds, $includeSelf = TRUE) { $groupIds = self::getAncestorGroupIds($groupIds, $includeSelf); $params['id'] = $groupIds; return CRM_Contact_BAO_Group::getGroups($params); @@ -589,7 +579,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return array $groupIdArray List of groupIds that represent the requested group and its children@access public */ - static function getChildGroupIds($groupIds) { + public static function getChildGroupIds($groupIds) { if (!is_array($groupIds)) { $groupIds = array($groupIds); } @@ -610,7 +600,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return array $groupIdArray List of groupIds that represent the requested group and its parents@access public */ - static function getParentGroupIds($groupIds) { + public static function getParentGroupIds($groupIds) { if (!is_array($groupIds)) { $groupIds = array($groupIds); } @@ -632,7 +622,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * @param bool $includeSelf * @return array $groupIdArray List of groupIds that represent the requested group and its descendents@access public */ - static function getDescendentGroupIds($groupIds, $includeSelf = TRUE) { + public static function getDescendentGroupIds($groupIds, $includeSelf = TRUE) { if (!is_array($groupIds)) { $groupIds = array($groupIds); } @@ -665,7 +655,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * @param bool $includeSelf * @return \An $groupArray List of descendent groups@access public */ - static function getDescendentGroups($groupIds, $includeSelf = TRUE) { + public static function getDescendentGroups($groupIds, $includeSelf = TRUE) { $groupIds = self::getDescendentGroupIds($groupIds, $includeSelf); $params['id'] = $groupIds; return CRM_Contact_BAO_Group::getGroups($params); @@ -678,7 +668,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return array $groupIdArray List of groupIds that represent the valid potential children of the group@access public */ - static function getPotentialChildGroupIds($groupId) { + public static function getPotentialChildGroupIds($groupId) { $groups = CRM_Contact_BAO_Group::getGroups(); $potentialChildGroupIds = array(); foreach ($groups as $group) { @@ -700,7 +690,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen * * @return array */ - static function getContainingGroups($contactId, $parentGroupId) { + public static function getContainingGroups($contactId, $parentGroupId) { $groups = CRM_Contact_BAO_Group::getGroups(); $containingGroups = array(); foreach ($groups as $group) { @@ -715,4 +705,3 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen return $containingGroups; } } -