Exemple #1
0
             $place->setLat($params['lat']);
             $place->setLng($params['lng']);
             $place->setRadius($params['radius']);
             $result = $ctr->addPlace($place);
         } catch (SSSException $e) {
             $result = ErrorFactory::getError($e->getCode());
         }
     }
     break;
 case "updateCheckPoint":
     if (validate_input_param($params, array('placeId', 'placeName', 'lat', 'lng', 'radius'))) {
         try {
             $ctr = new ClientController();
             $place = new Place();
             $place->setId($params['placeId']);
             $place->setAddress($params['placeName']);
             $place->setLat($params['lat']);
             $place->setLng($params['lng']);
             $place->setRadius($params['radius']);
             // 				var_dump($place);
             $result = $ctr->updatePlace($place);
         } catch (SSSException $e) {
             $result = ErrorFactory::getError($e->getCode());
         }
     }
     break;
 case "removeCheckPoint":
     if (validate_input_param($params, array('placeId'))) {
         try {
             $ctr = new ClientController();
             $result = $ctr->removePlace($params['placeId']);
 public function getAll($observeeId)
 {
     $sp = "sp_place_get";
     $params = new SDMDBParameters();
     $params->add($observeeId);
     $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'])) {
             if (isset($result['response']['resultSet'])) {
                 $items = $result['response']['resultSet'];
                 $places = array();
                 foreach ($items as $item) {
                     // 						var_dump($item);
                     $place = new Place();
                     $place->setAddress($item['place_name']);
                     $place->setId($item['place_id']);
                     $place->setLat($item['latitude']);
                     $place->setLng($item['longitude']);
                     $place->setRadius($item['radius']);
                     $place->setStudentId($item['user_id']);
                     array_push($places, $place);
                 }
                 if (sizeof($places) > 0) {
                     $ret = $places;
                 }
             } else {
                 throw new SSSException(ErrorFactory::ERR_DB_INVALID_RESULT);
             }
         } else {
             $ret = false;
         }
     } else {
         throw new SSSException(ErrorFactory::ERR_DB_EXECUTE);
     }
     return $ret;
 }