本文整理汇总了PHP中CRM_Utils_Date::setDateDefaults方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Date::setDateDefaults方法的具体用法?PHP CRM_Utils_Date::setDateDefaults怎么用?PHP CRM_Utils_Date::setDateDefaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Date
的用法示例。
在下文中一共展示了CRM_Utils_Date::setDateDefaults方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultValues
function setDefaultValues()
{
$defaults = array('include_morning' => $this->_includeMorning, 'show_details' => $this->_showDetails, 'not_signed_out' => $this->_notSignedOut);
list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults($this->_startDate);
list($defaults['end_date'], $defaults['end_date_time']) = CRM_Utils_Date::setDateDefaults($this->_endDate);
return $defaults;
}
示例2: setDefaultValues
public function setDefaultValues($freez = 1)
{
$defaults = array();
if ($this->_objectID) {
$sql = "SELECT * FROM {$this->_tableName} WHERE id={$this->_objectID}";
$dao = CRM_Core_DAO::executeQuery($sql);
if ($this->_action & CRM_Core_Action::DELETE) {
if ($this->_object != 'fee') {
while ($dao->fetch()) {
$this->assign('class', $dao->class);
}
}
return $defaults;
}
while ($dao->fetch()) {
foreach ($this->_customFields as $field) {
if (property_exists($dao, $field)) {
if (in_array($field, array('signin_time', 'signout_time', 'fee_date'))) {
list($defaults[$field], $defaults[$field . '_time']) = CRM_Utils_Date::setDateDefaults($dao->{$field});
} else {
$defaults[$field] = $dao->{$field};
}
}
}
}
} elseif ($id = CRM_Utils_Request::retrieve('id', 'Integer', $this, false)) {
$defaults['entity_id'] = $id;
}
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(&$form)
{
$defaults = array();
if ($form->_context == 'caseActivity') {
return $defaults;
}
list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults();
// set default case status, case type, encounter medium, location type and phone type defaults are set in DB
$caseStatus = CRM_Core_OptionGroup::values('case_status', FALSE, FALSE, FALSE, 'AND is_default = 1');
if (count($caseStatus) == 1) {
$defaults['status_id'] = key($caseStatus);
}
$caseType = CRM_Core_OptionGroup::values('case_type', FALSE, FALSE, FALSE, 'AND is_default = 1');
if (count($caseType) == 1) {
$defaults['case_type_id'] = key($caseType);
}
$medium = CRM_Core_OptionGroup::values('encounter_medium', FALSE, FALSE, FALSE, 'AND is_default = 1');
if (count($medium) == 1) {
$defaults['medium_id'] = key($medium);
}
$defaultLocationType = CRM_Core_BAO_LocationType::getDefault();
if ($defaultLocationType->id) {
$defaults['location[1][location_type_id]'] = $defaultLocationType->id;
}
$phoneType = CRM_Core_OptionGroup::values('phone_type', FALSE, FALSE, FALSE, 'AND is_default = 1');
if (count($phoneType) == 1) {
$defaults['location[1][phone][1][phone_type_id]'] = key($phoneType);
}
return $defaults;
}
示例4: setDefaultValues
/**
* Set the default form values.
*
* @return array
* the default array reference
*/
public function setDefaultValues()
{
$defaults = array();
// note we intentionally overwrite value since we use it as defaults
// and its all pass by value
// we need to figure out the type, so we can either set an array element
// or a scalar -- FIX ME sometime please
foreach ($_GET as $key => $value) {
if (substr($key, 0, 7) == 'custom_' || $key == "preferred_communication_method") {
if (strpos($value, CRM_Core_DAO::VALUE_SEPARATOR) !== FALSE) {
$v = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
$value = array();
foreach ($v as $item) {
if ($item) {
$value[$item] = $item;
}
}
}
} elseif ($key == 'group' || $key == 'tag') {
$v = explode(',', $value);
$value = array();
foreach ($v as $item) {
$value[$item] = 1;
}
} elseif (in_array($key, array('birth_date', 'deceased_date'))) {
list($value) = CRM_Utils_Date::setDateDefaults($value);
}
$defaults[$key] = $value;
}
return $defaults;
}
示例5: dateParam
/**
* @param string $fieldName
* @param $field
* @param $defaults
*
* @return bool
*/
public static function dateParam($fieldName, &$field, &$defaults)
{
// type = 12 (datetime) is not recognized by Utils_Type::escape() method,
// and therefore the below hack
$type = 4;
$from = self::getTypedValue("{$fieldName}_from", $type);
$to = self::getTypedValue("{$fieldName}_to", $type);
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $_GET);
if ($relative) {
list($from, $to) = CRM_Report_Form::getFromTo($relative, NULL, NULL);
$from = substr($from, 0, 8);
$to = substr($to, 0, 8);
}
if (!($from || $to)) {
return FALSE;
}
if ($from !== NULL) {
$dateFrom = CRM_Utils_Date::setDateDefaults($from);
if ($dateFrom !== NULL && !empty($dateFrom[0])) {
$defaults["{$fieldName}_from"] = $dateFrom[0];
}
}
if ($to !== NULL) {
$dateTo = CRM_Utils_Date::setDateDefaults($to);
if ($dateTo !== NULL && !empty($dateTo[0])) {
$defaults["{$fieldName}_to"] = $dateTo[0];
}
}
}
示例6: setDefaultValues
public function setDefaultValues()
{
$defaults = array();
try {
$defaults['rood_mtype'] = civicrm_api3('MembershipType', 'getvalue', array('return' => 'id', 'name' => 'Lid SP en ROOD'));
} catch (Exception $e) {
//do nothing
}
try {
$defaults['rood_mstatus'] = civicrm_api3('MembershipStatus', 'getvalue', array('return' => 'id', 'name' => 'Correctie'));
} catch (Exception $e) {
//do nothing
}
try {
$defaults['sp_mtype'] = civicrm_api3('MembershipType', 'getvalue', array('return' => 'id', 'name' => 'Lid SP'));
} catch (Exception $e) {
//do nothing
}
try {
$status = civicrm_api3('MembershipStatus', 'getvalue', array('return' => 'id', 'name' => 'current'));
$defaults['member_status_id'][$status] = $status;
} catch (Exception $e) {
//do nothing
}
$date = new DateTime();
$date->modify('-26 years');
$date->modify('first day of this year');
list($defaults['birth_date_from']) = CRM_Utils_Date::setDateDefaults($date->format('Y-m-d'));
$date->modify('last day of this year');
list($defaults['birth_date_to']) = CRM_Utils_Date::setDateDefaults($date->format('Y-m-d'));
$minimum_fee = CRM_Core_BAO_Setting::getItem('nl.sp.rood', 'minimum_fee', null, '5.00');
$defaults['minimum_fee'] = $minimum_fee;
return $defaults;
}
示例7: 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();
if ($form->_context == 'caseActivity') {
return $defaults;
}
require_once 'CRM/Utils/Date.php';
list($defaults['start_date']) = CRM_Utils_Date::setDateDefaults();
// set case status to 'ongoing'
$defaults['status_id'] = 1;
// set default encounter medium, location type and phone type defaults are set in DB
require_once "CRM/Core/OptionGroup.php";
$medium = CRM_Core_OptionGroup::values('encounter_medium', false, false, false, 'AND is_default = 1');
if (count($medium) == 1) {
$defaults['medium_id'] = key($medium);
}
require_once 'CRM/Core/BAO/LocationType.php';
$defaultLocationType =& CRM_Core_BAO_LocationType::getDefault();
if ($defaultLocationType->id) {
$defaults['location[1][location_type_id]'] = $defaultLocationType->id;
}
$phoneType = CRM_Core_OptionGroup::values('phone_type', false, false, false, 'AND is_default = 1');
if (count($phoneType) == 1) {
$defaults['location[1][phone][1][phone_type_id]'] = key($phoneType);
}
return $defaults;
}
示例8: setDefaultValues
/**
* Set default values for the form. For edit/view mode
* the default values are retrieved from the database
*
*
* @return array
*/
public function setDefaultValues()
{
$defaults = array();
//Always pass current event's start date by default
$currentEventStartDate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'start_date', 'id');
list($defaults['repetition_start_date'], $defaults['repetition_start_date_time']) = CRM_Utils_Date::setDateDefaults($currentEventStartDate, 'activityDateTime');
$recurringEntityDefaults = CRM_Core_Form_RecurringEntity::setDefaultValues();
return array_merge($defaults, $recurringEntityDefaults);
}
示例9: 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
*/
static function setDefaultValues(&$form)
{
$defaults = array();
$defaults['is_reset_timeline'] = 1;
$defaults['reset_date_time'] = array();
list($defaults['reset_date_time'], $defaults['reset_date_time_time']) = CRM_Utils_Date::setDateDefaults(NULL, 'activityDateTime');
$defaults['case_type_id'] = $form->_caseTypeId;
return $defaults;
}
示例10: 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();
list($defaults['reset_date_time'], $defaults['reset_date_time_time']) = CRM_Utils_Date::setDateDefaults(null, 'activityDateTime');
$caseType = CRM_Case_PseudoConstant::caseTypeName($form->_caseId);
$defaults['case_type_id'] = $caseType['id'];
return $defaults;
}
示例11: setDefaultValues
function setDefaultValues()
{
$defaults = array();
if ($this->_id) {
$defaults = CRM_HRAbsence_BAO_HRAbsencePeriod::getDefaultValues($this->_id);
list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['start_date'], 'activityDateTime');
list($defaults['end_date'], $defaults['end_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['end_date'], 'activityDateTime');
}
return $defaults;
}
示例12: 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();
if ($this->_id) {
$params['id'] = $this->_id;
require_once 'CRM/Pledge/BAO/Payment.php';
CRM_Pledge_BAO_Payment::retrieve($params, $defaults);
list($defaults['scheduled_date']) = CRM_Utils_Date::setDateDefaults($defaults['scheduled_date']);
$statuses = CRM_Contribute_PseudoConstant::contributionStatus();
$this->assign('status', $statuses[$defaults['status_id']]);
}
return $defaults;
}
示例13: setDefaultValues
function setDefaultValues()
{
$defaults = array();
list($defaults['ptc_date'], $defaults['ptc_date_time']) = CRM_Utils_Date::setDateDefaults(date("Y-m-d", time() + 14 * 24 * 60 * 60));
$defaults['ptc_duration'] = 25;
for ($i = 1; $i < 6; $i++) {
$time = (int) ($i + 1) / 2;
$defaults["ptc_date_{$i}_time"] = "{$time}:00 PM";
$i++;
$defaults["ptc_date_{$i}_time"] = "{$time}:30 PM";
}
return $defaults;
}
示例14: setDefaultValues
/**
* This function is called prior to building and submitting the form and after the preProcess
*/
function setDefaultValues()
{
$defaults = array();
$defaults = $this->_values;
// current employer id
$defaults['current_employer_id'] = trim($defaults['employer_id']);
// datum in dienst
if (isset($defaults['Datum_in_dienst'])) {
list($defaults['Datum_in_dienst']) = CRM_Utils_Date::setDateDefaults($defaults['Datum_in_dienst']);
// list is needed or else it does not work
}
return $defaults;
}
示例15: setDefaultValues
/**
* Set default values for the form.
* the default values are retrieved from the database
*
*
* @return void
*/
public function setDefaultValues()
{
$defaults = array();
if ($this->_id) {
$params['id'] = $this->_id;
CRM_Pledge_BAO_PledgePayment::retrieve($params, $defaults);
list($defaults['scheduled_date']) = CRM_Utils_Date::setDateDefaults($defaults['scheduled_date']);
if (isset($defaults['contribution_id'])) {
$this->assign('pledgePayment', TRUE);
}
$status = CRM_Contribute_PseudoConstant::contributionStatus($defaults['status_id']);
$this->assign('status', $status);
}
$defaults['option_type'] = 1;
return $defaults;
}