本文整理匯總了PHP中CRM_Report_Form::getFromTo方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Report_Form::getFromTo方法的具體用法?PHP CRM_Report_Form::getFromTo怎麽用?PHP CRM_Report_Form::getFromTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Report_Form
的用法示例。
在下文中一共展示了CRM_Report_Form::getFromTo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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];
}
}
}
示例2: dateParam
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);
}
if (!($from || $to)) {
return false;
} else {
if ($from || $to || $relative) {
// unset other criteria
self::unsetFilters($defaults);
}
}
$defaults["{$fieldName}_from"] = CRM_Utils_Date::unformat($from, '');
$defaults["{$fieldName}_to"] = CRM_Utils_Date::unformat($to, '');
}
示例3: beginPostProcess
function beginPostProcess()
{
parent::beginPostProcess();
$this->_ranges = array('interval_0' => array());
$dateFields = array('receive_date' => '', 'comparison_date' => 'comparison_', 'report_date' => 'report_date');
$earliestDate = date('Y-m-d');
$latestDate = date('Y-m-d', strtotime('50 years ago'));
foreach ($dateFields as $fieldName => $prefix) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
$from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
$to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$fromTime = CRM_Utils_Array::value("{$fieldName}_from_time", $this->_params);
$toTime = CRM_Utils_Array::value("{$fieldName}_to_time", $this->_params);
list($from, $to) = CRM_Report_Form::getFromTo($relative, $from, $to, $fromTime, $toTime);
$this->_ranges['interval_0'][$prefix . 'from_date'] = DATE('Y-m-d', strtotime($from));
$this->_ranges['interval_0'][$prefix . 'to_date'] = DATE('Y-m-d', strtotime($to));
if (strtotime($from) < strtotime($earliestDate)) {
$earliestDate = date('m/d/Y', strtotime($from));
}
if (strtotime($to) > strtotime($latestDate)) {
$latestDate = date('m/d/Y', strtotime($to));
}
}
// now we will re-set the receive date range to reflect the largest
// & smallest dates we are interested in
$this->_params['report_date_from'] = $earliestDate;
$this->_params['report_date_to'] = $latestDate;
$this->_params['report_date_relative'] = '0';
$this->_columns['civicrm_contribution']['filters']['report_date'] = $this->_columns['civicrm_contribution']['filters']['receive_date'];
$this->_columns['civicrm_contribution']['filters']['report_date']['title'] = 'Report Date Range';
$this->_columns['civicrm_contribution']['filters']['report_date']['pseudofield'] = FALSE;
$this->_statuses = array($this->_params['behaviour_type_value']);
}
開發者ID:eileenmcnaughton,項目名稱:net.ourpowerbase.report.advancedfundraising,代碼行數:33,代碼來源:AggregatePledgeDetails.php