_doc->isPagePreviewMode()) { /** * При прев’юві цмс сторінки, беремо фейкову ід-ку юзера, потрібна на фільтрування ордерів на списку. */ $this->_getDataObj()->addFilter(['userId' => Qs_Config::getByClass('App\User\View')->previewData->userId]); } else if ($this->_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'] = $this->_getBackUrl(CURRENT_PAGE_FINAL, BASE_URL_LANGUAGE . '/' . 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; } }