1 | <?php |
---|
2 | /* ----------------------------------------------------------------------------- |
---|
3 | Plugin : Histogram |
---|
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 | |
---|
12 | HGram_PIP : classe to manage plugin public pages |
---|
13 | |
---|
14 | --------------------------------------------------------------------------- */ |
---|
15 | |
---|
16 | include_once('hgram_root.class.inc.php'); |
---|
17 | |
---|
18 | class HGram_PIP extends HGram_root |
---|
19 | { |
---|
20 | protected $section_page; |
---|
21 | |
---|
22 | public function __construct($prefixeTable, $filelocation) |
---|
23 | { |
---|
24 | parent::__construct($prefixeTable, $filelocation); |
---|
25 | $this->loadConfig(); |
---|
26 | |
---|
27 | $this->initEvents(); |
---|
28 | $this->load_lang(); |
---|
29 | } |
---|
30 | |
---|
31 | public function __destruct() |
---|
32 | { |
---|
33 | unset($section_page); |
---|
34 | parent::__destruct(); |
---|
35 | } |
---|
36 | |
---|
37 | /** |
---|
38 | * load language file |
---|
39 | */ |
---|
40 | public function load_lang() |
---|
41 | { |
---|
42 | global $lang; |
---|
43 | |
---|
44 | load_language('plugin.lang', HGRAM_PATH); |
---|
45 | } |
---|
46 | |
---|
47 | /** |
---|
48 | * initialize events call for the plugin |
---|
49 | */ |
---|
50 | public function initEvents() |
---|
51 | { |
---|
52 | parent::initEvents(); |
---|
53 | |
---|
54 | add_event_handler('loc_begin_picture', array(&$this, 'addHistogram')); |
---|
55 | } |
---|
56 | |
---|
57 | |
---|
58 | |
---|
59 | /* ------------------------------------------------------------------------- |
---|
60 | FUNCTIONS TO MANAGE HISTOGRAM DISPLAY |
---|
61 | ------------------------------------------------------------------------- */ |
---|
62 | public function addHistogram() |
---|
63 | { |
---|
64 | global $page, $template; |
---|
65 | |
---|
66 | $fileName=self::getHistogramGraph($page['image_id']); |
---|
67 | |
---|
68 | $metadata=$template->get_template_vars('metadata'); |
---|
69 | |
---|
70 | |
---|
71 | $template->set_filename('hgramHisto', |
---|
72 | dirname($this->getFileLocation()).'/templates/hgram_picture_histo.tpl'); |
---|
73 | $template->assign('histoImg', $fileName); |
---|
74 | $template->assign('imageId', $page['image_id']); |
---|
75 | $template->assign('token', self::getToken($page['image_id'])); |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | $histoNfo=Array( |
---|
80 | 'TITLE' => l10n('hgram_histogram'), |
---|
81 | 'lines' => Array( |
---|
82 | '<!--rawContent-->' => $template->parse('hgramHisto', true) |
---|
83 | ) |
---|
84 | ); |
---|
85 | |
---|
86 | $metadata[]=$histoNfo; |
---|
87 | |
---|
88 | $template->assign('metadata', $metadata); |
---|
89 | } |
---|
90 | |
---|
91 | |
---|
92 | } //class |
---|
93 | |
---|
94 | ?> |
---|