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


PHP Event::setDate方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: find

 function find($criteria = null, $order = null, $limit = 1000, $from = 0)
 {
     $result = $this->database->query($this->buildFindQuery($criteria, $order, $limit, $from));
     if (!is_null($result->getError())) {
         return $result->getError();
     }
     $events = array();
     while ($row = $result->fetchRow()) {
         $event = new Event();
         $value = $row[0];
         $event->setId($value);
         $value = $row[1];
         $event->setPid($value);
         $value = $row[2];
         $event->setCid($value);
         $value = $row[3];
         $event->setSid($value);
         $value = $row[4];
         $event->setValid_date($value);
         $value = $row[5];
         $event->setReminde_date($value);
         $value = $row[6];
         $event->setAmount($value);
         $value = $row[7];
         $event->setState($value);
         $value = $row[8];
         $event->setMoved($value);
         $value = $row[9];
         $value = $this->database->toBoolean($value);
         $event->setDelay($value);
         $value = $row[10];
         $event->setDelays($value);
         $value = $row[11];
         $event->setComment($value);
         $value = $row[12];
         $event->setIncome($value);
         $value = $row[13];
         $event->setCost($value);
         $value = $row[14];
         $event->setProfit($value);
         $value = $row[15];
         $event->setWasted_time($value);
         $value = $row[16];
         $event->setR_date($value);
         $value = $row[17];
         $event->setDate($value);
         if ($order != null) {
             array_push($events, $event);
         } else {
             $events[$event->getId()] = $event;
         }
     }
     return $events;
 }
开发者ID:Faradejus,项目名称:WorkFlow,代码行数:54,代码来源:eventDao.class.php

示例5: saveFirsEvent

 function saveFirsEvent($client, $getResponse)
 {
     $projectID = $client->getPid();
     $clientID = $client->getId();
     $stage = $this->getStageID($projectID, 1, $getResponse);
     if (!$stage) {
         return false;
     }
     $stageID = $stage->getID();
     $event = new Event();
     $event->setPid($projectID);
     $event->setCid($clientID);
     $event->setSid($stageID);
     $event->setState(0);
     $event->setR_date(Date::getCurrentDatr());
     $event->setDate(Date::getCurrentDatr());
     $store = $this->storeEvent($event, $getResponse);
     if (!$store) {
         return false;
     }
     return true;
 }
开发者ID:Faradejus,项目名称:WorkFlow,代码行数:22,代码来源:getResponseApp.class.php

示例6: saveFirsEvent

 function saveFirsEvent($client)
 {
     $projectID = $client->getPid();
     $clientID = $client->getId();
     $stage = $this->getStageID($projectID, 1);
     if (!$stage) {
         return false;
     }
     $stageID = $stage->getID();
     $event = new Event();
     $validDate = $this->countEventTime($stage->getPeriod_type(), $stage->getPeriod());
     $event->setPid($projectID);
     $event->setCid($clientID);
     $event->setSid($stageID);
     $event->setState(1);
     $event->setValid_date($validDate["validateDate"]);
     $event->setReminde_date($validDate["remindeDate"]);
     $event->setR_date(Date::getCurrentDatr());
     $event->setDate(Date::getCurrentDatr());
     $store = $this->storeEvent($event, false, false);
     if (!$store) {
         return false;
     }
     return true;
 }
开发者ID:Faradejus,项目名称:WorkFlow,代码行数:25,代码来源:masterControler.class.php

示例7: htmlspecialchars

 if (isset($_POST["end_time"])) {
     $end_time = htmlspecialchars($_POST["end_time"]);
 }
 if (isset($_POST["location"])) {
     $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);
开发者ID:Web-Systems-Development-Team,项目名称:RPIwannahangout,代码行数:31,代码来源:create.php

