} catch (SSSException $e) { $result = ErrorFactory::getError($e->getCode()); } } break; case "addCheckPoint": // var_dump($params); if (validate_input_param($params, array('userId', 'placeName', 'lat', 'lng', 'radius'))) { // if(validate_input_param($params, array('userId', 'placeName', 'lat', 'lng', 'radius'))) // if(validate_input_param($params, array('radius'))) // { // print 11111; try { $ctr = new ClientController(); $place = new Place(); $place->setStudentId($params['userId']); $place->setAddress($params['placeName']); $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();
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; }