source: extensions/ColorStat/cstat_pip.class.inc.php @ 17940

Last change on this file since 17940 was 16010, checked in by grum, 12 years ago

feature:2639- compatibility with Piwigo 2.4

  • Property svn:executable set to *
File size: 2.4 KB
RevLine 
[5961]1<?php
2/* -----------------------------------------------------------------------------
[6107]3  Plugin     : ColorStat
[5961]4  Author     : Grum
5    email    : grum@piwigo.org
6    website  : http://photos.grum.fr
7
8    << May the Little SpaceFrog be with you ! >>
9  ------------------------------------------------------------------------------
10  See main.inc.php for release information
11
[6107]12  CStat_PIP : classe to manage plugin public pages
[5961]13
14  --------------------------------------------------------------------------- */
15
[6107]16include_once('cstat_root.class.inc.php');
[5961]17//include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCPublicIntegration.class.inc.php');
18
[6107]19class CStat_PIP extends CStat_root
[5961]20{
21  protected $section_page;
22
23  public function __construct($prefixeTable, $filelocation)
24  {
25    parent::__construct($prefixeTable, $filelocation);
26    $this->loadConfig();
27
28    $this->initEvents();
29    $this->load_lang();
30  }
31
32  public function __destruct()
33  {
34    unset($section_page);
35    parent::__destruct();
36  }
37
[6107]38  /**
39   * load language file
40   */
[5961]41  public function load_lang()
42  {
43    global $lang;
44
[6107]45    load_language('plugin.lang', CSTAT_PATH);
[5961]46  }
47
[6107]48  /**
49   * initialize events call for the plugin
50   */
[5961]51  public function initEvents()
52  {
53    parent::initEvents();
[6107]54
55    if($this->config['display_gallery_showColors']=='y')
[5961]56    {
[6107]57      add_event_handler('loc_begin_picture', array(&$this, 'addColors'));
[5961]58    }
59  }
60
61  /* -------------------------------------------------------------------------
[6107]62    FUNCTIONS TO MANAGE COLORS DISPLAY
[5961]63  ------------------------------------------------------------------------- */
[6107]64  public function addColors()
[5961]65  {
[6107]66    global $page, $template;
[5961]67
[6176]68    $colors=CStat_functions::getImageColors($page['image_id']);
[5961]69
70
[6107]71    if(count($colors['colors'])>0)
[5961]72    {
[6107]73      $metadata=$template->get_template_vars('metadata');
[5961]74
[6107]75      $tmp=Array();
[5961]76
[6107]77      for($i=0;$i<count($colors['colors']);$i++)
78      {
79        $tmp[$colors['colors'][$i]]['pct']=$colors['colors_pct'][$i];
80      }
[5961]81
[6107]82      $colorsNfo=Array(
83        'TITLE' => l10n('cstat_colors'),
84        'lines' => Array(
[6176]85          l10n('cstat_colors_on_image') => CStat_functions::htmlColorList($tmp, 8, 25, "", "color1px", "/"),
[6107]86        )
87      );
[5961]88
[6107]89      $metadata[]=$colorsNfo;
[5961]90
[6107]91      $template->assign('metadata', $metadata);
[5961]92    }
[6107]93  }
[5961]94
95
96
97  /* ---------------------------------------------------------------------------
98    ajax functions
99  --------------------------------------------------------------------------- */
100
101} //class
102
103?>
Note: See TracBrowser for help on using the repository browser.