}
}
}
-
- static public function getAllConnectedEvents($parentId=''){
- if(!empty($parentId)){
- $query = "
- SELECT GROUP_CONCAT(entity_id) as entity_id
- FROM civicrm_recurring_entity
- WHERE parent_id = ".$parentId;
- $dao = CRM_Core_DAO::executeQuery($query);
- $dao->fetch();
- }
- return $dao;
- }
static function getListOfCurrentAndFutureEvents($ids=''){
if(isset($ids) and !empty($ids)){
}
$thisEventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($value, 'civicrm_event');
if($thisEventHasParent){
- $getAllConnections = CRM_Core_Form_RecurringEntity::getAllConnectedEvents($thisEventHasParent);
- if($getAllConnections->entity_id){
+ $getAllConnections = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($thisEventHasParent, 'civicrm_event');
+ $allEventIds = array();
+ foreach($getAllConnections as $key => $val){
+ $allEventIds[] = $val['id'];
+ }
+ if(!empty($allEventIds)){
$op = "IN";
- $value = "($getAllConnections->entity_id)";
+ $value = "(".implode(",", $allEventIds).")";
}
}
$query->_where[$grouping][] = "civicrm_event.id $op {$value}";
* Get connected event information list
*/
//Get all connected event ids
- $allEventIds = CRM_Core_Form_RecurringEntity::getAllConnectedEvents($checkParentExistsForThisId);
- if($allEventIds->entity_id){
- //echo "<pre>"; print_r($eventIds);
- //list($offset, $rowCount) = $this->_pager->getOffsetAndRowCount();
- $params = array();
- $query = "
- SELECT *
- FROM civicrm_event
- WHERE id IN (".$allEventIds->entity_id.")
- ORDER BY start_date asc
- ";
+ //$allEventIds = CRM_Core_Form_RecurringEntity::getAllConnectedEvents($checkParentExistsForThisId);
+ $allEventIdsArray = CRM_Core_BAo_RecurringEntity::getEntitiesForParent($checkParentExistsForThisId, 'civicrm_event');
+ $allEventIds = array();
+ if(!empty($allEventIdsArray)){
+ foreach($allEventIdsArray as $key => $val){
+ $allEventIds[] = $val['id'];
+ }
+ if(!empty($allEventIds)){
+ $params = array();
+ $query = "
+ SELECT *
+ FROM civicrm_event
+ WHERE id IN (".implode(",", $allEventIds).")
+ ORDER BY start_date asc
+ ";
- $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Event_DAO_Event');
- //$permissions = CRM_Event_BAO_Event::checkPermission();
- while($dao->fetch()){
-// if(in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])){
- if($dao->id){
- $manageEvent[$dao->id] = array();
- CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]);
+ $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Event_DAO_Event');
+ $permissions = CRM_Event_BAO_Event::checkPermission();
+ while($dao->fetch()){
+ if(in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])){
+ $manageEvent[$dao->id] = array();
+ CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]);
+ }
}
- }
+ }
$this->assign('rows', $manageEvent);
}
}else{