/** * calc_used_date has special sort, see bugs 108 and 127 * * @param \MUtil_Model_ModelAbstract $model */ protected function sortCalcDateCheck(\MUtil_Model_ModelAbstract $model) { $sort = $model->getSort(); if (isset($sort['calc_used_date'])) { $add = true; $resultSort = array(); foreach ($sort as $key => $asc) { if ('calc_used_date' === $key) { if ($add) { $resultSort['is_completed'] = $asc; $resultSort['gto_completion_time'] = $asc == SORT_ASC ? SORT_DESC : SORT_ASC; $resultSort['calc_valid_from'] = $asc; $add = false; // We can add this only once } } else { $resultSort[$key] = $asc; } } if (!$add) { $model->setSort($resultSort); } } }
/** * Set the model to be used by the bridge. * * This method exist to allow overruling in implementation classes * * @param \MUtil_Model_ModelAbstract $model * @return \MUtil_Model_Bridge_TableBridge */ public function setModel(\MUtil_Model_ModelAbstract $model) { $this->sortAscParam = $model->getSortParamAsc(); $this->sortDescParam = $model->getSortParamDesc(); if ($sort = $model->getSort()) { $this->setSort($sort); } return parent::setModel($model); }