コード例 #1
0
ファイル: MessageTemplates.php プロジェクト: ksecor/civicrm
 /**
  * This function sets the default values for the form. 
  * the default values are retrieved from the database
  * 
  * @access public
  * @return None
  */
 public function setDefaultValues()
 {
     $defaults = array();
     $defaults =& parent::setDefaultValues();
     $this->_workflow_id = $defaults['workflow_id'];
     $this->assign('workflow_id', $defaults['workflow_id']);
     return $defaults;
 }
コード例 #2
0
 function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     $config = CRM_Core_Config::singleton();
     require_once 'CRM/Event/PseudoConstant.php';
     $event_type = CRM_Event_PseudoConstant::eventType();
     if (!empty($config->civicrm_events_event_types)) {
         foreach ($config->civicrm_events_event_types as $key => $val) {
             $val = str_replace(" ", "_", $val);
             $eventtype_id = 'eventtype_' . $key;
             if (!empty($config->{$val})) {
                 $config->{$val} = $config->{$val};
             }
             if (!empty($eventtype_id)) {
                 $defaults[$eventtype_id] = $config->{$eventtype_id};
             } else {
                 $defaults[$eventtype_id] = 0;
             }
         }
     }
     if (isset($config->civicrm_event_calendar_title)) {
         $defaults['event_calendar_title'] = $config->civicrm_event_calendar_title;
     } else {
         $config->civicrm_event_calendar_title = 'Event Calendar';
         $defaults['event_calendar_title'] = 'Event Calendar';
     }
     if (isset($config->civicrm_events_event_past)) {
         $defaults['show_past_event'] = $config->civicrm_events_event_past;
     } else {
         $config->civicrm_events_event_past = 1;
         $defaults['show_past_event'] = 1;
     }
     if (isset($config->civicrm_events_event_is_public)) {
         $defaults['event_is_public'] = $config->civicrm_events_event_is_public;
     } else {
         $config->civicrm_events_event_is_public = 1;
         $defaults['event_is_public'] = 1;
     }
     if (isset($config->civicrm_events_event_end_date)) {
         $defaults['show_end_date'] = $config->civicrm_events_event_end_date;
     } else {
         $config->civicrm_events_event_end_date = 1;
         $defaults['show_end_date'] = 1;
     }
     if (isset($config->civicrm_events_event_months)) {
         $defaults['events_event_month'] = $config->civicrm_events_event_months;
     } else {
         $config->civicrm_events_event_months = 0;
         $defaults['events_event_month'] = 0;
     }
     if (isset($config->show_event_from_month)) {
         $defaults['show_event_from_month'] = $config->show_event_from_month;
     } else {
         $config->show_event_from_month = '';
         $defaults['show_event_from_month'] = '';
     }
     return $defaults;
 }
コード例 #3
0
ファイル: ACL.php プロジェクト: ksecor/civicrm
 /**
  * This function sets the default values for the form.
  * 
  * @access public
  * @return None
  */
 function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     if ($this->_action & CRM_Core_Action::ADD) {
         $defaults['object_type'] = 1;
     }
     require_once 'CRM/Core/ShowHideBlocks.php';
     $showHide =& new CRM_Core_ShowHideBlocks();
     if (isset($defaults['object_table'])) {
         switch ($defaults['object_table']) {
             case 'civicrm_saved_search':
                 $defaults['group_id'] = $defaults['object_id'];
                 $defaults['object_type'] = 1;
                 $showHide->addShow("id-group-acl");
                 $showHide->addHide("id-profile-acl");
                 $showHide->addHide("id-custom-acl");
                 $showHide->addHide("id-event-acl");
                 break;
             case 'civicrm_uf_group':
                 $defaults['uf_group_id'] = $defaults['object_id'];
                 $defaults['object_type'] = 2;
                 $showHide->addHide("id-group-acl");
                 $showHide->addShow("id-profile-acl");
                 $showHide->addHide("id-custom-acl");
                 $showHide->addHide("id-event-acl");
                 break;
             case 'civicrm_custom_group':
                 $defaults['custom_group_id'] = $defaults['object_id'];
                 $defaults['object_type'] = 3;
                 $showHide->addHide("id-group-acl");
                 $showHide->addHide("id-profile-acl");
                 $showHide->addShow("id-custom-acl");
                 $showHide->addHide("id-event-acl");
                 break;
             case 'civicrm_event':
                 $defaults['event_id'] = $defaults['object_id'];
                 $defaults['object_type'] = 4;
                 $showHide->addHide("id-group-acl");
                 $showHide->addHide("id-profile-acl");
                 $showHide->addHide("id-custom-acl");
                 $showHide->addShow("id-event-acl");
                 break;
         }
     } else {
         $showHide->addHide("id-group-acl");
         $showHide->addHide("id-profile-acl");
         $showHide->addHide("id-custom-acl");
         $showHide->addHide("id-event-acl");
     }
     // Don't assign showHide elements to template in DELETE mode (fields to be shown and hidden don't exist)
     if (!($this->_action & CRM_Core_Action::DELETE)) {
         $showHide->addToTemplate();
     }
     return $defaults;
 }
