本文整理汇总了PHP中CRM_Contact_DAO_RelationshipType::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_DAO_RelationshipType::fetch方法的具体用法?PHP CRM_Contact_DAO_RelationshipType::fetch怎么用?PHP CRM_Contact_DAO_RelationshipType::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_DAO_RelationshipType
的用法示例。
在下文中一共展示了CRM_Contact_DAO_RelationshipType::fetch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: civicrm_relationship_types_get
/**
* Function to get all relationship type
* retruns An array of Relationship_type
* * @access public
*/
function civicrm_relationship_types_get($params = null)
{
_civicrm_initialize();
require_once 'CRM/Contact/DAO/RelationshipType.php';
$relationshipTypes = array();
$relationshipType = array();
$relationType = new CRM_Contact_DAO_RelationshipType();
if (!empty($params) && is_array($params)) {
$properties = array_keys($relationType->fields());
foreach ($properties as $name) {
if (array_key_exists($name, $params)) {
$relationType->{$name} = $params[$name];
}
}
}
$relationType->find();
while ($relationType->fetch()) {
_civicrm_object_to_array(clone $relationType, $relationshipType);
$relationshipTypes[] = $relationshipType;
}
return $relationshipTypes;
}
示例2: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
//to save the current mappings
if (!$this->get('savedMapping')) {
$saveDetailsName = ts('Save this field mapping');
$this->applyFilter('saveMappingName', 'trim');
$this->add('text', 'saveMappingName', ts('Name'));
$this->add('text', 'saveMappingDesc', ts('Description'));
} else {
$savedMapping = $this->get('savedMapping');
list($mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingImProvider, $mappingRelation, $mappingOperator, $mappingValue, $mappingWebsiteType) = CRM_Core_BAO_Mapping::getMappingFields($savedMapping);
//get loaded Mapping Fields
$mappingName = CRM_Utils_Array::value(1, $mappingName);
$mappingContactType = CRM_Utils_Array::value(1, $mappingContactType);
$mappingLocation = CRM_Utils_Array::value(1, $mappingLocation);
$mappingPhoneType = CRM_Utils_Array::value(1, $mappingPhoneType);
$mappingImProvider = CRM_Utils_Array::value(1, $mappingImProvider);
$mappingRelation = CRM_Utils_Array::value(1, $mappingRelation);
$mappingWebsiteType = CRM_Utils_Array::value(1, $mappingWebsiteType);
$this->assign('loadedMapping', $savedMapping);
$this->set('loadedMapping', $savedMapping);
$params = array('id' => $savedMapping);
$temp = array();
$mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp);
$this->assign('savedName', $mappingDetails->name);
$this->add('hidden', 'mappingId', $savedMapping);
$this->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), NULL);
$saveDetailsName = ts('Save as a new field mapping');
$this->add('text', 'saveMappingName', ts('Name'));
$this->add('text', 'saveMappingDesc', ts('Description'));
}
$this->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, array('onclick' => "showSaveDetails(this)"));
$this->addFormRule(array('CRM_Contact_Import_Form_MapField', 'formRule'));
//-------- end of saved mapping stuff ---------
$defaults = array();
$mapperKeys = array_keys($this->_mapperFields);
$hasColumnNames = !empty($this->_columnNames);
$columnPatterns = $this->get('columnPatterns');
$dataPatterns = $this->get('dataPatterns');
$hasLocationTypes = $this->get('fieldTypes');
$this->_location_types = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
$defaultLocationType = CRM_Core_BAO_LocationType::getDefault();
// Pass default location to js
if ($defaultLocationType) {
$this->assign('defaultLocationType', $defaultLocationType->id);
$this->assign('defaultLocationTypeLabel', $this->_location_types[$defaultLocationType->id]);
}
/* Initialize all field usages to false */
foreach ($mapperKeys as $key) {
$this->_fieldUsed[$key] = FALSE;
}
$sel1 = $this->_mapperFields;
$sel2[''] = NULL;
$phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
$imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
$websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
foreach ($this->_location_types as $key => $value) {
$sel3['phone'][$key] =& $phoneTypes;
//build array for IM service provider type for contact
$sel3['im'][$key] =& $imProviders;
}
$sel4 = NULL;
// store and cache all relationship types
$contactRelation = new CRM_Contact_DAO_RelationshipType();
$contactRelation->find();
while ($contactRelation->fetch()) {
$contactRelationCache[$contactRelation->id] = array();
$contactRelationCache[$contactRelation->id]['contact_type_a'] = $contactRelation->contact_type_a;
$contactRelationCache[$contactRelation->id]['contact_sub_type_a'] = $contactRelation->contact_sub_type_a;
$contactRelationCache[$contactRelation->id]['contact_type_b'] = $contactRelation->contact_type_b;
$contactRelationCache[$contactRelation->id]['contact_sub_type_b'] = $contactRelation->contact_sub_type_b;
}
$highlightedFields = $highlightedRelFields = array();
$highlightedFields['email'] = 'All';
$highlightedFields['external_identifier'] = 'All';
$highlightedFields['first_name'] = 'Individual';
$highlightedFields['last_name'] = 'Individual';
$highlightedFields['household_name'] = 'Household';
$highlightedFields['organization_name'] = 'Organization';
foreach ($mapperKeys as $key) {
// check if there is a _a_b or _b_a in the key
if (strpos($key, '_a_b') || strpos($key, '_b_a')) {
list($id, $first, $second) = explode('_', $key);
} else {
$id = $first = $second = NULL;
}
if ($first == 'a' && $second == 'b' || $first == 'b' && $second == 'a') {
$cType = $contactRelationCache[$id]["contact_type_{$second}"];
//CRM-5125 for contact subtype specific relationshiptypes
$cSubType = NULL;
if (!empty($contactRelationCache[$id]["contact_sub_type_{$second}"])) {
$cSubType = $contactRelationCache[$id]["contact_sub_type_{$second}"];
}
if (!$cType) {
$cType = 'All';
}
$relatedFields = array();
//.........这里部分代码省略.........
示例3: array
/**
* Get all Relationship Types from database.
*
* The static array group is returned, and if it's
* called the first time, the <b>RelationshipType DAO</b> is used
* to get all the relationship types.
*
* Note: any database errors will be trapped by the DAO.
*
* @param string $valueColumnName db column name/label.
* @param boolean $reset reset relationship types if true
*
* @access public
* @static
*
* @return array - array reference of all relationship types.
*/
public static function &relationshipType($valueColumnName = 'label', $reset = FALSE)
{
if (!CRM_Utils_Array::value($valueColumnName, self::$relationshipType) || $reset) {
self::$relationshipType[$valueColumnName] = array();
//now we have name/label columns CRM-3336
$column_a_b = "{$valueColumnName}_a_b";
$column_b_a = "{$valueColumnName}_b_a";
$relationshipTypeDAO = new CRM_Contact_DAO_RelationshipType();
$relationshipTypeDAO->selectAdd();
$relationshipTypeDAO->selectAdd("id, {$column_a_b}, {$column_b_a}, contact_type_a, contact_type_b, contact_sub_type_a, contact_sub_type_b");
$relationshipTypeDAO->is_active = 1;
$relationshipTypeDAO->find();
while ($relationshipTypeDAO->fetch()) {
self::$relationshipType[$valueColumnName][$relationshipTypeDAO->id] = array('id' => $relationshipTypeDAO->id, $column_a_b => $relationshipTypeDAO->{$column_a_b}, $column_b_a => $relationshipTypeDAO->{$column_b_a}, 'contact_type_a' => "{$relationshipTypeDAO->contact_type_a}", 'contact_type_b' => "{$relationshipTypeDAO->contact_type_b}", 'contact_sub_type_a' => "{$relationshipTypeDAO->contact_sub_type_a}", 'contact_sub_type_b' => "{$relationshipTypeDAO->contact_sub_type_b}");
}
}
return self::$relationshipType[$valueColumnName];
}