当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_PseudoConstant::ufGroup方法代码示例

本文整理汇总了PHP中CRM_Core_PseudoConstant::ufGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_PseudoConstant::ufGroup方法的具体用法?PHP CRM_Core_PseudoConstant::ufGroup怎么用?PHP CRM_Core_PseudoConstant::ufGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_PseudoConstant的用法示例。


在下文中一共展示了CRM_Core_PseudoConstant::ufGroup方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInput

 protected function getInput()
 {
     $value = $this->value;
     $name = $this->name;
     // Initiate CiviCRM
     define('CIVICRM_SETTINGS_PATH', JPATH_ROOT . '/' . 'administrator/components/com_civicrm/civicrm.settings.php');
     require_once CIVICRM_SETTINGS_PATH;
     require_once 'CRM/Core/ClassLoader.php';
     CRM_Core_ClassLoader::singleton()->register();
     require_once 'CRM/Core/Config.php';
     $config = CRM_Core_Config::singleton();
     $ufGroups = CRM_Core_PseudoConstant::ufGroup();
     $options[] = JHTML::_('select.option', '', JText::_('- Select Profile -'));
     foreach ($ufGroups as $key => $values) {
         $options[] = JHTML::_('select.option', $key, $values);
     }
     return JHTML::_('select.genericlist', $options, $name, NULL, 'value', 'text', $value);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:18,代码来源:civiprofiles.php

示例2: ufGroup

 public static function ufGroup($type = CRM_Core_Permission::VIEW)
 {
     $ufGroups = CRM_Core_PseudoConstant::ufGroup();
     $allGroups = array_keys($ufGroups);
     // check if user has all powerful permission
     if (self::check('profile listings and forms')) {
         return $allGroups;
     }
     switch ($type) {
         case CRM_Core_Permission::VIEW:
             if (self::check('profile view') || self::check('profile edit')) {
                 return $allGroups;
             }
             break;
         case CRM_Core_Permission::CREATE:
             if (self::check('profile create')) {
                 return $allGroups;
             }
             break;
         case CRM_Core_Permission::EDIT:
             if (self::check('profile edit')) {
                 return $allGroups;
             }
             break;
         case CRM_Core_Permission::SEARCH:
             if (self::check('profile listings')) {
                 return $allGroups;
             }
             break;
     }
     return CRM_ACL_API::group($type, NULL, 'civicrm_uf_group', $ufGroups);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:32,代码来源:Permission.php

示例3: getListingFields

 /** 
  * get all the listing fields 
  * 
  * @param int  $action            what action are we doing 
  * @param int  $visibility        visibility of fields we are interested in
  * @param bool $considerSelector  whether to consider the in_selector parameter
  * @param      $ufGroupId
  * @param      $searchable
  * 
  * @return array     the fields that are listings related
  * @static 
  * @access public 
  */
 static function getListingFields($action, $visibility, $considerSelector = false, $ufGroupId = null, $searchable = null, $restrict = null, $skipPermission = false, $permissionType = CRM_Core_Permission::SEARCH)
 {
     if ($ufGroupId) {
         $subset = self::getFields($ufGroupId, false, $action, $visibility, $searchable, false, $restrict, $skipPermission, null, $permissionType);
         if ($considerSelector) {
             // drop the fields not meant for the selector
             foreach ($subset as $name => $field) {
                 if (!$field['in_selector']) {
                     unset($subset[$name]);
                 }
             }
         }
         $fields = $subset;
     } else {
         $ufGroups =& CRM_Core_PseudoConstant::ufGroup();
         $fields = array();
         foreach ($ufGroups as $id => $title) {
             $subset = self::getFields($id, false, $action, $visibility, $searchable, false, $restrict, $skipPermission, null, $permissionType);
             if ($considerSelector) {
                 // drop the fields not meant for the selector
                 foreach ($subset as $name => $field) {
                     if (!$field['in_selector']) {
                         unset($subset[$name]);
                     }
                 }
             }
             $fields = array_merge($fields, $subset);
         }
     }
     return $fields;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:44,代码来源:UFGroup.php

示例4: 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'));
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:36,代码来源:ACL.php

示例5: getRegisteredTitle

 /**
  * get the title of the group which contributes the largest number of fields
  * to the registered entries
  *
  * @params null
  * 
  * @return string    title of the registered group.
  * @static
  * @access public
  */
 function getRegisteredTitle()
 {
     $ufGroups =& CRM_Core_PseudoConstant::ufGroup();
     $size = -1;
     $title = null;
     foreach ($ufGroups as $id => $value) {
         $subset = CRM_Core_BAO_UFGroup::getFields($id, true, $action);
         if (count($subset) > $size) {
             $size = count($subset);
             $title = $value;
         }
     }
     return $title;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:24,代码来源:UFGroup.php

示例6:

/**                
 * Get all the user framework groups 
 * 
 * @access public                                         
 * @return array - array reference of all groups. 
 * @static 
 */
function &crm_uf_get_profile_groups()
{
    return CRM_Core_PseudoConstant::ufGroup();
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:11,代码来源:UFGroup.php

示例7: 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);
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:64,代码来源:ACL.php

示例8: 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);
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:51,代码来源:Group.php

示例9: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 function buildQuickForm()
 {
     $this->add('select', 'custom_pre_id', ts('Custom Fields') . '<br />' . ts('(above billing info)'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::ufGroup());
     $this->add('select', 'custom_post_id', ts('Custom Fields') . '<br />' . ts('(below billing info)'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::ufGroup());
     parent::buildQuickForm();
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:12,代码来源:Custom.php

示例10: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     //lets have single status message, CRM-4363
     $return = false;
     $statusMessage = null;
     //we should not allow component and mix profiles in search mode
     if ($this->_mode != self::MODE_REGISTER) {
         //check for mix profile fields (eg:  individual + other contact type)
         if (CRM_Core_BAO_UFField::checkProfileType($this->_gid)) {
             $statusMessage = ts('Profile search, view and edit are not supported for Profiles which include fields for more than one record type.');
         }
         $profileType = CRM_Core_BAO_UFField::getProfileType($this->_gid);
         if ($this->_id) {
             list($contactType, $contactSubType) = CRM_Contact_BAO_Contact::getContactTypes($this->_id);
             $profileSubType = false;
             if (CRM_Contact_BAO_ContactType::isaSubType($profileType)) {
                 $profileSubType = $profileType;
                 $profileType = CRM_Contact_BAO_ContactType::getBasicType($profileType);
             }
             if ($profileType != 'Contact' && ($profileSubType && $contactSubType && $profileSubType != $contactSubType || $profileType != $contactType)) {
                 $return = true;
                 if (!$statusMessage) {
                     $statusMessage = ts("This profile is configured for contact type '%1'. It cannot be used to edit contacts of other types.", array(1 => $profileSubType ? $profileSubType : $profileType));
                 }
             }
         }
         if (in_array($profileType, array("Membership", "Participant", "Contribution"))) {
             $return = true;
             if (!$statusMessage) {
                 $statusMessage = ts('Profile is not configured for the selected action.');
             }
         }
     }
     //lets have sigle status message,
     $this->assign('statusMessage', $statusMessage);
     if ($return) {
         return false;
     }
     $sBlocks = array();
     $hBlocks = array();
     $config =& CRM_Core_Config::singleton();
     $this->assign('id', $this->_id);
     $this->assign('mode', $this->_mode);
     $this->assign('action', $this->_action);
     $this->assign_by_ref('fields', $this->_fields);
     $this->assign('fieldset', isset($this->_fieldset) ? $this->_fieldset : "");
     // do we need inactive options ?
     if ($this->_action & CRM_Core_Action::VIEW) {
         $inactiveNeeded = true;
     } else {
         $inactiveNeeded = false;
     }
     $session =& CRM_Core_Session::singleton();
     // should we restrict what we display
     $admin = true;
     if ($this->_mode == self::MODE_EDIT) {
         $admin = false;
         // show all fields that are visibile:
         // if we are a admin OR the same user OR acl-user with access to the profile
         require_once 'CRM/ACL/API.php';
         if (CRM_Core_Permission::check('administer users') || $this->_id == $session->get('userID') || in_array($this->_gid, CRM_ACL_API::group(CRM_Core_Permission::EDIT, null, 'civicrm_uf_group', CRM_Core_PseudoConstant::ufGroup()))) {
             $admin = true;
         }
     }
     $userID = $session->get('userID');
     $anonUser = false;
     // if false, user is not logged-in.
     if (!$userID) {
         require_once 'CRM/Core/BAO/LocationType.php';
         $defaultLocationType =& CRM_Core_BAO_LocationType::getDefault();
         $primaryLocationType = $defaultLocationType->id;
         $anonUser = true;
         $this->assign('anonUser', true);
     }
     $addCaptcha = array();
     $emailPresent = false;
     // cache the state country fields. based on the results, we could use our javascript solution
     // in create or register mode
     $stateCountryMap = array();
     // add the form elements
     foreach ($this->_fields as $name => $field) {
         // make sure that there is enough permission to expose this field
         if (!$admin && $field['visibility'] == 'User and User Admin Only' || CRM_Utils_Array::value('is_view', $field)) {
             unset($this->_fields[$name]);
             continue;
         }
         // since the CMS manages the email field, suppress the email display if in
         // register mode which occur within the CMS form
         if ($this->_mode == self::MODE_REGISTER && substr($name, 0, 5) == 'email') {
             unset($this->_fields[$name]);
             continue;
         }
         list($prefixName, $index) = CRM_Utils_System::explode('-', $name, 2);
         if ($prefixName == 'state_province' || $prefixName == 'country') {
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:civicrm,代码行数:101,代码来源:Form.php

示例11: 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::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;
         }
         $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);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:72,代码来源:Group.php


注:本文中的CRM_Core_PseudoConstant::ufGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。