本文整理汇总了PHP中CRM_Core_BAO_UFField::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_UFField::orderBy方法的具体用法?PHP CRM_Core_BAO_UFField::orderBy怎么用?PHP CRM_Core_BAO_UFField::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_UFField
的用法示例。
在下文中一共展示了CRM_Core_BAO_UFField::orderBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browse
/**
* Browse all CiviCRM Profile group fields.
*
* @return void
* @access public
* @static
*/
function browse()
{
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
$ufField = array();
$ufFieldBAO = new CRM_Core_BAO_UFField();
// fkey is gid
$ufFieldBAO->uf_group_id = $this->_gid;
$ufFieldBAO->orderBy('weight', 'field_name');
$ufFieldBAO->find();
$otherModules = CRM_Core_BAO_UFGroup::getUFJoinRecord($this->_gid);
$this->assign('otherModules', $otherModules);
$isGroupReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'is_reserved');
$this->assign('isGroupReserved', $isGroupReserved);
$profileType = CRM_Core_BAO_UFField::getProfileType($this->_gid);
if ($profileType == 'Contribution' || $profileType == 'Membership' || $profileType == 'Activity' || $profileType == 'Participant') {
$this->assign('skipCreate', TRUE);
}
$locationType = array();
$locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
$fields = CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE);
$fields = array_merge(CRM_Contribute_BAO_Contribution::getContributionFields(), $fields);
$select = array();
foreach ($fields as $name => $field) {
if ($name) {
$select[$name] = $field['title'];
}
}
$select['group'] = ts('Group(s)');
$select['tag'] = ts('Tag(s)');
$visibility = CRM_Core_SelectValues::ufVisibility();
while ($ufFieldBAO->fetch()) {
$ufField[$ufFieldBAO->id] = array();
$phoneType = $locType = '';
CRM_Core_DAO::storeValues($ufFieldBAO, $ufField[$ufFieldBAO->id]);
$ufField[$ufFieldBAO->id]['visibility_display'] = $visibility[$ufFieldBAO->visibility];
$ufField[$ufFieldBAO->id]['label'] = $ufFieldBAO->label;
$action = array_sum(array_keys($this->actionLinks()));
if ($ufFieldBAO->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
if ($ufFieldBAO->is_reserved) {
$action -= CRM_Core_Action::UPDATE;
$action -= CRM_Core_Action::DISABLE;
$action -= CRM_Core_Action::DELETE;
}
$ufField[$ufFieldBAO->id]['order'] = $ufField[$ufFieldBAO->id]['weight'];
$ufField[$ufFieldBAO->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $ufFieldBAO->id, 'gid' => $this->_gid), ts('more'), FALSE, 'ufField.row.actions', 'UFField', $ufFieldBAO->id);
}
$returnURL = CRM_Utils_System::url('civicrm/admin/uf/group/field', "reset=1&action=browse&gid={$this->_gid}");
$filter = "uf_group_id = {$this->_gid}";
CRM_Utils_Weight::addOrder($ufField, 'CRM_Core_DAO_UFField', 'id', $returnURL, $filter);
$this->assign('ufField', $ufField);
// retrieve showBestResult from session
$session = CRM_Core_Session::singleton();
$showBestResult = $session->get('showBestResult');
$this->assign('showBestResult', $showBestResult);
$session->set('showBestResult', 0);
}
示例2: browse
/**
* Browse all CiviCRM Profile group fields.
*
* @return void
* @access public
* @static
*/
function browse()
{
$ufField = array();
$ufFieldBAO = new CRM_Core_BAO_UFField();
// fkey is gid
$ufFieldBAO->uf_group_id = $this->_gid;
$ufFieldBAO->orderBy('weight', 'field_name');
$ufFieldBAO->find();
require_once "CRM/Core/BAO/UFField.php";
$profileType = CRM_Core_BAO_UFField::getProfileType($this->_gid);
if ($profileType == 'Contribution' || $profileType == 'Membership' || $profileType == 'Activity' || $profileType == 'Participant') {
$this->assign('skipCreate', true);
}
$locationType = array();
$locationType =& CRM_Core_PseudoConstant::locationType();
require_once 'CRM/Contact/BAO/Contact.php';
$fields =& CRM_Contact_BAO_Contact::exportableFields('All', false, true);
require_once "CRM/Contribute/BAO/Contribution.php";
$fields = array_merge(CRM_Contribute_BAO_Contribution::getContributionFields(), $fields);
if (CRM_Core_Permission::access('Quest')) {
require_once 'CRM/Quest/BAO/Student.php';
$fields = array_merge(CRM_Quest_BAO_Student::exportableFields(), $fields);
}
$select = array();
foreach ($fields as $name => $field) {
if ($name) {
$select[$name] = $field['title'];
}
}
$select['group'] = ts('Group(s)');
$select['tag'] = ts('Tag(s)');
while ($ufFieldBAO->fetch()) {
$ufField[$ufFieldBAO->id] = array();
$phoneType = $locType = '';
CRM_Core_DAO::storeValues($ufFieldBAO, $ufField[$ufFieldBAO->id]);
CRM_Core_DAO_UFField::addDisplayEnums($ufField[$ufFieldBAO->id]);
$ufField[$ufFieldBAO->id]['label'] = $ufFieldBAO->label;
$action = array_sum(array_keys($this->actionLinks()));
if ($ufFieldBAO->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
if ($ufFieldBAO->is_reserved) {
$action -= CRM_Core_Action::UPDATE;
$action -= CRM_Core_Action::DISABLE;
$action -= CRM_Core_Action::DELETE;
}
$ufField[$ufFieldBAO->id]['order'] = $ufField[$ufFieldBAO->id]['weight'];
$ufField[$ufFieldBAO->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $ufFieldBAO->id, 'gid' => $this->_gid));
}
$returnURL = CRM_Utils_System::url('civicrm/admin/uf/group/field', "reset=1&action=browse&gid={$this->_gid}");
$filter = "uf_group_id = {$this->_gid}";
require_once 'CRM/Utils/Weight.php';
CRM_Utils_Weight::addOrder($ufField, 'CRM_Core_DAO_UFField', 'id', $returnURL, $filter);
$this->assign('ufField', $ufField);
// retrieve showBestResult from session
$session = CRM_Core_Session::singleton();
$showBestResult = $session->get('showBestResult');
$this->assign('showBestResult', $showBestResult);
$session->set('showBestResult', 0);
}