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


PHP Event::setName方法代码示例

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


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

示例1: on

 /**
  * @return null
  */
 public function on($name, $handler)
 {
     $event = new Event();
     $event->setName($name);
     $event->setHandler($handler);
     $this->addEvent($event);
 }
开发者ID:wispira,项目名称:framework,代码行数:10,代码来源:Manager.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: load

 public function load(ObjectManager $manager)
 {
     $testEvent = new Event();
     $testEvent->setStartDate(date("d/m/Y"));
     $testEvent->setName('TestEvent');
     //$testEvent->setOwner('James');
     $manager->persist($testEvent);
     $manager->flush();
     $this->addReference('test-event', $testEvent);
 }
开发者ID:JamesHyot,项目名称:symfony_userevent,代码行数:10,代码来源:LoadEventData.php

示例4: dispatch

 /**
  * {@inheritdoc}
  */
 public function dispatch($eventName, Event $event = null)
 {
     if (null === $event) {
         $event = new Event();
     }
     $event->setDispatcher($this);
     $event->setName($eventName);
     if ($listeners = $this->getListeners($eventName)) {
         $this->doDispatch($listeners, $eventName, $event);
     }
     return $event;
 }
开发者ID:nix9,项目名称:laracasts,代码行数:15,代码来源:EventDispatcher.php

示例5: dispatch

 /**
  * @see EventDispatcherInterface::dispatch
  *
  * @api
  */
 public function dispatch($eventName, Event $event = null)
 {
     if (!isset($this->listeners[$eventName])) {
         return;
     }
     if (null === $event) {
         $event = new Event();
     }
     $event->setDispatcher($this);
     $event->setName($eventName);
     $this->doDispatch($this->getListeners($eventName), $eventName, $event);
 }
开发者ID:krisldz,项目名称:Gekosale2,代码行数:17,代码来源:EventDispatcher.php

示例6: dispatch

 /**
  * @see IDispatcher::dispatch
  *
  * @api
  */
 public function dispatch($eventName, \Flywheel\Event\Event $event = null)
 {
     if (null === $event) {
         $event = new Event();
     }
     $event->setDispatcher($this);
     $event->setName($eventName);
     if (!isset($this->_listeners[$eventName])) {
         return $event;
     }
     $this->doDispatch($this->getListeners($eventName), $eventName, $event);
     return $event;
 }
开发者ID:quyenminh102,项目名称:flywheel-framework,代码行数:18,代码来源:Dispatcher.php

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

示例8: fromArray

 public static function fromArray($input)
 {
     $event = null;
     if (array_key_exists('id', $input)) {
         try {
             // get event by id
             $event = new Event($input['id']);
         } catch (fExpectedException $e) {
         }
     }
     if ($event == null) {
         $event = new Event();
         $event->generateSecret();
         $event->setHidden(1);
     }
     // These are marked as required
     $event->setTitle(get($input['title'], 'Title missing'));
     $event->setLocname(get($input['venue'], 'Venue missing'));
     $event->setAddress(get($input['address'], 'Address missing'));
     $event->setName(get($input['organizer'], 'Organizer missing'));
     $event->setEmail(get($input['email'], 'Email missing'));
     // These are optional
     $event->setHideemail(get($input['hideemail'], 0));
     $event->setPhone(get($input['phone'], ''));
     $event->setHidephone(get($input['hidephone'], 0));
     $event->setContact(get($input['contact'], ''));
     $event->setHidecontact(get($input['hidecontact'], 0));
     $event->setDescr(get($input['details'], ''));
     $event->setEventtime(get($input['time'], ''));
     $event->setHighlight(0);
     $event->setTimedetails(get($input['timedetails'], ''));
     $event->setLocdetails(get($input['locdetails'], ''));
     $event->setEventduration(get($input['eventduration'], 0));
     $event->setWeburl(get($input['weburl'], ''));
     $event->setWebname(get($input['webname'], ''));
     $event->setAudience(get($input['audience'], ''));
     $event->setTinytitle(get($input['tinytitle'], ''));
     $event->setPrintdescr(get($input['printdescr'], ''));
     $event->setDates(get($input['datestring'], ''));
     // string field 'dates' needed for legacy admin calendar
     $event->setDatestype(get($input['datestype'], 'O'));
     $event->setArea(get($input['area'], 'P'));
     // default to 'P'ortland
     //$event->setPrintcontact(get($input['printcontact'], ''));
     // Length
     return $event;
 }
开发者ID:ejegg,项目名称:shiftcal,代码行数:47,代码来源:Event.php

