当前位置: 首页>>代码示例>>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;未经允许,请勿转载。