$userId = $_SESSION['userId'];
if ($_SERVER['REQUEST_METHOD'] == 'POST' || $_SERVER['REQUEST_METHOD'] == 'post') {
    /* get all the post data from */
    $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->init($poiName, $poiAddress, $poiPosition, $categoryController->find($poiCategory), $poiPhone, $poiEmail, $poiWebsite, "", $userController->find($user->getId()));
    if ($poiContribution != 0) {
        if (is_numeric($poiContribution)) {
            if ($contribution = $contributionController->find($poiContribution)) {
                $poi->setContribution($contribution);
            }
        }
    }
    $poiController->add($poi);
}
Exemple #2
0
 * Created by Yogesh on 12/2/2015.
 *
 */
session_start();
require_once "../config/Route.php";
require_once "../model/UsersController.php";
require_once "../model/ContributionController.php";
if (array_key_exists('userId', $_SESSION)) {
    $contributionController = new ContributionController();
    $userController = new UsersController();
    $userId = $_SESSION['userId'];
    $user = $userController->find($userId);
    if ($user) {
        if (array_key_exists('post', $_GET) && array_key_exists('s', $_GET)) {
            $id = test_input($_GET['post']);
            $poi = $contributionController->find($id);
            if ($poi) {
                $action = test_input($_GET['s']);
                switch ($action) {
                    case "a":
                        $poi->setStatus("A");
                        $contributionController->update($poi);
                        Route::redirect($_SERVER['HTTP_REFERER']);
                        break;
                    case "r":
                        $poi->setStatus("R");
                        $contributionController->update($poi);
                        Route::redirect($_SERVER['HTTP_REFERER']);
                        break;
                    default:
                        Route::get404Error();
Exemple #3
0
<?php

include "../header.php";
require_once "../model/ContributionController.php";
require_once "../model/objects/Contribution.php";
if (array_key_exists('post', $_REQUEST)) {
    $postId = $_REQUEST['post'];
    if (is_numeric($postId)) {
        $contributionController = new ContributionController();
        $contribution = $contributionController->find($postId);
        ?>

        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                <h1>
                    Read Contribution
                </h1>
            </section>

            <!-- Main content -->
            <section class="content">
                <div class="row">
                    <div class="col-md-9">
                        <div class="box box-primary">
                            <div class="box-header with-border">
                                <h3 class="box-title">Read Contribution</h3>

<!--                                <div class="box-tools pull-right">-->
<!--                                    <a href="#" class="btn btn-box-tool" data-toggle="tooltip" title="Previous"><i-->