79 if(checkRole(
"admin"))
81 $out =
"<br/><button class='button' onclick='editEvent($event_id)'>Edit this Event</button>\n";
101 $end = explode(
" ",
$event->end_date);
103 $startTimeStamp = strtotime(
$start[0]);
104 $endTimeStamp = strtotime($end[0]);
105 $dateTimeStamp = strtotime(
$date);
107 $diff = abs($endTimeStamp - $startTimeStamp);
108 $days = floor($diff/(60*60*24));
110 $inDate =
new DateTime(
$date.
"T00:00:00");
111 $startDate =
new DateTime(
$event->start_date);
114 if($inDate->format(
"j") == 1 && ($startDate->format(
"Y-m-d") <= $inDate->format(
"Y-m-d")))
119 if($days <= 5 || $showEvent)
121 return ($dateTimeStamp >= $startTimeStamp && $dateTimeStamp <= $endTimeStamp);
125 return ($dateTimeStamp == $startTimeStamp);
132 if(!count($tagRowCallbacks))
return "";
134 $id =
$event->format(
"id='{$pk}_{{$pk}}'");
136 foreach($tagRowCallbacks as $cb)
138 $dataAttrs = call_user_func($cb,
$event, $dataAttrs);
142 foreach($dataAttrs as
$name => $value)
144 $attrs .=
" ".$name.
"='".$value.
"'";
147 return "{$id}{$attrs}";
152 return "<h4>{$event->title}</h4><p>{$event->event_type}</p>";
159 <div
class=
"event_details">
160 <h3><?echo
$event->title?></h3>
161 <div
class=
"event_contents">
162 <p><em><?echo
$event->event_type?></em></p>
163 <p><label
style=
"width: 80px">Start: </label><?echo
$event->format(
"{start_date:short}") ?><br/>
164 <label
style=
"width: 80px">End: </label><?echo
$event->format(
"{end_date:short}") ?></p>
169 <p><label
style=
"width: 80px">Location: </label><?echo
$event->location?></p>
173 <p><?echo
$event->description?></p>
181 $out = ob_get_contents();
195 $form->required(
"title",
"start_date",
"end_date");
196 $form->hide(
"composite_class",
"event_invitation_id",
"allow_access",
"time_zone_id",
"owner_id");
198 $form->allowDelete =
true;
206 $calendarSelect =
new RelatedItemSelectFieldRenderer(
$form,
"calendar_id",
"Calendar",
Calendar,
"ORDER BY name",
"{name}",
"calendar_id",
false,
false, 80);
207 $eventTypeSelect =
new SelectFieldRenderer(
$form,
"event_type",
"Event Type");
208 $eventTypeSelect->allowAddEntry();
215 $handler_class = get_class($this);
218 $content .=
"<div {$tags} class='event_summary' onclick='showEventDetail({$event->$pk}, \"{$handler_class}\")'>";
248 $this->
month = date(
"n");
249 $this->
year = date(
"Y");
250 $this->tagRowCallbacks = array();
257 $this->maxEventsPerDay =
$max;
290 if(get_class(
$event) ==
"Event" &&
$event->composite_class)
292 $event_class =
$event->composite_class;
296 $event_class = get_class(
$event);
299 if(array_key_exists($event_class, $this->handlerMap))
301 $handler = $this->handlerMap[$event_class];
317 $this->tagRowCallbacks[] =
$handler;
351 $qs = $_SERVER[
'QUERY_STRING'];
357 $qs = preg_replace(
"/identifier=[\\w_]+&*/",
"",
$qs);
358 $qs = preg_replace(
"/{$this->yearParam}=\\d+&*/",
"",
$qs);
359 $qs = preg_replace(
"/{$this->monthParam}=\\d+&*/",
"",
$qs);
361 return "$identifier".appendToQueryString(
$qs,
"{$this->yearParam}=$year&{$this->monthParam}=$month");
366 if ($this->year < 2005 || $this->
year > 2038 || $this->month < 1 || $this->
month > 12)
368 die(
"Date out of range");
371 $this->startStr = sprintf(
"%d-%02d-01", $this->
year, $this->
month);
372 $this->start = strtotime($this->startStr);
374 $this->dayOfWeek = date(
"w", $this->start);
375 $this->daysInMonth = getMonthDays($this->
month, $this->
year);
377 $this->prevMonth = $this->
month - 1;
380 if ($this->prevMonth <= 0)
383 $this->prevMonth = 12;
386 $this->nextMonth = $this->
month + 1;
388 if ($this->nextMonth > 12)
391 $this->nextMonth = 1;
395 $this->endStr = sprintf(
"%d-%02d-01", $this->nextYear, $this->nextMonth);
407 <script type=
"text/javascript" src=
"/components/calendar/js/calendar.js"></script>
415 <div
id=
"minicalendar">
418 <td
colspan=
"7" class=
"month"><a
class=
"calendar_nav" href=
"<?echo $this->prevLink?>"><</a>&
nbsp; <?echo date(
"F Y", $this->start)?>&
nbsp; <a
class=
"calendar_nav" href=
"<?echo $this->nextLink?>">></a> </td>
421 <th
width=
"14%">Su</th>
422 <th
width=
"14%">Mo</th>
423 <th
width=
"14%">Tu</th>
424 <th
width=
"14%">We</th>
425 <th
width=
"14%">Th</th>
426 <th
width=
"14%">Fr</th>
427 <th
width=
"14%">Sa</th>
431 for(
$c = 0;
$c < $this->dayOfWeek; ++
$c)
433 ?><td
class=
"empty">&
nbsp;</td><?
438 for($i = 1; $i <= $this->daysInMonth; ++$i)
441 $currentDay = sprintf(
"%d-%02d-%02d", $this->
year, $this->
month, $i);
442 $eventsToday = $this->
filterEvents($this->events, $currentDay);
444 if (count($eventsToday) > 0)
448 $eventBubbleID =
"event_bubble_".str_replace(
"-",
"_", $currentDay);
449 $dayTitle = date(
"F jS Y", strtotime($currentDay));
454 "<div id='$eventBubbleID' class='event_bubble'>
455 <div class='event_bubble_content'>
456 <h4>{$dayTitle}</h4>";
458 foreach($eventsToday as
$event)
466 <div class='event_bubble_bottom'> </div></div>";
470 $class = ((
$c % 7) == 0 || (
$c % 7) == 6) ?
"weekend" :
"weekday";
476 <td
class=
"<?echo $class ?>" ><?echo
$link ?></td>
479 if ((
$c % 7) == 0) echo
"</tr><tr>";
485 ?><td
class=
"empty">&
nbsp;</td>
507 <div
id=
"fullcalendar">
508 <table
id=<?php echo $this->
id ?>>
510 <td
class=
"month" colspan=
"7"><?echo date(
"F Y", $this->start)?> <a
class=
"calendar_nav" href=
"<?echo $this->prevLink?>"><img src=
"/components/calendar/images/calendar_arrow_l.png" alt=
"left" width=
"22" height=
"22" border=
"0"></a> <a
class=
"calendar_nav" href=
"<?echo $this->nextLink?>"><img src=
"/components/calendar/images/calendar_arrow_r.png" alt=
"right" width=
"22" height=
"22" border=
"0"></a> </td>
513 <th
width=
"14.28%">Su</th>
514 <th
width=
"14.28%">Mo</th>
515 <th
width=
"14.28%">Tu</th>
516 <th
width=
"14.28%">We</th>
517 <th
width=
"14.28%">Th</th>
518 <th
width=
"14.28%">Fr</th>
519 <th
width=
"14.28%">Sa</th>
523 for(
$c = 0;
$c < $this->dayOfWeek; ++
$c)
525 ?><td
class=
"empty">&
nbsp;</td><?
530 for($i = 1; $i <= $this->daysInMonth; ++$i)
533 $currentDay = sprintf(
"%d-%02d-%02d", $this->
year, $this->
month, $i);
534 $eventsToday = $this->
filterEvents($this->events, $currentDay);
537 if (count($eventsToday) > 0)
540 foreach($eventsToday as
$event)
550 $class = ((
$c % 7) == 0 || (
$c % 7) == 6) ?
"weekend" :
"weekday";
556 <td
class=
"<?echo $class ?>" data-day=
"<?php echo $i ?>"><?echo
$link ?><? echo
$content?></td>
559 if ((
$c % 7) == 0) echo
"</tr><tr>";
565 ?><td
class=
"empty">&
nbsp;</td>
578 if(!count($this->tagRowCallbacks) || !$this->maxEventsPerDay)
return;
581 if($this->maxEventsPerDay)
583 $options =
"{per_day: {$this->maxEventsPerDay}}";
588 <script type=
"text/javascript" src=
"/components/calendar/js/filtering_calendar.js"></script>
589 <script type=
"text/javascript">
590 window.addEvent(
'domready',
function()
592 var <?echo $this->
id?> =
new FilteringCalendar(
'<?echo $this->id ?>', <?php echo
$options ?>);
604 $altTitle = ($alt == event_display) ?
"List of Events" :
"Calendar";
606 <table
style=
'width: 100%' class=
"layout">
608 <td><p><a href=
"<? echo $link ?>">View <? echo $altTitle ?></a></p></td>
610 <form method=
"get" action=
"">
612 $calendar_id = htmlSafe(checkNumeric($_GET[
"calendar_id"]));
615 echo
"<input id='calendar_id' type='hidden' name='calendar_id' value='$calendar_id'/>\n";
618 <select name=
"month">
620 for($i = 1; $i <= 12; ++$i)
622 $monthName = date(
"F", strtotime(
"$i/1/2007"));
623 option($i, $monthName, $i == $this->
month);
626 </select>&
nbsp;<select name=
"year">
628 $endYear = date(
"Y") + 2;
629 for($i = 2006; $i <= $endYear; ++$i)
631 option($i, $i, (
int)$this->
year);
635 <input type=
"submit" class=
"button" value=
" GO "/>
651 $link .= (preg_match(
"/\?/",
$link)) ?
"&" :
"?";
652 $link .=
"date=$currentDay";
659 if(preg_match(
"/[\(.*?\)]$/", $dLink))
660 $dLink = preg_replace(
"/[\(.*?\)]$/",
", '$currentDay')", $dLink);
662 $dLink .=
"('$currentDay')";
663 $onclick =
"onclick=\"$dLink; return false;\"";
666 return "<a class='eventlink' href=\"{$link}\" $onclick;
667 onmouseover='showEventBubble(\"$eventBubbleID\", this);' onmouseout='hideEventBubble(\"$eventBubbleID\");'>{$idx}</a>";
677 $this->
header(calendar_display);
679 if (count($this->events) > 0)
681 foreach($this->events as
$event)
692 <p><i>No events have been scheduled
for this month.</i></p>
$id
The HTML tag id for the calendar view.
CalendarView($events, $id=null)
$maxEventsPerDay
The maximum number of events to display per day on monthly view.
formatEventListLink($link, $dLink, $currentDay, $eventBubbleID, $idx)
rewriteQueryString($year, $month)
$tagRowCallbacks
Array of callbacks for adding extra attributes to each row.
details($event, $param=null)
addFacetTaggingHandler($handler)
Adds a row tagging handler.
header($alt=event_display)
filterEvents($events, $currentDay)
addHandler($class, $handler)
static fireEvent($event, $parameter=null, $mustBeConsumed=false)
Fire an event to all subscribers as detailed in their manifests.
formatFilteringTags($event, $tagRowCallbacks)
formatiCalendar($event)
format an event for sending through email as iCal event.
formatButtons($event)
Called by function details.
formatSummary($event, $tagRowCallbacks)
FakoliException is the base exception class for all Fakoli errors.
static using()
Import the datamodels, views and manifest for the specified component(s).
static getValue($component, $name)
Retrieve the value of the specified Setting.
formatiCalendar($event, $sequence_id=0)
filter($event, $date)
If an event spans over more than 5 days, only show it on the first day.
formatSummary($event, $tagRowCallacks)
formatFilteringTags($event, $tagRowCallbacks)
details($event, $byProgram=false)
Note: we may wish to add someting like this to description:
if(!checkRole("admin")) $c
if(count($sites) > 1) $calendarSelect
if(array_key_exists("HTTP_IF_MODIFIED_SINCE", $_SERVER)) $content