. */ namespace SP\Modules\Web\Controllers\UserProfile; use Exception; use JsonException; use SP\Core\Events\Event; use SP\Domain\Core\Acl\AclActionsInterface; use SP\Http\JsonResponse; use SP\Modules\Web\Controllers\Traits\JsonTrait; /** * Class UserProfileController * * @package SP\Modules\Web\Controllers */ final class ViewController extends UserProfileViewBase { use JsonTrait; /** * View action * * @param int $id * * @return bool * @throws JsonException */ public function viewAction(int $id): bool { try { if (!$this->acl->checkUserAccess(AclActionsInterface::PROFILE_VIEW)) { return $this->returnJsonResponse( JsonResponse::JSON_ERROR, __u('You don\'t have permission to do this operation') ); } $this->view->assign('header', __('View Profile')); $this->view->assign('isView', true); $this->setViewData($id); $this->eventDispatcher->notify('show.userProfile', new Event($this)); return $this->returnJsonResponseData(['html' => $this->render()]); } catch (Exception $e) { processException($e); $this->eventDispatcher->notify('exception', new Event($e)); return $this->returnJsonResponseException($e); } } }