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


PHP CRM_Core_BAO_Domain::isDomainGroup方法代码示例

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


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

示例1: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     if ($this->_action == CRM_Core_Action::DELETE) {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete Group'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'title', ts('Name') . ' ', CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'title'), TRUE);
     $this->add('textarea', 'description', ts('Description') . ' ', CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'description'));
     $groupTypes = CRM_Core_OptionGroup::values('group_type', TRUE);
     $config = CRM_Core_Config::singleton();
     if (isset($this->_id) && CRM_Utils_Array::value('saved_search_id', $this->_groupValues)) {
         unset($groupTypes['Access Control']);
     }
     if (!empty($groupTypes)) {
         $this->addCheckBox('group_type', ts('Group Type'), $groupTypes, NULL, NULL, NULL, NULL, '   ');
     }
     $this->add('select', 'visibility', ts('Visibility'), CRM_Core_SelectValues::ufVisibility(TRUE), TRUE);
     $groupNames = CRM_Core_PseudoConstant::group();
     $parentGroups = $parentGroupElements = array();
     if (isset($this->_id) && CRM_Utils_Array::value('parents', $this->_groupValues)) {
         $parentGroupIds = explode(',', $this->_groupValues['parents']);
         foreach ($parentGroupIds as $parentGroupId) {
             $parentGroups[$parentGroupId] = $groupNames[$parentGroupId];
             if (array_key_exists($parentGroupId, $groupNames)) {
                 $parentGroupElements[$parentGroupId] = $groupNames[$parentGroupId];
                 $this->addElement('checkbox', "remove_parent_group_{$parentGroupId}", $groupNames[$parentGroupId]);
             }
         }
     }
     $this->assign_by_ref('parent_groups', $parentGroupElements);
     if (isset($this->_id)) {
         $potentialParentGroupIds = CRM_Contact_BAO_GroupNestingCache::getPotentialCandidates($this->_id, $groupNames);
     } else {
         $potentialParentGroupIds = array_keys($groupNames);
     }
     $parentGroupSelectValues = array('' => '- ' . ts('select') . ' -');
     foreach ($potentialParentGroupIds as $potentialParentGroupId) {
         if (array_key_exists($potentialParentGroupId, $groupNames)) {
             $parentGroupSelectValues[$potentialParentGroupId] = $groupNames[$potentialParentGroupId];
         }
     }
     if (count($parentGroupSelectValues) > 1) {
         if (CRM_Core_Permission::isMultisiteEnabled()) {
             $required = empty($parentGroups) ? TRUE : FALSE;
             $required = $this->_id && CRM_Core_BAO_Domain::isDomainGroup($this->_id) || !isset($this->_id) ? FALSE : $required;
         } else {
             $required = FALSE;
         }
         $this->add('select', 'parents', ts('Add Parent'), $parentGroupSelectValues, $required);
     }
     if (CRM_Core_Permission::check('administer Multiple Organizations') && CRM_Core_Permission::isMultisiteEnabled()) {
         //group organization Element
         $groupOrgDataURL = CRM_Utils_System::url('civicrm/ajax/search', 'org=1', FALSE, NULL, FALSE);
         $this->assign('groupOrgDataURL', $groupOrgDataURL);
         $this->addElement('text', 'organization', ts('Organization'), '');
         $this->addElement('hidden', 'organization_id', '', array('id' => 'organization_id'));
     }
     // is_reserved property CRM-9936
     $this->addElement('checkbox', 'is_reserved', ts('Reserved Group?'));
     if (!CRM_Core_Permission::check('administer reserved groups')) {
         $this->freeze('is_reserved');
     }
     //build custom data
     CRM_Custom_Form_CustomData::buildQuickForm($this);
     $this->addButtons(array(array('type' => 'upload', 'name' => $this->_action == CRM_Core_Action::ADD ? ts('Continue') : ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
     $doParentCheck = FALSE;
     if (CRM_Core_Permission::isMultisiteEnabled()) {
         $doParentCheck = $this->_id && CRM_Core_BAO_Domain::isDomainGroup($this->_id) ? FALSE : TRUE;
     }
     $options = array('selfObj' => $this, 'parentGroups' => $parentGroups, 'doParentCheck' => $doParentCheck);
     $this->addFormRule(array('CRM_Group_Form_Edit', 'formRule'), $options);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:79,代码来源:Edit.php

示例2: buildParentGroups

 /**
  * Build parent groups form elements.
  *
  * @param CRM_Core_Form $form
  *
  * @return array
  *   parent groups
  */
 public static function buildParentGroups(&$form)
 {
     $groupNames = CRM_Core_PseudoConstant::group();
     $parentGroups = $parentGroupElements = array();
     if (isset($form->_id) && !empty($form->_groupValues['parents'])) {
         $parentGroupIds = explode(',', $form->_groupValues['parents']);
         foreach ($parentGroupIds as $parentGroupId) {
             $parentGroups[$parentGroupId] = $groupNames[$parentGroupId];
             if (array_key_exists($parentGroupId, $groupNames)) {
                 $parentGroupElements[$parentGroupId] = $groupNames[$parentGroupId];
                 $form->addElement('checkbox', "remove_parent_group_{$parentGroupId}", $groupNames[$parentGroupId]);
             }
         }
     }
     $form->assign_by_ref('parent_groups', $parentGroupElements);
     if (isset($form->_id)) {
         $potentialParentGroupIds = CRM_Contact_BAO_GroupNestingCache::getPotentialCandidates($form->_id, $groupNames);
     } else {
         $potentialParentGroupIds = array_keys($groupNames);
     }
     $parentGroupSelectValues = array('' => '- ' . ts('select group') . ' -');
     foreach ($potentialParentGroupIds as $potentialParentGroupId) {
         if (array_key_exists($potentialParentGroupId, $groupNames)) {
             $parentGroupSelectValues[$potentialParentGroupId] = $groupNames[$potentialParentGroupId];
         }
     }
     if (count($parentGroupSelectValues) > 1) {
         if (CRM_Core_Permission::isMultisiteEnabled()) {
             $required = !isset($form->_id) || $form->_id && CRM_Core_BAO_Domain::isDomainGroup($form->_id) ? FALSE : empty($parentGroups);
         } else {
             $required = FALSE;
         }
         $form->add('select', 'parents', ts('Add Parent'), $parentGroupSelectValues, $required, array('class' => 'crm-select2'));
     }
     return $parentGroups;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:44,代码来源:Edit.php

示例3: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     if ($this->_action == CRM_Core_Action::DELETE) {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete Group'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'title', ts('Name') . ' ', CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'title'), true);
     $this->addRule('title', ts('Name already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Group', $this->_id, 'title'));
     $this->add('textarea', 'description', ts('Description') . ' ', CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'description'));
     require_once 'CRM/Core/OptionGroup.php';
     $groupTypes = CRM_Core_OptionGroup::values('group_type', true);
     $config =& CRM_Core_Config::singleton();
     if (isset($this->_id) && CRM_Utils_Array::value('saved_search_id', $this->_groupValues) || $config->userFramework == 'Joomla') {
         unset($groupTypes['Access Control']);
     }
     if (!CRM_Core_Permission::access('CiviMail')) {
         unset($groupTypes['Mailing List']);
     }
     if (!empty($groupTypes)) {
         $this->addCheckBox('group_type', ts('Group Type'), $groupTypes, null, null, null, null, '   ');
     }
     $this->add('select', 'visibility', ts('Visibility'), CRM_Core_SelectValues::ufVisibility(true), true);
     $groupNames =& CRM_Core_PseudoConstant::group();
     $parentGroups = array();
     if (isset($this->_id) && CRM_Utils_Array::value('parents', $this->_groupValues)) {
         $parentGroupIds = explode(',', $this->_groupValues['parents']);
         foreach ($parentGroupIds as $parentGroupId) {
             $parentGroups[$parentGroupId] = $groupNames[$parentGroupId];
             $this->addElement('checkbox', "remove_parent_group_{$parentGroupId}", $groupNames[$parentGroupId]);
         }
     }
     $this->assign_by_ref('parent_groups', $parentGroups);
     if (isset($this->_id)) {
         require_once 'CRM/Contact/BAO/GroupNestingCache.php';
         $potentialParentGroupIds = CRM_Contact_BAO_GroupNestingCache::getPotentialCandidates($this->_id, $groupNames);
     } else {
         $potentialParentGroupIds = array_keys($groupNames);
     }
     $parentGroupSelectValues = array('' => '- ' . ts('select') . ' -');
     foreach ($potentialParentGroupIds as $potentialParentGroupId) {
         if (array_key_exists($potentialParentGroupId, $groupNames)) {
             $parentGroupSelectValues[$potentialParentGroupId] = $groupNames[$potentialParentGroupId];
         }
     }
     if (count($parentGroupSelectValues) > 1) {
         if (defined('CIVICRM_MULTISITE') && CIVICRM_MULTISITE) {
             $required = empty($parentGroups) ? true : false;
             $required = $this->_id && CRM_Core_BAO_Domain::isDomainGroup($this->_id) ? false : $required;
         } else {
             $required = false;
         }
         $this->add('select', 'parents', ts('Add Parent'), $parentGroupSelectValues, $required);
     }
     if (defined('CIVICRM_MULTISITE') && CIVICRM_MULTISITE && CRM_Core_Permission::check('administer Multiple Organizations')) {
         //group organization Element
         $groupOrgDataURL = CRM_Utils_System::url('civicrm/ajax/search', 'org=1', false, null, false);
         $this->assign('groupOrgDataURL', $groupOrgDataURL);
         $this->addElement('text', 'organization', ts('Organization'), '');
         $this->addElement('hidden', 'organization_id', '', array('id' => 'organization_id'));
     }
     //build custom data
     CRM_Custom_Form_Customdata::buildQuickForm($this);
     $this->addButtons(array(array('type' => 'upload', 'name' => $this->_action == CRM_Core_Action::ADD ? ts('Continue') : ts('Save'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
     if (defined('CIVICRM_MULTISITE') && CIVICRM_MULTISITE) {
         $doParentCheck = $this->_id && CRM_Core_BAO_Domain::isDomainGroup($this->_id) ? false : true;
     } else {
         $doParentCheck = false;
     }
     if ($doParentCheck) {
         $this->addFormRule(array('CRM_Group_Form_Edit', 'formRule'), $parentGroups);
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:79,代码来源:Edit.php


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