本文整理汇总了PHP中CRM_Utils_Date::getAllDefaultValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Date::getAllDefaultValues方法的具体用法?PHP CRM_Utils_Date::getAllDefaultValues怎么用?PHP CRM_Utils_Date::getAllDefaultValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Date
的用法示例。
在下文中一共展示了CRM_Utils_Date::getAllDefaultValues方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultValues
/**
* This function sets the default values for the form. For edit/view mode
* the default values are retrieved from the database
*
* @access public
* @return None
*/
function setDefaultValues(&$form)
{
$defaults = array();
$defaults['is_reset_timeline'] = 1;
$defaults['reset_date_time'] = array();
CRM_Utils_Date::getAllDefaultValues($defaults['reset_date_time']);
$defaults['reset_date_time']['i'] = (int) ($defaults['reset_date_time']['i'] / 15) * 15;
$caseType = CRM_Case_PseudoConstant::caseTypeName($form->_caseId);
$defaults['case_type_id'] = $caseType['id'];
return $defaults;
}
示例2: setDefaultValues
function setDefaultValues()
{
$defaults = array();
$contactNames = array();
require_once 'CRM/Case/BAO/Case.php';
if (isset($this->_id)) {
$params = array('id' => $this->_id);
CRM_Case_BAO_Case::retrieve($params, $defaults, $ids);
$defaults['case_contact'] = CRM_Case_BAO_Case::retrieveContactIdsByCaseId($this->_id, $this->_contactID);
$contactNames = CRM_Case_BAO_Case::getcontactNames($this->_id);
foreach ($contactNames as $key => $name) {
$defaults['contact_names'] .= $defaults['contact_names'] ? ",\"{$name}\"" : "\"{$name}\"";
}
}
$this->assign('contactNames', CRM_Utils_Array::value('contact_names', $defaults));
$defaults['case_type_id'] = explode(CRM_Case_BAO_Case::VALUE_SEPERATOR, CRM_Utils_Array::value('case_type_id', $defaults));
$config =& CRM_Core_Config::singleton();
if ($config->civiHRD) {
$defaults['casetag2_id'] = explode(CRM_Case_BAO_Case::VALUE_SEPERATOR, CRM_Utils_Array::value('casetag2_id', $defaults));
$defaults['casetag3_id'] = explode(CRM_Case_BAO_Case::VALUE_SEPERATOR, CRM_Utils_Array::value('casetag3_id', $defaults));
}
if ($this->_action & CRM_Core_Action::ADD || $this->_context == 'search') {
$defaults['start_date'] = array();
CRM_Utils_Date::getAllDefaultValues($defaults['start_date']);
}
//set the assigneed contact count to template
if (!empty($defaults['case_contact'])) {
$this->assign('caseContactCount', count($defaults['case_contact']));
}
return $defaults;
}
示例3: setDefaultValues
/**
* This function sets the default values for the form. For edit/view mode
* the default values are retrieved from the database
*
* @access public
* @return None
*/
function setDefaultValues()
{
$this->_defaults = parent::setDefaultValues();
//return form for ajax
if ($this->_cdType || $this->_addAssigneeContact || $this->_addTargetContact) {
return $this->_defaults;
}
if ($this->_activityId) {
$activityDate = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $this->_activityId, 'activity_date_time');
} else {
// Set activity date-time to now() in create mode
$defaults['activity_date_time'] = array();
CRM_Utils_Date::getAllDefaultValues($defaults['activity_date_time']);
}
// set default encounter medium CRM-4816
if (empty($this->_defaults['medium_id'])) {
require_once "CRM/Core/OptionGroup.php";
$medium = CRM_Core_OptionGroup::values('encounter_medium', false, false, false, 'AND is_default = 1');
if (count($medium) == 1) {
$this->_defaults['medium_id'] = key($medium);
}
}
return $this->_defaults;
}
示例4: createFollowupActivity
/**
* Function to create a follow up a given activity
*
* @activityId int activity id of parent activity
* @param array $activity details
*
* @access public
*/
static function createFollowupActivity($activityId, $params)
{
if (!$activityId) {
return;
}
$session =& CRM_Core_Session::singleton();
$followupParams = array();
$followupParams['parent_id'] = $activityId;
$followupParams['source_contact_id'] = $session->get('userID');
$followupParams['status_id'] = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name');
$followupParams['activity_type_id'] = $params['followup_activity_type_id'];
// Get Subject of Follow-up Activiity, CRM-4491
$followupParams['subject'] = CRM_Utils_Array::value('followup_activity_subject', $params);
//create target contact for followup
if (CRM_Utils_Array::value('target_contact_id', $params)) {
$followupParams['target_contact_id'] = $params['target_contact_id'];
}
CRM_Utils_Date::getAllDefaultValues($currentDate);
$followupDate = CRM_Utils_Date::intervalAdd($params['interval_unit'], $params['interval'], $currentDate);
$followupDate = CRM_Utils_Date::format($followupDate);
$followupParams['activity_date_time'] = $followupDate;
$followupActivity = self::create($followupParams);
return $followupActivity;
}
示例5: setDefaultValues
/**
* This function sets the default values for the form. For edit/view mode
* the default values are retrieved from the database
*
* @access public
* @return None
*/
function setDefaultValues()
{
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::setDefaultValues($this);
}
$defaults = parent::setDefaultValues();
// in update mode, we need to set custom data subtype to tpl
if (CRM_Utils_Array::value('event_type_id', $defaults)) {
$this->assign('customDataSubType', $defaults["event_type_id"]);
}
if (!isset($defaults['start_date'])) {
$defaultDate = array();
CRM_Utils_Date::getAllDefaultValues($defaultDate);
$defaultDate['i'] = (int) ($defaultDate['i'] / 15) * 15;
$defaults['start_date'] = $defaultDate;
}
require_once 'CRM/Core/ShowHideBlocks.php';
$this->_showHide =& new CRM_Core_ShowHideBlocks();
// Show waitlist features or event_full_text if max participants set
if (CRM_Utils_Array::value('max_participants', $defaults)) {
$this->_showHide->addShow('id-waitlist');
if (CRM_Utils_Array::value('has_waitlist', $defaults)) {
$this->_showHide->addShow('id-waitlist-text');
$this->_showHide->addHide('id-event_full');
} else {
$this->_showHide->addHide('id-waitlist-text');
$this->_showHide->addShow('id-event_full');
}
} else {
$this->_showHide->addHide('id-event_full');
$this->_showHide->addHide('id-waitlist');
$this->_showHide->addHide('id-waitlist-text');
}
$this->_showHide->addToTemplate();
$this->assign('elemType', 'table-row');
$this->assign('description', CRM_Utils_Array::value('description', $defaults));
// Provide suggested text for event full and waitlist messages if they're empty
$defaults['event_full_text'] = CRM_Utils_Array::value('event_full_text', $defaults, ts('This event is currently full.'));
$defaults['waitlist_text'] = CRM_Utils_Array::value('waitlist_text', $defaults, ts('This event is currently full. However you can register now and get added to a waiting list. You will be notified if spaces become available.'));
list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults(CRM_Utils_Array::value('start_date', $defaults));
list($defaults['end_date'], $defaults['end_date_time']) = CRM_Utils_Date::setDateDefaults(CRM_Utils_Array::value('end_date', $defaults));
return $defaults;
}