Merge branch 'master' of git://github.com/rWatcher/gallery3-contrib
Conflicts: modules/calendarview/controllers/calendarview.php modules/calendarview/libraries/Calendar_Breadcrumb.php modules/calendarview/views/kohana_calendar.php
This commit is contained in:
commit
55f806b754
@ -84,10 +84,6 @@ class CalendarView_Controller extends Controller {
|
||||
$template->set_global("page_size", $page_size);
|
||||
$template->page_title = t("Gallery :: Calendar");
|
||||
|
||||
$template->set_global("first_visible_position", $offset+1);
|
||||
$template->set_global("last_visible_position", $offset+$page_size);
|
||||
// $template->set_global("total", $day_count);
|
||||
|
||||
// Figure out which photos go on this page.
|
||||
if ($display_user == "-1") {
|
||||
$template->set_global("children", ORM::factory("item")
|
||||
@ -108,6 +104,88 @@ class CalendarView_Controller extends Controller {
|
||||
->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");
|
||||
$template->content->title = t("Photos From ") . date("d", mktime(0, 0, 0, $display_month, $display_day, $display_year)) . " " . t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))) . " " . date("Y", mktime(0, 0, 0, $display_month, $display_day, $display_year));
|
||||
print $template;
|
||||
}
|
||||
|
||||
public function month($display_year, $display_user, $display_month) {
|
||||
// Display all images for the specified month.
|
||||
|
||||
// Figure out the total number of photos to display.
|
||||
$day_count = 0;
|
||||
if ($display_user == "-1") {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->find_all()
|
||||
->count();
|
||||
} else {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $display_user)
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->find_all()
|
||||
->count();
|
||||
}
|
||||
|
||||
// Figure out paging stuff.
|
||||
$page_size = module::get_var("gallery", "page_size", 9);
|
||||
$page = (int) $this->input->get("page", "1");
|
||||
$offset = ($page-1) * $page_size;
|
||||
$max_pages = max(ceil($day_count / $page_size), 1);
|
||||
|
||||
// Make sure that the page references a valid offset
|
||||
if (($page < 1) || ($page > $max_pages)) {
|
||||
Kohana::show_404();
|
||||
}
|
||||
|
||||
// Set up the page.
|
||||
$template = new Theme_View("page.html", "collection", "CalendarMonthView");
|
||||
$template->set_global("page", $page);
|
||||
$template->set_global("max_pages", $max_pages);
|
||||
$template->set_global("page_size", $page_size);
|
||||
$template->page_title = t("Gallery :: Calendar");
|
||||
|
||||
// Figure out which photos go on this page.
|
||||
if ($display_user == "-1") {
|
||||
$template->set_global("children", ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->orderby("captured", "ASC")
|
||||
->find_all($page_size, $offset));
|
||||
} else {
|
||||
$template->set_global("children", ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $display_user)
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->orderby("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);
|
||||
|
||||
@ -121,7 +199,7 @@ class CalendarView_Controller extends Controller {
|
||||
|
||||
|
||||
$template->content = new View("dynamic.html");
|
||||
$template->content->title = t("Photos From ") . date("d F Y", mktime(0, 0, 0, $display_month, $display_day, $display_year));
|
||||
$template->content->title = t("Photos From ") . t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))) . " " . date("Y", mktime(0, 0, 0, $display_month, 1, $display_year));
|
||||
print $template;
|
||||
}
|
||||
|
||||
|
@ -18,27 +18,23 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Calendar_Breadcrumb_Core {
|
||||
public $title = "the_title";
|
||||
// Creates a class to maintain a single breadcrumb.
|
||||
// Multiple breadcrumbs can be achieved by createing an array of this class type.
|
||||
public $title = "";
|
||||
public $id = 0;
|
||||
//public $crumb_url = "asdf";
|
||||
public $url = "asdf";
|
||||
public $crumb_parent = null;
|
||||
public $url = "";
|
||||
|
||||
public function __construct($new_title, $new_url) {
|
||||
$this->title = $new_title;
|
||||
$this->url = $new_url;
|
||||
//$this->crumb_url = $new_url;
|
||||
}
|
||||
|
||||
public function url($query=null) {
|
||||
//return $crumb_url;
|
||||
//print $this->url;
|
||||
//return "http://the.url/";
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function parent() {
|
||||
return $crumb_parent;
|
||||
return null;
|
||||
}
|
||||
|
||||
public function is_album() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
|
||||
<h1 align="center"><?=$calendar_year ?></h1>
|
||||
<h1 align="center"><?=t($calendar_year) ?></h1>
|
||||
<?= $calendar_user_year_form ?>
|
||||
|
||||
<?
|
||||
|
@ -19,12 +19,12 @@ $next = Router::$current_uri.'?'.http_build_query(array_merge($qs, array('month'
|
||||
<table class="calendar">
|
||||
<tr class="controls">
|
||||
<td class="title" colspan="7" align="center">
|
||||
<a href="<? print url::site("calendarview/month/" . $year . "/" . $calendar_user . "/" . $month ) ?>"><?php echo strftime('%B %Y', mktime(0, 0, 0, $month, 1, $year)) ?></a>
|
||||
<a href="<? print url::site("calendarview/month/" . $year . "/" . $calendar_user . "/" . $month ) ?>"><?php print t(strftime('%B', mktime(0, 0, 0, $month, 1, $year))) . " " . t(strftime('%Y', mktime(0, 0, 0, $month, 1, $year))) ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php foreach ($days as $day): ?>
|
||||
<th><?php echo $day ?></th>
|
||||
<th><?php echo t($day) ?></th>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
<?php foreach ($weeks as $week): ?>
|
||||
|
Reference in New Issue
Block a user