本文整理汇总了PHP中CRM_Core_SelectValues::ufGroupTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_SelectValues::ufGroupTypes方法的具体用法?PHP CRM_Core_SelectValues::ufGroupTypes怎么用?PHP CRM_Core_SelectValues::ufGroupTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_SelectValues
的用法示例。
在下文中一共展示了CRM_Core_SelectValues::ufGroupTypes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUFJoinRecord
/**
* Get the UF Join records for an ufgroup id.
*
* @param int $ufGroupId
* Uf group id.
* @param int $displayName
* If set return display name in array.
* @param int $status
* If set return module other than default modules (User Account/User registration/Profile).
*
* @return array
*
*/
public static function getUFJoinRecord($ufGroupId = NULL, $displayName = NULL, $status = NULL)
{
if ($displayName) {
$UFGroupType = array();
$UFGroupType = CRM_Core_SelectValues::ufGroupTypes();
}
$ufJoin = array();
$dao = new CRM_Core_DAO_UFJoin();
if ($ufGroupId) {
$dao->uf_group_id = $ufGroupId;
}
$dao->find();
$ufJoin = array();
while ($dao->fetch()) {
if (!$displayName) {
$ufJoin[$dao->id] = $dao->module;
} else {
if (isset($UFGroupType[$dao->module])) {
// skip the default modules
if (!$status) {
$ufJoin[$dao->id] = $UFGroupType[$dao->module];
}
// added for CRM-1475
} elseif (!CRM_Utils_Array::key($dao->module, $ufJoin)) {
$ufJoin[$dao->id] = $dao->module;
}
}
}
return $ufJoin;
}
示例2: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
if ($this->_action & (CRM_Core_Action::DISABLE | CRM_Core_Action::DELETE)) {
if ($this->_action & CRM_Core_Action::DISABLE) {
$display = 'Disable Profile';
} else {
$display = 'Delete Profile';
}
$this->addButtons(array(array('type' => 'next', 'name' => $display, 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
$this->applyFilter('__ALL__', 'trim');
// title
$this->add('text', 'title', ts('Profile Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'title'), TRUE);
$this->add('textarea', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'description'));
//add checkboxes
$uf_group_type = array();
$UFGroupType = CRM_Core_SelectValues::ufGroupTypes();
foreach ($UFGroupType as $key => $value) {
$uf_group_type[] = $this->createElement('checkbox', $key, NULL, $value);
}
$this->addGroup($uf_group_type, 'uf_group_type', ts('Used For'), ' ');
// help text
$this->addWysiwyg('help_pre', ts('Pre-form Help'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'help_post'));
$this->addWysiwyg('help_post', ts('Post-form Help'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'help_post'));
// weight
$this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFJoin', 'weight'), TRUE);
$this->addRule('weight', ts('is a numeric field'), 'numeric');
// is this group active ?
$this->addElement('checkbox', 'is_active', ts('Is this CiviCRM Profile active?'));
$paneNames = array('Advanced Settings' => 'buildAdvanceSetting');
foreach ($paneNames as $name => $type) {
if ($this->_id) {
$dataURL = "&reset=1&action=update&id={$this->_id}&snippet=4&formType={$type}";
} else {
$dataURL = "&reset=1&action=add&snippet=4&formType={$type}";
}
$allPanes[$name] = array('url' => CRM_Utils_System::url('civicrm/admin/uf/group/setting', $dataURL), 'open' => 'false', 'id' => $type);
CRM_UF_Form_AdvanceSetting::$type($this);
}
$this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
// views are implemented as frozen form
if ($this->_action & CRM_Core_Action::VIEW) {
$this->freeze();
$this->addElement('button', 'done', ts('Done'), array('onclick' => "location.href='civicrm/admin/uf/group?reset=1&action=browse'"));
}
$this->addFormRule(array('CRM_UF_Form_Group', 'formRule'), $this);
}
示例3: getUFJoinRecord
/**
* Function to get the UF Join records for an ufgroup id
*
* @params int $ufGroupId uf group id
* @params int $displayName if set return display name in array
* @params int $status if set return module other than default modules (User Account/User registration/Profile)
*
* @return array $ufGroupJoinRecords
*
* @access public
* @static
*/
public static function getUFJoinRecord($ufGroupId = null, $displayName = null, $status = null)
{
if ($displayName) {
$UFGroupType = array();
require_once "CRM/Core/SelectValues.php";
$UFGroupType = CRM_Core_SelectValues::ufGroupTypes();
}
$ufJoin = array();
require_once 'CRM/Core/DAO/UFJoin.php';
$dao =& new CRM_Core_DAO_UFJoin();
if ($ufGroupId) {
$dao->uf_group_id = $ufGroupId;
}
$dao->find();
$ufJoin = array();
while ($dao->fetch()) {
if (!$displayName) {
$ufJoin[$dao->id] = $dao->module;
} else {
if (isset($UFGroupType[$dao->module])) {
if (!$status) {
//skip the default modules
$ufJoin[$dao->id] = $UFGroupType[$dao->module];
}
} else {
if (!CRM_Utils_Array::key($dao->module, $ufJoin)) {
//added for CRM-1475
$ufJoin[$dao->id] = $dao->module;
}
}
}
}
return $ufJoin;
}
示例4: 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;
}