本文整理汇总了PHP中CRM_Utils_Hook::aclGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Hook::aclGroup方法的具体用法?PHP CRM_Utils_Hook::aclGroup怎么用?PHP CRM_Utils_Hook::aclGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Hook
的用法示例。
在下文中一共展示了CRM_Utils_Hook::aclGroup方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: group
public static function group($type, $contactID = NULL, $tableName = 'civicrm_saved_search', $allGroups = NULL, $includedGroups = NULL)
{
$acls = CRM_ACL_BAO_Cache::build($contactID);
if (!empty($includedGroups) && is_array($includedGroups)) {
$ids = $includedGroups;
} else {
$ids = array();
}
if (!empty($acls)) {
$aclKeys = array_keys($acls);
$aclKeys = implode(',', $aclKeys);
$query = "\nSELECT a.operation, a.object_id\n FROM civicrm_acl_cache c, civicrm_acl a\n WHERE c.acl_id = a.id\n AND a.is_active = 1\n AND a.object_table = %1\n AND a.id IN ( {$aclKeys} )\nORDER BY a.object_id\n";
$params = array(1 => array($tableName, 'String'));
$dao = CRM_Core_DAO::executeQuery($query, $params);
while ($dao->fetch()) {
if ($dao->object_id) {
if (self::matchType($type, $dao->operation)) {
$ids[] = $dao->object_id;
}
} else {
// this user has got the permission for all objects of this type
// check if the type matches
if (self::matchType($type, $dao->operation)) {
foreach ($allGroups as $id => $dontCare) {
$ids[] = $id;
}
}
break;
}
}
}
CRM_Utils_Hook::aclGroup($type, $contactID, $tableName, $allGroups, $ids);
return $ids;
}
示例2: browse
/**
* Browse all uf data groups.
*
* @param
*
* @return void
* @access public
* @static
*/
function browse($action = NULL)
{
$ufGroup = array();
$allUFGroups = array();
$allUFGroups = CRM_Core_BAO_UFGroup::getModuleUFGroup();
if (empty($allUFGroups)) {
return;
}
$ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
CRM_Utils_Hook::aclGroup(CRM_Core_Permission::ADMIN, NULL, 'civicrm_uf_group', $ufGroups, $allUFGroups);
foreach ($allUFGroups as $id => $value) {
$ufGroup[$id] = array();
$ufGroup[$id]['id'] = $id;
$ufGroup[$id]['title'] = $value['title'];
$ufGroup[$id]['created_id'] = $value['created_id'];
$ufGroup[$id]['created_by'] = CRM_Contact_BAO_Contact::displayName($value['created_id']);
$ufGroup[$id]['description'] = $value['description'];
$ufGroup[$id]['is_active'] = $value['is_active'];
$ufGroup[$id]['group_type'] = $value['group_type'];
$ufGroup[$id]['is_reserved'] = $value['is_reserved'];
// form all action links
$action = array_sum(array_keys($this->actionLinks()));
// update enable/disable links depending on uf_group properties.
if ($value['is_active']) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
// drop certain actions if the profile is reserved
if ($value['is_reserved']) {
$action -= CRM_Core_Action::UPDATE;
$action -= CRM_Core_Action::DISABLE;
$action -= CRM_Core_Action::DELETE;
}
$groupTypes = self::extractGroupTypes($value['group_type']);
$groupComponents = array('Contribution', 'Membership', 'Activity', 'Participant');
// drop Create, Edit and View mode links if profile group_type is Contribution, Membership, Activities or Participant
$componentFound = array_intersect($groupComponents, array_keys($groupTypes));
if (!empty($componentFound)) {
$action -= CRM_Core_Action::ADD;
}
$groupTypesString = '';
if (!empty($groupTypes)) {
$groupTypesStrings = array();
foreach ($groupTypes as $groupType => $typeValues) {
if (is_array($typeValues)) {
if ($groupType == 'Participant') {
foreach ($typeValues as $subType => $subTypeValues) {
$groupTypesStrings[] = $subType . '::' . implode(': ', $subTypeValues);
}
} else {
$groupTypesStrings[] = $groupType . '::' . implode(': ', current($typeValues));
}
} else {
$groupTypesStrings[] = $groupType;
}
}
$groupTypesString = implode(', ', $groupTypesStrings);
}
$ufGroup[$id]['group_type'] = $groupTypesString;
$ufGroup[$id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $id));
//get the "Used For" from uf_join
$ufGroup[$id]['module'] = implode(', ', CRM_Core_BAO_UFGroup::getUFJoinRecord($id, TRUE));
}
$this->assign('rows', $ufGroup);
}
示例3: getValidProfiles
/**
* Check whether a profile is valid combination of
* required and/or optional profile types
*
* @param array $required
* Array of types those are required.
* @param array $optional
* Array of types those are optional.
*
* @return array
* associative array of profiles
*/
public static function getValidProfiles($required, $optional = NULL)
{
if (!is_array($required) || empty($required)) {
return NULL;
}
$profiles = array();
$ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
CRM_Utils_Hook::aclGroup(CRM_Core_Permission::ADMIN, NULL, 'civicrm_uf_group', $ufGroups, $ufGroups);
foreach ($ufGroups as $id => $title) {
$type = CRM_Core_BAO_UFField::checkValidProfileType($id, $required, $optional);
if ($type) {
$profiles[$id] = $title;
}
}
return $profiles;
}
示例4: browse
/**
* Browse all uf data groups.
*
* @param
*
* @return void
*/
public function browse($action = NULL)
{
$ufGroup = array();
$allUFGroups = CRM_Core_BAO_UFGroup::getModuleUFGroup();
if (empty($allUFGroups)) {
return;
}
$ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
CRM_Utils_Hook::aclGroup(CRM_Core_Permission::ADMIN, NULL, 'civicrm_uf_group', $ufGroups, $allUFGroups);
foreach ($allUFGroups as $id => $value) {
$ufGroup[$id] = array();
$ufGroup[$id]['id'] = $id;
$ufGroup[$id]['title'] = $value['title'];
$ufGroup[$id]['created_id'] = $value['created_id'];
$ufGroup[$id]['created_by'] = CRM_Contact_BAO_Contact::displayName($value['created_id']);
$ufGroup[$id]['description'] = $value['description'];
$ufGroup[$id]['is_active'] = $value['is_active'];
$ufGroup[$id]['group_type'] = $value['group_type'];
$ufGroup[$id]['is_reserved'] = $value['is_reserved'];
// form all action links
$action = array_sum(array_keys(self::actionLinks()));
// update enable/disable links depending on uf_group properties.
if ($value['is_active']) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
// drop certain actions if the profile is reserved
if ($value['is_reserved']) {
$action -= CRM_Core_Action::UPDATE;
$action -= CRM_Core_Action::DISABLE;
$action -= CRM_Core_Action::DELETE;
}
$groupTypes = self::extractGroupTypes($value['group_type']);
// drop Create, Edit and View mode links if profile group_type is one of the following:
// Contribution, Membership, Activity, Participant, Case, Grant
$isMixedProfile = CRM_Core_BAO_UFField::checkProfileType($id);
if ($isMixedProfile) {
$action -= CRM_Core_Action::ADD;
$action -= CRM_Core_Action::ADVANCED;
$action -= CRM_Core_Action::BASIC;
$action -= CRM_Core_Action::PROFILE;
}
$ufGroup[$id]['group_type'] = self::formatGroupTypes($groupTypes);
$ufGroup[$id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $id), ts('more'), FALSE, 'ufGroup.row.actions', 'UFGroup', $id);
//get the "Used For" from uf_join
$ufGroup[$id]['module'] = implode(', ', CRM_Core_BAO_UFGroup::getUFJoinRecord($id, TRUE));
}
$this->assign('rows', $ufGroup);
}
示例5: getProfiles
/**
* Function to get profiles by type eg: pure Individual etc
*
* @param array $types associative array of types eg: types('Individual')
* @param boolean $onlyPure true if only pure profiles are required
*
* @return array $profiles associative array of profiles
* @static
* @access public
*/
static function getProfiles($types, $onlyPure = false)
{
require_once "CRM/Core/BAO/UFField.php";
$profiles = array();
$ufGroups = CRM_Core_PseudoConstant::ufgroup();
require_once 'CRM/Utils/Hook.php';
CRM_Utils_Hook::aclGroup(CRM_Core_Permission::ADMIN, null, 'civicrm_uf_group', $ufGroups, $ufGroups);
foreach ($ufGroups as $id => $title) {
$ptype = CRM_Core_BAO_UFField::getProfileType($id, false, $onlyPure);
if (in_array($ptype, $types)) {
$profiles[$id] = $title;
}
}
return $profiles;
}
示例6: browse
/**
* Browse all uf data groups.
*
* @param
* @return void
* @access public
* @static
*/
function browse($action = null)
{
$ufGroup = array();
$allUFGroups = array();
require_once 'CRM/Core/BAO/UFGroup.php';
$allUFGroups = CRM_Core_BAO_UFGroup::getModuleUFGroup();
if (empty($allUFGroups)) {
return;
}
require_once 'CRM/Utils/Hook.php';
$ufGroups = CRM_Core_PseudoConstant::ufGroup();
CRM_Utils_Hook::aclGroup(CRM_Core_Permission::ADMIN, null, 'civicrm_uf_group', $ufGroups, $allUFGroups);
foreach ($allUFGroups as $id => $value) {
$ufGroup[$id] = array();
$ufGroup[$id]['id'] = $id;
$ufGroup[$id]['title'] = $value['title'];
$ufGroup[$id]['is_active'] = $value['is_active'];
$ufGroup[$id]['group_type'] = $value['group_type'];
$ufGroup[$id]['is_reserved'] = $value['is_reserved'];
// form all action links
$action = array_sum(array_keys($this->actionLinks()));
// update enable/disable links depending on uf_group properties.
if ($value['is_active']) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
// drop certain actions if the profile is reserved
if ($value['is_reserved']) {
$action -= CRM_Core_Action::UPDATE;
$action -= CRM_Core_Action::DISABLE;
$action -= CRM_Core_Action::DELETE;
}
// drop Create, Edit and View mode links if profile group_type is Contribution, Membership, or Participant
if ($value['group_type'] == 'Contribution' || $value['group_type'] == 'Membership' || $value['group_type'] == 'Participant') {
$action -= CRM_Core_Action::ADD;
}
$ufGroup[$id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $id));
//get the "Used For" from uf_join
$ufGroup[$id]['module'] = implode(', ', CRM_Core_BAO_UFGroup::getUFJoinRecord($id, true));
}
$this->assign('rows', $ufGroup);
}