[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] | 16 | include_once('cstat_root.class.inc.php'); |
---|
[5961] | 17 | //include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCPublicIntegration.class.inc.php'); |
---|
| 18 | |
---|
[6107] | 19 | class 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 | |
---|
| 62 | |
---|
| 63 | /* ------------------------------------------------------------------------- |
---|
[6107] | 64 | FUNCTIONS TO MANAGE COLORS DISPLAY |
---|
[5961] | 65 | ------------------------------------------------------------------------- */ |
---|
[6107] | 66 | public function addColors() |
---|
[5961] | 67 | { |
---|
[6107] | 68 | global $page, $template; |
---|
[5961] | 69 | |
---|
[6176] | 70 | $colors=CStat_functions::getImageColors($page['image_id']); |
---|
[5961] | 71 | |
---|
| 72 | |
---|
[6107] | 73 | if(count($colors['colors'])>0) |
---|
[5961] | 74 | { |
---|
[6107] | 75 | $metadata=$template->get_template_vars('metadata'); |
---|
[5961] | 76 | |
---|
[6107] | 77 | $tmp=Array(); |
---|
[5961] | 78 | |
---|
[6107] | 79 | for($i=0;$i<count($colors['colors']);$i++) |
---|
| 80 | { |
---|
| 81 | $tmp[$colors['colors'][$i]]['pct']=$colors['colors_pct'][$i]; |
---|
| 82 | } |
---|
[5961] | 83 | |
---|
[6107] | 84 | $colorsNfo=Array( |
---|
| 85 | 'TITLE' => l10n('cstat_colors'), |
---|
| 86 | 'lines' => Array( |
---|
[6176] | 87 | l10n('cstat_colors_on_image') => CStat_functions::htmlColorList($tmp, 8, 25, "", "color1px", "/"), |
---|
[6107] | 88 | ) |
---|
| 89 | ); |
---|
[5961] | 90 | |
---|
[6107] | 91 | $metadata[]=$colorsNfo; |
---|
[5961] | 92 | |
---|
[6107] | 93 | $template->assign('metadata', $metadata); |
---|
[5961] | 94 | } |
---|
[6107] | 95 | } |
---|
[5961] | 96 | |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | /* --------------------------------------------------------------------------- |
---|
| 100 | ajax functions |
---|
| 101 | --------------------------------------------------------------------------- */ |
---|
| 102 | |
---|
| 103 | } //class |
---|
| 104 | |
---|
| 105 | ?> |
---|