1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | pwgCumulus - a plugin for Piwigo | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | Copyright(C) 2009-2011 Nicolas Roudaire http://www.nikrou.net | |
---|
6 | // +-----------------------------------------------------------------------+ |
---|
7 | // | This program is free software; you can redistribute it and/or modify | |
---|
8 | // | it under the terms of the GNU General Public License version 2 as | |
---|
9 | // | published by the Free Software Foundation | |
---|
10 | // | | |
---|
11 | // | This program is distributed in the hope that it will be useful, but | |
---|
12 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
13 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
14 | // | General Public License for more details. | |
---|
15 | // | | |
---|
16 | // | You should have received a copy of the GNU General Public License | |
---|
17 | // | along with this program; if not, write to the Free Software | |
---|
18 | // | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
---|
19 | // | MA 02110-1301 USA | |
---|
20 | // +-----------------------------------------------------------------------+ |
---|
21 | |
---|
22 | if (!defined('PHPWG_ROOT_PATH')) { |
---|
23 | die('Hacking attempt!'); |
---|
24 | } |
---|
25 | |
---|
26 | $save_config = false; |
---|
27 | $Positions = array('before' => l10n('Before'), |
---|
28 | 'after' => l10n('After') |
---|
29 | ); |
---|
30 | |
---|
31 | include_once(PHPWG_ROOT_PATH.'include/block.class.php'); |
---|
32 | |
---|
33 | $menu = new BlockManager('menubar'); |
---|
34 | $menu->load_registered_blocks(); |
---|
35 | $Blocks = array(); |
---|
36 | |
---|
37 | foreach ($menu->get_registered_blocks() as $block) { |
---|
38 | $Blocks[$block->get_id()] = l10n($block->get_name()); |
---|
39 | } |
---|
40 | |
---|
41 | if (!empty($_POST['submit'])) { |
---|
42 | if (!empty($_POST['pwg_cumulus_in_main_menu']) && $_POST['pwg_cumulus_in_main_menu']!=$me->pwg_cumulus_in_main_menu) { |
---|
43 | $me->pwg_cumulus_in_main_menu = true; |
---|
44 | $page['infos'][] = l10n('Tags cloud added in main menu'); |
---|
45 | $save_config = true; |
---|
46 | } elseif (empty($_POST['pwg_cumulus_in_main_menu']) && $me->pwg_cumulus_in_main_menu) { |
---|
47 | $me->pwg_cumulus_in_main_menu = false; |
---|
48 | $page['infos'][] = l10n('Tags cloud removed from main menu'); |
---|
49 | $save_config = true; |
---|
50 | } |
---|
51 | |
---|
52 | if (!empty($_POST['position_order']) && isset($Positions[$_POST['position_order']]) |
---|
53 | && !empty($_POST['position_block_id']) && isset($Blocks[$_POST['position_block_id']]) |
---|
54 | && ($_POST['position_order']!=$me->position_order || $_POST['position_block_id']!=$me->position_block_id)) { |
---|
55 | |
---|
56 | $me->position_order = $_POST['position_order']; |
---|
57 | $me->position_block_id = $_POST['position_block_id']; |
---|
58 | $page['infos'][] = l10n('Block\'s position has been updated'); |
---|
59 | $save_config = true; |
---|
60 | } |
---|
61 | |
---|
62 | if ($save_config) { |
---|
63 | $me->save_config(); |
---|
64 | } |
---|
65 | } |
---|
66 | |
---|
67 | $template->assign('MENUBAR_BLOCKS', $Blocks); |
---|
68 | $template->assign('POSITION_ORDER', $me->position_order); |
---|
69 | $template->assign('POSITIONS', $Positions); |
---|
70 | $template->assign('POSITION_BLOCK_ID', $me->position_block_id); |
---|
71 | $template->assign('PWG_CUMULUS_IN_MAIN_MENU', $me->pwg_cumulus_in_main_menu); |
---|
72 | ?> |
---|