. */ namespace SP\Modules\Web\Controllers\Account; use Exception; use SP\Core\Events\Event; use SP\Domain\Core\Acl\AclActionsInterface; use SP\Modules\Web\Util\ErrorUtil; /** * ViewController */ final class ViewController extends AccountViewBase { /** * View action * * @param int $id Account's ID */ public function viewAction(int $id): void { try { $this->view->addTemplate('account'); $accountDetailsResponse = $this->accountService->getByIdEnriched($id); $this->accountService ->withUsers($accountDetailsResponse) ->withUserGroupsById($accountDetailsResponse) ->withTagsById($accountDetailsResponse); $this->accountHelper->setIsView(true); $this->accountHelper->setViewForAccount($accountDetailsResponse, AclActionsInterface::ACCOUNT_VIEW); $this->view->assign( 'title', [ 'class' => 'titleNormal', 'name' => __('Account Details'), 'icon' => $this->icons->view()->getIcon(), ] ); $this->accountService->incrementViewCounter($id); $this->eventDispatcher->notify('show.account', new Event($this)); if ($this->isAjax === false) { $this->upgradeView(); } $this->view(); } catch (Exception $e) { processException($e); $this->eventDispatcher->notify('exception', new Event($e)); if ($this->isAjax === false && !$this->view->isUpgraded()) { $this->upgradeView(); } ErrorUtil::showExceptionInView($this->view, $e, 'account'); } } }