本文整理汇总了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];
}
示例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];
}