source: extensions/akBookStyle/trunk/admin.php @ 14170

Last change on this file since 14170 was 10975, checked in by nikrou, 13 years ago

Update to make plugin compatible with piwigo 2.2

File size: 4.7 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | akBookStyle  - a plugin for Piwigo                                    |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2009-2011 Nicolas Roudaire        http://www.nikrou.net  |
6// | Copyright(C) 2009      vdigital                                       |
7// +-----------------------------------------------------------------------+
8// | This program is free software; you can redistribute it and/or modify  |
9// | it under the terms of the GNU General Public License as published by  |
10// | the Free Software Foundation                                          |
11// |                                                                       |
12// | This program is distributed in the hope that it will be useful, but   |
13// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
14// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
15// | General Public License for more details.                              |
16// |                                                                       |
17// | You should have received a copy of the GNU General Public License     |
18// | along with this program; if not, write to the Free Software           |
19// | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,            |
20// | MA 02110-1301 USA                                                     |
21// +-----------------------------------------------------------------------+
22
23if (!defined('PHPWG_ROOT_PATH')) {
24  die('Hacking attempt!');
25}
26
27load_language('plugin.lang', AK_PLUGIN_LANG);
28
29$ThumbnailsLocations = array('top' => l10n('Top'),
30                             'left' => l10n('Left'),
31                             'bottom' => l10n('Bottom'),
32                             'right' => l10n('Right')
33                             );
34$MouseEvents = array('click' => l10n('Click'),
35                     'mouseover' => l10n('Mouseover')
36                     );
37
38$me = get_plugin_data($plugin_id);
39$save_config = false;
40
41if (!empty($_POST['submit'])) {
42  if (!empty($_POST['ak_categories']) && $_POST['ak_categories']!=$me->ak_categories) {
43    $me->ak_categories = $_POST['ak_categories'];
44    $page['infos'][] = l10n_dec('Applicable category has been updated',
45                                'Applicable categories have been updated',
46                                count($_POST['ak_categories'])
47                                );
48    $save_config = true;
49  }
50
51  if (!empty($_POST['ak_by_page']) && intval($_POST['ak_by_page'])!=$me->ak_by_page) {
52    $me->ak_by_page = intval($_POST['ak_by_page']);
53    $page['infos'][] = l10n('Thumbnails per page has been updated');
54    $save_config = true;
55  }
56
57  if (!empty($_POST['ak_by_line']) && intval($_POST['ak_by_line'])!=$me->ak_by_line) {
58    $me->ak_by_line = intval($_POST['ak_by_line']);
59    $page['infos'][] = l10n('Number of column has been updated');
60    $save_config = true;
61  }
62
63  if (!empty($_POST['ak_thumbnail_size']) && $_POST['ak_thumbnail_size']!=$me->ak_thumbnail_size) {
64    $me->ak_thumbnail_size = (int) $_POST['ak_thumbnail_size'];
65    $page['infos'][] = l10n('Thumbnail size has been updated');
66    $save_config = true;
67  }
68
69  if (!empty($_POST['ak_mouse_event']) && $_POST['ak_mouse_event']!=$me->ak_mouse_event) {
70    if (isset($MouseEvents[$_POST['ak_mouse_event']])) {
71      $me->ak_mouse_event = $_POST['ak_mouse_event'];
72    } else {
73      $me->ak_mouse_event = 'click';
74    }
75    $page['infos'][] = l10n('Event to show medium picture has been updated.');
76    $save_config = true;
77  }
78
79  if (!empty($_POST['ak_thumbnails_loc']) && $_POST['ak_thumbnails_loc']!=$me->ak_thumbnails_loc) {
80    if (isset($ThumbnailsLocations[$_POST['ak_thumbnails_loc']])) {
81      $me->ak_thumbnails_loc = $_POST['ak_thumbnails_loc'];
82    } else {
83      $me->ak_thumbnails_loc = 'left';    }
84    $page['infos'][] = l10n('Thumbnails location has been changed');
85    $save_config = true;
86  }
87
88  if ($save_config) {
89    $me->save_config();
90  }
91}
92
93$query = '
94SELECT id,name
95  FROM '.CATEGORIES_TABLE;
96
97$all_categories = simple_hash_from_query($query, 'id', 'name');
98
99$template->set_filenames(array('plugin_admin_content' => AK_PLUGIN_TEMPLATE . '/admin.tpl'));
100$template->assign('AK_PLUGIN_CSS', AK_PLUGIN_CSS);
101$template->assign('ALL_CATEGORIES', $all_categories); 
102$template->assign('AK_CATEGORIES', $me->ak_categories); 
103$template->assign('AK_BY_PAGE', $me->ak_by_page); 
104$template->assign('AK_BY_LINE', $me->ak_by_line); 
105$template->assign('AK_THUMBNAIL_SIZE', $me->ak_thumbnail_size); 
106$template->assign('AK_EVENT', $me->ak_mouse_event); 
107$template->assign('AK_EVENTS', $MouseEvents); 
108$template->assign('AK_THUMBNAILS_LOC', $me->ak_thumbnails_loc); 
109$template->assign('AK_THUMBNAILS_LOCATIONS', $ThumbnailsLocations); 
110$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
111?>
Note: See TracBrowser for help on using the repository browser.