protected function initializeDefaultValues() { $this->arrSearchOptions = array('product_name' => &$GLOBALS['TL_LANG']['ISO_REPORT']['product_name']); $this->arrSortingOptions = array('product_name' => &$GLOBALS['TL_LANG']['ISO_REPORT']['product_name'], 'total' => &$GLOBALS['TL_LANG']['ISO_REPORT']['total_sales']); // Set default session data $arrSession = \Session::getInstance()->get('iso_reports'); if ($arrSession[$this->name]['tl_sort'] == '') { $arrSession[$this->name]['tl_sort'] = 'total'; } \Session::getInstance()->set('iso_reports', $arrSession); parent::initializeDefaultValues(); }
protected function initializeDefaultValues() { // Set default session data $arrSession = \Session::getInstance()->get('iso_reports'); if ($arrSession[$this->name]['period'] == '') { $arrSession[$this->name]['period'] = 'month'; } if ($arrSession[$this->name]['stop'] == '') { $arrSession[$this->name]['stop'] = time(); } elseif (!is_numeric($arrSession[$this->name]['stop'])) { // Convert date formats into timestamps try { $objDate = new \Date($arrSession[$this->name]['stop'], $GLOBALS['TL_CONFIG']['dateFormat']); $arrSession[$this->name]['stop'] = $objDate->tstamp; } catch (\OutOfBoundsException $e) { \Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['date'], $GLOBALS['TL_CONFIG']['dateFormat'])); $arrSession[$this->name]['stop'] = time(); } } if ($arrSession[$this->name]['start'] == '') { $arrSession[$this->name]['start'] = strtotime('-6 months'); } elseif (!is_numeric($arrSession[$this->name]['start'])) { // Convert date formats into timestamps try { $objDate = new \Date($arrSession[$this->name]['start'], $GLOBALS['TL_CONFIG']['dateFormat']); $arrSession[$this->name]['start'] = $objDate->tstamp; } catch (\OutOfBoundsException $e) { \Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['date'], $GLOBALS['TL_CONFIG']['dateFormat'])); $arrSession[$this->name]['start'] = strtotime('-6 months'); } } \Session::getInstance()->set('iso_reports', $arrSession); parent::initializeDefaultValues(); }