|
1 | | -<?php |
2 | | -/*********************************************** |
3 | | -* File : picture.inc.php |
4 | | -* Project : piwigo-openstreetmap |
5 | | -* Descr : Display map on right panel |
6 | | -* |
7 | | -* Created : 20.08.2014 |
8 | | -* |
9 | | -* Copyright 2013-2014 <xbgmsharp@gmail.com> |
10 | | -* |
11 | | -* This program is free software: you can redistribute it and/or modify |
12 | | -* it under the terms of the GNU General Public License as published by |
13 | | -* the Free Software Foundation, either version 3 of the License, or |
14 | | -* (at your option) any later version. |
15 | | -* |
16 | | -* This program is distributed in the hope that it will be useful, |
17 | | -* but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 | | -* GNU General Public License for more details. |
20 | | -* |
21 | | -* You should have received a copy of the GNU General Public License |
22 | | -* along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | | -* |
24 | | -************************************************/ |
25 | | - |
26 | | -// Chech whether we are indeed included by Piwigo. |
27 | | -if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
28 | | - |
29 | | -if ($conf['osm_conf']['main_menu']['enabled']) |
30 | | -{ |
31 | | - add_event_handler('blockmanager_register_blocks', 'osm_register_menu'); |
32 | | - add_event_handler('blockmanager_apply', 'osm_apply_menu'); |
33 | | -} |
34 | | -function osm_register_menu( $menu_ref_arr ) |
35 | | -{ |
36 | | - $menu = & $menu_ref_arr[0]; |
37 | | - if ($menu->get_id() != 'menubar') |
38 | | - return; |
39 | | - $menu->register_block( new RegisteredBlock( 'mbAbout', 'About', 'A1M')); |
40 | | -} |
41 | | - |
42 | | -function osm_apply_menu($menu_ref_arr) |
43 | | -{ |
44 | | - global $template, $page, $conf; |
45 | | - |
46 | | - $menu = & $menu_ref_arr[0]; |
47 | | - |
48 | | - if (($block = $menu->get_block('mbLinks')) != null) { |
49 | | - include_once( dirname(__FILE__) .'/include/functions.php'); |
50 | | - include_once(dirname(__FILE__).'/include/functions_map.php'); |
51 | | - osm_load_language(); |
52 | | - load_language('plugin.lang', OSM_PATH); |
53 | | - |
54 | | - #comment are used only with this condition index.php l294 |
55 | | - if ($page['start']==0 and !isset($page['chronology_field']) ) |
56 | | - { |
57 | | - $js_data = osm_get_items($page); |
58 | | - if ($js_data != array()) |
59 | | - { |
60 | | - $local_conf = array(); |
61 | | - $local_conf['pinid'] = 1; |
62 | | - $local_conf['contextmenu'] = 'false'; |
63 | | - $local_conf['available_pin'] = ''; |
64 | | - $local_conf['control'] = false; |
65 | | - $local_conf['img_popup'] = false; |
66 | | - $local_conf['popup'] = 2; |
67 | | - $local_conf['center_lat'] = 0; |
68 | | - $local_conf['center_lng'] = 0; |
69 | | - $local_conf['zoom'] = 2; |
70 | | - $local_conf['auto_center'] = 0; |
71 | | - $local_conf['divname'] = 'mapmenu'; |
72 | | - $local_conf['paths'] = osm_get_gps($page); |
73 | | - $height = isset($conf['osm_conf']['main_menu']['height']) ? $conf['osm_conf']['main_menu']['height'] : '200'; |
74 | | - $js = osm_get_js($conf, $local_conf, $js_data); |
75 | | - $template->set_template_dir(dirname(__FILE__).'/template/'); |
76 | | - $template->assign( |
77 | | - array( |
78 | | - 'OSM_PATH' => embellish_url(get_absolute_root_url().OSM_PATH), |
79 | | - 'OSMJS' => $js, |
80 | | - 'HEIGHT' => $height, |
81 | | - ) |
82 | | - ); |
83 | | - $block->template = 'osm-menu.tpl'; |
84 | | - } |
85 | | - } |
86 | | - } |
87 | | -} |
88 | | -?> |
| 1 | +<?php |
| 2 | +/*********************************************** |
| 3 | +* File : menu.inc.php |
| 4 | +* Project : piwigo-openstreetmap |
| 5 | +* Descr : Display an OSM map on mainmenu right |
| 6 | +* |
| 7 | +* Created : 10.10.2014 |
| 8 | +* |
| 9 | +* Copyright 2013-2014 <xbgmsharp@gmail.com> |
| 10 | +* |
| 11 | +* This program is free software: you can redistribute it and/or modify |
| 12 | +* it under the terms of the GNU General Public License as published by |
| 13 | +* the Free Software Foundation, either version 3 of the License, or |
| 14 | +* (at your option) any later version. |
| 15 | +* |
| 16 | +* This program is distributed in the hope that it will be useful, |
| 17 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | +* GNU General Public License for more details. |
| 20 | +* |
| 21 | +* You should have received a copy of the GNU General Public License |
| 22 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | +* |
| 24 | +************************************************/ |
| 25 | + |
| 26 | +// Chech whether we are indeed included by Piwigo. |
| 27 | +if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
| 28 | + |
| 29 | +if ($conf['osm_conf']['main_menu']['enabled']) |
| 30 | +{ |
| 31 | + add_event_handler('blockmanager_register_blocks', 'osm_register_menu'); |
| 32 | + add_event_handler('blockmanager_apply', 'osm_apply_menu'); |
| 33 | +} |
| 34 | +function osm_register_menu( $menu_ref_arr ) |
| 35 | +{ |
| 36 | + $menu = & $menu_ref_arr[0]; |
| 37 | + if ($menu->get_id() != 'menubar') |
| 38 | + return; |
| 39 | + $menu->register_block( new RegisteredBlock( 'mbAbout', 'About', 'A1M')); |
| 40 | +} |
| 41 | + |
| 42 | +function osm_apply_menu($menu_ref_arr) |
| 43 | +{ |
| 44 | + global $template, $page, $conf; |
| 45 | + |
| 46 | + $menu = & $menu_ref_arr[0]; |
| 47 | + |
| 48 | + if (($block = $menu->get_block('mbLinks')) != null) { |
| 49 | + include_once( dirname(__FILE__) .'/include/functions.php'); |
| 50 | + include_once(dirname(__FILE__).'/include/functions_map.php'); |
| 51 | + osm_load_language(); |
| 52 | + load_language('plugin.lang', OSM_PATH); |
| 53 | + |
| 54 | + #comment are used only with this condition index.php l294 |
| 55 | + if ($page['start']==0 and !isset($page['chronology_field']) ) |
| 56 | + { |
| 57 | + $js_data = osm_get_items($page); |
| 58 | + if ($js_data != array()) |
| 59 | + { |
| 60 | + $local_conf = array(); |
| 61 | + $local_conf['pinid'] = 1; |
| 62 | + $local_conf['contextmenu'] = 'false'; |
| 63 | + $local_conf['available_pin'] = ''; |
| 64 | + $local_conf['control'] = false; |
| 65 | + $local_conf['img_popup'] = false; |
| 66 | + $local_conf['popup'] = 2; |
| 67 | + $local_conf['center_lat'] = 0; |
| 68 | + $local_conf['center_lng'] = 0; |
| 69 | + $local_conf['zoom'] = 2; |
| 70 | + $local_conf['auto_center'] = 0; |
| 71 | + $local_conf['divname'] = 'mapmenu'; |
| 72 | + $local_conf['paths'] = osm_get_gps($page); |
| 73 | + $height = isset($conf['osm_conf']['main_menu']['height']) ? $conf['osm_conf']['main_menu']['height'] : '200'; |
| 74 | + $js = osm_get_js($conf, $local_conf, $js_data); |
| 75 | + $template->set_template_dir(dirname(__FILE__).'/template/'); |
| 76 | + $template->assign( |
| 77 | + array( |
| 78 | + 'OSM_PATH' => embellish_url(get_absolute_root_url().OSM_PATH), |
| 79 | + 'OSMJS' => $js, |
| 80 | + 'HEIGHT' => $height, |
| 81 | + ) |
| 82 | + ); |
| 83 | + $block->template = 'osm-menu.tpl'; |
| 84 | + } |
| 85 | + } |
| 86 | + } |
| 87 | +} |
| 88 | +?> |
0 commit comments