本文整理汇总了PHP中CRM_Core_BAO_UFGroup::getWeight方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_UFGroup::getWeight方法的具体用法?PHP CRM_Core_BAO_UFGroup::getWeight怎么用?PHP CRM_Core_BAO_UFGroup::getWeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_UFGroup
的用法示例。
在下文中一共展示了CRM_Core_BAO_UFGroup::getWeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultValues
/**
* This function sets the default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @access public
*
* @return void
*/
function setDefaultValues()
{
$defaults = array();
$showHide = new CRM_Core_ShowHideBlocks();
if ($this->_action == CRM_Core_Action::ADD) {
$defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_UFJoin');
}
//id fetched for Dojo Pane
$pId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
if (isset($pId)) {
$this->_id = $pId;
}
if (isset($this->_id)) {
$defaults['weight'] = CRM_Core_BAO_UFGroup::getWeight($this->_id);
$params = array('id' => $this->_id);
CRM_Core_BAO_UFGroup::retrieve($params, $defaults);
$defaults['group'] = CRM_Utils_Array::value('limit_listings_group_id', $defaults);
$defaults['add_contact_to_group'] = CRM_Utils_Array::value('add_to_group_id', $defaults);
//get the uf join records for current uf group
$ufJoinRecords = CRM_Core_BAO_UFGroup::getUFJoinRecord($this->_id);
foreach ($ufJoinRecords as $key => $value) {
$checked[$value] = 1;
}
$defaults['uf_group_type'] = isset($checked) ? $checked : "";
//get the uf join records for current uf group other than default modules
$otherModules = array();
$otherModules = CRM_Core_BAO_UFGroup::getUFJoinRecord($this->_id, TRUE, TRUE);
if (!empty($otherModules)) {
$otherModuleString = NULL;
foreach ($otherModules as $key) {
$otherModuleString .= " [ x ] <label>" . $key . "</label>";
}
$this->assign('otherModuleString', $otherModuleString);
}
$showAdvanced = 0;
$advFields = array('group', 'post_URL', 'cancel_URL', 'add_captcha', 'is_map', 'is_uf_link', 'is_edit_link', 'is_update_dupe', 'is_cms_user', 'is_proximity_search');
foreach ($advFields as $key) {
if (!empty($defaults[$key])) {
$showAdvanced = 1;
$this->_allPanes['Advanced Settings']['open'] = 'true';
break;
}
}
} else {
$defaults['is_active'] = 1;
$defaults['is_map'] = 0;
$defaults['is_update_dupe'] = 0;
$defaults['is_proximity_search'] = 0;
}
// Don't assign showHide elements to template in DELETE mode (fields to be shown and hidden don't exist)
if (!($this->_action & CRM_Core_Action::DELETE) && !($this->_action & CRM_Core_Action::DISABLE)) {
$showHide->addToTemplate();
}
$this->assign('allPanes', $this->_allPanes);
return $defaults;
}
示例2: setDefaultValues
/**
* This function sets the default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @access public
* @return void
*/
function setDefaultValues()
{
$defaults = array();
if ($this->_action == CRM_CORE_ACTION_ADD) {
$defaults['weight'] = CRM_Core_BAO_UFGroup::getWeight();
$UFGroupType = CRM_Core_SelectValues::ufGroupTypes();
foreach ($UFGroupType as $key => $value) {
$checked[$key] = 1;
}
$defaults['uf_group_type'] = $checked;
}
if (isset($this->_id)) {
$defaults['weight'] = CRM_Core_BAO_UFGroup::getWeight($this->_id);
$params = array('id' => $this->_id);
CRM_Core_BAO_UFGroup::retrieve($params, $defaults);
$defaults['group'] = $defaults['limit_listings_group_id'];
//get the uf join records for current uf group
$ufJoinRecords = CRM_Core_BAO_UFGroup::getUFJoinRecord($this->_id);
foreach ($ufJoinRecords as $key => $value) {
$checked[$value] = 1;
}
$defaults['uf_group_type'] = $checked;
//get the uf join records for current uf group other than default modules
$otherModules = array();
$otherModules = CRM_Core_BAO_UFGroup::getUFJoinRecord($this->_id, true, true);
if (!empty($otherModules)) {
foreach ($otherModules as $key) {
$otherModuleString .= " [ x ] " . $key;
}
$this->assign('otherModuleString', $otherModuleString);
}
} else {
$defaults['is_active'] = 1;
}
return $defaults;
}