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


PHP CRM_Event_BAO_Event::countEventsUsingLocBlockId方法代码示例

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


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

示例1: getLocBlock

 function getLocBlock()
 {
     // i wish i could retrieve loc block info based on loc_block_id,
     // Anyway, lets retrieve an event which has loc_block_id set to 'lbid'.
     if ($_POST['lbid']) {
         $params = array('1' => array($_POST['lbid'], 'Integer'));
         $eventId = CRM_Core_DAO::singleValueQuery('SELECT id FROM civicrm_event WHERE loc_block_id=%1 LIMIT 1', $params);
     }
     // now lets use the event-id obtained above, to retrieve loc block information.
     if ($eventId) {
         $params = array('entity_id' => $eventId, 'entity_table' => 'civicrm_event');
         require_once 'CRM/Core/BAO/Location.php';
         // second parameter is of no use, but since required, lets use the same variable.
         $location = CRM_Core_BAO_Location::getValues($params, $params);
     }
     $result = array();
     require_once 'CRM/Core/BAO/Preferences.php';
     $addressOptions = CRM_Core_BAO_Preferences::valueOptions('address_options', true, null, true);
     // lets output only required fields.
     foreach ($addressOptions as $element => $isSet) {
         if ($isSet && !in_array($element, array('im', 'openid'))) {
             if (in_array($element, array('country', 'state_province', 'county'))) {
                 $element .= '_id';
             } else {
                 if ($element == 'address_name') {
                     $element = 'name';
                 }
             }
             $fld = "address[1][{$element}]";
             $value = CRM_Utils_Array::value($element, $location['address'][1]);
             $value = $value ? $value : "";
             $result[str_replace(array('][', '[', "]"), array('_', '_', ''), $fld)] = $value;
         }
     }
     foreach (array('email', 'phone_type_id', 'phone') as $element) {
         $block = $element == 'phone_type_id' ? 'phone' : $element;
         for ($i = 1; $i < 3; $i++) {
             $fld = "{$block}[{$i}][{$element}]";
             $value = CRM_Utils_Array::value($element, $location[$block][$i]);
             $value = $value ? $value : "";
             $result[str_replace(array('][', '[', "]"), array('_', '_', ''), $fld)] = $value;
         }
     }
     // set the message if loc block is being used by more than one event.
     require_once 'CRM/Event/BAO/Event.php';
     $result['count_loc_used'] = CRM_Event_BAO_Event::countEventsUsingLocBlockId($_POST['lbid']);
     echo json_encode($result);
     exit;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:49,代码来源:Location.php

示例2: setDefaultValues

 /**
  * This function sets the default values for the form. Note that in edit/view mode
  * the default values are retrieved from the database
  *
  * @access public
  *
  * @return void
  */
 function setDefaultValues()
 {
     $defaults = $this->_values;
     if (!empty($defaults['loc_block_id'])) {
         $defaults['loc_event_id'] = $defaults['loc_block_id'];
         $countLocUsed = CRM_Event_BAO_Event::countEventsUsingLocBlockId($defaults['loc_block_id']);
         if ($countLocUsed > 1) {
             $this->assign('locUsed', TRUE);
         }
     }
     $config = CRM_Core_Config::singleton();
     if (!isset($defaults['address'][1]['country_id'])) {
         $defaults['address'][1]['country_id'] = $config->defaultContactCountry;
     }
     if (!isset($defaults['address'][1]['state_province_id'])) {
         $defaults['address'][1]['state_province_id'] = $config->defaultContactStateProvince;
     }
     $defaults['location_option'] = $this->_oldLocBlockId ? 2 : 1;
     return $defaults;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:28,代码来源:Location.php

示例3: setDefaultValues

 /**
  * This function sets the default values for the form. Note that in edit/view mode
  * the default values are retrieved from the database
  * 
  * @access public
  * @return None
  */
 function setDefaultValues()
 {
     $defaults = $this->_values;
     if (CRM_Utils_Array::value('loc_block_id', $defaults)) {
         $defaults['loc_event_id'] = $defaults['loc_block_id'];
         $countLocUsed = CRM_Event_BAO_Event::countEventsUsingLocBlockId($defaults['loc_block_id']);
         if ($countLocUsed > 1) {
             $this->assign('locUsed', true);
         }
     }
     require_once 'CRM/Contact/Form/Edit/Address.php';
     if (!empty($defaults['address'])) {
         $config = CRM_Core_Config::singleton();
         foreach ($defaults['address'] as $key => $value) {
             CRM_Contact_Form_Edit_Address::fixStateSelect($this, "address[{$key}][country_id]", "address[{$key}][state_province_id]", CRM_Utils_Array::value('country_id', CRM_Utils_Array::value('address', $defaults), $config->defaultContactCountry));
         }
     }
     $defaults['location_option'] = $this->_oldLocBlockId ? 2 : 1;
     return $defaults;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:27,代码来源:Location.php

示例4: setDefaultValues

 /**
  * This function sets the default values for the form. Note that in edit/view mode
  * the default values are retrieved from the database
  *
  * @access public
  *
  * @return None
  */
 function setDefaultValues()
 {
     $defaults = $this->_values;
     if (CRM_Utils_Array::value('loc_block_id', $defaults)) {
         $defaults['loc_event_id'] = $defaults['loc_block_id'];
         $countLocUsed = CRM_Event_BAO_Event::countEventsUsingLocBlockId($defaults['loc_block_id']);
         if ($countLocUsed > 1) {
             $this->assign('locUsed', TRUE);
         }
     }
     $config = CRM_Core_Config::singleton();
     if (!isset($defaults['address'][1]['country_id'])) {
         $defaults['address'][1]['country_id'] = $config->defaultContactCountry;
     }
     if (!isset($defaults['address'][1]['state_province_id'])) {
         $defaults['address'][1]['state_province_id'] = $config->defaultContactStateProvince;
     }
     if (!empty($defaults['address'])) {
         foreach ($defaults['address'] as $key => $value) {
             CRM_Contact_Form_Edit_Address::fixStateSelect($this, "address[{$key}][country_id]", "address[{$key}][state_province_id]", "address[{$key}][county_id]", CRM_Utils_Array::value('country_id', $value, $config->defaultContactCountry), CRM_Utils_Array::value('state_province_id', $value));
         }
     }
     $defaults['location_option'] = $this->_oldLocBlockId ? 2 : 1;
     return $defaults;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:33,代码来源:Location.php


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