public function __construct($user_id) { $factory = new \Service\Passport\Model_Factory(); if (!empty($user_id)) { $user = $factory->users->getByID($user_id); $this->is_auth = true; $this->username = $user->Title; $this->is_admin = \Service\Passport\Controller_Auth::isUserAccessLevel_static(); if ($this->is_admin) { $this->url_admin = $factory->factoryPages->router->route_admin->route_index->makeUrl(); } $this->url_cabinet = $factory->router->route_client->route_user_events->makeUrl($user_id); $this->url_settings = $factory->router->route_client->route_user_profile->makeUrl($user_id); $this->url_logout = $factory->router->route_client->route_logout->makeUrl(); $photos = $factory->factoryPhotos->photos->getPhotosByRecord($user, \Service\Passport\Model_Users_User::FIELD_opt_Photo, \Service\Passport\Model_Config::PHOTO_GROUP_SMALL); foreach ($photos as $i => $photo) { if ($i > 0) { continue; } $this->url_photo = $photo->Url; } } $this->url_login = $factory->router->route_client->route_login->makeUrl(); $this->url_register = $factory->router->route_client->route_register->makeUrl(); }
public function actionPrepare() { parent::actionPrepare(); if (!\Service\Passport\Controller_Auth::is_auth_static() || !\Service\Passport\Controller_Auth::isAdmin_static()) { return $this->response->setRedirect('/404.html'); } $this->factory_orm = $this->getServiceOrm(); return null; }
public function __construct() { $this->menu = $this->getLeftMenu(); $user_id = \Service\Passport\Controller_Auth::UserID(); if (null !== $user_id) { $factory = new \Service\Passport\Model_Factory(); $user = $factory->users->getByID($user_id); if (null !== $user) { $this->user = $user; } } }