当前位置: 首页>>代码示例>>PHP>>正文


PHP Event::setDescription方法代码示例

本文整理汇总了PHP中Event::setDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::setDescription方法的具体用法?PHP Event::setDescription怎么用?PHP Event::setDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Event的用法示例。


在下文中一共展示了Event::setDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createNewEvent

 private function createNewEvent($email, $password, $title, $venue, $privacy, $fees, $currency_country = "")
 {
     $response = array();
     $response["success"] = 0;
     //verify if the user exists
     $trycheck = new TryUserLogin($email, $password);
     if ($trycheck->isExists()) {
         $tryfetch = new TryFetchUser();
         $user = $tryfetch->fetch($email);
         if ($user != null) {
             $user_json = json_encode($user);
             $user_php = json_decode($user_json);
             $event = new Event($user_php->ID, $title, $venue, $privacy);
             $event->setCreateDate(Validator::Now());
             $event->setDuration("");
             $event->setStartDate("");
             $event->setDescription("");
             $event->setFees($fees);
             $event->setCurrencyCountry($currency_country);
             // $event->setSearchableKeywords($searchable);
             //validate the events
             if ($this->validate($event)) {
                 $response = $this->commit($event);
             } else {
                 $response["error_message"] = $this->__message;
             }
         }
     } else {
         $response["success"] = 0;
         $response["error_message"] = "relogin into your account , user session expired";
     }
     $jsonView = new JsonViewer();
     $jsonView->setContent($response);
     return $jsonView;
 }
开发者ID:jimobama,项目名称:fffddffd,代码行数:35,代码来源:TryCreateNewEventController.php

示例2: createEvent

 /**
  * Create an event
  * @return void
  */
 private function createEvent()
 {
     // if post data is set, we are creating an event
     if (isset($_POST) && count($_POST) > 0) {
         require_once FRAMEWORK_PATH . 'models/event.php';
         $event = new Event($this->registry, 0);
         $event->setName($this->registry->getObject('db')->sanitizeData($_POST['name']));
         $event->setDescription($this->registry->getObject('db')->sanitizeData($_POST['description']));
         $event->setDate($this->registry->getObject('db')->sanitizeData($_POST['date']), false);
         $event->setStartTime($this->registry->getObject('db')->sanitizeData($_POST['start_time']));
         $event->setEndTime($this->registry->getObject('db')->sanitizeData($_POST['end_time']));
         $event->setCreator($this->registry->getObject('authenticate')->getUser()->getID());
         $event->setType($this->registry->getObject('db')->sanitizeData($_POST['type']));
         if (isset($_POST['invitees']) && is_array($_POST['invitees']) && count($_POST['invitees']) > 0) {
             // assumes invitees are added to a table using javascript, with a hidden field with name invitees[] for the ID of invitee
             $is = array();
             foreach ($_POST['invitees'] as $i) {
                 $is[] = intval($i);
             }
             $event->setInvitees($is);
         }
         $event->save();
         $this->registry->redirectUser($this->registry->buildURL(array('event', 'view', $event->getID()), '', false), 'Event created', 'Thanks, the event has been created', false);
     } else {
         $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'events/create.tpl.php', 'footer.tpl.php');
     }
 }
开发者ID:simontakite,项目名称:cookbooks,代码行数:31,代码来源:controller.php

示例3: testDescription

    public function testDescription()
    {
        $event = new Event();

        $this->assertNull($event->getDescription());

        $event->setDescription('...Or try the sun');
        $this->assertEquals('...Or try the sun', $event->getDescription());
    }
开发者ID:regisg27,项目名称:CalendarBundle,代码行数:9,代码来源:EventTest.php

示例4: find

 public static function find($id)
 {
     $event_query = getEvent($id);
     $event = new Event();
     $event->setId($event_query["id"]);
     $event->setDate($event_query["date"]);
     $event->setDescription($event_query["description"]);
     $event->setName($event_query["name"]);
     $event->setPublic($event_query["public"]);
     $event->setOwner($event_query["owner"]);
     $event->setImagePath($event_query["imagePath"]);
     return $event;
 }
开发者ID:andrelago13,项目名称:LTW,代码行数:13,代码来源:events.php

