本文整理汇总了PHP中CRM_Core_PseudoConstant::customGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_PseudoConstant::customGroup方法的具体用法?PHP CRM_Core_PseudoConstant::customGroup怎么用?PHP CRM_Core_PseudoConstant::customGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_PseudoConstant
的用法示例。
在下文中一共展示了CRM_Core_PseudoConstant::customGroup方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Function to actually build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
$customGroup = CRM_Core_PseudoConstant::customGroup();
unset($customGroup[$this->_srcGID]);
if (empty($customGroup)) {
CRM_Core_Error::statusBounce(ts('You need more than one custom group to move fields'));
}
$customGroup = array('' => ts('- select -')) + $customGroup;
$this->add('select', 'dst_group_id', ts('Destination'), $customGroup, TRUE);
$this->addButtons(array(array('type' => 'next', 'name' => ts('Move Custom Field'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
$this->addFormRule(array('CRM_Custom_Form_MoveField', 'formRule'), $this);
}
示例2: customGroup
public static function customGroup($type = CRM_Core_Permission::VIEW, $reset = FALSE)
{
$customGroups = CRM_Core_PseudoConstant::customGroup($reset);
$defaultGroups = array();
// check if user has all powerful permission
// or administer civicrm permission (CRM-1905)
if (self::customGroupAdmin()) {
$defaultGroups = array_keys($customGroups);
}
return CRM_ACL_API::group($type, NULL, 'civicrm_custom_group', $customGroups, $defaultGroups);
}
示例3: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$attributes = CRM_Core_DAO::getAttribute('CRM_ACL_DAO_ACL');
$this->add('text', 'name', ts('Description'), CRM_Core_DAO::getAttribute('CRM_ACL_DAO_ACL', 'name'), TRUE);
$operations = array('' => ts('- select -')) + CRM_ACL_BAO_ACL::operation();
$this->add('select', 'operation', ts('Operation'), $operations, TRUE);
$objTypes = array('1' => ts('A group of contacts'), '2' => ts('A profile'), '3' => ts('A set of custom data fields'));
if (CRM_Core_Permission::access('CiviEvent')) {
$objTypes['4'] = ts('Events');
}
$extra = array('onclick' => "showObjectSelect();");
$this->addRadio('object_type', ts('Type of Data'), $objTypes, $extra, ' ', TRUE);
$label = ts('Role');
$role = array('-1' => ts('- select role -'), '0' => ts('Everyone')) + CRM_Core_OptionGroup::values('acl_role');
$this->add('select', 'entity_id', $label, $role, TRUE);
$group = array('-1' => ts('- select -'), '0' => ts('All Groups')) + CRM_Core_PseudoConstant::group();
$customGroup = array('-1' => ts('- select -'), '0' => ts('All Custom Groups')) + CRM_Core_PseudoConstant::customGroup();
$ufGroup = array('-1' => ts('- select -'), '0' => ts('All Profiles')) + CRM_Core_PseudoConstant::ufGroup();
$event = array('-1' => ts('- select -'), '0' => ts('All Events')) + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
$this->add('select', 'group_id', ts('Group'), $group);
$this->add('select', 'custom_group_id', ts('Custom Data'), $customGroup);
$this->add('select', 'uf_group_id', ts('Profile'), $ufGroup);
$this->add('select', 'event_id', ts('Event'), $event);
$this->add('checkbox', 'is_active', ts('Enabled?'));
$this->addFormRule(array('CRM_ACL_Form_ACL', 'formRule'));
}
示例4: customGroup
public static function customGroup($type = CRM_Core_Permission::VIEW, $reset = false)
{
$customGroups = CRM_Core_PseudoConstant::customGroup($reset);
$defaultGroups = array();
// check if user has all powerful permission
// or administer civicrm permission (CRM-1905)
if (self::check('access all custom data')) {
$defaultGroups = array_keys($customGroups);
} else {
if (defined('CIVICRM_MULTISITE') && CIVICRM_MULTISITE) {
if (self::check('administer Multiple Organizations')) {
$defaultGroups = array_keys($customGroups);
}
} else {
if (self::check('administer CiviCRM')) {
$defaultGroups = array_keys($customGroups);
}
}
}
require_once 'CRM/ACL/API.php';
return CRM_ACL_API::group($type, null, 'civicrm_custom_group', $customGroups, $defaultGroups);
}
示例5: browse
/**
* Browse all acls
*
* @return void
* @access public
* @static
*/
function browse()
{
require_once 'CRM/ACL/DAO/ACL.php';
// get all acl's sorted by weight
$acl = array();
$query = "\n SELECT *\n FROM civicrm_acl\n WHERE ( object_table IN ( 'civicrm_saved_search', 'civicrm_uf_group', 'civicrm_custom_group', 'civicrm_event' ) )\nORDER BY entity_id\n";
$dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
require_once 'CRM/Core/OptionGroup.php';
$roles = CRM_Core_OptionGroup::values('acl_role');
$group = array('-1' => ts('- select -'), '0' => ts('All Groups')) + CRM_Core_PseudoConstant::group();
$customGroup = array('-1' => ts('- select -'), '0' => ts('All Custom Groups')) + CRM_Core_PseudoConstant::customGroup();
$ufGroup = array('-1' => ts('- select -'), '0' => ts('All Profiles')) + CRM_Core_PseudoConstant::ufGroup();
require_once 'CRM/Event/PseudoConstant.php';
$event = array('-1' => ts('- select -'), '0' => ts('All Events')) + CRM_Event_PseudoConstant::event();
while ($dao->fetch()) {
$acl[$dao->id] = array();
$acl[$dao->id]['name'] = $dao->name;
$acl[$dao->id]['operation'] = $dao->operation;
$acl[$dao->id]['entity_id'] = $dao->entity_id;
$acl[$dao->id]['entity_table'] = $dao->entity_table;
$acl[$dao->id]['object_table'] = $dao->object_table;
$acl[$dao->id]['object_id'] = $dao->object_id;
$acl[$dao->id]['is_active'] = $dao->is_active;
if ($acl[$dao->id]['entity_id']) {
$acl[$dao->id]['entity'] = $roles[$acl[$dao->id]['entity_id']];
} else {
$acl[$dao->id]['entity'] = ts('Everyone');
}
switch ($acl[$dao->id]['object_table']) {
case 'civicrm_saved_search':
$acl[$dao->id]['object'] = $group[$acl[$dao->id]['object_id']];
$acl[$dao->id]['object_name'] = ts('Group');
break;
case 'civicrm_uf_group':
$acl[$dao->id]['object'] = $ufGroup[$acl[$dao->id]['object_id']];
$acl[$dao->id]['object_name'] = ts('Profile');
break;
case 'civicrm_custom_group':
$acl[$dao->id]['object'] = $customGroup[$acl[$dao->id]['object_id']];
$acl[$dao->id]['object_name'] = ts('Custom Group');
break;
case 'civicrm_event':
$acl[$dao->id]['object'] = $event[$acl[$dao->id]['object_id']];
$acl[$dao->id]['object_name'] = ts('Event');
break;
}
// form all action links
$action = array_sum(array_keys($this->links()));
if ($dao->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$acl[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id));
}
$this->assign('rows', $acl);
}
示例6: customGroup
public static function customGroup($type = CRM_Core_Permission::VIEW, $reset = false)
{
$customGroups = CRM_Core_PseudoConstant::customGroup($reset);
// check if user has all powerful permission
// or administer civicrm permission (CRM-1905)
if (self::check('access all custom data') || self::check('administer CiviCRM')) {
return array_keys($customGroups);
}
require_once 'CRM/ACL/API.php';
return CRM_ACL_API::group($type, null, 'civicrm_custom_group', $customGroups);
}