1 | <?php |
---|
2 | /* ----------------------------------------------------------------------------- |
---|
3 | Plugin : Advanced Search Engine |
---|
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 | ASE_root : common classe for admin and public classes |
---|
13 | |
---|
14 | --------------------------------------------------------------------------- */ |
---|
15 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); |
---|
16 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCss.class.inc.php'); |
---|
17 | |
---|
18 | class ASE_root extends CommonPlugin |
---|
19 | { |
---|
20 | protected $css; |
---|
21 | |
---|
22 | public function __construct($prefixeTable, $filelocation) |
---|
23 | { |
---|
24 | $this->setPluginName('Advanced Search Engine'); |
---|
25 | $this->setPluginNameFiles("ase"); |
---|
26 | parent::__construct($prefixeTable, $filelocation); |
---|
27 | $this->section_name=$this->getPluginNameFiles(); |
---|
28 | |
---|
29 | $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().".css"); |
---|
30 | } |
---|
31 | |
---|
32 | public function __destruct() |
---|
33 | { |
---|
34 | parent::__destruct(); |
---|
35 | } |
---|
36 | |
---|
37 | public function initEvents() |
---|
38 | { |
---|
39 | } |
---|
40 | |
---|
41 | |
---|
42 | /* |
---|
43 | surchage of CommonPlugin->saveConfig function |
---|
44 | */ |
---|
45 | public function saveConfig() |
---|
46 | { |
---|
47 | if(parent::saveConfig()) |
---|
48 | { |
---|
49 | return(true); |
---|
50 | } |
---|
51 | return(false); |
---|
52 | } |
---|
53 | |
---|
54 | /* |
---|
55 | surchage of CommonPlugin->saveConfig function |
---|
56 | */ |
---|
57 | public function loadConfig() |
---|
58 | { |
---|
59 | parent::loadConfig(); |
---|
60 | } |
---|
61 | |
---|
62 | /* |
---|
63 | intialize default values |
---|
64 | */ |
---|
65 | public function initConfig() |
---|
66 | { |
---|
67 | //global $user; |
---|
68 | $this->config=array( |
---|
69 | ); |
---|
70 | } |
---|
71 | |
---|
72 | |
---|
73 | /** |
---|
74 | * |
---|
75 | */ |
---|
76 | protected function configForTemplate() |
---|
77 | { |
---|
78 | global $template; |
---|
79 | |
---|
80 | $template->assign('aseConfig', $this->config); |
---|
81 | } |
---|
82 | |
---|
83 | |
---|
84 | public function getAdminLink($mode='') |
---|
85 | { |
---|
86 | if($mode=='ajax') |
---|
87 | { |
---|
88 | return('plugins/'.basename(dirname($this->getFileLocation())).'/ase_ajax.php'); |
---|
89 | } |
---|
90 | else |
---|
91 | { |
---|
92 | return(parent::getAdminLink()); |
---|
93 | } |
---|
94 | } |
---|
95 | |
---|
96 | protected function displayResult($action_msg, $result) |
---|
97 | { |
---|
98 | global $page; |
---|
99 | |
---|
100 | if($result) |
---|
101 | { |
---|
102 | array_push($page['infos'], $action_msg); |
---|
103 | } |
---|
104 | else |
---|
105 | { |
---|
106 | array_push($page['errors'], $action_msg); |
---|
107 | } |
---|
108 | } |
---|
109 | |
---|
110 | |
---|
111 | /* --------------------------------------------------------------------------- |
---|
112 | |
---|
113 | --------------------------------------------------------------------------- */ |
---|
114 | |
---|
115 | |
---|
116 | |
---|
117 | } //class |
---|
118 | |
---|
119 | |
---|
120 | |
---|
121 | class ASE_functions |
---|
122 | { |
---|
123 | static private $tables = Array(); |
---|
124 | static private $config = Array(); |
---|
125 | |
---|
126 | /** |
---|
127 | * initialise the class |
---|
128 | * |
---|
129 | * @param String $prefixeTable : the piwigo prefixe used on tables name |
---|
130 | * @param String $pluginNameFile : the plugin name used for tables name |
---|
131 | */ |
---|
132 | static public function init($prefixeTable) |
---|
133 | { |
---|
134 | // no tables for this plugin |
---|
135 | } |
---|
136 | |
---|
137 | |
---|
138 | /** |
---|
139 | * return all HTML&JS code necessary to display a dialogbox to choose |
---|
140 | * tags |
---|
141 | */ |
---|
142 | static public function dialogBoxASETags() |
---|
143 | { |
---|
144 | global $template; |
---|
145 | |
---|
146 | $template->set_filename('ase_tag_choose', |
---|
147 | dirname(__FILE__).'/templates/ase_dialog_tag_choose.tpl'); |
---|
148 | |
---|
149 | $datas=Array(); |
---|
150 | |
---|
151 | $template->assign('datas', $datas); |
---|
152 | |
---|
153 | return($template->parse('ase_tag_choose', true)); |
---|
154 | } |
---|
155 | |
---|
156 | |
---|
157 | /** |
---|
158 | * return all HTML&JS code necessary to display a dialogbox to choose |
---|
159 | * categories |
---|
160 | */ |
---|
161 | static public function dialogBoxASECategory() |
---|
162 | { |
---|
163 | global $template; |
---|
164 | |
---|
165 | $template->set_filename('ase_category_choose', |
---|
166 | dirname(__FILE__).'/templates/ase_dialog_category_choose.tpl'); |
---|
167 | |
---|
168 | $datas=Array(); |
---|
169 | |
---|
170 | $template->assign('datas', $datas); |
---|
171 | |
---|
172 | return($template->parse('ase_category_choose', true)); |
---|
173 | } |
---|
174 | |
---|
175 | /** |
---|
176 | * return all HTML&JS code necessary to display a dialogbox to choose |
---|
177 | * dates |
---|
178 | */ |
---|
179 | static public function dialogBoxASEDate() |
---|
180 | { |
---|
181 | global $template; |
---|
182 | |
---|
183 | $template->set_filename('ase_date_choose', |
---|
184 | dirname(__FILE__).'/templates/ase_dialog_date_choose.tpl'); |
---|
185 | |
---|
186 | $datas=Array(); |
---|
187 | |
---|
188 | $template->assign('datas', $datas); |
---|
189 | |
---|
190 | return($template->parse('ase_date_choose', true)); |
---|
191 | } |
---|
192 | |
---|
193 | /** |
---|
194 | * return all HTML&JS code necessary to display a dialogbox to choose |
---|
195 | * keywords |
---|
196 | */ |
---|
197 | static public function dialogBoxASEKeyword() |
---|
198 | { |
---|
199 | global $template; |
---|
200 | |
---|
201 | $template->set_filename('ase_keyword_choose', |
---|
202 | dirname(__FILE__).'/templates/ase_dialog_keyword_choose.tpl'); |
---|
203 | |
---|
204 | $datas=Array(); |
---|
205 | |
---|
206 | $template->assign('datas', $datas); |
---|
207 | |
---|
208 | return($template->parse('ase_keyword_choose', true)); |
---|
209 | } |
---|
210 | |
---|
211 | /** |
---|
212 | * return all HTML&JS code necessary to display a dialogbox to choose |
---|
213 | * HD picture |
---|
214 | */ |
---|
215 | static public function dialogBoxASEHD() |
---|
216 | { |
---|
217 | global $template; |
---|
218 | |
---|
219 | $template->set_filename('ase_hd_choose', |
---|
220 | dirname(__FILE__).'/templates/ase_dialog_hd_choose.tpl'); |
---|
221 | |
---|
222 | $datas=Array(); |
---|
223 | |
---|
224 | $template->assign('datas', $datas); |
---|
225 | |
---|
226 | return($template->parse('ase_hd_choose', true)); |
---|
227 | } |
---|
228 | |
---|
229 | /** |
---|
230 | * return all HTML&JS code necessary to display a dialogbox to choose |
---|
231 | * rate on picture |
---|
232 | */ |
---|
233 | static public function dialogBoxASERate() |
---|
234 | { |
---|
235 | global $template; |
---|
236 | |
---|
237 | $template->set_filename('ase_rate_choose', |
---|
238 | dirname(__FILE__).'/templates/ase_dialog_rate_choose.tpl'); |
---|
239 | |
---|
240 | $datas=Array(); |
---|
241 | |
---|
242 | $template->assign('datas', $datas); |
---|
243 | |
---|
244 | return($template->parse('ase_rate_choose', true)); |
---|
245 | } |
---|
246 | |
---|
247 | } //ASE_functions |
---|
248 | |
---|
249 | |
---|
250 | |
---|
251 | ?> |
---|