コード例 #4
0
 function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     if (!CRM_Utils_Array::value('weight', $defaults)) {
         $query = "SELECT max( `weight` ) as weight FROM `civicrm_booking_resource_config_option`";
         $dao = new CRM_Core_DAO();
         $dao->query($query);
         $dao->fetch();
         $defaults['weight'] = $dao->weight + 1;
     }
     return $defaults;
 }
コード例 #5
0
 /**
  * Set default values.
  *
  * @return array
  */
 public function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     if (empty($defaults['weight'])) {
         $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Event_DAO_ParticipantStatusType');
     }
     $this->_isReserved = CRM_Utils_Array::value('is_reserved', $defaults);
     if ($this->_isReserved) {
         $this->freeze(array('name', 'class', 'is_active'));
     }
     return $defaults;
 }
コード例 #6
0
ファイル: ParticipantStatus.php プロジェクト: bhirsch/voipdev
 function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     if (!CRM_Utils_Array::value('weight', $defaults)) {
         require_once 'CRM/Utils/Weight.php';
         $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Event_DAO_ParticipantStatusType');
     }
     $this->_isReserved = $defaults['is_reserved'];
     if ($this->_isReserved) {
         $this->freeze(array('name', 'class', 'is_active'));
     }
     return $defaults;
 }
コード例 #7
0
 function setDefaultValues()
 {
     $defaults = array_merge(parent::setDefaultValues(), (array) CRM_Core_BAO_Setting::getItem('Eventcalendar', 'events_event_types', null, array()));
     require_once 'CRM/Event/PseudoConstant.php';
     $event_type = CRM_Event_PseudoConstant::eventType();
     if (!empty($event_type)) {
         foreach ($event_type as $key => $val) {
             $eventtype = 'eventtype_' . $key;
             if (empty($defaults[$eventtype])) {
                 $defaults[$eventtype] = 0;
             }
             $eventcolor = 'eventcolor_' . $key;
             if (empty($defaults[$eventcolor])) {
                 $defaults[$eventcolor] = '3366CC';
             }
         }
     }
     if (empty($defaults['event_calendar_title'])) {
         $defaults['event_calendar_title'] = 'Event Calendar';
     }
     if (!isset($defaults['show_end_date'])) {
         $defaults['show_end_date'] = 1;
     }
     if (!isset($defaults['show_past_event'])) {
         $defaults['show_past_event'] = 1;
     }
     if (!isset($defaults['event_is_public'])) {
         $defaults['event_is_public'] = 1;
     }
     if (!isset($defaults['events_event_month'])) {
         $defaults['events_event_month'] = 0;
     }
     if (!isset($defaults['show_event_from_month'])) {
         $defaults['show_event_from_month'] = '';
     }
     $viewset = false;
     foreach (EventCalendarDefines::$fullcalendarviews as $view => $viewName) {
         if (!isset($defaults['calendar_views_' . $view])) {
             $defaults['calendar_views_' . $view] = 0;
         } else {
             $viewset = true;
         }
     }
     if (!$viewset) {
         $defaults['calendar_views_month'] = $defaults['calendar_views_basicWeek'] = $defaults['calendar_views_basicDay'] = 1;
     }
     // set defaults if they havent been already set
     CRM_Core_BAO_Setting::setItem($defaults, 'Eventcalendar', 'events_event_types');
     //~ echo '<pre>'.print_r($defaults,true).'</pre>';
     return $defaults;
 }
