/** * This function is to build the date range - relative or absolute * * @param Object $form the form object that we are operating on * * @static * @access public */ static function buildDateRange(&$form, $fieldName, $count = 1, $from = '_from', $to = '_to', $fromLabel = 'From:', $required = FALSE, $addReportFilters = TRUE, $dateFormat = 'searchDate') { $selector = array(ts('Choose Date Range'), 'this.year' => ts('This Year'), 'this.fiscal_year' => ts('This Fiscal Year'), 'this.quarter' => ts('This Quarter'), 'this.month' => ts('This Month'), 'this.week' => ts('This Week'), 'this.day' => ts('This Day'), 'previous.year' => ts('Previous Year'), 'previous.fiscal_year' => ts('Previous Fiscal Year'), 'previous.quarter' => ts('Previous Quarter'), 'previous.month' => ts('Previous Month'), 'previous.week' => ts('Previous Week'), 'previous.day' => ts('Previous Day'), 'previous_before.year' => ts('Prior to Previous Year'), 'previous_before.quarter' => ts('Prior to Previous Quarter'), 'previous_before.month' => ts('Prior to Previous Month'), 'previous_before.week' => ts('Prior to Previous Week'), 'previous_before.day' => ts('Prior to Previous Day'), 'previous_2.year' => ts('Previous 2 Years'), 'previous_2.quarter' => ts('Previous 2 Quarters'), 'previous_2.month' => ts('Previous 2 Months'), 'previous_2.week' => ts('Previous 2 Weeks'), 'previous_2.day' => ts('Previous 2 Days'), 'earlier.year' => ts('To End of Prior Year'), 'earlier.quarter' => ts('To End of Prior Quarter'), 'earlier.month' => ts('To End of Prior Month'), 'earlier.week' => ts('To End of Prior Week'), 'earlier.day' => ts('To End of Prior Day'), 'greater.year' => ts('Current Year to-date'), 'greater.quarter' => ts('Current Quarter to-date'), 'greater.month' => ts('Current Month to-date'), 'greater.week' => ts('Current Week to-date'), 'greater.day' => ts('Current Day'), 'ending.year' => ts('From 12 Months Ago'), 'ending.quarter' => ts('From 3 Months Ago'), 'ending.month' => ts('From 1 Month Ago'), 'ending.week' => ts('From 1 Week Ago')); if ($addReportFilters) { $selector += CRM_Report_Form::getOperationPair(CRM_Report_FORM::OP_DATE); } $config = CRM_Core_Config::singleton(); //if fiscal year start on 1 jan then remove fiscal year task //form list if ($config->fiscalYearStart['d'] == 1 & $config->fiscalYearStart['M'] == 1) { unset($selector['this.fiscal_year']); unset($selector['previous.fiscal_year']); } $form->add('select', "{$fieldName}_relative", ts('Relative Date Range'), $selector, $required, array('onclick' => "showAbsoluteRange(this.value, '{$fieldName}_relative');")); $form->addDateRange($fieldName, $from, $to, $fromLabel, $dateFormat); }
/** * This function is to build the date range - relative or absolute * * @param Object $form the form object that we are operating on * * @static * @access public */ static function buildDateRange(&$form, $fieldName, $count = 1, $required = false, $addReportFilters = true) { $selector = array(ts('Choose Date Range'), 'this.year' => ts('This Year'), 'this.fiscal_year' => ts('This Fiscal Year'), 'this.quarter' => ts('This Quarter'), 'this.month' => ts('This Month'), 'this.week' => ts('This Week'), 'this.day' => ts('This Day'), 'previous.year' => ts('Previous Year'), 'previous.fiscal_year' => ts('Previous Fiscal Year'), 'previous.quarter' => ts('Previous Quarter'), 'previous.month' => ts('Previous Month'), 'previous.week' => ts('Previous Week'), 'previous.day' => ts('Previous Day'), 'previous_before.year' => ts('Previous Before Year'), 'previous_before.quarter' => ts('Previous Before Quarter'), 'previous_before.month' => ts('Previous Before Month'), 'previous_before.week' => ts('Previous Before Week'), 'previous_before.day' => ts('Previous Before Day'), 'previous_2.year' => ts('Previous 2 Years'), 'previous_2.quarter' => ts('Previous 2 Quarters'), 'previous_2.month' => ts('Previous 2 Months'), 'previous_2.week' => ts('Previous 2 Weeks'), 'previous_2.day' => ts('Previous 2 Days'), 'earlier.year' => ts('Earlier Year'), 'earlier.quarter' => ts('Earlier Quarter'), 'earlier.month' => ts('Earlier Month'), 'earlier.week' => ts('Earlier Week'), 'earlier.day' => ts('Earlier Day'), 'greater.year' => ts('Greater Year'), 'greater.quarter' => ts('Greater Quarter'), 'greater.month' => ts('Greater Month'), 'greater.week' => ts('Greater Week'), 'greater.day' => ts('Greater Day')); if ($addReportFilters) { require_once 'CRM/Report/Form.php'; $selector += CRM_Report_Form::getOperationPair(CRM_Report_FORM::OP_DATE); } $config =& CRM_Core_Config::singleton(); //if fiscal year start on 1 jan then remove fiscal year task //form list if ($config->fiscalYearStart['d'] == 1 & $config->fiscalYearStart['M'] == 1) { unset($selector['this.fiscal_year']); unset($selector['previous.fiscal_year']); } $form->add('select', "{$fieldName}_relative", ts('Relative Date Range'), $selector, $required, array('onclick' => "showAbsoluteRange(this.value, '{$fieldName}_relative');")); $form->addDateRange($fieldName); }
/** * Override "This Year" $op options * @param string $type * @param null $fieldName * * @return array */ public function getOperationPair($type = "string", $fieldName = NULL) { if ($fieldName == 'yid') { return array('calendar' => ts('Is Calendar Year'), 'fiscal' => ts('Fiscal Year Starting')); } return parent::getOperationPair($type, $fieldName); }
/** * Note: $fieldName param allows inheriting class to build operationPairs * specific to a field. * * @param string $type * @param null $fieldName * * @return array */ function getOperationPair($type = "string", $fieldName = NULL) { if ($type == self::OP_SINGLEDATE) { return array( 'to' => ts('Until Date'), 'from' => ts('From Date'), ); } return parent::getOperationPair($type, $fieldName); }
function getOperationPair($type = "string", $fieldName = NULL) { if ($fieldName == 'gid' && $type == CRM_Report_Form::OP_MULTISELECT) { return array('in' => ts('Is one of'), 'mand' => ts('Is equal to')); } else { return parent::getOperationPair($type); } }