当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_BAO_RecurringEntity::getEntitiesForParent方法代码示例

本文整理汇总了PHP中CRM_Core_BAO_RecurringEntity::getEntitiesForParent方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_RecurringEntity::getEntitiesForParent方法的具体用法?PHP CRM_Core_BAO_RecurringEntity::getEntitiesForParent怎么用?PHP CRM_Core_BAO_RecurringEntity::getEntitiesForParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_BAO_RecurringEntity的用法示例。


在下文中一共展示了CRM_Core_BAO_RecurringEntity::getEntitiesForParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preProcess

 public function preProcess()
 {
     parent::preProcess();
     $this->assign('currentEventId', $this->_id);
     $checkParentExistsForThisId = CRM_Core_BAO_RecurringEntity::getParentFor($this->_id, 'civicrm_event');
     //If this ID has parent, send parent id
     if ($checkParentExistsForThisId) {
         /**
          * Get connected event information list
          */
         //Get all connected event ids
         $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 = "\n            SELECT *\n            FROM civicrm_event\n            WHERE id IN (" . implode(",", $allEventIds) . ")\n            ORDER BY start_date asc\n             ";
                 $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);
         }
     }
     $parentEventParams = array('id' => $this->_id);
     $parentEventValues = array();
     $parentEventReturnProperties = array('start_date', 'end_date');
     $parentEventAttributes = CRM_Core_DAO::commonRetrieve('CRM_Event_DAO_Event', $parentEventParams, $parentEventValues, $parentEventReturnProperties);
     $this->_parentEventStartDate = $parentEventAttributes->start_date;
     $this->_parentEventEndDate = $parentEventAttributes->end_date;
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:39,代码来源:Repeat.php

示例2: whereClauseSingle

 /**
  * @param $values
  * @param $query
  */
 public static function whereClauseSingle(&$values, &$query)
 {
     list($name, $op, $value, $grouping, $wildcard) = $values;
     $fields = array_merge(CRM_Event_BAO_Event::fields(), CRM_Event_BAO_Participant::exportableFields());
     switch ($name) {
         case 'event_start_date_low':
         case 'event_start_date_high':
             $query->dateQueryBuilder($values, 'civicrm_event', 'event_start_date', 'start_date', 'Start Date');
             return;
         case 'event_end_date_low':
         case 'event_end_date_high':
             $query->dateQueryBuilder($values, 'civicrm_event', 'event_end_date', 'end_date', 'End Date');
             return;
         case 'event_include_repeating_events':
             /**
              * Include Repeating Events
              */
             //Get parent of this event
             $exEventId = '';
             if ($query->_where[$grouping]) {
                 foreach ($query->_where[$grouping] as $key => $val) {
                     if (strstr($val, 'civicrm_event.id =')) {
                         $exEventId = $val;
                         $extractEventId = explode(" ", $val);
                         $value = $extractEventId[2];
                         $where = $query->_where[$grouping][$key];
                     } else {
                         if (strstr($val, 'civicrm_event.id IN')) {
                             //extract the first event id if multiple events are selected
                             preg_match('/civicrm_event.id IN \\(\\"(\\d+)/', $val, $matches);
                             $value = $matches[1];
                             $where = $query->_where[$grouping][$key];
                         }
                     }
                 }
                 if ($exEventId) {
                     $extractEventId = explode(" ", $exEventId);
                     $value = $extractEventId[2];
                 } else {
                     if (!empty($matches[1])) {
                         $value = $matches[1];
                     }
                 }
                 $where = $query->_where[$grouping][$key];
             }
             $thisEventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($value, 'civicrm_event');
             if ($thisEventHasParent) {
                 $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 = "(" . implode(",", $allEventIds) . ")";
                 }
             }
             $query->_where[$grouping][] = "{$where} OR civicrm_event.id {$op} {$value}";
             $query->_qill[$grouping][] = ts('Include Repeating Events');
             $query->_tables['civicrm_event'] = $query->_whereTables['civicrm_event'] = 1;
             return;
         case 'participant_is_test':
             $key = array_search('civicrm_participant.is_test = 0', $query->_where[$grouping]);
             if (!empty($key)) {
                 unset($query->_where[$grouping][$key]);
             }
         case 'participant_test':
             // We dont want to include all tests for sql OR CRM-7827
             if (!$value || $query->getOperator() != 'OR') {
                 $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_participant.is_test", $op, $value, "Boolean");
                 $isTest = $value ? 'a Test' : 'not a Test';
                 $query->_qill[$grouping][] = ts("Participant is %1", array(1 => $isTest));
                 $query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
             }
             return;
         case 'participant_fee_id':
             foreach ($value as $k => &$val) {
                 $val = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $val, 'label');
                 $val = CRM_Core_DAO::escapeString(trim($val));
             }
             $feeLabel = implode('|', $value);
             $query->_where[$grouping][] = "civicrm_participant.fee_level REGEXP '{$feeLabel}'";
             $query->_qill[$grouping][] = ts("Fee level") . " IN " . implode(', ', $value);
             $query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
             return;
         case 'participant_fee_amount_high':
         case 'participant_fee_amount_low':
             $query->numberRangeBuilder($values, 'civicrm_participant', 'participant_fee_amount', 'fee_amount', 'Fee Amount');
             return;
         case 'participant_status_id':
             if ($value && is_array($value) && strpos($op, 'IN') === FALSE) {
                 $op = 'IN';
             }
         case 'participant_status':
         case 'participant_source':
         case 'participant_id':
