Navigation Menu

Skip to content

Commit

Permalink
Remove the breadcrumb code that was crashing the month and day views,…
Browse files Browse the repository at this point in the history
… link the month view onto the main calendar view page.
  • Loading branch information
rWatcher committed Feb 8, 2010
1 parent ce31263 commit 7b0df09
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
8 changes: 4 additions & 4 deletions modules/calendarview/controllers/calendarview.php
Expand Up @@ -103,14 +103,14 @@ public function day($display_year, $display_user, $display_month, $display_day)
->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");
Expand Down Expand Up @@ -179,13 +179,13 @@ public function month($display_year, $display_user, $display_month) {
->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");
Expand Down
6 changes: 4 additions & 2 deletions modules/calendarview/libraries/PHPCalendar.php
Expand Up @@ -4,21 +4,23 @@ 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;

// 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

// Set the month and year
$this->month = (int) $month;
$this->year = (int) $year;
$this->month_url = $url;

}

Expand All @@ -28,7 +30,7 @@ public function event($day_of_the_week, $event_url = NULL, $css_id = NULL, $cust

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
Expand Down
8 changes: 5 additions & 3 deletions modules/calendarview/views/calendarview_year.html.php
Expand Up @@ -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") {
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 7b0df09

Please sign in to comment.