本文整理汇总了PHP中CRM_Core_PseudoConstant::mappingTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_PseudoConstant::mappingTypes方法的具体用法?PHP CRM_Core_PseudoConstant::mappingTypes怎么用?PHP CRM_Core_PseudoConstant::mappingTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_PseudoConstant
的用法示例。
在下文中一共展示了CRM_Core_PseudoConstant::mappingTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action == CRM_Core_Action::DELETE) {
return;
} else {
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'name'), TRUE);
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_Mapping', $this->_id));
$this->addElement('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'description'));
$mappingType = $this->addElement('select', 'mapping_type_id', ts('Mapping Type'), CRM_Core_PseudoConstant::mappingTypes());
if ($this->_action == CRM_Core_Action::UPDATE) {
$mappingType->freeze();
}
}
}
示例2: browse
/**
* browse all entities.
*
* @param int $action
*
* @return void
* @access public
*/
function browse($action = null, $sort)
{
$links =& $this->links();
if ($action == null) {
if (!empty($links)) {
$action = array_sum(array_keys($links));
}
}
if ($action & CRM_Core_Action::DISABLE) {
$action -= CRM_Core_Action::DISABLE;
}
if ($action & CRM_Core_Action::ENABLE) {
$action -= CRM_Core_Action::ENABLE;
}
eval('$object =& new ' . $this->getBAOName() . '( );');
$values = array();
/*
* lets make sure we get the stuff sorted by name if it exists
*/
$fields =& $object->fields();
$key = '';
if (CRM_Utils_Array::value('title', $fields)) {
$key = 'title';
} else {
if (CRM_Utils_Array::value('label', $fields)) {
$key = 'label';
} else {
if (CRM_Utils_Array::value('name', $fields)) {
$key = 'name';
}
}
}
if (trim($sort)) {
$object->orderBy($sort);
} else {
if ($key) {
$object->orderBy($key . ' asc');
}
}
// find all objects
$object->find();
while ($object->fetch()) {
if (!isset($object->mapping_type_id) || $object->mapping_type_id != 1) {
// "1 for Search Builder"
$permission = CRM_Core_Permission::EDIT;
if ($key) {
$permission = $this->checkPermission($object->id, $object->{$key});
}
if ($permission) {
$values[$object->id] = array();
CRM_Core_DAO::storeValues($object, $values[$object->id]);
require_once 'CRM/Contact/DAO/RelationshipType.php';
CRM_Contact_DAO_RelationshipType::addDisplayEnums($values[$object->id]);
// populate action links
$this->action($object, $action, $values[$object->id], $links, $permission);
if (isset($object->mapping_type_id)) {
require_once 'CRM/Core/PseudoConstant.php';
$mappintTypes = CRM_Core_PseudoConstant::mappingTypes();
$values[$object->id]['mapping_type'] = $mappintTypes[$object->mapping_type_id];
}
}
$this->assign('rows', $values);
}
}
}