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


PHP CRM_Core_BAO_Location::deleteLocBlock方法代码示例

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


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

示例1: deleteEventLocBlock

 /**
  * Function to delete the location block associated with an event, 
  * if not being used by any other event.
  *
  * @param int $loc_block_id    location block id to be deleted
  * @param int $eventid         event id with which loc block is associated
  *
  * @access public
  * @static
  *
  */
 static function deleteEventLocBlock($locBlockId, $eventId = null)
 {
     $query = "SELECT count(ce.id) FROM civicrm_event ce WHERE ce.loc_block_id = {$locBlockId}";
     if ($eventId) {
         $query .= " AND ce.id != {$eventId};";
     }
     $locCount = CRM_Core_DAO::singleValueQuery($query);
     if ($locCount == 0) {
         require_once 'CRM/Core/BAO/Location.php';
         CRM_Core_BAO_Location::deleteLocBlock($locBlockId);
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:23,代码来源:Event.php

示例2: testDeleteLocBlock

 /**
  * DeleteLocBlock() method
  * delete the location block
  * created with various elements.
  */
 public function testDeleteLocBlock()
 {
     $this->_contactId = $this->individualCreate();
     //create test event record.
     $event = $this->eventCreate();
     $params['location'][1] = array('location_type_id' => 1, 'is_primary' => 1, 'address' => array('street_address' => 'Saint Helier St', 'supplemental_address_1' => 'Hallmark Ct', 'supplemental_address_2' => 'Jersey Village', 'city' => 'Newark', 'postal_code' => '01903', 'country_id' => 1228, 'state_province_id' => 1029, 'geo_code_1' => '18.219023', 'geo_code_2' => '-105.00973'), 'email' => array('1' => array('email' => 'john.smith@example.org')), 'phone' => array('1' => array('phone_type_id' => 1, 'phone' => '303443689'), '2' => array('phone_type_id' => 2, 'phone' => '9833910234')), 'im' => array('1' => array('name' => 'jane.doe', 'provider_id' => 1)));
     $params['entity_id'] = $event['id'];
     $params['entity_table'] = 'civicrm_event';
     //create location block.
     //with various elements
     //like address, phone, email, im.
     $location = CRM_Core_BAO_Location::create($params, NULL, TRUE);
     $locBlockId = CRM_Utils_Array::value('id', $location);
     //update event record with location block id
     $eventParams = array('id' => $event['id'], 'loc_block_id' => $locBlockId);
     CRM_Event_BAO_Event::add($eventParams);
     //delete the location block
     CRM_Core_BAO_Location::deleteLocBlock($locBlockId);
     //Now check DB for location elements.
     //Now check DB for Address
     $this->assertDBNull('CRM_Core_DAO_Address', 'Saint Helier St', 'id', 'street_address', 'Database check, Address deleted successfully.');
     //Now check DB for Email
     $this->assertDBNull('CRM_Core_DAO_Email', 'john.smith@example.org', 'id', 'email', 'Database check, Email deleted successfully.');
     //Now check DB for Phone
     $this->assertDBNull('CRM_Core_DAO_Phone', '303443689', 'id', 'phone', 'Database check, Phone deleted successfully.');
     //Now check DB for Mobile
     $this->assertDBNull('CRM_Core_DAO_Phone', '9833910234', 'id', 'phone', 'Database check, Mobile deleted successfully.');
     //Now check DB for IM
     $this->assertDBNull('CRM_Core_DAO_IM', 'jane.doe', 'id', 'name', 'Database check, IM deleted successfully.');
     //cleanup DB by deleting the record.
     $this->eventDelete($event['id']);
     $this->contactDelete($this->_contactId);
     //Now check DB for Event
     $this->assertDBNull('CRM_Event_DAO_Event', $event['id'], 'id', 'id', 'Database check, Event deleted successfully.');
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:40,代码来源:LocationTest.php

示例3: deleteEventLocBlock

 /**
  * Delete the location block associated with an event,
  * if not being used by any other event.
  *
  * @param $locBlockId
  *   Location block id to be deleted.
  * @param int $eventId
  *   Event with which loc block is associated.
  *
  */
 public static function deleteEventLocBlock($locBlockId, $eventId = NULL)
 {
     $query = "SELECT count(ce.id) FROM civicrm_event ce WHERE ce.loc_block_id = {$locBlockId}";
     if ($eventId) {
         $query .= " AND ce.id != {$eventId};";
     }
     $locCount = CRM_Core_DAO::singleValueQuery($query);
     if ($locCount == 0) {
         CRM_Core_BAO_Location::deleteLocBlock($locBlockId);
     }
 }
开发者ID:hoegrammer,项目名称:civicrm-core,代码行数:21,代码来源:Event.php


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