本文整理汇总了PHP中CRM_Core_SelectValues::getDedupeRuleTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_SelectValues::getDedupeRuleTypes方法的具体用法?PHP CRM_Core_SelectValues::getDedupeRuleTypes怎么用?PHP CRM_Core_SelectValues::getDedupeRuleTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_SelectValues
的用法示例。
在下文中一共展示了CRM_Core_SelectValues::getDedupeRuleTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* Pre processing.
*
* @return void
*/
public function preProcess()
{
// Ensure user has permission to be here
if (!CRM_Core_Permission::check('administer dedupe rules')) {
CRM_Utils_System::permissionDenied();
CRM_Utils_System::civiExit();
}
$this->_options = CRM_Core_SelectValues::getDedupeRuleTypes();
$this->_rgid = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
$this->_contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, FALSE, 0);
if ($this->_rgid) {
$rgDao = new CRM_Dedupe_DAO_RuleGroup();
$rgDao->id = $this->_rgid;
$rgDao->find(TRUE);
$this->_defaults['threshold'] = $rgDao->threshold;
$this->_contactType = $rgDao->contact_type;
$this->_defaults['used'] = CRM_Utils_Array::key($rgDao->used, $this->_options);
$this->_defaults['title'] = $rgDao->title;
$this->_defaults['name'] = $rgDao->name;
$this->_defaults['is_reserved'] = $rgDao->is_reserved;
$this->assign('isReserved', $rgDao->is_reserved);
$this->assign('ruleName', $rgDao->name);
$ruleDao = new CRM_Dedupe_DAO_Rule();
$ruleDao->dedupe_rule_group_id = $this->_rgid;
$ruleDao->find();
$count = 0;
while ($ruleDao->fetch()) {
$this->_defaults["where_{$count}"] = "{$ruleDao->rule_table}.{$ruleDao->rule_field}";
$this->_defaults["length_{$count}"] = $ruleDao->rule_length;
$this->_defaults["weight_{$count}"] = $ruleDao->rule_weight;
$count++;
}
}
$supported = CRM_Dedupe_BAO_RuleGroup::supportedFields($this->_contactType);
if (is_array($supported)) {
foreach ($supported as $table => $fields) {
foreach ($fields as $field => $title) {
$this->_fields["{$table}.{$field}"] = $title;
}
}
}
asort($this->_fields);
}
示例2: browse
/**
* Browse all rule groups.
*/
public function browse()
{
// get all rule groups
$ruleGroups = array();
$dao = new CRM_Dedupe_DAO_RuleGroup();
$dao->orderBy('contact_type,used ASC');
$dao->find();
$dedupeRuleTypes = CRM_Core_SelectValues::getDedupeRuleTypes();
while ($dao->fetch()) {
$ruleGroups[$dao->contact_type][$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $ruleGroups[$dao->contact_type][$dao->id]);
// form all action links
$action = array_sum(array_keys($this->links()));
$links = self::links();
/* if ($dao->is_default) {
unset($links[CRM_Core_Action::MAP]);
unset($links[CRM_Core_Action::DELETE]);
}*/
if ($dao->is_reserved) {
unset($links[CRM_Core_Action::DELETE]);
}
$ruleGroups[$dao->contact_type][$dao->id]['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $dao->id), ts('more'), FALSE, 'dedupeRule.manage.action', 'DedupeRule', $dao->id);
$ruleGroups[$dao->contact_type][$dao->id]['used_display'] = $dedupeRuleTypes[$ruleGroups[$dao->contact_type][$dao->id]['used']];
}
$this->assign('brows', $ruleGroups);
}