本文整理汇总了PHP中CRM_Core_Dao::getFieldValue方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Dao::getFieldValue方法的具体用法?PHP CRM_Core_Dao::getFieldValue怎么用?PHP CRM_Core_Dao::getFieldValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Dao
的用法示例。
在下文中一共展示了CRM_Core_Dao::getFieldValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_PreferencesDate');
$this->applyFilter('__ALL__', 'trim');
$name =& $this->add('text', 'name', ts('Name'), $attributes['name'], true);
$name->freeze();
$this->add('text', 'description', ts('Description'), $attributes['description'], false);
$this->add('text', 'start', ts('Start Offset'), $attributes['start'], true);
$this->add('text', 'end', ts('End Offset'), $attributes['end'], true);
$formatType = CRM_Core_Dao::getFieldValue('CRM_Core_DAO_PreferencesDate', $this->_id, 'name');
if ($formatType == 'creditCard') {
$this->add('text', 'date_format', ts('Format'), $attributes['date_format'], true);
} else {
$this->add('select', 'date_format', ts('Format'), array('' => ts('- default input format -')) + CRM_Core_SelectValues::getDatePluginInputFormats());
$this->add('select', 'time_format', ts('Time'), array('' => ts('- none -')) + CRM_Core_SelectValues::getTimeFormats());
}
$this->addRule('start', ts('Value should be a positive number'), 'positiveInteger');
$this->addRule('end', ts('Value should be a positive number'), 'positiveInteger');
// add a form rule
$this->addFormRule(array('CRM_Admin_Form_PreferencesDate', 'formRule'));
}
示例2: getDateFormat
/**
* Function get date format
* @param string $formatType Date name e.g. birth
*
* @return string $format
*/
static function getDateFormat($formatType = null)
{
$format = null;
if ($formatType) {
$format = CRM_Core_Dao::getFieldValue('CRM_Core_DAO_PreferencesDate', $formatType, 'date_format', 'name');
}
if (!$format) {
$config = CRM_Core_Config::singleton();
$format = $config->dateInputFormat;
}
return $format;
}
示例3: format
//.........这里部分代码省略.........
}
}
}
foreach (array('prefix', 'suffix') as $name) {
$phpName = $name;
$dbName = "{$name}_id";
$vals = "{$name}es";
$value = $individual->{$dbName};
if (in_array($name, $useDBNames)) {
$params[$dbName] = $value;
$contact->{$dbName} = $value;
if ($value) {
$temp = ${$vals};
${$phpName} = $temp[$value];
} else {
${$phpName} = null;
}
} else {
if (array_key_exists($dbName, $params)) {
$temp = ${$vals};
// CRM-5278
if (!empty($params[$dbName])) {
${$phpName} = CRM_Utils_Array::value($params[$dbName], $temp);
}
} else {
if ($value) {
$temp = ${$vals};
${$phpName} = $temp[$value];
}
}
}
}
}
}
if ($lastName || $firstName || $middleName) {
if ($lastName && $firstName) {
$contact->sort_name = trim("{$lastName}, {$firstName}");
} else {
$contact->sort_name = trim("{$lastName} {$firstName}");
}
$display_name = trim("{$prefix} {$firstName} {$middleName} {$lastName} {$suffix}");
$display_name = str_replace(' ', ' ', $display_name);
}
if (isset($display_name) && trim($display_name)) {
$contact->display_name = trim($display_name);
}
if (CRM_Utils_Array::value('email', $params) && is_array($params['email'])) {
foreach ($params['email'] as $emailBlock) {
if (isset($emailBlock['is_primary'])) {
$email = $emailBlock['email'];
break;
}
}
}
$uniqId = CRM_Utils_Array::value('user_unique_id', $params);
if (empty($contact->display_name)) {
if (isset($email)) {
$contact->display_name = $email;
} else {
if (isset($uniqId)) {
$contact->display_name = $uniqId;
}
}
}
if (empty($contact->sort_name)) {
if (isset($email)) {
$contact->sort_name = $email;
} else {
if (isset($uniqId)) {
$contact->sort_name = $uniqId;
}
}
}
$format = CRM_Core_Dao::getFieldValue('CRM_Core_DAO_PreferencesDate', 'birth', 'date_format', 'name');
if ($date = CRM_Utils_Array::value('birth_date', $params)) {
if (in_array($format, array('dd/mm', 'mm/dd'))) {
$date = "{$date}/1902";
}
$contact->birth_date = CRM_Utils_Date::processDate($date);
//$contact->birth_date = preg_replace('/[^0-9]/', '', $date);
} else {
if ($contact->birth_date) {
$contact->birth_date = CRM_Utils_Date::isoToMysql($contact->birth_date);
}
}
if ($date = CRM_Utils_Array::value('deceased_date', $params)) {
if (in_array($format, array('dd/mm', 'mm/dd'))) {
$date = "{$date}/1902";
}
$contact->deceased_date = CRM_Utils_Date::processDate($date);
} else {
if ($contact->deceased_date) {
$contact->deceased_date = CRM_Utils_Date::isoToMysql($contact->deceased_date);
}
}
if ($middle_name = CRM_Utils_Array::value('middle_name', $params)) {
$contact->middle_name = $middle_name;
}
return $contact;
}
示例4: qfBirthDate
/**
* check the validity of the birth date (in qf format)
* note that only a year is valid, or a mon-year or day-month is
* also valid in addition to day-mon-year
*
* @param array $date
*
* @return bool true if valid date
* @static
* @access public
*/
static function qfBirthDate($date)
{
//if birth format is not set then execute qfDate function
if (!CRM_Core_Dao::getFieldValue('CRM_Core_DAO_PreferencesDate', 'birth', 'format', 'name')) {
return self::qfDate($date);
}
$config =& CRM_Core_Config::singleton();
$d = CRM_Utils_Array::value('d', $date);
$m = CRM_Utils_Array::value($config->dateformatMonthVar, $date);
$y = CRM_Utils_Array::value('Y', $date);
if (!$d && !$m && !$y) {
return true;
}
if (in_array('', $date)) {
return false;
}
$day = $mon = 1;
$year = 1000;
if ($d) {
$day = $d;
}
if ($m) {
$mon = $m;
}
if ($y) {
$year = $y;
}
if (!empty($day) || !empty($mon) || !empty($year)) {
return checkdate($mon, $day, $year);
}
return false;
}
示例5: setDateDefaults
/**
* Function to convert mysql to date plugin format
*
* @param string $mysqlDate date string
*
* @return array $date and time
*/
static function setDateDefaults($mysqlDate = null, $formatType = null, $format = null, $timeFormat = null)
{
// if date is not passed assume it as today
if (!$mysqlDate) {
$mysqlDate = date('Y-m-d G:i:s');
}
$config =& CRM_Core_Config::singleton();
if ($formatType) {
$format = CRM_Core_Dao::getFieldValue('CRM_Core_DAO_PreferencesDate', $formatType, 'format', 'name');
}
if (!$format) {
$format = $config->dateInputFormat;
}
// get actual format
$actualPHPFormats = CRM_Core_SelectValues::datePluginToPHPFormats();
$dateFormat = $actualPHPFormats[$format];
$date = date($dateFormat, strtotime($mysqlDate));
if (!$timeFormat) {
$timeFormat = $config->timeInputFormat;
}
$actualTimeFormat = "g:iA";
$appendZeroLength = 7;
if ($timeFormat > 1) {
$actualTimeFormat = "G:i";
$appendZeroLength = 5;
}
$time = date($actualTimeFormat, strtotime($mysqlDate));
// need to append zero for hours < 10
if (strlen($time) < $appendZeroLength) {
$time = '0' . $time;
}
return array($date, $time);
}