1
0

Limit year list to choices that are valid for the selected user.

This commit is contained in:
rWatcher 2012-06-13 19:17:51 -04:00
parent 26cd108cb7
commit 5ea05a4423
2 changed files with 27 additions and 13 deletions

View File

@ -234,16 +234,31 @@ class CalendarView_Controller extends Controller {
// Generate a list of years, starting with the year the earliest photo was
// taken, and ending with the year of the most recent photo.
$valid_years = Array();
$all_photos = ORM::factory("item")
->viewable()
->where("type", "!=", "album")
->where("captured", "!=", "")
->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++;
if ($display_user == -1) {
$all_photos = ORM::factory("item")
->viewable()
->where("type", "!=", "album")
->where("captured", "!=", "")
->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++;
}
} 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.

View File

@ -18,9 +18,8 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class calendarview_theme_Core {
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");
}
}