Example #1
0
<?php

use_helper('I18N', 'jQuery', 'Date');
?>

<?php 
$culture = $settings['culture'];
$today = date('Y-m-d');
$page_slug = $slot->getPage()->getSlug();
$page_date = is_numeric(str_replace('-', '', substr($page_slug, 0, 10))) ? substr($page_slug, 0, 10) : $today;
$dt = new sfPlopDate($page_date);
$c = new sfEventCalendar('month', $page_date);
$current_month = explode('-', $dt->dump());
$prev_month = substr($dt->reset()->subtractMonth()->dump(), 0, 10);
$next_month = substr($dt->reset()->addMonth()->dump(), 0, 10);
$page_month = explode('-', $page_date);
// search for events
$events = sfPlopTools::getCalendarPages($culture);
if ($events) {
    foreach ($events as $calendar_event) {
        if ($calendar_event->getIsPublished()) {
            $c->addEvent(substr($calendar_event->getSlug(), 0, 10), array('title' => $calendar_event->getTitle($culture), 'url' => sfPlopTools::urlForPage($calendar_event->getSlug(), '', $culture)));
        }
    }
}
$calendar = $c->getEventCalendar();
?>

<table class="calendar_table">
    <tr>
      <th class="th"><?php 
Example #2
0
<?php

use_helper('Date', 'Number', 'I18N', 'Form', 'Javascript', 'Star', 'Global', 'sfFileGallery');
?>

<?php 
echo nav_tabs('project', $tab, $project);
?>

  <?php 
// Initialize the event calendar with two parameters
// 1.) The style of the calendar (day, week, month, year)
// 2.) Any date within the specified time period. The script will automatically determine the best calendar days to return.
//     For example, if you choose "month" and pass 1/15/2006, the calendar will return all dates and events from 01/01/2006 - 01/31/2006.
//     If you choose "week" and pass 1/18/2006, the calender will return all dates and events from 01/16/2006 - 01/22/2006.
$c = new sfEventCalendar('month', date('Y-m-d'));
// The style of the calendar, any date within the specified time period
// Add an event to the calendar
// You must enter a date for the calendar event.
// You can enter as many options as you'd like that best fit your circumstances.
// For example, i've passed a title, and url to the calendar.
// You can pass these, or any number of parameters you'd like to associate with the event
foreach ($project->getTasks() as $task) {
    $c->addEvent(format_date($task->getFinish()), array('title' => $task->getName(), 'url' => '@show_task?project=' . $project->getSlug() . '&task=' . $task->getUuid(), 'alt' => 'Task deadline approaching: "' . strip_tags($task->getDescription()) . '"'));
}
// Return an array of calendar dates with the events attached to them.
// You can use this array to formulate a calendar in any way you'd like.
// The array automatically breaks years into months and months into weeks, etc...
$calendar = $c->getEventCalendar();
?>