本文整理汇总了PHP中CRM_Core_DAO_UFJoin::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO_UFJoin::orderBy方法的具体用法?PHP CRM_Core_DAO_UFJoin::orderBy怎么用?PHP CRM_Core_DAO_UFJoin::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_DAO_UFJoin
的用法示例。
在下文中一共展示了CRM_Core_DAO_UFJoin::orderBy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultValues
/**
* This function sets the default values for the form.
* the default values are retrieved from the database
*
* @access public
* @return None
*/
function setDefaultValues()
{
$eventId = $this->_id;
$defaults = parent::setDefaultValues();
$this->setShowHide($defaults);
if (isset($eventId)) {
$params = array('id' => $eventId);
CRM_Event_BAO_Event::retrieve($params, $defaults);
require_once 'CRM/Core/BAO/UFJoin.php';
$ufJoinParams = array('entity_table' => 'civicrm_event', 'module' => 'CiviEvent', 'entity_id' => $eventId);
list($defaults['custom_pre_id'], $defaults['custom_post_id']) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
if ($defaults['is_multiple_registrations']) {
// CRM-4377: set additional participants’ profiles – set to ‘none’ if explicitly unset (non-active)
$ufJoin = new CRM_Core_DAO_UFJoin();
$ufJoin->module = 'CiviEvent_Additional';
$ufJoin->entity_table = 'civicrm_event';
$ufJoin->entity_id = $eventId;
$ufJoin->orderBy('weight');
$ufJoin->find();
$custom = array(1 => 'additional_custom_pre_id', 2 => 'additional_custom_post_id');
while ($ufJoin->fetch()) {
$defaults[$custom[$ufJoin->weight]] = $ufJoin->is_active ? $ufJoin->uf_group_id : 'none';
}
}
} else {
$defaults['is_email_confirm'] = 0;
}
// provide defaults for required fields if empty (and as a 'hint' for approval message field)
$defaults['registration_link_text'] = CRM_Utils_Array::value('registration_link_text', $defaults, ts('Register Now'));
$defaults['confirm_title'] = CRM_Utils_Array::value('confirm_title', $defaults, ts('Confirm Your Registration Information'));
$defaults['thankyou_title'] = CRM_Utils_Array::value('thankyou_title', $defaults, ts('Thank You for Registering'));
$defaults['approval_req_text'] = CRM_Utils_Array::value('approval_req_text', $defaults, ts('Participation in this event requires approval. Submit your registration request here. Once approved, you will receive an email with a link to a web page where you can complete the registration process.'));
if (CRM_Utils_Array::value('registration_start_date', $defaults)) {
list($defaults['registration_start_date'], $defaults['registration_start_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['registration_start_date'], 'activityDateTime');
}
if (CRM_Utils_Array::value('registration_end_date', $defaults)) {
list($defaults['registration_end_date'], $defaults['registration_end_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['registration_end_date'], 'activityDateTime');
}
return $defaults;
}
示例2: getUFGroupIds
/**
* @param array $params
*
* @return array
*/
public static function getUFGroupIds(&$params)
{
$dao = new CRM_Core_DAO_UFJoin();
// CRM-4377 (ab)uses the module column
if (isset($params['module'])) {
$dao->module = CRM_Utils_Array::value('module', $params);
}
$dao->entity_table = CRM_Utils_Array::value('entity_table', $params);
$dao->entity_id = CRM_Utils_Array::value('entity_id', $params);
$dao->orderBy('weight asc');
$dao->find();
$first = $firstActive = NULL;
$second = $secondActive = array();
while ($dao->fetch()) {
if ($dao->weight == 1) {
$first = $dao->uf_group_id;
$firstActive = $dao->is_active;
} else {
$second[] = $dao->uf_group_id;
$secondActive[] = $dao->is_active;
}
}
return array($first, $second, $firstActive, $secondActive);
}
示例3: getUFGroupIds
public static function getUFGroupIds(&$params)
{
$dao = new CRM_Core_DAO_UFJoin();
// CRM-4377 (ab)uses the module column
if (isset($params['module'])) {
$dao->module = CRM_Utils_Array::value('module', $params);
}
$dao->entity_table = CRM_Utils_Array::value('entity_table', $params);
$dao->entity_id = CRM_Utils_Array::value('entity_id', $params);
$dao->orderBy('weight asc');
$first = $second = $firstActive = $secondActive = null;
$firstWeight = null;
$dao->find();
if ($dao->fetch()) {
$first = $dao->uf_group_id;
$firstWeight = $dao->weight;
$firstActive = $dao->is_active;
}
while ($dao->fetch()) {
if ($first != $dao->uf_group_id) {
$second = $dao->uf_group_id;
$secondActive = $dao->is_active;
break;
}
}
// if there is only one profile check to see the weight, if > 1 then let it be second
// this is an approx rule, but should work in most cases.
if ($second == null && $firstWeight > 1) {
$second = $first;
$first = null;
}
return array($first, $second, $firstActive, $secondActive);
}
示例4: setValues
/**
* Load values for a contribution page.
*
* @param int $id
* @param array $values
*/
public static function setValues($id, &$values)
{
$modules = array('CiviContribute', 'soft_credit', 'on_behalf');
$values['custom_pre_id'] = $values['custom_post_id'] = NULL;
$params = array('id' => $id);
CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_ContributionPage', $params, $values);
// get the profile ids
$ufJoinParams = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $id);
// retrieve profile id as also unserialize module_data corresponding to each $module
foreach ($modules as $module) {
$ufJoinParams['module'] = $module;
$ufJoin = new CRM_Core_DAO_UFJoin();
$ufJoin->copyValues($ufJoinParams);
if ($module == 'CiviContribute') {
$ufJoin->orderBy('weight asc');
$ufJoin->find();
while ($ufJoin->fetch()) {
if ($ufJoin->weight == 1) {
$values['custom_pre_id'] = $ufJoin->uf_group_id;
} else {
$values['custom_post_id'] = $ufJoin->uf_group_id;
}
}
} else {
$ufJoin->find(TRUE);
if (!$ufJoin->is_active) {
continue;
}
$params = CRM_Contribute_BAO_ContributionPage::formatModuleData($ufJoin->module_data, TRUE, $module);
$values = array_merge($params, $values);
if ($module == 'soft_credit') {
$values['honoree_profile_id'] = $ufJoin->uf_group_id;
$values['honor_block_is_active'] = $ufJoin->is_active;
} else {
$values['onbehalf_profile_id'] = $ufJoin->uf_group_id;
}
}
}
}
示例5: getProfileIDs
/**
* Search for profiles by Volunteer Project ID
* @param type $projectId
* @return array of UFGroup (Profile) Ids
*/
function getProfileIDs()
{
if (empty($this->_profile_ids)) {
$dao = new CRM_Core_DAO_UFJoin();
$dao->entity_table = CRM_Volunteer_BAO_Project::$_tableName;
$dao->entity_id = $this->_project->id;
$dao->orderBy('weight asc');
$dao->find();
while ($dao->fetch()) {
$this->_profile_ids[] = $dao->uf_group_id;
}
}
return $this->_profile_ids;
}
示例6: getProfileIDs
/**
* Does a UFJoin lookup and caches it for future use.
*
* @return array of UFGroup (profile) IDs
*/
private function getProfileIDs()
{
if (empty($this->_profile_ids) && $this->getProject() !== FALSE) {
$dao = new CRM_Core_DAO_UFJoin();
$dao->entity_table = CRM_Volunteer_BAO_Project::$_tableName;
$dao->entity_id = $this->getProject()->id;
$dao->orderBy('weight asc');
$dao->find();
while ($dao->fetch()) {
$this->_profile_ids[] = $dao->uf_group_id;
}
}
if (empty($this->_profile_ids)) {
$this->_profile_ids[] = civicrm_api3('UFGroup', 'getvalue', array('name' => 'volunteer_sign_up', 'return' => 'id'));
}
return $this->_profile_ids;
}
示例7: getProfileIDs
/**
* Search for profiles
*
* @return array
* UFGroup (Profile) Ids
*/
function getProfileIDs()
{
if (empty($this->_profile_ids)) {
$profileIds = array();
foreach ($this->projectIds as $projectId) {
$dao = new CRM_Core_DAO_UFJoin();
$dao->entity_table = CRM_Volunteer_BAO_Project::$_tableName;
$dao->entity_id = $projectId;
$dao->orderBy('weight asc');
$dao->find();
while ($dao->fetch()) {
$profileIds[] = $dao->uf_group_id;
}
}
$this->_profile_ids = array_unique($profileIds);
}
return $this->_profile_ids;
}