/** * Prcesses the filter for the date selector and return the filter to use instead * * @param \Zend_Controller_Request_Abstract $request * @param array $filter * @param string $dateField * @return array The new complete filter to use */ public function getFilter(\Zend_Controller_Request_Abstract $request, array $filter = array(), $dateField = null) { $this->_actionKey = $request->getActionKey(); // \MUtil_Echo::r($filter, __CLASS__ . '->' . __FUNCTION__ .' 1'); $filter = $this->processFilter($request, $filter); if ($filter) { $model = $this->getModel(); $model->addFilter($filter); } // \MUtil_Echo::r($filter, __CLASS__ . '->' . __FUNCTION__ . ' 2'); $newfilter = $filter; if ($this->dateCurrentStart && $this->dateCurrentEnd) { if (null === $dateField) { $dateField = $this->dateFrom; } $start = $this->dateCurrentStart->getIso(); $end = $this->dateCurrentEnd->getIso(); $newfilter[] = "{$dateField} BETWEEN '{$start}' AND '{$end}'"; } if ($this->dateGroup) { $fields = $this->getFields(); if (isset($fields[$this->dateGroup])) { if ($groupfilter = $fields[$this->dateGroup]->getFilter()) { $newfilter[] = $groupfilter; } } } return $newfilter; }