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

Last change on this file since 1537 was 1537, checked in by rvelices, 18 years ago

feature 519: quick search (first version)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 8.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-2006 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | branch        : BSF (Best So Far)
8// | file          : $Id: menubar.inc.php 1537 2006-08-15 02:06:06Z rvelices $
9// | last update   : $Date: 2006-08-15 02:06:06 +0000 (Tue, 15 Aug 2006) $
10// | last modifier : $Author: rvelices $
11// | revision      : $Revision: 1537 $
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
38$template->assign_vars(
39  array(
40    'NB_PICTURE' => $user['nb_total_images'],
41    'USERNAME' => $user['username'],
42    'MENU_CATEGORIES_CONTENT' => get_categories_menu(),
43    'F_IDENTIFY' => get_root_url().'identification.php',
44    'U_HOME' => make_index_url(),
45    'U_REGISTER' => get_root_url().'register.php',
46    'U_LOST_PASSWORD' => get_root_url().'password.php',
47    'U_LOGOUT' => get_root_url().'?act=logout',
48    'U_ADMIN'=> get_root_url().'admin.php',
49    'U_PROFILE'=> get_root_url().'profile.php',
50    )
51  );
52
53//-------------------------------------------------------------- external links
54if (count($conf['links']) > 0)
55{
56  $template->assign_block_vars('links', array());
57
58  foreach ($conf['links'] as $url => $label)
59  {
60    $template->assign_block_vars(
61      'links.link',
62      array(
63        'URL' => $url,
64        'LABEL' => $label
65        )
66      );
67  }
68}
69//------------------------------------------------------------------------ tags
70if ('tags' == $page['section'])
71{
72  $template->assign_block_vars('tags', array());
73
74  // display tags associated to currently tagged items, less current tags
75  $tags = array();
76
77  if ( !empty($page['items']) )
78  {
79    $tags = get_common_tags($page['items'],
80        $conf['menubar_tag_cloud_items_number'], $page['tag_ids']);
81  }
82
83  $tags = add_level_to_tags($tags);
84
85  foreach ($tags as $tag)
86  {
87    $template->assign_block_vars(
88      'tags.tag',
89      array(
90        'URL_ADD' => make_index_url(
91          array(
92            'tags' => array_merge(
93              $page['tags'],
94              array(
95                array(
96                  'id' => $tag['tag_id'],
97                  'url_name' => $tag['url_name'],
98                  ),
99                )
100              )
101            )
102          ),
103
104        'URL' => make_index_url(
105          array(
106            'tags' => array(
107              array(
108                'id' => $tag['tag_id'],
109                'url_name' => $tag['url_name'],
110                ),
111              )
112            )
113          ),
114
115        'NAME' => $tag['name'],
116
117        'TITLE' => l10n('See pictures linked to this tag only'),
118
119        'TITLE_ADD' => sprintf(
120          l10n('%d pictures are also linked to current tags'),
121          $tag['counter']
122          ),
123
124        'CLASS' => 'tagLevel'.$tag['level']
125        )
126      );
127  }
128}
129//---------------------------------------------------------- special categories
130// favorites categories
131if ( !$user['is_the_guest'] )
132{
133  $template->assign_block_vars('username', array());
134
135  $template->assign_block_vars(
136    'special_cat',
137    array(
138      'URL' => make_index_url(array('section' => 'favorites')),
139      'TITLE' => $lang['favorite_cat_hint'],
140      'NAME' => $lang['favorite_cat']
141      ));
142}
143// most visited
144$template->assign_block_vars(
145  'special_cat',
146  array(
147    'URL' => make_index_url(array('section' => 'most_visited')),
148    'TITLE' => $lang['most_visited_cat_hint'],
149    'NAME' => $lang['most_visited_cat']
150    ));
151// best rated
152if ($conf['rate'])
153{
154  $template->assign_block_vars(
155    'special_cat',
156    array(
157      'URL' => make_index_url(array('section' => 'best_rated')),
158      'TITLE' => $lang['best_rated_cat_hint'],
159      'NAME' => $lang['best_rated_cat']
160      )
161    );
162}
163// random
164$template->assign_block_vars(
165  'special_cat',
166  array(
167    'URL' => get_root_url().'random.php',
168    'TITLE' => $lang['random_cat_hint'],
169    'NAME' => $lang['random_cat']
170    ));
171// recent pics
172$template->assign_block_vars(
173  'special_cat',
174  array(
175    'URL' => make_index_url(array('section' => 'recent_pics')),
176    'TITLE' => $lang['recent_pics_cat_hint'],
177    'NAME' => $lang['recent_pics_cat']
178    ));
179// recent cats
180$template->assign_block_vars(
181  'special_cat',
182  array(
183    'URL' => make_index_url(array('section' => 'recent_cats')),
184    'TITLE' => $lang['recent_cats_cat_hint'],
185    'NAME' => $lang['recent_cats_cat']
186    ));
187
188// calendar
189$template->assign_block_vars(
190  'special_cat',
191  array(
192    'URL' =>
193      make_index_url(
194        array(
195          'chronology_field' => ($conf['calendar_datefield']=='date_available'
196                                  ? 'posted' : 'created'),
197           'chronology_style'=> 'monthly',
198           'chronology_view' => 'calendar'
199        )
200      ),
201    'TITLE' => $lang['calendar_hint'],
202    'NAME' => $lang['calendar']
203    )
204  );
205//--------------------------------------------------------------------- summary
206
207if ($user['is_the_guest'])
208{
209  $template->assign_block_vars('register', array());
210  $template->assign_block_vars('login', array());
211
212  $template->assign_block_vars('quickconnect', array());
213  if ($conf['authorize_remembering'])
214  {
215    $template->assign_block_vars('quickconnect.remember_me', array());
216  }
217}
218else
219{
220  $template->assign_block_vars('hello', array());
221
222  if (is_autorize_status(ACCESS_CLASSIC))
223  {
224    $template->assign_block_vars('profile', array());
225  }
226
227  // the logout link has no meaning with Apache authentication : it is not
228  // possible to logout with this kind of authentication.
229  if (!$conf['apache_authentication'])
230  {
231    $template->assign_block_vars('logout', array());
232  }
233
234  if (is_admin())
235  {
236    $template->assign_block_vars('admin', array());
237  }
238}
239
240// tags link
241$template->assign_block_vars(
242  'summary',
243  array(
244    'TITLE' => l10n('See available tags'),
245    'NAME' => l10n('Tags'),
246    'U_SUMMARY'=> get_root_url().'tags.php',
247    )
248  );
249
250// search link
251$template->assign_block_vars(
252  'summary',
253  array(
254    'TITLE'=>$lang['hint_search'],
255    'NAME'=>$lang['search'],
256    'U_SUMMARY'=> get_root_url().'search.php',
257    'REL'=> 'rel="search"'
258    )
259  );
260$template->assign_block_vars( 'summary.quick_search',  array() );
261
262// comments link
263$template->assign_block_vars(
264  'summary',
265  array(
266    'TITLE'=>$lang['hint_comments'],
267    'NAME'=>$lang['comments'],
268    'U_SUMMARY'=> get_root_url().'comments.php',
269    )
270  );
271
272// about link
273$template->assign_block_vars(
274  'summary',
275  array(
276    'TITLE'     => $lang['about_page_title'],
277    'NAME'      => $lang['About'],
278    'U_SUMMARY' => get_root_url().'about.php',
279    )
280  );
281
282// notification
283$template->assign_block_vars(
284  'summary',
285  array(
286    'TITLE'=>l10n('notification'),
287    'NAME'=>l10n('Notification'),
288    'U_SUMMARY'=> get_root_url().'notification.php',
289    'REL'=> 'rel="nofollow"'
290    )
291  );
292
293if (isset($page['category']) and $page['cat_uploadable'] )
294{ // upload a picture in the category
295  $url = get_root_url().'upload.php?cat='.$page['category'];
296  $template->assign_block_vars(
297    'upload',
298    array(
299      'U_UPLOAD'=> $url
300      )
301    );
302}
303
304$template->assign_var_from_handle('MENUBAR', 'menubar');
305?>
Note: See TracBrowser for help on using the repository browser.