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

Last change on this file since 1815 was 1815, checked in by rvelices, 17 years ago

tags returned by get_all_tags, get_available_tags contain id key instead of tag_id
(as expected by make_index_url, as $pagetags was and as the database model is)

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