source: extensions/pwgCumulus/include/pwgCumulusContent.class.php @ 9752

Last change on this file since 9752 was 9038, checked in by nikrou, 13 years ago

add no_NO (Norwegian) thanks to atlew
prepare plugin for piwigo 2.2 compatibility

File size: 3.4 KB
Line 
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
22class pwgCumulusContent
23{
24  public function __construct($config) {
25    $this->plugin_config = $config;
26  }
27
28  public function loc_begin_page_header() {
29    if (!empty($_GET['display_mode']) && $_GET['display_mode']=='cumulus') {
30      $GLOBALS['template']->assign('display_mode', 'cumulus');
31    }
32
33    $GLOBALS['template']->set_filenames(array('tags'=> PWG_CUMULUS_PLUGIN_TEMPLATE . '/tags.tpl'));
34   
35    if (version_compare(PHPWG_VERSION, '2.2', '>=') || (PHPWG_VERSION=='Colibri')) {
36      $GLOBALS['template']->func_combine_script(array('id' => 'swfobject',
37                                                      'path' => PWG_CUMULUS_PLUGIN_JS. '/swfobject.js'
38                                                      ),
39                                                $GLOBALS['template']->smarty
40                                                );
41    } else {
42      $GLOBALS['template']->func_known_script(array('id' => 'swfobject',
43                                                    'src' => PWG_CUMULUS_PLUGIN_JS. '/swfobject.js'
44                                                    ),
45                                              $GLOBALS['template']->smarty
46                                              );
47    }
48   
49    $GLOBALS['template']->assign('PWG_CUMULUS_SWF', PWG_CUMULUS_PLUGIN_SWF);
50    $GLOBALS['template']->assign('PWG_CUMULUS_IMGS', PWG_CUMULUS_PLUGIN_IMGS);
51
52    $GLOBALS['template']->assign('PWG_CUMULUS_WIDTH', $this->plugin_config->pwg_cumulus_width);
53    $GLOBALS['template']->assign('PWG_CUMULUS_HEIGHT', $this->plugin_config->pwg_cumulus_height);
54    $GLOBALS['template']->assign('PWG_CUMULUS_HREF', get_root_url().'tags.php?display_mode=cumulus');
55
56    $GLOBALS['template']->assign('PWG_CUMULUS_COLOR1', '0x'.$this->plugin_config->pwg_cumulus_color1);
57    $GLOBALS['template']->assign('PWG_CUMULUS_COLOR2', '0x'.$this->plugin_config->pwg_cumulus_color2);
58    $GLOBALS['template']->assign('PWG_CUMULUS_HICOLOR', '0x'.$this->plugin_config->pwg_cumulus_hicolor);
59
60    if (!empty($GLOBALS['template']->smarty->_tpl_vars['tags'])) {
61      foreach ($GLOBALS['template']->smarty->_tpl_vars['tags'] as $key => &$tag) {
62        $tag['display_name'] = urlencode($tag['name']);
63        $tag['size'] = $this->plugin_config->pwg_cumulus_coeff*$tag['level'];
64      }
65    }
66  }
67}
68?>
Note: See TracBrowser for help on using the repository browser.