Пример #1
0
 /**
  * Set default values for the form.
  *
  * @return array
  */
 public function setDefaultValues()
 {
     $defaults = array();
     if (isset($this->_id)) {
         $defaults = $this->_groupValues;
         if (!empty($defaults['group_type'])) {
             $types = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($defaults['group_type'], 1, -1));
             $defaults['group_type'] = array();
             foreach ($types as $type) {
                 $defaults['group_type'][$type] = 1;
             }
         }
         if (CRM_Core_Permission::check('administer Multiple Organizations') && CRM_Core_Permission::isMultisiteEnabled()) {
             CRM_Contact_BAO_GroupOrganization::retrieve($this->_id, $defaults);
         }
     }
     if (!(CRM_Core_Permission::check('access CiviMail') || CRM_Mailing_Info::workflowEnabled() && CRM_Core_Permission::check('create mailings'))) {
         $groupTypes = CRM_Core_OptionGroup::values('group_type', TRUE);
         if ($defaults['group_type'][$groupTypes['Mailing List']] == 1) {
             $this->assign('freezeMailignList', $groupTypes['Mailing List']);
         } else {
             $this->assign('hideMailignList', $groupTypes['Mailing List']);
         }
     }
     if (empty($defaults['parents'])) {
         $defaults['parents'] = CRM_Core_BAO_Domain::getGroupId();
     }
     // custom data set defaults
     $defaults += CRM_Custom_Form_CustomData::setDefaultValues($this);
     return $defaults;
 }
Пример #2
0
 function setDefaultValues()
 {
     $defaults = array();
     if (isset($this->_id)) {
         $defaults = $this->_groupValues;
         if (CRM_Utils_Array::value('group_type', $defaults)) {
             $types = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($defaults['group_type'], 1, -1));
             $defaults['group_type'] = array();
             foreach ($types as $type) {
                 $defaults['group_type'][$type] = 1;
             }
         }
         if (defined('CIVICRM_MULTISITE') && CIVICRM_MULTISITE && CRM_Core_Permission::check('administer Multiple Organizations')) {
             require_once 'CRM/Contact/BAO/GroupOrganization.php';
             CRM_Contact_BAO_GroupOrganization::retrieve($this->_id, $defaults);
             if (CRM_Utils_Array::value('group_organization', $defaults)) {
                 //used in edit mode
                 $this->_groupOrganizationID = $defaults['group_organization'];
             }
             $this->assign('organizationID', $defaults['organization_id']);
         }
     }
     if (!CRM_Utils_Array::value('parents', $defaults)) {
         $defaults['parents'] = CRM_Core_BAO_Domain::getGroupId();
     }
     // custom data set defaults
     $defaults += CRM_Custom_Form_Customdata::setDefaultValues($this);
     return $defaults;
 }