source: trunk/include/menubar.inc.php @ 1677

Last change on this file since 1677 was 1677, checked in by rub, 17 years ago

Feature Issue ID 0000601: Filter all public pages with only recent elements

It's a finalized version.
Obsolete code of draft are removed.

You can filter categories and images with recent date period on your screen selection.
In the future, filter could be easy done on other type data (plugin?)

You can flat categories and sub-categories with a recent date period of your choice.

Next, perhaps, a panel to choice recent date for the 2 features.

On draft, there have problem with MySql 5, be careful!

Css problem not resolved:

  • Menu "Categories" is bad centered
  • Icon on dark too on the top
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 8.8 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
5// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | branch        : BSF (Best So Far)
8// | file          : $Id: menubar.inc.php 1677 2006-12-21 21:38:20Z rub $
9// | last update   : $Date: 2006-12-21 21:38:20 +0000 (Thu, 21 Dec 2006) $
10// | last modifier : $Author: rub $
11// | revision      : $Revision: 1677 $
12// +-----------------------------------------------------------------------+
13// | This program is free software; you can redistribute it and/or modify  |
14// | it under the terms of the GNU General Public License as published by  |
15// | the Free Software Foundation                                          |
16// |                                                                       |
17// | This program is distributed in the hope that it will be useful, but   |
18// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
19// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
20// | General Public License for more details.                              |
21// |                                                                       |
22// | You should have received a copy of the GNU General Public License     |
23// | along with this program; if not, write to the Free Software           |
24// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
25// | USA.                                                                  |
26// +-----------------------------------------------------------------------+
27
28/**
29 * This file is included by the main page to show the menu bar
30 *
31 */
32$template->set_filenames(
33  array(
34    'menubar' => 'menubar.tpl',
35    )
36  );
37
38trigger_action('loc_begin_menubar');
39
40$template->assign_vars(
41  array(
42    'NB_PICTURE' => $user['nb_total_images'],
43    'USERNAME' => $user['username'],
44    'MENU_CATEGORIES_CONTENT' => get_categories_menu(),
45    'F_IDENTIFY' => get_root_url().'identification.php',
46    'U_HOME' => make_index_url(),
47    'U_REGISTER' => get_root_url().'register.php',
48    'U_LOST_PASSWORD' => get_root_url().'password.php',
49    'U_LOGOUT' => get_root_url().'?act=logout',
50    'U_ADMIN'=> get_root_url().'admin.php',
51    'U_PROFILE'=> get_root_url().'profile.php',
52    )
53  );
54
55//-------------------------------------------------------------- external links
56foreach ($conf['links'] as $url => $label)
57{
58  $template->assign_block_vars(
59    'links.link',
60    array(
61      'URL' => $url,
62      'LABEL' => $label
63      )
64    );
65}
66
67//------------------------------------------------------------------------ filter
68if ($filter['enabled'])
69{
70  $template->assign_block_vars(
71    'stop_filter',
72    array(
73      'URL' => add_url_params(make_index_url(array()), array('filter' => 'stop'))
74      )
75    );
76}
77else
78{
79  $template->assign_block_vars(
80    'start_filter',
81    array(
82      'URL' => add_url_params(make_index_url(array()), array('filter' => 'start'))
83      )
84    );
85}
86
87
88//------------------------------------------------------------------------ tags
89if ('tags' == $page['section'])
90{
91  // display tags associated to currently tagged items, less current tags
92  $tags = array();
93  if ( !empty($page['items']) )
94  {
95    $tags = get_common_tags($page['items'],
96        $conf['menubar_tag_cloud_items_number'], $page['tag_ids']);
97  }
98
99  $tags = add_level_to_tags($tags);
100
101  foreach ($tags as $tag)
102  {
103    $template->assign_block_vars(
104      'tags.tag',
105      array(
106        'URL' => make_index_url(
107          array(
108            'tags' => array(
109              array(
110                'id' => $tag['tag_id'],
111                'url_name' => $tag['url_name'],
112                ),
113              )
114            )
115          ),
116
117        'NAME' => $tag['name'],
118
119        'TITLE' => l10n('See pictures linked to this tag only'),
120
121        'CLASS' => 'tagLevel'.$tag['level']
122        )
123      );
124
125    $template->assign_block_vars(
126      'tags.tag.add',
127      array(
128        'URL' => make_index_url(
129          array(
130            'tags' => array_merge(
131              $page['tags'],
132              array(
133                array(
134                  'id' => $tag['tag_id'],
135                  'url_name' => $tag['url_name'],
136                  ),
137                )
138              )
139            )
140          ),
141        'TITLE' => sprintf(
142          l10n('%d pictures are also linked to current tags'),
143          $tag['counter']
144          ),
145        )
146      );
147
148  }
149}
150//---------------------------------------------------------- special categories
151// favorites categories
152if ( !$user['is_the_guest'] )
153{
154  $template->assign_block_vars('username', array());
155
156  $template->assign_block_vars(
157    'special_cat',
158    array(
159      'URL' => make_index_url(array('section' => 'favorites')),
160      'TITLE' => $lang['favorite_cat_hint'],
161      'NAME' => $lang['favorite_cat']
162      ));
163}
164// most visited
165$template->assign_block_vars(
166  'special_cat',
167  array(
168    'URL' => make_index_url(array('section' => 'most_visited')),
169    'TITLE' => $lang['most_visited_cat_hint'],
170    'NAME' => $lang['most_visited_cat']
171    ));
172// best rated
173if ($conf['rate'])
174{
175  $template->assign_block_vars(
176    'special_cat',
177    array(
178      'URL' => make_index_url(array('section' => 'best_rated')),
179      'TITLE' => $lang['best_rated_cat_hint'],
180      'NAME' => $lang['best_rated_cat']
181      )
182    );
183}
184// random
185$template->assign_block_vars(
186  'special_cat',
187  array(
188    'URL' => get_root_url().'random.php',
189    'TITLE' => $lang['random_cat_hint'],
190    'NAME' => $lang['random_cat']
191    ));
192
193// recent pics
194$template->assign_block_vars(
195  'special_cat',
196  array(
197    'URL' => make_index_url(array('section' => 'recent_pics')),
198    'TITLE' => $lang['recent_pics_cat_hint'],
199    'NAME' => $lang['recent_pics_cat']
200    ));
201// recent cats
202$template->assign_block_vars(
203  'special_cat',
204  array(
205    'URL' => make_index_url(array('section' => 'recent_cats')),
206    'TITLE' => $lang['recent_cats_cat_hint'],
207    'NAME' => $lang['recent_cats_cat']
208    ));
209
210// calendar
211$template->assign_block_vars(
212  'special_cat',
213  array(
214    'URL' =>
215      make_index_url(
216        array(
217          'chronology_field' => ($conf['calendar_datefield']=='date_available'
218                                  ? 'posted' : 'created'),
219           'chronology_style'=> 'monthly',
220           'chronology_view' => 'calendar'
221        )
222      ),
223    'TITLE' => $lang['calendar_hint'],
224    'NAME' => $lang['calendar']
225    )
226  );
227//--------------------------------------------------------------------- summary
228
229if ($user['is_the_guest'])
230{
231  $template->assign_block_vars('login', array());
232
233  $template->assign_block_vars('quickconnect', array());
234  if ($conf['authorize_remembering'])
235  {
236    $template->assign_block_vars('quickconnect.remember_me', array());
237  }
238  if ($conf['allow_user_registration'])
239  {
240    $template->assign_block_vars('register', array());
241    $template->assign_block_vars('quickconnect.register', array());
242  }
243}
244else
245{
246  $template->assign_block_vars('hello', array());
247
248  if (is_autorize_status(ACCESS_CLASSIC))
249  {
250    $template->assign_block_vars('profile', array());
251  }
252
253  // the logout link has no meaning with Apache authentication : it is not
254  // possible to logout with this kind of authentication.
255  if (!$conf['apache_authentication'])
256  {
257    $template->assign_block_vars('logout', array());
258  }
259
260  if (is_admin())
261  {
262    $template->assign_block_vars('admin', array());
263  }
264}
265
266// tags link
267$template->assign_block_vars(
268  'summary',
269  array(
270    'TITLE' => l10n('See available tags'),
271    'NAME' => l10n('Tags'),
272    'U_SUMMARY'=> get_root_url().'tags.php',
273    )
274  );
275
276// search link
277$template->assign_block_vars(
278  'summary',
279  array(
280    'TITLE'=>$lang['hint_search'],
281    'NAME'=>$lang['search'],
282    'U_SUMMARY'=> get_root_url().'search.php',
283    'REL'=> 'rel="search"'
284    )
285  );
286$template->assign_block_vars( 'summary.quick_search',  array() );
287
288// comments link
289$template->assign_block_vars(
290  'summary',
291  array(
292    'TITLE'=>$lang['hint_comments'],
293    'NAME'=>$lang['comments'],
294    'U_SUMMARY'=> get_root_url().'comments.php',
295    )
296  );
297
298// about link
299$template->assign_block_vars(
300  'summary',
301  array(
302    'TITLE'     => $lang['about_page_title'],
303    'NAME'      => $lang['About'],
304    'U_SUMMARY' => get_root_url().'about.php',
305    )
306  );
307
308// notification
309$template->assign_block_vars(
310  'summary',
311  array(
312    'TITLE'=>l10n('RSS feed'),
313    'NAME'=>l10n('Notification'),
314    'U_SUMMARY'=> get_root_url().'notification.php',
315    'REL'=> 'rel="nofollow"'
316    )
317  );
318
319if (isset($page['category']) and $page['cat_uploadable'] )
320{ // upload a picture in the category
321  $url = get_root_url().'upload.php?cat='.$page['category'];
322  $template->assign_block_vars(
323    'upload',
324    array(
325      'U_UPLOAD'=> $url
326      )
327    );
328}
329
330trigger_action('loc_end_menubar');
331$template->assign_var_from_handle('MENUBAR', 'menubar');
332?>
Note: See TracBrowser for help on using the repository browser.