Limit year list to choices that are valid for the selected user.
This commit is contained in:
parent
26cd108cb7
commit
5ea05a4423
@ -234,16 +234,31 @@ class CalendarView_Controller extends Controller {
|
|||||||
// Generate a list of years, starting with the year the earliest photo was
|
// Generate a list of years, starting with the year the earliest photo was
|
||||||
// taken, and ending with the year of the most recent photo.
|
// taken, and ending with the year of the most recent photo.
|
||||||
$valid_years = Array();
|
$valid_years = Array();
|
||||||
$all_photos = ORM::factory("item")
|
if ($display_user == -1) {
|
||||||
->viewable()
|
$all_photos = ORM::factory("item")
|
||||||
->where("type", "!=", "album")
|
->viewable()
|
||||||
->where("captured", "!=", "")
|
->where("type", "!=", "album")
|
||||||
->order_by("captured", "DESC")
|
->where("captured", "!=", "")
|
||||||
->find_all();
|
->order_by("captured", "DESC")
|
||||||
$counter = date('Y', $all_photos[count($all_photos)-1]->captured);
|
->find_all();
|
||||||
while ($counter <= date('Y', $all_photos[0]->captured)) {
|
$counter = date('Y', $all_photos[count($all_photos)-1]->captured);
|
||||||
$valid_years[$counter] = $counter;
|
while ($counter <= date('Y', $all_photos[0]->captured)) {
|
||||||
$counter++;
|
$valid_years[$counter] = $counter;
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$all_photos = ORM::factory("item")
|
||||||
|
->viewable()
|
||||||
|
->where("type", "!=", "album")
|
||||||
|
->where("captured", "!=", "")
|
||||||
|
->where("owner_id", "=", $display_user)
|
||||||
|
->order_by("captured", "DESC")
|
||||||
|
->find_all();
|
||||||
|
$counter = date('Y', $all_photos[count($all_photos)-1]->captured);
|
||||||
|
while ($counter <= date('Y', $all_photos[0]->captured)) {
|
||||||
|
$valid_years[$counter] = $counter;
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the form.
|
// Create the form.
|
||||||
|
@ -18,9 +18,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class calendarview_theme_Core {
|
class calendarview_theme_Core {
|
||||||
|
|
||||||
static function head($theme) {
|
static function head($theme) {
|
||||||
$theme->css("calendarview_menu.css");
|
return $theme->css("calendarview_calendar.css") .
|
||||||
return $theme->css("calendarview_calendar.css");
|
$theme->css("calendarview_menu.css");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user