本文整理汇总了PHP中CRM_Core_BAO_Email::dataExists方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Email::dataExists方法的具体用法?PHP CRM_Core_BAO_Email::dataExists怎么用?PHP CRM_Core_BAO_Email::dataExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Email
的用法示例。
在下文中一共展示了CRM_Core_BAO_Email::dataExists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* takes an associative array and creates a contact object
*
* the function extract all the params it needs to initialize the create a
* contact object. the params array could contain additional unused name/value
* pairs
*
* @param array $params (reference ) an assoc array of name/value pairs
* @param array $ids the array that holds all the db ids
* @param int $locationId
* @param int $emailId
* @param bool $isPrimary Has any previous entry been marked as isPrimary?
*
* @return object CRM_Core_BAO_Email object if successful
* else null will be returned
* @access public
* @static
*/
function add(&$params, &$ids, $locationId, $emailId, &$isPrimary)
{
// if no data and we are not updating an exisiting record
if (!CRM_Core_BAO_Email::dataExists($params, $locationId, $emailId, $ids)) {
return null;
}
$email =& new CRM_Core_DAO_Email();
$email->id = CRM_Utils_Array::value($emailId, $ids['location'][$locationId]['email']);
$email->email = $params['location'][$locationId]['email'][$emailId]['email'];
if (empty($email->email)) {
$email->delete();
return null;
}
$email->location_id = $params['location'][$locationId]['id'];
// set this object to be the value of isPrimary and make sure no one else can be isPrimary
$email->is_primary = $isPrimary;
$isPrimary = false;
return $email->save();
}
示例2: dataExists
/**
* Check if there is data to create the object
*
* @param array $params (reference ) an assoc array of name/value pairs
* @param array $locationId
* @param array $ids (reference ) the array that holds all the db ids
*
* @return boolean
* @access public
* @static
*/
function dataExists(&$params, $locationId, &$ids)
{
if (CRM_Utils_Array::value('id', $ids['location'][$locationId])) {
return true;
}
// return if no data present
if (!array_key_exists('location', $params) || !array_key_exists($locationId, $params['location'])) {
return false;
}
//if location name exits return true
if (CRM_Utils_Array::value('name', $params['location'][$locationId])) {
return true;
}
if (CRM_Core_BAO_Address::dataExists($params, $locationId, $ids)) {
return true;
}
for ($i = 1; $i <= CRM_CONTACT_FORM_LOCATION_BLOCKS; $i++) {
if (CRM_Core_BAO_Phone::dataExists($params, $locationId, $i, $ids) || CRM_Core_BAO_Email::dataExists($params, $locationId, $i, $ids) || CRM_Core_BAO_IM::dataExists($params, $locationId, $i, $ids)) {
return true;
}
}
return false;
}