當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Event_BAO_Event::deleteEventLocBlock方法代碼示例

本文整理匯總了PHP中CRM_Event_BAO_Event::deleteEventLocBlock方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Event_BAO_Event::deleteEventLocBlock方法的具體用法?PHP CRM_Event_BAO_Event::deleteEventLocBlock怎麽用?PHP CRM_Event_BAO_Event::deleteEventLocBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Event_BAO_Event的用法示例。


在下文中一共展示了CRM_Event_BAO_Event::deleteEventLocBlock方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: postProcess

 /**
  * Function to process the form
  *
  * @access public
  * @return None
  */
 public function postProcess()
 {
     $params = $this->exportValues();
     $delteOldBlock = false;
     // if 'use existing location' option is selected -
     if ($params['location_option'] == 2 && CRM_Utils_Array::value('loc_event_id', $params) && $params['loc_event_id'] != $this->_oldLocBlockId) {
         // if new selected loc is different from old loc, update the loc_block_id
         // so that loc update would affect the selected loc and not the old one.
         $delteOldBlock = true;
         CRM_Core_DAO::setFieldValue('CRM_Event_DAO_Event', $this->_id, 'loc_block_id', $params['loc_event_id']);
     }
     // if 'create new loc' option is selected, set the loc_block_id for this event to null
     // so that an update would result in creating a new loc.
     if ($this->_oldLocBlockId && $params['location_option'] == 1) {
         $delteOldBlock = true;
         CRM_Core_DAO::setFieldValue('CRM_Event_DAO_Event', $this->_id, 'loc_block_id', 'null');
     }
     // if 'create new loc' optioin is selected OR selected new loc is different
     // from old one, go ahead and delete the old loc provided thats not being
     // used by any other event
     if ($this->_oldLocBlockId && $delteOldBlock) {
         CRM_Event_BAO_Event::deleteEventLocBlock($this->_oldLocBlockId, $this->_id);
     }
     // get ready with location block params
     $params['entity_table'] = 'civicrm_event';
     $params['entity_id'] = $this->_id;
     require_once 'CRM/Core/BAO/LocationType.php';
     $defaultLocationType =& CRM_Core_BAO_LocationType::getDefault();
     foreach (array('address', 'phone', 'email') as $block) {
         if (!CRM_Utils_Array::value($block, $params) || !is_array($params[$block])) {
             continue;
         }
         foreach ($params[$block] as $count => &$values) {
             if ($count == 1) {
                 $values['is_primary'] = 1;
             }
             $values['location_type_id'] = $defaultLocationType->id ? $defaultLocationType->id : 1;
         }
     }
     // create/update event location
     require_once 'CRM/Core/BAO/Location.php';
     $location = CRM_Core_BAO_Location::create($params, true, 'event');
     $params['loc_block_id'] = $location['id'];
     // finally update event params
     $params['id'] = $this->_id;
     require_once 'CRM/Event/BAO/Event.php';
     CRM_Event_BAO_Event::add($params);
     parent::endPostProcess();
 }
開發者ID:ksecor,項目名稱:civicrm,代碼行數:55,代碼來源:Location.php


注:本文中的CRM_Event_BAO_Event::deleteEventLocBlock方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。