_doc->getAuth()->isLoggedIn()) { $userId = $this->_doc->getAuth()->getData('id'); $this->_getDataObj()->setFilter('userId', $userId); if (sizeof($this->_restParams) == 2) { if (in_array($this->_restParams[0], array('view', 'print')) && filter_var($this->_restParams[1], FILTER_VALIDATE_INT) && $this->_getDataObj()->checkUserOrderAccess($userId, $this->_restParams[1]) ) { $this->_getDataObj()->setPrimaryKey($this->_restParams[1]); $this->_defaultAction = $this->_restParams[0]; } else { $this->_do404(); } } if (Qs_Request::getPostValue('action') == 'update') { if (!Qs_Request::getPostValue('id') || !$this->_getDataObj()->checkUserOrderAccess($userId, Qs_Request::getPostValue('id')) ) { $this->_do404(); } } } else { $this->_doc->authenticate(); } return parent::exec(); } protected function _initFromForm(Qs_Form $form) { $data = array_intersect_key($form->getValues(), array_flip($this->_allowedUpdateField)); $this->_getDataObj()->initFromForm($data); return $this; } protected function _doView() { $item = $this->_getDataObj()->getData(); if (empty($item)) { $this->_doc->display404(); } $this->_setViewHeader($item); $item['config'] = $this->getConfig()->toArray(); $item['printVersion'] = $this->_printVersion; $item['tpl'] = $this->getTemplate('view.tpl'); $item['backUrl'] = ($backUrl = $this->_getBackUrl(CURRENT_PAGE_FINAL)) ? $backUrl : CURRENT_PAGE_FINAL; $this->_addItem($item); $this->_postView(); return $this; } protected function _getLog() { if (null === $this->_log) { parent::_getLog(); $this->_log->setAction('list', 'Viewed "Order History" Page'); } return $this->_log; } protected function _getBackUrl($sessionName = null) { $backUrl = ''; if (is_null($sessionName)){ $sessionName = CURRENT_PAGE; } $session = new Qs_Session_Namespace($sessionName); if (isset($session->backUrl)) { $backUrl = $session->backUrl; } return $backUrl; } }