示例8: installTo

 /**
  * Install a consumable to a printer
  */
 public function installTo($printer)
 {
     global $db;
     #printf('Installing consumable %s to printer %s.', $this->getName(), $printer->getName());
     #fCore::dump($printer);
     // Validation checks
     // 1. Check printer model is compatible
     $models = $this->getModels();
     if (!in_array($printer->getModelId(), $models)) {
         $this->err = sprintf('Consumable %s not compatible with printer %s.', $this->getName(), $printer->getName());
         return FALSE;
     }
     // 2. Check quantity
     if ($this->getQty() < 1) {
         $this->err = sprintf('No stock of the consumable %s.', $this->getName());
         return FALSE;
     }
     // Finished validation
     // Add 'event'
     try {
         $e = new Event();
         $e->setPrinterId($printer->getId());
         $e->setConsumableId($this->getId());
         $e->setDate(date('Y-m-d H:i:s'));
         $e->setCost($this->getCost());
         $e->store();
     } catch (fExpectedException $e) {
         #fMessaging::create('error', fURL::get(), $e->getMessage());
         $this->err = $e->getMessage();
         return FALSE;
     } catch (fSQLException $e) {
         #fMessaging::create('error', fURL::get(), 'Database error: ' . $e->getMessage());
         $this->err = $e->getMessage();
         return FALSE;
     }
     // Decrease stock
     try {
         $sql = 'UPDATE consumables SET qty = qty - 1 WHERE id = %i LIMIT 1';
         $query = $db->execute($sql, $this->getId());
     } catch (fSQLException $e) {
         $this->err = $e->getMessage();
         return FALSE;
     }
     // Return true
     #echo 'Done!';
     return TRUE;
 }
开发者ID:mrjwc,项目名称:printmaster,代码行数:50,代码来源:Consumable.php

示例9: 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

示例10: findEvents

 public static function findEvents($entityManager, $date)
 {
     error_log("date: " . $date->format('Y-m-d'));
     $query = $entityManager->createQuery('SELECT count(e) FROM Event e WHERE e.date LIKE :date');
     $query->setParameter("date", "%" . $date->format('m-d'));
     $eventNumber = $query->getSingleScalarResult();
     if ($eventNumber) {
         error_log("events for " . $date->format('Y-m-d') . " already exist.");
         return "1";
     }
     $dim = new \ThisDayIn\Music($date->format('j'), $date->format('F'));
     $evs = $dim->getEvents();
     foreach ($evs as $ev) {
         $date = new \DateTime($ev['date']);
         if ($ev['type'] === 'Death') {
             $ev['description'] = sprintf('%s, %s', $ev['name'], $ev['description']);
         }
         //unlike the death events, the birth events do not include enough information in the description.
         if ($ev['type'] === 'Birth') {
             $ev['description'] = sprintf('%s, %s was born', $ev['name'], $ev['description']);
         }
         //must find artist name for these kind of events
         if ($ev['type'] == 'Event') {
             $artist = self::findEventArtist($ev['description']);
             $ev['name'] = $artist['name'];
             if (isset($artist['spotifyId'])) {
                 $ev['spotifyId'] = $artist['spotifyId'];
             }
         }
         #TODO: find artist spotify id for the other event types
         //set current event
         $event = new \Event();
         $event->setDate($date);
         $event->setDescription($ev['description']);
         $event->setType($ev['type']);
         $event->setSource($dim->getSource());
         //connects the event to an artist
         if ($ev['name']) {
             $artist = $entityManager->getRepository('Artist')->findBy(array('name' => $ev['name']));
             $artist = array_shift($artist);
             if (!$artist) {
                 $artist = new \Artist();
                 $artist->setName($ev['name']);
                 if (isset($ev['spotifyId'])) {
                     $artist->setSpotifyId($ev['spotifyId']);
                 }
             }
             error_log("artist name: " . $artist->getName());
             $event->setArtist($artist);
             $entityManager->persist($event);
             $artist->assignToEvent($event);
             $entityManager->persist($artist);
             #one must save here so it copes for repeated artist in the event list
             $entityManager->flush();
         }
         $entityManager->persist($event);
     }
     //insert all events to db
     if (count($evs)) {
         $entityManager->flush();
     }
     return 0;
 }
开发者ID:andreiamlm,项目名称:ThisDayInMusic,代码行数:63,代码来源:ThisDayInMusic.php


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