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


PHP CRM_Core_DAO_OptionValue::import方法代码示例

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


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

示例1: getFields

 /**
  * Check if there is a record with the same name in the db.
  *
  * @param string $mode
  * @param string $contactType
  *
  * @return bool
  *   true if object exists
  */
 public static function getFields($mode = '', $contactType = 'Individual')
 {
     $key = "{$mode} {$contactType}";
     if (empty(self::$_fields[$key]) || !self::$_fields[$key]) {
         self::$_fields[$key] = array();
         $option = CRM_Core_DAO_OptionValue::import();
         foreach (array_keys($option) as $id) {
             $optionName = $option[$id];
         }
         $nameTitle = array();
         if ($mode == 'contribute') {
             $nameTitle = array('payment_instrument' => array('name' => 'payment_instrument', 'title' => ts('Payment Method'), 'headerPattern' => '/^payment|(p(ayment\\s)?instrument)$/i'));
         } elseif ($mode == '') {
             //the fields email greeting and postal greeting are meant only for Individual and Household
             //the field addressee is meant for all contact types, CRM-4575
             if (in_array($contactType, array('Individual', 'Household', 'Organization', 'All'))) {
                 $nameTitle = array('addressee' => array('name' => 'addressee', 'title' => ts('Addressee'), 'headerPattern' => '/^addressee$/i'));
                 $title = array('email_greeting' => array('name' => 'email_greeting', 'title' => ts('Email Greeting'), 'headerPattern' => '/^email_greeting$/i'), 'postal_greeting' => array('name' => 'postal_greeting', 'title' => ts('Postal Greeting'), 'headerPattern' => '/^postal_greeting$/i'));
                 $nameTitle = array_merge($nameTitle, $title);
             }
         }
         if (is_array($nameTitle)) {
             foreach ($nameTitle as $name => $attribs) {
                 self::$_fields[$key][$name] = $optionName;
                 list($tableName, $fieldName) = explode('.', $optionName['where']);
                 self::$_fields[$key][$name]['where'] = "{$name}.label";
                 foreach ($attribs as $k => $val) {
                     self::$_fields[$key][$name][$k] = $val;
                 }
             }
         }
     }
     return self::$_fields[$key];
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:43,代码来源:OptionValue.php

示例2: getFields

 /**
  * Check if there is a record with the same name in the db
  *
  * @param string $value     the value of the field we are checking
  * @param string $daoName   the dao object name
  * @param string $daoID     the id of the object being updated. u can change your name
  *                          as long as there is no conflict
  * @param string $fieldName the name of the field in the DAO
  *
  * @return boolean     true if object exists
  * @access public
  * @static
  */
 static function getFields($mode = '', $contactType = 'Individual')
 {
     $key = "{$mode} {$contactType}";
     if (empty(self::$_fields[$key]) || !self::$_fields[$key]) {
         self::$_fields[$key] = array();
         require_once "CRM/Core/DAO/OptionValue.php";
         $option = CRM_Core_DAO_OptionValue::import();
         foreach (array_keys($option) as $id) {
             $optionName = $option[$id];
         }
         $nameTitle = array();
         if ($mode == 'contribute') {
             $nameTitle = array('payment_instrument' => array('name' => 'payment_instrument', 'title' => 'Payment Instrument', 'headerPattern' => '/^payment|(p(ayment\\s)?instrument)$/i'));
         } else {
             if ($mode == '') {
                 //the fields email greeting and postal greeting are meant only for Individual and Household
                 //the field addressee is meant for all contact types, CRM-4575
                 if (in_array($contactType, array('Individual', 'Household', 'Organization', 'All'))) {
                     $nameTitle = array('addressee' => array('name' => 'addressee', 'title' => 'Addressee', 'headerPattern' => '/^addressee$/i'));
                 }
                 if ($contactType == 'Individual' || $contactType == 'Household' || $contactType == 'All') {
                     $title = array('email_greeting' => array('name' => 'email_greeting', 'title' => 'Email Greeting', 'headerPattern' => '/^email_greeting$/i'), 'postal_greeting' => array('name' => 'postal_greeting', 'title' => 'Postal Greeting', 'headerPattern' => '/^postal_greeting$/i'));
                     $nameTitle = array_merge($nameTitle, $title);
                 }
                 if ($contactType == 'Individual' || $contactType == 'All') {
                     $title = array('gender' => array('name' => 'gender', 'title' => 'Gender', 'headerPattern' => '/^gender$/i'), 'individual_prefix' => array('name' => 'individual_prefix', 'title' => 'Individual Prefix', 'headerPattern' => '/^(prefix|title)/i'), 'individual_suffix' => array('name' => 'individual_suffix', 'title' => 'Individual Suffix', 'headerPattern' => '/^suffix$/i'));
                     $nameTitle = array_merge($nameTitle, $title);
                 }
             }
         }
         if (is_array($nameTitle)) {
             foreach ($nameTitle as $name => $attribs) {
                 self::$_fields[$key][$name] = $optionName;
                 list($tableName, $fieldName) = explode('.', $optionName['where']);
                 // not sure of this fix, so keeping it commented for now
                 // this is from CRM-1541
                 // self::$_fields[$mode][$name]['where'] = $name . '.' . $fieldName;
                 self::$_fields[$key][$name]['where'] = "{$name}.label";
                 foreach ($attribs as $k => $val) {
                     self::$_fields[$key][$name][$k] = $val;
                 }
             }
         }
     }
     return self::$_fields[$key];
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:59,代码来源:OptionValue.php


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