source: extensions/community/admin.php @ 16859

Last change on this file since 16859 was 9516, checked in by plg, 13 years ago

display the number of pending photos outside the dedicated admin screen (on the admin homepage, in the admin menubar, in the tab name)

File size: 3.7 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based picture gallery                                  |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
6// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
7// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
8// +-----------------------------------------------------------------------+
9// | This program is free software; you can redistribute it and/or modify  |
10// | it under the terms of the GNU General Public License as published by  |
11// | the Free Software Foundation                                          |
12// |                                                                       |
13// | This program is distributed in the hope that it will be useful, but   |
14// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
15// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
16// | General Public License for more details.                              |
17// |                                                                       |
18// | You should have received a copy of the GNU General Public License     |
19// | along with this program; if not, write to the Free Software           |
20// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
21// | USA.                                                                  |
22// +-----------------------------------------------------------------------+
23
24if( !defined("PHPWG_ROOT_PATH") )
25{
26  die ("Hacking attempt!");
27}
28
29include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
30include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
31
32define('COMMUNITY_BASE_URL', get_root_url().'admin.php?page=plugin-community');
33
34// +-----------------------------------------------------------------------+
35// | Check Access and exit when user status is not ok                      |
36// +-----------------------------------------------------------------------+
37
38check_status(ACCESS_ADMINISTRATOR);
39
40// +-----------------------------------------------------------------------+
41// | Tabs                                                                  |
42// +-----------------------------------------------------------------------+
43
44$pendings_label = l10n('Pending Photos');
45if ($page['community_nb_pendings'] > 0)
46{
47  $pendings_label.= ' ('.$page['community_nb_pendings'].')';
48}
49
50$tabs = array(
51  array(
52    'code' => 'permissions',
53    'label' => l10n('Upload Permissions'),
54    ),
55  array(
56    'code' => 'pendings',
57    'label' => $pendings_label,
58    ),
59  );
60
61$tab_codes = array_map(
62  create_function('$a', 'return $a["code"];'),
63  $tabs
64  );
65
66if (isset($_GET['tab']) and in_array($_GET['tab'], $tab_codes))
67{
68  $page['tab'] = $_GET['tab'];
69}
70else
71{
72  $page['tab'] = $tabs[0]['code'];
73}
74
75$tabsheet = new tabsheet();
76foreach ($tabs as $tab)
77{
78  $tabsheet->add(
79    $tab['code'],
80    $tab['label'],
81    COMMUNITY_BASE_URL.'-'.$tab['code']
82    );
83}
84$tabsheet->select($page['tab']);
85$tabsheet->assign();
86
87// +-----------------------------------------------------------------------+
88// |                             template init                             |
89// +-----------------------------------------------------------------------+
90
91$template->set_filenames(
92  array(
93    'photos_add' => 'photos_add_'.$page['tab'].'.tpl'
94    )
95  );
96
97// +-----------------------------------------------------------------------+
98// |                             Load the tab                              |
99// +-----------------------------------------------------------------------+
100
101include(COMMUNITY_PATH.'admin_'.$page['tab'].'.php');
102?>
Note: See TracBrowser for help on using the repository browser.