Beispiel #1
0
 * @apiErrorExample Error-Response:
 *   {
 * "code":204,
 * "error":1,
 * "message":"Oops, Event by id 20 not found"
 * }
 */
$app->get('/event/:id', function ($id) use($app, $eventMapper) {
    $response = array();
    if (!is_numeric($id)) {
        $status = 204;
        $response["code"] = 204;
        $response["error"] = 1;
        $response["error_message"] = "Oops, Invalid ID. ID should be numeric";
    } else {
        $Event = $eventMapper->getEvent($id);
        if ($Event) {
            $status = 200;
            $response["code"] = $status;
            $response["events"] = $Event;
            $response["error"] = 0;
            $app->response->setStatus(200);
        } else {
            $status = 204;
            $response["code"] = 204;
            $response["error"] = 1;
            $response["message"] = "Oops, Event by id {$id} not found";
            //$app->response->setStatus(204);
        }
    }
    print json_encode($response);
Beispiel #2
0
header("location:index.php");
}*/
include 'db.php';
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
require_once "{$root}/Udaan2016/fms/utilities/Database.class.php";
require_once "{$root}/Udaan2016/fms/mappers/EventMapper.php";
$eventMapper = new \Udaan\EventMapper();
$event = null;
$result = null;
//$event = $_GET['event'];
if (isset($_GET['event']) && $_GET['event'] != "") {
    $event = $_GET['event'];
    $_SESSION['eventid'] = $event;
}
if ($event != null && isset($event)) {
    $result = $eventMapper->getEvent($_SESSION['eventid']);
}
//echo $event;
//$clgquery=mysql_query("SELECT name FROM college");
//$eventquery=mysql_query("SELECT * from event where id='$event'");
//$row = mysql_fetch_array($eventquery);
if (isset($_POST['updated'])) {
    #$eventMapper->updateEvent();
    $eventid = $_POST['event'];
    $name = $_POST['name'];
    $slogan = $_POST['slogan'];
    $details = $_POST['details'];
    $category = $_POST['category'];
    $starttime = $_POST['starttime'];
    $endtime = $_POST['endtime'];
    $startdate = $_POST['startdate'];