示例#1
0
 /**
  * @param $parentGroup
  * @param null $group
  *
  * @return CRM_Contact_BAO_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
         $childGroup = new CRM_Contact_BAO_Group();
         $cgQuery = "SELECT * FROM civicrm_group WHERE id IN (" . implode(',', $children) . ") ORDER BY title " . self::$_sortOrder;
         $childGroup->query($cgQuery);
         $currentGroup =& $this->_current;
         if ($group == NULL) {
             $sawLast = TRUE;
         } else {
             $sawLast = FALSE;
         }
         while ($childGroup->fetch()) {
             if ($sawLast) {
                 return $childGroup;
             } elseif ($currentGroup->id === $childGroup->id) {
                 $sawLast = TRUE;
             }
         }
     }
     return NULL;
 }
 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
         require_once 'CRM/Contact/BAO/Group.php';
         $childGroup = new CRM_Contact_BAO_Group();
         $cgQuery = "SELECT * FROM civicrm_group WHERE id IN (" . implode(',', $children) . ") ORDER BY title " . self::$_sortOrder;
         $childGroup->query($cgQuery);
         $currentGroup =& $this->_current;
         if ($group == null) {
             $sawLast = true;
         } else {
             $sawLast = false;
         }
         while ($childGroup->fetch()) {
             if ($sawLast) {
                 return $childGroup;
             } else {
                 if ($currentGroup == $childGroup) {
                     $sawLast = true;
                 }
             }
         }
     }
     return null;
 }