本文整理汇总了PHP中Event::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::get方法的具体用法?PHP Event::get怎么用?PHP Event::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->insertBefore(new DropdownField('MemberID', 'Member', Member::get()->map('ID', "FirstName")), 'AttendingWholeEvent');
$siteConfig = SiteConfig::current_site_config();
$current = $siteConfig->getCurrentEventID();
if ($this->ParentID < 1) {
$event = Event::get()->byID($current);
} else {
$event = Event::get()->byID($this->ParentID);
}
$fields->insertAfter(HiddenField::create('ParentID', 'Event', $event->ID), 'ExtraDetail');
$fields->removeByName('PublicFieldsRaw');
$fields->removeByName('Sort');
if ($this->PlayerGames()->Count() > 0) {
$gridField = new GridField('PlayerGames', 'Games', $this->PlayerGames(), $config = GridFieldConfig_RelationEditor::create());
$gridField->setModelClass('PlayerGame');
$config->addComponent(new GridFieldOrderableRows());
$config->removeComponentsByType('GridFieldPaginator');
$config->removeComponentsByType('GridFieldPageCount');
$config->addComponent(new GridFieldDeleteAction(false));
$config->addComponent($export = new GridFieldExportButton('before'));
$export->setExportColumns(singleton("PlayerGame")->getExportFields());
$fields->addFieldToTab('Root.PlayerGames', $gridField);
}
return $fields;
}
示例2: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->insertBefore(TextareaField::create('Intro', 'Intro'), 'Content');
$fields->insertAfter(ColorPaletteField::create("Colour", "Colour", array('night' => '#333333', 'air' => '#009EE2', 'earth' => ' #79c608', 'passion' => '#b02635', 'people' => '#de347f', 'inspiration' => '#783980')), "Intro");
$fields->insertBefore($image = UploadField::create('SplashImage', 'Splash Image'), 'Content');
$image->setFolderName('Uploads/Splash-Images');
if ($this->ClassName === "Page" || $this->ClassName === "HomePage") {
$fields->insertAfter(HTMLEditorField::create('ExtraContent'), 'Content');
$gridField = new GridField('FeatureItems', 'FeatureItems', $this->FeatureItems()->sort(array('Sort' => 'ASC', 'Archived' => 'ASC')), $config = GridFieldConfig_RelationEditor::create());
$gridField->setModelClass('FeatureItem');
$fields->addFieldToTab('Root.Features', $gridField);
$config->addComponent(new GridFieldOrderableRows());
} else {
if ($this->ClassName === "CalendarPage") {
$content = $fields->dataFieldByName('Content');
$content->addExtraClass('no-pagebreak');
$events = Event::get()->sort(array('StartDateTime' => 'Desc'))->filterByCallback(function ($record) {
return !$record->getIsPastEvent();
});
$gridField = new GridField('Event', 'Upcoming Events', $events, $config = GridFieldConfig_RecordEditor::create());
$gridField->setModelClass('Event');
$dataColumns = $config->getComponentByType('GridFieldDataColumns');
$dataColumns->setDisplayFields(array('Title' => 'Title', 'StartDateTime' => 'Date and Time', 'DatesAndTimeframe' => 'Presentation String'));
$fields->addFieldToTab('Root.UpcomingEvents', $gridField);
}
}
return $fields;
}
示例3: runEvents
private static function runEvents($eventName, &$data = NULL)
{
kohana::log('debug', 'Running event ' . $eventName);
// Returns of the callbacks for event specified
$events = Event::get($eventName);
// Loop through each event, instantiate the event object, and call the event.
// NOTE: We do this because we rely on __get/__set methods in bluebox plugins and they must be able to use $object->
// to reference the current controller
$return_value = TRUE;
foreach ($events as $event) {
// Share our current controller w/ the event system
Event::$data =& $data;
// Go get our plugin object
$obj =& self::initialize($event[0]);
if (method_exists($obj, $event[1])) {
$return = call_user_func(array($obj, $event[1]));
kohana::log('debug', 'Plugin hook ' . get_class($obj) . '::' . $event[1] . '() returned ' . ($return ? 'true' : 'false'));
// If the func doesnt have a return or its not bool, assume true
if (is_null($return) || !is_bool($return)) {
$return = TRUE;
}
// Bitwise AND of all the returns (if any returns false, the event will return false)
$return_value = $return_value & $return;
} else {
throw new Exception('Tried to call plugin method ' . get_class($obj) . '::' . $event[1] . '(), but no such method exists. (Event ' . $eventName . ')');
}
// Do this to prevent data from getting 'stuck'
$clearData = '';
Event::$data =& $clearData;
}
return $return_value;
}
示例4: init
public function init()
{
parent::init();
$member = Member::currentUser();
$this->member = $member;
$request = $this->getRequest();
//echo $request->getVar('test');
//Setting dates based on request variables
//We could add some sanity check herre
$this->start = $request->getVar('start');
$this->end = $request->getVar('end');
if ($request->getVar('allDay') == 'true') {
$this->allDay = true;
}
//Setting event based on request vars
if (($eventID = (int) $request->getVar('eventID')) && $eventID > 0) {
$event = Event::get()->byID($eventID);
if ($event && $event->exists()) {
if ($event->ClassName == 'PrivateEvent') {
//Only show private events to their owners
if ($event->OwnerID == $member->ID) {
$this->event = $event;
}
} else {
$this->event = $event;
}
}
}
}
示例5: generate_data_for_day
private static function generate_data_for_day(SS_Datetime $date)
{
$data = array('timestamp' => time(), 'searchDate' => $date->Format("Y-m-d"), 'collections' => array('events' => array(), 'galleries' => array(), 'locations' => array()));
$galleryIDs = array();
$locationIDs = array();
// Get events
$where = sprintf("DATE(`StartDate`) = '%s'", $date->Format('Y-m-d'));
$events = Event::get()->where($where)->exclude(array("GalleryID" => 0, "Gallery.LocationID" => 0));
foreach ($events as $event) {
$galleryIDs[] = $event->GalleryID;
$data['collections']['events'][] = $event->forAPI();
}
// Get galleries
$galleries = Gallery::get()->byIDs(array_unique($galleryIDs));
foreach ($galleries as $gallery) {
$locationIDs[] = $gallery->LocationID;
$data['collections']['galleries'][] = $gallery->forAPI();
}
// Get locations
$locations = Location::get()->byIDs(array_unique($locationIDs));
foreach ($locations as $location) {
$data['collections']['locations'][] = $location->forAPI();
}
return $data;
}
示例6: filter
/**
* Filters the Response.
*
* @param Event $event An Event instance
* @param Response $response A Response instance
*/
public function filter($event, Response $response)
{
if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) {
return $response;
}
$this->esi->addSurrogateControl($response);
return $response;
}
示例7: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
if (count(Event::get()) > 0) {
$current = new DropdownField('CurrentEventID', 'CurrentEvent', Event::get()->map('ID', 'Title'));
$current->setEmptyString('');
$fields->addFieldToTab('Root.Events', $current);
}
$events = new GridField('Events', 'Event', Event::get(), GridFieldConfig_RecordEditor::create());
$fields->addFieldToTab('Root.Events', $events);
}
示例8: index
/**
* Main route for events page
*
* Route: /events
*/
public function index()
{
$event = new Event();
$event->where('start >', date('Y-m-d H:m:s'));
$event->order_by('start', 'asc');
$event->get();
$data['events'] = $event;
// Create the view
$this->template->title = 'Events';
$this->template->javascript->add('assets/js/masonry.min.js');
$this->template->content->view('events/index', $data);
$this->template->publish();
}
示例9: doRegister
/**
* Register action
* @param type $data
* @param type $form
* @return \SS_HTTPResponse
*/
public function doRegister($data, $form)
{
$r = new EventRegistration();
$form->saveInto($r);
$EventDetails = Event::get()->byID($r->EventID);
if ($EventDetails->TicketsRequired) {
$r->AmountPaid = $r->AmountPaid / 100;
}
$r->write();
$from = Email::getAdminEmail();
$to = $r->Email;
$bcc = $EventDetails->RSVPEmail;
$subject = "Event Registration - " . $EventDetails->Title . " - " . date("d/m/Y H:ia");
$body = "";
$email = new Email($from, $to, $subject, $body, null, null, $bcc);
$email->setTemplate('EventRegistration');
$email->send();
exit;
}
示例10: getFieldsForEventDay
public function getFieldsForEventDay($daysFromNow = 0)
{
// Get time
if ($daysFromNow === 0) {
$time = time();
} elseif ($daysFromNow === 1) {
$time = strtotime('+1 day');
} else {
$time = strtotime("+{$daysFromNow} days");
}
// Field data
$date = date('Y-m-d', $time);
$name = 'DaysEvents_' . date('l', $time);
$title = date('l', $time) . "'s Events - " . date('d/m/Y', $time);
$events = Event::get()->where("DATE(`StartDate`) = '{$date}'");
$eventsGrid = GridField::create($name, $title, $events, GridFieldConfig_RecordEditor::create()->removeComponentsByType('GridFieldPageCount')->removeComponentsByType('GridFieldAddNewButton')->addComponent(new GridFieldAddNewButton('toolbar-header-right')));
$fields = FieldList::create($eventsGrid);
$tabTitle = date('l', $time) . " ({$events->count()})";
return array('Fields' => $fields, 'TabTitle' => $tabTitle);
}
示例11: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Sort');
$siteConfig = SiteConfig::current_site_config();
$current = $siteConfig->getCurrentEventID();
if ($this->Event()->ID) {
$event = $this->Event();
} else {
if ($this->Parent()->ParentID > 0) {
$event = Event::get()->byID($this->Parent()->ParentID);
} else {
$event = Event::get()->byID($current);
}
}
if ($event) {
$prefNum = $event->PreferencesPerSession ? $event->PreferencesPerSession : 2;
} else {
$prefNum = 2;
}
$pref = array();
for ($i = 1; $i <= $prefNum; $i++) {
$pref[$i] = $i;
}
$preference = new DropdownField('Preference', 'Preference', $pref);
$preference->setEmptyString(' ');
$fields->insertAfter($preference, 'GameID');
$status = array(0 => "Pending/Declined", 1 => "Accepted");
$fields->insertAfter(new OptionsetField('Status', 'Status', $status), 'Preference');
$reg = Registration::get()->filter(array('ParentID' => $event->ID))->map('ID', "Title");
$player = new DropdownField('ParentID', 'Player', $reg);
$player->setEmptyString(' ');
$fields->insertAfter($player, 'Status');
$fields->insertAfter($fields->dataFieldByName('Favourite'), 'Status');
$fields->insertAfter($fields->dataFieldByName('ParentID'), 'GameID');
$event = HiddenField::create('EventID', 'Event', $event->ID);
$fields->insertAfter($event, 'GameID');
return $fields;
}
示例12: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$siteConfig = SiteConfig::current_site_config();
$current = $siteConfig->getCurrentEventID();
if ($this->ParentID < 1) {
$event = Event::get()->byID($current);
} else {
$event = Event::get()->byID($this->ParentID);
}
$parent = HiddenField::create('ParentID', 'Event', $event->ID);
$fields->insertAfter($parent, 'Details');
$sessions = array();
if ($event) {
for ($i = 1; $i <= $event->NumberOfSessions; $i++) {
$sessions[$i] = $i;
}
}
$session = new DropdownField('Session', 'Session', $sessions);
$session->setEmptyString(' ');
$fields->insertAfter($session, 'Title');
$fields->insertAfter($member = new DropdownField('FacilitatorID', 'Facilitator', Member::get()->map('ID', 'Name')), 'Session');
$member->setEmptyString(' ');
$fields->insertAfter(new TextField('FacilitatorText', 'Or enter facilitator name(s)'), 'FacilitatorID');
$status = array(0 => "Pending", 1 => "Accepted");
$fields->insertBefore(new OptionsetField('Status', 'Status', $status), 'Title');
$gridField = $fields->dataFieldByName("Players");
if ($gridField) {
$config = $gridField->getConfig();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(singleton("PlayerGame")->getGameDisplayFields());
$config->addComponent(new GridFieldOrderableRows());
$config->removeComponentsByType('GridFieldPaginator');
$config->removeComponentsByType('GridFieldPageCount');
$config->addComponent($export = new GridFieldExportButton('before'));
$export->setExportColumns(singleton("PlayerGame")->getExportFields());
}
return $fields;
}
示例13: send_newsletter
public function send_newsletter()
{
$this->load->library('markdown');
$currentWeek = date("W");
$currentYear = date("Y");
$dates = $this->getStartAndEndDate($currentWeek, $currentYear);
// Generate the message
$event = new Event();
$event->where('WEEKOFYEAR(start) =', $currentWeek);
$event->order_by('start', 'asc');
$event->get();
$data['dates'] = $dates;
$data['events'] = $event;
$message = $this->load->view('email/newsletter', $data, TRUE);
$this->load->library('email');
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from('fsc-announce@fsc.stanford.edu', 'FSC Nexus');
$this->email->subject('Weekly Newsletter for ' . $dates[0] . ' to ' . $dates[1]);
$this->email->to($this->input->post('email'));
$this->email->message($message);
$this->email->send();
}
示例14: testParseEvent
public function testParseEvent()
{
$eventTag = new Event();
$eventTag->set("Some Ordinary Event");
$unparsedTag = '[Event "Some Ordinary Event"]';
$errors = null;
$parsed = Tag::parse($unparsedTag, $errors);
echo "errors: ";
var_dump($errors);
$this->assertInstanceof('pgn\\tags\\Event', $parsed);
$this->assertSame($eventTag->get(), $parsed->get());
$this->assertNotNull($errors);
$this->assertEquals(0, count($errors));
}
示例15: foreach
}
?>
</section>
<?php
$liste = Event::last();
if (count($liste)) {
?>
<section class="contenu demi">
<h4>Dernières interactions</h4>
<ul class="listeDesEvenements">
<?php
foreach ($liste as $event) {
$e = new Event($event['id']);
$c = new People($e->get('people'));
?>
<li class="evenement <?php
echo $e->get('type');
?>
<?php
if ($e->link()) {
?>
clic<?php
}
?>
">
<small><span><?php
echo Event::displayType($e->get('type'));
?>
</span></small>