/**
  * Returns an singleton instance of this class
  *
  * @param object $config
  * @param object $args
  * @return
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new AdminsManager();
     }
     return self::$instance;
 }
Esempio n. 2
0
 /**
  * Validates user credentials 
  * 
  * @return TRUE - if validation passed, and FALSE - otherwise
  */
 public function validate($uniqueId = false)
 {
     if (!$uniqueId) {
         $uniqueId = $this->getUniqueId();
     }
     return AdminsManager::getInstance()->validate($this->getId(), $uniqueId);
 }
Esempio n. 3
0
 public function service()
 {
     $login = $this->secure($_REQUEST['login']);
     $password = $this->secure($_REQUEST['password']);
     $adminsManager = AdminsManager::getInstance();
     $adminDto = $adminsManager->getByLoginPassword($login, $password);
     if ($adminDto) {
         $adminUser = new AdminUser($adminDto->getId());
         $adminUser->setUniqueId($adminDto->getHash());
         $this->sessionManager->setUser($adminUser, true, true);
     } else {
         $_SESSION['error_message'] = 'Wrong Login/Password!';
         $this->redirect('admin/login');
     }
     $this->redirect('admin');
 }
 public function getCustomer()
 {
     if (!$this->customer) {
         if ($this->getUserLevel() != UserGroups::$GUEST) {
             $userId = $this->getUserId();
             if ($this->getUserLevel() == UserGroups::$ADMIN) {
                 $adminsManager = AdminsManager::getInstance();
                 $this->customer = $adminsManager->selectByPK($userId);
             } else {
                 if ($this->getUserLevel() == UserGroups::$CARWASH) {
                     $carwashManager = CarwashManager::getInstance();
                     $this->customer = $carwashManager->selectByPK($userId);
                 }
             }
         }
     }
     return $this->customer;
 }