*/ include_once "../model/objects/POI.php"; include_once "../model/CategoryController.php"; include_once "../model/PoiController.php"; include_once "../model/ContributionController.php"; include_once "../model/UsersController.php"; $userId = $_SESSION['userId']; if ($_SERVER['REQUEST_METHOD'] == 'POST' || $_SERVER['REQUEST_METHOD'] == 'post') { /* get all the post data from */ $id = decodeInput($_POST['id']); $poiName = decodeInput($_POST['poiName']); $poiAddress = decodeInput($_POST['poiAddress']); $poiCategory = decodeInput($_POST['poiCategory']); $poiPhone = decodeInput($_POST['poiPhone']); $poiEmail = decodeInput($_POST['poiEmail']); $poiWebsite = decodeInput($_POST['poiWebsite']); $poiLatitude = decodeInput($_POST['poiLat']); $poiLongitude = decodeInput($_POST['poiLong']); $poiPosition = $poiLatitude . "," . $poiLongitude; $poiContribution = decodeInput($_POST['poiContribution']); $userController = new UsersController(); $poiController = new PoiController(); $categoryController = new CategoryController(); $contributionController = new ContributionController(); /* since we are letting the validation of the data on the client side, we will skip the validation here and just go on with insertion */ /* so first create the poi object, also the required objects to initialize the poi */ $poi = new POI(); $poi->initWithId($id, $poiName, $poiAddress, $poiPosition, $categoryController->find($poiCategory), $poiPhone, $poiEmail, $poiWebsite, "", "", new Contribution(), $userController->find($user->getId())); $poiController->update($poi); }
public function parsePoi($row) { $parentCat = new ParentCategory(); $subCat = new Category(); $poiUser = new User(); $poiUser->initWithId($row['supUid'], $row['username'], $row['password'], $row['email'], $row['previlege'], $row['status']); $parentCatUser = $this->userController->find($row['supUid']); $subCatUser = $this->userController->find($row['subUid']); $parentCat->initWithId($row['supId'], $row['supCategory'], $parentCatUser, $row['supDate']); $subCat->initWithId($row['subId'], $parentCat, $row['subCategory'], $subCatUser, $row['subDate']); $contribution = new Contribution(); $contribution->setId($row['contributionId']); $poi = new POI(); $poi->initWithId($row['pId'], $row['name'], $row['address'], $row['position'], $subCat, $row['phone'], $row['poiEmail'], $row['website'], $row['poiDate'], $row['update_date'], $contribution, $poiUser); return $poi; }