コード例 #8
0
ファイル: MessageTemplates.php プロジェクト: bhirsch/voipdev
 /**
  * This function sets the default values for the form. 
  * the default values are retrieved from the database
  * 
  * @access public
  * @return None
  */
 public function setDefaultValues()
 {
     $defaults = array();
     $defaults =& parent::setDefaultValues();
     $this->_workflow_id = CRM_Utils_Array::value('workflow_id', $defaults);
     $this->assign('workflow_id', $this->_workflow_id);
     // FIXME: we need to fix the Cancel button here as we don’t know whether it’s a workflow template in buildQuickForm()
     if ($this->_workflow_id and $this->_action & CRM_Core_Action::UPDATE) {
         $cancelURL = CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1');
         $cancelURL = str_replace('&amp;', '&', $cancelURL);
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'), 'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"))));
     }
     return $defaults;
 }
コード例 #9
0
ファイル: OptionValue.php プロジェクト: ksecor/civicrm
 /**
  * This function sets the default values for the form. 
  * the default values are retrieved from the database
  * 
  * @access public
  * @return None
  */
 function setDefaultValues()
 {
     $defaults = array();
     $defaults = parent::setDefaultValues();
     if (!CRM_Utils_Array::value('weight', $defaults)) {
         $query = "SELECT max( `weight` ) as weight FROM `civicrm_option_value` where option_group_id=" . $this->_gid;
         $dao =& new CRM_Core_DAO();
         $dao->query($query);
         $dao->fetch();
         $defaults['weight'] = $dao->weight + 1;
     }
     //setDefault of contact types for email greeting, postal greeting, addressee, CRM-4575
     if (in_array($this->_gName, array('email_greeting', 'postal_greeting', 'addressee'))) {
         $defaults['contactOptions'] = CRM_Utils_Array::value('filter', $defaults);
     }
     return $defaults;
 }
コード例 #10
0
ファイル: OptionValue.php プロジェクト: hguru/224Civi
 /**
  * This function sets the default values for the form.
  * the default values are retrieved from the database
  *
  * @access public
  *
  * @return None
  */
 function setDefaultValues()
 {
     $defaults = array();
     $defaults = parent::setDefaultValues();
     if (!CRM_Utils_Array::value('weight', $defaults)) {
         $query = "SELECT max( `weight` ) as weight FROM `civicrm_option_value` where option_group_id=" . $this->_gid;
         $dao = new CRM_Core_DAO();
         $dao->query($query);
         $dao->fetch();
         $defaults['weight'] = $dao->weight + 1;
     }
     // CRM-11516
     if ($this->_gName == 'payment_instrument' && $this->_id) {
         $defaults['financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($this->_id, 'civicrm_option_value', 'financial_account_id');
     }
     //setDefault of contact types for email greeting, postal greeting, addressee, CRM-4575
     if (in_array($this->_gName, array('email_greeting', 'postal_greeting', 'addressee'))) {
         $defaults['contactOptions'] = CRM_Utils_Array::value('filter', $defaults);
     }
     return $defaults;
 }
コード例 #11
0
 function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     return $defaults;
 }
