本文整理汇总了PHP中Events::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP Events::getById方法的具体用法?PHP Events::getById怎么用?PHP Events::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::getById方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process()
{
$event = Events::getById($this->getElementValue('id'));
Events::setSignupStatus($this->user->getId(), $event['id'], 'SIGNEDUP');
Events::appendSignupComment($this->user->getId(), $event['id'], 'Forced signup.', Session::getUser()->getUsername());
logActivity('Forced signup of:' . $this->getElementValue('username') . ' to event: ' . $event['id'] . ' (' . $event['name'] . ')');
redirect('viewEvent.php?id=' . $event['id'], 'They have been signed up.');
}
示例2: show
public function show($id)
{
// init
$data = array();
$event = Events::getById($id);
if ($event == false) {
return App::abort('404');
}
$data['view'] = $event;
// // get photos
$data['photos'] = Photo::where('type_name', '=', 'events')->where('type_id', '=', $event->id)->where('status', '=', 1)->get();
$data['social_actions'] = SocialAction::with(array('city', 'category'))->join('social_action_events', 'social_action_events.social_action_id', '=', 'social_actions.id')->where('event_id', '=', $event->id)->where('social_actions.status', '=', 1)->orderBy('social_actions.id', 'desc')->get();
$data['social_target_id'] = SocialTarget::getAll();
$data['social_action_category_id'] = SocialActionCategory::getAll();
$data['city_id'] = City::getAll();
return View::make('bagikasih.event.detail', $data);
}
示例3: process
public function process()
{
$event = Events::getById($this->getElementValue('event'));
switch ($event['signups']) {
case 'staff':
$initialSignupStatus = 'STAFF';
break;
case 'punters':
$initialSignupStatus = 'SIGNEDUP';
break;
case 'waitinglist':
$initialSignupStatus = 'WAITING_LIST';
break;
default:
throw new Exception('Cannot determine your initial signup status when the event signup status is: ' . $event['signups']);
}
Events::setSignupStatus($this->getElementValue('user'), $this->getElementValue('event'), $initialSignupStatus);
$userReq = $this->getElementValue('comment');
if (!empty($userReq)) {
$userReq = 'User requirement: ' . $userReq;
}
Events::appendSignupComment($this->getElementValue('user'), $this->getElementValue('event'), 'User self signup. ' . $userReq);
}
示例4: __construct
public function __construct($eventId)
{
parent::__construct('eventUpdate', 'Event update');
$event = Events::getById($eventId);
$this->addElement(new ElementHidden('action', null, 'update'));
$this->addElement(new ElementHidden('id', null, $event['id']));
$this->addSection('Basics');
$this->addElement(new ElementInput('name', 'Event name', $event['name']));
$this->addElement($this->getElementGalleries($event['gallery']));
$this->addElement(new ElementNumeric('totalSeats', 'Total seats', $event['totalSeats']));
$this->addElement(new ElementInput('comment', 'Comment', $event['comment']));
$this->addElement(new ElementCheckbox('published', 'Published', $event['published']));
$this->addSection('When and where?');
$this->addElement($this->getElementVenues($event['venueId']));
$this->addElement(new ElementDate('dateStart', 'Start', formatDt($event['start'])));
$this->addElement(new ElementNumeric('duration', 'Duration', $event['duration']));
$this->addSection('Tickets');
$this->addElement($this->getElementSeatingplan($event['seatingPlan']));
$this->addElement(new ElementNumeric('priceInAdv', 'Price in advance', $event['priceInAdv']));
$this->addElement(new ElementNumeric('priceOnDoor', 'Price on door', $event['priceOnDoor']));
$this->addElement($this->getElementSignups($event['signups']));
$this->requireFields(array('name', 'totalSeats'));
$this->addButtons(Form::BTN_SUBMIT);
}
示例5: signupCreate
private static function signupCreate($userId, $eventId, $status)
{
global $db;
$event = Events::getById($eventId);
$sql = 'INSERT INTO signups (user, event, status, ticketCost, comments) VALUES (:user, :event, :status, :cost, concat(now(), " Signup created.")) ';
$stmt = $db->prepare($sql);
$stmt->bindValue(':user', $userId);
$stmt->bindValue(':event', $eventId);
$stmt->bindValue(':status', $status);
$stmt->bindValue(':cost', $event['priceInAdv']);
$stmt->execute();
}
示例6: process
public function process()
{
$event = Events::getById($this->getElementvalue('event'));
Basket::addEvent($event, $this->ticketCosts[$event['id']]);
}
示例7: redirect
require_once 'includes/common.php';
require_once 'includes/classes/Events.php';
require_once 'includes/classes/FormPayForFriend.php';
require_once 'includes/classes/FormAddToBasket.php';
require_once 'includes/classes/Basket.php';
use libAllure\Session;
use libAllure\Sanitizer;
use libAllure\DatabaseFactory;
if (!Session::isLoggedIn()) {
redirect('login.php', 'You need to <a href = "login.php">login</a> or <a href = "register.php">register</a> to pay for events.');
}
$sanitizer = new Sanitizer();
$action = $sanitizer->filterString('action');
if (isset($_REQUEST['event'])) {
$eventId = intval($_REQUEST['event']);
$event = Events::getById($eventId);
switch ($action) {
case 'addPersonal':
Basket::addEvent($event);
redirect('basket.php', 'Ticked added', false, 1);
case 'delete':
Basket::removeEvent($event, $_REQUEST['user']);
redirect('basket.php', 'Ticket removed', false, -1);
}
}
$signupableEvents = Events::getSignupableEvents();
$tpl->assign('signupableEvents', $signupableEvents);
$formAddToBasket = new FormAddToBasket($signupableEvents);
if ($formAddToBasket->validate()) {
$formAddToBasket->process();
redirect('basket.php', 'Ticket added to basket');
示例8: FormSeatingPlanMoveUser
require_once 'includes/classes/FormSwapSeats.php';
use libAllure\DatabaseFactory;
use libAllure\Sanitizer;
use libAllure\Session;
if (Session::hasPriv('SEATING_PLAN_MOVE_USERS')) {
$formMoveUsers = new FormSeatingPlanMoveUser();
if ($formMoveUsers->validate()) {
$formMoveUsers->process();
}
$formSwapUsers = new FormSwapSeats();
if ($formSwapUsers->validate()) {
$formSwapUsers->process();
}
}
$event = Sanitizer::getInstance()->filterUint('event');
$event = Events::getById($event);
if (empty($event['seatingPlan'])) {
$tpl->error('Seating plan not enabled.');
}
$sql = 'SELECT sp.seatCount, sp.layout, sp.name, e.id AS event, e.name AS eventName FROM events e JOIN seatingplans sp ON e.seatingPlan = sp.id WHERE e.id = :event';
$stmt = DatabaseFactory::getInstance()->prepare($sql);
$stmt->bindValue(':event', $event['id']);
$stmt->execute();
$seatingPlan = $stmt->fetchRow();
$structSp = parseSeatingPlanObjects($seatingPlan['layout']);
$tpl->assign('listSeatingPlanObjects', $structSp);
$tpl->assign('itemSeatingPlan', $seatingPlan);
$tpl->display('viewSeatingPlan.tpl');
if (isset($formMoveUsers)) {
$tpl->assignForm($formMoveUsers);
$tpl->display('form.tpl');
示例9: catch
<?php
require_once 'includes/common.php';
require_once 'includes/classes/Events.php';
require_once 'includes/classes/Schedule.php';
use libAllure\Session;
use libAllure\Sanitizer;
$id = Sanitizer::getInstance()->filterUint('id');
try {
$event = Events::getById($id);
} catch (Exception $e) {
$tpl->error('Could not get event');
}
$event['priceInAdvWithCurrency'] = doubleToGbp($event['priceInAdv']);
$event['priceOnDoorWithCurrency'] = doubleToGbp($event['priceOnDoor']);
//$tpl->clear_assign('form');
if (Session::hasPriv('FORCE_SIGNUP')) {
require_once 'includes/classes/FormForceSignup.php';
$formForceSignup = new FormForceSignup($event['id']);
if ($formForceSignup->validate()) {
$formForceSignup->process();
}
}
require_once 'includes/widgets/header.php';
if (!Session::hasPriv('VIEW_SIGNUP_COMMENTS')) {
require_once 'includes/widgets/sidebar.php';
}
if (Session::isLoggedIn()) {
$notifications = array();
checkNotificationNotGuarenteedSeats($notifications);
$tpl->assign('notifications', $notifications);
示例10: redirect
<?php
require_once 'includes/common.php';
require_once 'includes/classes/Events.php';
require_once 'includes/classes/FormSignup.php';
use libAllure\Session;
if (!Session::isLoggedIn()) {
redirect('index.php', 'Ah, you are not logged in. How did you even get here? I am confused.');
}
$event = Events::getById(intval($_REQUEST['event']));
if (isset($_REQUEST['user']) && $_REQUEST['user'] != Session::getUser()->getID()) {
if (Session::hasPriv('SIGNUPS_MODIFY')) {
$user = intval($_REQUEST['user']);
} else {
throw new PermissionsException();
}
} else {
$user = Session::getUser()->getId();
}
$f = new FormSignup($event, $user, 'SIGNEDUP');
if ($f->validate()) {
$f->process();
logActivity('Signed up to event: ' . $event['name'], Session::getUser()->getId());
redirect('viewEvent.php?id=' . $event['id'], 'You have been signed up.');
}
//if (isset($_REQUEST['status'])) {
// Events::setSignupStatus($user, $event['id'], $_REQUEST['status']);
//
// redirect('viewEvent.php?id=' . $event['id'], 'Erm, thanks.');
//}
require_once 'includes/widgets/header.php';