source: extensions/photoWidget/admin.php @ 5611

Last change on this file since 5611 was 5611, checked in by nikrou, 14 years ago

New plugin photoWidget : first public release

File size: 4.0 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | photoWidget  - a plugin for Piwigo                                    |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2010 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 as published by  |
9// | 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
19// | USA.                                                                  |
20// +-----------------------------------------------------------------------+
21
22if (!defined('PHPWG_ROOT_PATH')) {
23  die('Hacking attempt!');
24}
25
26load_language('plugin.lang', PW_PLUGIN_LANG);
27
28$me = get_plugin_data($plugin_id);
29$save_config = false;
30
31if (!empty($_POST['submit'])) {
32  if (isset($_POST['pw_all_categories']) && $_POST['pw_all_categories']!=$me->pw_all_categories) {
33    $me->pw_all_categories = $_POST['pw_all_categories'];
34    array_push($GLOBALS['page']['infos'],
35               l10n('You choose that mode for').' '.l10n('all categories'));
36    $save_config = true;
37  } else {
38    if (!empty($_POST['pw_categories']) && $_POST['pw_categories']!=$me->pw_categories) {
39      $me->pw_categories = $_POST['pw_categories'];
40      array_push($GLOBALS['page']['infos'],
41                 l10n('You choose that mode for').' '.
42                 l10n_dec('one category',
43                          'severals categories',
44                          count($_POST['pw_categories'])));
45      $save_config = true;
46    }
47  }
48    if (!empty($_POST['pw_width']) && intval($_POST['pw_width'])!=$me->pw_width) {
49    $me->pw_width = intval($_POST['pw_width']);
50    array_push($GLOBALS['page']['infos'], l10n('Width has been updated'));
51    $save_config = true;
52  }
53  if (!empty($_POST['pw_height']) && intval($_POST['pw_height'])!=$me->pw_height) {
54    $me->pw_height = intval($_POST['pw_height']);
55    array_push($GLOBALS['page']['infos'], l10n('Height has been updated'));
56    $save_config = true;
57  }
58  if (!empty($_POST['pw_bgcolor']) && trim($_POST['pw_bgcolor'])!=$me->pw_bgcolor) {
59    $me->pw_bgcolor = $_POST['pw_bgcolor'];
60    array_push($GLOBALS['page']['infos'], l10n('Background color of animation has been updated'));
61    $save_config = true;
62  }
63
64  if ($save_config) {
65    $me->save_config();
66  }
67}
68
69$query = '
70SELECT id,name
71  FROM '.CATEGORIES_TABLE;
72
73$all_categories = simple_hash_from_query($query, 'id', 'name');
74
75$GLOBALS['template']->set_filenames(array('plugin_admin_content' => PW_TEMPLATE . '/admin.tpl'));
76$GLOBALS['template']->assign('PW_CAT_CHOICES', array(1 => l10n('Yes'), 0 => l10n('No')));
77$GLOBALS['template']->assign('ALL_CATEGORIES', $all_categories); 
78$GLOBALS['template']->assign('PW_CATEGORIES', $me->pw_categories);
79$GLOBALS['template']->assign('PW_ALL_CATEGORIES', $me->pw_all_categories);
80$GLOBALS['template']->assign('PWG_PHOTO_WIDGET_PLUGIN_CSS', PW_CSS);
81$GLOBALS['template']->assign('PWG_PHOTO_WIDGET_PLUGIN_JS', PW_JS);
82$GLOBALS['template']->assign('PW_BGCOLOR', $me->pw_bgcolor);
83$GLOBALS['template']->assign('PW_WIDTH', $me->pw_width); 
84$GLOBALS['template']->assign('PW_HEIGHT', $me->pw_height); 
85$GLOBALS['template']->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
86?>
Note: See TracBrowser for help on using the repository browser.