示例9: dispatchEvent

 /**
  * Dispatches an event by dispatching arguments to all listeners that handle the event.
  *
  * @param   string         $name  The event name
  * @param   object|array   $event An array, a ObjectConfig or a Event object
  * @return  Event
  */
 public function dispatchEvent($name, $event = array())
 {
     $result = array();
     //Make sure we have an event object
     if (!$event instanceof Event) {
         $event = new Event($event);
     }
     $event->setName($name)->setDispatcher($this);
     //Notify the listeners
     $listeners = $this->getListeners($name);
     foreach ($listeners as $listener) {
         call_user_func($listener, $event);
         if (!$event->canPropagate()) {
             break;
         }
     }
     return $event;
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:25,代码来源:abstract.php

示例10: dispatch

 /**
  * {@inheritDoc}
  */
 public function dispatch($eventName, EventInterface $event = null)
 {
     if ($event === null) {
         $event = new Event();
     }
     $event->setName($eventName);
     $event->setDispatcher($this);
     if (isset($this->listeners[$eventName])) {
         foreach ($this->listeners[$eventName] as $priority => $listeners) {
             foreach ($listeners as $key => $listener) {
                 $listener->notify($event);
                 if ($event->isPropagationStopped()) {
                     break;
                 }
             }
             if ($event->isPropagationStopped()) {
                 break;
             }
         }
     }
     return $event;
 }
开发者ID:Cravid,项目名称:php-event,代码行数:25,代码来源:Dispatcher.php

示例11: setEventsFromICal

 /**
  * The file contents is looked at and events are created here.
  * @param string $fileContents
  * @return integer The number of events saved.
  */
 public function setEventsFromICal($fullDir, $fullFileName, $personId)
 {
     //start parse of local file
     $v = new vcalendar();
     // set directory
     $v->setConfig('directory', $fullDir);
     // set file name
     $v->setConfig('filename', $fullFileName);
     $v->parse();
     $count = 0;
     foreach ($v->components as $component => $info) {
         # get first vevent
         $comp = $v->getComponent("VEVENT");
         $summary_array = $comp->getProperty("summary", 1, TRUE);
         //echo "Event: ", $summary_array["value"], "\n";
         $dtstart_array = $comp->getProperty("dtstart", 1, TRUE);
         $dtstart = $dtstart_array["value"];
         $startDate = "{$dtstart["year"]}-{$dtstart["month"]}-{$dtstart["day"]}";
         $startTime = "{$dtstart["hour"]}:{$dtstart["min"]}:{$dtstart["sec"]}";
         $dtend_array = $comp->getProperty("dtend", 1, TRUE);
         $dtend = $dtend_array["value"];
         $endDate = "{$dtend["year"]}-{$dtend["month"]}-{$dtend["day"]}";
         $endTime = "{$dtend["hour"]}:{$dtend["min"]}:{$dtend["sec"]}";
         //echo "start: ",  $startDate,"T",$startTime, "\n";
         //echo "end: ",  $endDate,"T",$endTime, "\n";
         $location_array = $comp->getProperty("location", 1, TRUE);
         //echo "Location: ", $location_array["value"], "\n <br>";
         //TODO: Check that this event does not already exist.
         $event = new Event();
         $event->setPersonId($personId);
         $event->setName($summary_array["value"]);
         $event->setStartTime($startDate . "T" . $startTime);
         $event->setEndTime($endDate . "T" . $endTime);
         $event->setLocation($location_array["value"]);
         $event->save();
         $count++;
     }
     return $count;
 }
开发者ID:nathanlon,项目名称:twical,代码行数:44,代码来源:EventTable.class.php

示例12: dispatchUntil

 /**
  * Dispatch all listeners of a given event until one returns a non null value.
  *
  * @param  Event $event A Event instance
  *
  * @return Event The Event instance
  */
 public function dispatchUntil($eventName, Event $event)
 {
     // skip dispatching because event is already dispatched
     if ($event->isProcessed()) {
         return $event;
     }
     // skip dispatching because event hasn't listeners
     if (!$this->hasListeners($eventName)) {
         return $event;
     }
     $event->setName($eventName);
     foreach ($this->getListeners($event->getName()) as $listener) {
         if (call_user_func($listener, $event)) {
             $event->setProcessed(true);
             break;
         }
     }
     return $event;
 }
开发者ID:phpalchemy,项目名称:phpalchemy,代码行数:26,代码来源:EventDispatcher.php

示例13: function

            $status = 200;
            $response["code"] = $status;
            $response["error"] = 1;
            $response["error_message"] = "Some error occured while updating contingent {$contingent->getId()}.";
        }
    } else {
        $response["error"] = 1;
        $response["error_message"] = "Invalid ID,Expecting numeric ID";
    }
    print json_encode($response);
});
$app->put('/event/:id', function ($id) use($app, $eventMapper) {
    verifyRequiredParams(array('id', 'logo'));
    $event = new Event();
    $event->setId($id);
    $event->setName($app->request()->put('name'));
    $event->setDetails($app->request()->put('details'));
    $event->setSlogan($app->request()->put('slogan'));
    $event->setCategory($app->request()->put('type'));
    $event->setRules($app->request()->put('rules'));
    $event->setStartDate($app->request()->put('start_date'));
    $event->setEndDate($app->request()->put('end_date'));
    $event->setStartTime($app->request()->put('start_time'));
    $event->setEndTime($app->request()->put('end_time'));
    $event->setGroupSize($app->request()->put('group_size'));
    $event->setLogo($app->request()->put('logo'));
    # --Getting the put vars and typecasting to int. Blehhh. Can't help, its PHP xD
    $feeHome = $app->request()->put('fee_home');
    settype($feeHome, "integer");
    $feeRemote = $app->request()->put('fee_remote');
    settype($feeRemote, "integer");
开发者ID:bedekarsarvesh,项目名称:Udaan2016,代码行数:31,代码来源:index.php

示例14: testSetName3

 /**
  * set non-string name
  *
  * @covers Phossa\Event\Event::setName
  * @expectedExceptionCode Phossa\Event\Message\Message::INVALID_EVENT_NAME
  * @expectedException Phossa\Event\Exception\InvalidArgumentException
  */
 public function testSetName3()
 {
     $newname = 100;
     $this->object->setName($newname);
     $this->assertTrue($newname === $this->object->getName());
 }
开发者ID:phossa,项目名称:phossa-event,代码行数:13,代码来源:EventTest.php

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


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