Example #1
0
    session_start();
}
//var_dump($_POST);exit;
//perform verification of input and required values
/**************/
/*Post a Event*/
/**************/
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['title']) && !empty($_POST['tags']) && !empty($_POST['sortdate']) && !empty($_POST['address']) && !empty($_POST['hour']) && !empty($_FILES['coverimage'])) {
    //var_dump($_POST);exit;
    //echo htmlspecialchars($_POST['body']);
    //instantiate the blogpost class
    $event = new Event();
    //clean post data
    $cleanedPost = cleanData($_POST);
    //update the project
    $id = $event->updateEvent($cleanedPost);
    if (!empty($id)) {
        //go to
        //echo "succesfully posted event with id: ".$id;
        header('Location:../events.php?id=' . $id);
        exit;
    } else {
        exit('ERROR: problem updating project');
    }
} else {
    if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['title']) && !empty($_POST['tags']) && !empty($_POST['sortdate']) && (!empty($_FILES['coverimage']["name"]) || !empty($_POST['youtubecover']) && $_POST['youtubecover'] != "" || !empty($_POST['id']))) {
        //var_dump($_POST);
        //var_dump($_FILES);
        //echo htmlspecialchars($_POST['body']);
        //instantiate the blogpost class
        $blogpost = new Blogpost();
Example #2
0
        $time[0] = trim($time[0]);
        $time[1] = trim($time[1]);
        $time[2] = trim($time[2]);
        $date = $time[0] . ". " . $time[1] . ". " . $time[2];
        $timestampEntry = mktime(0, 0, 0, $time[1], $time[0], $time[2]);
    }
    $subsciption = safeText($_POST['subsciption']);
    $place = safeText($_POST['place']);
    $accessPost = safeText($_POST['access']);
    $typePost = safeText($_POST['eventType']);
    if (empty($err)) {
        $database = new Event();
        if ($isSaved == 0) {
            $isSaved = $database->setEvent($timestampEntry, 0, $profil->getId(), $profil->getId(), $organisator, $enrollSystem, $mainTitle, $subsciption, $place, $accessPost, $typePost);
            $database->setEnroll($profil->getId(), $isSaved, $profil->getEmailAdmin());
            $err[] = "Úspěšně vytvořená událost!";
        } else {
            $database->updateEvent($timestampEntry, 0, $meOrganisator, $organisator, $enrollSystem, $mainTitle, $subsciption, $place, $accessPost, $typePost, $isSaved);
            $err[] = "Změny uloženy!";
        }
        if ($enrollSystem == 1) {
            header("location: index.php?page=calendar_new_event_enrollSystemSetting&id={$isSaved}");
        }
    }
}
$access = (include "controllers/log/calendar/access_options.php");
$eventType = (include "controllers/log/calendar/event_type.php");
if ($isSaved != 0) {
    $save = "Upravit";
}
return include_once "views/calendar/new-html.php";
<?php

//Get from textbox
$event_name = $_POST['event_name'];
$id = $_POST['event_id'];
//Instances of Classes
include '../classes/class.event.php';
//assigning of values from Instance
$e = new Event();
$e->event_id = $id;
$e->event_name = $event_name;
//calling of method Save
if ($e->updateEvent()) {
    header('Location:../public/Event_5.php');
} else {
    echo Database::$conn->error;
}
Example #4
0
 public static function updateEventField($eventId, $eventFieldName, $eventFieldValue, $userId)
 {
     if (!Authorisation::isEventAdmin($eventId, $userId)) {
         throw new CTKException("Can not update the event : you are not authorized to update that event!");
     }
     $dataFieldName = self::getCollectionFieldNameAndValidate($eventFieldName, $eventFieldValue, $eventId);
     //address
     if ($eventFieldName == "address") {
         if (!empty($eventFieldValue["postalCode"]) && !empty($eventFieldValue["codeInsee"])) {
             $insee = $eventFieldValue["codeInsee"];
             $address = SIG::getAdressSchemaLikeByCodeInsee($insee);
             $set = array("address" => $address, "geo" => SIG::getGeoPositionByInseeCode($insee));
         } else {
             throw new CTKException("Error updating the Event : address is not well formated !");
         }
         //Date format
     } else {
         if ($dataFieldName == "startDate" || $dataFieldName == "endDate") {
             date_default_timezone_set('UTC');
             $dt = DateTime::createFromFormat('Y-m-d H:i', $eventFieldValue);
             if (empty($dt)) {
                 $dt = DateTime::createFromFormat('Y-m-d', $eventFieldValue);
             }
             $newMongoDate = new MongoDate($dt->getTimestamp());
             $set = array($dataFieldName => $newMongoDate);
         } else {
             $set = array($dataFieldName => $eventFieldValue);
         }
     }
     $res = Event::updateEvent($eventId, $set, $userId);
     return $res;
 }