1
0

Remove the breadcrumb code that was crashing the month and day views, link the month view onto the main calendar view page.

This commit is contained in:
rWatcher 2010-02-07 23:48:23 -05:00
parent ce31263a51
commit 7b0df0982f
3 changed files with 13 additions and 9 deletions

View File

@ -103,14 +103,14 @@ class CalendarView_Controller extends Controller {
->order_by("captured", "ASC")
->find_all($page_size, $offset));
}
/*
// Set up breadcrumbs
$calendar_breadcrumbs[0] = new Calendar_Breadcrumb($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user));
$calendar_breadcrumbs[1] = new Calendar_Breadcrumb(t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))), url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month));
$fake_item = new Calendar_Breadcrumb($display_day, "");
$template->set_global("item", $fake_item);
$template->set_global("parents", $calendar_breadcrumbs);
*/
// Finish setting up and then display the page.
$template->set_global("children_count", $day_count);
$template->content = new View("dynamic.html");
@ -179,13 +179,13 @@ class CalendarView_Controller extends Controller {
->order_by("captured", "ASC")
->find_all($page_size, $offset));
}
/*
// Set up breadcrumbs for this page.
$calendar_breadcrumbs[0] = new Calendar_Breadcrumb($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user));
$fake_item = new Calendar_Breadcrumb(t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))), "");
$template->set_global("item", $fake_item);
$template->set_global("parents", $calendar_breadcrumbs);
*/
// Finish setting up and then display the page.
$template->set_global("children_count", $day_count);
$template->content = new View("dynamic.html");

View File

@ -4,6 +4,7 @@ class PHPCalendar_Core {
// Month and year to use for calendaring
protected $month;
protected $year;
protected $month_url;
// First Day of the Week (0 = Sunday, 1 = Monday, etc.).
protected $week_start = 1;
@ -11,7 +12,7 @@ class PHPCalendar_Core {
// Events for the current month.
protected $event_data = Array();
public function __construct($month = NULL, $year = NULL)
public function __construct($month = NULL, $year = NULL, $url = NULL)
{
empty($month) and $month = date('n'); // Current month
empty($year) and $year = date('Y'); // Current year
@ -19,6 +20,7 @@ class PHPCalendar_Core {
// Set the month and year
$this->month = (int) $month;
$this->year = (int) $year;
$this->month_url = $url;
}
@ -28,7 +30,7 @@ class PHPCalendar_Core {
public function render()
{
return $this->generate_calendar($this->year, $this->month, $this->event_data, 2, NULL, $this->week_start, NULL);
return $this->generate_calendar($this->year, $this->month, $this->event_data, 2, $this->month_url, $this->week_start, NULL);
}
# PHP Calendar (version 2.3), written by Keith Devens

View File

@ -9,8 +9,9 @@
// Loop through January to November in the current year.
while ($counter_months <12) {
print "<td>";
$calendar = new PHPCalendar($counter_months, $calendar_year);
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
// Figure out if any photos were taken for the current month.
if ($calendar_user == "-1") {
@ -108,7 +109,8 @@
// Do December seperately, because the mktime code is different.
print "<td>";
$calendar = new PHPCalendar($counter_months, $calendar_year);
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
if ($calendar_user == "-1") {
$month_count = ORM::factory("item")
->viewable()