public function getUserByType($type) { if (!($type == 'P' || $type == 'O')) { throw new SSSException(ErrorFactory::ERR_WRONG_USER_TYPE); } $userMod = new UserModel(); try { $users = $userMod->getByType($type); $ret['data']['users'] = DataConvertor::objectArrayToArray($users); $ret['result'] = 'success'; return $ret; } catch (SSSException $e) { return $e->getError(); } }
public function checkWebAdminLogin(User $user) { if ($user->getType() != 'A') { return ErrorFactory::getError(ErrorFactory::LOGIN_FAIL_INVALID_USER); } //Check User Login $userMod = new UserModel(); $userFound = $userMod->login($user); //Login Fail if (!$userFound) { return ErrorFactory::getError(ErrorFactory::LOGIN_FAIL_INVALID_USER); } $user->setId($userFound); $ret['result'] = "success"; $ret['data']['user_id'] = $user->getId(); session_start(); $_SESSION['userId'] = $userFound; $_SESSION['userName'] = $user->getName(); $_SESSION['loginDt'] = new \DateTime(); return $ret; }
<?php use Models\User_Model\UserModel; use Utilities\SSSException; require_once '../../../autoload.php'; $userMod = new UserModel(); $pageLoaded = true; try { $observers = $userMod->getByType('O'); // var_dump($observees); } catch (SSSException $e) { $pageLoaded = false; } ?> <?php if ($pageLoaded) { ?> <html> <head> <script type="text/javascript" src="./js/observerMgt.js"></script> </head> <body> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Observer Management <!-- <small>Optional description</small> --> </h1> <!-- <ol class="breadcrumb"> --> <!-- <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li> -->
<?php use Models\User_Model\UserModel; use Utilities\SSSException; require_once '../../../autoload.php'; $userMod = new UserModel(); $pageLoaded = true; try { $observees = $userMod->getByType('P'); // var_dump($observees); } catch (SSSException $e) { $pageLoaded = false; } ?> <?php if ($pageLoaded) { ?> <html> <head> <script type="text/javascript" src="./js/observeeMgt.js"></script> </head> <body> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Observee Management <!-- <small>Optional description</small> --> </h1> <!-- <ol class="breadcrumb"> --> <!-- <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li> -->