//.........这里部分代码省略.........
开发者ID:sarehag,项目名称:civicrm-core,代码行数:101,代码来源:Query.php

示例3: run

 /**
  * Run the basic page (run essentially starts execution for that page).
  */
 public function run()
 {
     $parentEventId = $startDate = $endDate = NULL;
     $dates = $original = array();
     $formValues = $_REQUEST;
     if (!empty($formValues['entity_table'])) {
         $startDateColumnName = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['dateColumns'][0];
         $endDateColumnName = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['intervalDateColumns'][0];
         $recursion = new CRM_Core_BAO_RecurringEntity();
         if (CRM_Utils_Array::value('dateColumns', CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']])) {
             $recursion->dateColumns = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['dateColumns'];
         }
         $recursion->scheduleFormValues = $formValues;
         if (!empty($formValues['exclude_date_list'])) {
             $recursion->excludeDates = explode(',', $formValues['exclude_date_list']);
         }
         if (CRM_Utils_Array::value('excludeDateRangeColumns', CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']])) {
             $recursion->excludeDateRangeColumns = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['excludeDateRangeColumns'];
         }
         if (!empty($formValues['entity_id'])) {
             $parentEventId = CRM_Core_BAO_RecurringEntity::getParentFor($formValues['entity_id'], $formValues['entity_table']);
         }
         // Get original entity
         $original[$startDateColumnName] = CRM_Utils_Date::processDate($formValues['repetition_start_date']);
         $daoName = CRM_Core_BAO_RecurringEntity::$_tableDAOMapper[$formValues['entity_table']];
         if ($parentEventId) {
             $startDate = $original[$startDateColumnName] = CRM_Core_DAO::getFieldValue($daoName, $parentEventId, $startDateColumnName);
             $endDate = $original[$startDateColumnName] = $endDateColumnName ? CRM_Core_DAO::getFieldValue($daoName, $parentEventId, $endDateColumnName) : NULL;
         }
         //Check if there is any enddate column defined to find out the interval between the two range
         if (CRM_Utils_Array::value('intervalDateColumns', CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']])) {
             if ($endDate) {
                 $interval = $recursion->getInterval($startDate, $endDate);
                 $recursion->intervalDateColumns = array($endDateColumnName => $interval);
             }
         }
         $dates = array_merge(array($original), $recursion->generateRecursiveDates());
         foreach ($dates as $key => &$value) {
             if ($startDateColumnName) {
                 $value['start_date'] = CRM_Utils_Date::customFormat($value[$startDateColumnName]);
             }
             if ($endDateColumnName && !empty($value[$endDateColumnName])) {
                 $value['end_date'] = CRM_Utils_Date::customFormat($value[$endDateColumnName]);
                 $endDates = TRUE;
             }
         }
         //Show the list of participants registered for the events if any
         if ($formValues['entity_table'] == "civicrm_event" && !empty($parentEventId)) {
             $getConnectedEntities = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($parentEventId, 'civicrm_event', TRUE);
             if ($getConnectedEntities) {
                 $participantDetails = CRM_Event_Form_ManageEvent_Repeat::getParticipantCountforEvent($getConnectedEntities);
                 if (!empty($participantDetails['countByName'])) {
                     $this->assign('participantData', $participantDetails['countByName']);
                 }
             }
         }
     }
     $this->assign('dates', $dates);
     $this->assign('endDates', !empty($endDates));
     return parent::run();
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:64,代码来源:RecurringEntityPreview.php

示例4: whereClauseSingle

 /**
  * @param $values
  * @param $query
  */
 public static function whereClauseSingle(&$values, &$query)
 {
     list($name, $op, $value, $grouping, $wildcard) = $values;
     $fields = array_merge(CRM_Event_BAO_Event::fields(), CRM_Event_BAO_Participant::exportableFields());
     switch ($name) {
         case 'event_start_date_low':
         case 'event_start_date_high':
             $query->dateQueryBuilder($values, 'civicrm_event', 'event_start_date', 'start_date', 'Start Date');
             return;
         case 'event_end_date_low':
         case 'event_end_date_high':
             $query->dateQueryBuilder($values, 'civicrm_event', 'event_end_date', 'end_date', 'End Date');
             return;
         case 'event_include_repeating_events':
             /**
              * Include Repeating Events
              */
             //Get parent of this event
             $exEventId = '';
             if ($query->_where[$grouping]) {
                 foreach ($query->_where[$grouping] as $key => $val) {
                     if (strstr($val, 'civicrm_event.id =')) {
                         $exEventId = $val;
                         $extractEventId = explode(" ", $val);
                         $value = $extractEventId[2];
                         unset($query->_where[$grouping][$key]);
                     }
                 }
                 $extractEventId = explode(" ", $exEventId);
                 $value = $extractEventId[2];
                 unset($query->_where[$grouping][$key]);
             }
             $thisEventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($value, 'civicrm_event');
             if ($thisEventHasParent) {
                 $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 = "(" . implode(",", $allEventIds) . ")";
                 }
             }
             $query->_where[$grouping][] = "civicrm_event.id {$op} {$value}";
             $query->_qill[$grouping][] = ts('Include Repeating Events');
             $query->_tables['civicrm_event'] = $query->_whereTables['civicrm_event'] = 1;
             return;
         case 'participant_is_test':
             $key = array_search('civicrm_participant.is_test = 0', $query->_where[$grouping]);
             if (!empty($key)) {
                 unset($query->_where[$grouping][$key]);
             }
         case 'participant_test':
             // We dont want to include all tests for sql OR CRM-7827
             if (!$value || $query->getOperator() != 'OR') {
                 $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_participant.is_test", $op, $value, "Boolean");
                 if ($value) {
                     $query->_qill[$grouping][] = ts("Participant is a Test");
                 }
                 $query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
             }
             return;
         case 'participant_fee_id':
             $feeLabel = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $value, 'label');
             $feeLabel = CRM_Core_DAO::escapeString(trim($feeLabel));
             if ($value) {
                 $query->_where[$grouping][] = "civicrm_participant.fee_level LIKE '%{$feeLabel}%'";
                 $query->_qill[$grouping][] = ts("Fee level") . " contains {$feeLabel}";
             }
             $query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
             return;
         case 'participant_fee_amount_high':
         case 'participant_fee_amount_low':
             $query->numberRangeBuilder($values, 'civicrm_participant', 'participant_fee_amount', 'fee_amount', 'Fee Amount');
             return;
         case 'participant_status_id':
         case 'participant_role_id':
             if ($value && is_array($value) && strpos($op, 'IN') === FALSE) {
                 $op = 'IN';
             }
         case 'participant_status':
         case 'participant_role':
         case 'participant_source':
         case 'participant_id':
         case 'participant_contact_id':
         case 'participant_is_pay_later':
         case 'participant_fee_amount':
         case 'participant_fee_level':
             $qillName = $name;
             if (in_array($name, array('participant_status_id', 'participant_role_id', 'participant_source', 'participant_id', 'participant_contact_id', 'participant_fee_amount', 'participant_fee_level', 'participant_is_pay_later'))) {
                 $name = str_replace('participant_', '', $name);
                 if ($name == 'is_pay_later') {
                     $qillName = $name;
                 }
                 if ($name == 'role_id') {
//.........这里部分代码省略.........
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:101,代码来源:Query.php


注:本文中的CRM_Core_BAO_RecurringEntity::getEntitiesForParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。