Esempio n. 1
0
     if (validate_input_param($params, array('userId', 'status'))) {
         $user = new User();
         $user->setId($params['userId']);
         $user->setStatus($params['status']);
         $ctr = new WebController();
         try {
             $result = $ctr->updateUserStatus($user);
         } catch (SSSException $e) {
             $result = ErrorFactory::getError($e->getCode());
         }
     }
     break;
     if (validate_input_param($params, array('type'))) {
         $user = new User();
         $user->setId($params['userId']);
         $user->setStatus($params['status']);
         $ctr = new WebController();
         try {
             $result = $ctr->updateUserStatus($user);
         } catch (SSSException $e) {
             $result = ErrorFactory::getError($e->getCode());
         }
     }
 case "getUsers":
     if (validate_input_param($params, array('type'))) {
         $ctr = new WebController();
         try {
             $result = $ctr->getUserByType($params['type']);
         } catch (SSSException $e) {
             $result = ErrorFactory::getError($e->getCode());
         }
Esempio n. 2
0
 public function getByType($type)
 {
     $sp = "sp_user_getByType";
     $params = new SDMDBParameters();
     $params->add($type);
     // 				var_dump($params);
     $result = $this->handler->execute_stored_procedure($sp, $params, 'array');
     // 				var_dump($result);
     $ret = false;
     if ($result && $result['response']['system']['errorNo'] == 0) {
         if (isset($result['response']['resultSet'])) {
             $items = $result['response']['resultSet'];
             $array = array();
             foreach ($items as $item) {
                 $user = new User();
                 $user->setName($item['login_name']);
                 $user->setId($item['user_id']);
                 $user->setType($item['user_type']);
                 $user->setStatus($item['status']);
                 $user->setLastUpdate($item['last_update']);
                 array_push($array, $user);
             }
             return $array;
         } else {
             $ret = false;
         }
     } else {
         throw new SSSException(ErrorFactory::ERR_DB_EXECUTE);
     }
     return $ret;
 }