/** * * * @param Event $event * @return void */ public function dispatch(Event $event) { $eventId = $event->getId(); if (array_key_exists($eventId, $this->listeners)) { foreach ($this->listeners[$eventId] as $listener) { $listener->handle($event); } } }
public function run(Event $event) { foreach ((array) $this->_listeners[$event->getId()] as $listener) { call_user_func($listener->getCallback(), $event); if ($event->isPropagationStopped()) { break; } } return $event; }
/** * Creates events for the day view. * * @param Event $event * @param int $lwst * @param int $hgst * @param int $cl_start * @param int $cl_end * @param array $events_created * @return boolean */ private static function createDayViewEvent($event, $lwst, $hgst, $cl_start, $cl_end, array &$events_created) { // if this date is in the exceptions? if ($event->getProperty('EXDATE')) { $exdates = explode(',', $event->getProperty('EXDATE')); foreach ($exdates as $exdate) { if ($exdate > 0 && $exdate >= $lwst && $exdate <= $hgst) { return false; } } } // is event expired? $rrule = $event->getRecurrence(); if ($rrule['rtype'] != 'SINGLE' && $rrule['expire'] > 0 && $rrule['expire'] < $hgst) { return false; } $start = mktime(date('G', $event->getStart()), date('i', $event->getStart()), date('s', $event->getStart()), date('n', $lwst), date('j', $lwst), date('Y', $lwst)); $end = mktime(date('G', $event->getEnd()), date('i', $event->getEnd()), date('s', $event->getEnd()), date('n', $hgst), date('j', $hgst), date('Y', $hgst)); if ($start <= $cl_start && $end >= $cl_end || $start >= $cl_start && $start < $cl_end || $end > $cl_start && $end <= $cl_end) { if (!$events_created[implode('', (array) $event->getId()) . $start]) { $new_event = clone $event; $new_event->setStart($start); $new_event->setEnd($end); $events_created[implode('', (array) $event->getId()) . $start] = $new_event; } } }
if (date('Y-m-d', strtotime($event->getRemindMeTime())) == date('Y-m-d', strtotime($event->getStartDateTime()))) { echo date('H:i', strtotime($event->getRemindMeTime())); } else { echo $event->getRemindMeTime(); } echo ' '; } echo '<i class="fa fa-clock-o"></i> '; if ($event->getAllDay() == '1') { echo "all day"; } else { echo $start_time . '-' . $end_time; } echo '</small>'; echo ' <i class="fa fa-info-circle"></i> '; echo $event->getDescription() . ' <small><a href="/edit_evt.php?id=' . $event->getId() . '">edit</a>'; if ($event->getUserId() == Authentication::get_user() || PermissionMgr::groupHasPermission(Authentication::getUserObject()->getGroupId(), 'is_administrator')) { echo ' <a href="#" onclick="deleteEvt(' . $event->getId() . ', \'' . htmlspecialchars($event->getDescription()) . '\')">delete</a>'; } echo '</small></h5>'; $number += 1; } if ($number == 0) { echo '<i>No events on this date.</i>'; } $date = date("Y-m-d", strtotime("+1 day", strtotime($date))); echo '<hr>'; } ?>
function json_encode_event(Event $event) { return [$event->getId(), $event->getStartdate(), $event->getEnddate(), $event->getUsers(), $event->getLocation(), $event->getDescription(), $event->getName(), $event->getHosts(), $event->getTags()]; }
// name of all event volunteers from the DB echo '<option>', $head['username'], '</option>'; } // we set a hidden input eventvol to eventvol, so that we know we want to assign an event to volunteer echo '</select><br><input type="hidden" name="eventvol" value="eventvol"/><input type="submit" value="Assign" /></form>'; } break; case 'eventcat': // case -> assign event to catagory if (isset($_POST['eventcat'])) { if (isset($_POST['eventname']) and isset($_POST['catname'])) { $e = new Event(); $c = new Catagory(); if ($e->select($_POST['eventname'])) { if ($c->select($_POST['catname'])) { echo $c->addEvent($e->getId()); // assigning the event to catagory } else { echo 'Catagory Does Not Exist'; } } else { echo 'Event Does Not Exist'; } } else { echo 'Please check your entries'; } } else { // displaying the list of all events and heads $e = new Event(); $c = new Catagory(); echo '<form method="POST">Select an Event and Head<br><select name="eventname">';
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'); } }
/** * Counts the number of guests for event * @param Event $event * * @return int */ public function countGuests($event) { $numberOfGuests = $this->getEntityManager()->createQueryBuilder('e')->select('count(e.id)')->from('CoreBundle:Event', 'e')->join('e.guests', 'g')->where('e.id = :event')->setParameter('event', $event->getId())->getQuery()->getSingleScalarResult(); return $numberOfGuests; }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Event $value A Event object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(Event $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
if ($period == "all") { echo 'Vergangene und kommende Veranstaltungen'; } ?> </h2> <hr> <ul class="events layout list"> <?php for ($i = ($pagenum - 1) * PERPAGE; $i < $events->getTotalEvents() && $i < $pagenum * PERPAGE; $i++) { $event = new Event($events->getEvent($i)); ?> <li class="box"> <div class="leftdiv left"> <a href="<?php echo BASEPATH . DS . $page . DS . $event->getId(); ?> "> <img src="<?php echo $event->getThumb(); ?> " alt="<?php echo $event->getTitle(); ?> "> </a> </div> <div class="vr left"></div> <div class="rightdiv left">
echo BASEPATH . DS . $page . DS . $tab . DS; ?> new"> <li class="box"> <h3 class="glow"><i class="fa fa-plus-circle"></i> Neue Veranstaltung erstellen</h3> </li> </a> <?php for ($i = $events->getTotalEvents() - 1; $i >= 0; $i--) { //create an event instance for every iteration $event = new Event($events->getEvent($i)); ?> <a href="<?php echo BASEPATH . DS . $page . DS . $tab . DS; echo $event->getId(); ?> "> <li class="box"> <h3 class="glow"><?php echo $event->getDate('readable'); ?> </h3> <p class="dull">Eintritt: <?php echo $event->getPrice(); ?> | Einlass: <?php echo $event->getTime(); ?> | Gäste: <?php echo $event->getGuests();
/** * Declares an association between this object and a Event object. * * @param Event $v * @return EventReservation The current object (for fluent API support) * @throws PropelException */ public function setEvent(Event $v = null) { if ($v === null) { $this->setEventId(NULL); } else { $this->setEventId($v->getId()); } $this->aEvent = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Event object, it will not be re-added. if ($v !== null) { $v->addEventReservation($this); } return $this; }
/** * */ public function testGetId() { $id = 'foo.bar'; $event = new Event($id); $this->assertSame($id, $event->getId()); }
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; }