本文整理汇总了PHP中CRM_Admin_Form::setDefaultValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Admin_Form::setDefaultValues方法的具体用法?PHP CRM_Admin_Form::setDefaultValues怎么用?PHP CRM_Admin_Form::setDefaultValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Admin_Form
的用法示例。
在下文中一共展示了CRM_Admin_Form::setDefaultValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultValues
/**
* 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: setDefaultValues
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: setDefaultValues
/**
* 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: setDefaultValues
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: setDefaultValues
/**
* 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: setDefaultValues
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: setDefaultValues
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: setDefaultValues
/**
* 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('&', '&', $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: setDefaultValues
/**
* 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: setDefaultValues
/**
* 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: setDefaultValues
function setDefaultValues()
{
$defaults = parent::setDefaultValues();
return $defaults;
}
示例12: setDefaultValues
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: setDefaultValues
/**
* 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: setDefaultValues
/**
* 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: setDefaultValues
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();
}
}