コード例 #12
0
ファイル: RelationshipType.php プロジェクト: bhirsch/voipdev
 function setDefaultValues()
 {
     if ($this->_action != CRM_Core_Action::DELETE && isset($this->_id)) {
         $defaults = $params = array();
         $params = array('id' => $this->_id);
         require_once str_replace('_', DIRECTORY_SEPARATOR, $this->_BAOName) . ".php";
         eval($this->_BAOName . '::retrieve( $params, $defaults );');
         $defaults['contact_types_a'] = $defaults['contact_type_a'];
         if ($defaults['contact_sub_type_a']) {
             $defaults['contact_types_a'] .= CRM_Core_DAO::VALUE_SEPARATOR . $defaults['contact_sub_type_a'];
         }
         $defaults['contact_types_b'] = $defaults['contact_type_b'];
         if ($defaults['contact_sub_type_b']) {
             $defaults['contact_types_b'] .= CRM_Core_DAO::VALUE_SEPARATOR . $defaults['contact_sub_type_b'];
         }
         return $defaults;
     } else {
         return parent::setDefaultValues();
     }
 }
コード例 #13
0
ファイル: Options.php プロジェクト: nielosz/civicrm-core
 /**
  * Set default values for the form.
  */
 public function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     // Default weight & value
     $fieldValues = array('option_group_id' => $this->_gid);
     foreach (array('weight', 'value') as $field) {
         if (empty($defaults[$field])) {
             $defaults[$field] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', $fieldValues, $field);
         }
     }
     //setDefault of contact types for email greeting, postal greeting, addressee, CRM-4575
     if (in_array($this->_gName, array('email_greeting', 'postal_greeting', 'addressee'))) {
         $defaults['contactOptions'] = CRM_Utils_Array::value('filter', $defaults) ? $defaults['filter'] : NULL;
     }
     // CRM-11516
     if ($this->_gName == 'payment_instrument' && $this->_id) {
         $defaults['financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($this->_id, 'civicrm_option_value', 'financial_account_id');
     }
     return $defaults;
 }
コード例 #14
0
 /**
  * This function sets the default values for the form.
  * the default values are retrieved from the database.
  *
  * @param null
  *
  * @return array    array of default values
  * @access public
  */
 function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     if (!isset($defaults['weight']) || !$defaults['weight']) {
         $fieldValues = array('option_group_id' => $this->_gid);
         $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', $fieldValues);
     }
     return $defaults;
 }
コード例 #15
0
ファイル: RelationshipType.php プロジェクト: hguru/224Civi
 function setDefaultValues()
 {
     if ($this->_action != CRM_Core_Action::DELETE && isset($this->_id)) {
         $defaults = $params = array();
         $params = array('id' => $this->_id);
         $baoName = $this->_BAOName;
         $baoName::retrieve($params, $defaults);
         $defaults['contact_types_a'] = CRM_Utils_Array::value('contact_type_a', $defaults);
         if (CRM_Utils_Array::value('contact_sub_type_a', $defaults)) {
             $defaults['contact_types_a'] .= '__' . $defaults['contact_sub_type_a'];
         }
         $defaults['contact_types_b'] = $defaults['contact_type_b'];
         if (CRM_Utils_Array::value('contact_sub_type_b', $defaults)) {
             $defaults['contact_types_b'] .= '__' . $defaults['contact_sub_type_b'];
         }
         return $defaults;
     } else {
         return parent::setDefaultValues();
     }
 }
コード例 #16
0
ファイル: Options.php プロジェクト: bhirsch/voipdev
 /**
  * This function sets the default values for the form. 
  * the default values are retrieved from the database
  * 
  * @access public
  * @return None
  */
 function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     if (!isset($defaults['weight']) || !$defaults['weight']) {
         $fieldValues = array('option_group_id' => $this->_gid);
         $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', $fieldValues);
     }
     //setDefault of contact types for email greeting, postal greeting, addressee, CRM-4575
     if (in_array($this->_gName, array('email_greeting', 'postal_greeting', 'addressee'))) {
         $defaults['contactOptions'] = CRM_Utils_Array::value('filter', $defaults) ? $defaults['filter'] : null;
     }
     return $defaults;
 }