示例5: postProjectEventAction

 /**
  * Create a Event from the submitted data.<br/>
  *
  * @ApiDoc(
  *   resource = true,
  *   description = "Creates a new event from the submitted data.",
  *   statusCodes = {
  *     201 = "Returned when successful",
  *     400 = "Returned when the form has errors"
  *   }
  * )
  *
  * @param int $id id
  *
  * @param ParamFetcher $paramFetcher Paramfetcher
  *
  * @RequestParam(name="title", nullable=false, strict=true, description="Title.")
  * @RequestParam(name="description", nullable=false, strict=true, description="Description.")
  * @RequestParam(name="startDateTime", nullable=false, strict=true, description="Date de début.")
  * @RequestParam(name="endDateTime", nullable=false, strict=true, description="Date de fin.")
  *
  * @return View
  */
 public function postProjectEventAction($id, ParamFetcher $paramFetcher)
 {
     $eventRepository = $this->getDoctrine()->getRepository('ReservationBundle:Event');
     $projectRepository = $this->getDoctrine()->getRepository('CustomFosUserBundle:Project');
     $project = $projectRepository->find($id);
     $event = new Event();
     $event->setTitle($paramFetcher->get('title'));
     $event->setDescription($paramFetcher->get('description'));
     $event->setUser($this->getUser());
     $event->setCreationDateTime();
     $event->setStartDateTime($paramFetcher->get('startDateTime'));
     $event->setEndDateTime($paramFetcher->get('endDateTime'));
     $event->setProject($project);
     $view = View::create();
     $errors = $this->get('validator')->validate($event, array('Registration'));
     if (count($errors) == 0) {
         $em = $this->getDoctrine()->getManager();
         $em->persist($event);
         $em->flush();
         $view->setData($event)->setStatusCode(201);
         return $view;
     } else {
         $view = $this->getErrorsView($errors);
         return $view;
     }
 }
开发者ID:alxckn,项目名称:fablab,代码行数:49,代码来源:EventController.php

示例6: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     //var_dump($request->getParameter('event[start_time]'));
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         //$event = $form->save();
         $name = $form->getValue('name');
         $venue = $form->getValue('venue');
         $description = $form->getValue('description');
         $price = $form->getValue('price');
         $c_ids = $form->getValue('category_ids');
         $event_url = $form->getValue('event_url');
         $start_time = $form->getValue('start_time');
         $end_time = $form->getValue('end_time');
         $date = $form->getValue('date');
         $o_id = $form->getValue('organizer_id');
         $event = null;
         if (!$form->getObject()->isNew()) {
             $event = $form->getObject();
             //Delete previous relations to genres
             Doctrine_Core::getTable('EventCategory')->createQuery()->delete()->where('event_id = ?', $event->getId())->execute();
         } else {
             $event = new Event();
         }
         if ($event === null) {
             $event = new Event();
         }
         //$event = new Event();
         //$event->setCategoryId($c_id);
         $event->setName($name);
         $event->setDescription($description);
         $event->setPrice($price);
         $event->setVenue($venue);
         $event->setEventUrl($event_url);
         $event->setStartTime($start_time);
         $event->setEndTime($end_time);
         $event->setOrganizerId($o_id);
         $sql_date = date("Y-m-d", strtotime($date));
         $event->setDate($sql_date);
         $event->save();
         foreach ($c_ids as $cid) {
             $ec = new EventCategory();
             $ec->setEventId($event->getId());
             $ec->setCategoryId($cid);
             $ec->save();
         }
         $this->getUser()->setAttribute('m', 1);
         $this->redirect('organize/edit?id=' . $event->getId() . '&m=1');
     }
 }
开发者ID:huqa,项目名称:trevents,代码行数:50,代码来源:actions.class.php

