diff options
author | rvelices <rv-github@modusoptimus.com> | 2008-03-01 13:12:07 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2008-03-01 13:12:07 +0000 |
commit | 35076ee1b9e32618d3c92bdd8aee20f2c4abb694 (patch) | |
tree | 7a7ece7dcc77d5304366ea3bd456152a1285522e /include/calendar_base.class.php | |
parent | b2b00ba7be2d8b80cfa30aca624706162dcb7800 (diff) |
- index.tpl, menubar.tpl, mainpage_categories.tpl and month_calendar.tpl go smarty
- better template debugging tweak (the smarty console is shown only once at the end)
git-svn-id: http://piwigo.org/svn/trunk@2231 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/calendar_base.class.php | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/include/calendar_base.class.php b/include/calendar_base.class.php index 67282190c..aff910253 100644 --- a/include/calendar_base.class.php +++ b/include/calendar_base.class.php @@ -1,7 +1,7 @@ <?php // +-----------------------------------------------------------------------+ // | PhpWebGallery - a PHP based picture gallery | -// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | +// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net | // +-----------------------------------------------------------------------+ // | file : $Id$ // | last update : $Date$ @@ -35,8 +35,6 @@ class CalendarBase // var $calendar_levels; - var $has_nav_bar; - /** * Initialize the calendar * @param string inner_sql used for queries (INNER JOIN or normal) @@ -53,7 +51,6 @@ class CalendarBase $this->date_field = 'date_creation'; } $this->inner_sql = $inner_sql; - $this->has_nav_bar = false; } function get_display_name() @@ -262,13 +259,12 @@ SELECT DISTINCT('.$this->calendar_levels[$level]['sql'] isset($labels) ? $labels : $this->calendar_levels[$level]['labels'] ); - $template->assign_block_vars( - 'calendar.navbar', + $template->append( + 'chronology_navigation_bars', array( - 'BAR' => $nav_bar, + 'CONTENT' => $nav_bar, ) ); - $this->has_nav_bar = true; } /** @@ -311,40 +307,47 @@ GROUP BY period'; } $current_rank = $upper_items_rank[$current]; - if (!$this->has_nav_bar and - ($current_rank>0 or $current_rank < count($upper_items)-1 ) ) - { - $template->assign_block_vars( 'calendar.navbar', array() ); - } - + $tpl_var = array(); + if ( $current_rank>0 ) { // has previous $prev = $upper_items[$current_rank-1]; $chronology_date = explode('-', $prev); - $template->assign_block_vars( - 'calendar.navbar.prev', + $tpl_var['previous'] = array( 'LABEL' => $this->get_date_nice_name($prev), 'URL' => duplicate_index_url( array('chronology_date'=>$chronology_date), array('start') ) - ) ); } + if ( $current_rank < count($upper_items)-1 ) { // has next $next = $upper_items[$current_rank+1]; $chronology_date = explode('-', $next); - $template->assign_block_vars( - 'calendar.navbar.next', + $tpl_var['next'] = array( 'LABEL' => $this->get_date_nice_name($next), 'URL' => duplicate_index_url( array('chronology_date'=>$chronology_date), array('start') ) - ) ); } + + if ( !empty($tpl_var) ) + { + $existing = & $template->get_template_vars('chronology_navigation_bars'); + if ( !empty($existing) ) + { + $existing[ sizeof($existing)-1 ] = + array_merge( $existing[ sizeof($existing)-1 ], $tpl_var); + } + else + { + $template->append( 'chronology_navigation_bars', $tpl_var ); + } + } } } ?> |