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

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

Fixed: Missing information "recent" in URL filter start parameter

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.0 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-2007 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | branch        : BSF (Best So Far)
8// | file          : $Id: menubar.inc.php 1723 2007-01-15 22:28:15Z rub $
9// | last update   : $Date: 2007-01-15 22:28:15 +0000 (Mon, 15 Jan 2007) $
10// | last modifier : $Author: rub $
11// | revision      : $Revision: 1723 $
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 (!empty($conf['filter_pages']) and get_filter_page_value('used'))
69{
70  if ($filter['enabled'])
71  {
72    $template->assign_block_vars(
73      'stop_filter',
74      array(
75        'URL' => add_url_params(make_index_url(array()), array('filter' => 'stop'))
76        )
77      );
78  }
79  else
80  {
81    $template->assign_block_vars(
82      'start_filter',
83      array(
84        'URL' => add_url_params(make_index_url(array()), array('filter' => 'start-recent-'.$user['recent_period']))
85        )
86      );
87  }
88}
89
90//------------------------------------------------------------------------ tags
91if ('tags' == $page['section'])
92{
93  // display tags associated to currently tagged items, less current tags
94  $tags = array();
95  if ( !empty($page['items']) )
96  {
97    $tags = get_common_tags($page['items'],
98        $conf['menubar_tag_cloud_items_number'], $page['tag_ids']);
99  }
100
101  $tags = add_level_to_tags($tags);
102
103  foreach ($tags as $tag)
104  {
105    $template->assign_block_vars(
106      'tags.tag',
107      array(
108        'URL' => make_index_url(
109          array(
110            'tags' => array(
111              array(
112                'id' => $tag['tag_id'],
113                'url_name' => $tag['url_name'],
114                ),
115              )
116            )
117          ),
118
119        'NAME' => $tag['name'],
120
121        'TITLE' => l10n('See pictures linked to this tag only'),
122
123        'CLASS' => 'tagLevel'.$tag['level']
124        )
125      );
126
127    $template->assign_block_vars(
128      'tags.tag.add',
129      array(
130        'URL' => make_index_url(
131          array(
132            'tags' => array_merge(
133              $page['tags'],
134              array(
135                array(
136                  'id' => $tag['tag_id'],
137                  'url_name' => $tag['url_name'],
138                  ),
139                )
140              )
141            )
142          ),
143        'TITLE' => sprintf(
144          l10n('%d pictures are also linked to current tags'),
145          $tag['counter']
146          ),
147        )
148      );
149
150  }
151}
152//---------------------------------------------------------- special categories
153// favorites categories
154if ( !$user['is_the_guest'] )
155{
156  $template->assign_block_vars('username', array());
157
158  $template->assign_block_vars(
159    'special_cat',
160    array(
161      'URL' => make_index_url(array('section' => 'favorites')),
162      'TITLE' => $lang['favorite_cat_hint'],
163      'NAME' => $lang['favorite_cat']
164      ));
165}
166// most visited
167$template->assign_block_vars(
168  'special_cat',
169  array(
170    'URL' => make_index_url(array('section' => 'most_visited')),
171    'TITLE' => $lang['most_visited_cat_hint'],
172    'NAME' => $lang['most_visited_cat']
173    ));
174// best rated
175if ($conf['rate'])
176{
177  $template->assign_block_vars(
178    'special_cat',
179    array(
180      'URL' => make_index_url(array('section' => 'best_rated')),
181      'TITLE' => $lang['best_rated_cat_hint'],
182      'NAME' => $lang['best_rated_cat']
183      )
184    );
185}
186// random
187$template->assign_block_vars(
188  'special_cat',
189  array(
190    'URL' => get_root_url().'random.php',
191    'TITLE' => $lang['random_cat_hint'],
192    'NAME' => $lang['random_cat'],
193    'REL'=> 'rel="nofollow"'
194    ));
195
196// recent pics
197$template->assign_block_vars(
198  'special_cat',
199  array(
200    'URL' => make_index_url(array('section' => 'recent_pics')),
201    'TITLE' => $lang['recent_pics_cat_hint'],
202    'NAME' => $lang['recent_pics_cat'],
203    ));
204// recent cats
205$template->assign_block_vars(
206  'special_cat',
207  array(
208    'URL' => make_index_url(array('section' => 'recent_cats')),
209    'TITLE' => $lang['recent_cats_cat_hint'],
210    'NAME' => $lang['recent_cats_cat'],
211    ));
212
213// calendar
214$template->assign_block_vars(
215  'special_cat',
216  array(
217    'URL' =>
218      make_index_url(
219        array(
220          'chronology_field' => ($conf['calendar_datefield']=='date_available'
221                                  ? 'posted' : 'created'),
222           'chronology_style'=> 'monthly',
223           'chronology_view' => 'calendar'
224        )
225      ),
226    'TITLE' => $lang['calendar_hint'],
227    'NAME' => $lang['calendar'],
228    'REL'=> 'rel="nofollow"'
229    )
230  );
231//--------------------------------------------------------------------- summary
232
233if ($user['is_the_guest'])
234{
235  $template->assign_block_vars('login', array());
236
237  $template->assign_block_vars('quickconnect', array());
238  if ($conf['authorize_remembering'])
239  {
240    $template->assign_block_vars('quickconnect.remember_me', array());
241  }
242  if ($conf['allow_user_registration'])
243  {
244    $template->assign_block_vars('register', array());
245    $template->assign_block_vars('quickconnect.register', array());
246  }
247}
248else
249{
250  $template->assign_block_vars('hello', array());
251
252  if (is_autorize_status(ACCESS_CLASSIC))
253  {
254    $template->assign_block_vars('profile', array());
255  }
256
257  // the logout link has no meaning with Apache authentication : it is not
258  // possible to logout with this kind of authentication.
259  if (!$conf['apache_authentication'])
260  {
261    $template->assign_block_vars('logout', array());
262  }
263
264  if (is_admin())
265  {
266    $template->assign_block_vars('admin', array());
267  }
268}
269
270// tags link
271$template->assign_block_vars(
272  'summary',
273  array(
274    'TITLE' => l10n('See available tags'),
275    'NAME' => l10n('Tags'),
276    'U_SUMMARY'=> get_root_url().'tags.php',
277    )
278  );
279
280// search link
281$template->assign_block_vars(
282  'summary',
283  array(
284    'TITLE'=>$lang['hint_search'],
285    'NAME'=>$lang['search'],
286    'U_SUMMARY'=> get_root_url().'search.php',
287    'REL'=> 'rel="search"'
288    )
289  );
290$template->assign_block_vars( 'summary.quick_search',  array() );
291
292// comments link
293$template->assign_block_vars(
294  'summary',
295  array(
296    'TITLE'=>$lang['hint_comments'],
297    'NAME'=>$lang['comments'],
298    'U_SUMMARY'=> get_root_url().'comments.php',
299    )
300  );
301
302// about link
303$template->assign_block_vars(
304  'summary',
305  array(
306    'TITLE'     => $lang['about_page_title'],
307    'NAME'      => $lang['About'],
308    'U_SUMMARY' => get_root_url().'about.php',
309    )
310  );
311
312// notification
313$template->assign_block_vars(
314  'summary',
315  array(
316    'TITLE'=>l10n('RSS feed'),
317    'NAME'=>l10n('Notification'),
318    'U_SUMMARY'=> get_root_url().'notification.php',
319    'REL'=> 'rel="nofollow"'
320    )
321  );
322
323if (isset($page['category']) and $page['cat_uploadable'] )
324{ // upload a picture in the category
325  $url = get_root_url().'upload.php?cat='.$page['category'];
326  $template->assign_block_vars(
327    'upload',
328    array(
329      'U_UPLOAD'=> $url
330      )
331    );
332}
333
334trigger_action('loc_end_menubar');
335$template->assign_var_from_handle('MENUBAR', 'menubar');
336?>
Note: See TracBrowser for help on using the repository browser.