_getDataObj()->setFilter('vendorId', $this->_doc->getAuth()->getData('vendorId')); return parent::exec(); } protected function _getDefaultLinks() { return ['new' => 'New Application']; } protected function _doView() { $licenseId = $this->_getDataObj()->getPrimaryKey(); $vendorId = $this->_doc->getAuthData('vendorId'); if (!$this->_getDataObj()->hasAccessToLicense($vendorId, $licenseId)) { return $this->_do404(); } $options = $this->_doc->getOptions(); $options['doc'] = $this->_doc; $options['licenseId'] = $licenseId; $options['handler'] = 'user'; $view = new DetailPageView($options); $view->exec(); return $this; } protected function _doNew() { if ($this->_getDataObj()->getModel()->hasApprovedLicense($this->_doc->getAuthData('vendorId'))) { $this->_setBackError($this->getConfig('errorAlreadyHasApproveLicense')); $this->_doBack(); return $this; } $view = new LicenseView(); $view->clearSession(); $url = LicenseView::getStepUrl(LicenseView::STEP_NAICS); $this->redirect($url); return $this; } protected function _doRenew() { $view = new LicenseView(); $view->clearSession(); if (!($license = $this->_getDataObj()->getData())) { $this->_do404(); } $view->setSessionOptions([ 'action' => LicenseView::ACTION_RENEW, 'id' => $license['id'], ]); $view->saveStepData(LicenseView::STEP_NAICS, ['naicsCodes' => array_column($license['naicsCodes'], 'id')]); $edit = 'y' === Qs_Request::getGetValue('edit', 'y'); $url = LicenseView::getStepUrl($edit ? LicenseView::STEP_NAICS : LicenseView::STEP_PAYMENT); $this->redirect($url); } protected function _doList() { $this->_doc->addScript('js/app/license/userLicenseList.js'); $dialogId = 'renew-dialog'; $this->_doc->addInitObject('app.license.userLicenseList', [[ 'id' => $this->_getList()->getAttrib('id'), 'nodes' => [ 'btnRenew' => '[data-action="renew"]', 'dialog' => '#' . $dialogId, 'dialogBtnYes' => '#' . $dialogId . ' [data-dialog-btn="yes"]', 'dialogBtnNo' => '#' . $dialogId . ' [data-dialog-btn="no"]', ], ]]); $this->_doc->addItem( [ 'id' => $dialogId, 'tpl' => $this->getTemplate('renewDialog.tpl'), ], 'AFTER_BODY' ); return parent::_doList(); } protected function _doBecomePremium() { $tribeId = Qs_Request::getGetValue('tribeId'); $licenseId = Qs_Request::getGetValue('licenseId'); try { (new LicensePremiumView(['doc' => $this->_doc]))->setTribeLicenseKey(compact('tribeId', 'licenseId')); $this->redirect(LicensePremiumView::getStepUrl(LicensePremiumView::STEP_PAYMENT)); } catch (Exception $e) { $this->_doc->displayError($e->getMessage()); } return $this; } }