本文整理汇总了PHP中CRM_Core_BAO_CustomField::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomField::orderBy方法的具体用法?PHP CRM_Core_BAO_CustomField::orderBy怎么用?PHP CRM_Core_BAO_CustomField::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_CustomField
的用法示例。
在下文中一共展示了CRM_Core_BAO_CustomField::orderBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browse
/**
* Browse all custom group fields.
*
* @return void
*/
public function browse()
{
$resourceManager = CRM_Core_Resources::singleton();
if (!empty($_GET['new']) && $resourceManager->ajaxPopupsEnabled) {
$resourceManager->addScriptFile('civicrm', 'js/crm.addNew.js', 999, 'html-header');
}
$customField = array();
$customFieldBAO = new CRM_Core_BAO_CustomField();
// fkey is gid
$customFieldBAO->custom_group_id = $this->_gid;
$customFieldBAO->orderBy('weight, label');
$customFieldBAO->find();
while ($customFieldBAO->fetch()) {
$customField[$customFieldBAO->id] = array();
CRM_Core_DAO::storeValues($customFieldBAO, $customField[$customFieldBAO->id]);
$action = array_sum(array_keys($this->actionLinks()));
if ($customFieldBAO->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
switch ($customFieldBAO->data_type) {
case "String":
case "Int":
case "Float":
case "Money":
// if Multi Select field is selected in custom field
if ($customFieldBAO->html_type == 'Text') {
$action -= CRM_Core_Action::BROWSE;
}
break;
case "ContactReference":
case "Memo":
case "Date":
case "Boolean":
case "StateProvince":
case "Country":
case "File":
case "Link":
$action -= CRM_Core_Action::BROWSE;
break;
}
$customFieldDataType = CRM_Core_BAO_CustomField::dataType();
$customField[$customFieldBAO->id]['data_type'] = $customFieldDataType[$customField[$customFieldBAO->id]['data_type']];
$customField[$customFieldBAO->id]['order'] = $customField[$customFieldBAO->id]['weight'];
$customField[$customFieldBAO->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $customFieldBAO->id, 'gid' => $this->_gid), ts('more'), FALSE, 'customField.row.actions', 'CustomField', $customFieldBAO->id);
}
$returnURL = CRM_Utils_System::url('civicrm/admin/custom/group/field', "reset=1&action=browse&gid={$this->_gid}");
$filter = "custom_group_id = {$this->_gid}";
CRM_Utils_Weight::addOrder($customField, 'CRM_Core_DAO_CustomField', 'id', $returnURL, $filter);
$this->assign('customField', $customField);
}
示例2: browse
/**
* Browse all custom group fields.
*
* @param null
*
* @return void
* @access public
*/
function browse()
{
require_once 'CRM/Core/BAO/CustomField.php';
$customField = array();
$customFieldBAO = new CRM_Core_BAO_CustomField();
// fkey is gid
$customFieldBAO->custom_group_id = $this->_gid;
$customFieldBAO->orderBy('weight, label');
$customFieldBAO->find();
while ($customFieldBAO->fetch()) {
$customField[$customFieldBAO->id] = array();
CRM_Core_DAO::storeValues($customFieldBAO, $customField[$customFieldBAO->id]);
$action = array_sum(array_keys($this->actionLinks()));
if ($customFieldBAO->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
switch ($customFieldBAO->data_type) {
case "String":
case "Int":
case "Float":
case "Money":
// if Multi Select field is selected in custom field
if ($customFieldBAO->html_type == 'Text') {
$action -= CRM_Core_Action::BROWSE;
}
break;
case "ContactReference":
case "Memo":
case "Date":
case "Boolean":
case "StateProvince":
case "Country":
case "File":
case "Link":
$action -= CRM_Core_Action::BROWSE;
break;
}
$customFieldDataType = CRM_Core_BAO_CustomField::dataType();
$customField[$customFieldBAO->id]['data_type'] = $customFieldDataType[$customField[$customFieldBAO->id]['data_type']];
$customField[$customFieldBAO->id]['order'] = $customField[$customFieldBAO->id]['weight'];
$customField[$customFieldBAO->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $customFieldBAO->id, 'gid' => $this->_gid));
}
$returnURL = CRM_Utils_System::url('civicrm/admin/custom/group/field', "reset=1&action=browse&gid={$this->_gid}");
$filter = "custom_group_id = {$this->_gid}";
require_once 'CRM/Utils/Weight.php';
CRM_Utils_Weight::addOrder($customField, 'CRM_Core_DAO_CustomField', 'id', $returnURL, $filter);
$this->assign('customField', $customField);
}