示例7: parserEventJson

 private function parserEventJson($jsonevent)
 {
     $event = null;
     //convert to php object
     $php_object = json_decode($jsonevent);
     if ($php_object != null) {
         $event = new Event($php_object->CreatorId, $php_object->Title, $php_object->Venue, $php_object->privacy);
         $event->setCurrencyCountry($php_object->current_country);
         $event->setSearchableKeywords($php_object->search_keywords);
         $event->setFees($php_object->fees);
         $event->setCurrencyCountry($php_object->current_country);
         $event->setCurrencyCountry($php_object->current_country);
         $event->setDescription($php_object->Description);
         $event->setStartDate($php_object->StartDate);
         $event->setGoing($php_object->going);
     }
     return $event;
 }
开发者ID:jimobama,项目名称:fffddffd,代码行数:18,代码来源:TryUpdateEventController.php

示例8: htmlspecialchars

     $location = htmlspecialchars($_POST["location"]);
 }
 if (isset($_POST["description"])) {
     $description = htmlspecialchars($_POST["description"]);
 }
 if (isset($_POST["max_attendance"])) {
     $max_attendance = htmlspecialchars($_POST["max_attendance"]);
 }
 // set up event object
 $event = new Event();
 $event->setTitle($title);
 $event->setDate($date);
 $event->setStartTime($start_time);
 $event->setEndTime($end_time);
 $event->setLocation($location);
 $event->setDescription($description);
 $event->setMaxAttendance($max_attendance);
 $event->setCreatorUserId($_SESSION['uid']);
 $failure_messages = array();
 if (!$event->validate()) {
     foreach ($event->getValidationFailures() as $failure) {
         $message = '<p><strong>Error in ' . $failure->getPropertyPath() . ' field!</strong> ' . $failure->getMessage() . '</p>';
         array_push($failure_messages, $message);
         // clear out the bad data
         $_POST[$failure->getPropertyPath()] = '';
     }
     unset($message);
 } else {
     // validate date fields
     //$now = new DateTime('now');
     $st = DateTime::createFromFormat("m/d/Y H:i A", $date . " " . $start_time);
开发者ID:Web-Systems-Development-Team,项目名称:RPIwannahangout,代码行数:31,代码来源:create.php

示例9: Event

$usageEvent1->setMerchantEventId("eventID-1-" . $testId);
// unique Id
$usageEvent1->setEventDate('2015-03-27T06:29:34-07:00');
$usageEvent1->setDescription("Service usage");
$usageEvent1->setMerchantAutoBillId("subscriptionID101");
// CashBox will automatically identify which AutoBill item the event should be
// applied to if there are no more than one item with same product. If the
// subscription
$usageEvent1->setMerchantProductId("ratedPriceProduct");
$usageEvent1->setAmount(14902);
// Separate event related to another subscription can be reported in a single call
$usageEvent2 = new Event();
$usageEvent2->setMerchantEventId("eventID-2-" . $testId);
// unique Id
$usageEvent2->setEventDate('2015-03-28T23:59:00-07:00');
$usageEvent2->setDescription("Service usage");
$usageEvent2->setMerchantAutoBillId("subscriptionID102");
$usageEvent2->setMerchantProductId("regular-product");
$usageEvent2->setAmount(159002);
// Now let's record the two events with CashBox
$rp = new RatePlan();
// This is the SOAP interface that supports the recordEvent call
$response = $rp->recordEvent(array($usageEvent1, $usageEvent2));
// up to 50 events can be put in the array
print_r($response);
if ($response['returnCode'] == 200) {
    print "Successfully reported events. Call SOAP ID" . $response['data']->return->soapId . "\n";
} else {
    print "Events could not be reported";
    print "Return code: " . $response['returnCode'] . " Return string: " . $response['returnString'] . " Call SOAP ID: " . $response['data']->return->soapId . "\n";
}
开发者ID:sheller-vin,项目名称:CashBoxAPISamples,代码行数:31,代码来源:reportUsageEvents.php

示例10: parse

 function parse($syncId, &$nbEvents = 0, $enableCache = true, $forceFeed = false)
 {
     $nbEvents = 0;
     assert('is_int($syncId) && $syncId>0');
     if (empty($this->id) || 0 == $this->id) {
         /* Le flux ne dispose pas pas d'id !. Ça arrive si on appelle
            parse() sans avoir appelé save() pour un nouveau flux.
            @TODO: un create() pour un nouveau flux ? */
         $msg = 'Empty or null id for a feed! ' . 'See ' . __FILE__ . ' on line ' . __LINE__;
         error_log($msg, E_USER_ERROR);
         die($msg);
         // Arrêt, sinon création événements sans flux associé.
     }
     $feed = new SimplePie();
     $feed->enable_cache($enableCache);
     $feed->force_feed($forceFeed);
     $feed->set_feed_url($this->url);
     $feed->set_useragent('Mozilla/4.0 Leed (LightFeed Aggregator) ' . VERSION_NAME . ' by idleman http://projet.idleman.fr/leed');
     if (!$feed->init()) {
         $this->error = $feed->error;
         $this->lastupdate = $_SERVER['REQUEST_TIME'];
         $this->save();
         return false;
     }
     $feed->handle_content_type();
     // UTF-8 par défaut pour SimplePie
     if ($this->name == '') {
         $this->name = $feed->get_title();
     }
     if ($this->name == '') {
         $this->name = $this->url;
     }
     $this->website = $feed->get_link();
     $this->description = $feed->get_description();
     $items = $feed->get_items();
     $eventManager = new Event();
     $events = array();
     $iEvents = 0;
     foreach ($items as $item) {
         // Ne retient que les 100 premiers éléments de flux.
         if ($iEvents++ >= 100) {
             break;
         }
         // Si le guid existe déjà, on évite de le reparcourir.
         $alreadyParsed = $eventManager->load(array('guid' => $item->get_id(), 'feed' => $this->id));
         if (isset($alreadyParsed) && $alreadyParsed != false) {
             $events[] = $alreadyParsed->getId();
             continue;
         }
         // Initialisation des informations de l'événement (élt. de flux)
         $event = new Event();
         $event->setSyncId($syncId);
         $event->setGuid($item->get_id());
         $event->setTitle($item->get_title());
         $event->setPubdate($item->get_date());
         $event->setCreator('' == $item->get_author() ? '' : $item->get_author()->name);
         $event->setLink($item->get_permalink());
         $event->setFeed($this->id);
         $event->setUnread(1);
         // inexistant, donc non-lu
         //Gestion de la balise enclosure pour les podcasts et autre cochonneries :)
         $enclosure = $item->get_enclosure();
         if ($enclosure != null && $enclosure->link != '') {
             $enclosureName = substr($enclosure->link, strrpos($enclosure->link, '/') + 1, strlen($enclosure->link));
             $enclosureArgs = strpos($enclosureName, '?');
             if ($enclosureArgs !== false) {
                 $enclosureName = substr($enclosureName, 0, $enclosureArgs);
             }
             $enclosureFormat = isset($enclosure->handler) ? $enclosure->handler : substr($enclosureName, strrpos($enclosureName, '.') + 1);
             $enclosure = '<div class="enclosure"><h1>Fichier média :</h1><a href="' . $enclosure->link . '"> ' . $enclosureName . '</a> <span>(Format ' . strtoupper($enclosureFormat) . ', ' . Functions::convertFileSize($enclosure->length) . ')</span></div>';
         } else {
             $enclosure = '';
         }
         $event->setContent($item->get_content() . $enclosure);
         $event->setDescription($item->get_description() . $enclosure);
         if (trim($event->getDescription()) == '') {
             $event->setDescription(substr($event->getContent(), 0, 300) . '…<br><a href="' . $event->getLink() . '">Lire la suite de l\'article</a>');
         }
         if (trim($event->getContent()) == '') {
             $event->setContent($event->getDescription());
         }
         $event->setCategory($item->get_category());
         $event->save();
         $nbEvents++;
     }
     $listid = "";
     foreach ($events as $item) {
         $listid .= ',' . $item;
     }
     $query = 'UPDATE `' . MYSQL_PREFIX . 'event` SET syncId=' . $syncId . ' WHERE id in (0' . $listid . ');';
     $myQuery = $this->customQuery($query);
     $this->lastupdate = $_SERVER['REQUEST_TIME'];
     $this->save();
     return true;
 }
开发者ID:Rorto,项目名称:Leed,代码行数:95,代码来源:Feed.class.php

示例11: executeAjaxSaveEvent

 public function executeAjaxSaveEvent(sfWebRequest $request, $xhr = true)
 {
     $reservation_id = $request->getParameter('id');
     $event_id = $request->getParameter('event_id');
     $event_designation = $request->getParameter('event_designation');
     $event_description = $request->getParameter('event_description');
     // ajout d'un event
     if ($event_id == "") {
         $event = new Event();
         $event->setDesignation($event_designation);
         $event->setDescription($event_description);
         $event->setReservationId($reservation_id);
         $event->save();
     } else {
         $event = Doctrine::getTable('Event')->find(array($event_id));
         $event->setDesignation($event_designation);
         $event->setDescription($event_description);
         $event->save();
     }
     $this->executeAjaxDetailedReservation($request, $xhr);
 }
开发者ID:xmasclaux,项目名称:OpenGenepi,代码行数:21,代码来源:actions.class.php

示例12: list

     $errors[] = "Je bent niet ingelogd.";
 }
 // In case of multiple authors who can proofread, amend: don't update unless empty.
 if (!$event->userId()) {
     $event->setUserId($user->id());
 }
 list($date, $time) = explode(" ", $_POST['start']);
 list($day, $month, $year) = explode("-", $date);
 $start = "{$year}-{$month}-{$day} {$time}";
 $event->setStart($start);
 list($date, $time) = explode(" ", $_POST['end']);
 list($day, $month, $year) = explode("-", $date);
 $end = "{$year}-{$month}-{$day} {$time}";
 $event->setEnd($end);
 $event->setTitle($_POST['title']);
 $event->setDescription($_POST['description']);
 $event->setLocation($_POST['location']);
 $event->setFeatured(isset($_POST['featured']) && $_POST['featured'] == 'on' ? 1 : 0);
 $event->setVisible(isset($_POST['visible']) && $_POST['visible'] == 'on' ? 1 : 0);
 $event->setHashtags(isset($_POST['hashtags']) ? $_POST['hashtags'] : null);
 $event->setAlbumId(isset($_POST['albumId']) ? $_POST['albumId'] : null);
 if (!$event->title()) {
     $errors[] = "Je kunt geen event zonder titel opslaan!";
 }
 Log::debug($errors);
 if (!sizeof($errors)) {
     // Save event prior to publishing to create cname.
     $event->save();
     // Publish event.
     if (isset($_POST['connections'])) {
         foreach ($_POST['connections'] as $id => $value) {
开发者ID:robkaper,项目名称:kiki,代码行数:31,代码来源:event.php

示例13: executeCreate

 public function executeCreate()
 {
     if ($this->getRequest()->getMethod() != sfRequest::POST) {
         $this->event = new Event();
         $this->etime = new Etime();
         $this->forward404Unless($this->event);
         $this->forward404Unless($this->etime);
     } else {
         $event = new Event();
         $etime = new Etime();
         $event->setTitle($this->getRequestParameter('title'));
         $event->setStatusId($this->getRequestParameter('status_id') ? $this->getRequestParameter('status_id') : null);
         $event->setCategoryId($this->getRequestParameter('category_id') ? $this->getRequestParameter('category_id') : null);
         $event->setPublished($this->getRequestParameter('published', 0));
         $event->setMediaPotential($this->getRequestParameter('media_potential', 0));
         $event->setDescription($this->getRequestParameter('description'));
         $event->setNotes($this->getRequestParameter('notes'));
         $event->setImageUrl($this->getRequestParameter('image_url'));
         //      $event->setOrganiser($this->getRequestParameter('organiser'));
         //      $event->setInterestedParties($this->getRequestParameter('interested_parties'));
         $event->save();
         $etime->setEventId($event->getId());
         $etime->setTitle($this->getRequestParameter('etime_title'));
         $etime->setStartDate(strtotime($this->getRequestParameter('start_date') . ' ' . $this->getRequestParameter('start_date_time')));
         $etime->setEndDate(strtotime($this->getRequestParameter('end_date') . ' ' . $this->getRequestParameter('end_date_time')));
         $etime->setAllDay($this->getRequestParameter('all_day') ? $this->getRequestParameter('all_day') : false);
         $etime->setLocation($this->getRequestParameter('location'));
         $etime->setDescription($this->getRequestParameter('etime_description'));
         $etime->setNotes($this->getRequestParameter('etime_notes'));
         $etime->setCapacity($this->getRequestParameter('capacity') ? $this->getRequestParameter('capacity') : null);
         $etime->setAdditionalGuests($this->getRequestParameter('additional_guests') ? $this->getRequestParameter('additional_guests') : 0);
         $etime->setHasFee($this->getRequestParameter('has_fee') ? $this->getRequestParameter('has_fee') : false);
         $etime->setAudioVisualSupport($this->getRequestParameter('audio_visual_support') ? $this->getRequestParameter('audio_visual_support') : false);
         //      $etime->setOrganiser($this->getRequestParameter('etime_organiser'));
         //      $etime->setInterestedParties($this->getRequestParameter('etime_interested_parties'));
         $etime->save();
         // Update many-to-many for "etime_rsvp"
         $c = new Criteria();
         $c->add(EtimeRsvpPeer::ETIME_ID, $etime->getPrimaryKey());
         EtimeRsvpPeer::doDelete($c);
         $ids = $this->getRequestParameter('associated_etime_rsvp');
         if (is_array($ids)) {
             foreach ($ids as $id) {
                 $EtimeRsvp = new EtimeRsvp();
                 $EtimeRsvp->setEtime($etime);
                 $EtimeRsvp->setRsvpId($id);
                 $EtimeRsvp->save();
             }
         }
         // Update many-to-many for "etime_audience"
         $c = new Criteria();
         $c->add(EtimeAudiencePeer::ETIME_ID, $etime->getPrimaryKey());
         EtimeAudiencePeer::doDelete($c);
         $ids = $this->getRequestParameter('associated_etime_audience');
         if (is_array($ids)) {
             foreach ($ids as $id) {
                 $EtimeAudience = new EtimeAudience();
                 $EtimeAudience->setEtime($etime);
                 $EtimeAudience->setAudienceId($id);
                 $EtimeAudience->save();
             }
         }
         if ($this->getRequestParameter('tag_string')) {
             TagTools::recordTags($this->getRequestParameter('tag_string'), "event", $event);
         }
         if ($this->getRequestParameter('etime_tag_string')) {
             TagTools::recordTags($this->getRequestParameter('etime_tag_string'), "etime", $etime);
         }
         return $this->redirect('@show_event?slug=' . $event->getSlug());
     }
     return sfView::SUCCESS;
 }
开发者ID:soon0009,项目名称:EMS,代码行数:72,代码来源:actions.class.php

示例14: function

}
$app->get('/events', function () use($app, $em) {
    $events = $em->getRepository('Event')->findAll();
    $encoded = [];
    foreach ($events as $event) {
        $encoded[] = json_encode_event($event);
    }
    return new JsonResponse($encoded);
});
$app->post('/events/add', function (Request $request) use($app, $em) {
    $event = new Event();
    $event->setStartdate($request->get('startdate', null));
    $event->setEnddate($request->get('enddate', null));
    $event->setUsers($request->get('users', []));
    $event->setLocation($request->get('location', ''));
    $event->setDescription($request->get('description', ''));
    $event->setName($request->get('name', null));
    $event->setHosts($request->get('hosts', []));
    $event->setTags($request->get('tags', []));
    if ($event->getName() === null) {
        return new JsonResponse(['error' => 'No name set'], 500);
    }
    $em->persist($event);
    $em->flush();
    return new JsonResponse(['success' => 'Event stored']);
});
//$app->get('/events/get/{id}', function ($id) use ($app, $em) {
//
//    $event = $em->getRepository('Event')->find($id);
//    return new JsonResponse(json_encode_event($event));
//
开发者ID:avelrd,项目名称:bam,代码行数:31,代码来源:app.php

示例15: run

 /**
  * Run method with main page logic
  * 
  * Populate template and display form for creating a new event entry. Regular users are allowed to create events but an
  * admin must approve them before they are visible on the site. Trusted users are allowed to create
  * events that will immediately be visible on the event calendar. For POST request,
  * validate form data and save information to database. Available to members only
  * @access public
  */
 public function run()
 {
     $session = Session::getInstance();
     $user = $session->getUser();
     //if (!$user || !$user->isAdmin ()) {
     if (!$user || !$user->validUser()) {
         $session->setMessage("Do not have permission to access", Session::MESSAGE_ERROR);
         header("Location: " . BASE_URL);
         return;
     }
     $form_errors = array();
     $form_values = array("title" => "", "description" => "", "sanctioned" => "", "status" => "", "date" => "", "platform" => "");
     $eventDAO = EventDAO::getInstance();
     //$event_array = $eventDAO->all ();
     if (!empty($_POST)) {
         $form_values["title"] = isset($_POST["title"]) ? trim($_POST["title"]) : "";
         $form_values["description"] = isset($_POST["description"]) ? trim($_POST["description"]) : "";
         $form_values["platform"] = isset($_POST["platform"]) ? trim($_POST["platform"]) : "";
         $form_values["sanctioned"] = isset($_POST["sanctioned"]) ? trim($_POST["sanctioned"]) : "";
         $form_values["status"] = isset($_POST["status"]) ? trim($_POST["status"]) : "";
         $form_values["date"] = isset($_POST["date"]) ? trim($_POST["date"]) : "";
         if (empty($form_values["title"])) {
             $form_errors["title"] = "No title specified";
         }
         if (empty($form_values["description"])) {
             $form_errors["description"] = "No description specified";
         }
         if (empty($form_values["platform"])) {
             $form_errors["platform"] = "No platform specified";
         } else {
             if (!is_numeric($form_values["platform"])) {
                 $form_errors["platform"] = "Platform choice must be an integer value";
             } else {
                 $platform = intval($form_values["platform"]);
                 $tmp = new Event();
                 try {
                     $tmp->setPlatformId($platform);
                 } catch (Exception $e) {
                     $form_errors["platform"] = "Invalid value for platform";
                 }
             }
         }
         if ($user->isAdmin() && empty($form_values["sanctioned"])) {
             $form_errors["sanctioned"] = "No sanctioned flag specified";
         } else {
             if ($user->isAdmin() && strcmp($form_values["sanctioned"], "true") != 0 && strcmp($form_values["sanctioned"], "false") != 0) {
                 $form_errors["sanctioned"] = "sanctioned flag must be a boolean value";
             }
         }
         if ($user->isAdmin() && empty($form_values["status"])) {
             $form_errors["status"] = "No status flag specified";
         } else {
             if ($user->isAdmin() && !is_numeric($form_values["status"])) {
                 $form_errors["status"] = "Status flag must be an integer value";
             } else {
                 if ($user->isAdmin()) {
                     $status = intval($form_values["status"]);
                     $tmp = new Event();
                     try {
                         $tmp->setStatus($status);
                     } catch (Exception $e) {
                         $form_errors["status"] = "Invalid value for status";
                     }
                 }
             }
         }
         if (empty($form_values["date"])) {
             $form_errors["date"] = "No date specified";
         } else {
             if (strtotime($_POST["date"]) == 0) {
                 $form_errors["date"] = "An invalid date was specified";
                 $form_values["date"] = "";
             }
         }
         if (empty($form_errors)) {
             $event = new Event();
             $event->setTitle($form_values["title"]);
             $event->setDescription($form_values["description"]);
             $event->setPlatformId(intval($form_values["platform"]));
             if ($user->isAdmin() || $user->validUser() && $user->getUserType() == User::TRUSTED_TYPE) {
                 $sanctioned_value = strcmp($form_values["sanctioned"], "true") == 0 ? true : false;
                 $event->setSanctioned($sanctioned_value);
                 $event->setStatus($form_values["status"]);
             } else {
                 if ($user->validUser()) {
                     $event->setSanctioned(false);
                     $event->setStatus(Event::PENDING_STATUS);
                 }
             }
             $pubtimestamp = strtotime($_POST["date"]);
             $event->setDate($pubtimestamp);
//.........这里部分代码省略.........
开发者ID:Ryochan7,项目名称:UGA-Proposal-Website,代码行数:101,代码来源:create_event.php


注:本文中的Event::setDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。