1 | <?php |
---|
2 | /* ----------------------------------------------------------------------------- |
---|
3 | Plugin : Advanced Menu Manager |
---|
4 | Author : Grum |
---|
5 | email : grum@piwigo.org |
---|
6 | website : http://photos.grum.fr |
---|
7 | PWG user : http://forum.phpwebgallery.net/profile.php?id=3706 |
---|
8 | |
---|
9 | << May the Little SpaceFrog be with you ! >> |
---|
10 | ------------------------------------------------------------------------------ |
---|
11 | See main.inc.php for release information |
---|
12 | |
---|
13 | AIP classe => manage integration in administration interface |
---|
14 | |
---|
15 | --------------------------------------------------------------------------- */ |
---|
16 | if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } |
---|
17 | |
---|
18 | include_once(PHPWG_PLUGINS_PATH.'AMenuManager/amm_root.class.inc.php'); |
---|
19 | include_once(PHPWG_ROOT_PATH.'include/block.class.php'); |
---|
20 | include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); |
---|
21 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTabSheet.class.inc.php'); |
---|
22 | |
---|
23 | |
---|
24 | class AMM_AIP extends AMM_root |
---|
25 | { |
---|
26 | protected $googleTranslate; |
---|
27 | protected $tabsheet; |
---|
28 | protected $blocksId=array('menu' => 'Menu', 'special' => 'Specials'); |
---|
29 | |
---|
30 | |
---|
31 | public function __construct($prefixeTable, $filelocation) |
---|
32 | { |
---|
33 | parent::__construct($prefixeTable, $filelocation); |
---|
34 | |
---|
35 | $this->loadConfig(); |
---|
36 | $this->initEvents(); |
---|
37 | |
---|
38 | $this->tabsheet = new tabsheet(); |
---|
39 | $this->tabsheet->add('setmenu', |
---|
40 | l10n('g002_setmenu'), |
---|
41 | $this->getAdminLink().'&fAMM_tabsheet=setmenu'); |
---|
42 | $this->tabsheet->add('links', |
---|
43 | l10n('g002_addlinks'), |
---|
44 | $this->getAdminLink().'&fAMM_tabsheet=links'); |
---|
45 | $this->tabsheet->add('randompict', |
---|
46 | l10n('g002_randompict'), |
---|
47 | $this->getAdminLink().'&fAMM_tabsheet=randompict'); |
---|
48 | $this->tabsheet->add('personnalblock', |
---|
49 | l10n('g002_personnalblock'), |
---|
50 | $this->getAdminLink().'&fAMM_tabsheet=personnalblock'); |
---|
51 | $this->tabsheet->add('album', |
---|
52 | l10n('g002_album'), |
---|
53 | $this->getAdminLink().'&fAMM_tabsheet=album'); |
---|
54 | $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().".css"); |
---|
55 | } |
---|
56 | |
---|
57 | |
---|
58 | /** |
---|
59 | * manage plugin integration into piwigo's admin interface |
---|
60 | */ |
---|
61 | public function manage() |
---|
62 | { |
---|
63 | global $template, $page; |
---|
64 | |
---|
65 | $template->set_filename('plugin_admin_content', dirname(__FILE__)."/admin/amm_admin.tpl"); |
---|
66 | |
---|
67 | $this->initRequest(); |
---|
68 | |
---|
69 | $this->tabsheet->select($_REQUEST['fAMM_tabsheet']); |
---|
70 | $this->tabsheet->assign(); |
---|
71 | $selected_tab=$this->tabsheet->get_selected(); |
---|
72 | $template->assign($this->tabsheet->get_titlename(), "[".$selected_tab['caption']."]"); |
---|
73 | |
---|
74 | $template_plugin["AMM_VERSION"] = "<i>".$this->getPluginName()."</i> ".l10n('g002_version').AMM_VERSION; |
---|
75 | $template_plugin["AMM_PAGE"] = $_REQUEST['fAMM_tabsheet']; |
---|
76 | $template_plugin["PATH"] = AMM_PATH; |
---|
77 | |
---|
78 | $template->assign('plugin', $template_plugin); |
---|
79 | $template->assign('token', get_pwg_token()); |
---|
80 | |
---|
81 | |
---|
82 | switch($_REQUEST['fAMM_tabsheet']) |
---|
83 | { |
---|
84 | case 'links': |
---|
85 | $this->displayLinksPage($_REQUEST['fAMM_page']); |
---|
86 | break; |
---|
87 | |
---|
88 | case 'randompict': |
---|
89 | $this->displayRandompicPage(); |
---|
90 | break; |
---|
91 | |
---|
92 | case 'personnalblock': |
---|
93 | $this->displayPersonalisedBlockPage(); |
---|
94 | break; |
---|
95 | |
---|
96 | case 'setmenu': |
---|
97 | $this->displayBlocksPage($_REQUEST['fAMM_page']); |
---|
98 | break; |
---|
99 | |
---|
100 | case 'album': |
---|
101 | $this->displayAlbumPage(); |
---|
102 | break; |
---|
103 | } |
---|
104 | |
---|
105 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
106 | } |
---|
107 | |
---|
108 | |
---|
109 | /** |
---|
110 | * initialize events call for the plugin |
---|
111 | */ |
---|
112 | public function initEvents() |
---|
113 | { |
---|
114 | add_event_handler('loc_end_page_header', array(&$this->css, 'applyCSS')); |
---|
115 | GPCCss::applyGpcCss(); |
---|
116 | } |
---|
117 | |
---|
118 | |
---|
119 | /** |
---|
120 | * if empty, initialize the $_REQUEST var |
---|
121 | * |
---|
122 | * if not empty, check validity for the request values |
---|
123 | * |
---|
124 | */ |
---|
125 | private function initRequest() |
---|
126 | { |
---|
127 | //initialise $REQUEST values if not defined |
---|
128 | if(!array_key_exists('fAMM_tabsheet', $_REQUEST)) $_REQUEST['fAMM_tabsheet']='setmenu'; |
---|
129 | |
---|
130 | if(!($_REQUEST['fAMM_tabsheet']=='links' or |
---|
131 | $_REQUEST['fAMM_tabsheet']=='randompict' or |
---|
132 | $_REQUEST['fAMM_tabsheet']=='personnalblock' or |
---|
133 | $_REQUEST['fAMM_tabsheet']=='setmenu' or |
---|
134 | $_REQUEST['fAMM_tabsheet']=='album' |
---|
135 | ) |
---|
136 | ) $_REQUEST['fAMM_tabsheet']='setmenu'; |
---|
137 | |
---|
138 | |
---|
139 | /* |
---|
140 | * checks for links page |
---|
141 | */ |
---|
142 | if($_REQUEST['fAMM_tabsheet']=='links') |
---|
143 | { |
---|
144 | if(!isset($_REQUEST['fAMM_page'])) $_REQUEST['fAMM_page']='links'; |
---|
145 | |
---|
146 | if(!($_REQUEST['fAMM_page']=='links' or |
---|
147 | $_REQUEST['fAMM_page']=='config' |
---|
148 | ) |
---|
149 | ) $_REQUEST['fAMM_page']='config'; |
---|
150 | } |
---|
151 | |
---|
152 | |
---|
153 | /* |
---|
154 | * checks for blocks menu page |
---|
155 | */ |
---|
156 | if($_REQUEST['fAMM_tabsheet']=='setmenu') |
---|
157 | { |
---|
158 | if(!isset($_REQUEST['fAMM_page'])) $_REQUEST['fAMM_page']='position'; |
---|
159 | |
---|
160 | if(!($_REQUEST['fAMM_page']=='position' or |
---|
161 | $_REQUEST['fAMM_page']=='blocksContent' |
---|
162 | ) |
---|
163 | ) $_REQUEST['fAMM_page']='position'; |
---|
164 | } |
---|
165 | |
---|
166 | } //initRequest |
---|
167 | |
---|
168 | |
---|
169 | /** |
---|
170 | * display the links management page |
---|
171 | */ |
---|
172 | private function displayLinksPage($tab) |
---|
173 | { |
---|
174 | global $template, $user; |
---|
175 | |
---|
176 | GPCCore::addHeaderJS('jquery.ui', 'themes/default/js/ui/minified/jquery.ui.core.min.js', array('jquery')); |
---|
177 | GPCCore::addHeaderJS('jquery.ui.sortable', 'themes/default/js/ui/minified/jquery.ui.sortable.min.js', array('jquery.ui')); |
---|
178 | GPCCore::addHeaderJS('jquery.ui.dialog', 'themes/default/js/ui/minified/jquery.ui.dialog.min.js', array('jquery.ui')); |
---|
179 | |
---|
180 | $template->set_filename('body_page', |
---|
181 | dirname($this->getFileLocation()).'/admin/amm_links.tpl'); |
---|
182 | |
---|
183 | $linksTabsheet = new GPCTabSheet('linksTabsheet', $this->tabsheet->get_titlename(), 'tabsheet2 gcBorder2', 'itab2'); |
---|
184 | $linksTabsheet->select($tab); |
---|
185 | $linksTabsheet->add('links', |
---|
186 | l10n('g002_setting_link_links'), |
---|
187 | $this->getAdminLink().'&fAMM_tabsheet=links&fAMM_page=links'); |
---|
188 | $linksTabsheet->add('config', |
---|
189 | l10n('g002_configlinks'), |
---|
190 | $this->getAdminLink().'&fAMM_tabsheet=links&fAMM_page=config'); |
---|
191 | $linksTabsheet->assign(); |
---|
192 | |
---|
193 | switch($tab) |
---|
194 | { |
---|
195 | case 'links': |
---|
196 | $template->assign('sheetContent', $this->displayLinksPageLinks()); |
---|
197 | break; |
---|
198 | case 'config': |
---|
199 | $template->assign('sheetContent', $this->displayLinksPageConfig()); |
---|
200 | break; |
---|
201 | } |
---|
202 | |
---|
203 | $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page'); |
---|
204 | $template->assign('pageNfo', l10n('g002_addlinks_nfo')); |
---|
205 | } |
---|
206 | |
---|
207 | /** |
---|
208 | * display the randompict management page |
---|
209 | */ |
---|
210 | private function displayRandompicPage() |
---|
211 | { |
---|
212 | global $template, $user; |
---|
213 | |
---|
214 | GPCCore::addHeaderJS('jquery.ui', 'themes/default/js/ui/minified/jquery.ui.core.min.js', array('jquery')); |
---|
215 | GPCCore::addHeaderJS('jquery.ui.slider', 'themes/default/js/ui/minified/jquery.ui.slider.min.js'); |
---|
216 | GPCCore::addHeaderJS('gpc.categorySelector', 'plugins/GrumPluginClasses/js/ui.categorySelector'.GPCCore::getMinified().'.js', array('jquery.ui')); |
---|
217 | GPCCore::addUI('inputList,inputText,inputRadio,categorySelector,googleTranslate'); |
---|
218 | GPCCore::addHeaderJS('amm.rpc', 'plugins/AMenuManager/js/amm_randomPictConfig'.GPCCore::getMinified().'.js', array('jquery', 'gpc.inputList', 'gpc.inputText', 'gpc.inputRadio', 'gpc.categorySelector', 'gpc.googleTranslate')); |
---|
219 | |
---|
220 | $template->set_filename('body_page', |
---|
221 | dirname($this->getFileLocation()).'/admin/amm_randompicconfig.tpl'); |
---|
222 | |
---|
223 | $datas=array( |
---|
224 | 'config' => array( |
---|
225 | 'infosName' => $this->config['amm_randompicture_showname'], |
---|
226 | 'infosComment' => $this->config['amm_randompicture_showcomment'], |
---|
227 | 'freqDelay' => $this->config['amm_randompicture_periodicchange'], |
---|
228 | 'selectMode' => $this->config['amm_randompicture_selectMode'], |
---|
229 | 'selectCat' => json_encode($this->config['amm_randompicture_selectCat']), |
---|
230 | 'blockHeight' => $this->config['amm_randompicture_height'], |
---|
231 | 'blockTitles' => array() |
---|
232 | ), |
---|
233 | 'selectedLang' => $user['language'], |
---|
234 | 'fromLang' => substr($user['language'],0,2), |
---|
235 | 'langs' => array() |
---|
236 | ); |
---|
237 | |
---|
238 | $lang=get_languages(); |
---|
239 | foreach($lang as $key => $val) |
---|
240 | { |
---|
241 | $datas['langs'][$key] = $val; |
---|
242 | $datas['config']['blockTitles'][$key] = isset($this->config['amm_randompicture_title'][$key])?base64_decode($this->config['amm_randompicture_title'][$key]):''; |
---|
243 | } |
---|
244 | |
---|
245 | $template->assign("datas", $datas); |
---|
246 | |
---|
247 | $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page'); |
---|
248 | $template->assign('pageNfo', l10n('g002_randompict_nfo')); |
---|
249 | } |
---|
250 | |
---|
251 | /** |
---|
252 | * display the personnal blocks management page |
---|
253 | */ |
---|
254 | private function displayPersonalisedBlockPage() |
---|
255 | { |
---|
256 | global $template, $user; |
---|
257 | |
---|
258 | GPCCore::addHeaderJS('jquery.ui', 'themes/default/js/ui/minified/jquery.ui.core.min.js', array('jquery')); |
---|
259 | GPCCore::addHeaderJS('jquery.ui.dialog', 'themes/default/js/ui/minified/jquery.ui.dialog.min.js', array('jquery')); |
---|
260 | GPCCore::addUI('inputList,inputText,inputRadio,googleTranslate'); |
---|
261 | GPCCore::addHeaderJS('amm.upbm', 'plugins/AMenuManager/js/amm_personalisedBlocks'.GPCCore::getMinified().'.js', array('jquery', 'gpc.inputList', 'gpc.inputText', 'gpc.inputRadio', 'gpc.googleTranslate')); |
---|
262 | |
---|
263 | |
---|
264 | $template->set_filename('body_page', |
---|
265 | dirname($this->getFileLocation()).'/admin/amm_personalised.tpl'); |
---|
266 | |
---|
267 | $datas=array( |
---|
268 | 'selectedLang' => $user['language'], |
---|
269 | 'fromLang' => substr($user['language'],0,2), |
---|
270 | 'langs' => get_languages() |
---|
271 | ); |
---|
272 | |
---|
273 | $template->assign("datas", $datas); |
---|
274 | |
---|
275 | $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page'); |
---|
276 | $template->assign('pageNfo', l10n('g002_personnalblock_nfo')); |
---|
277 | } |
---|
278 | |
---|
279 | /** |
---|
280 | * display the core blocks menu management page |
---|
281 | */ |
---|
282 | private function displayBlocksPage($tab) |
---|
283 | { |
---|
284 | global $template, $conf; |
---|
285 | |
---|
286 | GPCCore::addHeaderJS('jquery.ui', 'themes/default/js/ui/minified/jquery.ui.core.min.js', array('jquery')); |
---|
287 | GPCCore::addHeaderJS('jquery.ui.sortable', 'themes/default/js/ui/minified/jquery.ui.sortable.min.js', array('jquery.ui')); |
---|
288 | GPCCore::addUI('inputList'); |
---|
289 | GPCCore::addHeaderJS('amm.cbm', 'plugins/AMenuManager/js/amm_blocks'.GPCCore::getMinified().'.js', array('jquery', 'jquery.ui.sortable', 'gpc.inputList')); |
---|
290 | |
---|
291 | $template->set_filename('body_page', |
---|
292 | dirname($this->getFileLocation()).'/admin/amm_coreBlocks.tpl'); |
---|
293 | |
---|
294 | $blocksTabsheet = new GPCTabSheet('blocksTabsheet', $this->tabsheet->get_titlename(), 'tabsheet2 gcBorder2', 'itab2'); |
---|
295 | $blocksTabsheet->add('position', |
---|
296 | l10n('g002_setting_blocks_position'), |
---|
297 | '', false, "cbm.displayTabContent('position');"); |
---|
298 | $blocksTabsheet->add('config', |
---|
299 | l10n('g002_setting_core_blocks_content'), |
---|
300 | '', false, "cbm.displayTabContent('blocksContent');"); |
---|
301 | $blocksTabsheet->select($tab); |
---|
302 | $blocksTabsheet->assign(); |
---|
303 | |
---|
304 | |
---|
305 | $users=new GPCUsers(); |
---|
306 | $groups=new GPCGroups(); |
---|
307 | |
---|
308 | $this->sortCoreBlocksItems(); |
---|
309 | |
---|
310 | foreach($this->config['amm_blocks_items'] as $menuId=>$menu) |
---|
311 | { |
---|
312 | $this->config['amm_blocks_items'][$menuId]['visibilityForm'] = $this->makeBlockVisibility($menu['visibility'], $menuId); |
---|
313 | $this->config['amm_blocks_items'][$menuId]['translation']=$this->defaultMenus[$menuId]['translation']; |
---|
314 | $this->defaultMenus[$menuId]['visibilityForm'] = $this->makeBlockVisibility("/", $menuId); |
---|
315 | } |
---|
316 | |
---|
317 | $registeredBlocks=$this->getRegisteredBlocks(); |
---|
318 | foreach($registeredBlocks as $key=>$val) |
---|
319 | { |
---|
320 | $registeredBlocks[$key]['users']=json_encode($registeredBlocks[$key]['users']); |
---|
321 | $registeredBlocks[$key]['groups']=json_encode($registeredBlocks[$key]['groups']); |
---|
322 | } |
---|
323 | |
---|
324 | $datas=array( |
---|
325 | 'tab' => $tab, |
---|
326 | 'users' => $users->getList(), |
---|
327 | 'groups' => $groups->getList(), |
---|
328 | 'coreBlocks' => array( |
---|
329 | 'blocks' => $this->blocksId, |
---|
330 | 'defaultValues' => $this->defaultMenus, |
---|
331 | 'items' => $this->config['amm_blocks_items'] |
---|
332 | ), |
---|
333 | 'menuBlocks' => $registeredBlocks |
---|
334 | ); |
---|
335 | |
---|
336 | $template->assign("datas", $datas); |
---|
337 | |
---|
338 | $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page'); |
---|
339 | $template->assign('pageNfo', l10n('g002_setmenu_nfo')); |
---|
340 | } |
---|
341 | |
---|
342 | |
---|
343 | |
---|
344 | /** |
---|
345 | * display the album to menu management page |
---|
346 | */ |
---|
347 | private function displayAlbumPage() |
---|
348 | { |
---|
349 | global $template, $user; |
---|
350 | |
---|
351 | GPCCore::addHeaderCSS('gpc.categorySelector', 'plugins/GrumPluginClasses/css/categorySelector_'.$template->get_themeconf('name').'.css'); |
---|
352 | GPCCore::addHeaderJS('jquery.ui', 'themes/default/js/ui/minified/jquery.ui.core.min.js', array('jquery')); |
---|
353 | GPCCore::addHeaderJS('gpc.categorySelector', 'plugins/GrumPluginClasses/js/ui.categorySelector'.GPCCore::getMinified().'.js', array('jquery.ui')); |
---|
354 | GPCCore::addHeaderJS('amm.ac', 'plugins/AMenuManager/js/amm_albumConfig'.GPCCore::getMinified().'.js', array('jquery','gpc.categorySelector')); |
---|
355 | |
---|
356 | $template->set_filename('body_page', |
---|
357 | dirname($this->getFileLocation()).'/admin/amm_album.tpl'); |
---|
358 | |
---|
359 | $datas=array( |
---|
360 | 'albums' => json_encode($this->config['amm_albums_to_menu']) |
---|
361 | ); |
---|
362 | |
---|
363 | $template->assign("datas", $datas); |
---|
364 | |
---|
365 | $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page'); |
---|
366 | $template->assign('pageNfo', l10n('g002_album_nfo')); |
---|
367 | } |
---|
368 | |
---|
369 | |
---|
370 | /* |
---|
371 | * --------------------------------------------------------------------------- |
---|
372 | * links functionnalities |
---|
373 | * --------------------------------------------------------------------------- |
---|
374 | */ |
---|
375 | |
---|
376 | /** |
---|
377 | * display the links management page |
---|
378 | */ |
---|
379 | private function displayLinksPageLinks() |
---|
380 | { |
---|
381 | global $template, $user; |
---|
382 | |
---|
383 | GPCCore::addUI('inputList,inputRadio,inputText,inputCheckbox'); |
---|
384 | GPCCore::addHeaderJS('amm.ulm', 'plugins/AMenuManager/js/amm_links'.GPCCore::getMinified().'.js', array('jquery', 'gpc.inputList', 'gpc.inputText', 'gpc.inputRadio', 'gpc.inputCheckbox')); |
---|
385 | |
---|
386 | $template->set_filename('sheet_page', |
---|
387 | dirname($this->getFileLocation()).'/admin/amm_linkslinks.tpl'); |
---|
388 | |
---|
389 | $users=new GPCUsers(); |
---|
390 | $groups=new GPCGroups(); |
---|
391 | |
---|
392 | $datas=array( |
---|
393 | 'access' => array('users' => $users->getList(), 'groups' => $groups->getList()), |
---|
394 | 'iconsValues' => array(), |
---|
395 | 'modesValues' => array( |
---|
396 | array( |
---|
397 | 'value' => 0, |
---|
398 | 'label' => l10n("g002_mode_".$this->urlsModes[0]) |
---|
399 | ), |
---|
400 | array( |
---|
401 | 'value' => 1, |
---|
402 | 'label' => l10n("g002_mode_".$this->urlsModes[1]) |
---|
403 | ) |
---|
404 | ) |
---|
405 | ); |
---|
406 | |
---|
407 | $directory=dir(dirname($this->getFileLocation()).'/links_pictures/'); |
---|
408 | while($file=$directory->read()) |
---|
409 | { |
---|
410 | if(in_array(get_extension(strtolower($file)), array('jpg', 'jpeg','gif','png'))) |
---|
411 | { |
---|
412 | $datas['iconsValues'][] = array( |
---|
413 | 'img' => AMM_PATH."links_pictures/".$file, |
---|
414 | 'value' => $file, |
---|
415 | 'label' => $file |
---|
416 | ); |
---|
417 | } |
---|
418 | } |
---|
419 | |
---|
420 | $template->assign("datas", $datas); |
---|
421 | |
---|
422 | return($template->parse('sheet_page', true)); |
---|
423 | } |
---|
424 | |
---|
425 | /** |
---|
426 | * display the links config page |
---|
427 | */ |
---|
428 | private function displayLinksPageConfig() |
---|
429 | { |
---|
430 | global $template, $user; |
---|
431 | |
---|
432 | GPCCore::addUI('inputList,inputRadio,inputText,googleTranslate'); |
---|
433 | GPCCore::addHeaderJS('amm.ulc', 'plugins/AMenuManager/js/amm_linksConfig'.GPCCore::getMinified().'.js', array('jquery', 'gpc.inputList', 'gpc.inputText', 'gpc.inputRadio', 'gpc.googleTranslate')); |
---|
434 | |
---|
435 | $template->set_filename('sheet_page', |
---|
436 | dirname($this->getFileLocation()).'/admin/amm_linksconfig.tpl'); |
---|
437 | |
---|
438 | $datas=array( |
---|
439 | 'config' => array( |
---|
440 | 'showIcons' => $this->config['amm_links_show_icons'], |
---|
441 | 'titles' => array() |
---|
442 | ), |
---|
443 | 'selectedLang' => $user['language'], |
---|
444 | 'fromLang' => substr($user['language'],0,2), |
---|
445 | 'langs' => array() |
---|
446 | ); |
---|
447 | |
---|
448 | $lang=get_languages(); |
---|
449 | foreach($lang as $key => $val) |
---|
450 | { |
---|
451 | $datas['langs'][$key] = $val; |
---|
452 | $datas['config']['titles'][$key] = isset($this->config['amm_links_title'][$key])?base64_decode($this->config['amm_links_title'][$key]):''; |
---|
453 | } |
---|
454 | |
---|
455 | $template->assign("datas", $datas); |
---|
456 | return($template->parse('sheet_page', true)); |
---|
457 | } |
---|
458 | |
---|
459 | |
---|
460 | |
---|
461 | /* |
---|
462 | * --------------------------------------------------------------------------- |
---|
463 | * blocks functionnalities |
---|
464 | * --------------------------------------------------------------------------- |
---|
465 | */ |
---|
466 | |
---|
467 | /** |
---|
468 | * this function returns an HTML FORM to use with each menu items |
---|
469 | * |
---|
470 | * @param String $visibility : a formatted string like : |
---|
471 | * users type1(,users typeX)/(groupId0)(,groupIdX) |
---|
472 | * @param String $blockId : block Id |
---|
473 | * @return String : html ready to use |
---|
474 | */ |
---|
475 | private function makeBlockVisibility($visibility, $menuId) |
---|
476 | { |
---|
477 | $local_tpl = new Template(AMM_PATH."admin/", ""); |
---|
478 | $local_tpl->set_filename('body_page', |
---|
479 | dirname($this->getFileLocation()).'/admin/amm_coreBlocks_detail.tpl'); |
---|
480 | |
---|
481 | |
---|
482 | $parameters=explode("/", $visibility); |
---|
483 | |
---|
484 | /* submenu access system is : |
---|
485 | * - by default, everything is accesible |
---|
486 | * - items not accessible are defined |
---|
487 | */ |
---|
488 | $users=new GPCUsers(); |
---|
489 | $users->setAlloweds(explode(',', $parameters[0]), false); |
---|
490 | $groups=new GPCGroups(); |
---|
491 | $groups->setAlloweds(explode(',', $parameters[1]), false); |
---|
492 | |
---|
493 | $local_tpl->assign('name', $menuId); |
---|
494 | $local_tpl->assign('users', $users->getList()); |
---|
495 | $local_tpl->assign('groups', $groups->getList()); |
---|
496 | |
---|
497 | return($local_tpl->parse('body_page', true)); |
---|
498 | } |
---|
499 | |
---|
500 | |
---|
501 | } // AMM_AIP class |
---|
502 | |
---|
503 | ?> |
---|