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

Last change on this file since 10863 was 9271, checked in by ddtddt, 13 years ago

[extensions] - akBookStyle - add no_NO (Norwegian) thanks to atlew

File size: 5.1 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | akBookStyle  - a plugin for Piwigo                                    |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2009-2010 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' => 'Top',
30                             'left' => 'Left',
31                             'bottom' => 'Bottom',
32                             'right' => 'Right');
33$MouseEvents = array('click' => 'Click',
34                     'mouseover' => 'Mouseover');
35
36$me = get_plugin_data($plugin_id);
37$save_config = false;
38
39if (!empty($_POST['submit'])) {
40  if (!empty($_POST['ak_categories']) && $_POST['ak_categories']!=$me->ak_categories) {
41    $me->ak_categories = $_POST['ak_categories'];
42    array_push($GLOBALS['page']['infos'],
43               l10n_dec('Applicable category has been updated',
44                        'Applicable categories have been updated',
45                        count($_POST['ak_categories'])));
46    $save_config = true;
47  }
48
49  if (!empty($_POST['ak_by_page']) && intval($_POST['ak_by_page'])!=$me->ak_by_page) {
50    $me->ak_by_page = intval($_POST['ak_by_page']);
51    array_push($GLOBALS['page']['infos'], l10n('Thumbnails per page has been updated'));
52    $save_config = true;
53  }
54
55  if (!empty($_POST['ak_by_line']) && intval($_POST['ak_by_line'])!=$me->ak_by_line) {
56    $me->ak_by_line = intval($_POST['ak_by_line']);
57    array_push($GLOBALS['page']['infos'], l10n('Number of column has been updated'));
58    $save_config = true;
59  }
60
61  if (!empty($_POST['ak_thumbnail_size']) && $_POST['ak_thumbnail_size']!=$me->ak_thumbnail_size) {
62    $me->ak_thumbnail_size = (int) $_POST['ak_thumbnail_size'];
63    array_push($GLOBALS['page']['infos'], l10n('Thumbnail size has been updated'));
64    $save_config = true;
65  }
66
67  if (!empty($_POST['ak_mouse_event']) && $_POST['ak_mouse_event']!=$me->ak_mouse_event) {
68    if (isset($MouseEvents[$_POST['ak_mouse_event']])) {
69      $me->ak_mouse_event = $_POST['ak_mouse_event'];
70    } else {
71      $me->ak_mouse_event = 'click';
72    }
73    array_push($GLOBALS['page']['infos'], l10n('Event to show medium picture has been updated.'));
74    $save_config = true;
75  }
76
77  if (!empty($_POST['ak_thumbnails_loc']) && $_POST['ak_thumbnails_loc']!=$me->ak_thumbnails_loc) {
78    if (isset($ThumbnailsLocations[$_POST['ak_thumbnails_loc']])) {
79      $me->ak_thumbnails_loc = $_POST['ak_thumbnails_loc'];
80    } else {
81      $me->ak_thumbnails_loc = 'left';    }
82    array_push($GLOBALS['page']['infos'], l10n('Thumbnails location has been changed'));
83    $save_config = true;
84  }
85
86  if ($save_config) {
87    $me->save_config();
88  }
89}
90
91$query = '
92SELECT id,name
93  FROM '.CATEGORIES_TABLE;
94
95$all_categories = simple_hash_from_query($query, 'id', 'name');
96
97$GLOBALS['template']->set_filenames(array('plugin_admin_content' => AK_PLUGIN_TEMPLATE . '/admin.tpl'));
98$GLOBALS['template']->assign('AK_PLUGIN_CSS', AK_PLUGIN_CSS);
99$GLOBALS['template']->assign('ALL_CATEGORIES', $all_categories); 
100$GLOBALS['template']->assign('AK_CATEGORIES', $me->ak_categories); 
101$GLOBALS['template']->assign('AK_BY_PAGE', $me->ak_by_page); 
102$GLOBALS['template']->assign('AK_BY_LINE', $me->ak_by_line); 
103$GLOBALS['template']->assign('AK_THUMBNAIL_SIZE', $me->ak_thumbnail_size); 
104$GLOBALS['template']->assign('AK_MOUSE_EVENT', $me->ak_mouse_event); 
105$GLOBALS['template']->assign('AK_AVAILABLE_EVENTS', array_keys($MouseEvents)); 
106$GLOBALS['template']->assign('AK_EVENTS_LABELS', array_values($MouseEvents)); 
107$GLOBALS['template']->assign('AK_THUMBNAILS_LOC', $me->ak_thumbnails_loc); 
108$GLOBALS['template']->assign('AK_THUMBNAILS_LOCATIONS_KEYS', array_keys($ThumbnailsLocations)); 
109$GLOBALS['template']->assign('AK_THUMBNAILS_LOCATIONS_VALUES', array_values($ThumbnailsLocations)); 
110$GLOBALS['template']->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
111?>
Note: See TracBrowser for help on using the repository browser.