本文整理汇总了PHP中Event::getEvents方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::getEvents方法的具体用法?PHP Event::getEvents怎么用?PHP Event::getEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event::getEvents方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
* shows the homepage
*
*/
public function indexAction()
{
$get = Zend_Registry::get('getFilter');
if (isset($get->shelf)) {
$this->view->hideFeature = true;
}
$event = new Event();
$upcoming = $event->getEvents(null, null, null, time(), null, 'open', 5)->toArray();
$workshop = new Workshop();
foreach ($upcoming as &$u) {
$u['workshop'] = $workshop->find($u['workshopId'])->toArray();
if (Zend_Auth::getInstance()->hasIdentity()) {
$u['status'] = $event->getStatusOfUserForEvent(Zend_Auth::getInstance()->getIdentity()->accountId, $u['eventId']);
} else {
$u['status'] = '';
}
}
$this->view->upcoming = $upcoming;
$searchTerm = new Search_Term();
$this->view->popularSearchTerms = $searchTerm->getTopSearchTerms(5)->toArray();
if (Zend_Auth::getInstance()->hasIdentity()) {
$this->view->loggedIn = true;
$myEvents = $event->getEventsForUser(Zend_Auth::getInstance()->getIdentity()->accountId);
$this->view->myEvents = $myEvents['currentEvents'];
$this->view->account = Zend_Auth::getInstance()->getIdentity()->toArray();
}
$this->_helper->layout->setLayout('homepage');
$this->view->messages = $this->_helper->flashMessenger->getMessages();
}
示例2: test_addAll
function test_addAll($db)
{
//Insert X events per user
$result = true;
$count = 0;
$t1 = microtime(true);
for ($i = 0; $i < TOTAL_USERS; $i++) {
$events = Event::getEvents(EVENTS_PER_USER);
foreach ($events as $event) {
$userid = $i + 1;
if ($db->insert("calendar", $userid, $event) == false) {
$result = false;
} else {
$count++;
}
}
}
$t2 = microtime(true);
$diff = $t2 - $t1 . "s";
if ($result) {
echo "Insert {$count} records ({$diff})<br>";
} else {
echo "Failed addAll";
}
return $result;
}
示例3: execute
public function execute($lastRunDt = null)
{
$config = Zend_Registry::get('config');
$checkDtStart = new Zend_Date($this->_lastRunDt);
$checkDtStart->subHour($config->user->numHoursEvaluationReminder->val);
$checkDtEnd = new Zend_Date();
$checkDtEnd->subHour($config->user->numHoursEvaluationReminder->val);
$event = new Event();
$events = $event->getEvents(null, null, null, $checkDtStart->getTimestamp(), $checkDtEnd->getTimestamp(), 'open');
$location = new Location();
$workshop = new Workshop();
$instructor = new Event_Instructor();
$attendee = new Event_Attendee();
$eu = new Evaluation_User();
foreach ($events as $e) {
$startDt = strtotime($e->date . ' ' . $e->startTime);
$endDt = strtotime($e->date . ' ' . $e->endTime);
if ($checkDtStart->getTimestamp() < $endDt && $checkDtEnd->getTimestamp() >= $endDt) {
$evalAvailableDt = new Zend_Date($endDt);
$evalAvailableDt->addHour($config->user->numHoursEvaluationAvailability->val);
if ($evalAvailableDt->getTimestamp() > time()) {
$taken = $eu->getCompleted($e->eventId);
$thisLocation = $location->find($e->locationId);
if (is_null($thisLocation)) {
throw new Ot_Exception_Data('msg-error-noLocation');
}
$thisWorkshop = $workshop->find($e->workshopId);
if (is_null($thisWorkshop)) {
throw new Ot_Exception_Data('msg-error-noWorkshop');
}
$instructors = $instructor->getInstructorsForEvent($e->eventId);
$instructorNames = array();
$instructorEmails = array();
foreach ($instructors as $i) {
$instructorNames[] = $i['firstName'] . ' ' . $i['lastName'];
$instructorEmails[] = $i['emailAddress'];
}
$data = array('workshopName' => $thisWorkshop->title, 'workshopDate' => date('m/d/Y', $startDt), 'workshopStartTime' => date('g:i a', $startDt), 'workshopEndTime' => date('g:i a', $endDt), 'workshopMinimumEnrollment' => $e->minSize, 'workshopCurrentEnrollment' => $e->roleSize, 'locationName' => $thisLocation->name, 'locationAddress' => $thisLocation->address, 'instructorNames' => implode(', ', $instructorNames), 'instructorEmails' => implode(', ', $instructorEmails));
$attending = $attendee->getAttendeesForEvent($e->eventId, 'attending');
foreach ($attending as $a) {
if ($a['attended'] == 1 && !in_array($a['accountId'], $taken)) {
$trigger = new Ot_Trigger();
$trigger->setVariables($data);
$trigger->accountId = $a['accountId'];
$trigger->studentEmail = $a['emailAddress'];
$trigger->studentName = $a['firstName'] . ' ' . $a['lastName'];
$trigger->studentUsername = $a['username'];
$trigger->dispatch('Event_Evaluation_Reminder');
}
}
}
}
}
}
示例4: getReportCsv
public function getReportCsv($fromDate, $toDate)
{
$event = new Event();
$workshop = new Workshop();
$location = new Location();
$attendee = new Event_Attendee();
// go ahead and get all the workshops so we don't have to do loads of DB queries
$workshopList = $workshop->fetchAll();
$workshops = array();
foreach ($workshopList as $w) {
$workshops[$w->workshopId] = $w->toArray();
}
// go ahead and get all the locations so we don't have to do loads of DB queries
$locationList = $location->fetchAll();
$locations = array();
foreach ($locationList as $l) {
$locations[$l->locationId] = $l->toArray();
}
$events = $event->getEvents(null, null, null, $fromDate, $toDate)->toArray();
$fileName = 'report-' . date('Ymd-B') . '.csv';
$tmpName = tempnam('/tmp', $fileName);
$fp = fopen($tmpName, 'w');
$columnNames = array('eventId' => 'eventId', 'workshopId' => 'workshopId', 'workshopTitle' => 'workshopTitle', 'locationId' => 'locationId', 'locationName' => 'locationName', 'eventDate' => 'eventDate', 'startTime' => 'startTime', 'endTime' => 'endTime', 'accountId' => 'accountId', 'username' => 'username', 'firstName' => 'firstName', 'lastName' => 'lastName', 'status' => 'status', 'attended' => 'attended');
$ret = fputcsv($fp, $columnNames, ',', '"');
if ($ret === false) {
throw new Ot_Exception_Data('Error writing backup CSV file');
}
foreach ($events as &$e) {
$e['workshop'] = $workshops[$e['workshopId']];
$e['location'] = $locations[$e['locationId']];
$e['attendees'] = $attendee->getAttendeesForEvent($e['eventId']);
foreach ($e['attendees'] as $a) {
$data = array();
$data = array('eventId' => $e['eventId'], 'workshopId' => $e['workshopId'], 'workshopTitle' => $e['workshop']['title'], 'locationId' => $e['locationId'], 'locationName' => $e['location']['name'], 'eventDate' => $e['date'], 'startTime' => $e['startTime'], 'endTime' => $e['endTime'], 'accountId' => $a['accountId'], 'username' => $a['username'], 'firstName' => $a['firstName'], 'lastName' => $a['lastName'], 'status' => $a['status'], 'attended' => $a['attended']);
$ret = fputcsv($fp, $data, ',', '"');
if ($ret === false) {
throw new Ot_Exception_Data('Error writing backup CSV file');
}
}
}
fclose($fp);
file_get_contents($tmpName);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Length: ' . filesize($tmpName));
header("Content-Disposition: attachment; filename={$fileName}");
readfile($tmpName);
unlink($tmpName);
}
示例5: getEventsForInstructor
public function getEventsForInstructor($accountId, $startDt = null, $endDt = null)
{
$dba = $this->getAdapter();
$where = $dba->quoteInto('accountId = ?', $accountId);
$result = $this->fetchAll($where);
$eventIds = array();
foreach ($result as $r) {
$eventIds[] = $r->eventId;
}
if (count($eventIds) == 0) {
return array();
}
$event = new Event();
$workshop = new Workshop();
$events = $event->getEvents(null, $eventIds, null, $startDt, $endDt, 'open')->toArray();
foreach ($events as &$e) {
$e['workshop'] = $workshop->find($e['workshopId']);
//->toArray();
}
return $events;
}
示例6: execute
public function execute($lastRunDt = null)
{
$config = Zend_Registry::get('config');
$event = new Event();
$events = $event->getEvents(null, null, null, time(), null, 'open');
$location = new Location();
$workshop = new Workshop();
$instructor = new Event_Instructor();
$checkDt = new Zend_Date($this->_lastRunDt);
$checkDt->addHour($config->user->numHoursLowAttendanceNotification->val);
foreach ($events as $e) {
if ($e->roleSize < $e->minSize) {
$startDt = strtotime($e->date . ' ' . $e->startTime);
$endDt = strtotime($e->date . ' ' . $e->endTime);
if ($checkDt->getTimestamp() > $startDt && $this->_lastRunDt < $startDt) {
$thisLocation = $location->find($e->locationId);
if (is_null($thisLocation)) {
throw new Ot_Exception_Data('msg-error-noLocation');
}
$thisWorkshop = $workshop->find($e->workshopId);
if (is_null($thisWorkshop)) {
throw new Ot_Exception_Data('msg-error-noWorkshop');
}
$instructors = $instructor->getInstructorsForEvent($e->eventId);
$instructorNames = array();
$instructorEmails = array();
foreach ($instructors as $i) {
$instructorNames[] = $i['firstName'] . ' ' . $i['lastName'];
$instructorEmails[] = $i['emailAddress'];
}
$data = array('workshopName' => $thisWorkshop->title, 'workshopDate' => date('m/d/Y', $startDt), 'workshopStartTime' => date('g:i a', $startDt), 'workshopEndTime' => date('g:i a', $endDt), 'workshopMinimumEnrollment' => $e->minSize, 'workshopCurrentEnrollment' => $e->roleSize, 'locationName' => $thisLocation->name, 'locationAddress' => $thisLocation->address, 'instructorNames' => implode(', ', $instructorNames), 'instructorEmails' => implode(', ', $instructorEmails));
$trigger = new Ot_Trigger();
$trigger->setVariables($data);
$trigger->dispatch('Event_LowAttendance');
}
}
}
}
示例7: strtotime
break;
default:
$today = strtotime(date('Y-m-01', $today));
$firstday_num = date('w', $today);
$plus = "next months";
$nextDate = "next months";
$previousDate = "last month";
$num = cal_days_in_month(CAL_GREGORIAN, date('m', $today), date('Y'));
$term = "month";
break;
}
$next = strtotime($plus, $today);
$nextDate = strtotime($nextDate, $today);
$previousDate = strtotime($previousDate, $today);
$events = new Event();
$eventsAll = $events->getEvents($today, $next);
$calendar_term = "<div class='calendar_term'><a href='index.php?page=calendar&term=day&date={$today}' class='button'>Den</a>\n <a href='index.php?page=calendar&term=week&date={$today}' class='button'>Týden</a>\n <a href='index.php?page=calendar&term=month&date={$today}' class='button'>Měsíc</a></div>";
for ($i = 0; $i < $num; $i++) {
$days[$i]['name'] = $daysname[date("w", $today)];
$days[$i]['date'] = date("j. n. Y", $today);
$days[$i]['day'] = date("j", $today);
$days[$i]['timestamp'] = $today;
foreach ($eventsAll as $event) {
if ($event['timestamp1'] >= $today && $event['timestamp1'] < strtotime('+1 day', $today)) {
$days[$i]['events'][] = "<a href='index.php?page=calendar_event&id={$event['id']}'>{$event['title']}</a>";
}
}
$days[$i]['events'][] = "<a href='index.php?page=calendar_new_event×tamp={$today}' class='calendar_add_new'>+</a>";
$today = strtotime('+1 day', $today);
}
$calendar = (include_once "views/calendar/{$term}.php");
示例8: array
if ($action == 'none') {
$types = array('Addition Event', 'Change Event', 'Deletion Event', 'Other Events');
for ($i = 0; $i < count($types); $i++) {
?>
<h3><?php
echo $types[$i];
?>
</h3>
<table class="table table-hover">
<tr>
<th>ID</th>
<th>Message</th>
<th>Time</th>
</tr>
<?php
$events = Event::getEvents($i + 1);
foreach ($events as $event) {
?>
<tr>
<td><a onclick="load('events', 'view', 'none', {id:'<?php
echo $event->getID();
?>
'})"><?php
echo $event->getID();
?>
</a></td>
<td><?php
echo $event->getMessage();
?>
</td>
<td><?php
示例9: setLang
/**
*
*/
public static function setLang($controllerID)
{
static::getLanguages();
if ($lang = \App::storage('website.languages.' . $controllerID)) {
$event = \Event::getEvents('website');
if (is_array($event) && ptc_array_get($event, 'setlang', false)) {
ptc_fire('website.setlang', array($controllerID, &$lang));
}
\App::storage('website.current_lang', $lang);
$fallback_key = static::$_fallbackLang;
$fallback_lang = $fallback_key && $fallback_key != $controllerID ? \App::storage('website.languages.' . $fallback_key) : null;
\App::storage('website.fallback_lang', $fallback_lang);
return true;
}
return false;
}
示例10: execute
public function execute($lastRunDt = null)
{
$config = Zend_Registry::get('config');
$event = new Event();
$events = $event->getEvents(null, null, null, time(), null, 'open');
$location = new Location();
$workshop = new Workshop();
$instructor = new Event_Instructor();
$attendees = new Event_Attendee();
$lastRunDt = new Zend_Date($this->_lastRunDt);
$currentDt = new Zend_Date();
foreach ($events as $e) {
$startDt = strtotime($e->date . ' ' . $e->startTime);
$endDt = strtotime($e->date . ' ' . $e->endTime);
$firstDt = new Zend_Date($startDt);
$firstDt->subHour($config->user->numHoursFirstReminder->val);
$finalDt = new Zend_Date($startDt);
$finalDt->subHour($config->user->numHoursFinalReminder->val);
$notification = null;
if ($firstDt->getTimestamp() > $lastRunDt->getTimestamp() && $firstDt->getTimestamp() < $currentDt->getTimestamp()) {
$notification = 'first';
}
if ($finalDt->getTimestamp() > $lastRunDt->getTimestamp() && $finalDt->getTimestamp() < $currentDt->getTimestamp()) {
$notification = 'final';
}
if (!is_null($notification)) {
$thisLocation = $location->find($e->locationId);
if (is_null($thisLocation)) {
throw new Ot_Exception_Data('msg-error-noLocation');
}
$thisWorkshop = $workshop->find($e->workshopId);
if (is_null($thisWorkshop)) {
throw new Ot_Exception_Data('msg-error-noWorkshop');
}
$instructors = $instructor->getInstructorsForEvent($e->eventId);
$instructorNames = array();
$instructorEmails = array();
foreach ($instructors as $i) {
$instructorNames[] = $i['firstName'] . ' ' . $i['lastName'];
$instructorEmails[] = $i['emailAddress'];
}
$data = array('workshopName' => $thisWorkshop->title, 'workshopDate' => date('m/d/Y', $startDt), 'workshopStartTime' => date('g:i a', $startDt), 'workshopEndTime' => date('g:i a', $endDt), 'workshopMinimumEnrollment' => $e->minSize, 'workshopCurrentEnrollment' => $e->roleSize, 'locationName' => $thisLocation->name, 'locationAddress' => $thisLocation->address, 'instructorNames' => implode(', ', $instructorNames), 'instructorEmails' => implode(', ', $instructorEmails));
$attending = $attendees->getAttendeesForEvent($e->eventId, 'attending');
foreach ($attending as $a) {
$trigger = new Ot_Trigger();
$trigger->setVariables($data);
$trigger->accountId = $a['accountId'];
$trigger->studentEmail = $a['emailAddress'];
$trigger->studentName = $a['firstName'] . ' ' . $a['lastName'];
if ($notification == 'final') {
$trigger->dispatch('Event_Attendee_Final_Reminder');
} else {
$trigger->dispatch('Event_Attendee_First_Reminder');
}
}
$trigger = new Ot_Trigger();
$trigger->setVariables($data);
if ($notification == 'final') {
$trigger->dispatch('Event_Instructor_Final_Reminder');
} else {
$trigger->dispatch('Event_Instructor_First_Reminder');
}
}
}
}
示例11: _getBlock
/**
*
*/
protected static function _getBlock($page, $blockID, $type)
{
if (!static::_initialize()) {
return false;
}
$block = static::$_xml->xpath("//block[@id='" . $blockID . "']");
if (!$block) {
trigger_error('Block id "' . $blockID . '" not found in xml config file!', E_USER_ERROR);
return false;
}
$children = $block[0]->{$type};
$string = null;
if (isset($children->resource)) {
for ($i = 0; $i < count($children); $i++) {
$items = array();
for ($a = 0; $a < count($children->{$i}->resource); $a++) {
$resource_id = (string) $children->{$i}->resource->{$a};
$items[] = $resource_id;
}
if ($comment = $children->{$i}->attributes()) {
$comment = $comment->type;
}
$string .= static::_build($items, $type, $comment);
}
}
if ($listener = $block[0]->listener) {
for ($b = 0; $b < count($listener); $b++) {
$listener_type = (string) $listener->{$b}->attributes()->type;
if ($type === $listener_type || 'any' === $listener_type) {
$params = array($page, &$string, $type);
if (false === ptc_fire('website.' . (string) $listener->{$b}[0], $params)) {
static::$_fireEvent = false;
}
}
}
}
$event = \Event::getEvents('website');
if ($page && static::$_fireEvent && is_array($event) && ptc_array_get($event, 'resources', false)) {
ptc_fire('website.resources', array($page, &$string, $type, $blockID));
}
if ($raw = $block[0]->{$type}->raw) {
$string .= 'js' === $type ? '<script>' . "\n" : '<style>' . "\n";
for ($c = 0; $c < count($raw); $c++) {
$string .= "\t" . $raw->{$c} . (';' !== substr(trim($raw->{$c}), -1) ? ';' : null) . "\n";
}
$string .= 'js' === $type ? '</script>' . "\n" : '</style>' . "\n";
}
return $string;
}
示例12: Event
<?php
include_once 'header.php';
?>
</div>
<div id="sidebaar">
<?php
include_once 'class.inc.php';
include_once 'sidebar.php';
?>
</div>
<div id="content">
<?php
$view = $_GET['view'];
if ($view == "e") {
$event = new Event();
$res = $event->getEvents();
echo "<table border='1'>\n\t\t\t<tr><td>Event Name</td><td>Partcipants</td></tr>\n\t\t";
foreach ($res as $r) {
echo "<tr><td>" . $r['Ename'] . "</td><td>" . $r['TCount'] . "</td></tr>";
}
}
if ($view == "c") {
$cat = new Category();
$res = $cat->getCatSummary();
echo "<table border='1'>\n\t\t\t<tr><td>Category Name</td><td>Partcipants</td></tr>\n\t\t";
foreach ($res as $r) {
echo "<tr><td>" . $r['Cname'] . "</td><td>" . $r['TCount'] . "</td></tr>";
}
}
if ($view == 'd') {
$del = new Delegate();
示例13: getEventsAction
/**
* Gets the events for a given month. Used in the scheduler as an AJAX call
*/
public function getEventsAction()
{
$this->_helper->viewRenderer->setNeverRender();
$this->_helper->layout->disableLayout();
$get = Zend_Registry::get('getFilter');
if (isset($get->date)) {
if (!empty($get->date)) {
$date = new Zend_Date($get->date);
} else {
$date = new Zend_Date();
}
} else {
$date = new Zend_Date();
}
$locationId = null;
if (isset($get->locationId) && !empty($get->locationId)) {
$locationId = $get->locationId;
}
$startDate = clone $date;
$endDate = clone $date;
$startDate->setHour(0)->setMinute(0)->setSecond(0);
$startDate->setDay(1);
$startDate->subDay($startDate->get(Zend_Date::WEEKDAY_DIGIT));
$endDate->setHour(23)->setMinute(59)->setSecond(59);
$endDate->setDay($endDate->get(Zend_Date::MONTH_DAYS));
$endDate->addDay(6 - $endDate->get(Zend_Date::WEEKDAY_DIGIT));
$event = new Event();
$events = $event->getEvents(null, null, $locationId, $startDate->getTimestamp(), $endDate->getTimestamp(), array('open', 'closed'), null)->toArray();
$workshop = new Workshop();
foreach ($events as &$e) {
$e['startTime'] = strftime('%l:%M %p', strtotime($e['startTime']));
$e['endTime'] = strftime('%l:%M %p', strtotime($e['endTime']));
$e['workshop'] = $workshop->find($e['workshopId'])->toArray();
}
echo Zend_Json::encode($events);
}
示例14: getEventsForAttendee
public function getEventsForAttendee($accountId, $startDt = null, $endDt = null, $status = 'all')
{
$dba = $this->getAdapter();
$where = $dba->quoteInto('accountId = ?', $accountId);
if ($status == 'all') {
$where .= ' AND ' . $dba->quoteInto('status != ?', 'canceled');
} else {
$where .= ' AND ' . $dba->quoteInto('status = ?', $status);
}
$result = $this->fetchAll($where);
$eventIds = array();
foreach ($result as $r) {
$eventIds[$r->eventId] = array('status' => $r->status, 'attended' => $r->attended);
}
if (count($eventIds) == 0) {
return array();
}
$event = new Event();
$workshop = new Workshop();
$events = $event->getEvents(null, array_keys($eventIds), null, $startDt, $endDt, 'open')->toArray();
foreach ($events as &$e) {
$e['workshop'] = $workshop->find($e['workshopId'])->toArray();
$e['status'] = $eventIds[$e['eventId']]['status'];
$e['attended'] = $eventIds[$e['eventId']]['attended'];
}
return $events;
}
示例15: controller_event_all
/**
* Fonction pour afficher tous les évenements et les contrôles pour ses events
*/
function controller_event_all()
{
$events = Event::getEvents();
render("events.php", array('events' => $events));
}