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


PHP CRM_Core_BAO_RecurringEntity::getParentFor方法代码示例

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


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

示例1: preProcess

 /**
  * @param $entityTable
  */
 public static function preProcess($entityTable)
 {
     self::$_entityId = (int) CRM_Utils_Request::retrieve('id', 'Positive');
     self::$_entityTable = $entityTable;
     if (self::$_entityId && $entityTable) {
         $checkParentExistsForThisId = CRM_Core_BAO_RecurringEntity::getParentFor(self::$_entityId, $entityTable);
         if ($checkParentExistsForThisId) {
             self::$_hasParent = TRUE;
             self::$_parentEntityId = $checkParentExistsForThisId;
             self::$_scheduleReminderDetails = CRM_Core_BAO_RecurringEntity::getReminderDetailsByEntityId($checkParentExistsForThisId, $entityTable);
         } else {
             self::$_parentEntityId = self::$_entityId;
             self::$_scheduleReminderDetails = CRM_Core_BAO_RecurringEntity::getReminderDetailsByEntityId(self::$_entityId, $entityTable);
         }
         if (property_exists(self::$_scheduleReminderDetails, 'id')) {
             self::$_scheduleReminderID = self::$_scheduleReminderDetails->id;
         }
     }
     CRM_Core_OptionValue::getValues(array('name' => $entityTable . '_repeat_exclude_dates_' . self::$_parentEntityId), $optionValue);
     $excludeOptionValues = array();
     if (!empty($optionValue)) {
         foreach ($optionValue as $key => $val) {
             $excludeOptionValues[$val['value']] = substr(CRM_Utils_Date::mysqlToIso($val['value']), 0, 10);
         }
         self::$_excludeDateInfo = $excludeOptionValues;
     }
     // Assign variables
     $entityType = CRM_Core_DAO_AllCoreTables::getBriefName(CRM_Core_DAO_AllCoreTables::getClassForTable($entityTable));
     $tpl = CRM_Core_Smarty::singleton();
     $tpl->assign('recurringEntityType', ts($entityType));
     $tpl->assign('currentEntityId', self::$_entityId);
     $tpl->assign('entityTable', self::$_entityTable);
     $tpl->assign('scheduleReminderId', self::$_scheduleReminderID);
     $tpl->assign('hasParent', self::$_hasParent);
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:38,代码来源:RecurringEntity.php

示例2: 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:JSProffitt,项目名称:civicrm-website-org,代码行数:39,代码来源:Repeat.php

示例3: 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

示例4: process

 /**
  * @param CRM_Event_Form_ManageEvent $form
  *
  * @return array
  * @throws Exception
  */
 public static function process(&$form)
 {
     if ($form->getVar('_id') <= 0) {
         return NULL;
     }
     $default = array('link' => NULL, 'valid' => TRUE, 'active' => TRUE, 'current' => FALSE, 'class' => 'ajaxForm');
     $tabs = array();
     $tabs['settings'] = array('title' => ts('Info and Settings'), 'class' => 'ajaxForm livePage') + $default;
     $tabs['location'] = array('title' => ts('Event Location')) + $default;
     $tabs['fee'] = array('title' => ts('Fees')) + $default;
     $tabs['registration'] = array('title' => ts('Online Registration')) + $default;
     if (CRM_Core_Permission::check('administer CiviCRM') || CRM_Event_BAO_Event::checkPermission(NULL, CRM_Core_Permission::EDIT)) {
         $tabs['reminder'] = array('title' => ts('Schedule Reminders'), 'class' => 'livePage') + $default;
     }
     $tabs['conference'] = array('title' => ts('Conference Slots')) + $default;
     $tabs['friend'] = array('title' => ts('Tell a Friend')) + $default;
     $tabs['pcp'] = array('title' => ts('Personal Campaigns')) + $default;
     $tabs['repeat'] = array('title' => ts('Repeat')) + $default;
     // Repeat tab must refresh page when switching repeat mode so js & vars will get set-up
     if (!$form->_isRepeatingEvent) {
         unset($tabs['repeat']['class']);
     }
     // check if we're in shopping cart mode for events
     $enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart');
     if (!$enableCart) {
         unset($tabs['conference']);
     }
     $eventID = $form->getVar('_id');
     if ($eventID) {
         // disable tabs based on their configuration status
         $sql = "\nSELECT     e.loc_block_id as is_location, e.is_online_registration, e.is_monetary, taf.is_active, pcp.is_active as is_pcp, sch.id as is_reminder, re.id as is_repeating_event\nFROM       civicrm_event e\nLEFT JOIN  civicrm_tell_friend taf ON ( taf.entity_table = 'civicrm_event' AND taf.entity_id = e.id )\nLEFT JOIN  civicrm_pcp_block pcp   ON ( pcp.entity_table = 'civicrm_event' AND pcp.entity_id = e.id )\nLEFT JOIN  civicrm_action_mapping  map ON ( map.entity_value = 'civicrm_event' )\nLEFT JOIN  civicrm_action_schedule sch ON ( sch.mapping_id = map.id AND sch.entity_value = %1 )\nLEFT JOIN  civicrm_recurring_entity re ON ( e.id = re.entity_id AND re.entity_table = 'civicrm_event' )\nWHERE      e.id = %1\n";
         //Check if repeat is configured
         $eventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($eventID, 'civicrm_event');
         $params = array(1 => array($eventID, 'Integer'));
         $dao = CRM_Core_DAO::executeQuery($sql, $params);
         if (!$dao->fetch()) {
             CRM_Core_Error::fatal();
         }
         if (!$dao->is_location) {
             $tabs['location']['valid'] = FALSE;
         }
         if (!$dao->is_online_registration) {
             $tabs['registration']['valid'] = FALSE;
         }
         if (!$dao->is_monetary) {
             $tabs['fee']['valid'] = FALSE;
         }
         if (!$dao->is_active) {
             $tabs['friend']['valid'] = FALSE;
         }
         if (!$dao->is_pcp) {
             $tabs['pcp']['valid'] = FALSE;
         }
         if (!$dao->is_reminder) {
             $tabs['reminder']['valid'] = FALSE;
         }
         if (!$dao->is_repeating_event) {
             $tabs['repeat']['valid'] = FALSE;
         }
     }
     // see if any other modules want to add any tabs
     // note: status of 'valid' flag of any injected tab, needs to be taken care in the hook implementation.
     CRM_Utils_Hook::tabset('civicrm/event/manage', $tabs, array('event_id' => $eventID));
     $fullName = $form->getVar('_name');
     $className = CRM_Utils_String::getClassName($fullName);
     $new = '';
     // hack for special cases.
     switch ($className) {
         case 'Event':
             $attributes = $form->getVar('_attributes');
             $class = strtolower(basename(CRM_Utils_Array::value('action', $attributes)));
             break;
         case 'EventInfo':
             $class = 'settings';
             break;
         case 'ScheduleReminders':
             $class = 'reminder';
             break;
         default:
             $class = strtolower($className);
             break;
     }
     if (array_key_exists($class, $tabs)) {
         $tabs[$class]['current'] = TRUE;
         $qfKey = $form->get('qfKey');
         if ($qfKey) {
             $tabs[$class]['qfKey'] = "&qfKey={$qfKey}";
         }
     }
     if ($eventID) {
         $reset = !empty($_GET['reset']) ? 'reset=1&' : '';
         foreach ($tabs as $key => $value) {
             if (!isset($tabs[$key]['qfKey'])) {
                 $tabs[$key]['qfKey'] = NULL;
//.........这里部分代码省略.........
开发者ID:agloa,项目名称:tournament,代码行数:101,代码来源:TabHeader.php

示例5: postProcess

 /**
  * Process the form submission.
  *
  *
  * @param array $params
  * @return array|null
  */
 public function postProcess($params = NULL)
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         $deleteParams = array('id' => $this->_activityId);
         $moveToTrash = CRM_Case_BAO_Case::isCaseActivity($this->_activityId);
         CRM_Activity_BAO_Activity::deleteActivity($deleteParams, $moveToTrash);
         // delete tags for the entity
         $tagParams = array('entity_table' => 'civicrm_activity', 'entity_id' => $this->_activityId);
         CRM_Core_BAO_EntityTag::del($tagParams);
         CRM_Core_Session::setStatus(ts("Selected Activity has been deleted successfully."), ts('Record Deleted'), 'success');
         return NULL;
     }
     // store the submitted values in an array
     if (!$params) {
         $params = $this->controller->exportValues($this->_name);
     }
     // Set activity type id.
     if (empty($params['activity_type_id'])) {
         $params['activity_type_id'] = $this->_activityTypeId;
     }
     if (!empty($params['hidden_custom']) && !isset($params['custom'])) {
         $customFields = CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, $this->_activityTypeId);
         $customFields = CRM_Utils_Array::crmArrayMerge($customFields, CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, NULL, NULL, TRUE));
         $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->_activityId, 'Activity');
     }
     // store the date with proper format
     $params['activity_date_time'] = CRM_Utils_Date::processDate($params['activity_date_time'], $params['activity_date_time_time']);
     // format params as arrays
     foreach (array('target', 'assignee', 'followup_assignee') as $name) {
         if (!empty($params["{$name}_contact_id"])) {
             $params["{$name}_contact_id"] = explode(',', $params["{$name}_contact_id"]);
         } else {
             $params["{$name}_contact_id"] = array();
         }
     }
     // get ids for associated contacts
     if (!$params['source_contact_id']) {
         $params['source_contact_id'] = $this->_currentUserId;
     }
     if (isset($this->_activityId)) {
         $params['id'] = $this->_activityId;
     }
     // add attachments as needed
     CRM_Core_BAO_File::formatAttachment($params, $params, 'civicrm_activity', $this->_activityId);
     $activity = array();
     if (!empty($params['is_multi_activity']) && !CRM_Utils_Array::crmIsEmptyArray($params['target_contact_id'])) {
         $targetContacts = $params['target_contact_id'];
         foreach ($targetContacts as $targetContactId) {
             $params['target_contact_id'] = array($targetContactId);
             // save activity
             $activity[] = $this->processActivity($params);
         }
     } else {
         // save activity
         $activity = $this->processActivity($params);
     }
     $activityIds = empty($this->_activityIds) ? array($this->_activityId) : $this->_activityIds;
     foreach ($activityIds as $activityId) {
         // set params for repeat configuration in create mode
         $params['entity_id'] = $activityId;
         $params['entity_table'] = 'civicrm_activity';
         if (!empty($params['entity_id']) && !empty($params['entity_table'])) {
             $checkParentExistsForThisId = CRM_Core_BAO_RecurringEntity::getParentFor($params['entity_id'], $params['entity_table']);
             if ($checkParentExistsForThisId) {
                 $params['parent_entity_id'] = $checkParentExistsForThisId;
                 $scheduleReminderDetails = CRM_Core_BAO_RecurringEntity::getReminderDetailsByEntityId($checkParentExistsForThisId, $params['entity_table']);
             } else {
                 $params['parent_entity_id'] = $params['entity_id'];
                 $scheduleReminderDetails = CRM_Core_BAO_RecurringEntity::getReminderDetailsByEntityId($params['entity_id'], $params['entity_table']);
             }
             if (property_exists($scheduleReminderDetails, 'id')) {
                 $params['schedule_reminder_id'] = $scheduleReminderDetails->id;
             }
         }
         $params['dateColumns'] = array('activity_date_time');
         // Set default repetition start if it was not provided.
         if (empty($params['repetition_start_date'])) {
             $params['repetition_start_date'] = $params['activity_date_time'];
         }
         // unset activity id
         unset($params['id']);
         $linkedEntities = array(array('table' => 'civicrm_activity_contact', 'findCriteria' => array('activity_id' => $activityId), 'linkedColumns' => array('activity_id'), 'isRecurringEntityRecord' => FALSE));
         CRM_Core_Form_RecurringEntity::postProcess($params, 'civicrm_activity', $linkedEntities);
     }
     return array('activity' => $activity);
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:93,代码来源:Activity.php

示例6: postProcess

 public function postProcess()
 {
     if ($this->_id) {
         $params = $this->controller->exportValues($this->_name);
         if ($this->_parentEventStartDate && $this->_parentEventEndDate) {
             $interval = CRM_Core_BAO_RecurringEntity::getInterval($this->_parentEventStartDate, $this->_parentEventEndDate);
             $params['intervalDateColumns'] = array('end_date' => $interval);
         }
         $params['dateColumns'] = array('start_date');
         $params['excludeDateRangeColumns'] = array('start_date', 'end_date');
         $params['entity_table'] = 'civicrm_event';
         $params['entity_id'] = $this->_id;
         // CRM-16568 - check if parent exist for the event.
         $parentId = CRM_Core_BAO_RecurringEntity::getParentFor($this->_id, 'civicrm_event');
         $params['parent_entity_id'] = !empty($parentId) ? $parentId : $params['entity_id'];
         //Unset event id
         unset($params['id']);
         $url = 'civicrm/event/manage/repeat';
         $urlParams = "action=update&reset=1&id={$this->_id}";
         $linkedEntities = array(array('table' => 'civicrm_price_set_entity', 'findCriteria' => array('entity_id' => $this->_id, 'entity_table' => 'civicrm_event'), 'linkedColumns' => array('entity_id'), 'isRecurringEntityRecord' => FALSE), array('table' => 'civicrm_uf_join', 'findCriteria' => array('entity_id' => $this->_id, 'entity_table' => 'civicrm_event'), 'linkedColumns' => array('entity_id'), 'isRecurringEntityRecord' => FALSE), array('table' => 'civicrm_tell_friend', 'findCriteria' => array('entity_id' => $this->_id, 'entity_table' => 'civicrm_event'), 'linkedColumns' => array('entity_id'), 'isRecurringEntityRecord' => TRUE), array('table' => 'civicrm_pcp_block', 'findCriteria' => array('entity_id' => $this->_id, 'entity_table' => 'civicrm_event'), 'linkedColumns' => array('entity_id'), 'isRecurringEntityRecord' => TRUE));
         CRM_Core_Form_RecurringEntity::postProcess($params, 'civicrm_event', $linkedEntities);
         CRM_Utils_System::redirect(CRM_Utils_System::url($url, $urlParams));
     } else {
         CRM_Core_Error::fatal("Could not find Event ID");
     }
     parent::endPostProcess();
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:27,代码来源:Repeat.php

示例7: preProcess

 /**
  * Set variables up before form is built.
  *
  * @return void
  */
 public function preProcess()
 {
     $config = CRM_Core_Config::singleton();
     if (in_array('CiviEvent', $config->enableComponents)) {
         $this->assign('CiviEvent', TRUE);
     }
     CRM_Core_Form_RecurringEntity::preProcess('civicrm_event');
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add', 'REQUEST');
     $this->assign('action', $this->_action);
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, NULL, 'GET');
     if ($this->_id) {
         $this->_isRepeatingEvent = CRM_Core_BAO_RecurringEntity::getParentFor($this->_id, 'civicrm_event');
         $this->assign('eventId', $this->_id);
         if (!empty($this->_addBlockName) && empty($this->_addProfileBottom) && empty($this->_addProfileBottomAdd)) {
             $this->add('hidden', 'id', $this->_id);
         }
         $this->_single = TRUE;
         $params = array('id' => $this->_id);
         CRM_Event_BAO_Event::retrieve($params, $eventInfo);
         // its an update mode, do a permission check
         if (!CRM_Event_BAO_Event::checkPermission($this->_id, CRM_Core_Permission::EDIT)) {
             CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
         }
         $participantListingID = CRM_Utils_Array::value('participant_listing_id', $eventInfo);
         //CRM_Core_DAO::getFieldValue( 'CRM_Event_DAO_Event', $this->_id, 'participant_listing_id' );
         if ($participantListingID) {
             $participantListingURL = CRM_Utils_System::url('civicrm/event/participant', "reset=1&id={$this->_id}", TRUE, NULL, TRUE, TRUE);
             $this->assign('participantListingURL', $participantListingURL);
         }
         $this->assign('isOnlineRegistration', CRM_Utils_Array::value('is_online_registration', $eventInfo));
         $this->assign('id', $this->_id);
     }
     // figure out whether we’re handling an event or an event template
     if ($this->_id) {
         $this->_isTemplate = CRM_Utils_Array::value('is_template', $eventInfo);
     } elseif ($this->_action & CRM_Core_Action::ADD) {
         $this->_isTemplate = CRM_Utils_Request::retrieve('is_template', 'Boolean', $this);
     }
     $this->assign('isTemplate', $this->_isTemplate);
     if ($this->_id) {
         if ($this->_isTemplate) {
             $title = CRM_Utils_Array::value('template_title', $eventInfo);
             CRM_Utils_System::setTitle(ts('Edit Event Template') . " - {$title}");
         } else {
             $configureText = ts('Configure Event');
             $title = CRM_Utils_Array::value('title', $eventInfo);
             //If it is a repeating event change title
             if ($this->_isRepeatingEvent) {
                 $configureText = 'Configure Repeating Event';
             }
             CRM_Utils_System::setTitle($configureText . " - {$title}");
         }
         $this->assign('title', $title);
     } elseif ($this->_action & CRM_Core_Action::ADD) {
         if ($this->_isTemplate) {
             $title = ts('New Event Template');
             CRM_Utils_System::setTitle($title);
         } else {
             $title = ts('New Event');
             CRM_Utils_System::setTitle($title);
         }
         $this->assign('title', $title);
     }
     if (CRM_Core_Permission::check('view event participants') && CRM_Core_Permission::check('view all contacts')) {
         $statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1', 'label');
         $statusTypesPending = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 0', 'label');
         $findParticipants['statusCounted'] = implode(', ', array_values($statusTypes));
         $findParticipants['statusNotCounted'] = implode(', ', array_values($statusTypesPending));
         $this->assign('findParticipants', $findParticipants);
     }
     $this->_templateId = (int) CRM_Utils_Request::retrieve('template_id', 'Integer', $this);
     //Is a repeating event
     if ($this->_isRepeatingEvent) {
         $isRepeatingEntity = TRUE;
         $this->assign('isRepeatingEntity', $isRepeatingEntity);
     }
     // CRM-16776 - show edit/copy/create buttons for Profiles if user has required permission.
     $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
     $ufCreate = CRM_ACL_API::group(CRM_Core_Permission::CREATE, NULL, 'civicrm_uf_group', $ufGroups);
     $ufEdit = CRM_ACL_API::group(CRM_Core_Permission::EDIT, NULL, 'civicrm_uf_group', $ufGroups);
     $checkPermission = array(array('administer CiviCRM', 'manage event profiles'));
     if (CRM_Core_Permission::check($checkPermission) || !empty($ufCreate) || !empty($ufEdit)) {
         $this->assign('perm', TRUE);
     }
     // also set up tabs
     CRM_Event_Form_ManageEvent_TabHeader::build($this);
     // Set Done button URL and breadcrumb. Templates go back to Manage Templates,
     // otherwise go to Manage Event for new event or ManageEventEdit if event if exists.
     $breadCrumb = array();
     if (!$this->_isTemplate) {
         if ($this->_id) {
             $this->_doneUrl = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "action=update&reset=1&id={$this->_id}");
         } else {
             $this->_doneUrl = CRM_Utils_System::url('civicrm/event/manage', 'reset=1');
             $breadCrumb = array(array('title' => ts('Manage Events'), 'url' => $this->_doneUrl));
//.........这里部分代码省略.........
开发者ID:agloa,项目名称:tournament,代码行数:101,代码来源:ManageEvent.php

示例8: 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

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