@@ -23,42 +23,42 @@ |
||
23 | 23 | * Class ChangeReportModule |
24 | 24 | */ |
25 | 25 | class ChangeReportModule extends AbstractModule implements ModuleReportInterface { |
26 | - /** {@inheritdoc} */ |
|
27 | - public function getTitle() { |
|
28 | - // This text also appears in the .XML file - update both together |
|
29 | - return /* I18N: Name of a module/report */ I18N::translate('Changes'); |
|
30 | - } |
|
26 | + /** {@inheritdoc} */ |
|
27 | + public function getTitle() { |
|
28 | + // This text also appears in the .XML file - update both together |
|
29 | + return /* I18N: Name of a module/report */ I18N::translate('Changes'); |
|
30 | + } |
|
31 | 31 | |
32 | - /** {@inheritdoc} */ |
|
33 | - public function getDescription() { |
|
34 | - // This text also appears in the .XML file - update both together |
|
35 | - return /* I18N: Description of the “Changes” module */ I18N::translate('A report of recent and pending changes.'); |
|
36 | - } |
|
32 | + /** {@inheritdoc} */ |
|
33 | + public function getDescription() { |
|
34 | + // This text also appears in the .XML file - update both together |
|
35 | + return /* I18N: Description of the “Changes” module */ I18N::translate('A report of recent and pending changes.'); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * What is the default access level for this module? |
|
40 | - * |
|
41 | - * Some modules are aimed at admins or managers, and are not generally shown to users. |
|
42 | - * |
|
43 | - * @return int |
|
44 | - */ |
|
45 | - public function defaultAccessLevel() { |
|
46 | - return Auth::PRIV_USER; |
|
47 | - } |
|
38 | + /** |
|
39 | + * What is the default access level for this module? |
|
40 | + * |
|
41 | + * Some modules are aimed at admins or managers, and are not generally shown to users. |
|
42 | + * |
|
43 | + * @return int |
|
44 | + */ |
|
45 | + public function defaultAccessLevel() { |
|
46 | + return Auth::PRIV_USER; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Return a menu item for this report. |
|
51 | - * |
|
52 | - * @return Menu |
|
53 | - */ |
|
54 | - public function getReportMenu() { |
|
55 | - global $WT_TREE; |
|
49 | + /** |
|
50 | + * Return a menu item for this report. |
|
51 | + * |
|
52 | + * @return Menu |
|
53 | + */ |
|
54 | + public function getReportMenu() { |
|
55 | + global $WT_TREE; |
|
56 | 56 | |
57 | - return new Menu( |
|
58 | - $this->getTitle(), |
|
59 | - 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml', |
|
60 | - 'menu-report-' . $this->getName(), |
|
61 | - array('rel' => 'nofollow') |
|
62 | - ); |
|
63 | - } |
|
57 | + return new Menu( |
|
58 | + $this->getTitle(), |
|
59 | + 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml', |
|
60 | + 'menu-report-' . $this->getName(), |
|
61 | + array('rel' => 'nofollow') |
|
62 | + ); |
|
63 | + } |
|
64 | 64 | } |
@@ -22,15 +22,18 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Class ChangeReportModule |
24 | 24 | */ |
25 | -class ChangeReportModule extends AbstractModule implements ModuleReportInterface { |
|
25 | +class ChangeReportModule extends AbstractModule implements ModuleReportInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritdoc} */ |
27 | - public function getTitle() { |
|
28 | + public function getTitle() |
|
29 | + { |
|
28 | 30 | // This text also appears in the .XML file - update both together |
29 | 31 | return /* I18N: Name of a module/report */ I18N::translate('Changes'); |
30 | 32 | } |
31 | 33 | |
32 | 34 | /** {@inheritdoc} */ |
33 | - public function getDescription() { |
|
35 | + public function getDescription() |
|
36 | + { |
|
34 | 37 | // This text also appears in the .XML file - update both together |
35 | 38 | return /* I18N: Description of the “Changes” module */ I18N::translate('A report of recent and pending changes.'); |
36 | 39 | } |
@@ -42,7 +45,8 @@ discard block |
||
42 | 45 | * |
43 | 46 | * @return int |
44 | 47 | */ |
45 | - public function defaultAccessLevel() { |
|
48 | + public function defaultAccessLevel() |
|
49 | + { |
|
46 | 50 | return Auth::PRIV_USER; |
47 | 51 | } |
48 | 52 | |
@@ -51,7 +55,8 @@ discard block |
||
51 | 55 | * |
52 | 56 | * @return Menu |
53 | 57 | */ |
54 | - public function getReportMenu() { |
|
58 | + public function getReportMenu() |
|
59 | + { |
|
55 | 60 | global $WT_TREE; |
56 | 61 | |
57 | 62 | return new Menu( |
@@ -26,42 +26,42 @@ discard block |
||
26 | 26 | * Class NotesTabModule |
27 | 27 | */ |
28 | 28 | class NotesTabModule extends AbstractModule implements ModuleTabInterface { |
29 | - /** @var Fact[] A list facts for this note. */ |
|
30 | - private $facts; |
|
31 | - |
|
32 | - /** {@inheritdoc} */ |
|
33 | - public function getTitle() { |
|
34 | - return /* I18N: Name of a module */ I18N::translate('Notes'); |
|
35 | - } |
|
36 | - |
|
37 | - /** {@inheritdoc} */ |
|
38 | - public function getDescription() { |
|
39 | - return /* I18N: Description of the “Notes” module */ I18N::translate('A tab showing the notes attached to an individual.'); |
|
40 | - } |
|
41 | - |
|
42 | - /** {@inheritdoc} */ |
|
43 | - public function defaultTabOrder() { |
|
44 | - return 40; |
|
45 | - } |
|
46 | - |
|
47 | - /** {@inheritdoc} */ |
|
48 | - public function hasTabContent() { |
|
49 | - global $WT_TREE; |
|
50 | - |
|
51 | - return Auth::isEditor($WT_TREE) || $this->getFactsWithNotes(); |
|
52 | - } |
|
53 | - |
|
54 | - /** {@inheritdoc} */ |
|
55 | - public function isGrayedOut() { |
|
56 | - return !$this->getFactsWithNotes(); |
|
57 | - } |
|
58 | - |
|
59 | - /** {@inheritdoc} */ |
|
60 | - public function getTabContent() { |
|
61 | - global $controller; |
|
62 | - |
|
63 | - ob_start(); |
|
64 | - ?> |
|
29 | + /** @var Fact[] A list facts for this note. */ |
|
30 | + private $facts; |
|
31 | + |
|
32 | + /** {@inheritdoc} */ |
|
33 | + public function getTitle() { |
|
34 | + return /* I18N: Name of a module */ I18N::translate('Notes'); |
|
35 | + } |
|
36 | + |
|
37 | + /** {@inheritdoc} */ |
|
38 | + public function getDescription() { |
|
39 | + return /* I18N: Description of the “Notes” module */ I18N::translate('A tab showing the notes attached to an individual.'); |
|
40 | + } |
|
41 | + |
|
42 | + /** {@inheritdoc} */ |
|
43 | + public function defaultTabOrder() { |
|
44 | + return 40; |
|
45 | + } |
|
46 | + |
|
47 | + /** {@inheritdoc} */ |
|
48 | + public function hasTabContent() { |
|
49 | + global $WT_TREE; |
|
50 | + |
|
51 | + return Auth::isEditor($WT_TREE) || $this->getFactsWithNotes(); |
|
52 | + } |
|
53 | + |
|
54 | + /** {@inheritdoc} */ |
|
55 | + public function isGrayedOut() { |
|
56 | + return !$this->getFactsWithNotes(); |
|
57 | + } |
|
58 | + |
|
59 | + /** {@inheritdoc} */ |
|
60 | + public function getTabContent() { |
|
61 | + global $controller; |
|
62 | + |
|
63 | + ob_start(); |
|
64 | + ?> |
|
65 | 65 | <table class="facts_table"> |
66 | 66 | <colgroup> |
67 | 67 | <col class="width20"> |
@@ -77,22 +77,22 @@ discard block |
||
77 | 77 | </tr> |
78 | 78 | |
79 | 79 | <?php |
80 | - foreach ($this->getFactsWithNotes() as $fact) { |
|
81 | - if ($fact->getTag() == 'NOTE') { |
|
82 | - FunctionsPrintFacts::printMainNotes($fact, 1); |
|
83 | - } else { |
|
84 | - for ($i = 2; $i < 4; ++$i) { |
|
85 | - FunctionsPrintFacts::printMainNotes($fact, $i); |
|
86 | - } |
|
87 | - } |
|
88 | - } |
|
89 | - if (!$this->getFactsWithNotes()) { |
|
90 | - echo '<tr><td id="no_tab4" colspan="2" class="facts_value">', I18N::translate('There are no notes for this individual.'), '</td></tr>'; |
|
91 | - } |
|
92 | - |
|
93 | - // New note link |
|
94 | - if ($controller->record->canEdit()) { |
|
95 | - ?> |
|
80 | + foreach ($this->getFactsWithNotes() as $fact) { |
|
81 | + if ($fact->getTag() == 'NOTE') { |
|
82 | + FunctionsPrintFacts::printMainNotes($fact, 1); |
|
83 | + } else { |
|
84 | + for ($i = 2; $i < 4; ++$i) { |
|
85 | + FunctionsPrintFacts::printMainNotes($fact, $i); |
|
86 | + } |
|
87 | + } |
|
88 | + } |
|
89 | + if (!$this->getFactsWithNotes()) { |
|
90 | + echo '<tr><td id="no_tab4" colspan="2" class="facts_value">', I18N::translate('There are no notes for this individual.'), '</td></tr>'; |
|
91 | + } |
|
92 | + |
|
93 | + // New note link |
|
94 | + if ($controller->record->canEdit()) { |
|
95 | + ?> |
|
96 | 96 | <tr class="noprint"> |
97 | 97 | <td class="facts_label"> |
98 | 98 | <?php echo GedcomTag::getLabel('NOTE'); ?> |
@@ -114,53 +114,53 @@ discard block |
||
114 | 114 | </td> |
115 | 115 | </tr> |
116 | 116 | <?php |
117 | - } |
|
118 | - ?> |
|
117 | + } |
|
118 | + ?> |
|
119 | 119 | </table> |
120 | 120 | <script> |
121 | 121 | persistent_toggle("show-level-2-notes", ".row_note2"); |
122 | 122 | </script> |
123 | 123 | <?php |
124 | 124 | |
125 | - return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; |
|
126 | - } |
|
127 | - |
|
128 | - /** |
|
129 | - * Get all the facts for an individual which contain notes. |
|
130 | - * |
|
131 | - * @return Fact[] |
|
132 | - */ |
|
133 | - private function getFactsWithNotes() { |
|
134 | - global $controller; |
|
135 | - |
|
136 | - if ($this->facts === null) { |
|
137 | - $facts = $controller->record->getFacts(); |
|
138 | - foreach ($controller->record->getSpouseFamilies() as $family) { |
|
139 | - if ($family->canShow()) { |
|
140 | - foreach ($family->getFacts() as $fact) { |
|
141 | - $facts[] = $fact; |
|
142 | - } |
|
143 | - } |
|
144 | - } |
|
145 | - $this->facts = array(); |
|
146 | - foreach ($facts as $fact) { |
|
147 | - if (preg_match('/(?:^1|\n\d) NOTE/', $fact->getGedcom())) { |
|
148 | - $this->facts[] = $fact; |
|
149 | - } |
|
150 | - } |
|
151 | - Functions::sortFacts($this->facts); |
|
152 | - } |
|
153 | - |
|
154 | - return $this->facts; |
|
155 | - } |
|
156 | - |
|
157 | - /** {@inheritdoc} */ |
|
158 | - public function canLoadAjax() { |
|
159 | - return !Auth::isSearchEngine(); // Search engines cannot use AJAX |
|
160 | - } |
|
161 | - |
|
162 | - /** {@inheritdoc} */ |
|
163 | - public function getPreLoadContent() { |
|
164 | - return ''; |
|
165 | - } |
|
125 | + return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; |
|
126 | + } |
|
127 | + |
|
128 | + /** |
|
129 | + * Get all the facts for an individual which contain notes. |
|
130 | + * |
|
131 | + * @return Fact[] |
|
132 | + */ |
|
133 | + private function getFactsWithNotes() { |
|
134 | + global $controller; |
|
135 | + |
|
136 | + if ($this->facts === null) { |
|
137 | + $facts = $controller->record->getFacts(); |
|
138 | + foreach ($controller->record->getSpouseFamilies() as $family) { |
|
139 | + if ($family->canShow()) { |
|
140 | + foreach ($family->getFacts() as $fact) { |
|
141 | + $facts[] = $fact; |
|
142 | + } |
|
143 | + } |
|
144 | + } |
|
145 | + $this->facts = array(); |
|
146 | + foreach ($facts as $fact) { |
|
147 | + if (preg_match('/(?:^1|\n\d) NOTE/', $fact->getGedcom())) { |
|
148 | + $this->facts[] = $fact; |
|
149 | + } |
|
150 | + } |
|
151 | + Functions::sortFacts($this->facts); |
|
152 | + } |
|
153 | + |
|
154 | + return $this->facts; |
|
155 | + } |
|
156 | + |
|
157 | + /** {@inheritdoc} */ |
|
158 | + public function canLoadAjax() { |
|
159 | + return !Auth::isSearchEngine(); // Search engines cannot use AJAX |
|
160 | + } |
|
161 | + |
|
162 | + /** {@inheritdoc} */ |
|
163 | + public function getPreLoadContent() { |
|
164 | + return ''; |
|
165 | + } |
|
166 | 166 | } |
@@ -25,39 +25,46 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * Class NotesTabModule |
27 | 27 | */ |
28 | -class NotesTabModule extends AbstractModule implements ModuleTabInterface { |
|
28 | +class NotesTabModule extends AbstractModule implements ModuleTabInterface |
|
29 | +{ |
|
29 | 30 | /** @var Fact[] A list facts for this note. */ |
30 | 31 | private $facts; |
31 | 32 | |
32 | 33 | /** {@inheritdoc} */ |
33 | - public function getTitle() { |
|
34 | + public function getTitle() |
|
35 | + { |
|
34 | 36 | return /* I18N: Name of a module */ I18N::translate('Notes'); |
35 | 37 | } |
36 | 38 | |
37 | 39 | /** {@inheritdoc} */ |
38 | - public function getDescription() { |
|
40 | + public function getDescription() |
|
41 | + { |
|
39 | 42 | return /* I18N: Description of the “Notes” module */ I18N::translate('A tab showing the notes attached to an individual.'); |
40 | 43 | } |
41 | 44 | |
42 | 45 | /** {@inheritdoc} */ |
43 | - public function defaultTabOrder() { |
|
46 | + public function defaultTabOrder() |
|
47 | + { |
|
44 | 48 | return 40; |
45 | 49 | } |
46 | 50 | |
47 | 51 | /** {@inheritdoc} */ |
48 | - public function hasTabContent() { |
|
52 | + public function hasTabContent() |
|
53 | + { |
|
49 | 54 | global $WT_TREE; |
50 | 55 | |
51 | 56 | return Auth::isEditor($WT_TREE) || $this->getFactsWithNotes(); |
52 | 57 | } |
53 | 58 | |
54 | 59 | /** {@inheritdoc} */ |
55 | - public function isGrayedOut() { |
|
60 | + public function isGrayedOut() |
|
61 | + { |
|
56 | 62 | return !$this->getFactsWithNotes(); |
57 | 63 | } |
58 | 64 | |
59 | 65 | /** {@inheritdoc} */ |
60 | - public function getTabContent() { |
|
66 | + public function getTabContent() |
|
67 | + { |
|
61 | 68 | global $controller; |
62 | 69 | |
63 | 70 | ob_start(); |
@@ -130,7 +137,8 @@ discard block |
||
130 | 137 | * |
131 | 138 | * @return Fact[] |
132 | 139 | */ |
133 | - private function getFactsWithNotes() { |
|
140 | + private function getFactsWithNotes() |
|
141 | + { |
|
134 | 142 | global $controller; |
135 | 143 | |
136 | 144 | if ($this->facts === null) { |
@@ -155,12 +163,14 @@ discard block |
||
155 | 163 | } |
156 | 164 | |
157 | 165 | /** {@inheritdoc} */ |
158 | - public function canLoadAjax() { |
|
166 | + public function canLoadAjax() |
|
167 | + { |
|
159 | 168 | return !Auth::isSearchEngine(); // Search engines cannot use AJAX |
160 | 169 | } |
161 | 170 | |
162 | 171 | /** {@inheritdoc} */ |
163 | - public function getPreLoadContent() { |
|
172 | + public function getPreLoadContent() |
|
173 | + { |
|
164 | 174 | return ''; |
165 | 175 | } |
166 | 176 | } |
@@ -56,86 +56,86 @@ discard block |
||
56 | 56 | * Hence, use "Google Maps™ mapping service" where appropriate. |
57 | 57 | */ |
58 | 58 | class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, ModuleTabInterface, ModuleChartInterface { |
59 | - // How to update the database schema for this module |
|
60 | - const SCHEMA_TARGET_VERSION = 6; |
|
61 | - const SCHEMA_SETTING_NAME = 'GM_SCHEMA_VERSION'; |
|
62 | - const SCHEMA_MIGRATION_PREFIX = '\Fisharebest\Webtrees\Module\GoogleMaps\Schema'; |
|
63 | - |
|
64 | - /** @var Individual[] of ancestors of root person */ |
|
65 | - private $ancestors = array(); |
|
66 | - |
|
67 | - /** @var int Number of nodes in the chart */ |
|
68 | - private $treesize; |
|
69 | - |
|
70 | - /** {@inheritdoc} */ |
|
71 | - public function getTitle() { |
|
72 | - return /* I18N: The name of a module. Google Maps™ is a trademark. Do not translate it? http://en.wikipedia.org/wiki/Google_maps */ I18N::translate('Google Maps™'); |
|
73 | - } |
|
74 | - |
|
75 | - /** {@inheritdoc} */ |
|
76 | - public function getDescription() { |
|
77 | - return /* I18N: Description of the “Google Maps™” module */ I18N::translate('Show the location of places and events using the Google Maps™ mapping service.'); |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * This is a general purpose hook, allowing modules to respond to routes |
|
82 | - * of the form module.php?mod=FOO&mod_action=BAR |
|
83 | - * |
|
84 | - * @param string $mod_action |
|
85 | - */ |
|
86 | - public function modAction($mod_action) { |
|
87 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
88 | - |
|
89 | - switch ($mod_action) { |
|
90 | - case 'admin_config': |
|
91 | - $this->config(); |
|
92 | - break; |
|
93 | - case 'flags': |
|
94 | - $this->flags(); |
|
95 | - break; |
|
96 | - case 'pedigree_map': |
|
97 | - $this->pedigreeMap(); |
|
98 | - break; |
|
99 | - case 'admin_placecheck': |
|
100 | - $this->adminPlaceCheck(); |
|
101 | - break; |
|
102 | - case 'admin_places': |
|
103 | - $this->adminPlaces(); |
|
104 | - break; |
|
105 | - case 'places_edit': |
|
106 | - $this->placesEdit(); |
|
107 | - break; |
|
108 | - case 'wt_street_view': |
|
109 | - $this->wtStreetView(); |
|
110 | - break; |
|
111 | - default: |
|
112 | - http_response_code(404); |
|
113 | - break; |
|
114 | - } |
|
115 | - } |
|
116 | - |
|
117 | - /** {@inheritdoc} */ |
|
118 | - public function getConfigLink() { |
|
119 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
120 | - |
|
121 | - return 'module.php?mod=' . $this->getName() . '&mod_action=admin_config'; |
|
122 | - } |
|
123 | - |
|
124 | - /** {@inheritdoc} */ |
|
125 | - public function defaultTabOrder() { |
|
126 | - return 80; |
|
127 | - } |
|
128 | - |
|
129 | - /** {@inheritdoc} */ |
|
130 | - public function getPreLoadContent() { |
|
131 | - global $controller; |
|
132 | - |
|
133 | - $controller->addInlineJavascript(" |
|
59 | + // How to update the database schema for this module |
|
60 | + const SCHEMA_TARGET_VERSION = 6; |
|
61 | + const SCHEMA_SETTING_NAME = 'GM_SCHEMA_VERSION'; |
|
62 | + const SCHEMA_MIGRATION_PREFIX = '\Fisharebest\Webtrees\Module\GoogleMaps\Schema'; |
|
63 | + |
|
64 | + /** @var Individual[] of ancestors of root person */ |
|
65 | + private $ancestors = array(); |
|
66 | + |
|
67 | + /** @var int Number of nodes in the chart */ |
|
68 | + private $treesize; |
|
69 | + |
|
70 | + /** {@inheritdoc} */ |
|
71 | + public function getTitle() { |
|
72 | + return /* I18N: The name of a module. Google Maps™ is a trademark. Do not translate it? http://en.wikipedia.org/wiki/Google_maps */ I18N::translate('Google Maps™'); |
|
73 | + } |
|
74 | + |
|
75 | + /** {@inheritdoc} */ |
|
76 | + public function getDescription() { |
|
77 | + return /* I18N: Description of the “Google Maps™” module */ I18N::translate('Show the location of places and events using the Google Maps™ mapping service.'); |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * This is a general purpose hook, allowing modules to respond to routes |
|
82 | + * of the form module.php?mod=FOO&mod_action=BAR |
|
83 | + * |
|
84 | + * @param string $mod_action |
|
85 | + */ |
|
86 | + public function modAction($mod_action) { |
|
87 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
88 | + |
|
89 | + switch ($mod_action) { |
|
90 | + case 'admin_config': |
|
91 | + $this->config(); |
|
92 | + break; |
|
93 | + case 'flags': |
|
94 | + $this->flags(); |
|
95 | + break; |
|
96 | + case 'pedigree_map': |
|
97 | + $this->pedigreeMap(); |
|
98 | + break; |
|
99 | + case 'admin_placecheck': |
|
100 | + $this->adminPlaceCheck(); |
|
101 | + break; |
|
102 | + case 'admin_places': |
|
103 | + $this->adminPlaces(); |
|
104 | + break; |
|
105 | + case 'places_edit': |
|
106 | + $this->placesEdit(); |
|
107 | + break; |
|
108 | + case 'wt_street_view': |
|
109 | + $this->wtStreetView(); |
|
110 | + break; |
|
111 | + default: |
|
112 | + http_response_code(404); |
|
113 | + break; |
|
114 | + } |
|
115 | + } |
|
116 | + |
|
117 | + /** {@inheritdoc} */ |
|
118 | + public function getConfigLink() { |
|
119 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
120 | + |
|
121 | + return 'module.php?mod=' . $this->getName() . '&mod_action=admin_config'; |
|
122 | + } |
|
123 | + |
|
124 | + /** {@inheritdoc} */ |
|
125 | + public function defaultTabOrder() { |
|
126 | + return 80; |
|
127 | + } |
|
128 | + |
|
129 | + /** {@inheritdoc} */ |
|
130 | + public function getPreLoadContent() { |
|
131 | + global $controller; |
|
132 | + |
|
133 | + $controller->addInlineJavascript(" |
|
134 | 134 | jQuery('head').append('<link type=\"text/css\" href =\"" . WT_STATIC_URL . WT_MODULES_DIR . "googlemap/css/wt_v3_googlemap.css\" rel=\"stylesheet\">'); |
135 | 135 | "); |
136 | 136 | |
137 | - ob_start(); |
|
138 | - ?> |
|
137 | + ob_start(); |
|
138 | + ?> |
|
139 | 139 | <script src="<?php echo $this->googleMapsScript() ?>"></script> |
140 | 140 | <script> |
141 | 141 | var minZoomLevel = <?php echo $this->getSetting('GM_MIN_ZOOM') ?>; |
@@ -143,135 +143,135 @@ discard block |
||
143 | 143 | var startZoomLevel = maxZoomLevel; |
144 | 144 | </script> |
145 | 145 | <?php |
146 | - return ob_get_clean(); |
|
147 | - } |
|
148 | - |
|
149 | - /** {@inheritdoc} */ |
|
150 | - public function canLoadAjax() { |
|
151 | - return true; |
|
152 | - } |
|
153 | - |
|
154 | - /** {@inheritdoc} */ |
|
155 | - public function getTabContent() { |
|
156 | - global $controller; |
|
157 | - |
|
158 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
159 | - |
|
160 | - if ($this->checkMapData($controller->record)) { |
|
161 | - // This call can return an empty string if no facts with map co-ordinates exist |
|
162 | - $mapdata = $this->buildIndividualMap($controller->record); |
|
163 | - } else { |
|
164 | - $mapdata = ''; |
|
165 | - } |
|
166 | - if ($mapdata) { |
|
167 | - $html = '<div id="' . $this->getName() . '_content" class="facts_table">'; |
|
168 | - $html .= '<div class="gm-wrapper">'; |
|
169 | - $html .= '<div class="gm-map"></div>'; |
|
170 | - $html .= $mapdata; |
|
171 | - $html .= '</div>'; |
|
172 | - if (Auth::isAdmin()) { |
|
173 | - $html .= '<div class="gm-options noprint">'; |
|
174 | - $html .= '<a href="module.php?mod=' . $this->getName() . '&mod_action=admin_config">' . I18N::translate('Google Maps™ preferences') . '</a>'; |
|
175 | - $html .= ' | <a href="module.php?mod=' . $this->getName() . '&mod_action=admin_places">' . I18N::translate('Geographic data') . '</a>'; |
|
176 | - $html .= ' | <a href="module.php?mod=' . $this->getName() . '&mod_action=admin_placecheck">' . I18N::translate('Place check') . '</a>'; |
|
177 | - $html .= '</div>'; |
|
178 | - } |
|
179 | - $html .= '<script>loadMap();</script>'; |
|
180 | - $html .= '</div>'; |
|
181 | - } else { |
|
182 | - $html = '<div class="facts_value noprint">' . I18N::translate('No map data exists for this individual') . '</div>'; |
|
183 | - if (Auth::isAdmin()) { |
|
184 | - $html .= '<div style="text-align: center;"><a href="module.php?mod=googlemap&mod_action=admin_config">' . I18N::translate('Google Maps™ preferences') . '</a></div>'; |
|
185 | - } |
|
186 | - } |
|
187 | - |
|
188 | - return $html; |
|
189 | - } |
|
190 | - |
|
191 | - /** {@inheritdoc} */ |
|
192 | - public function hasTabContent() { |
|
193 | - return Module::getModuleByName('googlemap') || Auth::isAdmin(); |
|
194 | - } |
|
195 | - |
|
196 | - /** {@inheritdoc} */ |
|
197 | - public function isGrayedOut() { |
|
198 | - return false; |
|
199 | - } |
|
200 | - |
|
201 | - /** |
|
202 | - * Return a menu item for this chart. |
|
203 | - * |
|
204 | - * @param Individual $individual |
|
205 | - * |
|
206 | - * @return Menu |
|
207 | - */ |
|
208 | - public function getChartMenu(Individual $individual) { |
|
209 | - return new Menu( |
|
210 | - I18N::translate('Pedigree map'), |
|
211 | - 'module.php?mod=googlemap&mod_action=pedigree_map&rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), |
|
212 | - 'menu-chart-pedigree_map', |
|
213 | - array('rel' => 'nofollow') |
|
214 | - ); |
|
215 | - } |
|
216 | - |
|
217 | - /** |
|
218 | - * Return a menu item for this chart - for use in individual boxes. |
|
219 | - * |
|
220 | - * @param Individual $individual |
|
221 | - * |
|
222 | - * @return Menu |
|
223 | - */ |
|
224 | - public function getBoxChartMenu(Individual $individual) { |
|
225 | - return $this->getChartMenu($individual); |
|
226 | - } |
|
227 | - |
|
228 | - /** |
|
229 | - * A form to edit the module configuration. |
|
230 | - */ |
|
231 | - private function config() { |
|
232 | - $controller = new PageController; |
|
233 | - $controller |
|
234 | - ->restrictAccess(Auth::isAdmin()) |
|
235 | - ->setPageTitle(I18N::translate('Google Maps™')); |
|
236 | - |
|
237 | - if (Filter::post('action') === 'update') { |
|
238 | - $this->setSetting('GM_API_KEY', Filter::post('GM_API_KEY')); |
|
239 | - $this->setSetting('GM_MAP_TYPE', Filter::post('GM_MAP_TYPE')); |
|
240 | - $this->setSetting('GM_USE_STREETVIEW', Filter::post('GM_USE_STREETVIEW')); |
|
241 | - $this->setSetting('GM_MIN_ZOOM', Filter::post('GM_MIN_ZOOM')); |
|
242 | - $this->setSetting('GM_MAX_ZOOM', Filter::post('GM_MAX_ZOOM')); |
|
243 | - $this->setSetting('GM_PLACE_HIERARCHY', Filter::post('GM_PLACE_HIERARCHY')); |
|
244 | - $this->setSetting('GM_PH_XSIZE', Filter::post('GM_PH_XSIZE')); |
|
245 | - $this->setSetting('GM_PH_YSIZE', Filter::post('GM_PH_YSIZE')); |
|
246 | - $this->setSetting('GM_PH_MARKER', Filter::post('GM_PH_MARKER')); |
|
247 | - $this->setSetting('GM_PREFIX_1', Filter::post('GM_PREFIX_1')); |
|
248 | - $this->setSetting('GM_PREFIX_2', Filter::post('GM_PREFIX_2')); |
|
249 | - $this->setSetting('GM_PREFIX_3', Filter::post('GM_PREFIX_3')); |
|
250 | - $this->setSetting('GM_PREFIX_4', Filter::post('GM_PREFIX_4')); |
|
251 | - $this->setSetting('GM_PREFIX_5', Filter::post('GM_PREFIX_5')); |
|
252 | - $this->setSetting('GM_PREFIX_6', Filter::post('GM_PREFIX_6')); |
|
253 | - $this->setSetting('GM_PREFIX_7', Filter::post('GM_PREFIX_7')); |
|
254 | - $this->setSetting('GM_PREFIX_8', Filter::post('GM_PREFIX_8')); |
|
255 | - $this->setSetting('GM_PREFIX_9', Filter::post('GM_PREFIX_9')); |
|
256 | - $this->setSetting('GM_POSTFIX_1', Filter::post('GM_POSTFIX_1')); |
|
257 | - $this->setSetting('GM_POSTFIX_2', Filter::post('GM_POSTFIX_2')); |
|
258 | - $this->setSetting('GM_POSTFIX_3', Filter::post('GM_POSTFIX_3')); |
|
259 | - $this->setSetting('GM_POSTFIX_4', Filter::post('GM_POSTFIX_4')); |
|
260 | - $this->setSetting('GM_POSTFIX_5', Filter::post('GM_POSTFIX_5')); |
|
261 | - $this->setSetting('GM_POSTFIX_6', Filter::post('GM_POSTFIX_6')); |
|
262 | - $this->setSetting('GM_POSTFIX_7', Filter::post('GM_POSTFIX_7')); |
|
263 | - $this->setSetting('GM_POSTFIX_8', Filter::post('GM_POSTFIX_8')); |
|
264 | - $this->setSetting('GM_POSTFIX_9', Filter::post('GM_POSTFIX_9')); |
|
265 | - |
|
266 | - FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->getTitle()), 'success'); |
|
267 | - header('Location: ' . WT_BASE_URL . 'module.php?mod=googlemap&mod_action=admin_config'); |
|
268 | - |
|
269 | - return; |
|
270 | - } |
|
271 | - |
|
272 | - $controller->pageHeader(); |
|
273 | - |
|
274 | - ?> |
|
146 | + return ob_get_clean(); |
|
147 | + } |
|
148 | + |
|
149 | + /** {@inheritdoc} */ |
|
150 | + public function canLoadAjax() { |
|
151 | + return true; |
|
152 | + } |
|
153 | + |
|
154 | + /** {@inheritdoc} */ |
|
155 | + public function getTabContent() { |
|
156 | + global $controller; |
|
157 | + |
|
158 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
159 | + |
|
160 | + if ($this->checkMapData($controller->record)) { |
|
161 | + // This call can return an empty string if no facts with map co-ordinates exist |
|
162 | + $mapdata = $this->buildIndividualMap($controller->record); |
|
163 | + } else { |
|
164 | + $mapdata = ''; |
|
165 | + } |
|
166 | + if ($mapdata) { |
|
167 | + $html = '<div id="' . $this->getName() . '_content" class="facts_table">'; |
|
168 | + $html .= '<div class="gm-wrapper">'; |
|
169 | + $html .= '<div class="gm-map"></div>'; |
|
170 | + $html .= $mapdata; |
|
171 | + $html .= '</div>'; |
|
172 | + if (Auth::isAdmin()) { |
|
173 | + $html .= '<div class="gm-options noprint">'; |
|
174 | + $html .= '<a href="module.php?mod=' . $this->getName() . '&mod_action=admin_config">' . I18N::translate('Google Maps™ preferences') . '</a>'; |
|
175 | + $html .= ' | <a href="module.php?mod=' . $this->getName() . '&mod_action=admin_places">' . I18N::translate('Geographic data') . '</a>'; |
|
176 | + $html .= ' | <a href="module.php?mod=' . $this->getName() . '&mod_action=admin_placecheck">' . I18N::translate('Place check') . '</a>'; |
|
177 | + $html .= '</div>'; |
|
178 | + } |
|
179 | + $html .= '<script>loadMap();</script>'; |
|
180 | + $html .= '</div>'; |
|
181 | + } else { |
|
182 | + $html = '<div class="facts_value noprint">' . I18N::translate('No map data exists for this individual') . '</div>'; |
|
183 | + if (Auth::isAdmin()) { |
|
184 | + $html .= '<div style="text-align: center;"><a href="module.php?mod=googlemap&mod_action=admin_config">' . I18N::translate('Google Maps™ preferences') . '</a></div>'; |
|
185 | + } |
|
186 | + } |
|
187 | + |
|
188 | + return $html; |
|
189 | + } |
|
190 | + |
|
191 | + /** {@inheritdoc} */ |
|
192 | + public function hasTabContent() { |
|
193 | + return Module::getModuleByName('googlemap') || Auth::isAdmin(); |
|
194 | + } |
|
195 | + |
|
196 | + /** {@inheritdoc} */ |
|
197 | + public function isGrayedOut() { |
|
198 | + return false; |
|
199 | + } |
|
200 | + |
|
201 | + /** |
|
202 | + * Return a menu item for this chart. |
|
203 | + * |
|
204 | + * @param Individual $individual |
|
205 | + * |
|
206 | + * @return Menu |
|
207 | + */ |
|
208 | + public function getChartMenu(Individual $individual) { |
|
209 | + return new Menu( |
|
210 | + I18N::translate('Pedigree map'), |
|
211 | + 'module.php?mod=googlemap&mod_action=pedigree_map&rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), |
|
212 | + 'menu-chart-pedigree_map', |
|
213 | + array('rel' => 'nofollow') |
|
214 | + ); |
|
215 | + } |
|
216 | + |
|
217 | + /** |
|
218 | + * Return a menu item for this chart - for use in individual boxes. |
|
219 | + * |
|
220 | + * @param Individual $individual |
|
221 | + * |
|
222 | + * @return Menu |
|
223 | + */ |
|
224 | + public function getBoxChartMenu(Individual $individual) { |
|
225 | + return $this->getChartMenu($individual); |
|
226 | + } |
|
227 | + |
|
228 | + /** |
|
229 | + * A form to edit the module configuration. |
|
230 | + */ |
|
231 | + private function config() { |
|
232 | + $controller = new PageController; |
|
233 | + $controller |
|
234 | + ->restrictAccess(Auth::isAdmin()) |
|
235 | + ->setPageTitle(I18N::translate('Google Maps™')); |
|
236 | + |
|
237 | + if (Filter::post('action') === 'update') { |
|
238 | + $this->setSetting('GM_API_KEY', Filter::post('GM_API_KEY')); |
|
239 | + $this->setSetting('GM_MAP_TYPE', Filter::post('GM_MAP_TYPE')); |
|
240 | + $this->setSetting('GM_USE_STREETVIEW', Filter::post('GM_USE_STREETVIEW')); |
|
241 | + $this->setSetting('GM_MIN_ZOOM', Filter::post('GM_MIN_ZOOM')); |
|
242 | + $this->setSetting('GM_MAX_ZOOM', Filter::post('GM_MAX_ZOOM')); |
|
243 | + $this->setSetting('GM_PLACE_HIERARCHY', Filter::post('GM_PLACE_HIERARCHY')); |
|
244 | + $this->setSetting('GM_PH_XSIZE', Filter::post('GM_PH_XSIZE')); |
|
245 | + $this->setSetting('GM_PH_YSIZE', Filter::post('GM_PH_YSIZE')); |
|
246 | + $this->setSetting('GM_PH_MARKER', Filter::post('GM_PH_MARKER')); |
|
247 | + $this->setSetting('GM_PREFIX_1', Filter::post('GM_PREFIX_1')); |
|
248 | + $this->setSetting('GM_PREFIX_2', Filter::post('GM_PREFIX_2')); |
|
249 | + $this->setSetting('GM_PREFIX_3', Filter::post('GM_PREFIX_3')); |
|
250 | + $this->setSetting('GM_PREFIX_4', Filter::post('GM_PREFIX_4')); |
|
251 | + $this->setSetting('GM_PREFIX_5', Filter::post('GM_PREFIX_5')); |
|
252 | + $this->setSetting('GM_PREFIX_6', Filter::post('GM_PREFIX_6')); |
|
253 | + $this->setSetting('GM_PREFIX_7', Filter::post('GM_PREFIX_7')); |
|
254 | + $this->setSetting('GM_PREFIX_8', Filter::post('GM_PREFIX_8')); |
|
255 | + $this->setSetting('GM_PREFIX_9', Filter::post('GM_PREFIX_9')); |
|
256 | + $this->setSetting('GM_POSTFIX_1', Filter::post('GM_POSTFIX_1')); |
|
257 | + $this->setSetting('GM_POSTFIX_2', Filter::post('GM_POSTFIX_2')); |
|
258 | + $this->setSetting('GM_POSTFIX_3', Filter::post('GM_POSTFIX_3')); |
|
259 | + $this->setSetting('GM_POSTFIX_4', Filter::post('GM_POSTFIX_4')); |
|
260 | + $this->setSetting('GM_POSTFIX_5', Filter::post('GM_POSTFIX_5')); |
|
261 | + $this->setSetting('GM_POSTFIX_6', Filter::post('GM_POSTFIX_6')); |
|
262 | + $this->setSetting('GM_POSTFIX_7', Filter::post('GM_POSTFIX_7')); |
|
263 | + $this->setSetting('GM_POSTFIX_8', Filter::post('GM_POSTFIX_8')); |
|
264 | + $this->setSetting('GM_POSTFIX_9', Filter::post('GM_POSTFIX_9')); |
|
265 | + |
|
266 | + FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->getTitle()), 'success'); |
|
267 | + header('Location: ' . WT_BASE_URL . 'module.php?mod=googlemap&mod_action=admin_config'); |
|
268 | + |
|
269 | + return; |
|
270 | + } |
|
271 | + |
|
272 | + $controller->pageHeader(); |
|
273 | + |
|
274 | + ?> |
|
275 | 275 | <ol class="breadcrumb small"> |
276 | 276 | <li><a href="admin.php"><?php echo I18N::translate('Control panel') ?></a></li> |
277 | 277 | <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration') ?></a></li> |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | </label> |
323 | 323 | <div class="col-sm-9"> |
324 | 324 | <?php |
325 | - $options = array( |
|
326 | - 'ROADMAP' => I18N::translate('Map'), |
|
327 | - 'SATELLITE' => I18N::translate('Satellite'), |
|
328 | - 'HYBRID' => I18N::translate('Hybrid'), |
|
329 | - 'TERRAIN' => I18N::translate('Terrain'), |
|
330 | - ); |
|
331 | - echo FunctionsEdit::selectEditControl('GM_MAP_TYPE', $options, null, $this->getSetting('GM_MAP_TYPE'), 'class="form-control"'); |
|
332 | - ?> |
|
325 | + $options = array( |
|
326 | + 'ROADMAP' => I18N::translate('Map'), |
|
327 | + 'SATELLITE' => I18N::translate('Satellite'), |
|
328 | + 'HYBRID' => I18N::translate('Hybrid'), |
|
329 | + 'TERRAIN' => I18N::translate('Terrain'), |
|
330 | + ); |
|
331 | + echo FunctionsEdit::selectEditControl('GM_MAP_TYPE', $options, null, $this->getSetting('GM_MAP_TYPE'), 'class="form-control"'); |
|
332 | + ?> |
|
333 | 333 | </div> |
334 | 334 | </div> |
335 | 335 | |
@@ -378,12 +378,12 @@ discard block |
||
378 | 378 | <p class="form-control-static"><strong><?php echo I18N::translate('Prefixes') ?></strong></p> |
379 | 379 | <?php for ($level = 1; $level < 10; $level++): ?> |
380 | 380 | <?php |
381 | - if ($level == 1) { |
|
382 | - $label = I18N::translate('Country'); |
|
383 | - } else { |
|
384 | - $label = I18N::translate('Level') . ' ' . $level; |
|
385 | - } |
|
386 | - ?> |
|
381 | + if ($level == 1) { |
|
382 | + $label = I18N::translate('Country'); |
|
383 | + } else { |
|
384 | + $label = I18N::translate('Level') . ' ' . $level; |
|
385 | + } |
|
386 | + ?> |
|
387 | 387 | <div class="input-group"> |
388 | 388 | <label class="input-group-addon" for="GM_PREFIX_<?php echo $level ?>"><?php echo $label ?></label> |
389 | 389 | <input class="form-control" type="text" name="GM_PREFIX_<?php echo $level ?>" value="<?php echo $this->getSetting('GM_PREFIX_' . $level) ?>"> |
@@ -394,12 +394,12 @@ discard block |
||
394 | 394 | <p class="form-control-static"><strong><?php echo I18N::translate('Suffixes') ?></strong></p> |
395 | 395 | <?php for ($level = 1; $level < 10; $level++): ?> |
396 | 396 | <?php |
397 | - if ($level == 1) { |
|
398 | - $label = I18N::translate('Country'); |
|
399 | - } else { |
|
400 | - $label = I18N::translate('Level') . ' ' . $level; |
|
401 | - } |
|
402 | - ?> |
|
397 | + if ($level == 1) { |
|
398 | + $label = I18N::translate('Country'); |
|
399 | + } else { |
|
400 | + $label = I18N::translate('Level') . ' ' . $level; |
|
401 | + } |
|
402 | + ?> |
|
403 | 403 | <div class="input-group"> |
404 | 404 | <label class="input-group-addon" for="GM_POSTFIX_<?php echo $level ?>"><?php echo $label ?></label> |
405 | 405 | <input class="form-control" type="text" name="GM_POSTFIX_<?php echo $level ?>" value="<?php echo $this->getSetting('GM_POSTFIX_' . $level) ?>"> |
@@ -453,12 +453,12 @@ discard block |
||
453 | 453 | </label> |
454 | 454 | <div class="col-sm-9"> |
455 | 455 | <?php |
456 | - $ph_options = array( |
|
457 | - 'G_DEFAULT_ICON' => I18N::translate('Standard'), |
|
458 | - 'G_FLAG' => I18N::translate('Flag'), |
|
459 | - ); |
|
460 | - echo FunctionsEdit::selectEditControl('GM_PH_MARKER', $ph_options, null, $this->getSetting('GM_PH_MARKER'), 'class="form-control"'); |
|
461 | - ?> |
|
456 | + $ph_options = array( |
|
457 | + 'G_DEFAULT_ICON' => I18N::translate('Standard'), |
|
458 | + 'G_FLAG' => I18N::translate('Flag'), |
|
459 | + ); |
|
460 | + echo FunctionsEdit::selectEditControl('GM_PH_MARKER', $ph_options, null, $this->getSetting('GM_PH_MARKER'), 'class="form-control"'); |
|
461 | + ?> |
|
462 | 462 | </div> |
463 | 463 | </div> |
464 | 464 | |
@@ -473,66 +473,66 @@ discard block |
||
473 | 473 | </div> |
474 | 474 | </form> |
475 | 475 | <?php |
476 | - } |
|
477 | - |
|
478 | - /** |
|
479 | - * Google Maps API script |
|
480 | - * |
|
481 | - * @return string |
|
482 | - */ |
|
483 | - private function googleMapsScript() { |
|
484 | - $key = $this->getSetting('GM_API_KEY'); |
|
485 | - |
|
486 | - return 'https://maps.googleapis.com/maps/api/js?v=3&key=' . $key . '&language=' . WT_LOCALE; |
|
487 | - } |
|
488 | - |
|
489 | - /** |
|
490 | - * Select a flag. |
|
491 | - */ |
|
492 | - private function flags() { |
|
493 | - global $WT_TREE; |
|
494 | - |
|
495 | - $controller = new SimpleController; |
|
496 | - $controller |
|
497 | - ->setPageTitle(I18N::translate('Select flag')) |
|
498 | - ->pageHeader(); |
|
499 | - |
|
500 | - $stats = new Stats($WT_TREE); |
|
501 | - $countries = $stats->getAllCountries(); |
|
502 | - $action = Filter::post('action'); |
|
503 | - $countrySelected = Filter::get('countrySelected', null, 'Countries'); |
|
504 | - $stateSelected = Filter::get('stateSelected', null, 'States'); |
|
505 | - |
|
506 | - $country = array(); |
|
507 | - if (is_dir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/flags')) { |
|
508 | - $files = glob(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/flags/*.png'); |
|
509 | - foreach ($files as $file) { |
|
510 | - $country[] = basename($file, '.png'); |
|
511 | - } |
|
512 | - } |
|
513 | - |
|
514 | - if ($countrySelected == 'Countries') { |
|
515 | - $flags = $country; |
|
516 | - } else { |
|
517 | - $flags = array(); |
|
518 | - if (is_dir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags')) { |
|
519 | - $files = glob(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/*.png'); |
|
520 | - foreach ($files as $file) { |
|
521 | - $flags[] = basename($file, '.png'); |
|
522 | - } |
|
523 | - } |
|
524 | - } |
|
525 | - |
|
526 | - $flags_s = array(); |
|
527 | - if ($stateSelected != 'States' && is_dir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $stateSelected)) { |
|
528 | - $files = glob(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $stateSelected . '/*.png'); |
|
529 | - foreach ($files as $file) { |
|
530 | - $flags_s[] = basename($file, '.png'); |
|
531 | - } |
|
532 | - } |
|
533 | - |
|
534 | - if ($action == 'ChangeFlag' && Filter::post('FLAGS') !== null) { |
|
535 | - ?> |
|
476 | + } |
|
477 | + |
|
478 | + /** |
|
479 | + * Google Maps API script |
|
480 | + * |
|
481 | + * @return string |
|
482 | + */ |
|
483 | + private function googleMapsScript() { |
|
484 | + $key = $this->getSetting('GM_API_KEY'); |
|
485 | + |
|
486 | + return 'https://maps.googleapis.com/maps/api/js?v=3&key=' . $key . '&language=' . WT_LOCALE; |
|
487 | + } |
|
488 | + |
|
489 | + /** |
|
490 | + * Select a flag. |
|
491 | + */ |
|
492 | + private function flags() { |
|
493 | + global $WT_TREE; |
|
494 | + |
|
495 | + $controller = new SimpleController; |
|
496 | + $controller |
|
497 | + ->setPageTitle(I18N::translate('Select flag')) |
|
498 | + ->pageHeader(); |
|
499 | + |
|
500 | + $stats = new Stats($WT_TREE); |
|
501 | + $countries = $stats->getAllCountries(); |
|
502 | + $action = Filter::post('action'); |
|
503 | + $countrySelected = Filter::get('countrySelected', null, 'Countries'); |
|
504 | + $stateSelected = Filter::get('stateSelected', null, 'States'); |
|
505 | + |
|
506 | + $country = array(); |
|
507 | + if (is_dir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/flags')) { |
|
508 | + $files = glob(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/flags/*.png'); |
|
509 | + foreach ($files as $file) { |
|
510 | + $country[] = basename($file, '.png'); |
|
511 | + } |
|
512 | + } |
|
513 | + |
|
514 | + if ($countrySelected == 'Countries') { |
|
515 | + $flags = $country; |
|
516 | + } else { |
|
517 | + $flags = array(); |
|
518 | + if (is_dir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags')) { |
|
519 | + $files = glob(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/*.png'); |
|
520 | + foreach ($files as $file) { |
|
521 | + $flags[] = basename($file, '.png'); |
|
522 | + } |
|
523 | + } |
|
524 | + } |
|
525 | + |
|
526 | + $flags_s = array(); |
|
527 | + if ($stateSelected != 'States' && is_dir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $stateSelected)) { |
|
528 | + $files = glob(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $stateSelected . '/*.png'); |
|
529 | + foreach ($files as $file) { |
|
530 | + $flags_s[] = basename($file, '.png'); |
|
531 | + } |
|
532 | + } |
|
533 | + |
|
534 | + if ($action == 'ChangeFlag' && Filter::post('FLAGS') !== null) { |
|
535 | + ?> |
|
536 | 536 | <script> |
537 | 537 | <?php if (Filter::post('selcountry') == 'Countries') { ?> |
538 | 538 | window.opener.document.editplaces.icon.value = 'places/flags/<?php echo $flags[Filter::post('FLAGS')] ?>.png'; |
@@ -548,9 +548,9 @@ discard block |
||
548 | 548 | window.close(); |
549 | 549 | </script> |
550 | 550 | <?php |
551 | - return; |
|
552 | - } else { |
|
553 | - ?> |
|
551 | + return; |
|
552 | + } else { |
|
553 | + ?> |
|
554 | 554 | <script> |
555 | 555 | function selectCountry() { |
556 | 556 | if (document.flags.COUNTRYSELECT.value == 'Countries') { |
@@ -563,36 +563,36 @@ discard block |
||
563 | 563 | } |
564 | 564 | </script> |
565 | 565 | <?php |
566 | - } |
|
567 | - $countryList = array(); |
|
568 | - |
|
569 | - foreach ($country as $item) { |
|
570 | - if (is_dir(WT_MODULES_DIR . 'googlemap/places/' . $item . '/flags')) { |
|
571 | - if (isset($countries[$item])) { |
|
572 | - $countryList[$item] = $countries[$item]; |
|
573 | - } else { |
|
574 | - $countryList[$item] = $item; |
|
575 | - } |
|
576 | - } |
|
577 | - } |
|
578 | - asort($countryList); |
|
579 | - $stateList = array(); |
|
580 | - |
|
581 | - if ($countrySelected != 'Countries') { |
|
582 | - $placesDir = scandir(WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/'); |
|
583 | - foreach ($flags as $flag) { |
|
584 | - if (in_array($flag, $placesDir)) { |
|
585 | - $rep = opendir(WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $flag . '/'); |
|
586 | - while ($file = readdir($rep)) { |
|
587 | - $stateList[$flag] = $flag; |
|
588 | - } |
|
589 | - closedir($rep); |
|
590 | - } |
|
591 | - } |
|
592 | - asort($stateList); |
|
593 | - } |
|
594 | - |
|
595 | - ?> |
|
566 | + } |
|
567 | + $countryList = array(); |
|
568 | + |
|
569 | + foreach ($country as $item) { |
|
570 | + if (is_dir(WT_MODULES_DIR . 'googlemap/places/' . $item . '/flags')) { |
|
571 | + if (isset($countries[$item])) { |
|
572 | + $countryList[$item] = $countries[$item]; |
|
573 | + } else { |
|
574 | + $countryList[$item] = $item; |
|
575 | + } |
|
576 | + } |
|
577 | + } |
|
578 | + asort($countryList); |
|
579 | + $stateList = array(); |
|
580 | + |
|
581 | + if ($countrySelected != 'Countries') { |
|
582 | + $placesDir = scandir(WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/'); |
|
583 | + foreach ($flags as $flag) { |
|
584 | + if (in_array($flag, $placesDir)) { |
|
585 | + $rep = opendir(WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $flag . '/'); |
|
586 | + while ($file = readdir($rep)) { |
|
587 | + $stateList[$flag] = $flag; |
|
588 | + } |
|
589 | + closedir($rep); |
|
590 | + } |
|
591 | + } |
|
592 | + asort($stateList); |
|
593 | + } |
|
594 | + |
|
595 | + ?> |
|
596 | 596 | <h4><?php echo I18N::translate('Change flag') ?></h4> |
597 | 597 | |
598 | 598 | <p class="small text-muted"> |
@@ -609,75 +609,75 @@ discard block |
||
609 | 609 | <select name="COUNTRYSELECT" dir="ltr" onchange="selectCountry()"> |
610 | 610 | <option value="Countries"><?php echo I18N::translate('Countries') ?></option> |
611 | 611 | <?php foreach ($countryList as $country_key => $country_name) { |
612 | - echo '<option value="', $country_key, '" '; |
|
613 | - if ($countrySelected == $country_key) { |
|
614 | - echo 'selected'; |
|
615 | - } |
|
616 | - echo '>', $country_name, '</option>'; |
|
617 | - } ?> |
|
612 | + echo '<option value="', $country_key, '" '; |
|
613 | + if ($countrySelected == $country_key) { |
|
614 | + echo 'selected'; |
|
615 | + } |
|
616 | + echo '>', $country_name, '</option>'; |
|
617 | + } ?> |
|
618 | 618 | </select> |
619 | 619 | </td> |
620 | 620 | </tr> |
621 | 621 | |
622 | 622 | <?php |
623 | - $i = 0; |
|
624 | - $path = WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/places/'; |
|
625 | - $path .= $countrySelected == 'Countries' ? 'flags/' : $countrySelected . '/flags/'; |
|
626 | - foreach (array_chunk($flags, 4) as $row) { |
|
627 | - echo "<tr>"; |
|
628 | - foreach ($row as $flag) { |
|
629 | - if ($flag != 'blank') { |
|
630 | - if (isset($countries[$flag])) { |
|
631 | - $title = $countries[$flag]; |
|
632 | - } else { |
|
633 | - $title = $flag; |
|
634 | - } |
|
635 | - } else { |
|
636 | - $title = $countries['???']; |
|
637 | - } |
|
638 | - echo '<td>'; |
|
639 | - echo '<input type="radio" dir="ltr" name="FLAGS" value="' . $i++ . '">'; |
|
640 | - echo '<img style="width:25px; height:15px; margin-right:15px" src="' . $path . $flag . '.png" alt="' . $flag . '" title="' . $title . '">'; |
|
641 | - echo $flag . '</td>'; |
|
642 | - |
|
643 | - } |
|
644 | - |
|
645 | - echo str_repeat('<td></td>', 4 - count($row)); |
|
646 | - echo "</tr>"; |
|
647 | - } |
|
648 | - |
|
649 | - echo'<tr style="visibility:' . (($countrySelected == 'Countries' || count($stateList) == 0) ? 'hidden' : 'visible') . '">'; |
|
650 | - ?> |
|
623 | + $i = 0; |
|
624 | + $path = WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/places/'; |
|
625 | + $path .= $countrySelected == 'Countries' ? 'flags/' : $countrySelected . '/flags/'; |
|
626 | + foreach (array_chunk($flags, 4) as $row) { |
|
627 | + echo "<tr>"; |
|
628 | + foreach ($row as $flag) { |
|
629 | + if ($flag != 'blank') { |
|
630 | + if (isset($countries[$flag])) { |
|
631 | + $title = $countries[$flag]; |
|
632 | + } else { |
|
633 | + $title = $flag; |
|
634 | + } |
|
635 | + } else { |
|
636 | + $title = $countries['???']; |
|
637 | + } |
|
638 | + echo '<td>'; |
|
639 | + echo '<input type="radio" dir="ltr" name="FLAGS" value="' . $i++ . '">'; |
|
640 | + echo '<img style="width:25px; height:15px; margin-right:15px" src="' . $path . $flag . '.png" alt="' . $flag . '" title="' . $title . '">'; |
|
641 | + echo $flag . '</td>'; |
|
642 | + |
|
643 | + } |
|
644 | + |
|
645 | + echo str_repeat('<td></td>', 4 - count($row)); |
|
646 | + echo "</tr>"; |
|
647 | + } |
|
648 | + |
|
649 | + echo'<tr style="visibility:' . (($countrySelected == 'Countries' || count($stateList) == 0) ? 'hidden' : 'visible') . '">'; |
|
650 | + ?> |
|
651 | 651 | |
652 | 652 | <td class="optionbox" colspan="4"> |
653 | 653 | <select name="STATESELECT" dir="ltr" onchange="selectCountry()"> |
654 | 654 | <option value="States"><?php echo /* I18N: Part of a country, state/region/county */ I18N::translate('Subdivision') ?></option> |
655 | 655 | <?php foreach ($stateList as $state_key => $state_name) { |
656 | - echo '<option value="', $state_key, '" '; |
|
657 | - if ($stateSelected == $state_key) { |
|
658 | - echo 'selected'; |
|
659 | - } |
|
660 | - echo '>', $state_name, '</option>'; |
|
661 | - } ?> |
|
656 | + echo '<option value="', $state_key, '" '; |
|
657 | + if ($stateSelected == $state_key) { |
|
658 | + echo 'selected'; |
|
659 | + } |
|
660 | + echo '>', $state_name, '</option>'; |
|
661 | + } ?> |
|
662 | 662 | </select> |
663 | 663 | </td> |
664 | 664 | </tr> |
665 | 665 | |
666 | 666 | <?php |
667 | 667 | |
668 | - $i = 0; |
|
669 | - if (!empty($flags_s)) { |
|
670 | - foreach (array_chunk($flags_s, 4) as $row) { |
|
671 | - echo "<tr>"; |
|
672 | - foreach ($row as $flag) { |
|
673 | - echo '<td><input type="radio" dir="ltr" name="FLAGS" value="', $i++, '"><img src="', WT_STATIC_URL . WT_MODULES_DIR, 'googlemap/places/', $countrySelected, '/flags/', $stateSelected, '/', $flag, '.png"> ', $flag, '</td>'; |
|
674 | - } |
|
675 | - echo str_repeat('<td></td>', 4 - count($row)); |
|
676 | - echo '</tr>'; |
|
677 | - } |
|
678 | - } |
|
668 | + $i = 0; |
|
669 | + if (!empty($flags_s)) { |
|
670 | + foreach (array_chunk($flags_s, 4) as $row) { |
|
671 | + echo "<tr>"; |
|
672 | + foreach ($row as $flag) { |
|
673 | + echo '<td><input type="radio" dir="ltr" name="FLAGS" value="', $i++, '"><img src="', WT_STATIC_URL . WT_MODULES_DIR, 'googlemap/places/', $countrySelected, '/flags/', $stateSelected, '/', $flag, '.png"> ', $flag, '</td>'; |
|
674 | + } |
|
675 | + echo str_repeat('<td></td>', 4 - count($row)); |
|
676 | + echo '</tr>'; |
|
677 | + } |
|
678 | + } |
|
679 | 679 | |
680 | - ?> |
|
680 | + ?> |
|
681 | 681 | |
682 | 682 | </table> |
683 | 683 | <p id="save-cancel"> |
@@ -686,39 +686,39 @@ discard block |
||
686 | 686 | </p> |
687 | 687 | </form> |
688 | 688 | <?php |
689 | - } |
|
690 | - |
|
691 | - /** |
|
692 | - * Display a map showing the origins of ones ancestors. |
|
693 | - */ |
|
694 | - private function pedigreeMap() { |
|
695 | - global $controller, $WT_TREE; |
|
696 | - |
|
697 | - $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); |
|
698 | - // Limit this to match available number of icons. |
|
699 | - // 8 generations equals 255 individuals |
|
700 | - $MAX_PEDIGREE_GENERATIONS = min($MAX_PEDIGREE_GENERATIONS, 8); |
|
701 | - |
|
702 | - $controller = new ChartController(); |
|
703 | - $generations = Filter::getInteger('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS')); |
|
704 | - $this->treesize = pow(2, $generations) - 1; |
|
705 | - $this->ancestors = array_values($controller->sosaAncestors($generations)); |
|
706 | - |
|
707 | - $controller |
|
708 | - ->setPageTitle(/* I18N: %s is an individual’s name */ I18N::translate('Pedigree map of %s', $controller->root->getFullName())) |
|
709 | - ->pageHeader() |
|
710 | - ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) |
|
711 | - /* prepending the module css in the page head allows the theme to over-ride it*/ |
|
712 | - ->addInlineJavascript(" |
|
689 | + } |
|
690 | + |
|
691 | + /** |
|
692 | + * Display a map showing the origins of ones ancestors. |
|
693 | + */ |
|
694 | + private function pedigreeMap() { |
|
695 | + global $controller, $WT_TREE; |
|
696 | + |
|
697 | + $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); |
|
698 | + // Limit this to match available number of icons. |
|
699 | + // 8 generations equals 255 individuals |
|
700 | + $MAX_PEDIGREE_GENERATIONS = min($MAX_PEDIGREE_GENERATIONS, 8); |
|
701 | + |
|
702 | + $controller = new ChartController(); |
|
703 | + $generations = Filter::getInteger('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS')); |
|
704 | + $this->treesize = pow(2, $generations) - 1; |
|
705 | + $this->ancestors = array_values($controller->sosaAncestors($generations)); |
|
706 | + |
|
707 | + $controller |
|
708 | + ->setPageTitle(/* I18N: %s is an individual’s name */ I18N::translate('Pedigree map of %s', $controller->root->getFullName())) |
|
709 | + ->pageHeader() |
|
710 | + ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) |
|
711 | + /* prepending the module css in the page head allows the theme to over-ride it*/ |
|
712 | + ->addInlineJavascript(" |
|
713 | 713 | jQuery('head').prepend('<link type=\"text/css\" href =\"" . WT_STATIC_URL . WT_MODULES_DIR . "googlemap/css/wt_v3_googlemap.css\" rel=\"stylesheet\">'); |
714 | 714 | autocomplete();" . |
715 | - $this->pedigreeMapJavascript() |
|
716 | - ); |
|
715 | + $this->pedigreeMapJavascript() |
|
716 | + ); |
|
717 | 717 | |
718 | - echo '<div id="pedigreemap-page"><h2>', $controller->getPageTitle(), '</h2>'; |
|
718 | + echo '<div id="pedigreemap-page"><h2>', $controller->getPageTitle(), '</h2>'; |
|
719 | 719 | |
720 | - // -- print the form to change the number of displayed generations |
|
721 | - ?> |
|
720 | + // -- print the form to change the number of displayed generations |
|
721 | + ?> |
|
722 | 722 | <form name="people" method="get" action="?"> |
723 | 723 | <input type="hidden" name="ged" value="<?php echo $WT_TREE->getNameHtml() ?>"> |
724 | 724 | <input type="hidden" name="mod" value="googlemap"> |
@@ -747,14 +747,14 @@ discard block |
||
747 | 747 | <td class="optionbox"> |
748 | 748 | <select name="PEDIGREE_GENERATIONS" id="PEDIGREE_GENERATIONS"> |
749 | 749 | <?php |
750 | - for ($p = 3; $p <= $MAX_PEDIGREE_GENERATIONS; $p++) { |
|
751 | - echo '<option value="', $p, '" '; |
|
752 | - if ($p == $generations) { |
|
753 | - echo 'selected'; |
|
754 | - } |
|
755 | - echo '>', $p, '</option>'; |
|
756 | - } |
|
757 | - ?> |
|
750 | + for ($p = 3; $p <= $MAX_PEDIGREE_GENERATIONS; $p++) { |
|
751 | + echo '<option value="', $p, '" '; |
|
752 | + if ($p == $generations) { |
|
753 | + echo 'selected'; |
|
754 | + } |
|
755 | + echo '>', $p, '</option>'; |
|
756 | + } |
|
757 | + ?> |
|
758 | 758 | </select> |
759 | 759 | </td> |
760 | 760 | </tr> |
@@ -764,112 +764,112 @@ discard block |
||
764 | 764 | |
765 | 765 | <!-- count records by type --> |
766 | 766 | <?php |
767 | - $curgen = 1; |
|
768 | - $priv = 0; |
|
769 | - $count = 0; |
|
770 | - $miscount = 0; |
|
771 | - $missing = array(); |
|
772 | - |
|
773 | - $latlongval = array(); |
|
774 | - $lat = array(); |
|
775 | - $lon = array(); |
|
776 | - for ($i = 0; $i < ($this->treesize); $i++) { |
|
777 | - // -- check to see if we have moved to the next generation |
|
778 | - if ($i + 1 >= pow(2, $curgen)) { |
|
779 | - $curgen++; |
|
780 | - } |
|
781 | - $person = $this->ancestors[$i]; |
|
782 | - if (!empty($person)) { |
|
783 | - $name = $person->getFullName(); |
|
784 | - if ($name == I18N::translate('Private')) { |
|
785 | - $priv++; |
|
786 | - } |
|
787 | - $place = $person->getBirthPlace(); |
|
788 | - if (empty($place)) { |
|
789 | - $latlongval[$i] = null; |
|
790 | - } else { |
|
791 | - $latlongval[$i] = $this->getLatitudeAndLongitudeFromPlaceLocation($person->getBirthPlace()); |
|
792 | - } |
|
793 | - if ($latlongval[$i]) { |
|
794 | - $lat[$i] = strtr($latlongval[$i]->pl_lati, array('N' => '', 'S' => '-', ',' => '.')); |
|
795 | - $lon[$i] = strtr($latlongval[$i]->pl_long, array('N' => '', 'S' => '-', ',' => '.')); |
|
796 | - if ($lat[$i] && $lon[$i]) { |
|
797 | - $count++; |
|
798 | - } else { |
|
799 | - // The place is in the table but has empty values |
|
800 | - if ($name) { |
|
801 | - $missing[] = '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>'; |
|
802 | - $miscount++; |
|
803 | - } |
|
804 | - } |
|
805 | - } else { |
|
806 | - // There was no place, or not listed in the map table |
|
807 | - if ($name) { |
|
808 | - $missing[] = '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>'; |
|
809 | - $miscount++; |
|
810 | - } |
|
811 | - } |
|
812 | - } |
|
813 | - } |
|
814 | - |
|
815 | - //<!-- end of count records by type --> |
|
816 | - //<!-- start of map display --> |
|
817 | - echo '<div class="gm-pedigree-map">'; |
|
818 | - echo '<div class="gm-wrapper">'; |
|
819 | - echo '<div class="gm-map"><i class="icon-loading-large"></i></div>'; |
|
820 | - echo '<div class="gm-ancestors"></div>'; |
|
821 | - echo '</div>'; |
|
822 | - |
|
823 | - if (Auth::isAdmin()) { |
|
824 | - echo '<div class="gm-options noprint">'; |
|
825 | - echo '<a href="module.php?mod=' . $this->getName() . '&mod_action=admin_config">' . I18N::translate('Google Maps™ preferences') . '</a>'; |
|
826 | - echo ' | <a href="module.php?mod=' . $this->getName() . '&mod_action=admin_places">' . I18N::translate('Geographic data') . '</a>'; |
|
827 | - echo ' | <a href="module.php?mod=' . $this->getName() . '&mod_action=admin_placecheck">' . I18N::translate('Place check') . '</a>'; |
|
828 | - echo '</div>'; |
|
829 | - } |
|
830 | - // display info under map |
|
831 | - echo '<hr>'; |
|
832 | - |
|
833 | - // print summary statistics |
|
834 | - if (isset($curgen)) { |
|
835 | - $total = pow(2, $curgen) - 1; |
|
836 | - echo '<div>'; |
|
837 | - echo I18N::plural( |
|
838 | - '%1$s individual displayed, out of the normal total of %2$s, from %3$s generations.', |
|
839 | - '%1$s individuals displayed, out of the normal total of %2$s, from %3$s generations.', |
|
840 | - $count, |
|
841 | - I18N::number($count), I18N::number($total), I18N::number($curgen) |
|
842 | - ); |
|
843 | - echo '</div>'; |
|
844 | - if ($priv) { |
|
845 | - echo '<div>' . I18N::plural('%s individual is private.', '%s individuals are private.', $priv, $priv), '</div>'; |
|
846 | - } |
|
847 | - if ($count + $priv != $total) { |
|
848 | - if ($miscount == 0) { |
|
849 | - echo '<div>' . I18N::translate('No ancestors in the database.'), '</div>'; |
|
850 | - } else { |
|
851 | - echo '<div>' . /* I18N: %1$s is a count of individuals, %2$s is a list of their names */ I18N::plural( |
|
852 | - '%1$s individual is missing birthplace map coordinates: %2$s.', |
|
853 | - '%1$s individuals are missing birthplace map coordinates: %2$s.', |
|
854 | - $miscount, I18N::number($miscount), implode(I18N::$list_separator, $missing)), |
|
855 | - '</div>'; |
|
856 | - } |
|
857 | - } |
|
858 | - } |
|
859 | - |
|
860 | - echo '</div>'; |
|
861 | - echo '</div>'; |
|
862 | - echo '<script src="', $this->googleMapsScript(), '"></script>'; |
|
863 | - } |
|
864 | - |
|
865 | - /** |
|
866 | - * Create the Javascript to activate the map. |
|
867 | - * |
|
868 | - * @return string |
|
869 | - */ |
|
870 | - private function pedigreeMapJavascript() { |
|
871 | - |
|
872 | - $js = ' |
|
767 | + $curgen = 1; |
|
768 | + $priv = 0; |
|
769 | + $count = 0; |
|
770 | + $miscount = 0; |
|
771 | + $missing = array(); |
|
772 | + |
|
773 | + $latlongval = array(); |
|
774 | + $lat = array(); |
|
775 | + $lon = array(); |
|
776 | + for ($i = 0; $i < ($this->treesize); $i++) { |
|
777 | + // -- check to see if we have moved to the next generation |
|
778 | + if ($i + 1 >= pow(2, $curgen)) { |
|
779 | + $curgen++; |
|
780 | + } |
|
781 | + $person = $this->ancestors[$i]; |
|
782 | + if (!empty($person)) { |
|
783 | + $name = $person->getFullName(); |
|
784 | + if ($name == I18N::translate('Private')) { |
|
785 | + $priv++; |
|
786 | + } |
|
787 | + $place = $person->getBirthPlace(); |
|
788 | + if (empty($place)) { |
|
789 | + $latlongval[$i] = null; |
|
790 | + } else { |
|
791 | + $latlongval[$i] = $this->getLatitudeAndLongitudeFromPlaceLocation($person->getBirthPlace()); |
|
792 | + } |
|
793 | + if ($latlongval[$i]) { |
|
794 | + $lat[$i] = strtr($latlongval[$i]->pl_lati, array('N' => '', 'S' => '-', ',' => '.')); |
|
795 | + $lon[$i] = strtr($latlongval[$i]->pl_long, array('N' => '', 'S' => '-', ',' => '.')); |
|
796 | + if ($lat[$i] && $lon[$i]) { |
|
797 | + $count++; |
|
798 | + } else { |
|
799 | + // The place is in the table but has empty values |
|
800 | + if ($name) { |
|
801 | + $missing[] = '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>'; |
|
802 | + $miscount++; |
|
803 | + } |
|
804 | + } |
|
805 | + } else { |
|
806 | + // There was no place, or not listed in the map table |
|
807 | + if ($name) { |
|
808 | + $missing[] = '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>'; |
|
809 | + $miscount++; |
|
810 | + } |
|
811 | + } |
|
812 | + } |
|
813 | + } |
|
814 | + |
|
815 | + //<!-- end of count records by type --> |
|
816 | + //<!-- start of map display --> |
|
817 | + echo '<div class="gm-pedigree-map">'; |
|
818 | + echo '<div class="gm-wrapper">'; |
|
819 | + echo '<div class="gm-map"><i class="icon-loading-large"></i></div>'; |
|
820 | + echo '<div class="gm-ancestors"></div>'; |
|
821 | + echo '</div>'; |
|
822 | + |
|
823 | + if (Auth::isAdmin()) { |
|
824 | + echo '<div class="gm-options noprint">'; |
|
825 | + echo '<a href="module.php?mod=' . $this->getName() . '&mod_action=admin_config">' . I18N::translate('Google Maps™ preferences') . '</a>'; |
|
826 | + echo ' | <a href="module.php?mod=' . $this->getName() . '&mod_action=admin_places">' . I18N::translate('Geographic data') . '</a>'; |
|
827 | + echo ' | <a href="module.php?mod=' . $this->getName() . '&mod_action=admin_placecheck">' . I18N::translate('Place check') . '</a>'; |
|
828 | + echo '</div>'; |
|
829 | + } |
|
830 | + // display info under map |
|
831 | + echo '<hr>'; |
|
832 | + |
|
833 | + // print summary statistics |
|
834 | + if (isset($curgen)) { |
|
835 | + $total = pow(2, $curgen) - 1; |
|
836 | + echo '<div>'; |
|
837 | + echo I18N::plural( |
|
838 | + '%1$s individual displayed, out of the normal total of %2$s, from %3$s generations.', |
|
839 | + '%1$s individuals displayed, out of the normal total of %2$s, from %3$s generations.', |
|
840 | + $count, |
|
841 | + I18N::number($count), I18N::number($total), I18N::number($curgen) |
|
842 | + ); |
|
843 | + echo '</div>'; |
|
844 | + if ($priv) { |
|
845 | + echo '<div>' . I18N::plural('%s individual is private.', '%s individuals are private.', $priv, $priv), '</div>'; |
|
846 | + } |
|
847 | + if ($count + $priv != $total) { |
|
848 | + if ($miscount == 0) { |
|
849 | + echo '<div>' . I18N::translate('No ancestors in the database.'), '</div>'; |
|
850 | + } else { |
|
851 | + echo '<div>' . /* I18N: %1$s is a count of individuals, %2$s is a list of their names */ I18N::plural( |
|
852 | + '%1$s individual is missing birthplace map coordinates: %2$s.', |
|
853 | + '%1$s individuals are missing birthplace map coordinates: %2$s.', |
|
854 | + $miscount, I18N::number($miscount), implode(I18N::$list_separator, $missing)), |
|
855 | + '</div>'; |
|
856 | + } |
|
857 | + } |
|
858 | + } |
|
859 | + |
|
860 | + echo '</div>'; |
|
861 | + echo '</div>'; |
|
862 | + echo '<script src="', $this->googleMapsScript(), '"></script>'; |
|
863 | + } |
|
864 | + |
|
865 | + /** |
|
866 | + * Create the Javascript to activate the map. |
|
867 | + * |
|
868 | + * @return string |
|
869 | + */ |
|
870 | + private function pedigreeMapJavascript() { |
|
871 | + |
|
872 | + $js = ' |
|
873 | 873 | // this variable will collect the html which will eventually be placed in the side bar |
874 | 874 | var gm_ancestors_html = ""; |
875 | 875 | // arrays to hold copies of the markers and html used by the side bar |
@@ -1131,90 +1131,90 @@ discard block |
||
1131 | 1131 | }); |
1132 | 1132 | // create the map bounds |
1133 | 1133 | var bounds = new google.maps.LatLngBounds();'; |
1134 | - // add the points |
|
1135 | - $curgen = 1; |
|
1136 | - $count = 0; |
|
1137 | - $colored_line = array( |
|
1138 | - '1' => '#FF0000', |
|
1139 | - '2' => '#0000FF', |
|
1140 | - '3' => '#00FF00', |
|
1141 | - '4' => '#FFFF00', |
|
1142 | - '5' => '#00FFFF', |
|
1143 | - '6' => '#FF00FF', |
|
1144 | - '7' => '#C0C0FF', |
|
1145 | - '8' => '#808000', |
|
1146 | - ); |
|
1147 | - $lat = array(); |
|
1148 | - $lon = array(); |
|
1149 | - $latlongval = array(); |
|
1150 | - for ($i = 0; $i < $this->treesize; $i++) { |
|
1151 | - // moved up to grab the sex of the individuals |
|
1152 | - $person = $this->ancestors[$i]; |
|
1153 | - if ($person) { |
|
1154 | - $name = $person->getFullName(); |
|
1155 | - |
|
1156 | - // -- check to see if we have moved to the next generation |
|
1157 | - if ($i + 1 >= pow(2, $curgen)) { |
|
1158 | - $curgen++; |
|
1159 | - } |
|
1160 | - |
|
1161 | - $relationship = FunctionsCharts::getSosaName($i + 1); |
|
1162 | - |
|
1163 | - // get thumbnail image |
|
1164 | - if ($person->getTree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) { |
|
1165 | - $image = $person->displayImage(); |
|
1166 | - } else { |
|
1167 | - $image = ''; |
|
1168 | - } |
|
1169 | - |
|
1170 | - $event = '<img src="' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/sq' . $curgen . '.png" width="10" height="10"> '; |
|
1171 | - $event .= '<strong>' . $relationship . '</strong>'; |
|
1172 | - |
|
1173 | - $birth = $person->getFirstFact('BIRT'); |
|
1174 | - $data = Filter::escapeJs($image . '<div class="gm-ancestor-link">' . $event . ' <span><a href="' . $person->getHtmlUrl() . '">' . $name . '</a></span>'); |
|
1175 | - $data .= $birth ? Filter::escapeJs($birth->summary()) : ''; |
|
1176 | - $data .= '</div>'; |
|
1177 | - |
|
1178 | - $latlongval[$i] = $this->getLatitudeAndLongitudeFromPlaceLocation($person->getBirthPlace()); |
|
1179 | - if ($latlongval[$i]) { |
|
1180 | - $lat[$i] = (double) strtr($latlongval[$i]->pl_lati, array('N' => '', 'S' => '-', ',' => '.')); |
|
1181 | - $lon[$i] = (double) strtr($latlongval[$i]->pl_long, array('E' => '', 'W' => '-', ',' => '.')); |
|
1182 | - if ($lat[$i] || $lon[$i]) { |
|
1183 | - $marker_number = $curgen; |
|
1184 | - $dups = 0; |
|
1185 | - for ($k = 0; $k < $i; $k++) { |
|
1186 | - if ($latlongval[$i] == $latlongval[$k]) { |
|
1187 | - $dups++; |
|
1188 | - switch ($dups) { |
|
1189 | - case 1: |
|
1190 | - $marker_number = $curgen . 'L'; |
|
1191 | - break; |
|
1192 | - case 2: |
|
1193 | - $marker_number = $curgen . 'R'; |
|
1194 | - break; |
|
1195 | - case 3: |
|
1196 | - $marker_number = $curgen . 'Ls'; |
|
1197 | - break; |
|
1198 | - case 4: |
|
1199 | - $marker_number = $curgen . 'Rs'; |
|
1200 | - break; |
|
1201 | - case 5: //adjust position where markers have same coodinates |
|
1202 | - default: |
|
1203 | - $marker_number = $curgen; |
|
1204 | - $lon[$i] += 0.0025; |
|
1205 | - $lat[$i] += 0.0025; |
|
1206 | - break; |
|
1207 | - } |
|
1208 | - } |
|
1209 | - } |
|
1210 | - |
|
1211 | - $js .= 'var point = new google.maps.LatLng(' . $lat[$i] . ',' . $lon[$i] . ');'; |
|
1212 | - $js .= 'var marker = createMarker(point, "' . Filter::escapeJs($name) . '","' . $data . '", "'; |
|
1213 | - $js .= '<div class=\"gm-info-window\">' . $data . '</div>", "' . $marker_number . '");'; |
|
1214 | - // Construct the polygon lines |
|
1215 | - $to_child = (intval(($i - 1) / 2)); // Draw a line from parent to child |
|
1216 | - if (array_key_exists($to_child, $lat) && $lat[$to_child] != 0 && $lon[$to_child] != 0) { |
|
1217 | - $js .= ' |
|
1134 | + // add the points |
|
1135 | + $curgen = 1; |
|
1136 | + $count = 0; |
|
1137 | + $colored_line = array( |
|
1138 | + '1' => '#FF0000', |
|
1139 | + '2' => '#0000FF', |
|
1140 | + '3' => '#00FF00', |
|
1141 | + '4' => '#FFFF00', |
|
1142 | + '5' => '#00FFFF', |
|
1143 | + '6' => '#FF00FF', |
|
1144 | + '7' => '#C0C0FF', |
|
1145 | + '8' => '#808000', |
|
1146 | + ); |
|
1147 | + $lat = array(); |
|
1148 | + $lon = array(); |
|
1149 | + $latlongval = array(); |
|
1150 | + for ($i = 0; $i < $this->treesize; $i++) { |
|
1151 | + // moved up to grab the sex of the individuals |
|
1152 | + $person = $this->ancestors[$i]; |
|
1153 | + if ($person) { |
|
1154 | + $name = $person->getFullName(); |
|
1155 | + |
|
1156 | + // -- check to see if we have moved to the next generation |
|
1157 | + if ($i + 1 >= pow(2, $curgen)) { |
|
1158 | + $curgen++; |
|
1159 | + } |
|
1160 | + |
|
1161 | + $relationship = FunctionsCharts::getSosaName($i + 1); |
|
1162 | + |
|
1163 | + // get thumbnail image |
|
1164 | + if ($person->getTree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) { |
|
1165 | + $image = $person->displayImage(); |
|
1166 | + } else { |
|
1167 | + $image = ''; |
|
1168 | + } |
|
1169 | + |
|
1170 | + $event = '<img src="' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/sq' . $curgen . '.png" width="10" height="10"> '; |
|
1171 | + $event .= '<strong>' . $relationship . '</strong>'; |
|
1172 | + |
|
1173 | + $birth = $person->getFirstFact('BIRT'); |
|
1174 | + $data = Filter::escapeJs($image . '<div class="gm-ancestor-link">' . $event . ' <span><a href="' . $person->getHtmlUrl() . '">' . $name . '</a></span>'); |
|
1175 | + $data .= $birth ? Filter::escapeJs($birth->summary()) : ''; |
|
1176 | + $data .= '</div>'; |
|
1177 | + |
|
1178 | + $latlongval[$i] = $this->getLatitudeAndLongitudeFromPlaceLocation($person->getBirthPlace()); |
|
1179 | + if ($latlongval[$i]) { |
|
1180 | + $lat[$i] = (double) strtr($latlongval[$i]->pl_lati, array('N' => '', 'S' => '-', ',' => '.')); |
|
1181 | + $lon[$i] = (double) strtr($latlongval[$i]->pl_long, array('E' => '', 'W' => '-', ',' => '.')); |
|
1182 | + if ($lat[$i] || $lon[$i]) { |
|
1183 | + $marker_number = $curgen; |
|
1184 | + $dups = 0; |
|
1185 | + for ($k = 0; $k < $i; $k++) { |
|
1186 | + if ($latlongval[$i] == $latlongval[$k]) { |
|
1187 | + $dups++; |
|
1188 | + switch ($dups) { |
|
1189 | + case 1: |
|
1190 | + $marker_number = $curgen . 'L'; |
|
1191 | + break; |
|
1192 | + case 2: |
|
1193 | + $marker_number = $curgen . 'R'; |
|
1194 | + break; |
|
1195 | + case 3: |
|
1196 | + $marker_number = $curgen . 'Ls'; |
|
1197 | + break; |
|
1198 | + case 4: |
|
1199 | + $marker_number = $curgen . 'Rs'; |
|
1200 | + break; |
|
1201 | + case 5: //adjust position where markers have same coodinates |
|
1202 | + default: |
|
1203 | + $marker_number = $curgen; |
|
1204 | + $lon[$i] += 0.0025; |
|
1205 | + $lat[$i] += 0.0025; |
|
1206 | + break; |
|
1207 | + } |
|
1208 | + } |
|
1209 | + } |
|
1210 | + |
|
1211 | + $js .= 'var point = new google.maps.LatLng(' . $lat[$i] . ',' . $lon[$i] . ');'; |
|
1212 | + $js .= 'var marker = createMarker(point, "' . Filter::escapeJs($name) . '","' . $data . '", "'; |
|
1213 | + $js .= '<div class=\"gm-info-window\">' . $data . '</div>", "' . $marker_number . '");'; |
|
1214 | + // Construct the polygon lines |
|
1215 | + $to_child = (intval(($i - 1) / 2)); // Draw a line from parent to child |
|
1216 | + if (array_key_exists($to_child, $lat) && $lat[$to_child] != 0 && $lon[$to_child] != 0) { |
|
1217 | + $js .= ' |
|
1218 | 1218 | var linecolor; |
1219 | 1219 | var plines; |
1220 | 1220 | var lines = [new google.maps.LatLng(' . $lat[$i] . ',' . $lon[$i] . '), |
@@ -1229,18 +1229,18 @@ discard block |
||
1229 | 1229 | fillOpacity: 0.1 |
1230 | 1230 | }); |
1231 | 1231 | plines.setMap(pm_map);'; |
1232 | - } |
|
1233 | - // Extend and fit marker bounds |
|
1234 | - |
|
1235 | - $js .= 'bounds.extend(point);'; |
|
1236 | - $count++; |
|
1237 | - } |
|
1238 | - } |
|
1239 | - } else { |
|
1240 | - $latlongval[$i] = null; |
|
1241 | - } |
|
1242 | - } |
|
1243 | - $js .= ' |
|
1232 | + } |
|
1233 | + // Extend and fit marker bounds |
|
1234 | + |
|
1235 | + $js .= 'bounds.extend(point);'; |
|
1236 | + $count++; |
|
1237 | + } |
|
1238 | + } |
|
1239 | + } else { |
|
1240 | + $latlongval[$i] = null; |
|
1241 | + } |
|
1242 | + } |
|
1243 | + $js .= ' |
|
1244 | 1244 | pm_map.setCenter(bounds.getCenter()); |
1245 | 1245 | pm_map.fitBounds(bounds); |
1246 | 1246 | google.maps.event.addListenerOnce(pm_map, "bounds_changed", function(event) { |
@@ -1271,27 +1271,27 @@ discard block |
||
1271 | 1271 | }); |
1272 | 1272 | '; |
1273 | 1273 | |
1274 | - return $js; |
|
1275 | - } |
|
1274 | + return $js; |
|
1275 | + } |
|
1276 | 1276 | |
1277 | - /** |
|
1278 | - * Check places for missing data, etc. |
|
1279 | - */ |
|
1280 | - private function adminPlaceCheck() { |
|
1281 | - global $WT_TREE; |
|
1277 | + /** |
|
1278 | + * Check places for missing data, etc. |
|
1279 | + */ |
|
1280 | + private function adminPlaceCheck() { |
|
1281 | + global $WT_TREE; |
|
1282 | 1282 | |
1283 | - $gedcom_id = Filter::get('gedcom_id', null, $WT_TREE->getTreeId()); |
|
1284 | - $country = Filter::get('country', '.+', 'XYZ'); |
|
1285 | - $state = Filter::get('state', '.+', 'XYZ'); |
|
1286 | - $matching = Filter::getBool('matching'); |
|
1283 | + $gedcom_id = Filter::get('gedcom_id', null, $WT_TREE->getTreeId()); |
|
1284 | + $country = Filter::get('country', '.+', 'XYZ'); |
|
1285 | + $state = Filter::get('state', '.+', 'XYZ'); |
|
1286 | + $matching = Filter::getBool('matching'); |
|
1287 | 1287 | |
1288 | - $controller = new PageController; |
|
1289 | - $controller |
|
1290 | - ->restrictAccess(Auth::isAdmin()) |
|
1291 | - ->setPageTitle(I18N::translate('Google Maps™')) |
|
1292 | - ->pageHeader(); |
|
1288 | + $controller = new PageController; |
|
1289 | + $controller |
|
1290 | + ->restrictAccess(Auth::isAdmin()) |
|
1291 | + ->setPageTitle(I18N::translate('Google Maps™')) |
|
1292 | + ->pageHeader(); |
|
1293 | 1293 | |
1294 | - ?> |
|
1294 | + ?> |
|
1295 | 1295 | <ol class="breadcrumb small"> |
1296 | 1296 | <li><a href="admin.php"><?php echo I18N::translate('Control panel') ?></a></li> |
1297 | 1297 | <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration') ?></a></li> |
@@ -1317,102 +1317,102 @@ discard block |
||
1317 | 1317 | </ul> |
1318 | 1318 | <?php |
1319 | 1319 | |
1320 | - echo '<h2>', I18N::translate('Place check'), '</h2>'; |
|
1321 | - |
|
1322 | - // User options |
|
1323 | - $rows = Database::prepare("SELECT pl_id, pl_place FROM `##placelocation` WHERE pl_level=0 ORDER BY pl_place")->fetchAssoc(); |
|
1324 | - |
|
1325 | - echo '<form name="placecheck" class="form form-inline">'; |
|
1326 | - echo '<input type="hidden" name="mod" value="', $this->getName(), '">'; |
|
1327 | - echo '<input type="hidden" name="mod_action" value="admin_placecheck">'; |
|
1328 | - echo '<div class="form-group">'; |
|
1329 | - echo '<label for="gedcom_id">', I18N::translate('Family tree'), '</label> '; |
|
1330 | - echo FunctionsEdit::selectEditControl('gedcom_id', Tree::getIdList(), null, $gedcom_id, ' onchange="this.form.submit();" class="form-control"'), ' '; |
|
1331 | - echo '<label for="country">', I18N::translate('Country'), '</label> '; |
|
1332 | - echo '<select name="country" onchange="this.form.submit();" class="form-control"> '; |
|
1333 | - echo '<option value="XYZ">', I18N::translate('All'), '</option>'; |
|
1334 | - foreach ($rows as $id => $place) { |
|
1335 | - echo '<option value="', Filter::escapeHtml($place), '" '; |
|
1336 | - if ($place == $country) { |
|
1337 | - echo 'selected'; |
|
1338 | - $par_id = $id; |
|
1339 | - } |
|
1340 | - echo '>', Filter::escapeHtml($place), '</option>'; |
|
1341 | - } |
|
1342 | - echo '</select> '; |
|
1343 | - if ($country != 'XYZ') { |
|
1344 | - echo '<label for="state">', /* I18N: Part of a country, state/region/county */ I18N::translate('Subdivision'), '</label> '; |
|
1345 | - echo '<select name="state" onchange="this.form.submit();" class="form-control">'; |
|
1346 | - echo '<option value="XYZ">', I18N::translate('All'), '</option>'; |
|
1347 | - $places = Database::prepare("SELECT pl_place FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place") |
|
1348 | - ->execute(array($par_id)) |
|
1349 | - ->fetchOneColumn(); |
|
1350 | - foreach ($places as $place) { |
|
1351 | - echo '<option value="', Filter::escapeHtml($place), '" ', $place == $state ? 'selected' : '', '>', Filter::escapeHtml($place), '</option>'; |
|
1352 | - } |
|
1353 | - echo '</select> '; |
|
1354 | - } |
|
1355 | - echo '<div class="checkbox-inline">'; |
|
1356 | - echo '<label for="matching">'; |
|
1357 | - echo '<input type="checkbox" name="matching" value="1" onchange="this.form.submit();" ', ($matching ? 'checked' : ''), '>'; |
|
1358 | - echo I18N::translate('Include fully matched places'); |
|
1359 | - echo '</label>'; |
|
1360 | - echo '</div></div>'; |
|
1361 | - echo '</form>'; |
|
1362 | - echo '<hr>'; |
|
1363 | - |
|
1364 | - //Select all '2 PLAC ' tags in the file and create array |
|
1365 | - $place_list = array(); |
|
1366 | - $ged_data = Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?") |
|
1367 | - ->execute(array("%\n2 PLAC %", $gedcom_id)) |
|
1368 | - ->fetchOneColumn(); |
|
1369 | - foreach ($ged_data as $ged_datum) { |
|
1370 | - preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches); |
|
1371 | - foreach ($matches[1] as $match) { |
|
1372 | - $place_list[$match] = true; |
|
1373 | - } |
|
1374 | - } |
|
1375 | - $ged_data = Database::prepare("SELECT f_gedcom FROM `##families` WHERE f_gedcom LIKE ? AND f_file=?") |
|
1376 | - ->execute(array("%\n2 PLAC %", $gedcom_id)) |
|
1377 | - ->fetchOneColumn(); |
|
1378 | - foreach ($ged_data as $ged_datum) { |
|
1379 | - preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches); |
|
1380 | - foreach ($matches[1] as $match) { |
|
1381 | - $place_list[$match] = true; |
|
1382 | - } |
|
1383 | - } |
|
1384 | - // Unique list of places |
|
1385 | - $place_list = array_keys($place_list); |
|
1386 | - |
|
1387 | - // Apply_filter |
|
1388 | - if ($country == 'XYZ') { |
|
1389 | - $filter = '.*$'; |
|
1390 | - } else { |
|
1391 | - $filter = preg_quote($country) . '$'; |
|
1392 | - if ($state != 'XYZ') { |
|
1393 | - $filter = preg_quote($state) . ', ' . $filter; |
|
1394 | - } |
|
1395 | - } |
|
1396 | - $place_list = preg_grep('/' . $filter . '/', $place_list); |
|
1397 | - |
|
1398 | - //sort the array, limit to unique values, and count them |
|
1399 | - usort($place_list, '\Fisharebest\Webtrees\I18N::strcasecmp'); |
|
1400 | - $i = count($place_list); |
|
1401 | - |
|
1402 | - //calculate maximum no. of levels to display |
|
1403 | - $x = 0; |
|
1404 | - $max = 0; |
|
1405 | - while ($x < $i) { |
|
1406 | - $levels = explode(",", $place_list[$x]); |
|
1407 | - $parts = count($levels); |
|
1408 | - if ($parts > $max) { |
|
1409 | - $max = $parts; |
|
1410 | - } |
|
1411 | - $x++; } |
|
1412 | - $x = 0; |
|
1413 | - |
|
1414 | - //scripts for edit, add and refresh |
|
1415 | - ?> |
|
1320 | + echo '<h2>', I18N::translate('Place check'), '</h2>'; |
|
1321 | + |
|
1322 | + // User options |
|
1323 | + $rows = Database::prepare("SELECT pl_id, pl_place FROM `##placelocation` WHERE pl_level=0 ORDER BY pl_place")->fetchAssoc(); |
|
1324 | + |
|
1325 | + echo '<form name="placecheck" class="form form-inline">'; |
|
1326 | + echo '<input type="hidden" name="mod" value="', $this->getName(), '">'; |
|
1327 | + echo '<input type="hidden" name="mod_action" value="admin_placecheck">'; |
|
1328 | + echo '<div class="form-group">'; |
|
1329 | + echo '<label for="gedcom_id">', I18N::translate('Family tree'), '</label> '; |
|
1330 | + echo FunctionsEdit::selectEditControl('gedcom_id', Tree::getIdList(), null, $gedcom_id, ' onchange="this.form.submit();" class="form-control"'), ' '; |
|
1331 | + echo '<label for="country">', I18N::translate('Country'), '</label> '; |
|
1332 | + echo '<select name="country" onchange="this.form.submit();" class="form-control"> '; |
|
1333 | + echo '<option value="XYZ">', I18N::translate('All'), '</option>'; |
|
1334 | + foreach ($rows as $id => $place) { |
|
1335 | + echo '<option value="', Filter::escapeHtml($place), '" '; |
|
1336 | + if ($place == $country) { |
|
1337 | + echo 'selected'; |
|
1338 | + $par_id = $id; |
|
1339 | + } |
|
1340 | + echo '>', Filter::escapeHtml($place), '</option>'; |
|
1341 | + } |
|
1342 | + echo '</select> '; |
|
1343 | + if ($country != 'XYZ') { |
|
1344 | + echo '<label for="state">', /* I18N: Part of a country, state/region/county */ I18N::translate('Subdivision'), '</label> '; |
|
1345 | + echo '<select name="state" onchange="this.form.submit();" class="form-control">'; |
|
1346 | + echo '<option value="XYZ">', I18N::translate('All'), '</option>'; |
|
1347 | + $places = Database::prepare("SELECT pl_place FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place") |
|
1348 | + ->execute(array($par_id)) |
|
1349 | + ->fetchOneColumn(); |
|
1350 | + foreach ($places as $place) { |
|
1351 | + echo '<option value="', Filter::escapeHtml($place), '" ', $place == $state ? 'selected' : '', '>', Filter::escapeHtml($place), '</option>'; |
|
1352 | + } |
|
1353 | + echo '</select> '; |
|
1354 | + } |
|
1355 | + echo '<div class="checkbox-inline">'; |
|
1356 | + echo '<label for="matching">'; |
|
1357 | + echo '<input type="checkbox" name="matching" value="1" onchange="this.form.submit();" ', ($matching ? 'checked' : ''), '>'; |
|
1358 | + echo I18N::translate('Include fully matched places'); |
|
1359 | + echo '</label>'; |
|
1360 | + echo '</div></div>'; |
|
1361 | + echo '</form>'; |
|
1362 | + echo '<hr>'; |
|
1363 | + |
|
1364 | + //Select all '2 PLAC ' tags in the file and create array |
|
1365 | + $place_list = array(); |
|
1366 | + $ged_data = Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?") |
|
1367 | + ->execute(array("%\n2 PLAC %", $gedcom_id)) |
|
1368 | + ->fetchOneColumn(); |
|
1369 | + foreach ($ged_data as $ged_datum) { |
|
1370 | + preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches); |
|
1371 | + foreach ($matches[1] as $match) { |
|
1372 | + $place_list[$match] = true; |
|
1373 | + } |
|
1374 | + } |
|
1375 | + $ged_data = Database::prepare("SELECT f_gedcom FROM `##families` WHERE f_gedcom LIKE ? AND f_file=?") |
|
1376 | + ->execute(array("%\n2 PLAC %", $gedcom_id)) |
|
1377 | + ->fetchOneColumn(); |
|
1378 | + foreach ($ged_data as $ged_datum) { |
|
1379 | + preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches); |
|
1380 | + foreach ($matches[1] as $match) { |
|
1381 | + $place_list[$match] = true; |
|
1382 | + } |
|
1383 | + } |
|
1384 | + // Unique list of places |
|
1385 | + $place_list = array_keys($place_list); |
|
1386 | + |
|
1387 | + // Apply_filter |
|
1388 | + if ($country == 'XYZ') { |
|
1389 | + $filter = '.*$'; |
|
1390 | + } else { |
|
1391 | + $filter = preg_quote($country) . '$'; |
|
1392 | + if ($state != 'XYZ') { |
|
1393 | + $filter = preg_quote($state) . ', ' . $filter; |
|
1394 | + } |
|
1395 | + } |
|
1396 | + $place_list = preg_grep('/' . $filter . '/', $place_list); |
|
1397 | + |
|
1398 | + //sort the array, limit to unique values, and count them |
|
1399 | + usort($place_list, '\Fisharebest\Webtrees\I18N::strcasecmp'); |
|
1400 | + $i = count($place_list); |
|
1401 | + |
|
1402 | + //calculate maximum no. of levels to display |
|
1403 | + $x = 0; |
|
1404 | + $max = 0; |
|
1405 | + while ($x < $i) { |
|
1406 | + $levels = explode(",", $place_list[$x]); |
|
1407 | + $parts = count($levels); |
|
1408 | + if ($parts > $max) { |
|
1409 | + $max = $parts; |
|
1410 | + } |
|
1411 | + $x++; } |
|
1412 | + $x = 0; |
|
1413 | + |
|
1414 | + //scripts for edit, add and refresh |
|
1415 | + ?> |
|
1416 | 1416 | <script> |
1417 | 1417 | function edit_place_location(placeid) { |
1418 | 1418 | window.open('module.php?mod=googlemap&mod_action=places_edit&action=update&placeid='+placeid, '_blank', gmap_window_specs); |
@@ -1426,461 +1426,461 @@ discard block |
||
1426 | 1426 | </script> |
1427 | 1427 | <?php |
1428 | 1428 | |
1429 | - //start to produce the display table |
|
1430 | - echo '<table class="table table-bordered table-condensed table-hover"><thead><tr>'; |
|
1431 | - echo '<th rowspan="3">', I18N::translate('Place'), '</th>'; |
|
1432 | - echo '<th colspan="', $max * 3, '">', I18N::translate('Geographic data'), '</th></tr>'; |
|
1433 | - echo '<tr>'; |
|
1434 | - for ($cols = 0; $cols < $max; ++$cols) { |
|
1435 | - if ($cols == 0) { |
|
1436 | - echo '<th colspan="3">', I18N::translate('Country'), '</th>'; |
|
1437 | - } else { |
|
1438 | - echo '<th colspan="3">', I18N::translate('Level'), ' ', $cols + 1, '</th>'; |
|
1439 | - } |
|
1440 | - } |
|
1441 | - echo '</tr><tr>'; |
|
1442 | - for ($cols = 0; $cols < $max; ++$cols) { |
|
1443 | - echo '<th>', GedcomTag::getLabel('PLAC'), '</th>'; |
|
1444 | - echo '<th>', I18N::translate('Latitude'), '</th>'; |
|
1445 | - echo '<th>', I18N::translate('Longitude'), '</th>'; |
|
1446 | - } |
|
1447 | - echo '</tr></thead><tbody>'; |
|
1448 | - $countrows = 0; |
|
1449 | - $matched = array(); |
|
1450 | - while ($x < $i) { |
|
1451 | - $placestr = ''; |
|
1452 | - $levels = explode(', ', $place_list[$x]); |
|
1453 | - $parts = count($levels); |
|
1454 | - $levels = array_reverse($levels); |
|
1455 | - $placestr .= '<a href="placelist.php?action=show'; |
|
1456 | - foreach ($levels as $pindex => $ppart) { |
|
1457 | - $placestr .= '&parent[' . $pindex . ']=' . urlencode($ppart); |
|
1458 | - } |
|
1459 | - $placestr .= '">' . $place_list[$x] . "</a>"; |
|
1460 | - $gedplace = '<tr><td>' . $placestr . '</td>'; |
|
1461 | - $z = 0; |
|
1462 | - $id = 0; |
|
1463 | - $level = 0; |
|
1464 | - $matched[$x] = 0; // used to exclude places where the gedcom place is matched at all levels |
|
1465 | - $mapstr_edit = '<a href="#" dir="auto" onclick="edit_place_location(\''; |
|
1466 | - $mapstr_add = '<a href="#" dir="auto" onclick="add_place_location(\''; |
|
1467 | - $mapstr3 = ''; |
|
1468 | - $mapstr4 = ''; |
|
1469 | - $mapstr5 = '\')" title=\''; |
|
1470 | - $mapstr6 = '\' >'; |
|
1471 | - $mapstr7 = '\')">'; |
|
1472 | - $mapstr8 = '</a>'; |
|
1473 | - $plac = array(); |
|
1474 | - $lati = array(); |
|
1475 | - $long = array(); |
|
1476 | - while ($z < $parts) { |
|
1477 | - if ($levels[$z] == '') { |
|
1478 | - $levels[$z] = 'unknown'; // GoogleMap module uses "unknown" while GEDCOM uses , , |
|
1479 | - } |
|
1480 | - |
|
1481 | - $placelist = $this->createPossiblePlaceNames($levels[$z], $z + 1); // add the necessary prefix/postfix values to the place name |
|
1482 | - foreach ($placelist as $key => $placename) { |
|
1483 | - $row = |
|
1484 | - Database::prepare("SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place") |
|
1485 | - ->execute(array($z, $id, $placename)) |
|
1486 | - ->fetchOneRow(PDO::FETCH_ASSOC); |
|
1487 | - if (!empty($row['pl_id'])) { |
|
1488 | - $row['pl_placerequested'] = $levels[$z]; // keep the actual place name that was requested so we can display that instead of what is in the db |
|
1489 | - break; |
|
1490 | - } |
|
1491 | - } |
|
1492 | - if ($row['pl_id'] != '') { |
|
1493 | - $id = $row['pl_id']; |
|
1494 | - } |
|
1495 | - |
|
1496 | - if ($row['pl_place'] != '') { |
|
1497 | - $placestr2 = $mapstr_edit . $id . "&level=" . $level . $mapstr3 . $mapstr5 . I18N::translate('Zoom') . ' ' . $row['pl_zoom'] . $mapstr6 . $row['pl_placerequested'] . $mapstr8; |
|
1498 | - if ($row['pl_place'] === 'unknown') { |
|
1499 | - $matched[$x]++; |
|
1500 | - } |
|
1501 | - } else { |
|
1502 | - if ($levels[$z] === 'unknown') { |
|
1503 | - $placestr2 = $mapstr_add . $id . "&level=" . $level . $mapstr3 . $mapstr7 . "<strong>" . I18N::translate('unknown') . "</strong>" . $mapstr8; $matched[$x]++; |
|
1504 | - } else { |
|
1505 | - $placestr2 = $mapstr_add . $id . "&place_name=" . urlencode($levels[$z]) . "&level=" . $level . $mapstr3 . $mapstr7 . '<span class="danger">' . $levels[$z] . '</span>' . $mapstr8; $matched[$x]++; |
|
1506 | - } |
|
1507 | - } |
|
1508 | - $plac[$z] = '<td>' . $placestr2 . '</td>'; |
|
1509 | - if ($row['pl_lati'] == '0' && $row['pl_long'] == '0') { |
|
1510 | - $lati[$z] = '<td class="danger">0</td>'; |
|
1511 | - } elseif ($row['pl_lati'] != '') { |
|
1512 | - $lati[$z] = '<td>' . $row['pl_lati'] . '</td>'; |
|
1513 | - } else { |
|
1514 | - $lati[$z] = '<td class="danger"><i class="fa fa-warning"></i></td>'; |
|
1515 | - $matched[$x]++; |
|
1516 | - } |
|
1517 | - if ($row['pl_lati'] == '0' && $row['pl_long'] == '0') { |
|
1518 | - $long[$z] = '<td class="danger">0</td>'; |
|
1519 | - } elseif ($row['pl_long'] != '') { |
|
1520 | - $long[$z] = '<td>' . $row['pl_long'] . '</td>'; |
|
1521 | - } else { |
|
1522 | - $long[$z] = '<td class="danger"><i class="fa fa-warning"></i></td>'; |
|
1523 | - $matched[$x]++; |
|
1524 | - } |
|
1525 | - $level++; |
|
1526 | - $mapstr3 = $mapstr3 . "&parent[" . $z . "]=" . Filter::escapeJs($row['pl_placerequested']); |
|
1527 | - $mapstr4 = $mapstr4 . "&parent[" . $z . "]=" . Filter::escapeJs($levels[$z]); |
|
1528 | - $z++; |
|
1529 | - } |
|
1530 | - if ($matching) { |
|
1531 | - $matched[$x] = 1; |
|
1532 | - } |
|
1533 | - if ($matched[$x] != 0) { |
|
1534 | - echo $gedplace; |
|
1535 | - $z = 0; |
|
1536 | - while ($z < $max) { |
|
1537 | - if ($z < $parts) { |
|
1538 | - echo $plac[$z]; |
|
1539 | - echo $lati[$z]; |
|
1540 | - echo $long[$z]; |
|
1541 | - } else { |
|
1542 | - echo '<td></td>'; |
|
1543 | - echo '<td></td>'; |
|
1544 | - echo '<td></td>'; |
|
1545 | - } |
|
1546 | - $z++; |
|
1547 | - } |
|
1548 | - echo '</tr>'; |
|
1549 | - $countrows++; |
|
1550 | - } |
|
1551 | - $x++; |
|
1552 | - } |
|
1553 | - echo '</tbody>'; |
|
1554 | - echo '<tfoot>'; |
|
1555 | - echo '<tr>'; |
|
1556 | - echo '<td colspan="', (1 + 3 * $max), '">', /* I18N: A count of places */ I18N::translate('Total places: %s', I18N::number($countrows)), '</td>'; |
|
1557 | - echo '</tr>'; |
|
1558 | - echo '</tfoot>'; |
|
1559 | - echo '</table>'; |
|
1560 | - } |
|
1561 | - |
|
1562 | - /** |
|
1563 | - * Does an individual (or their spouse-families) have any facts with places? |
|
1564 | - * |
|
1565 | - * @param Individual $individual |
|
1566 | - * |
|
1567 | - * @return bool |
|
1568 | - */ |
|
1569 | - private function checkMapData(Individual $individual) { |
|
1570 | - $statement = Database::prepare( |
|
1571 | - "SELECT COUNT(*) FROM `##placelinks` WHERE pl_gid = :xref AND pl_file = :tree_id" |
|
1572 | - ); |
|
1573 | - $args = array( |
|
1574 | - 'xref' => $individual->getXref(), |
|
1575 | - 'tree_id' => $individual->getTree()->getTreeId(), |
|
1576 | - ); |
|
1577 | - |
|
1578 | - if ($statement->execute($args)->fetchOne()) { |
|
1579 | - return true; |
|
1580 | - } |
|
1581 | - |
|
1582 | - foreach ($individual->getSpouseFamilies() as $family) { |
|
1583 | - $args['xref'] = $family->getXref(); |
|
1584 | - if ($statement->execute($args)->fetchOne()) { |
|
1585 | - return true; |
|
1586 | - } |
|
1587 | - } |
|
1588 | - |
|
1589 | - return false; |
|
1590 | - } |
|
1591 | - |
|
1592 | - /** |
|
1593 | - * Remove prefixes from a place name to allow it to be matched. |
|
1594 | - * |
|
1595 | - * @param string $prefix_list |
|
1596 | - * @param string $place |
|
1597 | - * @param string[] $placelist |
|
1598 | - * |
|
1599 | - * @return string[] |
|
1600 | - */ |
|
1601 | - private function removePrefixFromPlaceName($prefix_list, $place, $placelist) { |
|
1602 | - if ($prefix_list) { |
|
1603 | - foreach (explode(';', $prefix_list) as $prefix) { |
|
1604 | - if ($prefix && substr($place, 0, strlen($prefix) + 1) == $prefix . ' ') { |
|
1605 | - $placelist[] = substr($place, strlen($prefix) + 1); |
|
1606 | - } |
|
1607 | - } |
|
1608 | - } |
|
1609 | - |
|
1610 | - return $placelist; |
|
1611 | - } |
|
1612 | - |
|
1613 | - /** |
|
1614 | - * Remove suffixes from a place name to allow it to be matched. |
|
1615 | - * |
|
1616 | - * @param string $suffix_list |
|
1617 | - * @param string $place |
|
1618 | - * @param string[] $placelist |
|
1619 | - * |
|
1620 | - * @return string[] |
|
1621 | - */ |
|
1622 | - private function removeSuffixFromPlaceName($suffix_list, $place, $placelist) { |
|
1623 | - if ($suffix_list) { |
|
1624 | - foreach (explode(';', $suffix_list) as $postfix) { |
|
1625 | - if ($postfix && substr($place, -strlen($postfix) - 1) == ' ' . $postfix) { |
|
1626 | - $placelist[] = substr($place, 0, strlen($place) - strlen($postfix) - 1); |
|
1627 | - } |
|
1628 | - } |
|
1629 | - } |
|
1630 | - |
|
1631 | - return $placelist; |
|
1632 | - } |
|
1633 | - |
|
1634 | - /** |
|
1635 | - * Remove prefixes and sufixes to allow place names to be matched. |
|
1636 | - * |
|
1637 | - * @param string $prefix_list |
|
1638 | - * @param string $suffix_list |
|
1639 | - * @param string $place |
|
1640 | - * @param string[] $placelist |
|
1641 | - * |
|
1642 | - * @return string[] |
|
1643 | - */ |
|
1644 | - private function removePrefixAndSuffixFromPlaceName($prefix_list, $suffix_list, $place, $placelist) { |
|
1645 | - if ($prefix_list && $suffix_list) { |
|
1646 | - foreach (explode(';', $prefix_list) as $prefix) { |
|
1647 | - foreach (explode(';', $suffix_list) as $postfix) { |
|
1648 | - if ($prefix && $postfix && substr($place, 0, strlen($prefix) + 1) == $prefix . ' ' && substr($place, -strlen($postfix) - 1) == ' ' . $postfix) { |
|
1649 | - $placelist[] = substr($place, strlen($prefix) + 1, strlen($place) - strlen($prefix) - strlen($postfix) - 2); |
|
1650 | - } |
|
1651 | - } |
|
1652 | - } |
|
1653 | - } |
|
1654 | - |
|
1655 | - return $placelist; |
|
1656 | - } |
|
1657 | - |
|
1658 | - /** |
|
1659 | - * Match placenames with different prefixes and suffixes. |
|
1660 | - * |
|
1661 | - * @param string $placename |
|
1662 | - * @param int $level |
|
1663 | - * |
|
1664 | - * @return string[] |
|
1665 | - */ |
|
1666 | - private function createPossiblePlaceNames($placename, $level) { |
|
1667 | - $retlist = array(); |
|
1668 | - if ($level <= 9) { |
|
1669 | - $retlist = $this->removePrefixAndSuffixFromPlaceName($this->getSetting('GM_PREFIX_' . $level), $this->getSetting('GM_POSTFIX_' . $level), $placename, $retlist); // Remove both |
|
1670 | - $retlist = $this->removePrefixFromPlaceName($this->getSetting('GM_PREFIX_' . $level), $placename, $retlist); // Remove prefix |
|
1671 | - $retlist = $this->removeSuffixFromPlaceName($this->getSetting('GM_POSTFIX_' . $level), $placename, $retlist); // Remove suffix |
|
1672 | - } |
|
1673 | - $retlist[] = $placename; // Exact |
|
1674 | - |
|
1675 | - return $retlist; |
|
1676 | - } |
|
1677 | - |
|
1678 | - /** |
|
1679 | - * Get the map co-ordinates of a place. |
|
1680 | - * |
|
1681 | - * @param string $place |
|
1682 | - * |
|
1683 | - * @return null|\stdClass |
|
1684 | - */ |
|
1685 | - private function getLatitudeAndLongitudeFromPlaceLocation($place) { |
|
1686 | - $parent = explode(',', $place); |
|
1687 | - $parent = array_reverse($parent); |
|
1688 | - $place_id = 0; |
|
1689 | - $num_parent = count($parent); |
|
1690 | - for ($i = 0; $i < $num_parent; $i++) { |
|
1691 | - $parent[$i] = trim($parent[$i]); |
|
1692 | - if (empty($parent[$i])) { |
|
1693 | - $parent[$i] = 'unknown'; // GoogleMap module uses "unknown" while GEDCOM uses , , |
|
1694 | - } |
|
1695 | - $placelist = $this->createPossiblePlaceNames($parent[$i], $i + 1); |
|
1696 | - foreach ($placelist as $placename) { |
|
1697 | - $pl_id = Database::prepare( |
|
1698 | - "SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place" |
|
1699 | - )->execute(array($i, $place_id, $placename))->fetchOne(); |
|
1700 | - if (!empty($pl_id)) { |
|
1701 | - break; |
|
1702 | - } |
|
1703 | - } |
|
1704 | - if (empty($pl_id)) { |
|
1705 | - break; |
|
1706 | - } |
|
1707 | - $place_id = $pl_id; |
|
1708 | - } |
|
1709 | - |
|
1710 | - return Database::prepare( |
|
1711 | - "SELECT sv_lati, sv_long, sv_bearing, sv_elevation, sv_zoom, pl_lati, pl_long, pl_zoom, pl_icon, pl_level" . |
|
1712 | - " FROM `##placelocation`" . |
|
1713 | - " WHERE pl_id = ?" . |
|
1714 | - " ORDER BY pl_place" |
|
1715 | - )->execute(array($place_id))->fetchOneRow(); |
|
1716 | - } |
|
1717 | - |
|
1718 | - /** |
|
1719 | - * @param Fact $fact |
|
1720 | - * |
|
1721 | - * @return array |
|
1722 | - */ |
|
1723 | - private function getPlaceData(Fact $fact) { |
|
1724 | - $result = array(); |
|
1725 | - |
|
1726 | - $has_latitude = preg_match('/\n4 LATI (.+)/', $fact->getGedcom(), $match1); |
|
1727 | - $has_longitude = preg_match('/\n4 LONG (.+)/', $fact->getGedcom(), $match2); |
|
1728 | - |
|
1729 | - // If co-ordinates are stored in the GEDCOM then use them |
|
1730 | - if ($has_latitude && $has_longitude) { |
|
1731 | - $result = array( |
|
1732 | - 'index' => 'ID' . $match1[1] . $match2[1], |
|
1733 | - 'mapdata' => array( |
|
1734 | - 'class' => 'optionbox', |
|
1735 | - 'place' => $fact->getPlace()->getFullName(), |
|
1736 | - 'tooltip' => $fact->getPlace()->getGedcomName(), |
|
1737 | - 'lat' => strtr($match1[1], array('N' => '', 'S' => '-', ',' => '.')), |
|
1738 | - 'lng' => strtr($match2[1], array('E' => '', 'W' => '-', ',' => '.')), |
|
1739 | - 'pl_icon' => '', |
|
1740 | - 'pl_zoom' => '0', |
|
1741 | - 'sv_bearing' => '0', |
|
1742 | - 'sv_elevation' => '0', |
|
1743 | - 'sv_lati' => '0', |
|
1744 | - 'sv_long' => '0', |
|
1745 | - 'sv_zoom' => '0', |
|
1746 | - 'events' => '', |
|
1747 | - ), |
|
1748 | - ); |
|
1749 | - } else { |
|
1750 | - $place_location = $this->getLatitudeAndLongitudeFromPlaceLocation($fact->getPlace()->getGedcomName()); |
|
1751 | - if ($place_location && $place_location->pl_lati && $place_location->pl_long) { |
|
1752 | - $result = array( |
|
1753 | - 'index' => 'ID' . $place_location->pl_lati . $place_location->pl_long, |
|
1754 | - 'mapdata' => array( |
|
1755 | - 'class' => 'optionbox', |
|
1756 | - 'place' => $fact->getPlace()->getFullName(), |
|
1757 | - 'tooltip' => $fact->getPlace()->getGedcomName(), |
|
1758 | - 'lat' => strtr($place_location->pl_lati, array('N' => '', 'S' => '-', ',' => '.')), |
|
1759 | - 'lng' => strtr($place_location->pl_long, array('E' => '', 'W' => '-', ',' => '.')), |
|
1760 | - 'pl_icon' => $place_location->pl_icon, |
|
1761 | - 'pl_zoom' => $place_location->pl_zoom, |
|
1762 | - 'sv_bearing' => $place_location->sv_bearing, |
|
1763 | - 'sv_elevation' => $place_location->sv_elevation, |
|
1764 | - 'sv_lati' => $place_location->sv_lati, |
|
1765 | - 'sv_long' => $place_location->sv_long, |
|
1766 | - 'sv_zoom' => $place_location->sv_zoom, |
|
1767 | - 'events' => '', |
|
1768 | - ), |
|
1769 | - ); |
|
1770 | - } |
|
1771 | - } |
|
1772 | - |
|
1773 | - return $result; |
|
1774 | - } |
|
1775 | - |
|
1776 | - /** |
|
1777 | - * Build a map for an individual. |
|
1778 | - * |
|
1779 | - * @param Individual $indi |
|
1780 | - */ |
|
1781 | - private function buildIndividualMap(Individual $indi) { |
|
1782 | - $GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM'); |
|
1783 | - $facts = $indi->getFacts(); |
|
1784 | - foreach ($indi->getSpouseFamilies() as $family) { |
|
1785 | - $facts = array_merge($facts, $family->getFacts()); |
|
1786 | - // Add birth of children from this family to the facts array |
|
1787 | - foreach ($family->getChildren() as $child) { |
|
1788 | - $birth_fact = $child->getFirstFact('BIRT'); |
|
1789 | - // Exclude children without birthplaces |
|
1790 | - // facts without places |
|
1791 | - if ($birth_fact !== null && $birth_fact->getPlace() !== null) { |
|
1792 | - $facts[] = $birth_fact; |
|
1793 | - } |
|
1794 | - } |
|
1795 | - } |
|
1796 | - |
|
1797 | - Functions::sortFacts($facts); |
|
1798 | - |
|
1799 | - // At this point we have an array of valid sorted facts |
|
1800 | - // so now build the data structures needed for the map display |
|
1801 | - $events = array(); |
|
1802 | - $unique_places = array(); |
|
1803 | - |
|
1804 | - foreach ($facts as $fact) { |
|
1805 | - $place_data = $this->getPlaceData($fact); |
|
1806 | - |
|
1807 | - if (!empty($place_data)) { |
|
1808 | - $index = $place_data['index']; |
|
1809 | - |
|
1810 | - if ($place_data['mapdata']['pl_zoom']) { |
|
1811 | - $GM_MAX_ZOOM = min($GM_MAX_ZOOM, $place_data['mapdata']['pl_zoom']); |
|
1812 | - } |
|
1813 | - // Produce the html for the sidebar |
|
1814 | - $parent = $fact->getParent(); |
|
1815 | - if ($parent instanceof Individual && $parent->getXref() !== $indi->getXref()) { |
|
1816 | - // Childs birth |
|
1817 | - $name = '<a href="' . $parent->getHtmlUrl() . '">' . $parent->getFullName() . '</a>'; |
|
1818 | - $label = strtr($parent->getSex(), array('F' => I18N::translate('Birth of a daughter'), 'M' => I18N::translate('Birth of a son'), 'U' => I18N::translate('Birth of a child'))); |
|
1819 | - $class = 'person_box' . strtr($parent->getSex(), array('F' => 'F', 'M' => '', 'U' => 'NN')); |
|
1820 | - $evtStr = '<div class="gm-event">' . $label . '<div><strong>' . $name . '</strong></div>' . $fact->getDate()->display(true) . '</div>'; |
|
1821 | - } else { |
|
1822 | - $spouse = $parent instanceof Family ? $parent->getSpouse($indi) : null; |
|
1823 | - $name = $spouse ? '<a href="' . $spouse->getHtmlUrl() . '">' . $spouse->getFullName() . '</a>' : ''; |
|
1824 | - $label = $fact->getLabel(); |
|
1825 | - $class = 'optionbox'; |
|
1826 | - if ($fact->getValue() && $spouse) { |
|
1827 | - $evtStr = '<div class="gm-event">' . $label . '<div>' . $fact->getValue() . '</div><strong>' . $name . '</strong>' . $fact->getDate()->display(true) . '</div>'; |
|
1828 | - } elseif ($spouse) { |
|
1829 | - $evtStr = '<div class="gm-event">' . $label . '<div><strong>' . $name . '</strong></div>' . $fact->getDate()->display(true) . '</div>'; |
|
1830 | - } elseif ($fact->getValue()) { |
|
1831 | - $evtStr = '<div class="gm-event">' . $label . '<div> ' . $fact->getValue() . '</div>' . $fact->getDate()->display(true) . '</div>'; |
|
1832 | - } else { |
|
1833 | - $evtStr = '<div class="gm-event">' . $label . '<div>' . $fact->getDate()->display(true) . '</div></div>'; |
|
1834 | - } |
|
1835 | - } |
|
1836 | - |
|
1837 | - if (empty($unique_places[$index])) { |
|
1838 | - $unique_places[$index] = $place_data['mapdata']; |
|
1839 | - } |
|
1840 | - $unique_places[$index]['events'] .= $evtStr; |
|
1841 | - $events[] = array( |
|
1842 | - 'class' => $class, |
|
1843 | - 'fact_label' => $label, |
|
1844 | - 'date' => $fact->getDate()->display(true), |
|
1845 | - 'info' => $fact->getValue(), |
|
1846 | - 'name' => $name, |
|
1847 | - 'place' => '<a href="' . $fact->getPlace()->getURL() . '">' . $fact->getPlace()->getFullName() . '</a>', |
|
1848 | - 'placeid' => $index, |
|
1849 | - ); |
|
1850 | - } |
|
1851 | - } |
|
1852 | - |
|
1853 | - if (!empty($events)) { |
|
1854 | - $places = array_keys($unique_places); |
|
1855 | - ob_start(); |
|
1856 | - // Create the normal googlemap sidebar of events and children |
|
1857 | - echo '<div class="gm-events"><table class="facts_table">'; |
|
1858 | - |
|
1859 | - foreach ($events as $event) { |
|
1860 | - $index = array_search($event['placeid'], $places); |
|
1861 | - echo '<tr>'; |
|
1862 | - echo '<td class="facts_label">'; |
|
1863 | - echo '<a href="#" onclick="return openInfowindow(\'', $index, '\')">', $event['fact_label'], '</a></td>'; |
|
1864 | - echo '<td class="', $event['class'], '">'; |
|
1865 | - if ($event['info']) { |
|
1866 | - echo '<div><span class="field">', Filter::escapeHtml($event['info']), '</span></div>'; |
|
1867 | - } |
|
1868 | - if ($event['name']) { |
|
1869 | - echo '<div>', $event['name'], '</div>'; |
|
1870 | - } |
|
1871 | - echo '<div>', $event['place'], '</div>'; |
|
1872 | - if ($event['date']) { |
|
1873 | - echo '<div>', $event['date'], '</div>'; |
|
1874 | - } |
|
1875 | - echo '</td>'; |
|
1876 | - echo '</tr>'; |
|
1877 | - } |
|
1878 | - |
|
1879 | - echo '</table></div>'; |
|
1880 | - |
|
1881 | - // *** ENABLE STREETVIEW *** |
|
1882 | - $STREETVIEW = (bool) $this->getSetting('GM_USE_STREETVIEW'); |
|
1883 | - ?> |
|
1429 | + //start to produce the display table |
|
1430 | + echo '<table class="table table-bordered table-condensed table-hover"><thead><tr>'; |
|
1431 | + echo '<th rowspan="3">', I18N::translate('Place'), '</th>'; |
|
1432 | + echo '<th colspan="', $max * 3, '">', I18N::translate('Geographic data'), '</th></tr>'; |
|
1433 | + echo '<tr>'; |
|
1434 | + for ($cols = 0; $cols < $max; ++$cols) { |
|
1435 | + if ($cols == 0) { |
|
1436 | + echo '<th colspan="3">', I18N::translate('Country'), '</th>'; |
|
1437 | + } else { |
|
1438 | + echo '<th colspan="3">', I18N::translate('Level'), ' ', $cols + 1, '</th>'; |
|
1439 | + } |
|
1440 | + } |
|
1441 | + echo '</tr><tr>'; |
|
1442 | + for ($cols = 0; $cols < $max; ++$cols) { |
|
1443 | + echo '<th>', GedcomTag::getLabel('PLAC'), '</th>'; |
|
1444 | + echo '<th>', I18N::translate('Latitude'), '</th>'; |
|
1445 | + echo '<th>', I18N::translate('Longitude'), '</th>'; |
|
1446 | + } |
|
1447 | + echo '</tr></thead><tbody>'; |
|
1448 | + $countrows = 0; |
|
1449 | + $matched = array(); |
|
1450 | + while ($x < $i) { |
|
1451 | + $placestr = ''; |
|
1452 | + $levels = explode(', ', $place_list[$x]); |
|
1453 | + $parts = count($levels); |
|
1454 | + $levels = array_reverse($levels); |
|
1455 | + $placestr .= '<a href="placelist.php?action=show'; |
|
1456 | + foreach ($levels as $pindex => $ppart) { |
|
1457 | + $placestr .= '&parent[' . $pindex . ']=' . urlencode($ppart); |
|
1458 | + } |
|
1459 | + $placestr .= '">' . $place_list[$x] . "</a>"; |
|
1460 | + $gedplace = '<tr><td>' . $placestr . '</td>'; |
|
1461 | + $z = 0; |
|
1462 | + $id = 0; |
|
1463 | + $level = 0; |
|
1464 | + $matched[$x] = 0; // used to exclude places where the gedcom place is matched at all levels |
|
1465 | + $mapstr_edit = '<a href="#" dir="auto" onclick="edit_place_location(\''; |
|
1466 | + $mapstr_add = '<a href="#" dir="auto" onclick="add_place_location(\''; |
|
1467 | + $mapstr3 = ''; |
|
1468 | + $mapstr4 = ''; |
|
1469 | + $mapstr5 = '\')" title=\''; |
|
1470 | + $mapstr6 = '\' >'; |
|
1471 | + $mapstr7 = '\')">'; |
|
1472 | + $mapstr8 = '</a>'; |
|
1473 | + $plac = array(); |
|
1474 | + $lati = array(); |
|
1475 | + $long = array(); |
|
1476 | + while ($z < $parts) { |
|
1477 | + if ($levels[$z] == '') { |
|
1478 | + $levels[$z] = 'unknown'; // GoogleMap module uses "unknown" while GEDCOM uses , , |
|
1479 | + } |
|
1480 | + |
|
1481 | + $placelist = $this->createPossiblePlaceNames($levels[$z], $z + 1); // add the necessary prefix/postfix values to the place name |
|
1482 | + foreach ($placelist as $key => $placename) { |
|
1483 | + $row = |
|
1484 | + Database::prepare("SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place") |
|
1485 | + ->execute(array($z, $id, $placename)) |
|
1486 | + ->fetchOneRow(PDO::FETCH_ASSOC); |
|
1487 | + if (!empty($row['pl_id'])) { |
|
1488 | + $row['pl_placerequested'] = $levels[$z]; // keep the actual place name that was requested so we can display that instead of what is in the db |
|
1489 | + break; |
|
1490 | + } |
|
1491 | + } |
|
1492 | + if ($row['pl_id'] != '') { |
|
1493 | + $id = $row['pl_id']; |
|
1494 | + } |
|
1495 | + |
|
1496 | + if ($row['pl_place'] != '') { |
|
1497 | + $placestr2 = $mapstr_edit . $id . "&level=" . $level . $mapstr3 . $mapstr5 . I18N::translate('Zoom') . ' ' . $row['pl_zoom'] . $mapstr6 . $row['pl_placerequested'] . $mapstr8; |
|
1498 | + if ($row['pl_place'] === 'unknown') { |
|
1499 | + $matched[$x]++; |
|
1500 | + } |
|
1501 | + } else { |
|
1502 | + if ($levels[$z] === 'unknown') { |
|
1503 | + $placestr2 = $mapstr_add . $id . "&level=" . $level . $mapstr3 . $mapstr7 . "<strong>" . I18N::translate('unknown') . "</strong>" . $mapstr8; $matched[$x]++; |
|
1504 | + } else { |
|
1505 | + $placestr2 = $mapstr_add . $id . "&place_name=" . urlencode($levels[$z]) . "&level=" . $level . $mapstr3 . $mapstr7 . '<span class="danger">' . $levels[$z] . '</span>' . $mapstr8; $matched[$x]++; |
|
1506 | + } |
|
1507 | + } |
|
1508 | + $plac[$z] = '<td>' . $placestr2 . '</td>'; |
|
1509 | + if ($row['pl_lati'] == '0' && $row['pl_long'] == '0') { |
|
1510 | + $lati[$z] = '<td class="danger">0</td>'; |
|
1511 | + } elseif ($row['pl_lati'] != '') { |
|
1512 | + $lati[$z] = '<td>' . $row['pl_lati'] . '</td>'; |
|
1513 | + } else { |
|
1514 | + $lati[$z] = '<td class="danger"><i class="fa fa-warning"></i></td>'; |
|
1515 | + $matched[$x]++; |
|
1516 | + } |
|
1517 | + if ($row['pl_lati'] == '0' && $row['pl_long'] == '0') { |
|
1518 | + $long[$z] = '<td class="danger">0</td>'; |
|
1519 | + } elseif ($row['pl_long'] != '') { |
|
1520 | + $long[$z] = '<td>' . $row['pl_long'] . '</td>'; |
|
1521 | + } else { |
|
1522 | + $long[$z] = '<td class="danger"><i class="fa fa-warning"></i></td>'; |
|
1523 | + $matched[$x]++; |
|
1524 | + } |
|
1525 | + $level++; |
|
1526 | + $mapstr3 = $mapstr3 . "&parent[" . $z . "]=" . Filter::escapeJs($row['pl_placerequested']); |
|
1527 | + $mapstr4 = $mapstr4 . "&parent[" . $z . "]=" . Filter::escapeJs($levels[$z]); |
|
1528 | + $z++; |
|
1529 | + } |
|
1530 | + if ($matching) { |
|
1531 | + $matched[$x] = 1; |
|
1532 | + } |
|
1533 | + if ($matched[$x] != 0) { |
|
1534 | + echo $gedplace; |
|
1535 | + $z = 0; |
|
1536 | + while ($z < $max) { |
|
1537 | + if ($z < $parts) { |
|
1538 | + echo $plac[$z]; |
|
1539 | + echo $lati[$z]; |
|
1540 | + echo $long[$z]; |
|
1541 | + } else { |
|
1542 | + echo '<td></td>'; |
|
1543 | + echo '<td></td>'; |
|
1544 | + echo '<td></td>'; |
|
1545 | + } |
|
1546 | + $z++; |
|
1547 | + } |
|
1548 | + echo '</tr>'; |
|
1549 | + $countrows++; |
|
1550 | + } |
|
1551 | + $x++; |
|
1552 | + } |
|
1553 | + echo '</tbody>'; |
|
1554 | + echo '<tfoot>'; |
|
1555 | + echo '<tr>'; |
|
1556 | + echo '<td colspan="', (1 + 3 * $max), '">', /* I18N: A count of places */ I18N::translate('Total places: %s', I18N::number($countrows)), '</td>'; |
|
1557 | + echo '</tr>'; |
|
1558 | + echo '</tfoot>'; |
|
1559 | + echo '</table>'; |
|
1560 | + } |
|
1561 | + |
|
1562 | + /** |
|
1563 | + * Does an individual (or their spouse-families) have any facts with places? |
|
1564 | + * |
|
1565 | + * @param Individual $individual |
|
1566 | + * |
|
1567 | + * @return bool |
|
1568 | + */ |
|
1569 | + private function checkMapData(Individual $individual) { |
|
1570 | + $statement = Database::prepare( |
|
1571 | + "SELECT COUNT(*) FROM `##placelinks` WHERE pl_gid = :xref AND pl_file = :tree_id" |
|
1572 | + ); |
|
1573 | + $args = array( |
|
1574 | + 'xref' => $individual->getXref(), |
|
1575 | + 'tree_id' => $individual->getTree()->getTreeId(), |
|
1576 | + ); |
|
1577 | + |
|
1578 | + if ($statement->execute($args)->fetchOne()) { |
|
1579 | + return true; |
|
1580 | + } |
|
1581 | + |
|
1582 | + foreach ($individual->getSpouseFamilies() as $family) { |
|
1583 | + $args['xref'] = $family->getXref(); |
|
1584 | + if ($statement->execute($args)->fetchOne()) { |
|
1585 | + return true; |
|
1586 | + } |
|
1587 | + } |
|
1588 | + |
|
1589 | + return false; |
|
1590 | + } |
|
1591 | + |
|
1592 | + /** |
|
1593 | + * Remove prefixes from a place name to allow it to be matched. |
|
1594 | + * |
|
1595 | + * @param string $prefix_list |
|
1596 | + * @param string $place |
|
1597 | + * @param string[] $placelist |
|
1598 | + * |
|
1599 | + * @return string[] |
|
1600 | + */ |
|
1601 | + private function removePrefixFromPlaceName($prefix_list, $place, $placelist) { |
|
1602 | + if ($prefix_list) { |
|
1603 | + foreach (explode(';', $prefix_list) as $prefix) { |
|
1604 | + if ($prefix && substr($place, 0, strlen($prefix) + 1) == $prefix . ' ') { |
|
1605 | + $placelist[] = substr($place, strlen($prefix) + 1); |
|
1606 | + } |
|
1607 | + } |
|
1608 | + } |
|
1609 | + |
|
1610 | + return $placelist; |
|
1611 | + } |
|
1612 | + |
|
1613 | + /** |
|
1614 | + * Remove suffixes from a place name to allow it to be matched. |
|
1615 | + * |
|
1616 | + * @param string $suffix_list |
|
1617 | + * @param string $place |
|
1618 | + * @param string[] $placelist |
|
1619 | + * |
|
1620 | + * @return string[] |
|
1621 | + */ |
|
1622 | + private function removeSuffixFromPlaceName($suffix_list, $place, $placelist) { |
|
1623 | + if ($suffix_list) { |
|
1624 | + foreach (explode(';', $suffix_list) as $postfix) { |
|
1625 | + if ($postfix && substr($place, -strlen($postfix) - 1) == ' ' . $postfix) { |
|
1626 | + $placelist[] = substr($place, 0, strlen($place) - strlen($postfix) - 1); |
|
1627 | + } |
|
1628 | + } |
|
1629 | + } |
|
1630 | + |
|
1631 | + return $placelist; |
|
1632 | + } |
|
1633 | + |
|
1634 | + /** |
|
1635 | + * Remove prefixes and sufixes to allow place names to be matched. |
|
1636 | + * |
|
1637 | + * @param string $prefix_list |
|
1638 | + * @param string $suffix_list |
|
1639 | + * @param string $place |
|
1640 | + * @param string[] $placelist |
|
1641 | + * |
|
1642 | + * @return string[] |
|
1643 | + */ |
|
1644 | + private function removePrefixAndSuffixFromPlaceName($prefix_list, $suffix_list, $place, $placelist) { |
|
1645 | + if ($prefix_list && $suffix_list) { |
|
1646 | + foreach (explode(';', $prefix_list) as $prefix) { |
|
1647 | + foreach (explode(';', $suffix_list) as $postfix) { |
|
1648 | + if ($prefix && $postfix && substr($place, 0, strlen($prefix) + 1) == $prefix . ' ' && substr($place, -strlen($postfix) - 1) == ' ' . $postfix) { |
|
1649 | + $placelist[] = substr($place, strlen($prefix) + 1, strlen($place) - strlen($prefix) - strlen($postfix) - 2); |
|
1650 | + } |
|
1651 | + } |
|
1652 | + } |
|
1653 | + } |
|
1654 | + |
|
1655 | + return $placelist; |
|
1656 | + } |
|
1657 | + |
|
1658 | + /** |
|
1659 | + * Match placenames with different prefixes and suffixes. |
|
1660 | + * |
|
1661 | + * @param string $placename |
|
1662 | + * @param int $level |
|
1663 | + * |
|
1664 | + * @return string[] |
|
1665 | + */ |
|
1666 | + private function createPossiblePlaceNames($placename, $level) { |
|
1667 | + $retlist = array(); |
|
1668 | + if ($level <= 9) { |
|
1669 | + $retlist = $this->removePrefixAndSuffixFromPlaceName($this->getSetting('GM_PREFIX_' . $level), $this->getSetting('GM_POSTFIX_' . $level), $placename, $retlist); // Remove both |
|
1670 | + $retlist = $this->removePrefixFromPlaceName($this->getSetting('GM_PREFIX_' . $level), $placename, $retlist); // Remove prefix |
|
1671 | + $retlist = $this->removeSuffixFromPlaceName($this->getSetting('GM_POSTFIX_' . $level), $placename, $retlist); // Remove suffix |
|
1672 | + } |
|
1673 | + $retlist[] = $placename; // Exact |
|
1674 | + |
|
1675 | + return $retlist; |
|
1676 | + } |
|
1677 | + |
|
1678 | + /** |
|
1679 | + * Get the map co-ordinates of a place. |
|
1680 | + * |
|
1681 | + * @param string $place |
|
1682 | + * |
|
1683 | + * @return null|\stdClass |
|
1684 | + */ |
|
1685 | + private function getLatitudeAndLongitudeFromPlaceLocation($place) { |
|
1686 | + $parent = explode(',', $place); |
|
1687 | + $parent = array_reverse($parent); |
|
1688 | + $place_id = 0; |
|
1689 | + $num_parent = count($parent); |
|
1690 | + for ($i = 0; $i < $num_parent; $i++) { |
|
1691 | + $parent[$i] = trim($parent[$i]); |
|
1692 | + if (empty($parent[$i])) { |
|
1693 | + $parent[$i] = 'unknown'; // GoogleMap module uses "unknown" while GEDCOM uses , , |
|
1694 | + } |
|
1695 | + $placelist = $this->createPossiblePlaceNames($parent[$i], $i + 1); |
|
1696 | + foreach ($placelist as $placename) { |
|
1697 | + $pl_id = Database::prepare( |
|
1698 | + "SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place" |
|
1699 | + )->execute(array($i, $place_id, $placename))->fetchOne(); |
|
1700 | + if (!empty($pl_id)) { |
|
1701 | + break; |
|
1702 | + } |
|
1703 | + } |
|
1704 | + if (empty($pl_id)) { |
|
1705 | + break; |
|
1706 | + } |
|
1707 | + $place_id = $pl_id; |
|
1708 | + } |
|
1709 | + |
|
1710 | + return Database::prepare( |
|
1711 | + "SELECT sv_lati, sv_long, sv_bearing, sv_elevation, sv_zoom, pl_lati, pl_long, pl_zoom, pl_icon, pl_level" . |
|
1712 | + " FROM `##placelocation`" . |
|
1713 | + " WHERE pl_id = ?" . |
|
1714 | + " ORDER BY pl_place" |
|
1715 | + )->execute(array($place_id))->fetchOneRow(); |
|
1716 | + } |
|
1717 | + |
|
1718 | + /** |
|
1719 | + * @param Fact $fact |
|
1720 | + * |
|
1721 | + * @return array |
|
1722 | + */ |
|
1723 | + private function getPlaceData(Fact $fact) { |
|
1724 | + $result = array(); |
|
1725 | + |
|
1726 | + $has_latitude = preg_match('/\n4 LATI (.+)/', $fact->getGedcom(), $match1); |
|
1727 | + $has_longitude = preg_match('/\n4 LONG (.+)/', $fact->getGedcom(), $match2); |
|
1728 | + |
|
1729 | + // If co-ordinates are stored in the GEDCOM then use them |
|
1730 | + if ($has_latitude && $has_longitude) { |
|
1731 | + $result = array( |
|
1732 | + 'index' => 'ID' . $match1[1] . $match2[1], |
|
1733 | + 'mapdata' => array( |
|
1734 | + 'class' => 'optionbox', |
|
1735 | + 'place' => $fact->getPlace()->getFullName(), |
|
1736 | + 'tooltip' => $fact->getPlace()->getGedcomName(), |
|
1737 | + 'lat' => strtr($match1[1], array('N' => '', 'S' => '-', ',' => '.')), |
|
1738 | + 'lng' => strtr($match2[1], array('E' => '', 'W' => '-', ',' => '.')), |
|
1739 | + 'pl_icon' => '', |
|
1740 | + 'pl_zoom' => '0', |
|
1741 | + 'sv_bearing' => '0', |
|
1742 | + 'sv_elevation' => '0', |
|
1743 | + 'sv_lati' => '0', |
|
1744 | + 'sv_long' => '0', |
|
1745 | + 'sv_zoom' => '0', |
|
1746 | + 'events' => '', |
|
1747 | + ), |
|
1748 | + ); |
|
1749 | + } else { |
|
1750 | + $place_location = $this->getLatitudeAndLongitudeFromPlaceLocation($fact->getPlace()->getGedcomName()); |
|
1751 | + if ($place_location && $place_location->pl_lati && $place_location->pl_long) { |
|
1752 | + $result = array( |
|
1753 | + 'index' => 'ID' . $place_location->pl_lati . $place_location->pl_long, |
|
1754 | + 'mapdata' => array( |
|
1755 | + 'class' => 'optionbox', |
|
1756 | + 'place' => $fact->getPlace()->getFullName(), |
|
1757 | + 'tooltip' => $fact->getPlace()->getGedcomName(), |
|
1758 | + 'lat' => strtr($place_location->pl_lati, array('N' => '', 'S' => '-', ',' => '.')), |
|
1759 | + 'lng' => strtr($place_location->pl_long, array('E' => '', 'W' => '-', ',' => '.')), |
|
1760 | + 'pl_icon' => $place_location->pl_icon, |
|
1761 | + 'pl_zoom' => $place_location->pl_zoom, |
|
1762 | + 'sv_bearing' => $place_location->sv_bearing, |
|
1763 | + 'sv_elevation' => $place_location->sv_elevation, |
|
1764 | + 'sv_lati' => $place_location->sv_lati, |
|
1765 | + 'sv_long' => $place_location->sv_long, |
|
1766 | + 'sv_zoom' => $place_location->sv_zoom, |
|
1767 | + 'events' => '', |
|
1768 | + ), |
|
1769 | + ); |
|
1770 | + } |
|
1771 | + } |
|
1772 | + |
|
1773 | + return $result; |
|
1774 | + } |
|
1775 | + |
|
1776 | + /** |
|
1777 | + * Build a map for an individual. |
|
1778 | + * |
|
1779 | + * @param Individual $indi |
|
1780 | + */ |
|
1781 | + private function buildIndividualMap(Individual $indi) { |
|
1782 | + $GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM'); |
|
1783 | + $facts = $indi->getFacts(); |
|
1784 | + foreach ($indi->getSpouseFamilies() as $family) { |
|
1785 | + $facts = array_merge($facts, $family->getFacts()); |
|
1786 | + // Add birth of children from this family to the facts array |
|
1787 | + foreach ($family->getChildren() as $child) { |
|
1788 | + $birth_fact = $child->getFirstFact('BIRT'); |
|
1789 | + // Exclude children without birthplaces |
|
1790 | + // facts without places |
|
1791 | + if ($birth_fact !== null && $birth_fact->getPlace() !== null) { |
|
1792 | + $facts[] = $birth_fact; |
|
1793 | + } |
|
1794 | + } |
|
1795 | + } |
|
1796 | + |
|
1797 | + Functions::sortFacts($facts); |
|
1798 | + |
|
1799 | + // At this point we have an array of valid sorted facts |
|
1800 | + // so now build the data structures needed for the map display |
|
1801 | + $events = array(); |
|
1802 | + $unique_places = array(); |
|
1803 | + |
|
1804 | + foreach ($facts as $fact) { |
|
1805 | + $place_data = $this->getPlaceData($fact); |
|
1806 | + |
|
1807 | + if (!empty($place_data)) { |
|
1808 | + $index = $place_data['index']; |
|
1809 | + |
|
1810 | + if ($place_data['mapdata']['pl_zoom']) { |
|
1811 | + $GM_MAX_ZOOM = min($GM_MAX_ZOOM, $place_data['mapdata']['pl_zoom']); |
|
1812 | + } |
|
1813 | + // Produce the html for the sidebar |
|
1814 | + $parent = $fact->getParent(); |
|
1815 | + if ($parent instanceof Individual && $parent->getXref() !== $indi->getXref()) { |
|
1816 | + // Childs birth |
|
1817 | + $name = '<a href="' . $parent->getHtmlUrl() . '">' . $parent->getFullName() . '</a>'; |
|
1818 | + $label = strtr($parent->getSex(), array('F' => I18N::translate('Birth of a daughter'), 'M' => I18N::translate('Birth of a son'), 'U' => I18N::translate('Birth of a child'))); |
|
1819 | + $class = 'person_box' . strtr($parent->getSex(), array('F' => 'F', 'M' => '', 'U' => 'NN')); |
|
1820 | + $evtStr = '<div class="gm-event">' . $label . '<div><strong>' . $name . '</strong></div>' . $fact->getDate()->display(true) . '</div>'; |
|
1821 | + } else { |
|
1822 | + $spouse = $parent instanceof Family ? $parent->getSpouse($indi) : null; |
|
1823 | + $name = $spouse ? '<a href="' . $spouse->getHtmlUrl() . '">' . $spouse->getFullName() . '</a>' : ''; |
|
1824 | + $label = $fact->getLabel(); |
|
1825 | + $class = 'optionbox'; |
|
1826 | + if ($fact->getValue() && $spouse) { |
|
1827 | + $evtStr = '<div class="gm-event">' . $label . '<div>' . $fact->getValue() . '</div><strong>' . $name . '</strong>' . $fact->getDate()->display(true) . '</div>'; |
|
1828 | + } elseif ($spouse) { |
|
1829 | + $evtStr = '<div class="gm-event">' . $label . '<div><strong>' . $name . '</strong></div>' . $fact->getDate()->display(true) . '</div>'; |
|
1830 | + } elseif ($fact->getValue()) { |
|
1831 | + $evtStr = '<div class="gm-event">' . $label . '<div> ' . $fact->getValue() . '</div>' . $fact->getDate()->display(true) . '</div>'; |
|
1832 | + } else { |
|
1833 | + $evtStr = '<div class="gm-event">' . $label . '<div>' . $fact->getDate()->display(true) . '</div></div>'; |
|
1834 | + } |
|
1835 | + } |
|
1836 | + |
|
1837 | + if (empty($unique_places[$index])) { |
|
1838 | + $unique_places[$index] = $place_data['mapdata']; |
|
1839 | + } |
|
1840 | + $unique_places[$index]['events'] .= $evtStr; |
|
1841 | + $events[] = array( |
|
1842 | + 'class' => $class, |
|
1843 | + 'fact_label' => $label, |
|
1844 | + 'date' => $fact->getDate()->display(true), |
|
1845 | + 'info' => $fact->getValue(), |
|
1846 | + 'name' => $name, |
|
1847 | + 'place' => '<a href="' . $fact->getPlace()->getURL() . '">' . $fact->getPlace()->getFullName() . '</a>', |
|
1848 | + 'placeid' => $index, |
|
1849 | + ); |
|
1850 | + } |
|
1851 | + } |
|
1852 | + |
|
1853 | + if (!empty($events)) { |
|
1854 | + $places = array_keys($unique_places); |
|
1855 | + ob_start(); |
|
1856 | + // Create the normal googlemap sidebar of events and children |
|
1857 | + echo '<div class="gm-events"><table class="facts_table">'; |
|
1858 | + |
|
1859 | + foreach ($events as $event) { |
|
1860 | + $index = array_search($event['placeid'], $places); |
|
1861 | + echo '<tr>'; |
|
1862 | + echo '<td class="facts_label">'; |
|
1863 | + echo '<a href="#" onclick="return openInfowindow(\'', $index, '\')">', $event['fact_label'], '</a></td>'; |
|
1864 | + echo '<td class="', $event['class'], '">'; |
|
1865 | + if ($event['info']) { |
|
1866 | + echo '<div><span class="field">', Filter::escapeHtml($event['info']), '</span></div>'; |
|
1867 | + } |
|
1868 | + if ($event['name']) { |
|
1869 | + echo '<div>', $event['name'], '</div>'; |
|
1870 | + } |
|
1871 | + echo '<div>', $event['place'], '</div>'; |
|
1872 | + if ($event['date']) { |
|
1873 | + echo '<div>', $event['date'], '</div>'; |
|
1874 | + } |
|
1875 | + echo '</td>'; |
|
1876 | + echo '</tr>'; |
|
1877 | + } |
|
1878 | + |
|
1879 | + echo '</table></div>'; |
|
1880 | + |
|
1881 | + // *** ENABLE STREETVIEW *** |
|
1882 | + $STREETVIEW = (bool) $this->getSetting('GM_USE_STREETVIEW'); |
|
1883 | + ?> |
|
1884 | 1884 | |
1885 | 1885 | <script> |
1886 | 1886 | var map_center = new google.maps.LatLng(0, 0); |
@@ -2112,221 +2112,221 @@ discard block |
||
2112 | 2112 | |
2113 | 2113 | </script> |
2114 | 2114 | <?php |
2115 | - $html = ob_get_clean(); |
|
2116 | - } else { |
|
2117 | - $html = ''; |
|
2118 | - } |
|
2119 | - |
|
2120 | - return $html; |
|
2121 | - } |
|
2122 | - |
|
2123 | - /** |
|
2124 | - * Get the Location ID. |
|
2125 | - * |
|
2126 | - * @param string $place |
|
2127 | - * |
|
2128 | - * @return int |
|
2129 | - */ |
|
2130 | - private function getPlaceLocationId($place) { |
|
2131 | - $par = explode(',', strip_tags($place)); |
|
2132 | - $par = array_reverse($par); |
|
2133 | - $place_id = 0; |
|
2134 | - $pl_id = 0; |
|
2135 | - $num_par = count($par); |
|
2136 | - for ($i = 0; $i < $num_par; $i++) { |
|
2137 | - $par[$i] = trim($par[$i]); |
|
2138 | - if (empty($par[$i])) { |
|
2139 | - $par[$i] = 'unknown'; |
|
2140 | - } |
|
2141 | - $placelist = $this->createPossiblePlaceNames($par[$i], $i + 1); |
|
2142 | - foreach ($placelist as $key => $placename) { |
|
2143 | - $pl_id = (int) Database::prepare( |
|
2144 | - "SELECT pl_id FROM `##placelocation` WHERE pl_level = :level AND pl_parent_id = :parent_id AND pl_place LIKE :placename" |
|
2145 | - )->execute(array( |
|
2146 | - 'level' => $i, |
|
2147 | - 'parent_id' => $place_id, |
|
2148 | - 'placename' => $placename, |
|
2149 | - ))->fetchOne(); |
|
2150 | - if ($pl_id) { |
|
2151 | - break; |
|
2152 | - } |
|
2153 | - } |
|
2154 | - if (!$pl_id) { |
|
2155 | - break; |
|
2156 | - } |
|
2157 | - $place_id = $pl_id; |
|
2158 | - } |
|
2159 | - |
|
2160 | - return $place_id; |
|
2161 | - } |
|
2162 | - |
|
2163 | - /** |
|
2164 | - * Get the place ID. |
|
2165 | - * |
|
2166 | - * @param string $place |
|
2167 | - * |
|
2168 | - * @return int |
|
2169 | - */ |
|
2170 | - private function getPlaceId($place) { |
|
2171 | - global $WT_TREE; |
|
2172 | - |
|
2173 | - $par = explode(',', $place); |
|
2174 | - $par = array_reverse($par); |
|
2175 | - $place_id = 0; |
|
2176 | - $pl_id = 0; |
|
2177 | - $num_par = count($par); |
|
2178 | - for ($i = 0; $i < $num_par; $i++) { |
|
2179 | - $par[$i] = trim($par[$i]); |
|
2180 | - $placelist = $this->createPossiblePlaceNames($par[$i], $i + 1); |
|
2181 | - foreach ($placelist as $placename) { |
|
2182 | - $pl_id = (int) Database::prepare( |
|
2183 | - "SELECT p_id FROM `##places` WHERE p_parent_id = :place_id AND p_file = :tree_id AND p_place = :placename" |
|
2184 | - )->execute(array( |
|
2185 | - 'place_id' => $place_id, |
|
2186 | - 'tree_id' => $WT_TREE->getTreeId(), |
|
2187 | - 'placename' => $placename, |
|
2188 | - ))->fetchOne(); |
|
2189 | - if ($pl_id) { |
|
2190 | - break; |
|
2191 | - } |
|
2192 | - } |
|
2193 | - if (!$pl_id) { |
|
2194 | - break; |
|
2195 | - } |
|
2196 | - $place_id = $pl_id; |
|
2197 | - } |
|
2198 | - |
|
2199 | - return $place_id; |
|
2200 | - } |
|
2201 | - |
|
2202 | - /** |
|
2203 | - * Set the place IDs. |
|
2204 | - * |
|
2205 | - * @param int $level |
|
2206 | - * @param string[] $parent |
|
2207 | - * |
|
2208 | - * @return int |
|
2209 | - */ |
|
2210 | - private function setPlaceIdMap($level, $parent) { |
|
2211 | - $fullplace = ''; |
|
2212 | - if ($level == 0) { |
|
2213 | - return 0; |
|
2214 | - } else { |
|
2215 | - for ($i = 1; $i <= $level; $i++) { |
|
2216 | - $fullplace .= $parent[$level - $i] . ', '; |
|
2217 | - } |
|
2218 | - $fullplace = substr($fullplace, 0, -2); |
|
2219 | - |
|
2220 | - return $this->getPlaceId($fullplace); |
|
2221 | - } |
|
2222 | - } |
|
2223 | - |
|
2224 | - /** |
|
2225 | - * Set the map level. |
|
2226 | - * |
|
2227 | - * @param int $level |
|
2228 | - * @param string[] $parent |
|
2229 | - * |
|
2230 | - * @return int |
|
2231 | - */ |
|
2232 | - private function setLevelMap($level, $parent) { |
|
2233 | - $fullplace = ''; |
|
2234 | - if ($level == 0) { |
|
2235 | - return 0; |
|
2236 | - } else { |
|
2237 | - for ($i = 1; $i <= $level; $i++) { |
|
2238 | - if ($parent[$level - $i] != '') { |
|
2239 | - $fullplace .= $parent[$level - $i] . ', '; |
|
2240 | - } else { |
|
2241 | - $fullplace .= 'Unknown, '; |
|
2242 | - } |
|
2243 | - } |
|
2244 | - $fullplace = substr($fullplace, 0, -2); |
|
2245 | - |
|
2246 | - return $this->getPlaceLocationId($fullplace); |
|
2247 | - } |
|
2248 | - } |
|
2249 | - |
|
2250 | - /** |
|
2251 | - * Called by placelist.php |
|
2252 | - */ |
|
2253 | - public function createMap() { |
|
2254 | - global $level, $levelm, $plzoom, $WT_TREE; |
|
2255 | - |
|
2256 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
2257 | - |
|
2258 | - $STREETVIEW = (bool) $this->getSetting('GM_USE_STREETVIEW'); |
|
2259 | - $parent = Filter::getArray('parent'); |
|
2260 | - $levelm = $this->setLevelMap($level, $parent); |
|
2261 | - |
|
2262 | - $latlng = |
|
2263 | - Database::prepare("SELECT pl_place, pl_id, pl_lati, pl_long, pl_zoom, sv_long, sv_lati, sv_bearing, sv_elevation, sv_zoom FROM `##placelocation` WHERE pl_id=?") |
|
2264 | - ->execute(array($levelm)) |
|
2265 | - ->fetch(PDO::FETCH_ASSOC); |
|
2266 | - |
|
2267 | - echo '<table style="margin:auto; border-collapse: collapse;">'; |
|
2268 | - echo '<tr style="vertical-align:top;"><td>'; |
|
2269 | - if ($STREETVIEW && $level != 0) { |
|
2270 | - // Leave space for the Street View buttons, so that the maps align vertically |
|
2271 | - echo '<div id="place_map" style="margin-top:25px; border:1px solid gray; width: ', $this->getSetting('GM_PH_XSIZE'), 'px; height: ', $this->getSetting('GM_PH_YSIZE'), 'px; '; |
|
2272 | - } else { |
|
2273 | - echo '<div id="place_map" style="border:1px solid gray; width:', $this->getSetting('GM_PH_XSIZE'), 'px; height:', $this->getSetting('GM_PH_YSIZE'), 'px; '; |
|
2274 | - } |
|
2275 | - echo '"><i class="icon-loading-large"></i></div>'; |
|
2276 | - echo '<script src="', $this->googleMapsScript(), '"></script>'; |
|
2277 | - |
|
2278 | - $plzoom = $latlng['pl_zoom']; // Map zoom level |
|
2279 | - |
|
2280 | - if (Auth::isAdmin()) { |
|
2281 | - $placecheck_url = 'module.php?mod=googlemap&mod_action=admin_placecheck'; |
|
2282 | - if ($parent && isset($parent[0])) { |
|
2283 | - $placecheck_url .= '&country=' . $parent[0]; |
|
2284 | - if (isset($parent[1])) { |
|
2285 | - $placecheck_url .= '&state=' . $parent[1]; |
|
2286 | - } |
|
2287 | - } |
|
2288 | - $adminplaces_url = 'module.php?mod=googlemap&mod_action=admin_places'; |
|
2289 | - if ($latlng && isset($latlng['pl_id'])) { |
|
2290 | - $adminplaces_url .= '&parent=' . $latlng['pl_id']; |
|
2291 | - } |
|
2292 | - $update_places_url = 'admin_trees_places.php?ged=' . $WT_TREE->getNameHtml() . '&search=' . urlencode(implode(', ', array_reverse($parent))); |
|
2293 | - echo '<div class="gm-options">'; |
|
2294 | - echo '<a href="module.php?mod=googlemap&mod_action=admin_config">', I18N::translate('Google Maps™ preferences'), '</a>'; |
|
2295 | - echo ' | <a href="' . $adminplaces_url . '">' . I18N::translate('Geographic data') . '</a>'; |
|
2296 | - echo ' | <a href="' . $placecheck_url . '">' . I18N::translate('Place check') . '</a>'; |
|
2297 | - echo ' | <a href="' . $update_places_url . '">' . I18N::translate('Update place names') . '</a>'; |
|
2298 | - echo '</div>'; |
|
2299 | - } |
|
2300 | - echo '</td>'; |
|
2301 | - |
|
2302 | - if ($STREETVIEW) { |
|
2303 | - echo '<td>'; |
|
2304 | - |
|
2305 | - global $pl_lati, $pl_long; |
|
2306 | - if ($level >= 1) { |
|
2307 | - $pl_lati = strtr($latlng['pl_lati'], array('N' => '', 'S' => '-', ',' => '.')); // WT_placelocation lati |
|
2308 | - $pl_long = strtr($latlng['pl_long'], array('E' => '', 'W' => '-', ',' => '.')); // WT_placelocation long |
|
2309 | - |
|
2310 | - // Check if Streetview location parameters are stored in database |
|
2311 | - $placeid = $latlng['pl_id']; // Placelocation place id |
|
2312 | - $sv_lat = $latlng['sv_lati']; // StreetView Point of View Latitude |
|
2313 | - $sv_lng = $latlng['sv_long']; // StreetView Point of View Longitude |
|
2314 | - $sv_dir = $latlng['sv_bearing']; // StreetView Point of View Direction (degrees from North) |
|
2315 | - $sv_pitch = $latlng['sv_elevation']; // StreetView Point of View Elevation (+90 to -90 degrees (+=down, -=up) |
|
2316 | - $sv_zoom = $latlng['sv_zoom']; // StreetView Point of View Zoom (0, 1, 2 or 3) |
|
2317 | - |
|
2318 | - // Check if Street View Lati/Long are the default of 0, if so use regular Place Lati/Long to set an initial location for the panda |
|
2319 | - if ($latlng['sv_lati'] == 0 && $latlng['sv_long'] == 0) { |
|
2320 | - $sv_lat = $pl_lati; |
|
2321 | - $sv_lng = $pl_long; |
|
2322 | - } |
|
2323 | - $frameheight = $this->getSetting('GM_PH_YSIZE') + 35; // Add height of buttons |
|
2324 | - |
|
2325 | - ?> |
|
2115 | + $html = ob_get_clean(); |
|
2116 | + } else { |
|
2117 | + $html = ''; |
|
2118 | + } |
|
2119 | + |
|
2120 | + return $html; |
|
2121 | + } |
|
2122 | + |
|
2123 | + /** |
|
2124 | + * Get the Location ID. |
|
2125 | + * |
|
2126 | + * @param string $place |
|
2127 | + * |
|
2128 | + * @return int |
|
2129 | + */ |
|
2130 | + private function getPlaceLocationId($place) { |
|
2131 | + $par = explode(',', strip_tags($place)); |
|
2132 | + $par = array_reverse($par); |
|
2133 | + $place_id = 0; |
|
2134 | + $pl_id = 0; |
|
2135 | + $num_par = count($par); |
|
2136 | + for ($i = 0; $i < $num_par; $i++) { |
|
2137 | + $par[$i] = trim($par[$i]); |
|
2138 | + if (empty($par[$i])) { |
|
2139 | + $par[$i] = 'unknown'; |
|
2140 | + } |
|
2141 | + $placelist = $this->createPossiblePlaceNames($par[$i], $i + 1); |
|
2142 | + foreach ($placelist as $key => $placename) { |
|
2143 | + $pl_id = (int) Database::prepare( |
|
2144 | + "SELECT pl_id FROM `##placelocation` WHERE pl_level = :level AND pl_parent_id = :parent_id AND pl_place LIKE :placename" |
|
2145 | + )->execute(array( |
|
2146 | + 'level' => $i, |
|
2147 | + 'parent_id' => $place_id, |
|
2148 | + 'placename' => $placename, |
|
2149 | + ))->fetchOne(); |
|
2150 | + if ($pl_id) { |
|
2151 | + break; |
|
2152 | + } |
|
2153 | + } |
|
2154 | + if (!$pl_id) { |
|
2155 | + break; |
|
2156 | + } |
|
2157 | + $place_id = $pl_id; |
|
2158 | + } |
|
2159 | + |
|
2160 | + return $place_id; |
|
2161 | + } |
|
2162 | + |
|
2163 | + /** |
|
2164 | + * Get the place ID. |
|
2165 | + * |
|
2166 | + * @param string $place |
|
2167 | + * |
|
2168 | + * @return int |
|
2169 | + */ |
|
2170 | + private function getPlaceId($place) { |
|
2171 | + global $WT_TREE; |
|
2172 | + |
|
2173 | + $par = explode(',', $place); |
|
2174 | + $par = array_reverse($par); |
|
2175 | + $place_id = 0; |
|
2176 | + $pl_id = 0; |
|
2177 | + $num_par = count($par); |
|
2178 | + for ($i = 0; $i < $num_par; $i++) { |
|
2179 | + $par[$i] = trim($par[$i]); |
|
2180 | + $placelist = $this->createPossiblePlaceNames($par[$i], $i + 1); |
|
2181 | + foreach ($placelist as $placename) { |
|
2182 | + $pl_id = (int) Database::prepare( |
|
2183 | + "SELECT p_id FROM `##places` WHERE p_parent_id = :place_id AND p_file = :tree_id AND p_place = :placename" |
|
2184 | + )->execute(array( |
|
2185 | + 'place_id' => $place_id, |
|
2186 | + 'tree_id' => $WT_TREE->getTreeId(), |
|
2187 | + 'placename' => $placename, |
|
2188 | + ))->fetchOne(); |
|
2189 | + if ($pl_id) { |
|
2190 | + break; |
|
2191 | + } |
|
2192 | + } |
|
2193 | + if (!$pl_id) { |
|
2194 | + break; |
|
2195 | + } |
|
2196 | + $place_id = $pl_id; |
|
2197 | + } |
|
2198 | + |
|
2199 | + return $place_id; |
|
2200 | + } |
|
2201 | + |
|
2202 | + /** |
|
2203 | + * Set the place IDs. |
|
2204 | + * |
|
2205 | + * @param int $level |
|
2206 | + * @param string[] $parent |
|
2207 | + * |
|
2208 | + * @return int |
|
2209 | + */ |
|
2210 | + private function setPlaceIdMap($level, $parent) { |
|
2211 | + $fullplace = ''; |
|
2212 | + if ($level == 0) { |
|
2213 | + return 0; |
|
2214 | + } else { |
|
2215 | + for ($i = 1; $i <= $level; $i++) { |
|
2216 | + $fullplace .= $parent[$level - $i] . ', '; |
|
2217 | + } |
|
2218 | + $fullplace = substr($fullplace, 0, -2); |
|
2219 | + |
|
2220 | + return $this->getPlaceId($fullplace); |
|
2221 | + } |
|
2222 | + } |
|
2223 | + |
|
2224 | + /** |
|
2225 | + * Set the map level. |
|
2226 | + * |
|
2227 | + * @param int $level |
|
2228 | + * @param string[] $parent |
|
2229 | + * |
|
2230 | + * @return int |
|
2231 | + */ |
|
2232 | + private function setLevelMap($level, $parent) { |
|
2233 | + $fullplace = ''; |
|
2234 | + if ($level == 0) { |
|
2235 | + return 0; |
|
2236 | + } else { |
|
2237 | + for ($i = 1; $i <= $level; $i++) { |
|
2238 | + if ($parent[$level - $i] != '') { |
|
2239 | + $fullplace .= $parent[$level - $i] . ', '; |
|
2240 | + } else { |
|
2241 | + $fullplace .= 'Unknown, '; |
|
2242 | + } |
|
2243 | + } |
|
2244 | + $fullplace = substr($fullplace, 0, -2); |
|
2245 | + |
|
2246 | + return $this->getPlaceLocationId($fullplace); |
|
2247 | + } |
|
2248 | + } |
|
2249 | + |
|
2250 | + /** |
|
2251 | + * Called by placelist.php |
|
2252 | + */ |
|
2253 | + public function createMap() { |
|
2254 | + global $level, $levelm, $plzoom, $WT_TREE; |
|
2255 | + |
|
2256 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
2257 | + |
|
2258 | + $STREETVIEW = (bool) $this->getSetting('GM_USE_STREETVIEW'); |
|
2259 | + $parent = Filter::getArray('parent'); |
|
2260 | + $levelm = $this->setLevelMap($level, $parent); |
|
2261 | + |
|
2262 | + $latlng = |
|
2263 | + Database::prepare("SELECT pl_place, pl_id, pl_lati, pl_long, pl_zoom, sv_long, sv_lati, sv_bearing, sv_elevation, sv_zoom FROM `##placelocation` WHERE pl_id=?") |
|
2264 | + ->execute(array($levelm)) |
|
2265 | + ->fetch(PDO::FETCH_ASSOC); |
|
2266 | + |
|
2267 | + echo '<table style="margin:auto; border-collapse: collapse;">'; |
|
2268 | + echo '<tr style="vertical-align:top;"><td>'; |
|
2269 | + if ($STREETVIEW && $level != 0) { |
|
2270 | + // Leave space for the Street View buttons, so that the maps align vertically |
|
2271 | + echo '<div id="place_map" style="margin-top:25px; border:1px solid gray; width: ', $this->getSetting('GM_PH_XSIZE'), 'px; height: ', $this->getSetting('GM_PH_YSIZE'), 'px; '; |
|
2272 | + } else { |
|
2273 | + echo '<div id="place_map" style="border:1px solid gray; width:', $this->getSetting('GM_PH_XSIZE'), 'px; height:', $this->getSetting('GM_PH_YSIZE'), 'px; '; |
|
2274 | + } |
|
2275 | + echo '"><i class="icon-loading-large"></i></div>'; |
|
2276 | + echo '<script src="', $this->googleMapsScript(), '"></script>'; |
|
2277 | + |
|
2278 | + $plzoom = $latlng['pl_zoom']; // Map zoom level |
|
2279 | + |
|
2280 | + if (Auth::isAdmin()) { |
|
2281 | + $placecheck_url = 'module.php?mod=googlemap&mod_action=admin_placecheck'; |
|
2282 | + if ($parent && isset($parent[0])) { |
|
2283 | + $placecheck_url .= '&country=' . $parent[0]; |
|
2284 | + if (isset($parent[1])) { |
|
2285 | + $placecheck_url .= '&state=' . $parent[1]; |
|
2286 | + } |
|
2287 | + } |
|
2288 | + $adminplaces_url = 'module.php?mod=googlemap&mod_action=admin_places'; |
|
2289 | + if ($latlng && isset($latlng['pl_id'])) { |
|
2290 | + $adminplaces_url .= '&parent=' . $latlng['pl_id']; |
|
2291 | + } |
|
2292 | + $update_places_url = 'admin_trees_places.php?ged=' . $WT_TREE->getNameHtml() . '&search=' . urlencode(implode(', ', array_reverse($parent))); |
|
2293 | + echo '<div class="gm-options">'; |
|
2294 | + echo '<a href="module.php?mod=googlemap&mod_action=admin_config">', I18N::translate('Google Maps™ preferences'), '</a>'; |
|
2295 | + echo ' | <a href="' . $adminplaces_url . '">' . I18N::translate('Geographic data') . '</a>'; |
|
2296 | + echo ' | <a href="' . $placecheck_url . '">' . I18N::translate('Place check') . '</a>'; |
|
2297 | + echo ' | <a href="' . $update_places_url . '">' . I18N::translate('Update place names') . '</a>'; |
|
2298 | + echo '</div>'; |
|
2299 | + } |
|
2300 | + echo '</td>'; |
|
2301 | + |
|
2302 | + if ($STREETVIEW) { |
|
2303 | + echo '<td>'; |
|
2304 | + |
|
2305 | + global $pl_lati, $pl_long; |
|
2306 | + if ($level >= 1) { |
|
2307 | + $pl_lati = strtr($latlng['pl_lati'], array('N' => '', 'S' => '-', ',' => '.')); // WT_placelocation lati |
|
2308 | + $pl_long = strtr($latlng['pl_long'], array('E' => '', 'W' => '-', ',' => '.')); // WT_placelocation long |
|
2309 | + |
|
2310 | + // Check if Streetview location parameters are stored in database |
|
2311 | + $placeid = $latlng['pl_id']; // Placelocation place id |
|
2312 | + $sv_lat = $latlng['sv_lati']; // StreetView Point of View Latitude |
|
2313 | + $sv_lng = $latlng['sv_long']; // StreetView Point of View Longitude |
|
2314 | + $sv_dir = $latlng['sv_bearing']; // StreetView Point of View Direction (degrees from North) |
|
2315 | + $sv_pitch = $latlng['sv_elevation']; // StreetView Point of View Elevation (+90 to -90 degrees (+=down, -=up) |
|
2316 | + $sv_zoom = $latlng['sv_zoom']; // StreetView Point of View Zoom (0, 1, 2 or 3) |
|
2317 | + |
|
2318 | + // Check if Street View Lati/Long are the default of 0, if so use regular Place Lati/Long to set an initial location for the panda |
|
2319 | + if ($latlng['sv_lati'] == 0 && $latlng['sv_long'] == 0) { |
|
2320 | + $sv_lat = $pl_lati; |
|
2321 | + $sv_lng = $pl_long; |
|
2322 | + } |
|
2323 | + $frameheight = $this->getSetting('GM_PH_YSIZE') + 35; // Add height of buttons |
|
2324 | + |
|
2325 | + ?> |
|
2326 | 2326 | <iframe class="gm-streetview-frame" style="height: <?php echo $frameheight ?>px;" src="module.php?mod=googlemap&mod_action=wt_street_view&x=<?php echo $sv_lng ?>&y=<?php echo $sv_lat ?>&z=18&t=2&c=1&s=1&b=<?php echo $sv_dir ?>&p=<?php echo $sv_pitch ?>&m=<?php echo $sv_zoom ?>&j=1&k=1&v=1"></iframe> |
2327 | 2327 | <?php |
2328 | - if (Auth::isAdmin()) { |
|
2329 | - ?> |
|
2328 | + if (Auth::isAdmin()) { |
|
2329 | + ?> |
|
2330 | 2330 | <div class="gm-streetview-parameters"> |
2331 | 2331 | <form method="post" action="module.php?mod=googlemap&mod_action=places_edit"> |
2332 | 2332 | <?php echo Filter::getCsrf() ?> |
@@ -2347,131 +2347,131 @@ discard block |
||
2347 | 2347 | </form> |
2348 | 2348 | </div> |
2349 | 2349 | <?php |
2350 | - } |
|
2351 | - } |
|
2352 | - echo '</td>'; |
|
2353 | - } |
|
2354 | - echo '</tr></table>'; |
|
2355 | - } |
|
2356 | - |
|
2357 | - /** |
|
2358 | - * Print the numbers of individuals. |
|
2359 | - * |
|
2360 | - * @param int $level |
|
2361 | - * @param string[] $parent |
|
2362 | - */ |
|
2363 | - private function printHowManyPeople($level, $parent) { |
|
2364 | - global $WT_TREE; |
|
2365 | - |
|
2366 | - $stats = new Stats($WT_TREE); |
|
2367 | - |
|
2368 | - $place_count_indi = 0; |
|
2369 | - $place_count_fam = 0; |
|
2370 | - if (!isset($parent[$level - 1])) { |
|
2371 | - $parent[$level - 1] = ''; |
|
2372 | - } |
|
2373 | - $p_id = $this->setPlaceIdMap($level, $parent); |
|
2374 | - $indi = $stats->statsPlaces('INDI', false, $p_id); |
|
2375 | - $fam = $stats->statsPlaces('FAM', false, $p_id); |
|
2376 | - foreach ($indi as $place) { |
|
2377 | - $place_count_indi = $place['tot']; |
|
2378 | - } |
|
2379 | - foreach ($fam as $place) { |
|
2380 | - $place_count_fam = $place['tot']; |
|
2381 | - } |
|
2382 | - echo '<br><br>', I18N::translate('Individuals'), ': ', $place_count_indi, ', ', I18N::translate('Families'), ': ', $place_count_fam; |
|
2383 | - } |
|
2384 | - |
|
2385 | - /** |
|
2386 | - * Print the flags and markers. |
|
2387 | - * |
|
2388 | - * @param string[] $place2 |
|
2389 | - * @param int $level |
|
2390 | - * @param string[] $parent |
|
2391 | - * @param int $levelm |
|
2392 | - * @param string $linklevels |
|
2393 | - */ |
|
2394 | - private function printGoogleMapMarkers($place2, $level, $parent, $levelm, $linklevels) { |
|
2395 | - echo 'var icon_url = null;'; |
|
2396 | - if (!$place2['lati'] || !$place2['long']) { |
|
2397 | - echo 'var icon_url ="' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/marker_yellow.png";'; |
|
2398 | - echo 'var point = new google.maps.LatLng(0, 0);'; |
|
2399 | - echo 'var marker = createMarker(point, "<div style=\"width: 250px;\"><a href=\"?action=find', $linklevels, '&parent[' . $level . ']='; |
|
2400 | - |
|
2401 | - if ($place2['place'] == 'Unknown') { |
|
2402 | - echo '\"><br>'; |
|
2403 | - } else { |
|
2404 | - echo addslashes($place2['place']), '\"><br>'; |
|
2405 | - } |
|
2406 | - if (($place2['icon'] !== null) && ($place2['icon'] !== '')) { |
|
2407 | - echo '<img src=\"', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place2['icon'], '\"> '; |
|
2408 | - } |
|
2409 | - if ($place2['place'] == 'Unknown') { |
|
2410 | - echo I18N::translate('unknown'); |
|
2411 | - } else { |
|
2412 | - echo addslashes($place2['place']); |
|
2413 | - } |
|
2414 | - echo '</a>'; |
|
2415 | - $parent[$level] = $place2['place']; |
|
2416 | - $this->printHowManyPeople($level + 1, $parent); |
|
2417 | - echo '<br>', I18N::translate('This place has no coordinates'); |
|
2418 | - if (Auth::isAdmin()) { |
|
2419 | - echo '<br><a href=\"module.php?mod=googlemap&mod_action=admin_places&parent=', $levelm, '&display=inactive\">', I18N::translate('Geographic data'), '</a>'; |
|
2420 | - } |
|
2421 | - echo '</div>", icon_url, "', str_replace(array('‎', '‏'), array(WT_UTF8_LRM, WT_UTF8_RLM), addslashes($place2['place'])), '");'; |
|
2422 | - } else { |
|
2423 | - $lati = strtr($place2['lati'], array('N' => '', 'S' => '-', ',' => '.')); |
|
2424 | - $long = strtr($place2['long'], array('E' => '', 'W' => '-', ',' => '.')); |
|
2425 | - //delete leading zero |
|
2426 | - if ($lati >= 0) { |
|
2427 | - $lati = abs($lati); |
|
2428 | - } elseif ($lati < 0) { |
|
2429 | - $lati = '-' . abs($lati); |
|
2430 | - } |
|
2431 | - if ($long >= 0) { |
|
2432 | - $long = abs($long); |
|
2433 | - } elseif ($long < 0) { |
|
2434 | - $long = '-' . abs($long); |
|
2435 | - } |
|
2436 | - |
|
2437 | - if ($place2['icon'] !== null && $place2['icon'] !== '' && $this->getSetting('GM_PH_MARKER') === 'G_FLAG') { |
|
2438 | - echo 'icon_url = "', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place2['icon'], '";'; |
|
2439 | - } |
|
2440 | - echo 'var point = new google.maps.LatLng(', $lati, ', ', $long, ');'; |
|
2441 | - echo 'var marker = createMarker(point, "<div style=\"width: 250px;\"><a href=\"?action=find', $linklevels; |
|
2442 | - echo '&parent[', $level, ']='; |
|
2443 | - if ($place2['place'] !== 'Unknown') { |
|
2444 | - echo Filter::escapeJs($place2['place']); |
|
2445 | - } |
|
2446 | - echo '\"><br>'; |
|
2447 | - if ($place2['icon'] !== null && $place2['icon'] !== '') { |
|
2448 | - echo '<img src=\"', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place2['icon'], '\"> '; |
|
2449 | - } |
|
2450 | - if ($place2['place'] === 'Unknown') { |
|
2451 | - echo I18N::translate('unknown'); |
|
2452 | - } else { |
|
2453 | - echo Filter::escapeJs($place2['place']); |
|
2454 | - } |
|
2455 | - echo '</a>'; |
|
2456 | - $parent[$level] = $place2['place']; |
|
2457 | - $this->printHowManyPeople($level + 1, $parent); |
|
2458 | - echo '</div>", icon_url, "', Filter::escapeJs($place2['place']), '");'; |
|
2459 | - } |
|
2460 | - } |
|
2461 | - |
|
2462 | - /** |
|
2463 | - * Called by placelist.php |
|
2464 | - * |
|
2465 | - * @param int $numfound |
|
2466 | - * @param int $level |
|
2467 | - * @param string[] $parent |
|
2468 | - * @param string $linklevels |
|
2469 | - * @param string[] $place_names |
|
2470 | - */ |
|
2471 | - public function mapScripts($numfound, $level, $parent, $linklevels, $place_names) { |
|
2472 | - global $plzoom, $controller; |
|
2473 | - |
|
2474 | - $controller->addInlineJavascript(' |
|
2350 | + } |
|
2351 | + } |
|
2352 | + echo '</td>'; |
|
2353 | + } |
|
2354 | + echo '</tr></table>'; |
|
2355 | + } |
|
2356 | + |
|
2357 | + /** |
|
2358 | + * Print the numbers of individuals. |
|
2359 | + * |
|
2360 | + * @param int $level |
|
2361 | + * @param string[] $parent |
|
2362 | + */ |
|
2363 | + private function printHowManyPeople($level, $parent) { |
|
2364 | + global $WT_TREE; |
|
2365 | + |
|
2366 | + $stats = new Stats($WT_TREE); |
|
2367 | + |
|
2368 | + $place_count_indi = 0; |
|
2369 | + $place_count_fam = 0; |
|
2370 | + if (!isset($parent[$level - 1])) { |
|
2371 | + $parent[$level - 1] = ''; |
|
2372 | + } |
|
2373 | + $p_id = $this->setPlaceIdMap($level, $parent); |
|
2374 | + $indi = $stats->statsPlaces('INDI', false, $p_id); |
|
2375 | + $fam = $stats->statsPlaces('FAM', false, $p_id); |
|
2376 | + foreach ($indi as $place) { |
|
2377 | + $place_count_indi = $place['tot']; |
|
2378 | + } |
|
2379 | + foreach ($fam as $place) { |
|
2380 | + $place_count_fam = $place['tot']; |
|
2381 | + } |
|
2382 | + echo '<br><br>', I18N::translate('Individuals'), ': ', $place_count_indi, ', ', I18N::translate('Families'), ': ', $place_count_fam; |
|
2383 | + } |
|
2384 | + |
|
2385 | + /** |
|
2386 | + * Print the flags and markers. |
|
2387 | + * |
|
2388 | + * @param string[] $place2 |
|
2389 | + * @param int $level |
|
2390 | + * @param string[] $parent |
|
2391 | + * @param int $levelm |
|
2392 | + * @param string $linklevels |
|
2393 | + */ |
|
2394 | + private function printGoogleMapMarkers($place2, $level, $parent, $levelm, $linklevels) { |
|
2395 | + echo 'var icon_url = null;'; |
|
2396 | + if (!$place2['lati'] || !$place2['long']) { |
|
2397 | + echo 'var icon_url ="' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/marker_yellow.png";'; |
|
2398 | + echo 'var point = new google.maps.LatLng(0, 0);'; |
|
2399 | + echo 'var marker = createMarker(point, "<div style=\"width: 250px;\"><a href=\"?action=find', $linklevels, '&parent[' . $level . ']='; |
|
2400 | + |
|
2401 | + if ($place2['place'] == 'Unknown') { |
|
2402 | + echo '\"><br>'; |
|
2403 | + } else { |
|
2404 | + echo addslashes($place2['place']), '\"><br>'; |
|
2405 | + } |
|
2406 | + if (($place2['icon'] !== null) && ($place2['icon'] !== '')) { |
|
2407 | + echo '<img src=\"', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place2['icon'], '\"> '; |
|
2408 | + } |
|
2409 | + if ($place2['place'] == 'Unknown') { |
|
2410 | + echo I18N::translate('unknown'); |
|
2411 | + } else { |
|
2412 | + echo addslashes($place2['place']); |
|
2413 | + } |
|
2414 | + echo '</a>'; |
|
2415 | + $parent[$level] = $place2['place']; |
|
2416 | + $this->printHowManyPeople($level + 1, $parent); |
|
2417 | + echo '<br>', I18N::translate('This place has no coordinates'); |
|
2418 | + if (Auth::isAdmin()) { |
|
2419 | + echo '<br><a href=\"module.php?mod=googlemap&mod_action=admin_places&parent=', $levelm, '&display=inactive\">', I18N::translate('Geographic data'), '</a>'; |
|
2420 | + } |
|
2421 | + echo '</div>", icon_url, "', str_replace(array('‎', '‏'), array(WT_UTF8_LRM, WT_UTF8_RLM), addslashes($place2['place'])), '");'; |
|
2422 | + } else { |
|
2423 | + $lati = strtr($place2['lati'], array('N' => '', 'S' => '-', ',' => '.')); |
|
2424 | + $long = strtr($place2['long'], array('E' => '', 'W' => '-', ',' => '.')); |
|
2425 | + //delete leading zero |
|
2426 | + if ($lati >= 0) { |
|
2427 | + $lati = abs($lati); |
|
2428 | + } elseif ($lati < 0) { |
|
2429 | + $lati = '-' . abs($lati); |
|
2430 | + } |
|
2431 | + if ($long >= 0) { |
|
2432 | + $long = abs($long); |
|
2433 | + } elseif ($long < 0) { |
|
2434 | + $long = '-' . abs($long); |
|
2435 | + } |
|
2436 | + |
|
2437 | + if ($place2['icon'] !== null && $place2['icon'] !== '' && $this->getSetting('GM_PH_MARKER') === 'G_FLAG') { |
|
2438 | + echo 'icon_url = "', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place2['icon'], '";'; |
|
2439 | + } |
|
2440 | + echo 'var point = new google.maps.LatLng(', $lati, ', ', $long, ');'; |
|
2441 | + echo 'var marker = createMarker(point, "<div style=\"width: 250px;\"><a href=\"?action=find', $linklevels; |
|
2442 | + echo '&parent[', $level, ']='; |
|
2443 | + if ($place2['place'] !== 'Unknown') { |
|
2444 | + echo Filter::escapeJs($place2['place']); |
|
2445 | + } |
|
2446 | + echo '\"><br>'; |
|
2447 | + if ($place2['icon'] !== null && $place2['icon'] !== '') { |
|
2448 | + echo '<img src=\"', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place2['icon'], '\"> '; |
|
2449 | + } |
|
2450 | + if ($place2['place'] === 'Unknown') { |
|
2451 | + echo I18N::translate('unknown'); |
|
2452 | + } else { |
|
2453 | + echo Filter::escapeJs($place2['place']); |
|
2454 | + } |
|
2455 | + echo '</a>'; |
|
2456 | + $parent[$level] = $place2['place']; |
|
2457 | + $this->printHowManyPeople($level + 1, $parent); |
|
2458 | + echo '</div>", icon_url, "', Filter::escapeJs($place2['place']), '");'; |
|
2459 | + } |
|
2460 | + } |
|
2461 | + |
|
2462 | + /** |
|
2463 | + * Called by placelist.php |
|
2464 | + * |
|
2465 | + * @param int $numfound |
|
2466 | + * @param int $level |
|
2467 | + * @param string[] $parent |
|
2468 | + * @param string $linklevels |
|
2469 | + * @param string[] $place_names |
|
2470 | + */ |
|
2471 | + public function mapScripts($numfound, $level, $parent, $linklevels, $place_names) { |
|
2472 | + global $plzoom, $controller; |
|
2473 | + |
|
2474 | + $controller->addInlineJavascript(' |
|
2475 | 2475 | jQuery("head").append(\'<link rel="stylesheet" type="text/css" href="' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/css/wt_v3_googlemap.css" />\'); |
2476 | 2476 | var numMarkers = "' . $numfound . '"; |
2477 | 2477 | var mapLevel = "' . $level . '"; |
@@ -2577,372 +2577,372 @@ discard block |
||
2577 | 2577 | } |
2578 | 2578 | '); |
2579 | 2579 | |
2580 | - $levelm = $this->setLevelMap($level, $parent); |
|
2581 | - |
|
2582 | - //create markers |
|
2583 | - ob_start(); |
|
2584 | - |
|
2585 | - if ($numfound == 0 && $level > 0) { |
|
2586 | - // show the current place on the map |
|
2587 | - |
|
2588 | - $place = Database::prepare("SELECT pl_id AS place_id, pl_place AS place, pl_lati AS lati, pl_long AS `long`, pl_zoom AS zoom, pl_icon AS icon FROM `##placelocation` WHERE pl_id=?") |
|
2589 | - ->execute(array($levelm)) |
|
2590 | - ->fetch(PDO::FETCH_ASSOC); |
|
2591 | - |
|
2592 | - if ($place) { |
|
2593 | - // re-calculate the hierarchy information required to display the current place |
|
2594 | - $thisloc = $parent; |
|
2595 | - array_pop($thisloc); |
|
2596 | - $thislevel = $level - 1; |
|
2597 | - $thislinklevels = substr($linklevels, 0, strrpos($linklevels, '&')); |
|
2598 | - |
|
2599 | - $this->printGoogleMapMarkers($place, $thislevel, $thisloc, $place['place_id'], $thislinklevels); |
|
2600 | - } |
|
2601 | - } |
|
2602 | - |
|
2603 | - // display any sub-places |
|
2604 | - $placeidlist = array(); |
|
2605 | - foreach ($place_names as $placename) { |
|
2606 | - $thisloc = $parent; |
|
2607 | - $thisloc[] = $placename; |
|
2608 | - $this_levelm = $this->setLevelMap($level + 1, $thisloc); |
|
2609 | - if ($this_levelm) { |
|
2610 | - $placeidlist[] = $this_levelm; |
|
2611 | - } |
|
2612 | - } |
|
2613 | - |
|
2614 | - // flip the array (thus removing duplicates) |
|
2615 | - $placeidlist = array_flip($placeidlist); |
|
2616 | - // remove entry for parent location |
|
2617 | - unset($placeidlist[$levelm]); |
|
2618 | - |
|
2619 | - if (!empty($placeidlist)) { |
|
2620 | - // the keys are all we care about (this reverses the earlier array_flip, and ensures there are no "holes" in the array) |
|
2621 | - $placeidlist = array_keys($placeidlist); |
|
2622 | - // note: this implode/array_fill code generates one '?' for each entry in the $placeidlist array |
|
2623 | - $placelist = |
|
2624 | - Database::prepare( |
|
2625 | - "SELECT pl_id as place_id, pl_place as place, pl_lati as lati, pl_long as `long`, pl_zoom as zoom, pl_icon as icon" . |
|
2626 | - " FROM `##placelocation` WHERE pl_id IN (" . implode(',', array_fill(0, count($placeidlist), '?')) . ')' |
|
2627 | - )->execute($placeidlist) |
|
2628 | - ->fetchAll(PDO::FETCH_ASSOC); |
|
2629 | - |
|
2630 | - foreach ($placelist as $place) { |
|
2631 | - $this->printGoogleMapMarkers($place, $level, $parent, $place['place_id'], $linklevels); |
|
2632 | - } |
|
2633 | - } |
|
2634 | - $controller->addInlineJavascript(ob_get_clean()); |
|
2635 | - } |
|
2636 | - |
|
2637 | - /** |
|
2638 | - * Take a place id and find its place in the hierarchy |
|
2639 | - * Input: place ID |
|
2640 | - * Output: ordered array of id=>name values, starting with the Top level |
|
2641 | - * e.g. 0=>"Top level", 16=>"England", 19=>"London", 217=>"Westminster" |
|
2642 | - * |
|
2643 | - * @param int $id |
|
2644 | - * |
|
2645 | - * @return string[] |
|
2646 | - */ |
|
2647 | - private function placeIdToHierarchy($id) { |
|
2648 | - $statement = Database::prepare("SELECT pl_parent_id, pl_place FROM `##placelocation` WHERE pl_id=?"); |
|
2649 | - $arr = array(); |
|
2650 | - while ($id != 0) { |
|
2651 | - $row = $statement->execute(array($id))->fetchOneRow(); |
|
2652 | - $arr = array($id => $row->pl_place) + $arr; |
|
2653 | - $id = $row->pl_parent_id; |
|
2654 | - } |
|
2655 | - |
|
2656 | - return $arr; |
|
2657 | - } |
|
2658 | - |
|
2659 | - /** |
|
2660 | - * Get the highest index. |
|
2661 | - * |
|
2662 | - * @return int |
|
2663 | - */ |
|
2664 | - private function getHighestIndex() { |
|
2665 | - return (int) Database::prepare("SELECT MAX(pl_id) FROM `##placelocation`")->fetchOne(); |
|
2666 | - } |
|
2667 | - |
|
2668 | - /** |
|
2669 | - * Get the highest level. |
|
2670 | - * |
|
2671 | - * @return int |
|
2672 | - */ |
|
2673 | - private function getHighestLevel() { |
|
2674 | - return (int) Database::prepare("SELECT MAX(pl_level) FROM `##placelocation`")->fetchOne(); |
|
2675 | - } |
|
2676 | - |
|
2677 | - /** |
|
2678 | - * Find all of the places in the hierarchy |
|
2679 | - * |
|
2680 | - * @param int $parent_id |
|
2681 | - * @param bool $inactive |
|
2682 | - * |
|
2683 | - * @return array[] |
|
2684 | - */ |
|
2685 | - private function getPlaceListLocation($parent_id, $inactive = false) { |
|
2686 | - if ($inactive) { |
|
2687 | - $rows = Database::prepare( |
|
2688 | - "SELECT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon" . |
|
2689 | - " FROM `##placelocation`" . |
|
2690 | - " WHERE pl_parent_id = :parent_id" . |
|
2691 | - " ORDER BY pl_place COLLATE :collation" |
|
2692 | - )->execute(array( |
|
2693 | - 'parent_id' => $parent_id, |
|
2694 | - 'collation' => I18N::collation(), |
|
2695 | - ))->fetchAll(); |
|
2696 | - } else { |
|
2697 | - $rows = Database::prepare( |
|
2698 | - "SELECT DISTINCT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon" . |
|
2699 | - " FROM `##placelocation`" . |
|
2700 | - " INNER JOIN `##places` ON `##placelocation`.pl_place=`##places`.p_place" . |
|
2701 | - " WHERE pl_parent_id = :parent_id" . |
|
2702 | - " ORDER BY pl_place COLLATE :collation" |
|
2703 | - )->execute(array( |
|
2704 | - 'parent_id' => $parent_id, |
|
2705 | - 'collation' => I18N::collation(), |
|
2706 | - ))->fetchAll(); |
|
2707 | - } |
|
2708 | - |
|
2709 | - $placelist = array(); |
|
2710 | - foreach ($rows as $row) { |
|
2711 | - $placelist[] = array( |
|
2712 | - 'place_id' => $row->pl_id, |
|
2713 | - 'place' => $row->pl_place, |
|
2714 | - 'lati' => $row->pl_lati, |
|
2715 | - 'long' => $row->pl_long, |
|
2716 | - 'zoom' => $row->pl_zoom, |
|
2717 | - 'icon' => $row->pl_icon, |
|
2718 | - ); |
|
2719 | - } |
|
2720 | - |
|
2721 | - return $placelist; |
|
2722 | - } |
|
2723 | - |
|
2724 | - /** |
|
2725 | - * Set the output level. |
|
2726 | - * |
|
2727 | - * @param int $parent_id |
|
2728 | - */ |
|
2729 | - private function outputLevel($parent_id) { |
|
2730 | - $tmp = $this->placeIdToHierarchy($parent_id); |
|
2731 | - $maxLevel = $this->getHighestLevel(); |
|
2732 | - if ($maxLevel > 8) { |
|
2733 | - $maxLevel = 8; |
|
2734 | - } |
|
2735 | - $prefix = implode(';', $tmp); |
|
2736 | - if ($prefix != '') { |
|
2737 | - $prefix .= ';'; |
|
2738 | - } |
|
2739 | - $suffix = str_repeat(';', $maxLevel - count($tmp)); |
|
2740 | - $level = count($tmp); |
|
2741 | - |
|
2742 | - $rows = Database::prepare( |
|
2743 | - "SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place" |
|
2744 | - )->execute(array($parent_id))->fetchAll(); |
|
2745 | - |
|
2746 | - foreach ($rows as $row) { |
|
2747 | - echo $level, ';', $prefix, $row->pl_place, $suffix, ';', $row->pl_long, ';', $row->pl_lati, ';', $row->pl_zoom, ';', $row->pl_icon, "\r\n"; |
|
2748 | - if ($level < $maxLevel) { |
|
2749 | - $this->outputLevel($row->pl_id); |
|
2750 | - } |
|
2751 | - } |
|
2752 | - } |
|
2753 | - |
|
2754 | - /** |
|
2755 | - * recursively find all of the csv files on the server |
|
2756 | - * |
|
2757 | - * @param string $path |
|
2758 | - * |
|
2759 | - * @return string[] |
|
2760 | - */ |
|
2761 | - private function findFiles($path) { |
|
2762 | - $placefiles = array(); |
|
2763 | - |
|
2764 | - try { |
|
2765 | - $di = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS); |
|
2766 | - $it = new \RecursiveIteratorIterator($di); |
|
2767 | - |
|
2768 | - foreach ($it as $file) { |
|
2769 | - if ($file->getExtension() == "csv") { |
|
2770 | - $placefiles[] = '/' . $file->getFilename(); |
|
2771 | - } |
|
2772 | - } |
|
2773 | - } catch (\Exception $e) { |
|
2774 | - Log::addErrorLog(basename($e->getFile()) . ' - line: ' . $e->getLine() . ' - ' . $e->getMessage()); |
|
2775 | - } |
|
2776 | - |
|
2777 | - return $placefiles; |
|
2778 | - } |
|
2779 | - |
|
2780 | - /** |
|
2781 | - * Edit places. |
|
2782 | - */ |
|
2783 | - private function placesEdit() { |
|
2784 | - $GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM'); |
|
2785 | - |
|
2786 | - $action = Filter::post('action', null, Filter::get('action')); |
|
2787 | - $placeid = Filter::post('placeid', null, Filter::get('placeid')); |
|
2788 | - $place_name = Filter::post('place_name', null, Filter::get('place_name')); |
|
2789 | - $placeid = (int) $placeid; // Convert empty string to zero |
|
2790 | - $place_icon = ''; |
|
2791 | - |
|
2792 | - // Update Street View fields fields |
|
2793 | - if ($action === 'update_sv_params' && Auth::isAdmin() && Filter::checkCsrf()) { |
|
2794 | - Database::prepare( |
|
2795 | - "UPDATE `##placelocation`" . |
|
2796 | - " SET sv_lati = :sv_latitude, sv_long = :sv_longitude, sv_bearing = :sv_bearing, sv_elevation = :sv_elevation, sv_zoom = :sv_zoom" . |
|
2797 | - " WHERE pl_id = :place_id" |
|
2798 | - )->execute(array( |
|
2799 | - 'sv_latitude' => (float) Filter::post('sv_latiText'), |
|
2800 | - 'sv_longitude' => (float) Filter::post('sv_longText'), |
|
2801 | - 'sv_bearing' => (float) Filter::post('sv_bearText'), |
|
2802 | - 'sv_elevation' => (float) Filter::post('sv_elevText'), |
|
2803 | - 'sv_zoom' => (float) Filter::post('sv_zoomText'), |
|
2804 | - 'place_id' => $placeid, |
|
2805 | - )); |
|
2806 | - // TODO - submit this data via AJAX, so we won't need to redraw the page. |
|
2807 | - header('Location: ' . Filter::post('destination', null, 'index.php')); |
|
2808 | - |
|
2809 | - return; |
|
2810 | - } |
|
2811 | - |
|
2812 | - $controller = new SimpleController; |
|
2813 | - $controller |
|
2814 | - ->restrictAccess(Auth::isAdmin()) |
|
2815 | - ->setPageTitle(I18N::translate('Geographic data')) |
|
2816 | - ->addInlineJavascript('jQuery("<link>", {rel: "stylesheet", type: "text/css", href: "' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/css/wt_v3_googlemap.css"}).appendTo("head");') |
|
2817 | - ->pageHeader(); |
|
2818 | - |
|
2819 | - $where_am_i = $this->placeIdToHierarchy($placeid); |
|
2820 | - $level = count($where_am_i); |
|
2821 | - |
|
2822 | - if ($action == 'addrecord' && Auth::isAdmin()) { |
|
2823 | - $statement = |
|
2824 | - Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); |
|
2825 | - |
|
2826 | - if ((Filter::post('LONG_CONTROL') == '') || (Filter::post('NEW_PLACE_LONG') == '') || (Filter::post('NEW_PLACE_LATI') == '')) { |
|
2827 | - $statement->execute(array($this->getHighestIndex() + 1, $placeid, $level, Filter::post('NEW_PLACE_NAME'), null, null, Filter::post('NEW_ZOOM_FACTOR'), Filter::post('icon'))); |
|
2828 | - } else { |
|
2829 | - $statement->execute(array($this->getHighestIndex() + 1, $placeid, $level, Filter::post('NEW_PLACE_NAME'), Filter::post('LONG_CONTROL') . Filter::post('NEW_PLACE_LONG'), Filter::post('LATI_CONTROL') . Filter::post('NEW_PLACE_LATI'), Filter::post('NEW_ZOOM_FACTOR'), Filter::post('icon'))); |
|
2830 | - } |
|
2831 | - |
|
2832 | - $controller->addInlineJavascript('closePopupAndReloadParent();'); |
|
2833 | - |
|
2834 | - return; |
|
2835 | - } |
|
2836 | - |
|
2837 | - if ($action == 'updaterecord' && Auth::isAdmin()) { |
|
2838 | - $statement = |
|
2839 | - Database::prepare("UPDATE `##placelocation` SET pl_place=?, pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?"); |
|
2840 | - |
|
2841 | - if ((Filter::post('LONG_CONTROL') == '') || (Filter::post('NEW_PLACE_LONG') == '') || (Filter::post('NEW_PLACE_LATI') == '')) { |
|
2842 | - $statement->execute(array(Filter::post('NEW_PLACE_NAME'), null, null, (int) Filter::post('NEW_ZOOM_FACTOR'), Filter::post('icon'), $placeid)); |
|
2843 | - } else { |
|
2844 | - $statement->execute(array(Filter::post('NEW_PLACE_NAME'), Filter::post('LATI_CONTROL') . Filter::post('NEW_PLACE_LATI'), Filter::post('LONG_CONTROL') . Filter::post('NEW_PLACE_LONG'), Filter::post('NEW_ZOOM_FACTOR'), Filter::post('icon'), $placeid)); |
|
2845 | - } |
|
2846 | - |
|
2847 | - $controller->addInlineJavascript('closePopupAndReloadParent();'); |
|
2848 | - |
|
2849 | - return; |
|
2850 | - } |
|
2851 | - |
|
2852 | - if ($action === 'update') { |
|
2853 | - // --- find the place in the file |
|
2854 | - $row = |
|
2855 | - Database::prepare("SELECT pl_place, pl_lati, pl_long, pl_icon, pl_parent_id, pl_level, pl_zoom FROM `##placelocation` WHERE pl_id=?") |
|
2856 | - ->execute(array($placeid)) |
|
2857 | - ->fetchOneRow(); |
|
2858 | - $place_name = $row->pl_place; |
|
2859 | - $place_icon = $row->pl_icon; |
|
2860 | - $selected_country = explode("/", $place_icon); |
|
2861 | - if (isset($selected_country[1]) && $selected_country[1] !== 'flags') { |
|
2862 | - $selected_country = $selected_country[1]; |
|
2863 | - } else { |
|
2864 | - $selected_country = 'Countries'; |
|
2865 | - } |
|
2866 | - $parent_id = $row->pl_parent_id; |
|
2867 | - $level = $row->pl_level; |
|
2868 | - $zoomfactor = $row->pl_zoom; |
|
2869 | - $parent_lati = 0.0; |
|
2870 | - $parent_long = 0.0; |
|
2871 | - if ($row->pl_lati !== null && $row->pl_long !== null) { |
|
2872 | - $place_lati = (float) (str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati)); |
|
2873 | - $place_long = (float) (str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long)); |
|
2874 | - } else { |
|
2875 | - $place_lati = 0.0; |
|
2876 | - $place_long = 0.0; |
|
2877 | - $zoomfactor = 1; |
|
2878 | - } |
|
2879 | - |
|
2880 | - do { |
|
2881 | - $row = |
|
2882 | - Database::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom FROM `##placelocation` WHERE pl_id=?") |
|
2883 | - ->execute(array($parent_id)) |
|
2884 | - ->fetchOneRow(); |
|
2885 | - if (!$row) { |
|
2886 | - break; |
|
2887 | - } |
|
2888 | - if ($row->pl_lati !== null && $row->pl_long !== null) { |
|
2889 | - $parent_lati = (float) (str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati)); |
|
2890 | - $parent_long = (float) (str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long)); |
|
2891 | - if ($zoomfactor == 1) { |
|
2892 | - $zoomfactor = $row->pl_zoom; |
|
2893 | - } |
|
2894 | - } |
|
2895 | - $parent_id = $row->pl_parent_id; |
|
2896 | - } while ($row->pl_parent_id != 0 && $row->pl_lati === null && $row->pl_long === null); |
|
2897 | - |
|
2898 | - echo '<b>', Filter::escapeHtml(str_replace('Unknown', I18N::translate('unknown'), implode(I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>'; |
|
2899 | - } |
|
2900 | - |
|
2901 | - if ($action === 'add') { |
|
2902 | - // --- find the parent place in the file |
|
2903 | - if ($placeid != 0) { |
|
2904 | - $place_lati = 0.0; |
|
2905 | - $place_long = 0.0; |
|
2906 | - $zoomfactor = 1; |
|
2907 | - $parent_lati = 0.0; |
|
2908 | - $parent_long = 0.0; |
|
2909 | - $parent_id = $placeid; |
|
2910 | - do { |
|
2911 | - $row = |
|
2912 | - Database::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom, pl_level FROM `##placelocation` WHERE pl_id=?") |
|
2913 | - ->execute(array($parent_id)) |
|
2914 | - ->fetchOneRow(); |
|
2915 | - if ($row->pl_lati !== null && $row->pl_long !== null) { |
|
2916 | - $parent_lati = strtr($row->pl_lati, array('N' => '', 'S' => '-', ',' => '.')); |
|
2917 | - $parent_long = strtr($row->pl_long, array('E' => '', 'W' => '-', ',' => '.')); |
|
2918 | - $zoomfactor = min($row->pl_zoom, $GM_MAX_ZOOM); |
|
2919 | - $level = $row->pl_level + 1; |
|
2920 | - } |
|
2921 | - $parent_id = $row->pl_parent_id; |
|
2922 | - } while ($row->pl_parent_id != 0 && $row->pl_lati === null && $row->pl_long === null); |
|
2923 | - } else { |
|
2924 | - $place_lati = 0.0; |
|
2925 | - $place_long = 0.0; |
|
2926 | - $parent_lati = 0.0; |
|
2927 | - $parent_long = 0.0; |
|
2928 | - $parent_id = 0; |
|
2929 | - $level = 0; |
|
2930 | - $zoomfactor = $this->getSetting('GM_MIN_ZOOM'); |
|
2931 | - } |
|
2932 | - $selected_country = 'Countries'; |
|
2933 | - |
|
2934 | - if ($place_name == '') { |
|
2935 | - echo '<b>', I18N::translate('unknown'); |
|
2936 | - } else { |
|
2937 | - echo '<b>', $place_name; |
|
2938 | - } |
|
2939 | - if (count($where_am_i) > 0) { |
|
2940 | - echo ', ', Filter::escapeHtml(str_replace('Unknown', I18N::translate('unknown'), implode(I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>'; |
|
2941 | - } |
|
2942 | - echo '</b><br>'; |
|
2943 | - } |
|
2944 | - |
|
2945 | - ?> |
|
2580 | + $levelm = $this->setLevelMap($level, $parent); |
|
2581 | + |
|
2582 | + //create markers |
|
2583 | + ob_start(); |
|
2584 | + |
|
2585 | + if ($numfound == 0 && $level > 0) { |
|
2586 | + // show the current place on the map |
|
2587 | + |
|
2588 | + $place = Database::prepare("SELECT pl_id AS place_id, pl_place AS place, pl_lati AS lati, pl_long AS `long`, pl_zoom AS zoom, pl_icon AS icon FROM `##placelocation` WHERE pl_id=?") |
|
2589 | + ->execute(array($levelm)) |
|
2590 | + ->fetch(PDO::FETCH_ASSOC); |
|
2591 | + |
|
2592 | + if ($place) { |
|
2593 | + // re-calculate the hierarchy information required to display the current place |
|
2594 | + $thisloc = $parent; |
|
2595 | + array_pop($thisloc); |
|
2596 | + $thislevel = $level - 1; |
|
2597 | + $thislinklevels = substr($linklevels, 0, strrpos($linklevels, '&')); |
|
2598 | + |
|
2599 | + $this->printGoogleMapMarkers($place, $thislevel, $thisloc, $place['place_id'], $thislinklevels); |
|
2600 | + } |
|
2601 | + } |
|
2602 | + |
|
2603 | + // display any sub-places |
|
2604 | + $placeidlist = array(); |
|
2605 | + foreach ($place_names as $placename) { |
|
2606 | + $thisloc = $parent; |
|
2607 | + $thisloc[] = $placename; |
|
2608 | + $this_levelm = $this->setLevelMap($level + 1, $thisloc); |
|
2609 | + if ($this_levelm) { |
|
2610 | + $placeidlist[] = $this_levelm; |
|
2611 | + } |
|
2612 | + } |
|
2613 | + |
|
2614 | + // flip the array (thus removing duplicates) |
|
2615 | + $placeidlist = array_flip($placeidlist); |
|
2616 | + // remove entry for parent location |
|
2617 | + unset($placeidlist[$levelm]); |
|
2618 | + |
|
2619 | + if (!empty($placeidlist)) { |
|
2620 | + // the keys are all we care about (this reverses the earlier array_flip, and ensures there are no "holes" in the array) |
|
2621 | + $placeidlist = array_keys($placeidlist); |
|
2622 | + // note: this implode/array_fill code generates one '?' for each entry in the $placeidlist array |
|
2623 | + $placelist = |
|
2624 | + Database::prepare( |
|
2625 | + "SELECT pl_id as place_id, pl_place as place, pl_lati as lati, pl_long as `long`, pl_zoom as zoom, pl_icon as icon" . |
|
2626 | + " FROM `##placelocation` WHERE pl_id IN (" . implode(',', array_fill(0, count($placeidlist), '?')) . ')' |
|
2627 | + )->execute($placeidlist) |
|
2628 | + ->fetchAll(PDO::FETCH_ASSOC); |
|
2629 | + |
|
2630 | + foreach ($placelist as $place) { |
|
2631 | + $this->printGoogleMapMarkers($place, $level, $parent, $place['place_id'], $linklevels); |
|
2632 | + } |
|
2633 | + } |
|
2634 | + $controller->addInlineJavascript(ob_get_clean()); |
|
2635 | + } |
|
2636 | + |
|
2637 | + /** |
|
2638 | + * Take a place id and find its place in the hierarchy |
|
2639 | + * Input: place ID |
|
2640 | + * Output: ordered array of id=>name values, starting with the Top level |
|
2641 | + * e.g. 0=>"Top level", 16=>"England", 19=>"London", 217=>"Westminster" |
|
2642 | + * |
|
2643 | + * @param int $id |
|
2644 | + * |
|
2645 | + * @return string[] |
|
2646 | + */ |
|
2647 | + private function placeIdToHierarchy($id) { |
|
2648 | + $statement = Database::prepare("SELECT pl_parent_id, pl_place FROM `##placelocation` WHERE pl_id=?"); |
|
2649 | + $arr = array(); |
|
2650 | + while ($id != 0) { |
|
2651 | + $row = $statement->execute(array($id))->fetchOneRow(); |
|
2652 | + $arr = array($id => $row->pl_place) + $arr; |
|
2653 | + $id = $row->pl_parent_id; |
|
2654 | + } |
|
2655 | + |
|
2656 | + return $arr; |
|
2657 | + } |
|
2658 | + |
|
2659 | + /** |
|
2660 | + * Get the highest index. |
|
2661 | + * |
|
2662 | + * @return int |
|
2663 | + */ |
|
2664 | + private function getHighestIndex() { |
|
2665 | + return (int) Database::prepare("SELECT MAX(pl_id) FROM `##placelocation`")->fetchOne(); |
|
2666 | + } |
|
2667 | + |
|
2668 | + /** |
|
2669 | + * Get the highest level. |
|
2670 | + * |
|
2671 | + * @return int |
|
2672 | + */ |
|
2673 | + private function getHighestLevel() { |
|
2674 | + return (int) Database::prepare("SELECT MAX(pl_level) FROM `##placelocation`")->fetchOne(); |
|
2675 | + } |
|
2676 | + |
|
2677 | + /** |
|
2678 | + * Find all of the places in the hierarchy |
|
2679 | + * |
|
2680 | + * @param int $parent_id |
|
2681 | + * @param bool $inactive |
|
2682 | + * |
|
2683 | + * @return array[] |
|
2684 | + */ |
|
2685 | + private function getPlaceListLocation($parent_id, $inactive = false) { |
|
2686 | + if ($inactive) { |
|
2687 | + $rows = Database::prepare( |
|
2688 | + "SELECT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon" . |
|
2689 | + " FROM `##placelocation`" . |
|
2690 | + " WHERE pl_parent_id = :parent_id" . |
|
2691 | + " ORDER BY pl_place COLLATE :collation" |
|
2692 | + )->execute(array( |
|
2693 | + 'parent_id' => $parent_id, |
|
2694 | + 'collation' => I18N::collation(), |
|
2695 | + ))->fetchAll(); |
|
2696 | + } else { |
|
2697 | + $rows = Database::prepare( |
|
2698 | + "SELECT DISTINCT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon" . |
|
2699 | + " FROM `##placelocation`" . |
|
2700 | + " INNER JOIN `##places` ON `##placelocation`.pl_place=`##places`.p_place" . |
|
2701 | + " WHERE pl_parent_id = :parent_id" . |
|
2702 | + " ORDER BY pl_place COLLATE :collation" |
|
2703 | + )->execute(array( |
|
2704 | + 'parent_id' => $parent_id, |
|
2705 | + 'collation' => I18N::collation(), |
|
2706 | + ))->fetchAll(); |
|
2707 | + } |
|
2708 | + |
|
2709 | + $placelist = array(); |
|
2710 | + foreach ($rows as $row) { |
|
2711 | + $placelist[] = array( |
|
2712 | + 'place_id' => $row->pl_id, |
|
2713 | + 'place' => $row->pl_place, |
|
2714 | + 'lati' => $row->pl_lati, |
|
2715 | + 'long' => $row->pl_long, |
|
2716 | + 'zoom' => $row->pl_zoom, |
|
2717 | + 'icon' => $row->pl_icon, |
|
2718 | + ); |
|
2719 | + } |
|
2720 | + |
|
2721 | + return $placelist; |
|
2722 | + } |
|
2723 | + |
|
2724 | + /** |
|
2725 | + * Set the output level. |
|
2726 | + * |
|
2727 | + * @param int $parent_id |
|
2728 | + */ |
|
2729 | + private function outputLevel($parent_id) { |
|
2730 | + $tmp = $this->placeIdToHierarchy($parent_id); |
|
2731 | + $maxLevel = $this->getHighestLevel(); |
|
2732 | + if ($maxLevel > 8) { |
|
2733 | + $maxLevel = 8; |
|
2734 | + } |
|
2735 | + $prefix = implode(';', $tmp); |
|
2736 | + if ($prefix != '') { |
|
2737 | + $prefix .= ';'; |
|
2738 | + } |
|
2739 | + $suffix = str_repeat(';', $maxLevel - count($tmp)); |
|
2740 | + $level = count($tmp); |
|
2741 | + |
|
2742 | + $rows = Database::prepare( |
|
2743 | + "SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place" |
|
2744 | + )->execute(array($parent_id))->fetchAll(); |
|
2745 | + |
|
2746 | + foreach ($rows as $row) { |
|
2747 | + echo $level, ';', $prefix, $row->pl_place, $suffix, ';', $row->pl_long, ';', $row->pl_lati, ';', $row->pl_zoom, ';', $row->pl_icon, "\r\n"; |
|
2748 | + if ($level < $maxLevel) { |
|
2749 | + $this->outputLevel($row->pl_id); |
|
2750 | + } |
|
2751 | + } |
|
2752 | + } |
|
2753 | + |
|
2754 | + /** |
|
2755 | + * recursively find all of the csv files on the server |
|
2756 | + * |
|
2757 | + * @param string $path |
|
2758 | + * |
|
2759 | + * @return string[] |
|
2760 | + */ |
|
2761 | + private function findFiles($path) { |
|
2762 | + $placefiles = array(); |
|
2763 | + |
|
2764 | + try { |
|
2765 | + $di = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS); |
|
2766 | + $it = new \RecursiveIteratorIterator($di); |
|
2767 | + |
|
2768 | + foreach ($it as $file) { |
|
2769 | + if ($file->getExtension() == "csv") { |
|
2770 | + $placefiles[] = '/' . $file->getFilename(); |
|
2771 | + } |
|
2772 | + } |
|
2773 | + } catch (\Exception $e) { |
|
2774 | + Log::addErrorLog(basename($e->getFile()) . ' - line: ' . $e->getLine() . ' - ' . $e->getMessage()); |
|
2775 | + } |
|
2776 | + |
|
2777 | + return $placefiles; |
|
2778 | + } |
|
2779 | + |
|
2780 | + /** |
|
2781 | + * Edit places. |
|
2782 | + */ |
|
2783 | + private function placesEdit() { |
|
2784 | + $GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM'); |
|
2785 | + |
|
2786 | + $action = Filter::post('action', null, Filter::get('action')); |
|
2787 | + $placeid = Filter::post('placeid', null, Filter::get('placeid')); |
|
2788 | + $place_name = Filter::post('place_name', null, Filter::get('place_name')); |
|
2789 | + $placeid = (int) $placeid; // Convert empty string to zero |
|
2790 | + $place_icon = ''; |
|
2791 | + |
|
2792 | + // Update Street View fields fields |
|
2793 | + if ($action === 'update_sv_params' && Auth::isAdmin() && Filter::checkCsrf()) { |
|
2794 | + Database::prepare( |
|
2795 | + "UPDATE `##placelocation`" . |
|
2796 | + " SET sv_lati = :sv_latitude, sv_long = :sv_longitude, sv_bearing = :sv_bearing, sv_elevation = :sv_elevation, sv_zoom = :sv_zoom" . |
|
2797 | + " WHERE pl_id = :place_id" |
|
2798 | + )->execute(array( |
|
2799 | + 'sv_latitude' => (float) Filter::post('sv_latiText'), |
|
2800 | + 'sv_longitude' => (float) Filter::post('sv_longText'), |
|
2801 | + 'sv_bearing' => (float) Filter::post('sv_bearText'), |
|
2802 | + 'sv_elevation' => (float) Filter::post('sv_elevText'), |
|
2803 | + 'sv_zoom' => (float) Filter::post('sv_zoomText'), |
|
2804 | + 'place_id' => $placeid, |
|
2805 | + )); |
|
2806 | + // TODO - submit this data via AJAX, so we won't need to redraw the page. |
|
2807 | + header('Location: ' . Filter::post('destination', null, 'index.php')); |
|
2808 | + |
|
2809 | + return; |
|
2810 | + } |
|
2811 | + |
|
2812 | + $controller = new SimpleController; |
|
2813 | + $controller |
|
2814 | + ->restrictAccess(Auth::isAdmin()) |
|
2815 | + ->setPageTitle(I18N::translate('Geographic data')) |
|
2816 | + ->addInlineJavascript('jQuery("<link>", {rel: "stylesheet", type: "text/css", href: "' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/css/wt_v3_googlemap.css"}).appendTo("head");') |
|
2817 | + ->pageHeader(); |
|
2818 | + |
|
2819 | + $where_am_i = $this->placeIdToHierarchy($placeid); |
|
2820 | + $level = count($where_am_i); |
|
2821 | + |
|
2822 | + if ($action == 'addrecord' && Auth::isAdmin()) { |
|
2823 | + $statement = |
|
2824 | + Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); |
|
2825 | + |
|
2826 | + if ((Filter::post('LONG_CONTROL') == '') || (Filter::post('NEW_PLACE_LONG') == '') || (Filter::post('NEW_PLACE_LATI') == '')) { |
|
2827 | + $statement->execute(array($this->getHighestIndex() + 1, $placeid, $level, Filter::post('NEW_PLACE_NAME'), null, null, Filter::post('NEW_ZOOM_FACTOR'), Filter::post('icon'))); |
|
2828 | + } else { |
|
2829 | + $statement->execute(array($this->getHighestIndex() + 1, $placeid, $level, Filter::post('NEW_PLACE_NAME'), Filter::post('LONG_CONTROL') . Filter::post('NEW_PLACE_LONG'), Filter::post('LATI_CONTROL') . Filter::post('NEW_PLACE_LATI'), Filter::post('NEW_ZOOM_FACTOR'), Filter::post('icon'))); |
|
2830 | + } |
|
2831 | + |
|
2832 | + $controller->addInlineJavascript('closePopupAndReloadParent();'); |
|
2833 | + |
|
2834 | + return; |
|
2835 | + } |
|
2836 | + |
|
2837 | + if ($action == 'updaterecord' && Auth::isAdmin()) { |
|
2838 | + $statement = |
|
2839 | + Database::prepare("UPDATE `##placelocation` SET pl_place=?, pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?"); |
|
2840 | + |
|
2841 | + if ((Filter::post('LONG_CONTROL') == '') || (Filter::post('NEW_PLACE_LONG') == '') || (Filter::post('NEW_PLACE_LATI') == '')) { |
|
2842 | + $statement->execute(array(Filter::post('NEW_PLACE_NAME'), null, null, (int) Filter::post('NEW_ZOOM_FACTOR'), Filter::post('icon'), $placeid)); |
|
2843 | + } else { |
|
2844 | + $statement->execute(array(Filter::post('NEW_PLACE_NAME'), Filter::post('LATI_CONTROL') . Filter::post('NEW_PLACE_LATI'), Filter::post('LONG_CONTROL') . Filter::post('NEW_PLACE_LONG'), Filter::post('NEW_ZOOM_FACTOR'), Filter::post('icon'), $placeid)); |
|
2845 | + } |
|
2846 | + |
|
2847 | + $controller->addInlineJavascript('closePopupAndReloadParent();'); |
|
2848 | + |
|
2849 | + return; |
|
2850 | + } |
|
2851 | + |
|
2852 | + if ($action === 'update') { |
|
2853 | + // --- find the place in the file |
|
2854 | + $row = |
|
2855 | + Database::prepare("SELECT pl_place, pl_lati, pl_long, pl_icon, pl_parent_id, pl_level, pl_zoom FROM `##placelocation` WHERE pl_id=?") |
|
2856 | + ->execute(array($placeid)) |
|
2857 | + ->fetchOneRow(); |
|
2858 | + $place_name = $row->pl_place; |
|
2859 | + $place_icon = $row->pl_icon; |
|
2860 | + $selected_country = explode("/", $place_icon); |
|
2861 | + if (isset($selected_country[1]) && $selected_country[1] !== 'flags') { |
|
2862 | + $selected_country = $selected_country[1]; |
|
2863 | + } else { |
|
2864 | + $selected_country = 'Countries'; |
|
2865 | + } |
|
2866 | + $parent_id = $row->pl_parent_id; |
|
2867 | + $level = $row->pl_level; |
|
2868 | + $zoomfactor = $row->pl_zoom; |
|
2869 | + $parent_lati = 0.0; |
|
2870 | + $parent_long = 0.0; |
|
2871 | + if ($row->pl_lati !== null && $row->pl_long !== null) { |
|
2872 | + $place_lati = (float) (str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati)); |
|
2873 | + $place_long = (float) (str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long)); |
|
2874 | + } else { |
|
2875 | + $place_lati = 0.0; |
|
2876 | + $place_long = 0.0; |
|
2877 | + $zoomfactor = 1; |
|
2878 | + } |
|
2879 | + |
|
2880 | + do { |
|
2881 | + $row = |
|
2882 | + Database::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom FROM `##placelocation` WHERE pl_id=?") |
|
2883 | + ->execute(array($parent_id)) |
|
2884 | + ->fetchOneRow(); |
|
2885 | + if (!$row) { |
|
2886 | + break; |
|
2887 | + } |
|
2888 | + if ($row->pl_lati !== null && $row->pl_long !== null) { |
|
2889 | + $parent_lati = (float) (str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati)); |
|
2890 | + $parent_long = (float) (str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long)); |
|
2891 | + if ($zoomfactor == 1) { |
|
2892 | + $zoomfactor = $row->pl_zoom; |
|
2893 | + } |
|
2894 | + } |
|
2895 | + $parent_id = $row->pl_parent_id; |
|
2896 | + } while ($row->pl_parent_id != 0 && $row->pl_lati === null && $row->pl_long === null); |
|
2897 | + |
|
2898 | + echo '<b>', Filter::escapeHtml(str_replace('Unknown', I18N::translate('unknown'), implode(I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>'; |
|
2899 | + } |
|
2900 | + |
|
2901 | + if ($action === 'add') { |
|
2902 | + // --- find the parent place in the file |
|
2903 | + if ($placeid != 0) { |
|
2904 | + $place_lati = 0.0; |
|
2905 | + $place_long = 0.0; |
|
2906 | + $zoomfactor = 1; |
|
2907 | + $parent_lati = 0.0; |
|
2908 | + $parent_long = 0.0; |
|
2909 | + $parent_id = $placeid; |
|
2910 | + do { |
|
2911 | + $row = |
|
2912 | + Database::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom, pl_level FROM `##placelocation` WHERE pl_id=?") |
|
2913 | + ->execute(array($parent_id)) |
|
2914 | + ->fetchOneRow(); |
|
2915 | + if ($row->pl_lati !== null && $row->pl_long !== null) { |
|
2916 | + $parent_lati = strtr($row->pl_lati, array('N' => '', 'S' => '-', ',' => '.')); |
|
2917 | + $parent_long = strtr($row->pl_long, array('E' => '', 'W' => '-', ',' => '.')); |
|
2918 | + $zoomfactor = min($row->pl_zoom, $GM_MAX_ZOOM); |
|
2919 | + $level = $row->pl_level + 1; |
|
2920 | + } |
|
2921 | + $parent_id = $row->pl_parent_id; |
|
2922 | + } while ($row->pl_parent_id != 0 && $row->pl_lati === null && $row->pl_long === null); |
|
2923 | + } else { |
|
2924 | + $place_lati = 0.0; |
|
2925 | + $place_long = 0.0; |
|
2926 | + $parent_lati = 0.0; |
|
2927 | + $parent_long = 0.0; |
|
2928 | + $parent_id = 0; |
|
2929 | + $level = 0; |
|
2930 | + $zoomfactor = $this->getSetting('GM_MIN_ZOOM'); |
|
2931 | + } |
|
2932 | + $selected_country = 'Countries'; |
|
2933 | + |
|
2934 | + if ($place_name == '') { |
|
2935 | + echo '<b>', I18N::translate('unknown'); |
|
2936 | + } else { |
|
2937 | + echo '<b>', $place_name; |
|
2938 | + } |
|
2939 | + if (count($where_am_i) > 0) { |
|
2940 | + echo ', ', Filter::escapeHtml(str_replace('Unknown', I18N::translate('unknown'), implode(I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>'; |
|
2941 | + } |
|
2942 | + echo '</b><br>'; |
|
2943 | + } |
|
2944 | + |
|
2945 | + ?> |
|
2946 | 2946 | |
2947 | 2947 | <script src="<?php echo $this->googleMapsScript() ?>"></script> |
2948 | 2948 | <script> |
@@ -3053,26 +3053,26 @@ discard block |
||
3053 | 3053 | // Define place LatLng arrays |
3054 | 3054 | |
3055 | 3055 | <?php |
3056 | - $coordsAsStr = array(); |
|
3057 | - switch (strtoupper($place_name)) { |
|
3058 | - case 'ENGLAND': |
|
3059 | - $coordsAsStr[] = '-4.74361,50.66750|-4.78361,50.59361|-4.91584,50.57722|-5.01750,50.54264|-5.02569,50.47271|-5.04729,50.42750|-5.15208,50.34374|-5.26805,50.27389|-5.43194,50.19326|-5.49584,50.21695|-5.54639,50.20527|-5.71000,50.12916|-5.71681,50.06083|-5.66174,50.03631|-5.58278,50.04777|-5.54166,50.07055|-5.53416,50.11569|-5.47055,50.12499|-5.33361,50.09138|-5.27666,50.05972|-5.25674,50.00514|-5.19306,49.95527|-5.16070,50.00319|-5.06555,50.03750|-5.07090,50.08166|-5.04806,50.17111|-4.95278,50.19333|-4.85750,50.23166|-4.76250,50.31138|-4.67861,50.32583|-4.54334,50.32222|-4.48278,50.32583|-4.42972,50.35139|-4.38000,50.36388|-4.16555,50.37028|-4.11139,50.33027|-4.05708,50.29791|-3.94389,50.31346|-3.87764,50.28139|-3.83653,50.22972|-3.78944,50.21222|-3.70666,50.20972|-3.65195,50.23111|-3.55139,50.43833|-3.49416,50.54639|-3.46181,50.58792|-3.41139,50.61610|-3.24416,50.67444|-3.17347,50.68833|-3.09445,50.69222|-2.97806,50.70638|-2.92750,50.73125|-2.88278,50.73111|-2.82305,50.72027|-2.77139,50.70861|-2.66195,50.67334|-2.56305,50.63222|-2.45861,50.57500|-2.44666,50.62639|-2.39097,50.64166|-2.19722,50.62611|-2.12195,50.60722|-2.05445,50.58569|-1.96437,50.59674|-1.95441,50.66536|-2.06681,50.71430|-1.93416,50.71277|-1.81639,50.72306|-1.68445,50.73888|-1.59278,50.72416|-1.33139,50.79138|-1.11695,50.80694|-1.15889,50.84083|-1.09445,50.84584|-0.92842,50.83966|-0.86584,50.79965|-0.90826,50.77396|-0.78187,50.72722|-0.74611,50.76583|-0.67528,50.78111|-0.57722,50.79527|-0.25500,50.82638|-0.19084,50.82583|-0.13805,50.81833|0.05695,50.78083|0.12334,50.75944|0.22778,50.73944|0.28695,50.76500|0.37195,50.81638|0.43084,50.83111|0.56722,50.84777|0.67889,50.87681|0.71639,50.90500|0.79334,50.93610|0.85666,50.92556|0.97125,50.98111|0.99778,51.01903|1.04555,51.04944|1.10028,51.07361|1.26250,51.10166|1.36889,51.13583|1.41111,51.20111|1.42750,51.33111|1.38556,51.38777|1.19195,51.37861|1.05278,51.36722|0.99916,51.34777|0.90806,51.34069|0.70416,51.37749|0.61972,51.38304|0.55945,51.40596|0.64236,51.44042|0.69750,51.47084|0.59195,51.48777|0.53611,51.48806|0.48916,51.48445|0.45215,51.45562|0.38894,51.44822|0.46500,51.50306|0.65195,51.53680|0.76695,51.52138|0.82084,51.53556|0.87528,51.56110|0.95250,51.60923|0.94695,51.72556|0.90257,51.73465|0.86306,51.71166|0.76140,51.69164|0.70111,51.71847|0.86211,51.77361|0.93236,51.80583|0.98278,51.82527|1.03569,51.77416|1.08834,51.77056|1.13222,51.77694|1.18139,51.78972|1.22361,51.80888|1.26611,51.83916|1.28097,51.88096|1.20834,51.95083|1.16347,52.02361|1.27750,51.98555|1.33125,51.92875|1.39028,51.96999|1.58736,52.08388|1.63000,52.19527|1.68576,52.32630|1.73028,52.41138|1.74945,52.45583|1.74590,52.62021|1.70250,52.71583|1.64528,52.77111|1.50361,52.83749|1.43222,52.87472|1.35250,52.90972|1.28222,52.92750|1.18389,52.93889|0.99472,52.95111|0.94222,52.95083|0.88472,52.96638|0.66722,52.97611|0.54778,52.96618|0.49139,52.93430|0.44431,52.86569|0.42903,52.82403|0.36334,52.78027|0.21778,52.80694|0.16125,52.86250|0.05778,52.88916|0.00211,52.87985|0.03222,52.91722|0.20389,53.02805|0.27666,53.06694|0.33916,53.09236|0.35389,53.18722|0.33958,53.23472|0.23555,53.39944|0.14347,53.47527|0.08528,53.48638|0.02694,53.50972|-0.10084,53.57306|-0.20722,53.63083|-0.26445,53.69083|-0.30166,53.71319|-0.39022,53.70794|-0.51972,53.68527|-0.71653,53.69638|-0.65445,53.72527|-0.60584,53.72972|-0.54916,53.70611|-0.42261,53.71755|-0.35728,53.73056|-0.29389,53.73666|-0.23139,53.72166|-0.10584,53.63166|-0.03472,53.62555|0.04416,53.63916|0.08916,53.62666|0.14945,53.58847|0.12639,53.64527|0.06264,53.70389|-0.12750,53.86388|-0.16916,53.91847|-0.21222,54.00833|-0.20569,54.05153|-0.16111,54.08806|-0.11694,54.13222|-0.20053,54.15171|-0.26250,54.17444|-0.39334,54.27277|-0.42166,54.33222|-0.45750,54.37694|-0.51847,54.44749|-0.56472,54.48000|-0.87584,54.57027|-1.06139,54.61722|-1.16528,54.64972|-1.30445,54.77138|-1.34556,54.87138|-1.41278,54.99944|-1.48292,55.08625|-1.51500,55.14972|-1.56584,55.28722|-1.58097,55.48361|-1.63597,55.58194|-1.69000,55.60556|-1.74695,55.62499|-1.81764,55.63306|-1.97681,55.75416|-2.02166,55.80611|-2.08361,55.78054|-2.22000,55.66499|-2.27916,55.64472|-2.27416,55.57527|-2.21528,55.50583|-2.18278,55.45985|-2.21236,55.42777|-2.46305,55.36111|-2.63055,55.25500|-2.69945,55.17722|-2.96278,55.03889|-3.01500,55.05222|-3.05103,54.97986|-3.13292,54.93139|-3.20861,54.94944|-3.28931,54.93792|-3.39166,54.87639|-3.42916,54.81555|-3.56916,54.64249|-3.61306,54.48861|-3.49305,54.40333|-3.43389,54.34806|-3.41056,54.28014|-3.38055,54.24444|-3.21472,54.09555|-3.15222,54.08194|-2.93097,54.15333|-2.81361,54.22277|-2.81750,54.14277|-2.83361,54.08500|-2.93250,53.95055|-3.05264,53.90764|-3.03708,53.74944|-2.99278,53.73277|-2.89979,53.72499|-2.97729,53.69382|-3.07306,53.59805|-3.10563,53.55993|-3.00678,53.41738|-2.95389,53.36027|-2.85736,53.32083|-2.70493,53.35062|-2.77639,53.29250|-2.89972,53.28916|-2.94250,53.31056|-3.02889,53.38191|-3.07248,53.40936|-3.16695,53.35708|-3.12611,53.32500|-3.08860,53.26001|-3.02000,53.24722|-2.95528,53.21555|-2.91069,53.17014|-2.89389,53.10416|-2.85695,53.03249|-2.77792,52.98514|-2.73109,52.96873|-2.71945,52.91902|-2.79278,52.90207|-2.85069,52.93875|-2.99389,52.95361|-3.08639,52.91611|-3.13014,52.88486|-3.13708,52.79312|-3.06806,52.77027|-3.01111,52.71166|-3.06666,52.63527|-3.11750,52.58666|-3.07089,52.55702|-3.00792,52.56902|-2.98028,52.53083|-3.02736,52.49792|-3.11916,52.49194|-3.19514,52.46722|-3.19611,52.41027|-3.02195,52.34027|-2.95486,52.33117|-2.99750,52.28139|-3.05125,52.23347|-3.07555,52.14804|-3.12222,52.11805|-3.11250,52.06945|-3.08500,52.01930|-3.04528,51.97639|-2.98889,51.92555|-2.91757,51.91569|-2.86639,51.92889|-2.77861,51.88583|-2.65944,51.81806|-2.68334,51.76957|-2.68666,51.71889|-2.66500,51.61500|-2.62916,51.64416|-2.57889,51.67777|-2.46056,51.74666|-2.40389,51.74041|-2.47166,51.72445|-2.55305,51.65722|-2.65334,51.56389|-2.77055,51.48916|-2.85278,51.44472|-2.96000,51.37499|-3.00695,51.30722|-3.01278,51.25632|-3.02834,51.20611|-3.30139,51.18111|-3.39361,51.18138|-3.43729,51.20638|-3.50722,51.22333|-3.57014,51.23027|-3.63222,51.21805|-3.70028,51.23000|-3.79250,51.23916|-3.88389,51.22416|-3.98472,51.21695|-4.11666,51.21222|-4.22805,51.18777|-4.22028,51.11054|-4.23702,51.04659|-4.30361,51.00416|-4.37639,50.99110|-4.42736,51.00958|-4.47445,51.01416|-4.52132,51.01424|-4.54334,50.92694|-4.56139,50.77625|-4.65139,50.71527|-4.74361,50.66750'; |
|
3060 | - break; |
|
3061 | - case 'SCOTLAND': |
|
3062 | - $coordsAsStr[] = '-2.02166,55.80611|-2.07972,55.86722|-2.13028,55.88583|-2.26028,55.91861|-2.37528,55.95694|-2.65722,56.05972|-2.82028,56.05694|-2.86618,56.02840|-2.89555,55.98861|-2.93500,55.96944|-3.01805,55.94944|-3.06750,55.94444|-3.25472,55.97166|-3.45472,55.99194|-3.66416,56.00652|-3.73722,56.05555|-3.57139,56.05360|-3.44111,56.01916|-3.39584,56.01083|-3.34403,56.02333|-3.13903,56.11084|-2.97611,56.19472|-2.91666,56.20499|-2.84695,56.18638|-2.78805,56.18749|-2.67937,56.21465|-2.58403,56.28264|-2.67208,56.32277|-2.76861,56.33180|-2.81528,56.37360|-2.81208,56.43958|-2.91653,56.45014|-2.99555,56.41416|-3.19042,56.35958|-3.27805,56.35750|-3.04055,56.45472|-2.95861,56.45611|-2.72084,56.48888|-2.64084,56.52250|-2.53126,56.57611|-2.48861,56.61416|-2.47805,56.71527|-2.39000,56.77166|-2.31986,56.79638|-2.21972,56.86777|-2.19708,56.94388|-2.16695,57.00055|-2.09334,57.07027|-2.05416,57.21861|-1.95889,57.33250|-1.85584,57.39889|-1.77334,57.45805|-1.78139,57.50555|-1.82195,57.57861|-1.86000,57.62138|-1.92972,57.67777|-2.02222,57.69388|-2.07555,57.69944|-2.14028,57.69056|-2.18611,57.66861|-2.39626,57.66638|-2.51000,57.67166|-2.78639,57.70222|-2.89806,57.70694|-2.96750,57.68027|-3.03847,57.66249|-3.12334,57.67166|-3.22334,57.69166|-3.28625,57.72499|-3.33972,57.72333|-3.48805,57.70945|-3.52222,57.66333|-3.59542,57.63666|-3.64063,57.63881|-3.75414,57.62504|-4.03986,57.55569|-4.19666,57.48584|-4.22889,57.51554|-4.17945,57.56249|-4.11139,57.59833|-4.08078,57.66533|-4.19139,57.67139|-4.25945,57.65527|-4.34361,57.60777|-4.41639,57.60166|-4.29666,57.67444|-4.08528,57.72611|-4.01908,57.70226|-3.96861,57.70250|-3.86556,57.76861|-3.81945,57.80458|-3.80681,57.85819|-3.85055,57.82000|-3.92639,57.80749|-4.04322,57.81438|-4.14973,57.82527|-4.29750,57.84638|-4.36250,57.89777|-4.24306,57.87028|-4.10666,57.85195|-4.01500,57.86777|-3.99166,57.90611|-3.99695,57.95056|-3.84500,58.02000|-3.56611,58.13916|-3.51319,58.16374|-3.45916,58.20305|-3.42028,58.24361|-3.33750,58.27694|-3.20555,58.30625|-3.10972,58.38166|-3.05792,58.45083|-3.02264,58.64653|-3.17639,58.64944|-3.35389,58.66055|-3.36931,58.59555|-3.57611,58.62194|-3.66028,58.61972|-3.71166,58.60374|-3.78264,58.56750|-3.84834,58.56000|-4.08056,58.55527|-4.27722,58.53361|-4.43653,58.54902|-4.50666,58.56777|-4.56055,58.57584|-4.59910,58.53027|-4.66805,58.48833|-4.76146,58.44604|-4.70195,58.50999|-4.70166,58.55861|-4.77014,58.60264|-5.00153,58.62416|-5.10945,58.50833|-5.16472,58.32527|-5.12639,58.28750|-5.07166,58.26472|-5.20361,58.25083|-5.39764,58.25055|-5.27389,58.11722|-5.31514,58.06416|-5.38416,58.08361|-5.45285,58.07416|-5.39805,58.03111|-5.26278,57.97111|-5.19334,57.95069|-5.12750,57.86944|-5.21750,57.90084|-5.33861,57.92083|-5.42876,57.90104|-5.45750,57.85889|-5.64445,57.89972|-5.62555,57.85222|-5.58153,57.81945|-5.60674,57.76618|-5.66305,57.78889|-5.71695,57.86944|-5.76695,57.86472|-5.81708,57.81944|-5.81084,57.63958|-5.69555,57.55944|-5.64361,57.55222|-5.53084,57.52833|-5.65305,57.50875|-5.75000,57.54834|-5.81569,57.57923|-5.85042,57.54972|-5.86695,57.46777|-5.81806,57.36250|-5.75111,57.34333|-5.50334,57.40111|-5.45126,57.41805|-5.49250,57.37083|-5.59884,57.33049|-5.57116,57.28411|-5.51266,57.27745|-5.40514,57.23097|-5.44972,57.22138|-5.49472,57.23888|-5.56066,57.25477|-5.64611,57.23499|-5.64751,57.16161|-5.55028,57.11639|-5.48166,57.11222|-5.40305,57.11062|-5.55945,57.09250|-5.65111,57.11611|-5.72472,57.11306|-5.77361,57.04556|-5.63139,56.98499|-5.56916,56.98972|-5.52403,56.99735|-5.57916,56.98000|-5.64611,56.97222|-5.73374,57.00909|-5.82584,57.00346|-5.91958,56.88708|-5.86528,56.87944|-5.74278,56.89374|-5.66292,56.86924|-5.73306,56.83916|-5.78584,56.83955|-5.85590,56.81430|-5.80208,56.79180|-5.84958,56.74444|-5.90500,56.75666|-5.96694,56.78027|-6.14000,56.75777|-6.19208,56.74888|-6.23452,56.71673|-6.19139,56.67972|-5.91916,56.67388|-5.82622,56.69156|-5.73945,56.71166|-5.55240,56.68886|-5.64861,56.68027|-5.69916,56.68278|-5.88261,56.65666|-5.97472,56.65138|-5.99584,56.61138|-5.93056,56.56972|-5.88416,56.55333|-5.79056,56.53805|-5.67695,56.49389|-5.56389,56.54056|-5.36334,56.66195|-5.23416,56.74333|-5.13236,56.79403|-5.31473,56.65666|-5.37405,56.55925|-5.31826,56.55633|-5.25080,56.55753|-5.37718,56.52112|-5.39866,56.47866|-5.19111,56.46194|-5.11556,56.51277|-5.07014,56.56069|-5.13555,56.48499|-5.22084,56.43583|-5.32764,56.43574|-5.42439,56.43091|-5.52611,56.37360|-5.57139,56.32833|-5.59653,56.25695|-5.57389,56.16000|-5.52000,56.16485|-5.56334,56.11333|-5.60139,56.07638|-5.64222,56.04305|-5.66039,55.98263|-5.62555,56.02055|-5.58014,56.01319|-5.63361,55.96611|-5.67697,55.88844|-5.64750,55.78139|-5.60986,55.75930|-5.66916,55.66166|-5.70166,55.58861|-5.71805,55.51500|-5.75916,55.41750|-5.79528,55.36027|-5.78166,55.29902|-5.73778,55.29222|-5.56694,55.31666|-5.51528,55.36347|-5.55520,55.41440|-5.48639,55.64306|-5.44597,55.70680|-5.38000,55.75027|-5.41889,55.90666|-5.39924,55.99972|-5.33895,56.03456|-5.30594,56.06922|-5.23889,56.11889|-5.03222,56.23250|-4.92229,56.27111|-4.97416,56.23333|-5.07222,56.18695|-5.20069,56.11861|-5.30906,56.00570|-5.34000,55.90201|-5.29250,55.84750|-5.20805,55.84444|-5.22458,55.90175|-5.17334,55.92916|-5.11000,55.90306|-5.01222,55.86694|-4.96195,55.88000|-4.89824,55.98145|-4.84623,56.08632|-4.86636,56.03178|-4.85461,55.98648|-4.77659,55.97977|-4.62723,55.94555|-4.52305,55.91861|-4.70972,55.93403|-4.75166,55.94611|-4.82406,55.94950|-4.87826,55.93653|-4.91639,55.70083|-4.87584,55.68194|-4.81361,55.64555|-4.68722,55.59750|-4.61361,55.49069|-4.63958,55.44264|-4.68250,55.43388|-4.74847,55.41055|-4.83715,55.31882|-4.84778,55.26944|-4.86542,55.22340|-4.93500,55.17860|-5.01250,55.13347|-5.05361,55.04902|-5.17834,54.98888|-5.18563,54.93622|-5.17000,54.89111|-5.11666,54.83180|-5.00500,54.76333|-4.96229,54.68125|-4.92250,54.64055|-4.85723,54.62958|-4.96076,54.79687|-4.92431,54.83708|-4.85222,54.86861|-4.80125,54.85556|-4.74055,54.82166|-4.68084,54.79972|-4.59861,54.78027|-4.55792,54.73903|-4.49639,54.69888|-4.37584,54.67666|-4.34569,54.70916|-4.35973,54.77111|-4.41111,54.82583|-4.42445,54.88152|-4.38479,54.90555|-4.35056,54.85903|-4.09555,54.76777|-3.95361,54.76749|-3.86972,54.80527|-3.81222,54.84888|-3.69250,54.88110|-3.61584,54.87527|-3.57111,54.99083|-3.44528,54.98638|-3.36056,54.97138|-3.14695,54.96500|-3.05103,54.97986|-3.01500,55.05222|-2.96278,55.03889|-2.69945,55.17722|-2.63055,55.25500|-2.46305,55.36111|-2.21236,55.42777|-2.18278,55.45985|-2.21528,55.50583|-2.27416,55.57527|-2.27916,55.64472|-2.22000,55.66499|-2.08361,55.78054|-2.02166,55.80611'; |
|
3063 | - break; |
|
3064 | - case 'IRELAND': |
|
3065 | - $coordsAsStr[] = '-8.17166,54.46388|-8.06555,54.37277|-7.94139,54.29944|-7.87576,54.28499|-7.86834,54.22764|-7.81805,54.19916|-7.69972,54.20250|-7.55945,54.12694|-7.31334,54.11250|-7.14584,54.22527|-7.17555,54.28916|-7.16084,54.33666|-7.05834,54.41000|-6.97445,54.40166|-6.92695,54.37916|-6.87305,54.34208|-6.85111,54.28972|-6.73473,54.18361|-6.65556,54.06527|-6.60584,54.04444|-6.44750,54.05833|-6.33889,54.11555|-6.26697,54.09983|-6.17403,54.07222|-6.10834,54.03638|-6.04389,54.03139|-5.96834,54.06389|-5.88500,54.11639|-5.87347,54.20916|-5.82500,54.23958|-5.74611,54.24806|-5.65556,54.22701|-5.60834,54.24972|-5.55916,54.29084|-5.57334,54.37704|-5.64502,54.49267|-5.70472,54.53361|-5.68055,54.57306|-5.59972,54.54194|-5.55097,54.50083|-5.54216,54.44903|-5.54643,54.40527|-5.50672,54.36444|-5.46111,54.38555|-5.43132,54.48596|-5.47945,54.53638|-5.53521,54.65090|-5.57431,54.67722|-5.62916,54.67945|-5.73674,54.67383|-5.80305,54.66138|-5.88257,54.60652|-5.92445,54.63180|-5.86681,54.68972|-5.81903,54.70972|-5.74672,54.72452|-5.68775,54.76335|-5.70931,54.83166|-5.74694,54.85361|-5.79139,54.85139|-6.03611,55.05778|-6.04250,55.10277|-6.03444,55.15458|-6.10125,55.20945|-6.14584,55.22069|-6.25500,55.21194|-6.37639,55.23916|-6.51556,55.23305|-6.61334,55.20722|-6.73028,55.18027|-6.82472,55.16806|-6.88972,55.16777|-6.96695,55.15611|-6.99416,55.11027|-7.05139,55.04680|-7.09500,55.03694|-7.25251,55.07059|-7.32639,55.04527|-7.40639,54.95333|-7.45805,54.85777|-7.55334,54.76277|-7.73916,54.71054|-7.82576,54.73416|-7.92639,54.70054|-7.85236,54.63388|-7.77750,54.62694|-7.83361,54.55389|-7.95084,54.53222|-8.04695,54.50722|-8.17166,54.46388'; |
|
3066 | - break; |
|
3067 | - case 'WALES': |
|
3068 | - $coordsAsStr[] = '-3.08860,53.26001|-3.33639,53.34722|-3.38806,53.34361|-3.60986,53.27944|-3.73014,53.28944|-3.85445,53.28444|-4.01861,53.23750|-4.06639,53.22639|-4.15334,53.22556|-4.19639,53.20611|-4.33028,53.11222|-4.36097,53.02888|-4.55278,52.92889|-4.61889,52.90916|-4.72195,52.83611|-4.72778,52.78139|-4.53945,52.79306|-4.47722,52.85500|-4.41416,52.88472|-4.31292,52.90499|-4.23334,52.91499|-4.13569,52.87888|-4.13056,52.77777|-4.05334,52.71666|-4.10639,52.65084|-4.12597,52.60375|-4.08056,52.55333|-4.05972,52.48584|-4.09666,52.38583|-4.14305,52.32027|-4.19361,52.27638|-4.23166,52.24888|-4.52722,52.13083|-4.66945,52.13027|-4.73695,52.10361|-4.76778,52.06444|-4.84445,52.01388|-5.09945,51.96056|-5.23916,51.91638|-5.25889,51.87056|-5.18500,51.86958|-5.11528,51.83333|-5.10257,51.77895|-5.16111,51.76222|-5.24694,51.73027|-5.19111,51.70888|-5.00739,51.70349|-4.90875,51.71249|-4.86111,51.71334|-4.97061,51.67577|-5.02128,51.66861|-5.05139,51.62028|-5.00528,51.60638|-4.94139,51.59416|-4.89028,51.62694|-4.83569,51.64534|-4.79063,51.63340|-4.69028,51.66666|-4.64584,51.72666|-4.57445,51.73416|-4.43611,51.73722|-4.26222,51.67694|-4.19750,51.67916|-4.06614,51.66804|-4.11639,51.63416|-4.17750,51.62235|-4.25055,51.62861|-4.29208,51.60743|-4.27778,51.55666|-4.20486,51.53527|-3.94972,51.61278|-3.83792,51.61999|-3.78166,51.56750|-3.75160,51.52931|-3.67194,51.47388|-3.54250,51.39777|-3.40334,51.37972|-3.27097,51.38014|-3.16458,51.40909|-3.15166,51.45305|-3.11875,51.48750|-3.02111,51.52527|-2.95472,51.53972|-2.89278,51.53861|-2.84778,51.54500|-2.71472,51.58083|-2.66500,51.61500|-2.68666,51.71889|-2.68334,51.76957|-2.65944,51.81806|-2.77861,51.88583|-2.86639,51.92889|-2.91757,51.91569|-2.98889,51.92555|-3.04528,51.97639|-3.08500,52.01930|-3.11250,52.06945|-3.12222,52.11805|-3.07555,52.14804|-3.05125,52.23347|-2.99750,52.28139|-2.95486,52.33117|-3.02195,52.34027|-3.19611,52.41027|-3.19514,52.46722|-3.11916,52.49194|-3.02736,52.49792|-2.98028,52.53083|-3.00792,52.56902|-3.07089,52.55702|-3.11750,52.58666|-3.06666,52.63527|-3.01111,52.71166|-3.06806,52.77027|-3.13708,52.79312|-3.13014,52.88486|-3.08639,52.91611|-2.99389,52.95361|-2.85069,52.93875|-2.79278,52.90207|-2.71945,52.91902|-2.73109,52.96873|-2.77792,52.98514|-2.85695,53.03249|-2.89389,53.10416|-2.91069,53.17014|-2.95528,53.21555|-3.02000,53.24722|-3.08860,53.26001'; |
|
3069 | - break; |
|
3070 | - case 'NC': |
|
3071 | - $coordsAsStr[] = '-81.65876,36.60938|-81.70390,36.55513|-81.70639,36.50804|-81.74665,36.39777|-81.90723,36.30804|-82.03195,36.12694|-82.08416,36.10146|-82.12826,36.11020|-82.21500,36.15833|-82.36375,36.11347|-82.43472,36.06013|-82.46236,36.01708|-82.56006,35.96263|-82.60042,35.99638|-82.62308,36.06121|-82.73500,36.01833|-82.84612,35.94944|-82.90451,35.88819|-82.93555,35.83846|-83.16000,35.76236|-83.24222,35.71944|-83.49222,35.57111|-83.56847,35.55861|-83.64416,35.56471|-83.73499,35.56638|-83.88222,35.51791|-83.98361,35.44944|-84.03639,35.35444|-84.04964,35.29117|-84.09042,35.25986|-84.15084,35.25388|-84.20521,35.25722|-84.29284,35.22596|-84.32471,34.98701|-83.09778,35.00027|-82.77722,35.09138|-82.59639,35.14972|-82.37999,35.21500|-82.27362,35.20583|-81.41306,35.17416|-81.05915,35.15333|-80.92666,35.10695|-80.78751,34.95610|-80.79334,34.82555|-79.66777,34.80694|-79.11555,34.34527|-78.57222,33.88166|-78.51806,33.87999|-78.43721,33.89804|-78.23735,33.91986|-78.15389,33.91471|-78.06974,33.89500|-78.02597,33.88936|-77.97611,33.94276|-77.95299,33.99243|-77.94499,34.06499|-77.92728,34.11756|-77.92250,33.99194|-77.92264,33.93715|-77.88215,34.06166|-77.86222,34.15083|-77.83501,34.19194|-77.75724,34.28527|-77.68222,34.36555|-77.63667,34.39805|-77.57363,34.43694|-77.45527,34.50403|-77.38173,34.51646|-77.37905,34.56294|-77.38572,34.61260|-77.40944,34.68916|-77.38847,34.73304|-77.33097,34.63992|-77.35024,34.60099|-77.30958,34.55972|-77.09424,34.67742|-76.75994,34.76659|-76.68325,34.79749|-76.66097,34.75781|-76.62611,34.71014|-76.50063,34.73617|-76.48138,34.77638|-76.38305,34.86423|-76.34326,34.88194|-76.27181,34.96263|-76.35125,35.02221|-76.32354,34.97429|-76.45319,34.93524|-76.43395,34.98782|-76.45356,35.06676|-76.52917,35.00444|-76.63382,34.98242|-76.69722,34.94887|-76.75306,34.90526|-76.81636,34.93944|-76.89000,34.95388|-76.93180,34.96957|-76.96501,34.99777|-77.06816,35.14978|-76.97639,35.06806|-76.86722,35.00000|-76.80531,34.98559|-76.72708,35.00152|-76.60402,35.07416|-76.56555,35.11486|-76.57305,35.16013|-76.66489,35.16694|-76.56361,35.23361|-76.48750,35.22582|-76.46889,35.27166|-76.50298,35.30791|-76.83251,35.39222|-77.02305,35.48694|-77.04958,35.52694|-76.91292,35.46166|-76.65250,35.41499|-76.61611,35.45888|-76.63195,35.52249|-76.58820,35.55104|-76.51556,35.53194|-76.56711,35.48494|-76.52251,35.40416|-76.46195,35.37221|-76.13319,35.35986|-76.04111,35.42416|-76.00223,35.46610|-75.97958,35.51666|-75.89362,35.57555|-75.83834,35.56694|-75.78944,35.57138|-75.74076,35.61846|-75.72084,35.69263|-75.72084,35.81451|-75.74917,35.87791|-75.78333,35.91972|-75.85083,35.97527|-75.94333,35.91777|-75.98944,35.88054|-75.98854,35.79110|-75.99388,35.71027|-76.02875,35.65409|-76.10320,35.66041|-76.13563,35.69239|-76.04475,35.68436|-76.04167,35.74916|-76.05305,35.79361|-76.05305,35.87375|-76.02653,35.96222|-76.07751,35.99319|-76.17472,35.99596|-76.27917,35.91915|-76.37986,35.95763|-76.42014,35.97874|-76.55375,35.93971|-76.66222,35.93305|-76.72952,35.93984|-76.73392,36.04760|-76.75384,36.09477|-76.76028,36.14513|-76.74610,36.22818|-76.70458,36.24673|-76.72764,36.16736|-76.71021,36.11752|-76.69117,36.07165|-76.65979,36.03312|-76.49527,36.00958|-76.37138,36.07694|-76.37084,36.14999|-76.21417,36.09471|-76.07591,36.17910|-76.18361,36.26915|-76.19965,36.31739|-76.13986,36.28805|-76.04274,36.21974|-76.00465,36.18110|-75.95287,36.19241|-75.97604,36.31138|-75.93895,36.28381|-75.85271,36.11069|-75.79315,36.07385|-75.79639,36.11804|-75.88333,36.29554|-75.94665,36.37194|-75.98694,36.41166|-76.03473,36.49666|-76.02899,36.55000|-78.44234,36.54986|-78.56594,36.55799|-80.27556,36.55110|-81.15361,36.56499|-81.38722,36.57695|-81.65876,36.60938'; |
|
3072 | - break; |
|
3073 | - default: |
|
3074 | - } |
|
3075 | - ?> |
|
3056 | + $coordsAsStr = array(); |
|
3057 | + switch (strtoupper($place_name)) { |
|
3058 | + case 'ENGLAND': |
|
3059 | + $coordsAsStr[] = '-4.74361,50.66750|-4.78361,50.59361|-4.91584,50.57722|-5.01750,50.54264|-5.02569,50.47271|-5.04729,50.42750|-5.15208,50.34374|-5.26805,50.27389|-5.43194,50.19326|-5.49584,50.21695|-5.54639,50.20527|-5.71000,50.12916|-5.71681,50.06083|-5.66174,50.03631|-5.58278,50.04777|-5.54166,50.07055|-5.53416,50.11569|-5.47055,50.12499|-5.33361,50.09138|-5.27666,50.05972|-5.25674,50.00514|-5.19306,49.95527|-5.16070,50.00319|-5.06555,50.03750|-5.07090,50.08166|-5.04806,50.17111|-4.95278,50.19333|-4.85750,50.23166|-4.76250,50.31138|-4.67861,50.32583|-4.54334,50.32222|-4.48278,50.32583|-4.42972,50.35139|-4.38000,50.36388|-4.16555,50.37028|-4.11139,50.33027|-4.05708,50.29791|-3.94389,50.31346|-3.87764,50.28139|-3.83653,50.22972|-3.78944,50.21222|-3.70666,50.20972|-3.65195,50.23111|-3.55139,50.43833|-3.49416,50.54639|-3.46181,50.58792|-3.41139,50.61610|-3.24416,50.67444|-3.17347,50.68833|-3.09445,50.69222|-2.97806,50.70638|-2.92750,50.73125|-2.88278,50.73111|-2.82305,50.72027|-2.77139,50.70861|-2.66195,50.67334|-2.56305,50.63222|-2.45861,50.57500|-2.44666,50.62639|-2.39097,50.64166|-2.19722,50.62611|-2.12195,50.60722|-2.05445,50.58569|-1.96437,50.59674|-1.95441,50.66536|-2.06681,50.71430|-1.93416,50.71277|-1.81639,50.72306|-1.68445,50.73888|-1.59278,50.72416|-1.33139,50.79138|-1.11695,50.80694|-1.15889,50.84083|-1.09445,50.84584|-0.92842,50.83966|-0.86584,50.79965|-0.90826,50.77396|-0.78187,50.72722|-0.74611,50.76583|-0.67528,50.78111|-0.57722,50.79527|-0.25500,50.82638|-0.19084,50.82583|-0.13805,50.81833|0.05695,50.78083|0.12334,50.75944|0.22778,50.73944|0.28695,50.76500|0.37195,50.81638|0.43084,50.83111|0.56722,50.84777|0.67889,50.87681|0.71639,50.90500|0.79334,50.93610|0.85666,50.92556|0.97125,50.98111|0.99778,51.01903|1.04555,51.04944|1.10028,51.07361|1.26250,51.10166|1.36889,51.13583|1.41111,51.20111|1.42750,51.33111|1.38556,51.38777|1.19195,51.37861|1.05278,51.36722|0.99916,51.34777|0.90806,51.34069|0.70416,51.37749|0.61972,51.38304|0.55945,51.40596|0.64236,51.44042|0.69750,51.47084|0.59195,51.48777|0.53611,51.48806|0.48916,51.48445|0.45215,51.45562|0.38894,51.44822|0.46500,51.50306|0.65195,51.53680|0.76695,51.52138|0.82084,51.53556|0.87528,51.56110|0.95250,51.60923|0.94695,51.72556|0.90257,51.73465|0.86306,51.71166|0.76140,51.69164|0.70111,51.71847|0.86211,51.77361|0.93236,51.80583|0.98278,51.82527|1.03569,51.77416|1.08834,51.77056|1.13222,51.77694|1.18139,51.78972|1.22361,51.80888|1.26611,51.83916|1.28097,51.88096|1.20834,51.95083|1.16347,52.02361|1.27750,51.98555|1.33125,51.92875|1.39028,51.96999|1.58736,52.08388|1.63000,52.19527|1.68576,52.32630|1.73028,52.41138|1.74945,52.45583|1.74590,52.62021|1.70250,52.71583|1.64528,52.77111|1.50361,52.83749|1.43222,52.87472|1.35250,52.90972|1.28222,52.92750|1.18389,52.93889|0.99472,52.95111|0.94222,52.95083|0.88472,52.96638|0.66722,52.97611|0.54778,52.96618|0.49139,52.93430|0.44431,52.86569|0.42903,52.82403|0.36334,52.78027|0.21778,52.80694|0.16125,52.86250|0.05778,52.88916|0.00211,52.87985|0.03222,52.91722|0.20389,53.02805|0.27666,53.06694|0.33916,53.09236|0.35389,53.18722|0.33958,53.23472|0.23555,53.39944|0.14347,53.47527|0.08528,53.48638|0.02694,53.50972|-0.10084,53.57306|-0.20722,53.63083|-0.26445,53.69083|-0.30166,53.71319|-0.39022,53.70794|-0.51972,53.68527|-0.71653,53.69638|-0.65445,53.72527|-0.60584,53.72972|-0.54916,53.70611|-0.42261,53.71755|-0.35728,53.73056|-0.29389,53.73666|-0.23139,53.72166|-0.10584,53.63166|-0.03472,53.62555|0.04416,53.63916|0.08916,53.62666|0.14945,53.58847|0.12639,53.64527|0.06264,53.70389|-0.12750,53.86388|-0.16916,53.91847|-0.21222,54.00833|-0.20569,54.05153|-0.16111,54.08806|-0.11694,54.13222|-0.20053,54.15171|-0.26250,54.17444|-0.39334,54.27277|-0.42166,54.33222|-0.45750,54.37694|-0.51847,54.44749|-0.56472,54.48000|-0.87584,54.57027|-1.06139,54.61722|-1.16528,54.64972|-1.30445,54.77138|-1.34556,54.87138|-1.41278,54.99944|-1.48292,55.08625|-1.51500,55.14972|-1.56584,55.28722|-1.58097,55.48361|-1.63597,55.58194|-1.69000,55.60556|-1.74695,55.62499|-1.81764,55.63306|-1.97681,55.75416|-2.02166,55.80611|-2.08361,55.78054|-2.22000,55.66499|-2.27916,55.64472|-2.27416,55.57527|-2.21528,55.50583|-2.18278,55.45985|-2.21236,55.42777|-2.46305,55.36111|-2.63055,55.25500|-2.69945,55.17722|-2.96278,55.03889|-3.01500,55.05222|-3.05103,54.97986|-3.13292,54.93139|-3.20861,54.94944|-3.28931,54.93792|-3.39166,54.87639|-3.42916,54.81555|-3.56916,54.64249|-3.61306,54.48861|-3.49305,54.40333|-3.43389,54.34806|-3.41056,54.28014|-3.38055,54.24444|-3.21472,54.09555|-3.15222,54.08194|-2.93097,54.15333|-2.81361,54.22277|-2.81750,54.14277|-2.83361,54.08500|-2.93250,53.95055|-3.05264,53.90764|-3.03708,53.74944|-2.99278,53.73277|-2.89979,53.72499|-2.97729,53.69382|-3.07306,53.59805|-3.10563,53.55993|-3.00678,53.41738|-2.95389,53.36027|-2.85736,53.32083|-2.70493,53.35062|-2.77639,53.29250|-2.89972,53.28916|-2.94250,53.31056|-3.02889,53.38191|-3.07248,53.40936|-3.16695,53.35708|-3.12611,53.32500|-3.08860,53.26001|-3.02000,53.24722|-2.95528,53.21555|-2.91069,53.17014|-2.89389,53.10416|-2.85695,53.03249|-2.77792,52.98514|-2.73109,52.96873|-2.71945,52.91902|-2.79278,52.90207|-2.85069,52.93875|-2.99389,52.95361|-3.08639,52.91611|-3.13014,52.88486|-3.13708,52.79312|-3.06806,52.77027|-3.01111,52.71166|-3.06666,52.63527|-3.11750,52.58666|-3.07089,52.55702|-3.00792,52.56902|-2.98028,52.53083|-3.02736,52.49792|-3.11916,52.49194|-3.19514,52.46722|-3.19611,52.41027|-3.02195,52.34027|-2.95486,52.33117|-2.99750,52.28139|-3.05125,52.23347|-3.07555,52.14804|-3.12222,52.11805|-3.11250,52.06945|-3.08500,52.01930|-3.04528,51.97639|-2.98889,51.92555|-2.91757,51.91569|-2.86639,51.92889|-2.77861,51.88583|-2.65944,51.81806|-2.68334,51.76957|-2.68666,51.71889|-2.66500,51.61500|-2.62916,51.64416|-2.57889,51.67777|-2.46056,51.74666|-2.40389,51.74041|-2.47166,51.72445|-2.55305,51.65722|-2.65334,51.56389|-2.77055,51.48916|-2.85278,51.44472|-2.96000,51.37499|-3.00695,51.30722|-3.01278,51.25632|-3.02834,51.20611|-3.30139,51.18111|-3.39361,51.18138|-3.43729,51.20638|-3.50722,51.22333|-3.57014,51.23027|-3.63222,51.21805|-3.70028,51.23000|-3.79250,51.23916|-3.88389,51.22416|-3.98472,51.21695|-4.11666,51.21222|-4.22805,51.18777|-4.22028,51.11054|-4.23702,51.04659|-4.30361,51.00416|-4.37639,50.99110|-4.42736,51.00958|-4.47445,51.01416|-4.52132,51.01424|-4.54334,50.92694|-4.56139,50.77625|-4.65139,50.71527|-4.74361,50.66750'; |
|
3060 | + break; |
|
3061 | + case 'SCOTLAND': |
|
3062 | + $coordsAsStr[] = '-2.02166,55.80611|-2.07972,55.86722|-2.13028,55.88583|-2.26028,55.91861|-2.37528,55.95694|-2.65722,56.05972|-2.82028,56.05694|-2.86618,56.02840|-2.89555,55.98861|-2.93500,55.96944|-3.01805,55.94944|-3.06750,55.94444|-3.25472,55.97166|-3.45472,55.99194|-3.66416,56.00652|-3.73722,56.05555|-3.57139,56.05360|-3.44111,56.01916|-3.39584,56.01083|-3.34403,56.02333|-3.13903,56.11084|-2.97611,56.19472|-2.91666,56.20499|-2.84695,56.18638|-2.78805,56.18749|-2.67937,56.21465|-2.58403,56.28264|-2.67208,56.32277|-2.76861,56.33180|-2.81528,56.37360|-2.81208,56.43958|-2.91653,56.45014|-2.99555,56.41416|-3.19042,56.35958|-3.27805,56.35750|-3.04055,56.45472|-2.95861,56.45611|-2.72084,56.48888|-2.64084,56.52250|-2.53126,56.57611|-2.48861,56.61416|-2.47805,56.71527|-2.39000,56.77166|-2.31986,56.79638|-2.21972,56.86777|-2.19708,56.94388|-2.16695,57.00055|-2.09334,57.07027|-2.05416,57.21861|-1.95889,57.33250|-1.85584,57.39889|-1.77334,57.45805|-1.78139,57.50555|-1.82195,57.57861|-1.86000,57.62138|-1.92972,57.67777|-2.02222,57.69388|-2.07555,57.69944|-2.14028,57.69056|-2.18611,57.66861|-2.39626,57.66638|-2.51000,57.67166|-2.78639,57.70222|-2.89806,57.70694|-2.96750,57.68027|-3.03847,57.66249|-3.12334,57.67166|-3.22334,57.69166|-3.28625,57.72499|-3.33972,57.72333|-3.48805,57.70945|-3.52222,57.66333|-3.59542,57.63666|-3.64063,57.63881|-3.75414,57.62504|-4.03986,57.55569|-4.19666,57.48584|-4.22889,57.51554|-4.17945,57.56249|-4.11139,57.59833|-4.08078,57.66533|-4.19139,57.67139|-4.25945,57.65527|-4.34361,57.60777|-4.41639,57.60166|-4.29666,57.67444|-4.08528,57.72611|-4.01908,57.70226|-3.96861,57.70250|-3.86556,57.76861|-3.81945,57.80458|-3.80681,57.85819|-3.85055,57.82000|-3.92639,57.80749|-4.04322,57.81438|-4.14973,57.82527|-4.29750,57.84638|-4.36250,57.89777|-4.24306,57.87028|-4.10666,57.85195|-4.01500,57.86777|-3.99166,57.90611|-3.99695,57.95056|-3.84500,58.02000|-3.56611,58.13916|-3.51319,58.16374|-3.45916,58.20305|-3.42028,58.24361|-3.33750,58.27694|-3.20555,58.30625|-3.10972,58.38166|-3.05792,58.45083|-3.02264,58.64653|-3.17639,58.64944|-3.35389,58.66055|-3.36931,58.59555|-3.57611,58.62194|-3.66028,58.61972|-3.71166,58.60374|-3.78264,58.56750|-3.84834,58.56000|-4.08056,58.55527|-4.27722,58.53361|-4.43653,58.54902|-4.50666,58.56777|-4.56055,58.57584|-4.59910,58.53027|-4.66805,58.48833|-4.76146,58.44604|-4.70195,58.50999|-4.70166,58.55861|-4.77014,58.60264|-5.00153,58.62416|-5.10945,58.50833|-5.16472,58.32527|-5.12639,58.28750|-5.07166,58.26472|-5.20361,58.25083|-5.39764,58.25055|-5.27389,58.11722|-5.31514,58.06416|-5.38416,58.08361|-5.45285,58.07416|-5.39805,58.03111|-5.26278,57.97111|-5.19334,57.95069|-5.12750,57.86944|-5.21750,57.90084|-5.33861,57.92083|-5.42876,57.90104|-5.45750,57.85889|-5.64445,57.89972|-5.62555,57.85222|-5.58153,57.81945|-5.60674,57.76618|-5.66305,57.78889|-5.71695,57.86944|-5.76695,57.86472|-5.81708,57.81944|-5.81084,57.63958|-5.69555,57.55944|-5.64361,57.55222|-5.53084,57.52833|-5.65305,57.50875|-5.75000,57.54834|-5.81569,57.57923|-5.85042,57.54972|-5.86695,57.46777|-5.81806,57.36250|-5.75111,57.34333|-5.50334,57.40111|-5.45126,57.41805|-5.49250,57.37083|-5.59884,57.33049|-5.57116,57.28411|-5.51266,57.27745|-5.40514,57.23097|-5.44972,57.22138|-5.49472,57.23888|-5.56066,57.25477|-5.64611,57.23499|-5.64751,57.16161|-5.55028,57.11639|-5.48166,57.11222|-5.40305,57.11062|-5.55945,57.09250|-5.65111,57.11611|-5.72472,57.11306|-5.77361,57.04556|-5.63139,56.98499|-5.56916,56.98972|-5.52403,56.99735|-5.57916,56.98000|-5.64611,56.97222|-5.73374,57.00909|-5.82584,57.00346|-5.91958,56.88708|-5.86528,56.87944|-5.74278,56.89374|-5.66292,56.86924|-5.73306,56.83916|-5.78584,56.83955|-5.85590,56.81430|-5.80208,56.79180|-5.84958,56.74444|-5.90500,56.75666|-5.96694,56.78027|-6.14000,56.75777|-6.19208,56.74888|-6.23452,56.71673|-6.19139,56.67972|-5.91916,56.67388|-5.82622,56.69156|-5.73945,56.71166|-5.55240,56.68886|-5.64861,56.68027|-5.69916,56.68278|-5.88261,56.65666|-5.97472,56.65138|-5.99584,56.61138|-5.93056,56.56972|-5.88416,56.55333|-5.79056,56.53805|-5.67695,56.49389|-5.56389,56.54056|-5.36334,56.66195|-5.23416,56.74333|-5.13236,56.79403|-5.31473,56.65666|-5.37405,56.55925|-5.31826,56.55633|-5.25080,56.55753|-5.37718,56.52112|-5.39866,56.47866|-5.19111,56.46194|-5.11556,56.51277|-5.07014,56.56069|-5.13555,56.48499|-5.22084,56.43583|-5.32764,56.43574|-5.42439,56.43091|-5.52611,56.37360|-5.57139,56.32833|-5.59653,56.25695|-5.57389,56.16000|-5.52000,56.16485|-5.56334,56.11333|-5.60139,56.07638|-5.64222,56.04305|-5.66039,55.98263|-5.62555,56.02055|-5.58014,56.01319|-5.63361,55.96611|-5.67697,55.88844|-5.64750,55.78139|-5.60986,55.75930|-5.66916,55.66166|-5.70166,55.58861|-5.71805,55.51500|-5.75916,55.41750|-5.79528,55.36027|-5.78166,55.29902|-5.73778,55.29222|-5.56694,55.31666|-5.51528,55.36347|-5.55520,55.41440|-5.48639,55.64306|-5.44597,55.70680|-5.38000,55.75027|-5.41889,55.90666|-5.39924,55.99972|-5.33895,56.03456|-5.30594,56.06922|-5.23889,56.11889|-5.03222,56.23250|-4.92229,56.27111|-4.97416,56.23333|-5.07222,56.18695|-5.20069,56.11861|-5.30906,56.00570|-5.34000,55.90201|-5.29250,55.84750|-5.20805,55.84444|-5.22458,55.90175|-5.17334,55.92916|-5.11000,55.90306|-5.01222,55.86694|-4.96195,55.88000|-4.89824,55.98145|-4.84623,56.08632|-4.86636,56.03178|-4.85461,55.98648|-4.77659,55.97977|-4.62723,55.94555|-4.52305,55.91861|-4.70972,55.93403|-4.75166,55.94611|-4.82406,55.94950|-4.87826,55.93653|-4.91639,55.70083|-4.87584,55.68194|-4.81361,55.64555|-4.68722,55.59750|-4.61361,55.49069|-4.63958,55.44264|-4.68250,55.43388|-4.74847,55.41055|-4.83715,55.31882|-4.84778,55.26944|-4.86542,55.22340|-4.93500,55.17860|-5.01250,55.13347|-5.05361,55.04902|-5.17834,54.98888|-5.18563,54.93622|-5.17000,54.89111|-5.11666,54.83180|-5.00500,54.76333|-4.96229,54.68125|-4.92250,54.64055|-4.85723,54.62958|-4.96076,54.79687|-4.92431,54.83708|-4.85222,54.86861|-4.80125,54.85556|-4.74055,54.82166|-4.68084,54.79972|-4.59861,54.78027|-4.55792,54.73903|-4.49639,54.69888|-4.37584,54.67666|-4.34569,54.70916|-4.35973,54.77111|-4.41111,54.82583|-4.42445,54.88152|-4.38479,54.90555|-4.35056,54.85903|-4.09555,54.76777|-3.95361,54.76749|-3.86972,54.80527|-3.81222,54.84888|-3.69250,54.88110|-3.61584,54.87527|-3.57111,54.99083|-3.44528,54.98638|-3.36056,54.97138|-3.14695,54.96500|-3.05103,54.97986|-3.01500,55.05222|-2.96278,55.03889|-2.69945,55.17722|-2.63055,55.25500|-2.46305,55.36111|-2.21236,55.42777|-2.18278,55.45985|-2.21528,55.50583|-2.27416,55.57527|-2.27916,55.64472|-2.22000,55.66499|-2.08361,55.78054|-2.02166,55.80611'; |
|
3063 | + break; |
|
3064 | + case 'IRELAND': |
|
3065 | + $coordsAsStr[] = '-8.17166,54.46388|-8.06555,54.37277|-7.94139,54.29944|-7.87576,54.28499|-7.86834,54.22764|-7.81805,54.19916|-7.69972,54.20250|-7.55945,54.12694|-7.31334,54.11250|-7.14584,54.22527|-7.17555,54.28916|-7.16084,54.33666|-7.05834,54.41000|-6.97445,54.40166|-6.92695,54.37916|-6.87305,54.34208|-6.85111,54.28972|-6.73473,54.18361|-6.65556,54.06527|-6.60584,54.04444|-6.44750,54.05833|-6.33889,54.11555|-6.26697,54.09983|-6.17403,54.07222|-6.10834,54.03638|-6.04389,54.03139|-5.96834,54.06389|-5.88500,54.11639|-5.87347,54.20916|-5.82500,54.23958|-5.74611,54.24806|-5.65556,54.22701|-5.60834,54.24972|-5.55916,54.29084|-5.57334,54.37704|-5.64502,54.49267|-5.70472,54.53361|-5.68055,54.57306|-5.59972,54.54194|-5.55097,54.50083|-5.54216,54.44903|-5.54643,54.40527|-5.50672,54.36444|-5.46111,54.38555|-5.43132,54.48596|-5.47945,54.53638|-5.53521,54.65090|-5.57431,54.67722|-5.62916,54.67945|-5.73674,54.67383|-5.80305,54.66138|-5.88257,54.60652|-5.92445,54.63180|-5.86681,54.68972|-5.81903,54.70972|-5.74672,54.72452|-5.68775,54.76335|-5.70931,54.83166|-5.74694,54.85361|-5.79139,54.85139|-6.03611,55.05778|-6.04250,55.10277|-6.03444,55.15458|-6.10125,55.20945|-6.14584,55.22069|-6.25500,55.21194|-6.37639,55.23916|-6.51556,55.23305|-6.61334,55.20722|-6.73028,55.18027|-6.82472,55.16806|-6.88972,55.16777|-6.96695,55.15611|-6.99416,55.11027|-7.05139,55.04680|-7.09500,55.03694|-7.25251,55.07059|-7.32639,55.04527|-7.40639,54.95333|-7.45805,54.85777|-7.55334,54.76277|-7.73916,54.71054|-7.82576,54.73416|-7.92639,54.70054|-7.85236,54.63388|-7.77750,54.62694|-7.83361,54.55389|-7.95084,54.53222|-8.04695,54.50722|-8.17166,54.46388'; |
|
3066 | + break; |
|
3067 | + case 'WALES': |
|
3068 | + $coordsAsStr[] = '-3.08860,53.26001|-3.33639,53.34722|-3.38806,53.34361|-3.60986,53.27944|-3.73014,53.28944|-3.85445,53.28444|-4.01861,53.23750|-4.06639,53.22639|-4.15334,53.22556|-4.19639,53.20611|-4.33028,53.11222|-4.36097,53.02888|-4.55278,52.92889|-4.61889,52.90916|-4.72195,52.83611|-4.72778,52.78139|-4.53945,52.79306|-4.47722,52.85500|-4.41416,52.88472|-4.31292,52.90499|-4.23334,52.91499|-4.13569,52.87888|-4.13056,52.77777|-4.05334,52.71666|-4.10639,52.65084|-4.12597,52.60375|-4.08056,52.55333|-4.05972,52.48584|-4.09666,52.38583|-4.14305,52.32027|-4.19361,52.27638|-4.23166,52.24888|-4.52722,52.13083|-4.66945,52.13027|-4.73695,52.10361|-4.76778,52.06444|-4.84445,52.01388|-5.09945,51.96056|-5.23916,51.91638|-5.25889,51.87056|-5.18500,51.86958|-5.11528,51.83333|-5.10257,51.77895|-5.16111,51.76222|-5.24694,51.73027|-5.19111,51.70888|-5.00739,51.70349|-4.90875,51.71249|-4.86111,51.71334|-4.97061,51.67577|-5.02128,51.66861|-5.05139,51.62028|-5.00528,51.60638|-4.94139,51.59416|-4.89028,51.62694|-4.83569,51.64534|-4.79063,51.63340|-4.69028,51.66666|-4.64584,51.72666|-4.57445,51.73416|-4.43611,51.73722|-4.26222,51.67694|-4.19750,51.67916|-4.06614,51.66804|-4.11639,51.63416|-4.17750,51.62235|-4.25055,51.62861|-4.29208,51.60743|-4.27778,51.55666|-4.20486,51.53527|-3.94972,51.61278|-3.83792,51.61999|-3.78166,51.56750|-3.75160,51.52931|-3.67194,51.47388|-3.54250,51.39777|-3.40334,51.37972|-3.27097,51.38014|-3.16458,51.40909|-3.15166,51.45305|-3.11875,51.48750|-3.02111,51.52527|-2.95472,51.53972|-2.89278,51.53861|-2.84778,51.54500|-2.71472,51.58083|-2.66500,51.61500|-2.68666,51.71889|-2.68334,51.76957|-2.65944,51.81806|-2.77861,51.88583|-2.86639,51.92889|-2.91757,51.91569|-2.98889,51.92555|-3.04528,51.97639|-3.08500,52.01930|-3.11250,52.06945|-3.12222,52.11805|-3.07555,52.14804|-3.05125,52.23347|-2.99750,52.28139|-2.95486,52.33117|-3.02195,52.34027|-3.19611,52.41027|-3.19514,52.46722|-3.11916,52.49194|-3.02736,52.49792|-2.98028,52.53083|-3.00792,52.56902|-3.07089,52.55702|-3.11750,52.58666|-3.06666,52.63527|-3.01111,52.71166|-3.06806,52.77027|-3.13708,52.79312|-3.13014,52.88486|-3.08639,52.91611|-2.99389,52.95361|-2.85069,52.93875|-2.79278,52.90207|-2.71945,52.91902|-2.73109,52.96873|-2.77792,52.98514|-2.85695,53.03249|-2.89389,53.10416|-2.91069,53.17014|-2.95528,53.21555|-3.02000,53.24722|-3.08860,53.26001'; |
|
3069 | + break; |
|
3070 | + case 'NC': |
|
3071 | + $coordsAsStr[] = '-81.65876,36.60938|-81.70390,36.55513|-81.70639,36.50804|-81.74665,36.39777|-81.90723,36.30804|-82.03195,36.12694|-82.08416,36.10146|-82.12826,36.11020|-82.21500,36.15833|-82.36375,36.11347|-82.43472,36.06013|-82.46236,36.01708|-82.56006,35.96263|-82.60042,35.99638|-82.62308,36.06121|-82.73500,36.01833|-82.84612,35.94944|-82.90451,35.88819|-82.93555,35.83846|-83.16000,35.76236|-83.24222,35.71944|-83.49222,35.57111|-83.56847,35.55861|-83.64416,35.56471|-83.73499,35.56638|-83.88222,35.51791|-83.98361,35.44944|-84.03639,35.35444|-84.04964,35.29117|-84.09042,35.25986|-84.15084,35.25388|-84.20521,35.25722|-84.29284,35.22596|-84.32471,34.98701|-83.09778,35.00027|-82.77722,35.09138|-82.59639,35.14972|-82.37999,35.21500|-82.27362,35.20583|-81.41306,35.17416|-81.05915,35.15333|-80.92666,35.10695|-80.78751,34.95610|-80.79334,34.82555|-79.66777,34.80694|-79.11555,34.34527|-78.57222,33.88166|-78.51806,33.87999|-78.43721,33.89804|-78.23735,33.91986|-78.15389,33.91471|-78.06974,33.89500|-78.02597,33.88936|-77.97611,33.94276|-77.95299,33.99243|-77.94499,34.06499|-77.92728,34.11756|-77.92250,33.99194|-77.92264,33.93715|-77.88215,34.06166|-77.86222,34.15083|-77.83501,34.19194|-77.75724,34.28527|-77.68222,34.36555|-77.63667,34.39805|-77.57363,34.43694|-77.45527,34.50403|-77.38173,34.51646|-77.37905,34.56294|-77.38572,34.61260|-77.40944,34.68916|-77.38847,34.73304|-77.33097,34.63992|-77.35024,34.60099|-77.30958,34.55972|-77.09424,34.67742|-76.75994,34.76659|-76.68325,34.79749|-76.66097,34.75781|-76.62611,34.71014|-76.50063,34.73617|-76.48138,34.77638|-76.38305,34.86423|-76.34326,34.88194|-76.27181,34.96263|-76.35125,35.02221|-76.32354,34.97429|-76.45319,34.93524|-76.43395,34.98782|-76.45356,35.06676|-76.52917,35.00444|-76.63382,34.98242|-76.69722,34.94887|-76.75306,34.90526|-76.81636,34.93944|-76.89000,34.95388|-76.93180,34.96957|-76.96501,34.99777|-77.06816,35.14978|-76.97639,35.06806|-76.86722,35.00000|-76.80531,34.98559|-76.72708,35.00152|-76.60402,35.07416|-76.56555,35.11486|-76.57305,35.16013|-76.66489,35.16694|-76.56361,35.23361|-76.48750,35.22582|-76.46889,35.27166|-76.50298,35.30791|-76.83251,35.39222|-77.02305,35.48694|-77.04958,35.52694|-76.91292,35.46166|-76.65250,35.41499|-76.61611,35.45888|-76.63195,35.52249|-76.58820,35.55104|-76.51556,35.53194|-76.56711,35.48494|-76.52251,35.40416|-76.46195,35.37221|-76.13319,35.35986|-76.04111,35.42416|-76.00223,35.46610|-75.97958,35.51666|-75.89362,35.57555|-75.83834,35.56694|-75.78944,35.57138|-75.74076,35.61846|-75.72084,35.69263|-75.72084,35.81451|-75.74917,35.87791|-75.78333,35.91972|-75.85083,35.97527|-75.94333,35.91777|-75.98944,35.88054|-75.98854,35.79110|-75.99388,35.71027|-76.02875,35.65409|-76.10320,35.66041|-76.13563,35.69239|-76.04475,35.68436|-76.04167,35.74916|-76.05305,35.79361|-76.05305,35.87375|-76.02653,35.96222|-76.07751,35.99319|-76.17472,35.99596|-76.27917,35.91915|-76.37986,35.95763|-76.42014,35.97874|-76.55375,35.93971|-76.66222,35.93305|-76.72952,35.93984|-76.73392,36.04760|-76.75384,36.09477|-76.76028,36.14513|-76.74610,36.22818|-76.70458,36.24673|-76.72764,36.16736|-76.71021,36.11752|-76.69117,36.07165|-76.65979,36.03312|-76.49527,36.00958|-76.37138,36.07694|-76.37084,36.14999|-76.21417,36.09471|-76.07591,36.17910|-76.18361,36.26915|-76.19965,36.31739|-76.13986,36.28805|-76.04274,36.21974|-76.00465,36.18110|-75.95287,36.19241|-75.97604,36.31138|-75.93895,36.28381|-75.85271,36.11069|-75.79315,36.07385|-75.79639,36.11804|-75.88333,36.29554|-75.94665,36.37194|-75.98694,36.41166|-76.03473,36.49666|-76.02899,36.55000|-78.44234,36.54986|-78.56594,36.55799|-80.27556,36.55110|-81.15361,36.56499|-81.38722,36.57695|-81.65876,36.60938'; |
|
3072 | + break; |
|
3073 | + default: |
|
3074 | + } |
|
3075 | + ?> |
|
3076 | 3076 | var coordStr = <?php echo json_encode($coordsAsStr) ?>; |
3077 | 3077 | jQuery.each(coordStr, function(index, value) { |
3078 | 3078 | var coordXY = value.split('|'); |
@@ -3139,31 +3139,31 @@ discard block |
||
3139 | 3139 | |
3140 | 3140 | // Create the Main Location Marker |
3141 | 3141 | <?php |
3142 | - if ($level < 3 && $place_icon != '') { |
|
3143 | - echo 'var image = { |
|
3142 | + if ($level < 3 && $place_icon != '') { |
|
3143 | + echo 'var image = { |
|
3144 | 3144 | "url" : WT_STATIC_URL + WT_MODULES_DIR + "googlemap/" + "' . $place_icon . '", |
3145 | 3145 | "size" : new google.maps.Size(25, 15), // Image size |
3146 | 3146 | "origin" : new google.maps.Point(0, 0), // Image origin |
3147 | 3147 | "anchor" : new google.maps.Point(12, 15) // Image anchor |
3148 | 3148 | };'; |
3149 | - echo 'marker = new google.maps.Marker({'; |
|
3150 | - echo 'icon: image,'; |
|
3151 | - echo 'position: latlng,'; |
|
3152 | - echo 'map: map,'; |
|
3153 | - echo 'title: pl_name,'; |
|
3154 | - echo 'draggable: true,'; |
|
3155 | - echo 'zIndex:1'; |
|
3156 | - echo '});'; |
|
3157 | - } else { |
|
3158 | - echo 'marker = new google.maps.Marker({'; |
|
3159 | - echo 'position: latlng,'; |
|
3160 | - echo 'map: map,'; |
|
3161 | - echo 'title: pl_name,'; |
|
3162 | - echo 'draggable: true,'; |
|
3163 | - echo 'zIndex: 1'; |
|
3164 | - echo '});'; |
|
3165 | - } |
|
3166 | - ?> |
|
3149 | + echo 'marker = new google.maps.Marker({'; |
|
3150 | + echo 'icon: image,'; |
|
3151 | + echo 'position: latlng,'; |
|
3152 | + echo 'map: map,'; |
|
3153 | + echo 'title: pl_name,'; |
|
3154 | + echo 'draggable: true,'; |
|
3155 | + echo 'zIndex:1'; |
|
3156 | + echo '});'; |
|
3157 | + } else { |
|
3158 | + echo 'marker = new google.maps.Marker({'; |
|
3159 | + echo 'position: latlng,'; |
|
3160 | + echo 'map: map,'; |
|
3161 | + echo 'title: pl_name,'; |
|
3162 | + echo 'draggable: true,'; |
|
3163 | + echo 'zIndex: 1'; |
|
3164 | + echo '});'; |
|
3165 | + } |
|
3166 | + ?> |
|
3167 | 3167 | |
3168 | 3168 | // Set marker by clicking on map --- |
3169 | 3169 | google.maps.event.addListener(map, 'click', function(event) { |
@@ -3411,73 +3411,73 @@ discard block |
||
3411 | 3411 | <br> |
3412 | 3412 | <br> |
3413 | 3413 | <?php |
3414 | - } |
|
3415 | - |
|
3416 | - /** |
|
3417 | - * Places administration. |
|
3418 | - */ |
|
3419 | - private function adminPlaces() { |
|
3420 | - global $WT_TREE; |
|
3421 | - |
|
3422 | - $action = Filter::get('action'); |
|
3423 | - $parent = Filter::get('parent'); |
|
3424 | - $inactive = Filter::getBool('inactive'); |
|
3425 | - $deleteRecord = Filter::get('deleteRecord'); |
|
3426 | - |
|
3427 | - if (!isset($parent)) { |
|
3428 | - $parent = 0; |
|
3429 | - } |
|
3430 | - |
|
3431 | - $controller = new PageController; |
|
3432 | - $controller->restrictAccess(Auth::isAdmin()); |
|
3433 | - |
|
3434 | - if ($action == 'ExportFile' && Auth::isAdmin()) { |
|
3435 | - $tmp = $this->placeIdToHierarchy($parent); |
|
3436 | - $maxLevel = $this->getHighestLevel(); |
|
3437 | - if ($maxLevel > 8) { |
|
3438 | - $maxLevel = 8; |
|
3439 | - } |
|
3440 | - $tmp[0] = 'places'; |
|
3441 | - $outputFileName = preg_replace('/[:;\/\\\(\)\{\}\[\] $]/', '_', implode('-', $tmp)) . '.csv'; |
|
3442 | - header('Content-Type: application/octet-stream'); |
|
3443 | - header('Content-Disposition: attachment; filename="' . $outputFileName . '"'); |
|
3444 | - echo '"', I18N::translate('Level'), '";"', I18N::translate('Country'), '";'; |
|
3445 | - if ($maxLevel > 0) { |
|
3446 | - echo '"', I18N::translate('State'), '";'; |
|
3447 | - } |
|
3448 | - if ($maxLevel > 1) { |
|
3449 | - echo '"', I18N::translate('County'), '";'; |
|
3450 | - } |
|
3451 | - if ($maxLevel > 2) { |
|
3452 | - echo '"', I18N::translate('City'), '";'; |
|
3453 | - } |
|
3454 | - if ($maxLevel > 3) { |
|
3455 | - echo '"', I18N::translate('Place'), '";'; |
|
3456 | - } |
|
3457 | - if ($maxLevel > 4) { |
|
3458 | - echo '"', I18N::translate('Place'), '";'; |
|
3459 | - } |
|
3460 | - if ($maxLevel > 5) { |
|
3461 | - echo '"', I18N::translate('Place'), '";'; |
|
3462 | - } |
|
3463 | - if ($maxLevel > 6) { |
|
3464 | - echo '"', I18N::translate('Place'), '";'; |
|
3465 | - } |
|
3466 | - if ($maxLevel > 7) { |
|
3467 | - echo '"', I18N::translate('Place'), '";'; |
|
3468 | - } |
|
3469 | - echo '"', I18N::translate('Longitude'), '";"', I18N::translate('Latitude'), '";'; |
|
3470 | - echo '"', I18N::translate('Zoom level'), '";"', I18N::translate('Icon'), '";', WT_EOL; |
|
3471 | - $this->outputLevel($parent); |
|
3472 | - |
|
3473 | - return; |
|
3474 | - } |
|
3475 | - |
|
3476 | - $controller |
|
3477 | - ->setPageTitle(I18N::translate('Google Maps™')) |
|
3478 | - ->pageHeader(); |
|
3479 | - |
|
3480 | - ?> |
|
3414 | + } |
|
3415 | + |
|
3416 | + /** |
|
3417 | + * Places administration. |
|
3418 | + */ |
|
3419 | + private function adminPlaces() { |
|
3420 | + global $WT_TREE; |
|
3421 | + |
|
3422 | + $action = Filter::get('action'); |
|
3423 | + $parent = Filter::get('parent'); |
|
3424 | + $inactive = Filter::getBool('inactive'); |
|
3425 | + $deleteRecord = Filter::get('deleteRecord'); |
|
3426 | + |
|
3427 | + if (!isset($parent)) { |
|
3428 | + $parent = 0; |
|
3429 | + } |
|
3430 | + |
|
3431 | + $controller = new PageController; |
|
3432 | + $controller->restrictAccess(Auth::isAdmin()); |
|
3433 | + |
|
3434 | + if ($action == 'ExportFile' && Auth::isAdmin()) { |
|
3435 | + $tmp = $this->placeIdToHierarchy($parent); |
|
3436 | + $maxLevel = $this->getHighestLevel(); |
|
3437 | + if ($maxLevel > 8) { |
|
3438 | + $maxLevel = 8; |
|
3439 | + } |
|
3440 | + $tmp[0] = 'places'; |
|
3441 | + $outputFileName = preg_replace('/[:;\/\\\(\)\{\}\[\] $]/', '_', implode('-', $tmp)) . '.csv'; |
|
3442 | + header('Content-Type: application/octet-stream'); |
|
3443 | + header('Content-Disposition: attachment; filename="' . $outputFileName . '"'); |
|
3444 | + echo '"', I18N::translate('Level'), '";"', I18N::translate('Country'), '";'; |
|
3445 | + if ($maxLevel > 0) { |
|
3446 | + echo '"', I18N::translate('State'), '";'; |
|
3447 | + } |
|
3448 | + if ($maxLevel > 1) { |
|
3449 | + echo '"', I18N::translate('County'), '";'; |
|
3450 | + } |
|
3451 | + if ($maxLevel > 2) { |
|
3452 | + echo '"', I18N::translate('City'), '";'; |
|
3453 | + } |
|
3454 | + if ($maxLevel > 3) { |
|
3455 | + echo '"', I18N::translate('Place'), '";'; |
|
3456 | + } |
|
3457 | + if ($maxLevel > 4) { |
|
3458 | + echo '"', I18N::translate('Place'), '";'; |
|
3459 | + } |
|
3460 | + if ($maxLevel > 5) { |
|
3461 | + echo '"', I18N::translate('Place'), '";'; |
|
3462 | + } |
|
3463 | + if ($maxLevel > 6) { |
|
3464 | + echo '"', I18N::translate('Place'), '";'; |
|
3465 | + } |
|
3466 | + if ($maxLevel > 7) { |
|
3467 | + echo '"', I18N::translate('Place'), '";'; |
|
3468 | + } |
|
3469 | + echo '"', I18N::translate('Longitude'), '";"', I18N::translate('Latitude'), '";'; |
|
3470 | + echo '"', I18N::translate('Zoom level'), '";"', I18N::translate('Icon'), '";', WT_EOL; |
|
3471 | + $this->outputLevel($parent); |
|
3472 | + |
|
3473 | + return; |
|
3474 | + } |
|
3475 | + |
|
3476 | + $controller |
|
3477 | + ->setPageTitle(I18N::translate('Google Maps™')) |
|
3478 | + ->pageHeader(); |
|
3479 | + |
|
3480 | + ?> |
|
3481 | 3481 | <ol class="breadcrumb small"> |
3482 | 3482 | <li><a href="admin.php"><?php echo I18N::translate('Control panel') ?></a></li> |
3483 | 3483 | <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration') ?></a></li> |
@@ -3503,134 +3503,134 @@ discard block |
||
3503 | 3503 | </ul> |
3504 | 3504 | <?php |
3505 | 3505 | |
3506 | - if ($action == 'ImportGedcom') { |
|
3507 | - echo '<h2>' . I18N::translate('Geographic data') . '</h2>'; |
|
3508 | - $placelist = array(); |
|
3509 | - $j = 0; |
|
3510 | - $gedcom_records = |
|
3511 | - Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?") |
|
3512 | - ->execute(array($WT_TREE->getTreeId(), $WT_TREE->getTreeId())) |
|
3513 | - ->fetchOneColumn(); |
|
3514 | - foreach ($gedcom_records as $gedrec) { |
|
3515 | - $i = 1; |
|
3516 | - $placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i); |
|
3517 | - while (!empty($placerec)) { |
|
3518 | - if (preg_match("/2 PLAC (.+)/", $placerec, $match)) { |
|
3519 | - $placelist[$j] = array(); |
|
3520 | - $placelist[$j]['place'] = trim($match[1]); |
|
3521 | - if (preg_match("/4 LATI (.*)/", $placerec, $match)) { |
|
3522 | - $placelist[$j]['lati'] = trim($match[1]); |
|
3523 | - if (($placelist[$j]['lati'][0] != 'N') && ($placelist[$j]['lati'][0] != 'S')) { |
|
3524 | - if ($placelist[$j]['lati'] < 0) { |
|
3525 | - $placelist[$j]['lati'][0] = 'S'; |
|
3526 | - } else { |
|
3527 | - $placelist[$j]['lati'] = 'N' . $placelist[$j]['lati']; |
|
3528 | - } |
|
3529 | - } |
|
3530 | - } else { |
|
3531 | - $placelist[$j]['lati'] = null; |
|
3532 | - } |
|
3533 | - if (preg_match("/4 LONG (.*)/", $placerec, $match)) { |
|
3534 | - $placelist[$j]['long'] = trim($match[1]); |
|
3535 | - if (($placelist[$j]['long'][0] != 'E') && ($placelist[$j]['long'][0] != 'W')) { |
|
3536 | - if ($placelist[$j]['long'] < 0) { |
|
3537 | - $placelist[$j]['long'][0] = 'W'; |
|
3538 | - } else { |
|
3539 | - $placelist[$j]['long'] = 'E' . $placelist[$j]['long']; |
|
3540 | - } |
|
3541 | - } |
|
3542 | - } else { |
|
3543 | - $placelist[$j]['long'] = null; |
|
3544 | - } |
|
3545 | - $j = $j + 1; |
|
3546 | - } |
|
3547 | - $i = $i + 1; |
|
3548 | - $placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i); |
|
3549 | - } |
|
3550 | - } |
|
3551 | - asort($placelist); |
|
3552 | - |
|
3553 | - $prevPlace = ''; |
|
3554 | - $prevLati = ''; |
|
3555 | - $prevLong = ''; |
|
3556 | - $placelistUniq = array(); |
|
3557 | - $j = 0; |
|
3558 | - foreach ($placelist as $k => $place) { |
|
3559 | - if ($place['place'] != $prevPlace) { |
|
3560 | - $placelistUniq[$j] = array(); |
|
3561 | - $placelistUniq[$j]['place'] = $place['place']; |
|
3562 | - $placelistUniq[$j]['lati'] = $place['lati']; |
|
3563 | - $placelistUniq[$j]['long'] = $place['long']; |
|
3564 | - $j = $j + 1; |
|
3565 | - } elseif (($place['place'] == $prevPlace) && (($place['lati'] != $prevLati) || ($place['long'] != $prevLong))) { |
|
3566 | - if (($placelistUniq[$j - 1]['lati'] == 0) || ($placelistUniq[$j - 1]['long'] == 0)) { |
|
3567 | - $placelistUniq[$j - 1]['lati'] = $place['lati']; |
|
3568 | - $placelistUniq[$j - 1]['long'] = $place['long']; |
|
3569 | - } elseif (($place['lati'] != '0') || ($place['long'] != '0')) { |
|
3570 | - echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>'; |
|
3571 | - } |
|
3572 | - } |
|
3573 | - $prevPlace = $place['place']; |
|
3574 | - $prevLati = $place['lati']; |
|
3575 | - $prevLong = $place['long']; |
|
3576 | - } |
|
3577 | - |
|
3578 | - $highestIndex = $this->getHighestIndex(); |
|
3579 | - |
|
3580 | - $default_zoom_level = array(4, 7, 10, 12); |
|
3581 | - foreach ($placelistUniq as $k => $place) { |
|
3582 | - $parent = preg_split('/ *, */', $place['place']); |
|
3583 | - $parent = array_reverse($parent); |
|
3584 | - $parent_id = 0; |
|
3585 | - $num_parent = count($parent); |
|
3586 | - for ($i = 0; $i < $num_parent; $i++) { |
|
3587 | - if (!isset($default_zoom_level[$i])) { |
|
3588 | - $default_zoom_level[$i] = $default_zoom_level[$i - 1]; |
|
3589 | - } |
|
3590 | - $escparent = $parent[$i]; |
|
3591 | - if ($escparent == '') { |
|
3592 | - $escparent = 'Unknown'; |
|
3593 | - } |
|
3594 | - $row = |
|
3595 | - Database::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ?") |
|
3596 | - ->execute(array($i, $parent_id, $escparent)) |
|
3597 | - ->fetchOneRow(); |
|
3598 | - if ($i < $num_parent - 1) { |
|
3599 | - // Create higher-level places, if necessary |
|
3600 | - if (empty($row)) { |
|
3601 | - $highestIndex++; |
|
3602 | - Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom) VALUES (?, ?, ?, ?, ?)") |
|
3603 | - ->execute(array($highestIndex, $parent_id, $i, $escparent, $default_zoom_level[$i])); |
|
3604 | - echo Filter::escapeHtml($escparent), '<br>'; |
|
3605 | - $parent_id = $highestIndex; |
|
3606 | - } else { |
|
3607 | - $parent_id = $row->pl_id; |
|
3608 | - } |
|
3609 | - } else { |
|
3610 | - // Create lowest-level place, if necessary |
|
3611 | - if (empty($row->pl_id)) { |
|
3612 | - $highestIndex++; |
|
3613 | - Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom) VALUES (?, ?, ?, ?, ?, ?, ?)") |
|
3614 | - ->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $default_zoom_level[$i])); |
|
3615 | - echo Filter::escapeHtml($escparent), '<br>'; |
|
3616 | - } else { |
|
3617 | - if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati'] != '0' && $place['long'] != '0') { |
|
3618 | - Database::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?") |
|
3619 | - ->execute(array($place['lati'], $place['long'], $row->pl_id)); |
|
3620 | - echo Filter::escapeHtml($escparent), '<br>'; |
|
3621 | - } |
|
3622 | - } |
|
3623 | - } |
|
3624 | - } |
|
3625 | - } |
|
3626 | - $parent = 0; |
|
3627 | - } |
|
3628 | - |
|
3629 | - if ($action === 'ImportFile') { |
|
3630 | - echo '<h2>' . I18N::translate('Upload geographic data') . '</h2>'; |
|
3631 | - $placefiles = $this->findFiles(WT_MODULES_DIR . 'googlemap/extra'); |
|
3632 | - sort($placefiles); |
|
3633 | - ?> |
|
3506 | + if ($action == 'ImportGedcom') { |
|
3507 | + echo '<h2>' . I18N::translate('Geographic data') . '</h2>'; |
|
3508 | + $placelist = array(); |
|
3509 | + $j = 0; |
|
3510 | + $gedcom_records = |
|
3511 | + Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?") |
|
3512 | + ->execute(array($WT_TREE->getTreeId(), $WT_TREE->getTreeId())) |
|
3513 | + ->fetchOneColumn(); |
|
3514 | + foreach ($gedcom_records as $gedrec) { |
|
3515 | + $i = 1; |
|
3516 | + $placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i); |
|
3517 | + while (!empty($placerec)) { |
|
3518 | + if (preg_match("/2 PLAC (.+)/", $placerec, $match)) { |
|
3519 | + $placelist[$j] = array(); |
|
3520 | + $placelist[$j]['place'] = trim($match[1]); |
|
3521 | + if (preg_match("/4 LATI (.*)/", $placerec, $match)) { |
|
3522 | + $placelist[$j]['lati'] = trim($match[1]); |
|
3523 | + if (($placelist[$j]['lati'][0] != 'N') && ($placelist[$j]['lati'][0] != 'S')) { |
|
3524 | + if ($placelist[$j]['lati'] < 0) { |
|
3525 | + $placelist[$j]['lati'][0] = 'S'; |
|
3526 | + } else { |
|
3527 | + $placelist[$j]['lati'] = 'N' . $placelist[$j]['lati']; |
|
3528 | + } |
|
3529 | + } |
|
3530 | + } else { |
|
3531 | + $placelist[$j]['lati'] = null; |
|
3532 | + } |
|
3533 | + if (preg_match("/4 LONG (.*)/", $placerec, $match)) { |
|
3534 | + $placelist[$j]['long'] = trim($match[1]); |
|
3535 | + if (($placelist[$j]['long'][0] != 'E') && ($placelist[$j]['long'][0] != 'W')) { |
|
3536 | + if ($placelist[$j]['long'] < 0) { |
|
3537 | + $placelist[$j]['long'][0] = 'W'; |
|
3538 | + } else { |
|
3539 | + $placelist[$j]['long'] = 'E' . $placelist[$j]['long']; |
|
3540 | + } |
|
3541 | + } |
|
3542 | + } else { |
|
3543 | + $placelist[$j]['long'] = null; |
|
3544 | + } |
|
3545 | + $j = $j + 1; |
|
3546 | + } |
|
3547 | + $i = $i + 1; |
|
3548 | + $placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i); |
|
3549 | + } |
|
3550 | + } |
|
3551 | + asort($placelist); |
|
3552 | + |
|
3553 | + $prevPlace = ''; |
|
3554 | + $prevLati = ''; |
|
3555 | + $prevLong = ''; |
|
3556 | + $placelistUniq = array(); |
|
3557 | + $j = 0; |
|
3558 | + foreach ($placelist as $k => $place) { |
|
3559 | + if ($place['place'] != $prevPlace) { |
|
3560 | + $placelistUniq[$j] = array(); |
|
3561 | + $placelistUniq[$j]['place'] = $place['place']; |
|
3562 | + $placelistUniq[$j]['lati'] = $place['lati']; |
|
3563 | + $placelistUniq[$j]['long'] = $place['long']; |
|
3564 | + $j = $j + 1; |
|
3565 | + } elseif (($place['place'] == $prevPlace) && (($place['lati'] != $prevLati) || ($place['long'] != $prevLong))) { |
|
3566 | + if (($placelistUniq[$j - 1]['lati'] == 0) || ($placelistUniq[$j - 1]['long'] == 0)) { |
|
3567 | + $placelistUniq[$j - 1]['lati'] = $place['lati']; |
|
3568 | + $placelistUniq[$j - 1]['long'] = $place['long']; |
|
3569 | + } elseif (($place['lati'] != '0') || ($place['long'] != '0')) { |
|
3570 | + echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>'; |
|
3571 | + } |
|
3572 | + } |
|
3573 | + $prevPlace = $place['place']; |
|
3574 | + $prevLati = $place['lati']; |
|
3575 | + $prevLong = $place['long']; |
|
3576 | + } |
|
3577 | + |
|
3578 | + $highestIndex = $this->getHighestIndex(); |
|
3579 | + |
|
3580 | + $default_zoom_level = array(4, 7, 10, 12); |
|
3581 | + foreach ($placelistUniq as $k => $place) { |
|
3582 | + $parent = preg_split('/ *, */', $place['place']); |
|
3583 | + $parent = array_reverse($parent); |
|
3584 | + $parent_id = 0; |
|
3585 | + $num_parent = count($parent); |
|
3586 | + for ($i = 0; $i < $num_parent; $i++) { |
|
3587 | + if (!isset($default_zoom_level[$i])) { |
|
3588 | + $default_zoom_level[$i] = $default_zoom_level[$i - 1]; |
|
3589 | + } |
|
3590 | + $escparent = $parent[$i]; |
|
3591 | + if ($escparent == '') { |
|
3592 | + $escparent = 'Unknown'; |
|
3593 | + } |
|
3594 | + $row = |
|
3595 | + Database::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ?") |
|
3596 | + ->execute(array($i, $parent_id, $escparent)) |
|
3597 | + ->fetchOneRow(); |
|
3598 | + if ($i < $num_parent - 1) { |
|
3599 | + // Create higher-level places, if necessary |
|
3600 | + if (empty($row)) { |
|
3601 | + $highestIndex++; |
|
3602 | + Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom) VALUES (?, ?, ?, ?, ?)") |
|
3603 | + ->execute(array($highestIndex, $parent_id, $i, $escparent, $default_zoom_level[$i])); |
|
3604 | + echo Filter::escapeHtml($escparent), '<br>'; |
|
3605 | + $parent_id = $highestIndex; |
|
3606 | + } else { |
|
3607 | + $parent_id = $row->pl_id; |
|
3608 | + } |
|
3609 | + } else { |
|
3610 | + // Create lowest-level place, if necessary |
|
3611 | + if (empty($row->pl_id)) { |
|
3612 | + $highestIndex++; |
|
3613 | + Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom) VALUES (?, ?, ?, ?, ?, ?, ?)") |
|
3614 | + ->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $default_zoom_level[$i])); |
|
3615 | + echo Filter::escapeHtml($escparent), '<br>'; |
|
3616 | + } else { |
|
3617 | + if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati'] != '0' && $place['long'] != '0') { |
|
3618 | + Database::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?") |
|
3619 | + ->execute(array($place['lati'], $place['long'], $row->pl_id)); |
|
3620 | + echo Filter::escapeHtml($escparent), '<br>'; |
|
3621 | + } |
|
3622 | + } |
|
3623 | + } |
|
3624 | + } |
|
3625 | + } |
|
3626 | + $parent = 0; |
|
3627 | + } |
|
3628 | + |
|
3629 | + if ($action === 'ImportFile') { |
|
3630 | + echo '<h2>' . I18N::translate('Upload geographic data') . '</h2>'; |
|
3631 | + $placefiles = $this->findFiles(WT_MODULES_DIR . 'googlemap/extra'); |
|
3632 | + sort($placefiles); |
|
3633 | + ?> |
|
3634 | 3634 | <form class="form-horizontal" method="post" enctype="multipart/form-data" id="importfile" name="importfile" action="module.php?mod=googlemap&mod_action=admin_places&action=ImportFile2"> |
3635 | 3635 | |
3636 | 3636 | <!-- PLACES FILE --> |
@@ -3656,17 +3656,17 @@ discard block |
||
3656 | 3656 | <?php echo WT_MODULES_DIR . 'googlemap/extra/' ?> |
3657 | 3657 | </span> |
3658 | 3658 | <?php |
3659 | - foreach ($placefiles as $p => $placefile) { |
|
3660 | - unset($placefiles[$p]); |
|
3661 | - $p = Filter::escapeHtml($placefile); |
|
3662 | - if (substr($placefile, 0, 1) == "/") { |
|
3663 | - $placefiles[$p] = substr($placefile, 1); |
|
3664 | - } else { |
|
3665 | - $placefiles[$p] = $placefile; |
|
3666 | - } |
|
3667 | - } |
|
3668 | - echo FunctionsEdit::selectEditControl('localfile', $placefiles, '', '', 'class="form-control"'); |
|
3669 | - ?> |
|
3659 | + foreach ($placefiles as $p => $placefile) { |
|
3660 | + unset($placefiles[$p]); |
|
3661 | + $p = Filter::escapeHtml($placefile); |
|
3662 | + if (substr($placefile, 0, 1) == "/") { |
|
3663 | + $placefiles[$p] = substr($placefile, 1); |
|
3664 | + } else { |
|
3665 | + $placefiles[$p] = $placefile; |
|
3666 | + } |
|
3667 | + } |
|
3668 | + echo FunctionsEdit::selectEditControl('localfile', $placefiles, '', '', 'class="form-control"'); |
|
3669 | + ?> |
|
3670 | 3670 | </div> |
3671 | 3671 | </div> |
3672 | 3672 | </div> |
@@ -3712,192 +3712,192 @@ discard block |
||
3712 | 3712 | </div> |
3713 | 3713 | </form> |
3714 | 3714 | <?php |
3715 | - return; |
|
3716 | - } |
|
3717 | - |
|
3718 | - if ($action === 'ImportFile2') { |
|
3719 | - echo '<h2>' . I18N::translate('Geographic data') . '</h2>'; |
|
3720 | - $country_names = array(); |
|
3721 | - $stats = new Stats($WT_TREE); |
|
3722 | - foreach ($stats->iso3166() as $key => $value) { |
|
3723 | - $country_names[$key] = I18N::translate($key); |
|
3724 | - } |
|
3725 | - if (Filter::postBool('cleardatabase')) { |
|
3726 | - Database::exec("DELETE FROM `##placelocation` WHERE 1=1"); |
|
3727 | - } |
|
3728 | - if (!empty($_FILES['placesfile']['tmp_name'])) { |
|
3729 | - $lines = file($_FILES['placesfile']['tmp_name']); |
|
3730 | - } elseif (!empty($_REQUEST['localfile'])) { |
|
3731 | - $lines = file(WT_MODULES_DIR . 'googlemap/extra' . $_REQUEST['localfile']); |
|
3732 | - } |
|
3733 | - // Strip BYTE-ORDER-MARK, if present |
|
3734 | - if (!empty($lines[0]) && substr($lines[0], 0, 3) === WT_UTF8_BOM) { |
|
3735 | - $lines[0] = substr($lines[0], 3); |
|
3736 | - } |
|
3737 | - asort($lines); |
|
3738 | - $highestIndex = $this->getHighestIndex(); |
|
3739 | - $placelist = array(); |
|
3740 | - $j = 0; |
|
3741 | - $maxLevel = 0; |
|
3742 | - foreach ($lines as $p => $placerec) { |
|
3743 | - $fieldrec = explode(';', $placerec); |
|
3744 | - if ($fieldrec[0] > $maxLevel) { |
|
3745 | - $maxLevel = $fieldrec[0]; |
|
3746 | - } |
|
3747 | - } |
|
3748 | - $fields = count($fieldrec); |
|
3749 | - $set_icon = true; |
|
3750 | - if (!is_dir(WT_MODULES_DIR . 'googlemap/places/flags/')) { |
|
3751 | - $set_icon = false; |
|
3752 | - } |
|
3753 | - foreach ($lines as $p => $placerec) { |
|
3754 | - $fieldrec = explode(';', $placerec); |
|
3755 | - if (is_numeric($fieldrec[0]) && $fieldrec[0] <= $maxLevel) { |
|
3756 | - $placelist[$j] = array(); |
|
3757 | - $placelist[$j]['place'] = ''; |
|
3758 | - for ($ii = $fields - 4; $ii > 1; $ii--) { |
|
3759 | - if ($fieldrec[0] > $ii - 2) { |
|
3760 | - $placelist[$j]['place'] .= $fieldrec[$ii] . ','; |
|
3761 | - } |
|
3762 | - } |
|
3763 | - foreach ($country_names as $countrycode => $countryname) { |
|
3764 | - if ($countrycode == strtoupper($fieldrec[1])) { |
|
3765 | - $fieldrec[1] = $countryname; |
|
3766 | - break; |
|
3767 | - } |
|
3768 | - } |
|
3769 | - $placelist[$j]['place'] .= $fieldrec[1]; |
|
3770 | - $placelist[$j]['long'] = $fieldrec[$fields - 4]; |
|
3771 | - $placelist[$j]['lati'] = $fieldrec[$fields - 3]; |
|
3772 | - $placelist[$j]['zoom'] = $fieldrec[$fields - 2]; |
|
3773 | - if ($set_icon) { |
|
3774 | - $placelist[$j]['icon'] = trim($fieldrec[$fields - 1]); |
|
3775 | - } else { |
|
3776 | - $placelist[$j]['icon'] = ''; |
|
3777 | - } |
|
3778 | - $j = $j + 1; |
|
3779 | - } |
|
3780 | - } |
|
3781 | - |
|
3782 | - $prevPlace = ''; |
|
3783 | - $prevLati = ''; |
|
3784 | - $prevLong = ''; |
|
3785 | - $placelistUniq = array(); |
|
3786 | - $j = 0; |
|
3787 | - foreach ($placelist as $k => $place) { |
|
3788 | - if ($place['place'] != $prevPlace) { |
|
3789 | - $placelistUniq[$j] = array(); |
|
3790 | - $placelistUniq[$j]['place'] = $place['place']; |
|
3791 | - $placelistUniq[$j]['lati'] = $place['lati']; |
|
3792 | - $placelistUniq[$j]['long'] = $place['long']; |
|
3793 | - $placelistUniq[$j]['zoom'] = $place['zoom']; |
|
3794 | - $placelistUniq[$j]['icon'] = $place['icon']; |
|
3795 | - $j = $j + 1; |
|
3796 | - } elseif (($place['place'] == $prevPlace) && (($place['lati'] != $prevLati) || ($place['long'] != $prevLong))) { |
|
3797 | - if (($placelistUniq[$j - 1]['lati'] == 0) || ($placelistUniq[$j - 1]['long'] == 0)) { |
|
3798 | - $placelistUniq[$j - 1]['lati'] = $place['lati']; |
|
3799 | - $placelistUniq[$j - 1]['long'] = $place['long']; |
|
3800 | - $placelistUniq[$j - 1]['zoom'] = $place['zoom']; |
|
3801 | - $placelistUniq[$j - 1]['icon'] = $place['icon']; |
|
3802 | - } elseif (($place['lati'] != '0') || ($place['long'] != '0')) { |
|
3803 | - echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>'; |
|
3804 | - } |
|
3805 | - } |
|
3806 | - $prevPlace = $place['place']; |
|
3807 | - $prevLati = $place['lati']; |
|
3808 | - $prevLong = $place['long']; |
|
3809 | - } |
|
3810 | - |
|
3811 | - $default_zoom_level = array(); |
|
3812 | - $default_zoom_level[0] = 4; |
|
3813 | - $default_zoom_level[1] = 7; |
|
3814 | - $default_zoom_level[2] = 10; |
|
3815 | - $default_zoom_level[3] = 12; |
|
3816 | - foreach ($placelistUniq as $k => $place) { |
|
3817 | - $parent = explode(',', $place['place']); |
|
3818 | - $parent = array_reverse($parent); |
|
3819 | - $parent_id = 0; |
|
3820 | - $num_parent = count($parent); |
|
3821 | - for ($i = 0; $i < $num_parent; $i++) { |
|
3822 | - $escparent = $parent[$i]; |
|
3823 | - if ($escparent == '') { |
|
3824 | - $escparent = 'Unknown'; |
|
3825 | - } |
|
3826 | - $row = |
|
3827 | - Database::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place") |
|
3828 | - ->execute(array($i, $parent_id, $escparent)) |
|
3829 | - ->fetchOneRow(); |
|
3830 | - if (empty($row)) { |
|
3831 | - // this name does not yet exist: create entry |
|
3832 | - if (!Filter::postBool('updateonly')) { |
|
3833 | - $highestIndex = $highestIndex + 1; |
|
3834 | - if (($i + 1) == $num_parent) { |
|
3835 | - $zoomlevel = $place['zoom']; |
|
3836 | - } elseif (isset($default_zoom_level[$i])) { |
|
3837 | - $zoomlevel = $default_zoom_level[$i]; |
|
3838 | - } else { |
|
3839 | - $zoomlevel = $this->getSetting('GM_MAX_ZOOM'); |
|
3840 | - } |
|
3841 | - if (($place['lati'] == '0') || ($place['long'] == '0') || (($i + 1) < $num_parent)) { |
|
3842 | - Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?)") |
|
3843 | - ->execute(array($highestIndex, $parent_id, $i, $escparent, $zoomlevel, $place['icon'])); |
|
3844 | - } else { |
|
3845 | - //delete leading zero |
|
3846 | - $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place['lati']); |
|
3847 | - $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $place['long']); |
|
3848 | - if ($pl_lati >= 0) { |
|
3849 | - $place['lati'] = 'N' . abs($pl_lati); |
|
3850 | - } elseif ($pl_lati < 0) { |
|
3851 | - $place['lati'] = 'S' . abs($pl_lati); |
|
3852 | - } |
|
3853 | - if ($pl_long >= 0) { |
|
3854 | - $place['long'] = 'E' . abs($pl_long); |
|
3855 | - } elseif ($pl_long < 0) { |
|
3856 | - $place['long'] = 'W' . abs($pl_long); |
|
3857 | - } |
|
3858 | - Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)") |
|
3859 | - ->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $zoomlevel, $place['icon'])); |
|
3860 | - } |
|
3861 | - $parent_id = $highestIndex; |
|
3862 | - } |
|
3863 | - } else { |
|
3864 | - $parent_id = $row->pl_id; |
|
3865 | - if (Filter::postBool('overwritedata') && ($i + 1 == count($parent))) { |
|
3866 | - Database::prepare("UPDATE `##placelocation` SET pl_lati = ?, pl_long = ?, pl_zoom = ?, pl_icon = ? WHERE pl_id = ?") |
|
3867 | - ->execute(array($place['lati'], $place['long'], $place['zoom'], $place['icon'], $parent_id)); |
|
3868 | - } else { |
|
3869 | - // Update only if existing data is missing |
|
3870 | - if (!$row->pl_long && !$row->pl_lati) { |
|
3871 | - Database::prepare("UPDATE `##placelocation` SET pl_lati = ?, pl_long = ? WHERE pl_id = ?") |
|
3872 | - ->execute(array($place['lati'], $place['long'], $parent_id)); |
|
3873 | - } |
|
3874 | - if (!$row->pl_icon && $place['icon']) { |
|
3875 | - Database::prepare("UPDATE `##placelocation` SET pl_icon = ? WHERE pl_id = ?") |
|
3876 | - ->execute(array($place['icon'], $parent_id)); |
|
3877 | - } |
|
3878 | - } |
|
3879 | - } |
|
3880 | - } |
|
3881 | - } |
|
3882 | - $parent = 0; |
|
3883 | - } |
|
3884 | - |
|
3885 | - if ($action == 'DeleteRecord') { |
|
3886 | - echo '<h2>' . I18N::translate('Geographic data') . '</h2>'; |
|
3887 | - $exists = |
|
3888 | - Database::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?") |
|
3889 | - ->execute(array($deleteRecord)) |
|
3890 | - ->fetchOne(); |
|
3891 | - |
|
3892 | - if (!$exists) { |
|
3893 | - Database::prepare("DELETE FROM `##placelocation` WHERE pl_id=?") |
|
3894 | - ->execute(array($deleteRecord)); |
|
3895 | - } else { |
|
3896 | - echo '<table class="facts_table"><tr><td>', I18N::translate('Location not removed: this location contains sub-locations'), '</td></tr></table>'; |
|
3897 | - } |
|
3898 | - } |
|
3899 | - |
|
3900 | - ?> |
|
3715 | + return; |
|
3716 | + } |
|
3717 | + |
|
3718 | + if ($action === 'ImportFile2') { |
|
3719 | + echo '<h2>' . I18N::translate('Geographic data') . '</h2>'; |
|
3720 | + $country_names = array(); |
|
3721 | + $stats = new Stats($WT_TREE); |
|
3722 | + foreach ($stats->iso3166() as $key => $value) { |
|
3723 | + $country_names[$key] = I18N::translate($key); |
|
3724 | + } |
|
3725 | + if (Filter::postBool('cleardatabase')) { |
|
3726 | + Database::exec("DELETE FROM `##placelocation` WHERE 1=1"); |
|
3727 | + } |
|
3728 | + if (!empty($_FILES['placesfile']['tmp_name'])) { |
|
3729 | + $lines = file($_FILES['placesfile']['tmp_name']); |
|
3730 | + } elseif (!empty($_REQUEST['localfile'])) { |
|
3731 | + $lines = file(WT_MODULES_DIR . 'googlemap/extra' . $_REQUEST['localfile']); |
|
3732 | + } |
|
3733 | + // Strip BYTE-ORDER-MARK, if present |
|
3734 | + if (!empty($lines[0]) && substr($lines[0], 0, 3) === WT_UTF8_BOM) { |
|
3735 | + $lines[0] = substr($lines[0], 3); |
|
3736 | + } |
|
3737 | + asort($lines); |
|
3738 | + $highestIndex = $this->getHighestIndex(); |
|
3739 | + $placelist = array(); |
|
3740 | + $j = 0; |
|
3741 | + $maxLevel = 0; |
|
3742 | + foreach ($lines as $p => $placerec) { |
|
3743 | + $fieldrec = explode(';', $placerec); |
|
3744 | + if ($fieldrec[0] > $maxLevel) { |
|
3745 | + $maxLevel = $fieldrec[0]; |
|
3746 | + } |
|
3747 | + } |
|
3748 | + $fields = count($fieldrec); |
|
3749 | + $set_icon = true; |
|
3750 | + if (!is_dir(WT_MODULES_DIR . 'googlemap/places/flags/')) { |
|
3751 | + $set_icon = false; |
|
3752 | + } |
|
3753 | + foreach ($lines as $p => $placerec) { |
|
3754 | + $fieldrec = explode(';', $placerec); |
|
3755 | + if (is_numeric($fieldrec[0]) && $fieldrec[0] <= $maxLevel) { |
|
3756 | + $placelist[$j] = array(); |
|
3757 | + $placelist[$j]['place'] = ''; |
|
3758 | + for ($ii = $fields - 4; $ii > 1; $ii--) { |
|
3759 | + if ($fieldrec[0] > $ii - 2) { |
|
3760 | + $placelist[$j]['place'] .= $fieldrec[$ii] . ','; |
|
3761 | + } |
|
3762 | + } |
|
3763 | + foreach ($country_names as $countrycode => $countryname) { |
|
3764 | + if ($countrycode == strtoupper($fieldrec[1])) { |
|
3765 | + $fieldrec[1] = $countryname; |
|
3766 | + break; |
|
3767 | + } |
|
3768 | + } |
|
3769 | + $placelist[$j]['place'] .= $fieldrec[1]; |
|
3770 | + $placelist[$j]['long'] = $fieldrec[$fields - 4]; |
|
3771 | + $placelist[$j]['lati'] = $fieldrec[$fields - 3]; |
|
3772 | + $placelist[$j]['zoom'] = $fieldrec[$fields - 2]; |
|
3773 | + if ($set_icon) { |
|
3774 | + $placelist[$j]['icon'] = trim($fieldrec[$fields - 1]); |
|
3775 | + } else { |
|
3776 | + $placelist[$j]['icon'] = ''; |
|
3777 | + } |
|
3778 | + $j = $j + 1; |
|
3779 | + } |
|
3780 | + } |
|
3781 | + |
|
3782 | + $prevPlace = ''; |
|
3783 | + $prevLati = ''; |
|
3784 | + $prevLong = ''; |
|
3785 | + $placelistUniq = array(); |
|
3786 | + $j = 0; |
|
3787 | + foreach ($placelist as $k => $place) { |
|
3788 | + if ($place['place'] != $prevPlace) { |
|
3789 | + $placelistUniq[$j] = array(); |
|
3790 | + $placelistUniq[$j]['place'] = $place['place']; |
|
3791 | + $placelistUniq[$j]['lati'] = $place['lati']; |
|
3792 | + $placelistUniq[$j]['long'] = $place['long']; |
|
3793 | + $placelistUniq[$j]['zoom'] = $place['zoom']; |
|
3794 | + $placelistUniq[$j]['icon'] = $place['icon']; |
|
3795 | + $j = $j + 1; |
|
3796 | + } elseif (($place['place'] == $prevPlace) && (($place['lati'] != $prevLati) || ($place['long'] != $prevLong))) { |
|
3797 | + if (($placelistUniq[$j - 1]['lati'] == 0) || ($placelistUniq[$j - 1]['long'] == 0)) { |
|
3798 | + $placelistUniq[$j - 1]['lati'] = $place['lati']; |
|
3799 | + $placelistUniq[$j - 1]['long'] = $place['long']; |
|
3800 | + $placelistUniq[$j - 1]['zoom'] = $place['zoom']; |
|
3801 | + $placelistUniq[$j - 1]['icon'] = $place['icon']; |
|
3802 | + } elseif (($place['lati'] != '0') || ($place['long'] != '0')) { |
|
3803 | + echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>'; |
|
3804 | + } |
|
3805 | + } |
|
3806 | + $prevPlace = $place['place']; |
|
3807 | + $prevLati = $place['lati']; |
|
3808 | + $prevLong = $place['long']; |
|
3809 | + } |
|
3810 | + |
|
3811 | + $default_zoom_level = array(); |
|
3812 | + $default_zoom_level[0] = 4; |
|
3813 | + $default_zoom_level[1] = 7; |
|
3814 | + $default_zoom_level[2] = 10; |
|
3815 | + $default_zoom_level[3] = 12; |
|
3816 | + foreach ($placelistUniq as $k => $place) { |
|
3817 | + $parent = explode(',', $place['place']); |
|
3818 | + $parent = array_reverse($parent); |
|
3819 | + $parent_id = 0; |
|
3820 | + $num_parent = count($parent); |
|
3821 | + for ($i = 0; $i < $num_parent; $i++) { |
|
3822 | + $escparent = $parent[$i]; |
|
3823 | + if ($escparent == '') { |
|
3824 | + $escparent = 'Unknown'; |
|
3825 | + } |
|
3826 | + $row = |
|
3827 | + Database::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place") |
|
3828 | + ->execute(array($i, $parent_id, $escparent)) |
|
3829 | + ->fetchOneRow(); |
|
3830 | + if (empty($row)) { |
|
3831 | + // this name does not yet exist: create entry |
|
3832 | + if (!Filter::postBool('updateonly')) { |
|
3833 | + $highestIndex = $highestIndex + 1; |
|
3834 | + if (($i + 1) == $num_parent) { |
|
3835 | + $zoomlevel = $place['zoom']; |
|
3836 | + } elseif (isset($default_zoom_level[$i])) { |
|
3837 | + $zoomlevel = $default_zoom_level[$i]; |
|
3838 | + } else { |
|
3839 | + $zoomlevel = $this->getSetting('GM_MAX_ZOOM'); |
|
3840 | + } |
|
3841 | + if (($place['lati'] == '0') || ($place['long'] == '0') || (($i + 1) < $num_parent)) { |
|
3842 | + Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?)") |
|
3843 | + ->execute(array($highestIndex, $parent_id, $i, $escparent, $zoomlevel, $place['icon'])); |
|
3844 | + } else { |
|
3845 | + //delete leading zero |
|
3846 | + $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place['lati']); |
|
3847 | + $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $place['long']); |
|
3848 | + if ($pl_lati >= 0) { |
|
3849 | + $place['lati'] = 'N' . abs($pl_lati); |
|
3850 | + } elseif ($pl_lati < 0) { |
|
3851 | + $place['lati'] = 'S' . abs($pl_lati); |
|
3852 | + } |
|
3853 | + if ($pl_long >= 0) { |
|
3854 | + $place['long'] = 'E' . abs($pl_long); |
|
3855 | + } elseif ($pl_long < 0) { |
|
3856 | + $place['long'] = 'W' . abs($pl_long); |
|
3857 | + } |
|
3858 | + Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)") |
|
3859 | + ->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $zoomlevel, $place['icon'])); |
|
3860 | + } |
|
3861 | + $parent_id = $highestIndex; |
|
3862 | + } |
|
3863 | + } else { |
|
3864 | + $parent_id = $row->pl_id; |
|
3865 | + if (Filter::postBool('overwritedata') && ($i + 1 == count($parent))) { |
|
3866 | + Database::prepare("UPDATE `##placelocation` SET pl_lati = ?, pl_long = ?, pl_zoom = ?, pl_icon = ? WHERE pl_id = ?") |
|
3867 | + ->execute(array($place['lati'], $place['long'], $place['zoom'], $place['icon'], $parent_id)); |
|
3868 | + } else { |
|
3869 | + // Update only if existing data is missing |
|
3870 | + if (!$row->pl_long && !$row->pl_lati) { |
|
3871 | + Database::prepare("UPDATE `##placelocation` SET pl_lati = ?, pl_long = ? WHERE pl_id = ?") |
|
3872 | + ->execute(array($place['lati'], $place['long'], $parent_id)); |
|
3873 | + } |
|
3874 | + if (!$row->pl_icon && $place['icon']) { |
|
3875 | + Database::prepare("UPDATE `##placelocation` SET pl_icon = ? WHERE pl_id = ?") |
|
3876 | + ->execute(array($place['icon'], $parent_id)); |
|
3877 | + } |
|
3878 | + } |
|
3879 | + } |
|
3880 | + } |
|
3881 | + } |
|
3882 | + $parent = 0; |
|
3883 | + } |
|
3884 | + |
|
3885 | + if ($action == 'DeleteRecord') { |
|
3886 | + echo '<h2>' . I18N::translate('Geographic data') . '</h2>'; |
|
3887 | + $exists = |
|
3888 | + Database::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?") |
|
3889 | + ->execute(array($deleteRecord)) |
|
3890 | + ->fetchOne(); |
|
3891 | + |
|
3892 | + if (!$exists) { |
|
3893 | + Database::prepare("DELETE FROM `##placelocation` WHERE pl_id=?") |
|
3894 | + ->execute(array($deleteRecord)); |
|
3895 | + } else { |
|
3896 | + echo '<table class="facts_table"><tr><td>', I18N::translate('Location not removed: this location contains sub-locations'), '</td></tr></table>'; |
|
3897 | + } |
|
3898 | + } |
|
3899 | + |
|
3900 | + ?> |
|
3901 | 3901 | <script> |
3902 | 3902 | function updateList(inactive) { |
3903 | 3903 | window.location.href='<?php if (strstr(Filter::server('REQUEST_URI'), '&inactive', true)) { $uri = strstr(Filter::server('REQUEST_URI'), '&inactive', true); } else { $uri = Filter::server('REQUEST_URI'); } echo $uri, '&inactive=' ?>'+inactive; |
@@ -3922,25 +3922,25 @@ discard block |
||
3922 | 3922 | </script> |
3923 | 3923 | <p id="gm_breadcrumb"> |
3924 | 3924 | <?php |
3925 | - $where_am_i = $this->placeIdToHierarchy($parent); |
|
3926 | - foreach (array_reverse($where_am_i, true) as $id => $place) { |
|
3927 | - if ($id == $parent) { |
|
3928 | - if ($place != 'Unknown') { |
|
3929 | - echo Filter::escapeHtml($place); |
|
3930 | - } else { |
|
3931 | - echo I18N::translate('unknown'); |
|
3932 | - } |
|
3933 | - } else { |
|
3934 | - echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $id, '&inactive=', $inactive, '">'; |
|
3935 | - if ($place != 'Unknown') { |
|
3936 | - echo Filter::escapeHtml($place), '</a>'; |
|
3937 | - } else { |
|
3938 | - echo I18N::translate('unknown'), '</a>'; |
|
3939 | - } |
|
3940 | - } |
|
3941 | - echo ' - '; |
|
3942 | - } |
|
3943 | - ?> |
|
3925 | + $where_am_i = $this->placeIdToHierarchy($parent); |
|
3926 | + foreach (array_reverse($where_am_i, true) as $id => $place) { |
|
3927 | + if ($id == $parent) { |
|
3928 | + if ($place != 'Unknown') { |
|
3929 | + echo Filter::escapeHtml($place); |
|
3930 | + } else { |
|
3931 | + echo I18N::translate('unknown'); |
|
3932 | + } |
|
3933 | + } else { |
|
3934 | + echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $id, '&inactive=', $inactive, '">'; |
|
3935 | + if ($place != 'Unknown') { |
|
3936 | + echo Filter::escapeHtml($place), '</a>'; |
|
3937 | + } else { |
|
3938 | + echo I18N::translate('unknown'), '</a>'; |
|
3939 | + } |
|
3940 | + } |
|
3941 | + echo ' - '; |
|
3942 | + } |
|
3943 | + ?> |
|
3944 | 3944 | <a href="module.php?mod=googlemap&mod_action=admin_places&parent=0&inactive=', $inactive, '"><?php echo I18N::translate('Top level') ?></a> |
3945 | 3945 | </p> |
3946 | 3946 | |
@@ -3958,54 +3958,54 @@ discard block |
||
3958 | 3958 | </form> |
3959 | 3959 | |
3960 | 3960 | <?php |
3961 | - $placelist = $this->getPlaceListLocation($parent, $inactive); |
|
3962 | - echo '<div class="gm_plac_edit">'; |
|
3963 | - echo '<table class="table table-bordered table-condensed table-hover"><tr>'; |
|
3964 | - echo '<th>', GedcomTag::getLabel('PLAC'), '</th>'; |
|
3965 | - echo '<th>', GedcomTag::getLabel('LATI'), '</th>'; |
|
3966 | - echo '<th>', GedcomTag::getLabel('LONG'), '</th>'; |
|
3967 | - echo '<th>', I18N::translate('Zoom level'), '</th>'; |
|
3968 | - echo '<th>', I18N::translate('Icon'), '</th>'; |
|
3969 | - echo '<th>'; |
|
3970 | - echo I18N::translate('Edit'), '</th><th>', I18N::translate('Delete'), '</th></tr>'; |
|
3971 | - if (count($placelist) == 0) { |
|
3972 | - echo '<tr><td colspan="7">', I18N::translate('No places found'), '</td></tr>'; |
|
3973 | - } |
|
3974 | - foreach ($placelist as $place) { |
|
3975 | - echo '<tr><td><a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $place['place_id'], '&inactive=', $inactive, '">'; |
|
3976 | - if ($place['place'] != 'Unknown') { |
|
3977 | - echo Filter::escapeHtml($place['place']), '</a></td>'; |
|
3978 | - } else { |
|
3979 | - echo I18N::translate('unknown'), '</a></td>'; |
|
3980 | - } |
|
3981 | - echo '<td>', $place['lati'], '</td>'; |
|
3982 | - echo '<td>', $place['long'], '</td>'; |
|
3983 | - echo '<td>', $place['zoom'], '</td>'; |
|
3984 | - echo '<td>'; |
|
3985 | - if ($place['icon']) { |
|
3986 | - echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place['icon'], '" width="25" height="15">'; |
|
3987 | - } else { |
|
3988 | - if ($place['lati'] || $place['long']) { |
|
3989 | - echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_red.png">'; |
|
3990 | - } else { |
|
3991 | - echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_yellow.png">'; |
|
3992 | - } |
|
3993 | - } |
|
3994 | - echo '</td>'; |
|
3995 | - echo '<td class="narrow"><a href="#" onclick="edit_place_location(', $place['place_id'], ');return false;" class="icon-edit" title="', I18N::translate('Edit'), '"></a></td>'; |
|
3996 | - $noRows = |
|
3997 | - Database::prepare("SELECT COUNT(pl_id) FROM `##placelocation` WHERE pl_parent_id=?") |
|
3998 | - ->execute(array($place['place_id'])) |
|
3999 | - ->fetchOne(); |
|
4000 | - if ($noRows == 0) { ?> |
|
3961 | + $placelist = $this->getPlaceListLocation($parent, $inactive); |
|
3962 | + echo '<div class="gm_plac_edit">'; |
|
3963 | + echo '<table class="table table-bordered table-condensed table-hover"><tr>'; |
|
3964 | + echo '<th>', GedcomTag::getLabel('PLAC'), '</th>'; |
|
3965 | + echo '<th>', GedcomTag::getLabel('LATI'), '</th>'; |
|
3966 | + echo '<th>', GedcomTag::getLabel('LONG'), '</th>'; |
|
3967 | + echo '<th>', I18N::translate('Zoom level'), '</th>'; |
|
3968 | + echo '<th>', I18N::translate('Icon'), '</th>'; |
|
3969 | + echo '<th>'; |
|
3970 | + echo I18N::translate('Edit'), '</th><th>', I18N::translate('Delete'), '</th></tr>'; |
|
3971 | + if (count($placelist) == 0) { |
|
3972 | + echo '<tr><td colspan="7">', I18N::translate('No places found'), '</td></tr>'; |
|
3973 | + } |
|
3974 | + foreach ($placelist as $place) { |
|
3975 | + echo '<tr><td><a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $place['place_id'], '&inactive=', $inactive, '">'; |
|
3976 | + if ($place['place'] != 'Unknown') { |
|
3977 | + echo Filter::escapeHtml($place['place']), '</a></td>'; |
|
3978 | + } else { |
|
3979 | + echo I18N::translate('unknown'), '</a></td>'; |
|
3980 | + } |
|
3981 | + echo '<td>', $place['lati'], '</td>'; |
|
3982 | + echo '<td>', $place['long'], '</td>'; |
|
3983 | + echo '<td>', $place['zoom'], '</td>'; |
|
3984 | + echo '<td>'; |
|
3985 | + if ($place['icon']) { |
|
3986 | + echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place['icon'], '" width="25" height="15">'; |
|
3987 | + } else { |
|
3988 | + if ($place['lati'] || $place['long']) { |
|
3989 | + echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_red.png">'; |
|
3990 | + } else { |
|
3991 | + echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_yellow.png">'; |
|
3992 | + } |
|
3993 | + } |
|
3994 | + echo '</td>'; |
|
3995 | + echo '<td class="narrow"><a href="#" onclick="edit_place_location(', $place['place_id'], ');return false;" class="icon-edit" title="', I18N::translate('Edit'), '"></a></td>'; |
|
3996 | + $noRows = |
|
3997 | + Database::prepare("SELECT COUNT(pl_id) FROM `##placelocation` WHERE pl_parent_id=?") |
|
3998 | + ->execute(array($place['place_id'])) |
|
3999 | + ->fetchOne(); |
|
4000 | + if ($noRows == 0) { ?> |
|
4001 | 4001 | <td><a href="#" onclick="delete_place(<?php echo $place['place_id'] ?>);return false;" class="icon-delete" title="<?php echo I18N::translate('Delete') ?>"></a></td> |
4002 | 4002 | <?php } else { ?> |
4003 | 4003 | <td><i class="icon-delete-grey"></i></td> |
4004 | 4004 | <?php } ?> |
4005 | 4005 | </tr> |
4006 | 4006 | <?php |
4007 | - } |
|
4008 | - ?> |
|
4007 | + } |
|
4008 | + ?> |
|
4009 | 4009 | </table> |
4010 | 4010 | </div> |
4011 | 4011 | |
@@ -4086,15 +4086,15 @@ discard block |
||
4086 | 4086 | </div> |
4087 | 4087 | </form> |
4088 | 4088 | <?php |
4089 | - } |
|
4089 | + } |
|
4090 | 4090 | |
4091 | - /** |
|
4092 | - * Generate the streetview window. |
|
4093 | - */ |
|
4094 | - private function wtStreetView() { |
|
4095 | - header('Content-type: text/html; charset=UTF-8'); |
|
4091 | + /** |
|
4092 | + * Generate the streetview window. |
|
4093 | + */ |
|
4094 | + private function wtStreetView() { |
|
4095 | + header('Content-type: text/html; charset=UTF-8'); |
|
4096 | 4096 | |
4097 | - ?> |
|
4097 | + ?> |
|
4098 | 4098 | <html> |
4099 | 4099 | <head> |
4100 | 4100 | <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> |
@@ -4355,5 +4355,5 @@ discard block |
||
4355 | 4355 | </body> |
4356 | 4356 | </html> |
4357 | 4357 | <?php |
4358 | - } |
|
4358 | + } |
|
4359 | 4359 | } |
@@ -87,30 +87,30 @@ discard block |
||
87 | 87 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
88 | 88 | |
89 | 89 | switch ($mod_action) { |
90 | - case 'admin_config': |
|
91 | - $this->config(); |
|
92 | - break; |
|
93 | - case 'flags': |
|
94 | - $this->flags(); |
|
95 | - break; |
|
96 | - case 'pedigree_map': |
|
97 | - $this->pedigreeMap(); |
|
98 | - break; |
|
99 | - case 'admin_placecheck': |
|
100 | - $this->adminPlaceCheck(); |
|
101 | - break; |
|
102 | - case 'admin_places': |
|
103 | - $this->adminPlaces(); |
|
104 | - break; |
|
105 | - case 'places_edit': |
|
106 | - $this->placesEdit(); |
|
107 | - break; |
|
108 | - case 'wt_street_view': |
|
109 | - $this->wtStreetView(); |
|
110 | - break; |
|
111 | - default: |
|
112 | - http_response_code(404); |
|
113 | - break; |
|
90 | + case 'admin_config': |
|
91 | + $this->config(); |
|
92 | + break; |
|
93 | + case 'flags': |
|
94 | + $this->flags(); |
|
95 | + break; |
|
96 | + case 'pedigree_map': |
|
97 | + $this->pedigreeMap(); |
|
98 | + break; |
|
99 | + case 'admin_placecheck': |
|
100 | + $this->adminPlaceCheck(); |
|
101 | + break; |
|
102 | + case 'admin_places': |
|
103 | + $this->adminPlaces(); |
|
104 | + break; |
|
105 | + case 'places_edit': |
|
106 | + $this->placesEdit(); |
|
107 | + break; |
|
108 | + case 'wt_street_view': |
|
109 | + $this->wtStreetView(); |
|
110 | + break; |
|
111 | + default: |
|
112 | + http_response_code(404); |
|
113 | + break; |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
@@ -1186,24 +1186,24 @@ discard block |
||
1186 | 1186 | if ($latlongval[$i] == $latlongval[$k]) { |
1187 | 1187 | $dups++; |
1188 | 1188 | switch ($dups) { |
1189 | - case 1: |
|
1190 | - $marker_number = $curgen . 'L'; |
|
1191 | - break; |
|
1192 | - case 2: |
|
1193 | - $marker_number = $curgen . 'R'; |
|
1194 | - break; |
|
1195 | - case 3: |
|
1196 | - $marker_number = $curgen . 'Ls'; |
|
1197 | - break; |
|
1198 | - case 4: |
|
1199 | - $marker_number = $curgen . 'Rs'; |
|
1200 | - break; |
|
1201 | - case 5: //adjust position where markers have same coodinates |
|
1202 | - default: |
|
1203 | - $marker_number = $curgen; |
|
1204 | - $lon[$i] += 0.0025; |
|
1205 | - $lat[$i] += 0.0025; |
|
1206 | - break; |
|
1189 | + case 1: |
|
1190 | + $marker_number = $curgen . 'L'; |
|
1191 | + break; |
|
1192 | + case 2: |
|
1193 | + $marker_number = $curgen . 'R'; |
|
1194 | + break; |
|
1195 | + case 3: |
|
1196 | + $marker_number = $curgen . 'Ls'; |
|
1197 | + break; |
|
1198 | + case 4: |
|
1199 | + $marker_number = $curgen . 'Rs'; |
|
1200 | + break; |
|
1201 | + case 5: //adjust position where markers have same coodinates |
|
1202 | + default: |
|
1203 | + $marker_number = $curgen; |
|
1204 | + $lon[$i] += 0.0025; |
|
1205 | + $lat[$i] += 0.0025; |
|
1206 | + break; |
|
1207 | 1207 | } |
1208 | 1208 | } |
1209 | 1209 | } |
@@ -3055,22 +3055,22 @@ discard block |
||
3055 | 3055 | <?php |
3056 | 3056 | $coordsAsStr = array(); |
3057 | 3057 | switch (strtoupper($place_name)) { |
3058 | - case 'ENGLAND': |
|
3059 | - $coordsAsStr[] = '-4.74361,50.66750|-4.78361,50.59361|-4.91584,50.57722|-5.01750,50.54264|-5.02569,50.47271|-5.04729,50.42750|-5.15208,50.34374|-5.26805,50.27389|-5.43194,50.19326|-5.49584,50.21695|-5.54639,50.20527|-5.71000,50.12916|-5.71681,50.06083|-5.66174,50.03631|-5.58278,50.04777|-5.54166,50.07055|-5.53416,50.11569|-5.47055,50.12499|-5.33361,50.09138|-5.27666,50.05972|-5.25674,50.00514|-5.19306,49.95527|-5.16070,50.00319|-5.06555,50.03750|-5.07090,50.08166|-5.04806,50.17111|-4.95278,50.19333|-4.85750,50.23166|-4.76250,50.31138|-4.67861,50.32583|-4.54334,50.32222|-4.48278,50.32583|-4.42972,50.35139|-4.38000,50.36388|-4.16555,50.37028|-4.11139,50.33027|-4.05708,50.29791|-3.94389,50.31346|-3.87764,50.28139|-3.83653,50.22972|-3.78944,50.21222|-3.70666,50.20972|-3.65195,50.23111|-3.55139,50.43833|-3.49416,50.54639|-3.46181,50.58792|-3.41139,50.61610|-3.24416,50.67444|-3.17347,50.68833|-3.09445,50.69222|-2.97806,50.70638|-2.92750,50.73125|-2.88278,50.73111|-2.82305,50.72027|-2.77139,50.70861|-2.66195,50.67334|-2.56305,50.63222|-2.45861,50.57500|-2.44666,50.62639|-2.39097,50.64166|-2.19722,50.62611|-2.12195,50.60722|-2.05445,50.58569|-1.96437,50.59674|-1.95441,50.66536|-2.06681,50.71430|-1.93416,50.71277|-1.81639,50.72306|-1.68445,50.73888|-1.59278,50.72416|-1.33139,50.79138|-1.11695,50.80694|-1.15889,50.84083|-1.09445,50.84584|-0.92842,50.83966|-0.86584,50.79965|-0.90826,50.77396|-0.78187,50.72722|-0.74611,50.76583|-0.67528,50.78111|-0.57722,50.79527|-0.25500,50.82638|-0.19084,50.82583|-0.13805,50.81833|0.05695,50.78083|0.12334,50.75944|0.22778,50.73944|0.28695,50.76500|0.37195,50.81638|0.43084,50.83111|0.56722,50.84777|0.67889,50.87681|0.71639,50.90500|0.79334,50.93610|0.85666,50.92556|0.97125,50.98111|0.99778,51.01903|1.04555,51.04944|1.10028,51.07361|1.26250,51.10166|1.36889,51.13583|1.41111,51.20111|1.42750,51.33111|1.38556,51.38777|1.19195,51.37861|1.05278,51.36722|0.99916,51.34777|0.90806,51.34069|0.70416,51.37749|0.61972,51.38304|0.55945,51.40596|0.64236,51.44042|0.69750,51.47084|0.59195,51.48777|0.53611,51.48806|0.48916,51.48445|0.45215,51.45562|0.38894,51.44822|0.46500,51.50306|0.65195,51.53680|0.76695,51.52138|0.82084,51.53556|0.87528,51.56110|0.95250,51.60923|0.94695,51.72556|0.90257,51.73465|0.86306,51.71166|0.76140,51.69164|0.70111,51.71847|0.86211,51.77361|0.93236,51.80583|0.98278,51.82527|1.03569,51.77416|1.08834,51.77056|1.13222,51.77694|1.18139,51.78972|1.22361,51.80888|1.26611,51.83916|1.28097,51.88096|1.20834,51.95083|1.16347,52.02361|1.27750,51.98555|1.33125,51.92875|1.39028,51.96999|1.58736,52.08388|1.63000,52.19527|1.68576,52.32630|1.73028,52.41138|1.74945,52.45583|1.74590,52.62021|1.70250,52.71583|1.64528,52.77111|1.50361,52.83749|1.43222,52.87472|1.35250,52.90972|1.28222,52.92750|1.18389,52.93889|0.99472,52.95111|0.94222,52.95083|0.88472,52.96638|0.66722,52.97611|0.54778,52.96618|0.49139,52.93430|0.44431,52.86569|0.42903,52.82403|0.36334,52.78027|0.21778,52.80694|0.16125,52.86250|0.05778,52.88916|0.00211,52.87985|0.03222,52.91722|0.20389,53.02805|0.27666,53.06694|0.33916,53.09236|0.35389,53.18722|0.33958,53.23472|0.23555,53.39944|0.14347,53.47527|0.08528,53.48638|0.02694,53.50972|-0.10084,53.57306|-0.20722,53.63083|-0.26445,53.69083|-0.30166,53.71319|-0.39022,53.70794|-0.51972,53.68527|-0.71653,53.69638|-0.65445,53.72527|-0.60584,53.72972|-0.54916,53.70611|-0.42261,53.71755|-0.35728,53.73056|-0.29389,53.73666|-0.23139,53.72166|-0.10584,53.63166|-0.03472,53.62555|0.04416,53.63916|0.08916,53.62666|0.14945,53.58847|0.12639,53.64527|0.06264,53.70389|-0.12750,53.86388|-0.16916,53.91847|-0.21222,54.00833|-0.20569,54.05153|-0.16111,54.08806|-0.11694,54.13222|-0.20053,54.15171|-0.26250,54.17444|-0.39334,54.27277|-0.42166,54.33222|-0.45750,54.37694|-0.51847,54.44749|-0.56472,54.48000|-0.87584,54.57027|-1.06139,54.61722|-1.16528,54.64972|-1.30445,54.77138|-1.34556,54.87138|-1.41278,54.99944|-1.48292,55.08625|-1.51500,55.14972|-1.56584,55.28722|-1.58097,55.48361|-1.63597,55.58194|-1.69000,55.60556|-1.74695,55.62499|-1.81764,55.63306|-1.97681,55.75416|-2.02166,55.80611|-2.08361,55.78054|-2.22000,55.66499|-2.27916,55.64472|-2.27416,55.57527|-2.21528,55.50583|-2.18278,55.45985|-2.21236,55.42777|-2.46305,55.36111|-2.63055,55.25500|-2.69945,55.17722|-2.96278,55.03889|-3.01500,55.05222|-3.05103,54.97986|-3.13292,54.93139|-3.20861,54.94944|-3.28931,54.93792|-3.39166,54.87639|-3.42916,54.81555|-3.56916,54.64249|-3.61306,54.48861|-3.49305,54.40333|-3.43389,54.34806|-3.41056,54.28014|-3.38055,54.24444|-3.21472,54.09555|-3.15222,54.08194|-2.93097,54.15333|-2.81361,54.22277|-2.81750,54.14277|-2.83361,54.08500|-2.93250,53.95055|-3.05264,53.90764|-3.03708,53.74944|-2.99278,53.73277|-2.89979,53.72499|-2.97729,53.69382|-3.07306,53.59805|-3.10563,53.55993|-3.00678,53.41738|-2.95389,53.36027|-2.85736,53.32083|-2.70493,53.35062|-2.77639,53.29250|-2.89972,53.28916|-2.94250,53.31056|-3.02889,53.38191|-3.07248,53.40936|-3.16695,53.35708|-3.12611,53.32500|-3.08860,53.26001|-3.02000,53.24722|-2.95528,53.21555|-2.91069,53.17014|-2.89389,53.10416|-2.85695,53.03249|-2.77792,52.98514|-2.73109,52.96873|-2.71945,52.91902|-2.79278,52.90207|-2.85069,52.93875|-2.99389,52.95361|-3.08639,52.91611|-3.13014,52.88486|-3.13708,52.79312|-3.06806,52.77027|-3.01111,52.71166|-3.06666,52.63527|-3.11750,52.58666|-3.07089,52.55702|-3.00792,52.56902|-2.98028,52.53083|-3.02736,52.49792|-3.11916,52.49194|-3.19514,52.46722|-3.19611,52.41027|-3.02195,52.34027|-2.95486,52.33117|-2.99750,52.28139|-3.05125,52.23347|-3.07555,52.14804|-3.12222,52.11805|-3.11250,52.06945|-3.08500,52.01930|-3.04528,51.97639|-2.98889,51.92555|-2.91757,51.91569|-2.86639,51.92889|-2.77861,51.88583|-2.65944,51.81806|-2.68334,51.76957|-2.68666,51.71889|-2.66500,51.61500|-2.62916,51.64416|-2.57889,51.67777|-2.46056,51.74666|-2.40389,51.74041|-2.47166,51.72445|-2.55305,51.65722|-2.65334,51.56389|-2.77055,51.48916|-2.85278,51.44472|-2.96000,51.37499|-3.00695,51.30722|-3.01278,51.25632|-3.02834,51.20611|-3.30139,51.18111|-3.39361,51.18138|-3.43729,51.20638|-3.50722,51.22333|-3.57014,51.23027|-3.63222,51.21805|-3.70028,51.23000|-3.79250,51.23916|-3.88389,51.22416|-3.98472,51.21695|-4.11666,51.21222|-4.22805,51.18777|-4.22028,51.11054|-4.23702,51.04659|-4.30361,51.00416|-4.37639,50.99110|-4.42736,51.00958|-4.47445,51.01416|-4.52132,51.01424|-4.54334,50.92694|-4.56139,50.77625|-4.65139,50.71527|-4.74361,50.66750'; |
|
3060 | - break; |
|
3061 | - case 'SCOTLAND': |
|
3062 | - $coordsAsStr[] = '-2.02166,55.80611|-2.07972,55.86722|-2.13028,55.88583|-2.26028,55.91861|-2.37528,55.95694|-2.65722,56.05972|-2.82028,56.05694|-2.86618,56.02840|-2.89555,55.98861|-2.93500,55.96944|-3.01805,55.94944|-3.06750,55.94444|-3.25472,55.97166|-3.45472,55.99194|-3.66416,56.00652|-3.73722,56.05555|-3.57139,56.05360|-3.44111,56.01916|-3.39584,56.01083|-3.34403,56.02333|-3.13903,56.11084|-2.97611,56.19472|-2.91666,56.20499|-2.84695,56.18638|-2.78805,56.18749|-2.67937,56.21465|-2.58403,56.28264|-2.67208,56.32277|-2.76861,56.33180|-2.81528,56.37360|-2.81208,56.43958|-2.91653,56.45014|-2.99555,56.41416|-3.19042,56.35958|-3.27805,56.35750|-3.04055,56.45472|-2.95861,56.45611|-2.72084,56.48888|-2.64084,56.52250|-2.53126,56.57611|-2.48861,56.61416|-2.47805,56.71527|-2.39000,56.77166|-2.31986,56.79638|-2.21972,56.86777|-2.19708,56.94388|-2.16695,57.00055|-2.09334,57.07027|-2.05416,57.21861|-1.95889,57.33250|-1.85584,57.39889|-1.77334,57.45805|-1.78139,57.50555|-1.82195,57.57861|-1.86000,57.62138|-1.92972,57.67777|-2.02222,57.69388|-2.07555,57.69944|-2.14028,57.69056|-2.18611,57.66861|-2.39626,57.66638|-2.51000,57.67166|-2.78639,57.70222|-2.89806,57.70694|-2.96750,57.68027|-3.03847,57.66249|-3.12334,57.67166|-3.22334,57.69166|-3.28625,57.72499|-3.33972,57.72333|-3.48805,57.70945|-3.52222,57.66333|-3.59542,57.63666|-3.64063,57.63881|-3.75414,57.62504|-4.03986,57.55569|-4.19666,57.48584|-4.22889,57.51554|-4.17945,57.56249|-4.11139,57.59833|-4.08078,57.66533|-4.19139,57.67139|-4.25945,57.65527|-4.34361,57.60777|-4.41639,57.60166|-4.29666,57.67444|-4.08528,57.72611|-4.01908,57.70226|-3.96861,57.70250|-3.86556,57.76861|-3.81945,57.80458|-3.80681,57.85819|-3.85055,57.82000|-3.92639,57.80749|-4.04322,57.81438|-4.14973,57.82527|-4.29750,57.84638|-4.36250,57.89777|-4.24306,57.87028|-4.10666,57.85195|-4.01500,57.86777|-3.99166,57.90611|-3.99695,57.95056|-3.84500,58.02000|-3.56611,58.13916|-3.51319,58.16374|-3.45916,58.20305|-3.42028,58.24361|-3.33750,58.27694|-3.20555,58.30625|-3.10972,58.38166|-3.05792,58.45083|-3.02264,58.64653|-3.17639,58.64944|-3.35389,58.66055|-3.36931,58.59555|-3.57611,58.62194|-3.66028,58.61972|-3.71166,58.60374|-3.78264,58.56750|-3.84834,58.56000|-4.08056,58.55527|-4.27722,58.53361|-4.43653,58.54902|-4.50666,58.56777|-4.56055,58.57584|-4.59910,58.53027|-4.66805,58.48833|-4.76146,58.44604|-4.70195,58.50999|-4.70166,58.55861|-4.77014,58.60264|-5.00153,58.62416|-5.10945,58.50833|-5.16472,58.32527|-5.12639,58.28750|-5.07166,58.26472|-5.20361,58.25083|-5.39764,58.25055|-5.27389,58.11722|-5.31514,58.06416|-5.38416,58.08361|-5.45285,58.07416|-5.39805,58.03111|-5.26278,57.97111|-5.19334,57.95069|-5.12750,57.86944|-5.21750,57.90084|-5.33861,57.92083|-5.42876,57.90104|-5.45750,57.85889|-5.64445,57.89972|-5.62555,57.85222|-5.58153,57.81945|-5.60674,57.76618|-5.66305,57.78889|-5.71695,57.86944|-5.76695,57.86472|-5.81708,57.81944|-5.81084,57.63958|-5.69555,57.55944|-5.64361,57.55222|-5.53084,57.52833|-5.65305,57.50875|-5.75000,57.54834|-5.81569,57.57923|-5.85042,57.54972|-5.86695,57.46777|-5.81806,57.36250|-5.75111,57.34333|-5.50334,57.40111|-5.45126,57.41805|-5.49250,57.37083|-5.59884,57.33049|-5.57116,57.28411|-5.51266,57.27745|-5.40514,57.23097|-5.44972,57.22138|-5.49472,57.23888|-5.56066,57.25477|-5.64611,57.23499|-5.64751,57.16161|-5.55028,57.11639|-5.48166,57.11222|-5.40305,57.11062|-5.55945,57.09250|-5.65111,57.11611|-5.72472,57.11306|-5.77361,57.04556|-5.63139,56.98499|-5.56916,56.98972|-5.52403,56.99735|-5.57916,56.98000|-5.64611,56.97222|-5.73374,57.00909|-5.82584,57.00346|-5.91958,56.88708|-5.86528,56.87944|-5.74278,56.89374|-5.66292,56.86924|-5.73306,56.83916|-5.78584,56.83955|-5.85590,56.81430|-5.80208,56.79180|-5.84958,56.74444|-5.90500,56.75666|-5.96694,56.78027|-6.14000,56.75777|-6.19208,56.74888|-6.23452,56.71673|-6.19139,56.67972|-5.91916,56.67388|-5.82622,56.69156|-5.73945,56.71166|-5.55240,56.68886|-5.64861,56.68027|-5.69916,56.68278|-5.88261,56.65666|-5.97472,56.65138|-5.99584,56.61138|-5.93056,56.56972|-5.88416,56.55333|-5.79056,56.53805|-5.67695,56.49389|-5.56389,56.54056|-5.36334,56.66195|-5.23416,56.74333|-5.13236,56.79403|-5.31473,56.65666|-5.37405,56.55925|-5.31826,56.55633|-5.25080,56.55753|-5.37718,56.52112|-5.39866,56.47866|-5.19111,56.46194|-5.11556,56.51277|-5.07014,56.56069|-5.13555,56.48499|-5.22084,56.43583|-5.32764,56.43574|-5.42439,56.43091|-5.52611,56.37360|-5.57139,56.32833|-5.59653,56.25695|-5.57389,56.16000|-5.52000,56.16485|-5.56334,56.11333|-5.60139,56.07638|-5.64222,56.04305|-5.66039,55.98263|-5.62555,56.02055|-5.58014,56.01319|-5.63361,55.96611|-5.67697,55.88844|-5.64750,55.78139|-5.60986,55.75930|-5.66916,55.66166|-5.70166,55.58861|-5.71805,55.51500|-5.75916,55.41750|-5.79528,55.36027|-5.78166,55.29902|-5.73778,55.29222|-5.56694,55.31666|-5.51528,55.36347|-5.55520,55.41440|-5.48639,55.64306|-5.44597,55.70680|-5.38000,55.75027|-5.41889,55.90666|-5.39924,55.99972|-5.33895,56.03456|-5.30594,56.06922|-5.23889,56.11889|-5.03222,56.23250|-4.92229,56.27111|-4.97416,56.23333|-5.07222,56.18695|-5.20069,56.11861|-5.30906,56.00570|-5.34000,55.90201|-5.29250,55.84750|-5.20805,55.84444|-5.22458,55.90175|-5.17334,55.92916|-5.11000,55.90306|-5.01222,55.86694|-4.96195,55.88000|-4.89824,55.98145|-4.84623,56.08632|-4.86636,56.03178|-4.85461,55.98648|-4.77659,55.97977|-4.62723,55.94555|-4.52305,55.91861|-4.70972,55.93403|-4.75166,55.94611|-4.82406,55.94950|-4.87826,55.93653|-4.91639,55.70083|-4.87584,55.68194|-4.81361,55.64555|-4.68722,55.59750|-4.61361,55.49069|-4.63958,55.44264|-4.68250,55.43388|-4.74847,55.41055|-4.83715,55.31882|-4.84778,55.26944|-4.86542,55.22340|-4.93500,55.17860|-5.01250,55.13347|-5.05361,55.04902|-5.17834,54.98888|-5.18563,54.93622|-5.17000,54.89111|-5.11666,54.83180|-5.00500,54.76333|-4.96229,54.68125|-4.92250,54.64055|-4.85723,54.62958|-4.96076,54.79687|-4.92431,54.83708|-4.85222,54.86861|-4.80125,54.85556|-4.74055,54.82166|-4.68084,54.79972|-4.59861,54.78027|-4.55792,54.73903|-4.49639,54.69888|-4.37584,54.67666|-4.34569,54.70916|-4.35973,54.77111|-4.41111,54.82583|-4.42445,54.88152|-4.38479,54.90555|-4.35056,54.85903|-4.09555,54.76777|-3.95361,54.76749|-3.86972,54.80527|-3.81222,54.84888|-3.69250,54.88110|-3.61584,54.87527|-3.57111,54.99083|-3.44528,54.98638|-3.36056,54.97138|-3.14695,54.96500|-3.05103,54.97986|-3.01500,55.05222|-2.96278,55.03889|-2.69945,55.17722|-2.63055,55.25500|-2.46305,55.36111|-2.21236,55.42777|-2.18278,55.45985|-2.21528,55.50583|-2.27416,55.57527|-2.27916,55.64472|-2.22000,55.66499|-2.08361,55.78054|-2.02166,55.80611'; |
|
3063 | - break; |
|
3064 | - case 'IRELAND': |
|
3065 | - $coordsAsStr[] = '-8.17166,54.46388|-8.06555,54.37277|-7.94139,54.29944|-7.87576,54.28499|-7.86834,54.22764|-7.81805,54.19916|-7.69972,54.20250|-7.55945,54.12694|-7.31334,54.11250|-7.14584,54.22527|-7.17555,54.28916|-7.16084,54.33666|-7.05834,54.41000|-6.97445,54.40166|-6.92695,54.37916|-6.87305,54.34208|-6.85111,54.28972|-6.73473,54.18361|-6.65556,54.06527|-6.60584,54.04444|-6.44750,54.05833|-6.33889,54.11555|-6.26697,54.09983|-6.17403,54.07222|-6.10834,54.03638|-6.04389,54.03139|-5.96834,54.06389|-5.88500,54.11639|-5.87347,54.20916|-5.82500,54.23958|-5.74611,54.24806|-5.65556,54.22701|-5.60834,54.24972|-5.55916,54.29084|-5.57334,54.37704|-5.64502,54.49267|-5.70472,54.53361|-5.68055,54.57306|-5.59972,54.54194|-5.55097,54.50083|-5.54216,54.44903|-5.54643,54.40527|-5.50672,54.36444|-5.46111,54.38555|-5.43132,54.48596|-5.47945,54.53638|-5.53521,54.65090|-5.57431,54.67722|-5.62916,54.67945|-5.73674,54.67383|-5.80305,54.66138|-5.88257,54.60652|-5.92445,54.63180|-5.86681,54.68972|-5.81903,54.70972|-5.74672,54.72452|-5.68775,54.76335|-5.70931,54.83166|-5.74694,54.85361|-5.79139,54.85139|-6.03611,55.05778|-6.04250,55.10277|-6.03444,55.15458|-6.10125,55.20945|-6.14584,55.22069|-6.25500,55.21194|-6.37639,55.23916|-6.51556,55.23305|-6.61334,55.20722|-6.73028,55.18027|-6.82472,55.16806|-6.88972,55.16777|-6.96695,55.15611|-6.99416,55.11027|-7.05139,55.04680|-7.09500,55.03694|-7.25251,55.07059|-7.32639,55.04527|-7.40639,54.95333|-7.45805,54.85777|-7.55334,54.76277|-7.73916,54.71054|-7.82576,54.73416|-7.92639,54.70054|-7.85236,54.63388|-7.77750,54.62694|-7.83361,54.55389|-7.95084,54.53222|-8.04695,54.50722|-8.17166,54.46388'; |
|
3066 | - break; |
|
3067 | - case 'WALES': |
|
3068 | - $coordsAsStr[] = '-3.08860,53.26001|-3.33639,53.34722|-3.38806,53.34361|-3.60986,53.27944|-3.73014,53.28944|-3.85445,53.28444|-4.01861,53.23750|-4.06639,53.22639|-4.15334,53.22556|-4.19639,53.20611|-4.33028,53.11222|-4.36097,53.02888|-4.55278,52.92889|-4.61889,52.90916|-4.72195,52.83611|-4.72778,52.78139|-4.53945,52.79306|-4.47722,52.85500|-4.41416,52.88472|-4.31292,52.90499|-4.23334,52.91499|-4.13569,52.87888|-4.13056,52.77777|-4.05334,52.71666|-4.10639,52.65084|-4.12597,52.60375|-4.08056,52.55333|-4.05972,52.48584|-4.09666,52.38583|-4.14305,52.32027|-4.19361,52.27638|-4.23166,52.24888|-4.52722,52.13083|-4.66945,52.13027|-4.73695,52.10361|-4.76778,52.06444|-4.84445,52.01388|-5.09945,51.96056|-5.23916,51.91638|-5.25889,51.87056|-5.18500,51.86958|-5.11528,51.83333|-5.10257,51.77895|-5.16111,51.76222|-5.24694,51.73027|-5.19111,51.70888|-5.00739,51.70349|-4.90875,51.71249|-4.86111,51.71334|-4.97061,51.67577|-5.02128,51.66861|-5.05139,51.62028|-5.00528,51.60638|-4.94139,51.59416|-4.89028,51.62694|-4.83569,51.64534|-4.79063,51.63340|-4.69028,51.66666|-4.64584,51.72666|-4.57445,51.73416|-4.43611,51.73722|-4.26222,51.67694|-4.19750,51.67916|-4.06614,51.66804|-4.11639,51.63416|-4.17750,51.62235|-4.25055,51.62861|-4.29208,51.60743|-4.27778,51.55666|-4.20486,51.53527|-3.94972,51.61278|-3.83792,51.61999|-3.78166,51.56750|-3.75160,51.52931|-3.67194,51.47388|-3.54250,51.39777|-3.40334,51.37972|-3.27097,51.38014|-3.16458,51.40909|-3.15166,51.45305|-3.11875,51.48750|-3.02111,51.52527|-2.95472,51.53972|-2.89278,51.53861|-2.84778,51.54500|-2.71472,51.58083|-2.66500,51.61500|-2.68666,51.71889|-2.68334,51.76957|-2.65944,51.81806|-2.77861,51.88583|-2.86639,51.92889|-2.91757,51.91569|-2.98889,51.92555|-3.04528,51.97639|-3.08500,52.01930|-3.11250,52.06945|-3.12222,52.11805|-3.07555,52.14804|-3.05125,52.23347|-2.99750,52.28139|-2.95486,52.33117|-3.02195,52.34027|-3.19611,52.41027|-3.19514,52.46722|-3.11916,52.49194|-3.02736,52.49792|-2.98028,52.53083|-3.00792,52.56902|-3.07089,52.55702|-3.11750,52.58666|-3.06666,52.63527|-3.01111,52.71166|-3.06806,52.77027|-3.13708,52.79312|-3.13014,52.88486|-3.08639,52.91611|-2.99389,52.95361|-2.85069,52.93875|-2.79278,52.90207|-2.71945,52.91902|-2.73109,52.96873|-2.77792,52.98514|-2.85695,53.03249|-2.89389,53.10416|-2.91069,53.17014|-2.95528,53.21555|-3.02000,53.24722|-3.08860,53.26001'; |
|
3069 | - break; |
|
3070 | - case 'NC': |
|
3071 | - $coordsAsStr[] = '-81.65876,36.60938|-81.70390,36.55513|-81.70639,36.50804|-81.74665,36.39777|-81.90723,36.30804|-82.03195,36.12694|-82.08416,36.10146|-82.12826,36.11020|-82.21500,36.15833|-82.36375,36.11347|-82.43472,36.06013|-82.46236,36.01708|-82.56006,35.96263|-82.60042,35.99638|-82.62308,36.06121|-82.73500,36.01833|-82.84612,35.94944|-82.90451,35.88819|-82.93555,35.83846|-83.16000,35.76236|-83.24222,35.71944|-83.49222,35.57111|-83.56847,35.55861|-83.64416,35.56471|-83.73499,35.56638|-83.88222,35.51791|-83.98361,35.44944|-84.03639,35.35444|-84.04964,35.29117|-84.09042,35.25986|-84.15084,35.25388|-84.20521,35.25722|-84.29284,35.22596|-84.32471,34.98701|-83.09778,35.00027|-82.77722,35.09138|-82.59639,35.14972|-82.37999,35.21500|-82.27362,35.20583|-81.41306,35.17416|-81.05915,35.15333|-80.92666,35.10695|-80.78751,34.95610|-80.79334,34.82555|-79.66777,34.80694|-79.11555,34.34527|-78.57222,33.88166|-78.51806,33.87999|-78.43721,33.89804|-78.23735,33.91986|-78.15389,33.91471|-78.06974,33.89500|-78.02597,33.88936|-77.97611,33.94276|-77.95299,33.99243|-77.94499,34.06499|-77.92728,34.11756|-77.92250,33.99194|-77.92264,33.93715|-77.88215,34.06166|-77.86222,34.15083|-77.83501,34.19194|-77.75724,34.28527|-77.68222,34.36555|-77.63667,34.39805|-77.57363,34.43694|-77.45527,34.50403|-77.38173,34.51646|-77.37905,34.56294|-77.38572,34.61260|-77.40944,34.68916|-77.38847,34.73304|-77.33097,34.63992|-77.35024,34.60099|-77.30958,34.55972|-77.09424,34.67742|-76.75994,34.76659|-76.68325,34.79749|-76.66097,34.75781|-76.62611,34.71014|-76.50063,34.73617|-76.48138,34.77638|-76.38305,34.86423|-76.34326,34.88194|-76.27181,34.96263|-76.35125,35.02221|-76.32354,34.97429|-76.45319,34.93524|-76.43395,34.98782|-76.45356,35.06676|-76.52917,35.00444|-76.63382,34.98242|-76.69722,34.94887|-76.75306,34.90526|-76.81636,34.93944|-76.89000,34.95388|-76.93180,34.96957|-76.96501,34.99777|-77.06816,35.14978|-76.97639,35.06806|-76.86722,35.00000|-76.80531,34.98559|-76.72708,35.00152|-76.60402,35.07416|-76.56555,35.11486|-76.57305,35.16013|-76.66489,35.16694|-76.56361,35.23361|-76.48750,35.22582|-76.46889,35.27166|-76.50298,35.30791|-76.83251,35.39222|-77.02305,35.48694|-77.04958,35.52694|-76.91292,35.46166|-76.65250,35.41499|-76.61611,35.45888|-76.63195,35.52249|-76.58820,35.55104|-76.51556,35.53194|-76.56711,35.48494|-76.52251,35.40416|-76.46195,35.37221|-76.13319,35.35986|-76.04111,35.42416|-76.00223,35.46610|-75.97958,35.51666|-75.89362,35.57555|-75.83834,35.56694|-75.78944,35.57138|-75.74076,35.61846|-75.72084,35.69263|-75.72084,35.81451|-75.74917,35.87791|-75.78333,35.91972|-75.85083,35.97527|-75.94333,35.91777|-75.98944,35.88054|-75.98854,35.79110|-75.99388,35.71027|-76.02875,35.65409|-76.10320,35.66041|-76.13563,35.69239|-76.04475,35.68436|-76.04167,35.74916|-76.05305,35.79361|-76.05305,35.87375|-76.02653,35.96222|-76.07751,35.99319|-76.17472,35.99596|-76.27917,35.91915|-76.37986,35.95763|-76.42014,35.97874|-76.55375,35.93971|-76.66222,35.93305|-76.72952,35.93984|-76.73392,36.04760|-76.75384,36.09477|-76.76028,36.14513|-76.74610,36.22818|-76.70458,36.24673|-76.72764,36.16736|-76.71021,36.11752|-76.69117,36.07165|-76.65979,36.03312|-76.49527,36.00958|-76.37138,36.07694|-76.37084,36.14999|-76.21417,36.09471|-76.07591,36.17910|-76.18361,36.26915|-76.19965,36.31739|-76.13986,36.28805|-76.04274,36.21974|-76.00465,36.18110|-75.95287,36.19241|-75.97604,36.31138|-75.93895,36.28381|-75.85271,36.11069|-75.79315,36.07385|-75.79639,36.11804|-75.88333,36.29554|-75.94665,36.37194|-75.98694,36.41166|-76.03473,36.49666|-76.02899,36.55000|-78.44234,36.54986|-78.56594,36.55799|-80.27556,36.55110|-81.15361,36.56499|-81.38722,36.57695|-81.65876,36.60938'; |
|
3072 | - break; |
|
3073 | - default: |
|
3058 | + case 'ENGLAND': |
|
3059 | + $coordsAsStr[] = '-4.74361,50.66750|-4.78361,50.59361|-4.91584,50.57722|-5.01750,50.54264|-5.02569,50.47271|-5.04729,50.42750|-5.15208,50.34374|-5.26805,50.27389|-5.43194,50.19326|-5.49584,50.21695|-5.54639,50.20527|-5.71000,50.12916|-5.71681,50.06083|-5.66174,50.03631|-5.58278,50.04777|-5.54166,50.07055|-5.53416,50.11569|-5.47055,50.12499|-5.33361,50.09138|-5.27666,50.05972|-5.25674,50.00514|-5.19306,49.95527|-5.16070,50.00319|-5.06555,50.03750|-5.07090,50.08166|-5.04806,50.17111|-4.95278,50.19333|-4.85750,50.23166|-4.76250,50.31138|-4.67861,50.32583|-4.54334,50.32222|-4.48278,50.32583|-4.42972,50.35139|-4.38000,50.36388|-4.16555,50.37028|-4.11139,50.33027|-4.05708,50.29791|-3.94389,50.31346|-3.87764,50.28139|-3.83653,50.22972|-3.78944,50.21222|-3.70666,50.20972|-3.65195,50.23111|-3.55139,50.43833|-3.49416,50.54639|-3.46181,50.58792|-3.41139,50.61610|-3.24416,50.67444|-3.17347,50.68833|-3.09445,50.69222|-2.97806,50.70638|-2.92750,50.73125|-2.88278,50.73111|-2.82305,50.72027|-2.77139,50.70861|-2.66195,50.67334|-2.56305,50.63222|-2.45861,50.57500|-2.44666,50.62639|-2.39097,50.64166|-2.19722,50.62611|-2.12195,50.60722|-2.05445,50.58569|-1.96437,50.59674|-1.95441,50.66536|-2.06681,50.71430|-1.93416,50.71277|-1.81639,50.72306|-1.68445,50.73888|-1.59278,50.72416|-1.33139,50.79138|-1.11695,50.80694|-1.15889,50.84083|-1.09445,50.84584|-0.92842,50.83966|-0.86584,50.79965|-0.90826,50.77396|-0.78187,50.72722|-0.74611,50.76583|-0.67528,50.78111|-0.57722,50.79527|-0.25500,50.82638|-0.19084,50.82583|-0.13805,50.81833|0.05695,50.78083|0.12334,50.75944|0.22778,50.73944|0.28695,50.76500|0.37195,50.81638|0.43084,50.83111|0.56722,50.84777|0.67889,50.87681|0.71639,50.90500|0.79334,50.93610|0.85666,50.92556|0.97125,50.98111|0.99778,51.01903|1.04555,51.04944|1.10028,51.07361|1.26250,51.10166|1.36889,51.13583|1.41111,51.20111|1.42750,51.33111|1.38556,51.38777|1.19195,51.37861|1.05278,51.36722|0.99916,51.34777|0.90806,51.34069|0.70416,51.37749|0.61972,51.38304|0.55945,51.40596|0.64236,51.44042|0.69750,51.47084|0.59195,51.48777|0.53611,51.48806|0.48916,51.48445|0.45215,51.45562|0.38894,51.44822|0.46500,51.50306|0.65195,51.53680|0.76695,51.52138|0.82084,51.53556|0.87528,51.56110|0.95250,51.60923|0.94695,51.72556|0.90257,51.73465|0.86306,51.71166|0.76140,51.69164|0.70111,51.71847|0.86211,51.77361|0.93236,51.80583|0.98278,51.82527|1.03569,51.77416|1.08834,51.77056|1.13222,51.77694|1.18139,51.78972|1.22361,51.80888|1.26611,51.83916|1.28097,51.88096|1.20834,51.95083|1.16347,52.02361|1.27750,51.98555|1.33125,51.92875|1.39028,51.96999|1.58736,52.08388|1.63000,52.19527|1.68576,52.32630|1.73028,52.41138|1.74945,52.45583|1.74590,52.62021|1.70250,52.71583|1.64528,52.77111|1.50361,52.83749|1.43222,52.87472|1.35250,52.90972|1.28222,52.92750|1.18389,52.93889|0.99472,52.95111|0.94222,52.95083|0.88472,52.96638|0.66722,52.97611|0.54778,52.96618|0.49139,52.93430|0.44431,52.86569|0.42903,52.82403|0.36334,52.78027|0.21778,52.80694|0.16125,52.86250|0.05778,52.88916|0.00211,52.87985|0.03222,52.91722|0.20389,53.02805|0.27666,53.06694|0.33916,53.09236|0.35389,53.18722|0.33958,53.23472|0.23555,53.39944|0.14347,53.47527|0.08528,53.48638|0.02694,53.50972|-0.10084,53.57306|-0.20722,53.63083|-0.26445,53.69083|-0.30166,53.71319|-0.39022,53.70794|-0.51972,53.68527|-0.71653,53.69638|-0.65445,53.72527|-0.60584,53.72972|-0.54916,53.70611|-0.42261,53.71755|-0.35728,53.73056|-0.29389,53.73666|-0.23139,53.72166|-0.10584,53.63166|-0.03472,53.62555|0.04416,53.63916|0.08916,53.62666|0.14945,53.58847|0.12639,53.64527|0.06264,53.70389|-0.12750,53.86388|-0.16916,53.91847|-0.21222,54.00833|-0.20569,54.05153|-0.16111,54.08806|-0.11694,54.13222|-0.20053,54.15171|-0.26250,54.17444|-0.39334,54.27277|-0.42166,54.33222|-0.45750,54.37694|-0.51847,54.44749|-0.56472,54.48000|-0.87584,54.57027|-1.06139,54.61722|-1.16528,54.64972|-1.30445,54.77138|-1.34556,54.87138|-1.41278,54.99944|-1.48292,55.08625|-1.51500,55.14972|-1.56584,55.28722|-1.58097,55.48361|-1.63597,55.58194|-1.69000,55.60556|-1.74695,55.62499|-1.81764,55.63306|-1.97681,55.75416|-2.02166,55.80611|-2.08361,55.78054|-2.22000,55.66499|-2.27916,55.64472|-2.27416,55.57527|-2.21528,55.50583|-2.18278,55.45985|-2.21236,55.42777|-2.46305,55.36111|-2.63055,55.25500|-2.69945,55.17722|-2.96278,55.03889|-3.01500,55.05222|-3.05103,54.97986|-3.13292,54.93139|-3.20861,54.94944|-3.28931,54.93792|-3.39166,54.87639|-3.42916,54.81555|-3.56916,54.64249|-3.61306,54.48861|-3.49305,54.40333|-3.43389,54.34806|-3.41056,54.28014|-3.38055,54.24444|-3.21472,54.09555|-3.15222,54.08194|-2.93097,54.15333|-2.81361,54.22277|-2.81750,54.14277|-2.83361,54.08500|-2.93250,53.95055|-3.05264,53.90764|-3.03708,53.74944|-2.99278,53.73277|-2.89979,53.72499|-2.97729,53.69382|-3.07306,53.59805|-3.10563,53.55993|-3.00678,53.41738|-2.95389,53.36027|-2.85736,53.32083|-2.70493,53.35062|-2.77639,53.29250|-2.89972,53.28916|-2.94250,53.31056|-3.02889,53.38191|-3.07248,53.40936|-3.16695,53.35708|-3.12611,53.32500|-3.08860,53.26001|-3.02000,53.24722|-2.95528,53.21555|-2.91069,53.17014|-2.89389,53.10416|-2.85695,53.03249|-2.77792,52.98514|-2.73109,52.96873|-2.71945,52.91902|-2.79278,52.90207|-2.85069,52.93875|-2.99389,52.95361|-3.08639,52.91611|-3.13014,52.88486|-3.13708,52.79312|-3.06806,52.77027|-3.01111,52.71166|-3.06666,52.63527|-3.11750,52.58666|-3.07089,52.55702|-3.00792,52.56902|-2.98028,52.53083|-3.02736,52.49792|-3.11916,52.49194|-3.19514,52.46722|-3.19611,52.41027|-3.02195,52.34027|-2.95486,52.33117|-2.99750,52.28139|-3.05125,52.23347|-3.07555,52.14804|-3.12222,52.11805|-3.11250,52.06945|-3.08500,52.01930|-3.04528,51.97639|-2.98889,51.92555|-2.91757,51.91569|-2.86639,51.92889|-2.77861,51.88583|-2.65944,51.81806|-2.68334,51.76957|-2.68666,51.71889|-2.66500,51.61500|-2.62916,51.64416|-2.57889,51.67777|-2.46056,51.74666|-2.40389,51.74041|-2.47166,51.72445|-2.55305,51.65722|-2.65334,51.56389|-2.77055,51.48916|-2.85278,51.44472|-2.96000,51.37499|-3.00695,51.30722|-3.01278,51.25632|-3.02834,51.20611|-3.30139,51.18111|-3.39361,51.18138|-3.43729,51.20638|-3.50722,51.22333|-3.57014,51.23027|-3.63222,51.21805|-3.70028,51.23000|-3.79250,51.23916|-3.88389,51.22416|-3.98472,51.21695|-4.11666,51.21222|-4.22805,51.18777|-4.22028,51.11054|-4.23702,51.04659|-4.30361,51.00416|-4.37639,50.99110|-4.42736,51.00958|-4.47445,51.01416|-4.52132,51.01424|-4.54334,50.92694|-4.56139,50.77625|-4.65139,50.71527|-4.74361,50.66750'; |
|
3060 | + break; |
|
3061 | + case 'SCOTLAND': |
|
3062 | + $coordsAsStr[] = '-2.02166,55.80611|-2.07972,55.86722|-2.13028,55.88583|-2.26028,55.91861|-2.37528,55.95694|-2.65722,56.05972|-2.82028,56.05694|-2.86618,56.02840|-2.89555,55.98861|-2.93500,55.96944|-3.01805,55.94944|-3.06750,55.94444|-3.25472,55.97166|-3.45472,55.99194|-3.66416,56.00652|-3.73722,56.05555|-3.57139,56.05360|-3.44111,56.01916|-3.39584,56.01083|-3.34403,56.02333|-3.13903,56.11084|-2.97611,56.19472|-2.91666,56.20499|-2.84695,56.18638|-2.78805,56.18749|-2.67937,56.21465|-2.58403,56.28264|-2.67208,56.32277|-2.76861,56.33180|-2.81528,56.37360|-2.81208,56.43958|-2.91653,56.45014|-2.99555,56.41416|-3.19042,56.35958|-3.27805,56.35750|-3.04055,56.45472|-2.95861,56.45611|-2.72084,56.48888|-2.64084,56.52250|-2.53126,56.57611|-2.48861,56.61416|-2.47805,56.71527|-2.39000,56.77166|-2.31986,56.79638|-2.21972,56.86777|-2.19708,56.94388|-2.16695,57.00055|-2.09334,57.07027|-2.05416,57.21861|-1.95889,57.33250|-1.85584,57.39889|-1.77334,57.45805|-1.78139,57.50555|-1.82195,57.57861|-1.86000,57.62138|-1.92972,57.67777|-2.02222,57.69388|-2.07555,57.69944|-2.14028,57.69056|-2.18611,57.66861|-2.39626,57.66638|-2.51000,57.67166|-2.78639,57.70222|-2.89806,57.70694|-2.96750,57.68027|-3.03847,57.66249|-3.12334,57.67166|-3.22334,57.69166|-3.28625,57.72499|-3.33972,57.72333|-3.48805,57.70945|-3.52222,57.66333|-3.59542,57.63666|-3.64063,57.63881|-3.75414,57.62504|-4.03986,57.55569|-4.19666,57.48584|-4.22889,57.51554|-4.17945,57.56249|-4.11139,57.59833|-4.08078,57.66533|-4.19139,57.67139|-4.25945,57.65527|-4.34361,57.60777|-4.41639,57.60166|-4.29666,57.67444|-4.08528,57.72611|-4.01908,57.70226|-3.96861,57.70250|-3.86556,57.76861|-3.81945,57.80458|-3.80681,57.85819|-3.85055,57.82000|-3.92639,57.80749|-4.04322,57.81438|-4.14973,57.82527|-4.29750,57.84638|-4.36250,57.89777|-4.24306,57.87028|-4.10666,57.85195|-4.01500,57.86777|-3.99166,57.90611|-3.99695,57.95056|-3.84500,58.02000|-3.56611,58.13916|-3.51319,58.16374|-3.45916,58.20305|-3.42028,58.24361|-3.33750,58.27694|-3.20555,58.30625|-3.10972,58.38166|-3.05792,58.45083|-3.02264,58.64653|-3.17639,58.64944|-3.35389,58.66055|-3.36931,58.59555|-3.57611,58.62194|-3.66028,58.61972|-3.71166,58.60374|-3.78264,58.56750|-3.84834,58.56000|-4.08056,58.55527|-4.27722,58.53361|-4.43653,58.54902|-4.50666,58.56777|-4.56055,58.57584|-4.59910,58.53027|-4.66805,58.48833|-4.76146,58.44604|-4.70195,58.50999|-4.70166,58.55861|-4.77014,58.60264|-5.00153,58.62416|-5.10945,58.50833|-5.16472,58.32527|-5.12639,58.28750|-5.07166,58.26472|-5.20361,58.25083|-5.39764,58.25055|-5.27389,58.11722|-5.31514,58.06416|-5.38416,58.08361|-5.45285,58.07416|-5.39805,58.03111|-5.26278,57.97111|-5.19334,57.95069|-5.12750,57.86944|-5.21750,57.90084|-5.33861,57.92083|-5.42876,57.90104|-5.45750,57.85889|-5.64445,57.89972|-5.62555,57.85222|-5.58153,57.81945|-5.60674,57.76618|-5.66305,57.78889|-5.71695,57.86944|-5.76695,57.86472|-5.81708,57.81944|-5.81084,57.63958|-5.69555,57.55944|-5.64361,57.55222|-5.53084,57.52833|-5.65305,57.50875|-5.75000,57.54834|-5.81569,57.57923|-5.85042,57.54972|-5.86695,57.46777|-5.81806,57.36250|-5.75111,57.34333|-5.50334,57.40111|-5.45126,57.41805|-5.49250,57.37083|-5.59884,57.33049|-5.57116,57.28411|-5.51266,57.27745|-5.40514,57.23097|-5.44972,57.22138|-5.49472,57.23888|-5.56066,57.25477|-5.64611,57.23499|-5.64751,57.16161|-5.55028,57.11639|-5.48166,57.11222|-5.40305,57.11062|-5.55945,57.09250|-5.65111,57.11611|-5.72472,57.11306|-5.77361,57.04556|-5.63139,56.98499|-5.56916,56.98972|-5.52403,56.99735|-5.57916,56.98000|-5.64611,56.97222|-5.73374,57.00909|-5.82584,57.00346|-5.91958,56.88708|-5.86528,56.87944|-5.74278,56.89374|-5.66292,56.86924|-5.73306,56.83916|-5.78584,56.83955|-5.85590,56.81430|-5.80208,56.79180|-5.84958,56.74444|-5.90500,56.75666|-5.96694,56.78027|-6.14000,56.75777|-6.19208,56.74888|-6.23452,56.71673|-6.19139,56.67972|-5.91916,56.67388|-5.82622,56.69156|-5.73945,56.71166|-5.55240,56.68886|-5.64861,56.68027|-5.69916,56.68278|-5.88261,56.65666|-5.97472,56.65138|-5.99584,56.61138|-5.93056,56.56972|-5.88416,56.55333|-5.79056,56.53805|-5.67695,56.49389|-5.56389,56.54056|-5.36334,56.66195|-5.23416,56.74333|-5.13236,56.79403|-5.31473,56.65666|-5.37405,56.55925|-5.31826,56.55633|-5.25080,56.55753|-5.37718,56.52112|-5.39866,56.47866|-5.19111,56.46194|-5.11556,56.51277|-5.07014,56.56069|-5.13555,56.48499|-5.22084,56.43583|-5.32764,56.43574|-5.42439,56.43091|-5.52611,56.37360|-5.57139,56.32833|-5.59653,56.25695|-5.57389,56.16000|-5.52000,56.16485|-5.56334,56.11333|-5.60139,56.07638|-5.64222,56.04305|-5.66039,55.98263|-5.62555,56.02055|-5.58014,56.01319|-5.63361,55.96611|-5.67697,55.88844|-5.64750,55.78139|-5.60986,55.75930|-5.66916,55.66166|-5.70166,55.58861|-5.71805,55.51500|-5.75916,55.41750|-5.79528,55.36027|-5.78166,55.29902|-5.73778,55.29222|-5.56694,55.31666|-5.51528,55.36347|-5.55520,55.41440|-5.48639,55.64306|-5.44597,55.70680|-5.38000,55.75027|-5.41889,55.90666|-5.39924,55.99972|-5.33895,56.03456|-5.30594,56.06922|-5.23889,56.11889|-5.03222,56.23250|-4.92229,56.27111|-4.97416,56.23333|-5.07222,56.18695|-5.20069,56.11861|-5.30906,56.00570|-5.34000,55.90201|-5.29250,55.84750|-5.20805,55.84444|-5.22458,55.90175|-5.17334,55.92916|-5.11000,55.90306|-5.01222,55.86694|-4.96195,55.88000|-4.89824,55.98145|-4.84623,56.08632|-4.86636,56.03178|-4.85461,55.98648|-4.77659,55.97977|-4.62723,55.94555|-4.52305,55.91861|-4.70972,55.93403|-4.75166,55.94611|-4.82406,55.94950|-4.87826,55.93653|-4.91639,55.70083|-4.87584,55.68194|-4.81361,55.64555|-4.68722,55.59750|-4.61361,55.49069|-4.63958,55.44264|-4.68250,55.43388|-4.74847,55.41055|-4.83715,55.31882|-4.84778,55.26944|-4.86542,55.22340|-4.93500,55.17860|-5.01250,55.13347|-5.05361,55.04902|-5.17834,54.98888|-5.18563,54.93622|-5.17000,54.89111|-5.11666,54.83180|-5.00500,54.76333|-4.96229,54.68125|-4.92250,54.64055|-4.85723,54.62958|-4.96076,54.79687|-4.92431,54.83708|-4.85222,54.86861|-4.80125,54.85556|-4.74055,54.82166|-4.68084,54.79972|-4.59861,54.78027|-4.55792,54.73903|-4.49639,54.69888|-4.37584,54.67666|-4.34569,54.70916|-4.35973,54.77111|-4.41111,54.82583|-4.42445,54.88152|-4.38479,54.90555|-4.35056,54.85903|-4.09555,54.76777|-3.95361,54.76749|-3.86972,54.80527|-3.81222,54.84888|-3.69250,54.88110|-3.61584,54.87527|-3.57111,54.99083|-3.44528,54.98638|-3.36056,54.97138|-3.14695,54.96500|-3.05103,54.97986|-3.01500,55.05222|-2.96278,55.03889|-2.69945,55.17722|-2.63055,55.25500|-2.46305,55.36111|-2.21236,55.42777|-2.18278,55.45985|-2.21528,55.50583|-2.27416,55.57527|-2.27916,55.64472|-2.22000,55.66499|-2.08361,55.78054|-2.02166,55.80611'; |
|
3063 | + break; |
|
3064 | + case 'IRELAND': |
|
3065 | + $coordsAsStr[] = '-8.17166,54.46388|-8.06555,54.37277|-7.94139,54.29944|-7.87576,54.28499|-7.86834,54.22764|-7.81805,54.19916|-7.69972,54.20250|-7.55945,54.12694|-7.31334,54.11250|-7.14584,54.22527|-7.17555,54.28916|-7.16084,54.33666|-7.05834,54.41000|-6.97445,54.40166|-6.92695,54.37916|-6.87305,54.34208|-6.85111,54.28972|-6.73473,54.18361|-6.65556,54.06527|-6.60584,54.04444|-6.44750,54.05833|-6.33889,54.11555|-6.26697,54.09983|-6.17403,54.07222|-6.10834,54.03638|-6.04389,54.03139|-5.96834,54.06389|-5.88500,54.11639|-5.87347,54.20916|-5.82500,54.23958|-5.74611,54.24806|-5.65556,54.22701|-5.60834,54.24972|-5.55916,54.29084|-5.57334,54.37704|-5.64502,54.49267|-5.70472,54.53361|-5.68055,54.57306|-5.59972,54.54194|-5.55097,54.50083|-5.54216,54.44903|-5.54643,54.40527|-5.50672,54.36444|-5.46111,54.38555|-5.43132,54.48596|-5.47945,54.53638|-5.53521,54.65090|-5.57431,54.67722|-5.62916,54.67945|-5.73674,54.67383|-5.80305,54.66138|-5.88257,54.60652|-5.92445,54.63180|-5.86681,54.68972|-5.81903,54.70972|-5.74672,54.72452|-5.68775,54.76335|-5.70931,54.83166|-5.74694,54.85361|-5.79139,54.85139|-6.03611,55.05778|-6.04250,55.10277|-6.03444,55.15458|-6.10125,55.20945|-6.14584,55.22069|-6.25500,55.21194|-6.37639,55.23916|-6.51556,55.23305|-6.61334,55.20722|-6.73028,55.18027|-6.82472,55.16806|-6.88972,55.16777|-6.96695,55.15611|-6.99416,55.11027|-7.05139,55.04680|-7.09500,55.03694|-7.25251,55.07059|-7.32639,55.04527|-7.40639,54.95333|-7.45805,54.85777|-7.55334,54.76277|-7.73916,54.71054|-7.82576,54.73416|-7.92639,54.70054|-7.85236,54.63388|-7.77750,54.62694|-7.83361,54.55389|-7.95084,54.53222|-8.04695,54.50722|-8.17166,54.46388'; |
|
3066 | + break; |
|
3067 | + case 'WALES': |
|
3068 | + $coordsAsStr[] = '-3.08860,53.26001|-3.33639,53.34722|-3.38806,53.34361|-3.60986,53.27944|-3.73014,53.28944|-3.85445,53.28444|-4.01861,53.23750|-4.06639,53.22639|-4.15334,53.22556|-4.19639,53.20611|-4.33028,53.11222|-4.36097,53.02888|-4.55278,52.92889|-4.61889,52.90916|-4.72195,52.83611|-4.72778,52.78139|-4.53945,52.79306|-4.47722,52.85500|-4.41416,52.88472|-4.31292,52.90499|-4.23334,52.91499|-4.13569,52.87888|-4.13056,52.77777|-4.05334,52.71666|-4.10639,52.65084|-4.12597,52.60375|-4.08056,52.55333|-4.05972,52.48584|-4.09666,52.38583|-4.14305,52.32027|-4.19361,52.27638|-4.23166,52.24888|-4.52722,52.13083|-4.66945,52.13027|-4.73695,52.10361|-4.76778,52.06444|-4.84445,52.01388|-5.09945,51.96056|-5.23916,51.91638|-5.25889,51.87056|-5.18500,51.86958|-5.11528,51.83333|-5.10257,51.77895|-5.16111,51.76222|-5.24694,51.73027|-5.19111,51.70888|-5.00739,51.70349|-4.90875,51.71249|-4.86111,51.71334|-4.97061,51.67577|-5.02128,51.66861|-5.05139,51.62028|-5.00528,51.60638|-4.94139,51.59416|-4.89028,51.62694|-4.83569,51.64534|-4.79063,51.63340|-4.69028,51.66666|-4.64584,51.72666|-4.57445,51.73416|-4.43611,51.73722|-4.26222,51.67694|-4.19750,51.67916|-4.06614,51.66804|-4.11639,51.63416|-4.17750,51.62235|-4.25055,51.62861|-4.29208,51.60743|-4.27778,51.55666|-4.20486,51.53527|-3.94972,51.61278|-3.83792,51.61999|-3.78166,51.56750|-3.75160,51.52931|-3.67194,51.47388|-3.54250,51.39777|-3.40334,51.37972|-3.27097,51.38014|-3.16458,51.40909|-3.15166,51.45305|-3.11875,51.48750|-3.02111,51.52527|-2.95472,51.53972|-2.89278,51.53861|-2.84778,51.54500|-2.71472,51.58083|-2.66500,51.61500|-2.68666,51.71889|-2.68334,51.76957|-2.65944,51.81806|-2.77861,51.88583|-2.86639,51.92889|-2.91757,51.91569|-2.98889,51.92555|-3.04528,51.97639|-3.08500,52.01930|-3.11250,52.06945|-3.12222,52.11805|-3.07555,52.14804|-3.05125,52.23347|-2.99750,52.28139|-2.95486,52.33117|-3.02195,52.34027|-3.19611,52.41027|-3.19514,52.46722|-3.11916,52.49194|-3.02736,52.49792|-2.98028,52.53083|-3.00792,52.56902|-3.07089,52.55702|-3.11750,52.58666|-3.06666,52.63527|-3.01111,52.71166|-3.06806,52.77027|-3.13708,52.79312|-3.13014,52.88486|-3.08639,52.91611|-2.99389,52.95361|-2.85069,52.93875|-2.79278,52.90207|-2.71945,52.91902|-2.73109,52.96873|-2.77792,52.98514|-2.85695,53.03249|-2.89389,53.10416|-2.91069,53.17014|-2.95528,53.21555|-3.02000,53.24722|-3.08860,53.26001'; |
|
3069 | + break; |
|
3070 | + case 'NC': |
|
3071 | + $coordsAsStr[] = '-81.65876,36.60938|-81.70390,36.55513|-81.70639,36.50804|-81.74665,36.39777|-81.90723,36.30804|-82.03195,36.12694|-82.08416,36.10146|-82.12826,36.11020|-82.21500,36.15833|-82.36375,36.11347|-82.43472,36.06013|-82.46236,36.01708|-82.56006,35.96263|-82.60042,35.99638|-82.62308,36.06121|-82.73500,36.01833|-82.84612,35.94944|-82.90451,35.88819|-82.93555,35.83846|-83.16000,35.76236|-83.24222,35.71944|-83.49222,35.57111|-83.56847,35.55861|-83.64416,35.56471|-83.73499,35.56638|-83.88222,35.51791|-83.98361,35.44944|-84.03639,35.35444|-84.04964,35.29117|-84.09042,35.25986|-84.15084,35.25388|-84.20521,35.25722|-84.29284,35.22596|-84.32471,34.98701|-83.09778,35.00027|-82.77722,35.09138|-82.59639,35.14972|-82.37999,35.21500|-82.27362,35.20583|-81.41306,35.17416|-81.05915,35.15333|-80.92666,35.10695|-80.78751,34.95610|-80.79334,34.82555|-79.66777,34.80694|-79.11555,34.34527|-78.57222,33.88166|-78.51806,33.87999|-78.43721,33.89804|-78.23735,33.91986|-78.15389,33.91471|-78.06974,33.89500|-78.02597,33.88936|-77.97611,33.94276|-77.95299,33.99243|-77.94499,34.06499|-77.92728,34.11756|-77.92250,33.99194|-77.92264,33.93715|-77.88215,34.06166|-77.86222,34.15083|-77.83501,34.19194|-77.75724,34.28527|-77.68222,34.36555|-77.63667,34.39805|-77.57363,34.43694|-77.45527,34.50403|-77.38173,34.51646|-77.37905,34.56294|-77.38572,34.61260|-77.40944,34.68916|-77.38847,34.73304|-77.33097,34.63992|-77.35024,34.60099|-77.30958,34.55972|-77.09424,34.67742|-76.75994,34.76659|-76.68325,34.79749|-76.66097,34.75781|-76.62611,34.71014|-76.50063,34.73617|-76.48138,34.77638|-76.38305,34.86423|-76.34326,34.88194|-76.27181,34.96263|-76.35125,35.02221|-76.32354,34.97429|-76.45319,34.93524|-76.43395,34.98782|-76.45356,35.06676|-76.52917,35.00444|-76.63382,34.98242|-76.69722,34.94887|-76.75306,34.90526|-76.81636,34.93944|-76.89000,34.95388|-76.93180,34.96957|-76.96501,34.99777|-77.06816,35.14978|-76.97639,35.06806|-76.86722,35.00000|-76.80531,34.98559|-76.72708,35.00152|-76.60402,35.07416|-76.56555,35.11486|-76.57305,35.16013|-76.66489,35.16694|-76.56361,35.23361|-76.48750,35.22582|-76.46889,35.27166|-76.50298,35.30791|-76.83251,35.39222|-77.02305,35.48694|-77.04958,35.52694|-76.91292,35.46166|-76.65250,35.41499|-76.61611,35.45888|-76.63195,35.52249|-76.58820,35.55104|-76.51556,35.53194|-76.56711,35.48494|-76.52251,35.40416|-76.46195,35.37221|-76.13319,35.35986|-76.04111,35.42416|-76.00223,35.46610|-75.97958,35.51666|-75.89362,35.57555|-75.83834,35.56694|-75.78944,35.57138|-75.74076,35.61846|-75.72084,35.69263|-75.72084,35.81451|-75.74917,35.87791|-75.78333,35.91972|-75.85083,35.97527|-75.94333,35.91777|-75.98944,35.88054|-75.98854,35.79110|-75.99388,35.71027|-76.02875,35.65409|-76.10320,35.66041|-76.13563,35.69239|-76.04475,35.68436|-76.04167,35.74916|-76.05305,35.79361|-76.05305,35.87375|-76.02653,35.96222|-76.07751,35.99319|-76.17472,35.99596|-76.27917,35.91915|-76.37986,35.95763|-76.42014,35.97874|-76.55375,35.93971|-76.66222,35.93305|-76.72952,35.93984|-76.73392,36.04760|-76.75384,36.09477|-76.76028,36.14513|-76.74610,36.22818|-76.70458,36.24673|-76.72764,36.16736|-76.71021,36.11752|-76.69117,36.07165|-76.65979,36.03312|-76.49527,36.00958|-76.37138,36.07694|-76.37084,36.14999|-76.21417,36.09471|-76.07591,36.17910|-76.18361,36.26915|-76.19965,36.31739|-76.13986,36.28805|-76.04274,36.21974|-76.00465,36.18110|-75.95287,36.19241|-75.97604,36.31138|-75.93895,36.28381|-75.85271,36.11069|-75.79315,36.07385|-75.79639,36.11804|-75.88333,36.29554|-75.94665,36.37194|-75.98694,36.41166|-76.03473,36.49666|-76.02899,36.55000|-78.44234,36.54986|-78.56594,36.55799|-80.27556,36.55110|-81.15361,36.56499|-81.38722,36.57695|-81.65876,36.60938'; |
|
3072 | + break; |
|
3073 | + default: |
|
3074 | 3074 | } |
3075 | 3075 | ?> |
3076 | 3076 | var coordStr = <?php echo json_encode($coordsAsStr) ?>; |
@@ -68,12 +68,14 @@ discard block |
||
68 | 68 | private $treesize; |
69 | 69 | |
70 | 70 | /** {@inheritdoc} */ |
71 | - public function getTitle() { |
|
71 | + public function getTitle() |
|
72 | + { |
|
72 | 73 | return /* I18N: The name of a module. Google Maps™ is a trademark. Do not translate it? http://en.wikipedia.org/wiki/Google_maps */ I18N::translate('Google Maps™'); |
73 | 74 | } |
74 | 75 | |
75 | 76 | /** {@inheritdoc} */ |
76 | - public function getDescription() { |
|
77 | + public function getDescription() |
|
78 | + { |
|
77 | 79 | return /* I18N: Description of the “Google Maps™” module */ I18N::translate('Show the location of places and events using the Google Maps™ mapping service.'); |
78 | 80 | } |
79 | 81 | |
@@ -83,7 +85,8 @@ discard block |
||
83 | 85 | * |
84 | 86 | * @param string $mod_action |
85 | 87 | */ |
86 | - public function modAction($mod_action) { |
|
88 | + public function modAction($mod_action) |
|
89 | + { |
|
87 | 90 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
88 | 91 | |
89 | 92 | switch ($mod_action) { |
@@ -115,19 +118,22 @@ discard block |
||
115 | 118 | } |
116 | 119 | |
117 | 120 | /** {@inheritdoc} */ |
118 | - public function getConfigLink() { |
|
121 | + public function getConfigLink() |
|
122 | + { |
|
119 | 123 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
120 | 124 | |
121 | 125 | return 'module.php?mod=' . $this->getName() . '&mod_action=admin_config'; |
122 | 126 | } |
123 | 127 | |
124 | 128 | /** {@inheritdoc} */ |
125 | - public function defaultTabOrder() { |
|
129 | + public function defaultTabOrder() |
|
130 | + { |
|
126 | 131 | return 80; |
127 | 132 | } |
128 | 133 | |
129 | 134 | /** {@inheritdoc} */ |
130 | - public function getPreLoadContent() { |
|
135 | + public function getPreLoadContent() |
|
136 | + { |
|
131 | 137 | global $controller; |
132 | 138 | |
133 | 139 | $controller->addInlineJavascript(" |
@@ -147,12 +153,14 @@ discard block |
||
147 | 153 | } |
148 | 154 | |
149 | 155 | /** {@inheritdoc} */ |
150 | - public function canLoadAjax() { |
|
156 | + public function canLoadAjax() |
|
157 | + { |
|
151 | 158 | return true; |
152 | 159 | } |
153 | 160 | |
154 | 161 | /** {@inheritdoc} */ |
155 | - public function getTabContent() { |
|
162 | + public function getTabContent() |
|
163 | + { |
|
156 | 164 | global $controller; |
157 | 165 | |
158 | 166 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
@@ -189,12 +197,14 @@ discard block |
||
189 | 197 | } |
190 | 198 | |
191 | 199 | /** {@inheritdoc} */ |
192 | - public function hasTabContent() { |
|
200 | + public function hasTabContent() |
|
201 | + { |
|
193 | 202 | return Module::getModuleByName('googlemap') || Auth::isAdmin(); |
194 | 203 | } |
195 | 204 | |
196 | 205 | /** {@inheritdoc} */ |
197 | - public function isGrayedOut() { |
|
206 | + public function isGrayedOut() |
|
207 | + { |
|
198 | 208 | return false; |
199 | 209 | } |
200 | 210 | |
@@ -205,7 +215,8 @@ discard block |
||
205 | 215 | * |
206 | 216 | * @return Menu |
207 | 217 | */ |
208 | - public function getChartMenu(Individual $individual) { |
|
218 | + public function getChartMenu(Individual $individual) |
|
219 | + { |
|
209 | 220 | return new Menu( |
210 | 221 | I18N::translate('Pedigree map'), |
211 | 222 | 'module.php?mod=googlemap&mod_action=pedigree_map&rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), |
@@ -221,14 +232,16 @@ discard block |
||
221 | 232 | * |
222 | 233 | * @return Menu |
223 | 234 | */ |
224 | - public function getBoxChartMenu(Individual $individual) { |
|
235 | + public function getBoxChartMenu(Individual $individual) |
|
236 | + { |
|
225 | 237 | return $this->getChartMenu($individual); |
226 | 238 | } |
227 | 239 | |
228 | 240 | /** |
229 | 241 | * A form to edit the module configuration. |
230 | 242 | */ |
231 | - private function config() { |
|
243 | + private function config() |
|
244 | + { |
|
232 | 245 | $controller = new PageController; |
233 | 246 | $controller |
234 | 247 | ->restrictAccess(Auth::isAdmin()) |
@@ -480,7 +493,8 @@ discard block |
||
480 | 493 | * |
481 | 494 | * @return string |
482 | 495 | */ |
483 | - private function googleMapsScript() { |
|
496 | + private function googleMapsScript() |
|
497 | + { |
|
484 | 498 | $key = $this->getSetting('GM_API_KEY'); |
485 | 499 | |
486 | 500 | return 'https://maps.googleapis.com/maps/api/js?v=3&key=' . $key . '&language=' . WT_LOCALE; |
@@ -489,7 +503,8 @@ discard block |
||
489 | 503 | /** |
490 | 504 | * Select a flag. |
491 | 505 | */ |
492 | - private function flags() { |
|
506 | + private function flags() |
|
507 | + { |
|
493 | 508 | global $WT_TREE; |
494 | 509 | |
495 | 510 | $controller = new SimpleController; |
@@ -691,7 +706,8 @@ discard block |
||
691 | 706 | /** |
692 | 707 | * Display a map showing the origins of ones ancestors. |
693 | 708 | */ |
694 | - private function pedigreeMap() { |
|
709 | + private function pedigreeMap() |
|
710 | + { |
|
695 | 711 | global $controller, $WT_TREE; |
696 | 712 | |
697 | 713 | $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); |
@@ -867,7 +883,8 @@ discard block |
||
867 | 883 | * |
868 | 884 | * @return string |
869 | 885 | */ |
870 | - private function pedigreeMapJavascript() { |
|
886 | + private function pedigreeMapJavascript() |
|
887 | + { |
|
871 | 888 | |
872 | 889 | $js = ' |
873 | 890 | // this variable will collect the html which will eventually be placed in the side bar |
@@ -1277,7 +1294,8 @@ discard block |
||
1277 | 1294 | /** |
1278 | 1295 | * Check places for missing data, etc. |
1279 | 1296 | */ |
1280 | - private function adminPlaceCheck() { |
|
1297 | + private function adminPlaceCheck() |
|
1298 | + { |
|
1281 | 1299 | global $WT_TREE; |
1282 | 1300 | |
1283 | 1301 | $gedcom_id = Filter::get('gedcom_id', null, $WT_TREE->getTreeId()); |
@@ -1566,7 +1584,8 @@ discard block |
||
1566 | 1584 | * |
1567 | 1585 | * @return bool |
1568 | 1586 | */ |
1569 | - private function checkMapData(Individual $individual) { |
|
1587 | + private function checkMapData(Individual $individual) |
|
1588 | + { |
|
1570 | 1589 | $statement = Database::prepare( |
1571 | 1590 | "SELECT COUNT(*) FROM `##placelinks` WHERE pl_gid = :xref AND pl_file = :tree_id" |
1572 | 1591 | ); |
@@ -1598,7 +1617,8 @@ discard block |
||
1598 | 1617 | * |
1599 | 1618 | * @return string[] |
1600 | 1619 | */ |
1601 | - private function removePrefixFromPlaceName($prefix_list, $place, $placelist) { |
|
1620 | + private function removePrefixFromPlaceName($prefix_list, $place, $placelist) |
|
1621 | + { |
|
1602 | 1622 | if ($prefix_list) { |
1603 | 1623 | foreach (explode(';', $prefix_list) as $prefix) { |
1604 | 1624 | if ($prefix && substr($place, 0, strlen($prefix) + 1) == $prefix . ' ') { |
@@ -1619,7 +1639,8 @@ discard block |
||
1619 | 1639 | * |
1620 | 1640 | * @return string[] |
1621 | 1641 | */ |
1622 | - private function removeSuffixFromPlaceName($suffix_list, $place, $placelist) { |
|
1642 | + private function removeSuffixFromPlaceName($suffix_list, $place, $placelist) |
|
1643 | + { |
|
1623 | 1644 | if ($suffix_list) { |
1624 | 1645 | foreach (explode(';', $suffix_list) as $postfix) { |
1625 | 1646 | if ($postfix && substr($place, -strlen($postfix) - 1) == ' ' . $postfix) { |
@@ -1641,7 +1662,8 @@ discard block |
||
1641 | 1662 | * |
1642 | 1663 | * @return string[] |
1643 | 1664 | */ |
1644 | - private function removePrefixAndSuffixFromPlaceName($prefix_list, $suffix_list, $place, $placelist) { |
|
1665 | + private function removePrefixAndSuffixFromPlaceName($prefix_list, $suffix_list, $place, $placelist) |
|
1666 | + { |
|
1645 | 1667 | if ($prefix_list && $suffix_list) { |
1646 | 1668 | foreach (explode(';', $prefix_list) as $prefix) { |
1647 | 1669 | foreach (explode(';', $suffix_list) as $postfix) { |
@@ -1663,7 +1685,8 @@ discard block |
||
1663 | 1685 | * |
1664 | 1686 | * @return string[] |
1665 | 1687 | */ |
1666 | - private function createPossiblePlaceNames($placename, $level) { |
|
1688 | + private function createPossiblePlaceNames($placename, $level) |
|
1689 | + { |
|
1667 | 1690 | $retlist = array(); |
1668 | 1691 | if ($level <= 9) { |
1669 | 1692 | $retlist = $this->removePrefixAndSuffixFromPlaceName($this->getSetting('GM_PREFIX_' . $level), $this->getSetting('GM_POSTFIX_' . $level), $placename, $retlist); // Remove both |
@@ -1682,7 +1705,8 @@ discard block |
||
1682 | 1705 | * |
1683 | 1706 | * @return null|\stdClass |
1684 | 1707 | */ |
1685 | - private function getLatitudeAndLongitudeFromPlaceLocation($place) { |
|
1708 | + private function getLatitudeAndLongitudeFromPlaceLocation($place) |
|
1709 | + { |
|
1686 | 1710 | $parent = explode(',', $place); |
1687 | 1711 | $parent = array_reverse($parent); |
1688 | 1712 | $place_id = 0; |
@@ -1720,7 +1744,8 @@ discard block |
||
1720 | 1744 | * |
1721 | 1745 | * @return array |
1722 | 1746 | */ |
1723 | - private function getPlaceData(Fact $fact) { |
|
1747 | + private function getPlaceData(Fact $fact) |
|
1748 | + { |
|
1724 | 1749 | $result = array(); |
1725 | 1750 | |
1726 | 1751 | $has_latitude = preg_match('/\n4 LATI (.+)/', $fact->getGedcom(), $match1); |
@@ -1778,7 +1803,8 @@ discard block |
||
1778 | 1803 | * |
1779 | 1804 | * @param Individual $indi |
1780 | 1805 | */ |
1781 | - private function buildIndividualMap(Individual $indi) { |
|
1806 | + private function buildIndividualMap(Individual $indi) |
|
1807 | + { |
|
1782 | 1808 | $GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM'); |
1783 | 1809 | $facts = $indi->getFacts(); |
1784 | 1810 | foreach ($indi->getSpouseFamilies() as $family) { |
@@ -2127,7 +2153,8 @@ discard block |
||
2127 | 2153 | * |
2128 | 2154 | * @return int |
2129 | 2155 | */ |
2130 | - private function getPlaceLocationId($place) { |
|
2156 | + private function getPlaceLocationId($place) |
|
2157 | + { |
|
2131 | 2158 | $par = explode(',', strip_tags($place)); |
2132 | 2159 | $par = array_reverse($par); |
2133 | 2160 | $place_id = 0; |
@@ -2167,7 +2194,8 @@ discard block |
||
2167 | 2194 | * |
2168 | 2195 | * @return int |
2169 | 2196 | */ |
2170 | - private function getPlaceId($place) { |
|
2197 | + private function getPlaceId($place) |
|
2198 | + { |
|
2171 | 2199 | global $WT_TREE; |
2172 | 2200 | |
2173 | 2201 | $par = explode(',', $place); |
@@ -2207,7 +2235,8 @@ discard block |
||
2207 | 2235 | * |
2208 | 2236 | * @return int |
2209 | 2237 | */ |
2210 | - private function setPlaceIdMap($level, $parent) { |
|
2238 | + private function setPlaceIdMap($level, $parent) |
|
2239 | + { |
|
2211 | 2240 | $fullplace = ''; |
2212 | 2241 | if ($level == 0) { |
2213 | 2242 | return 0; |
@@ -2229,7 +2258,8 @@ discard block |
||
2229 | 2258 | * |
2230 | 2259 | * @return int |
2231 | 2260 | */ |
2232 | - private function setLevelMap($level, $parent) { |
|
2261 | + private function setLevelMap($level, $parent) |
|
2262 | + { |
|
2233 | 2263 | $fullplace = ''; |
2234 | 2264 | if ($level == 0) { |
2235 | 2265 | return 0; |
@@ -2250,7 +2280,8 @@ discard block |
||
2250 | 2280 | /** |
2251 | 2281 | * Called by placelist.php |
2252 | 2282 | */ |
2253 | - public function createMap() { |
|
2283 | + public function createMap() |
|
2284 | + { |
|
2254 | 2285 | global $level, $levelm, $plzoom, $WT_TREE; |
2255 | 2286 | |
2256 | 2287 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
@@ -2360,7 +2391,8 @@ discard block |
||
2360 | 2391 | * @param int $level |
2361 | 2392 | * @param string[] $parent |
2362 | 2393 | */ |
2363 | - private function printHowManyPeople($level, $parent) { |
|
2394 | + private function printHowManyPeople($level, $parent) |
|
2395 | + { |
|
2364 | 2396 | global $WT_TREE; |
2365 | 2397 | |
2366 | 2398 | $stats = new Stats($WT_TREE); |
@@ -2391,7 +2423,8 @@ discard block |
||
2391 | 2423 | * @param int $levelm |
2392 | 2424 | * @param string $linklevels |
2393 | 2425 | */ |
2394 | - private function printGoogleMapMarkers($place2, $level, $parent, $levelm, $linklevels) { |
|
2426 | + private function printGoogleMapMarkers($place2, $level, $parent, $levelm, $linklevels) |
|
2427 | + { |
|
2395 | 2428 | echo 'var icon_url = null;'; |
2396 | 2429 | if (!$place2['lati'] || !$place2['long']) { |
2397 | 2430 | echo 'var icon_url ="' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/marker_yellow.png";'; |
@@ -2468,7 +2501,8 @@ discard block |
||
2468 | 2501 | * @param string $linklevels |
2469 | 2502 | * @param string[] $place_names |
2470 | 2503 | */ |
2471 | - public function mapScripts($numfound, $level, $parent, $linklevels, $place_names) { |
|
2504 | + public function mapScripts($numfound, $level, $parent, $linklevels, $place_names) |
|
2505 | + { |
|
2472 | 2506 | global $plzoom, $controller; |
2473 | 2507 | |
2474 | 2508 | $controller->addInlineJavascript(' |
@@ -2644,7 +2678,8 @@ discard block |
||
2644 | 2678 | * |
2645 | 2679 | * @return string[] |
2646 | 2680 | */ |
2647 | - private function placeIdToHierarchy($id) { |
|
2681 | + private function placeIdToHierarchy($id) |
|
2682 | + { |
|
2648 | 2683 | $statement = Database::prepare("SELECT pl_parent_id, pl_place FROM `##placelocation` WHERE pl_id=?"); |
2649 | 2684 | $arr = array(); |
2650 | 2685 | while ($id != 0) { |
@@ -2661,7 +2696,8 @@ discard block |
||
2661 | 2696 | * |
2662 | 2697 | * @return int |
2663 | 2698 | */ |
2664 | - private function getHighestIndex() { |
|
2699 | + private function getHighestIndex() |
|
2700 | + { |
|
2665 | 2701 | return (int) Database::prepare("SELECT MAX(pl_id) FROM `##placelocation`")->fetchOne(); |
2666 | 2702 | } |
2667 | 2703 | |
@@ -2670,7 +2706,8 @@ discard block |
||
2670 | 2706 | * |
2671 | 2707 | * @return int |
2672 | 2708 | */ |
2673 | - private function getHighestLevel() { |
|
2709 | + private function getHighestLevel() |
|
2710 | + { |
|
2674 | 2711 | return (int) Database::prepare("SELECT MAX(pl_level) FROM `##placelocation`")->fetchOne(); |
2675 | 2712 | } |
2676 | 2713 | |
@@ -2682,7 +2719,8 @@ discard block |
||
2682 | 2719 | * |
2683 | 2720 | * @return array[] |
2684 | 2721 | */ |
2685 | - private function getPlaceListLocation($parent_id, $inactive = false) { |
|
2722 | + private function getPlaceListLocation($parent_id, $inactive = false) |
|
2723 | + { |
|
2686 | 2724 | if ($inactive) { |
2687 | 2725 | $rows = Database::prepare( |
2688 | 2726 | "SELECT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon" . |
@@ -2726,7 +2764,8 @@ discard block |
||
2726 | 2764 | * |
2727 | 2765 | * @param int $parent_id |
2728 | 2766 | */ |
2729 | - private function outputLevel($parent_id) { |
|
2767 | + private function outputLevel($parent_id) |
|
2768 | + { |
|
2730 | 2769 | $tmp = $this->placeIdToHierarchy($parent_id); |
2731 | 2770 | $maxLevel = $this->getHighestLevel(); |
2732 | 2771 | if ($maxLevel > 8) { |
@@ -2758,7 +2797,8 @@ discard block |
||
2758 | 2797 | * |
2759 | 2798 | * @return string[] |
2760 | 2799 | */ |
2761 | - private function findFiles($path) { |
|
2800 | + private function findFiles($path) |
|
2801 | + { |
|
2762 | 2802 | $placefiles = array(); |
2763 | 2803 | |
2764 | 2804 | try { |
@@ -2780,7 +2820,8 @@ discard block |
||
2780 | 2820 | /** |
2781 | 2821 | * Edit places. |
2782 | 2822 | */ |
2783 | - private function placesEdit() { |
|
2823 | + private function placesEdit() |
|
2824 | + { |
|
2784 | 2825 | $GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM'); |
2785 | 2826 | |
2786 | 2827 | $action = Filter::post('action', null, Filter::get('action')); |
@@ -3416,7 +3457,8 @@ discard block |
||
3416 | 3457 | /** |
3417 | 3458 | * Places administration. |
3418 | 3459 | */ |
3419 | - private function adminPlaces() { |
|
3460 | + private function adminPlaces() |
|
3461 | + { |
|
3420 | 3462 | global $WT_TREE; |
3421 | 3463 | |
3422 | 3464 | $action = Filter::get('action'); |
@@ -4091,7 +4133,8 @@ discard block |
||
4091 | 4133 | /** |
4092 | 4134 | * Generate the streetview window. |
4093 | 4135 | */ |
4094 | - private function wtStreetView() { |
|
4136 | + private function wtStreetView() |
|
4137 | + { |
|
4095 | 4138 | header('Content-type: text/html; charset=UTF-8'); |
4096 | 4139 | |
4097 | 4140 | ?> |
@@ -23,25 +23,25 @@ |
||
23 | 23 | * Upgrade the database schema from version 2 to version 3. |
24 | 24 | */ |
25 | 25 | class Migration2 implements MigrationInterface { |
26 | - /** {@inheritDoc} */ |
|
27 | - public function upgrade() { |
|
28 | - // Add foreign key constraints |
|
29 | - // Delete any data that might violate the new constraints |
|
30 | - Database::exec( |
|
31 | - "DELETE FROM `##favorite`" . |
|
32 | - " WHERE user_id NOT IN (SELECT user_id FROM `##user` )" . |
|
33 | - " OR gedcom_id NOT IN (SELECT gedcom_id FROM `##gedcom`)" |
|
34 | - ); |
|
26 | + /** {@inheritDoc} */ |
|
27 | + public function upgrade() { |
|
28 | + // Add foreign key constraints |
|
29 | + // Delete any data that might violate the new constraints |
|
30 | + Database::exec( |
|
31 | + "DELETE FROM `##favorite`" . |
|
32 | + " WHERE user_id NOT IN (SELECT user_id FROM `##user` )" . |
|
33 | + " OR gedcom_id NOT IN (SELECT gedcom_id FROM `##gedcom`)" |
|
34 | + ); |
|
35 | 35 | |
36 | - // Add the new constraints |
|
37 | - try { |
|
38 | - Database::exec( |
|
39 | - "ALTER TABLE `##favorite`" . |
|
40 | - " ADD FOREIGN KEY `##favorite_fk1` (user_id ) REFERENCES `##user` (user_id) ON DELETE CASCADE," . |
|
41 | - " ADD FOREIGN KEY `##favorite_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE" |
|
42 | - ); |
|
43 | - } catch (PDOException $ex) { |
|
44 | - // Already updated? |
|
45 | - } |
|
46 | - } |
|
36 | + // Add the new constraints |
|
37 | + try { |
|
38 | + Database::exec( |
|
39 | + "ALTER TABLE `##favorite`" . |
|
40 | + " ADD FOREIGN KEY `##favorite_fk1` (user_id ) REFERENCES `##user` (user_id) ON DELETE CASCADE," . |
|
41 | + " ADD FOREIGN KEY `##favorite_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE" |
|
42 | + ); |
|
43 | + } catch (PDOException $ex) { |
|
44 | + // Already updated? |
|
45 | + } |
|
46 | + } |
|
47 | 47 | } |
@@ -22,9 +22,11 @@ |
||
22 | 22 | /** |
23 | 23 | * Upgrade the database schema from version 2 to version 3. |
24 | 24 | */ |
25 | -class Migration2 implements MigrationInterface { |
|
25 | +class Migration2 implements MigrationInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritDoc} */ |
27 | - public function upgrade() { |
|
28 | + public function upgrade() |
|
29 | + { |
|
28 | 30 | // Add foreign key constraints |
29 | 31 | // Delete any data that might violate the new constraints |
30 | 32 | Database::exec( |
@@ -23,64 +23,64 @@ |
||
23 | 23 | * Upgrade the database schema from version 1 to version 2. |
24 | 24 | */ |
25 | 25 | class Migration1 implements MigrationInterface { |
26 | - /** {@inheritDoc} */ |
|
27 | - public function upgrade() { |
|
28 | - // Add the new columns |
|
29 | - try { |
|
30 | - Database::exec( |
|
31 | - "ALTER TABLE `##favorites`" . |
|
32 | - " CHANGE fv_id favorite_id INTEGER AUTO_INCREMENT NOT NULL," . |
|
33 | - " CHANGE fv_gid xref VARCHAR(20) NULL," . |
|
34 | - " CHANGE fv_type favorite_type ENUM('INDI', 'FAM', 'SOUR', 'REPO', 'OBJE', 'NOTE', 'URL') NOT NULL," . |
|
35 | - " CHANGE fv_url url VARCHAR(255) NULL," . |
|
36 | - " CHANGE fv_title title VARCHAR(255) NULL," . |
|
37 | - " CHANGE fv_note note VARCHAR(1000) NULL," . |
|
38 | - " ADD user_id INTEGER NULL AFTER favorite_id," . |
|
39 | - " ADD gedcom_id INTEGER NOT NULL AFTER user_id," . |
|
40 | - " DROP KEY ix1," . |
|
41 | - " ADD KEY news_ix1 (gedcom_id, user_id)" |
|
42 | - ); |
|
43 | - } catch (PDOException $ex) { |
|
44 | - // Already updated? |
|
45 | - } |
|
26 | + /** {@inheritDoc} */ |
|
27 | + public function upgrade() { |
|
28 | + // Add the new columns |
|
29 | + try { |
|
30 | + Database::exec( |
|
31 | + "ALTER TABLE `##favorites`" . |
|
32 | + " CHANGE fv_id favorite_id INTEGER AUTO_INCREMENT NOT NULL," . |
|
33 | + " CHANGE fv_gid xref VARCHAR(20) NULL," . |
|
34 | + " CHANGE fv_type favorite_type ENUM('INDI', 'FAM', 'SOUR', 'REPO', 'OBJE', 'NOTE', 'URL') NOT NULL," . |
|
35 | + " CHANGE fv_url url VARCHAR(255) NULL," . |
|
36 | + " CHANGE fv_title title VARCHAR(255) NULL," . |
|
37 | + " CHANGE fv_note note VARCHAR(1000) NULL," . |
|
38 | + " ADD user_id INTEGER NULL AFTER favorite_id," . |
|
39 | + " ADD gedcom_id INTEGER NOT NULL AFTER user_id," . |
|
40 | + " DROP KEY ix1," . |
|
41 | + " ADD KEY news_ix1 (gedcom_id, user_id)" |
|
42 | + ); |
|
43 | + } catch (PDOException $ex) { |
|
44 | + // Already updated? |
|
45 | + } |
|
46 | 46 | |
47 | - // Migrate data from the old columns to the new ones |
|
48 | - try { |
|
49 | - Database::exec( |
|
50 | - "UPDATE `##favorites` f" . |
|
51 | - " LEFT JOIN `##gedcom` g ON (f.fv_file =g.gedcom_name)" . |
|
52 | - " LEFT JOIN `##user` u ON (f.fv_username=u.user_name)" . |
|
53 | - " SET f.gedcom_id=g.gedcom_id, f.user_id=u.user_id" |
|
54 | - ); |
|
55 | - } catch (PDOException $ex) { |
|
56 | - // Already updated? |
|
57 | - } |
|
47 | + // Migrate data from the old columns to the new ones |
|
48 | + try { |
|
49 | + Database::exec( |
|
50 | + "UPDATE `##favorites` f" . |
|
51 | + " LEFT JOIN `##gedcom` g ON (f.fv_file =g.gedcom_name)" . |
|
52 | + " LEFT JOIN `##user` u ON (f.fv_username=u.user_name)" . |
|
53 | + " SET f.gedcom_id=g.gedcom_id, f.user_id=u.user_id" |
|
54 | + ); |
|
55 | + } catch (PDOException $ex) { |
|
56 | + // Already updated? |
|
57 | + } |
|
58 | 58 | |
59 | - // Delete orphaned rows |
|
60 | - try { |
|
61 | - Database::exec( |
|
62 | - "DELETE FROM `##favorites` WHERE user_id IS NULL AND gedcom_id IS NULL" |
|
63 | - ); |
|
64 | - } catch (PDOException $ex) { |
|
65 | - // Already updated? |
|
66 | - } |
|
59 | + // Delete orphaned rows |
|
60 | + try { |
|
61 | + Database::exec( |
|
62 | + "DELETE FROM `##favorites` WHERE user_id IS NULL AND gedcom_id IS NULL" |
|
63 | + ); |
|
64 | + } catch (PDOException $ex) { |
|
65 | + // Already updated? |
|
66 | + } |
|
67 | 67 | |
68 | - // Delete the old column |
|
69 | - try { |
|
70 | - Database::exec( |
|
71 | - "ALTER TABLE `##favorites` DROP fv_username, DROP fv_file" |
|
72 | - ); |
|
73 | - } catch (PDOException $ex) { |
|
74 | - // Already updated? |
|
75 | - } |
|
68 | + // Delete the old column |
|
69 | + try { |
|
70 | + Database::exec( |
|
71 | + "ALTER TABLE `##favorites` DROP fv_username, DROP fv_file" |
|
72 | + ); |
|
73 | + } catch (PDOException $ex) { |
|
74 | + // Already updated? |
|
75 | + } |
|
76 | 76 | |
77 | - // Rename the table |
|
78 | - try { |
|
79 | - Database::exec( |
|
80 | - "RENAME TABLE `##favorites` TO `##favorite`" |
|
81 | - ); |
|
82 | - } catch (PDOException $ex) { |
|
83 | - // Already updated? |
|
84 | - } |
|
85 | - } |
|
77 | + // Rename the table |
|
78 | + try { |
|
79 | + Database::exec( |
|
80 | + "RENAME TABLE `##favorites` TO `##favorite`" |
|
81 | + ); |
|
82 | + } catch (PDOException $ex) { |
|
83 | + // Already updated? |
|
84 | + } |
|
85 | + } |
|
86 | 86 | } |
@@ -22,9 +22,11 @@ |
||
22 | 22 | /** |
23 | 23 | * Upgrade the database schema from version 1 to version 2. |
24 | 24 | */ |
25 | -class Migration1 implements MigrationInterface { |
|
25 | +class Migration1 implements MigrationInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritDoc} */ |
27 | - public function upgrade() { |
|
28 | + public function upgrade() |
|
29 | + { |
|
28 | 30 | // Add the new columns |
29 | 31 | try { |
30 | 32 | Database::exec( |
@@ -22,22 +22,22 @@ |
||
22 | 22 | * Upgrade the database schema from version 0 (empty database) to version 1. |
23 | 23 | */ |
24 | 24 | class Migration0 implements MigrationInterface { |
25 | - /** {@inheritDoc} */ |
|
26 | - public function upgrade() { |
|
27 | - // Create the tables, as per PhpGedView 4.2.1 |
|
28 | - Database::exec( |
|
29 | - "CREATE TABLE IF NOT EXISTS `##favorites` (" . |
|
30 | - " fv_id INTEGER AUTO_INCREMENT NOT NULL," . |
|
31 | - " fv_username VARCHAR(32) NOT NULL," . |
|
32 | - " fv_gid VARCHAR(20) NULL," . |
|
33 | - " fv_type VARCHAR(15) NULL," . |
|
34 | - " fv_file VARCHAR(100) NULL," . |
|
35 | - " fv_url VARCHAR(255) NULL," . |
|
36 | - " fv_title VARCHAR(255) NULL," . |
|
37 | - " fv_note TEXT NULL," . |
|
38 | - " PRIMARY KEY (fv_id)," . |
|
39 | - " KEY ix1 (fv_username)" . |
|
40 | - ") COLLATE utf8_unicode_ci ENGINE=InnoDB" |
|
41 | - ); |
|
42 | - } |
|
25 | + /** {@inheritDoc} */ |
|
26 | + public function upgrade() { |
|
27 | + // Create the tables, as per PhpGedView 4.2.1 |
|
28 | + Database::exec( |
|
29 | + "CREATE TABLE IF NOT EXISTS `##favorites` (" . |
|
30 | + " fv_id INTEGER AUTO_INCREMENT NOT NULL," . |
|
31 | + " fv_username VARCHAR(32) NOT NULL," . |
|
32 | + " fv_gid VARCHAR(20) NULL," . |
|
33 | + " fv_type VARCHAR(15) NULL," . |
|
34 | + " fv_file VARCHAR(100) NULL," . |
|
35 | + " fv_url VARCHAR(255) NULL," . |
|
36 | + " fv_title VARCHAR(255) NULL," . |
|
37 | + " fv_note TEXT NULL," . |
|
38 | + " PRIMARY KEY (fv_id)," . |
|
39 | + " KEY ix1 (fv_username)" . |
|
40 | + ") COLLATE utf8_unicode_ci ENGINE=InnoDB" |
|
41 | + ); |
|
42 | + } |
|
43 | 43 | } |
@@ -21,9 +21,11 @@ |
||
21 | 21 | /** |
22 | 22 | * Upgrade the database schema from version 0 (empty database) to version 1. |
23 | 23 | */ |
24 | -class Migration0 implements MigrationInterface { |
|
24 | +class Migration0 implements MigrationInterface |
|
25 | +{ |
|
25 | 26 | /** {@inheritDoc} */ |
26 | - public function upgrade() { |
|
27 | + public function upgrade() |
|
28 | + { |
|
27 | 29 | // Create the tables, as per PhpGedView 4.2.1 |
28 | 30 | Database::exec( |
29 | 31 | "CREATE TABLE IF NOT EXISTS `##favorites` (" . |
@@ -23,14 +23,14 @@ |
||
23 | 23 | * Upgrade the database schema from version 3 to version 4. |
24 | 24 | */ |
25 | 25 | class Migration3 implements MigrationInterface { |
26 | - /** {@inheritDoc} */ |
|
27 | - public function upgrade() { |
|
28 | - // An earlier update mistakenly made the fv_note column too short. |
|
29 | - // Add the new constraints |
|
30 | - try { |
|
31 | - Database::exec("ALTER TABLE `##favorite` CHANGE note note VARCHAR(1000) NULL"); |
|
32 | - } catch (PDOException $ex) { |
|
33 | - // Already updated? |
|
34 | - } |
|
35 | - } |
|
26 | + /** {@inheritDoc} */ |
|
27 | + public function upgrade() { |
|
28 | + // An earlier update mistakenly made the fv_note column too short. |
|
29 | + // Add the new constraints |
|
30 | + try { |
|
31 | + Database::exec("ALTER TABLE `##favorite` CHANGE note note VARCHAR(1000) NULL"); |
|
32 | + } catch (PDOException $ex) { |
|
33 | + // Already updated? |
|
34 | + } |
|
35 | + } |
|
36 | 36 | } |
@@ -22,9 +22,11 @@ |
||
22 | 22 | /** |
23 | 23 | * Upgrade the database schema from version 3 to version 4. |
24 | 24 | */ |
25 | -class Migration3 implements MigrationInterface { |
|
25 | +class Migration3 implements MigrationInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritDoc} */ |
27 | - public function upgrade() { |
|
28 | + public function upgrade() |
|
29 | + { |
|
28 | 30 | // An earlier update mistakenly made the fv_note column too short. |
29 | 31 | // Add the new constraints |
30 | 32 | try { |
@@ -29,116 +29,116 @@ discard block |
||
29 | 29 | * Class SlideShowModule |
30 | 30 | */ |
31 | 31 | class SlideShowModule extends AbstractModule implements ModuleBlockInterface { |
32 | - /** {@inheritdoc} */ |
|
33 | - public function getTitle() { |
|
34 | - return /* I18N: Name of a module */ I18N::translate('Slide show'); |
|
35 | - } |
|
32 | + /** {@inheritdoc} */ |
|
33 | + public function getTitle() { |
|
34 | + return /* I18N: Name of a module */ I18N::translate('Slide show'); |
|
35 | + } |
|
36 | 36 | |
37 | - /** {@inheritdoc} */ |
|
38 | - public function getDescription() { |
|
39 | - return /* I18N: Description of the “Slide show” module */ I18N::translate('Random images from the current family tree.'); |
|
40 | - } |
|
37 | + /** {@inheritdoc} */ |
|
38 | + public function getDescription() { |
|
39 | + return /* I18N: Description of the “Slide show” module */ I18N::translate('Random images from the current family tree.'); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Generate the HTML content of this block. |
|
44 | - * |
|
45 | - * @param int $block_id |
|
46 | - * @param bool $template |
|
47 | - * @param string[] $cfg |
|
48 | - * |
|
49 | - * @return string |
|
50 | - */ |
|
51 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
52 | - global $ctype, $WT_TREE; |
|
42 | + /** |
|
43 | + * Generate the HTML content of this block. |
|
44 | + * |
|
45 | + * @param int $block_id |
|
46 | + * @param bool $template |
|
47 | + * @param string[] $cfg |
|
48 | + * |
|
49 | + * @return string |
|
50 | + */ |
|
51 | + public function getBlock($block_id, $template = true, $cfg = array()) { |
|
52 | + global $ctype, $WT_TREE; |
|
53 | 53 | |
54 | - $filter = $this->getBlockSetting($block_id, 'filter', 'all'); |
|
55 | - $controls = $this->getBlockSetting($block_id, 'controls', '1'); |
|
56 | - $start = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start'); |
|
54 | + $filter = $this->getBlockSetting($block_id, 'filter', 'all'); |
|
55 | + $controls = $this->getBlockSetting($block_id, 'controls', '1'); |
|
56 | + $start = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start'); |
|
57 | 57 | |
58 | - // We can apply the filters using SQL |
|
59 | - // Do not use "ORDER BY RAND()" - it is very slow on large tables. Use PHP::array_rand() instead. |
|
60 | - $all_media = Database::prepare( |
|
61 | - "SELECT m_id FROM `##media`" . |
|
62 | - " WHERE m_file = ?" . |
|
63 | - " AND m_ext IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')" . |
|
64 | - " AND m_type IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')" |
|
65 | - )->execute(array( |
|
66 | - $WT_TREE->getTreeId(), |
|
67 | - $this->getBlockSetting($block_id, 'filter_avi', '0') ? 'avi' : null, |
|
68 | - $this->getBlockSetting($block_id, 'filter_bmp', '1') ? 'bmp' : null, |
|
69 | - $this->getBlockSetting($block_id, 'filter_gif', '1') ? 'gif' : null, |
|
70 | - $this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpg' : null, |
|
71 | - $this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpeg' : null, |
|
72 | - $this->getBlockSetting($block_id, 'filter_mp3', '0') ? 'mp3' : null, |
|
73 | - $this->getBlockSetting($block_id, 'filter_ole', '1') ? 'ole' : null, |
|
74 | - $this->getBlockSetting($block_id, 'filter_pcx', '1') ? 'pcx' : null, |
|
75 | - $this->getBlockSetting($block_id, 'filter_pdf', '0') ? 'pdf' : null, |
|
76 | - $this->getBlockSetting($block_id, 'filter_png', '1') ? 'png' : null, |
|
77 | - $this->getBlockSetting($block_id, 'filter_tiff', '1') ? 'tiff' : null, |
|
78 | - $this->getBlockSetting($block_id, 'filter_wav', '0') ? 'wav' : null, |
|
79 | - $this->getBlockSetting($block_id, 'filter_audio', '0') ? 'audio' : null, |
|
80 | - $this->getBlockSetting($block_id, 'filter_book', '1') ? 'book' : null, |
|
81 | - $this->getBlockSetting($block_id, 'filter_card', '1') ? 'card' : null, |
|
82 | - $this->getBlockSetting($block_id, 'filter_certificate', '1') ? 'certificate' : null, |
|
83 | - $this->getBlockSetting($block_id, 'filter_coat', '1') ? 'coat' : null, |
|
84 | - $this->getBlockSetting($block_id, 'filter_document', '1') ? 'document' : null, |
|
85 | - $this->getBlockSetting($block_id, 'filter_electronic', '1') ? 'electronic' : null, |
|
86 | - $this->getBlockSetting($block_id, 'filter_fiche', '1') ? 'fiche' : null, |
|
87 | - $this->getBlockSetting($block_id, 'filter_film', '1') ? 'film' : null, |
|
88 | - $this->getBlockSetting($block_id, 'filter_magazine', '1') ? 'magazine' : null, |
|
89 | - $this->getBlockSetting($block_id, 'filter_manuscript', '1') ? 'manuscript' : null, |
|
90 | - $this->getBlockSetting($block_id, 'filter_map', '1') ? 'map' : null, |
|
91 | - $this->getBlockSetting($block_id, 'filter_newspaper', '1') ? 'newspaper' : null, |
|
92 | - $this->getBlockSetting($block_id, 'filter_other', '1') ? 'other' : null, |
|
93 | - $this->getBlockSetting($block_id, 'filter_painting', '1') ? 'painting' : null, |
|
94 | - $this->getBlockSetting($block_id, 'filter_photo', '1') ? 'photo' : null, |
|
95 | - $this->getBlockSetting($block_id, 'filter_tombstone', '1') ? 'tombstone' : null, |
|
96 | - $this->getBlockSetting($block_id, 'filter_video', '0') ? 'video' : null, |
|
97 | - ))->fetchOneColumn(); |
|
58 | + // We can apply the filters using SQL |
|
59 | + // Do not use "ORDER BY RAND()" - it is very slow on large tables. Use PHP::array_rand() instead. |
|
60 | + $all_media = Database::prepare( |
|
61 | + "SELECT m_id FROM `##media`" . |
|
62 | + " WHERE m_file = ?" . |
|
63 | + " AND m_ext IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')" . |
|
64 | + " AND m_type IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')" |
|
65 | + )->execute(array( |
|
66 | + $WT_TREE->getTreeId(), |
|
67 | + $this->getBlockSetting($block_id, 'filter_avi', '0') ? 'avi' : null, |
|
68 | + $this->getBlockSetting($block_id, 'filter_bmp', '1') ? 'bmp' : null, |
|
69 | + $this->getBlockSetting($block_id, 'filter_gif', '1') ? 'gif' : null, |
|
70 | + $this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpg' : null, |
|
71 | + $this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpeg' : null, |
|
72 | + $this->getBlockSetting($block_id, 'filter_mp3', '0') ? 'mp3' : null, |
|
73 | + $this->getBlockSetting($block_id, 'filter_ole', '1') ? 'ole' : null, |
|
74 | + $this->getBlockSetting($block_id, 'filter_pcx', '1') ? 'pcx' : null, |
|
75 | + $this->getBlockSetting($block_id, 'filter_pdf', '0') ? 'pdf' : null, |
|
76 | + $this->getBlockSetting($block_id, 'filter_png', '1') ? 'png' : null, |
|
77 | + $this->getBlockSetting($block_id, 'filter_tiff', '1') ? 'tiff' : null, |
|
78 | + $this->getBlockSetting($block_id, 'filter_wav', '0') ? 'wav' : null, |
|
79 | + $this->getBlockSetting($block_id, 'filter_audio', '0') ? 'audio' : null, |
|
80 | + $this->getBlockSetting($block_id, 'filter_book', '1') ? 'book' : null, |
|
81 | + $this->getBlockSetting($block_id, 'filter_card', '1') ? 'card' : null, |
|
82 | + $this->getBlockSetting($block_id, 'filter_certificate', '1') ? 'certificate' : null, |
|
83 | + $this->getBlockSetting($block_id, 'filter_coat', '1') ? 'coat' : null, |
|
84 | + $this->getBlockSetting($block_id, 'filter_document', '1') ? 'document' : null, |
|
85 | + $this->getBlockSetting($block_id, 'filter_electronic', '1') ? 'electronic' : null, |
|
86 | + $this->getBlockSetting($block_id, 'filter_fiche', '1') ? 'fiche' : null, |
|
87 | + $this->getBlockSetting($block_id, 'filter_film', '1') ? 'film' : null, |
|
88 | + $this->getBlockSetting($block_id, 'filter_magazine', '1') ? 'magazine' : null, |
|
89 | + $this->getBlockSetting($block_id, 'filter_manuscript', '1') ? 'manuscript' : null, |
|
90 | + $this->getBlockSetting($block_id, 'filter_map', '1') ? 'map' : null, |
|
91 | + $this->getBlockSetting($block_id, 'filter_newspaper', '1') ? 'newspaper' : null, |
|
92 | + $this->getBlockSetting($block_id, 'filter_other', '1') ? 'other' : null, |
|
93 | + $this->getBlockSetting($block_id, 'filter_painting', '1') ? 'painting' : null, |
|
94 | + $this->getBlockSetting($block_id, 'filter_photo', '1') ? 'photo' : null, |
|
95 | + $this->getBlockSetting($block_id, 'filter_tombstone', '1') ? 'tombstone' : null, |
|
96 | + $this->getBlockSetting($block_id, 'filter_video', '0') ? 'video' : null, |
|
97 | + ))->fetchOneColumn(); |
|
98 | 98 | |
99 | - // Keep looking through the media until a suitable one is found. |
|
100 | - $random_media = null; |
|
101 | - while ($all_media) { |
|
102 | - $n = array_rand($all_media); |
|
103 | - $media = Media::getInstance($all_media[$n], $WT_TREE); |
|
104 | - if ($media->canShow() && !$media->isExternal()) { |
|
105 | - // Check if it is linked to a suitable individual |
|
106 | - foreach ($media->linkedIndividuals('OBJE') as $indi) { |
|
107 | - if ( |
|
108 | - $filter === 'all' || |
|
109 | - $filter === 'indi' && strpos($indi->getGedcom(), "\n1 OBJE @" . $media->getXref() . '@') !== false || |
|
110 | - $filter === 'event' && strpos($indi->getGedcom(), "\n2 OBJE @" . $media->getXref() . '@') !== false |
|
111 | - ) { |
|
112 | - // Found one :-) |
|
113 | - $random_media = $media; |
|
114 | - break 2; |
|
115 | - } |
|
116 | - } |
|
117 | - } |
|
118 | - unset($all_media[$n]); |
|
119 | - }; |
|
99 | + // Keep looking through the media until a suitable one is found. |
|
100 | + $random_media = null; |
|
101 | + while ($all_media) { |
|
102 | + $n = array_rand($all_media); |
|
103 | + $media = Media::getInstance($all_media[$n], $WT_TREE); |
|
104 | + if ($media->canShow() && !$media->isExternal()) { |
|
105 | + // Check if it is linked to a suitable individual |
|
106 | + foreach ($media->linkedIndividuals('OBJE') as $indi) { |
|
107 | + if ( |
|
108 | + $filter === 'all' || |
|
109 | + $filter === 'indi' && strpos($indi->getGedcom(), "\n1 OBJE @" . $media->getXref() . '@') !== false || |
|
110 | + $filter === 'event' && strpos($indi->getGedcom(), "\n2 OBJE @" . $media->getXref() . '@') !== false |
|
111 | + ) { |
|
112 | + // Found one :-) |
|
113 | + $random_media = $media; |
|
114 | + break 2; |
|
115 | + } |
|
116 | + } |
|
117 | + } |
|
118 | + unset($all_media[$n]); |
|
119 | + }; |
|
120 | 120 | |
121 | - $id = $this->getName() . $block_id; |
|
122 | - $class = $this->getName() . '_block'; |
|
123 | - if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { |
|
124 | - $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; |
|
125 | - } else { |
|
126 | - $title = ''; |
|
127 | - } |
|
128 | - $title .= $this->getTitle(); |
|
121 | + $id = $this->getName() . $block_id; |
|
122 | + $class = $this->getName() . '_block'; |
|
123 | + if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { |
|
124 | + $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; |
|
125 | + } else { |
|
126 | + $title = ''; |
|
127 | + } |
|
128 | + $title .= $this->getTitle(); |
|
129 | 129 | |
130 | - if ($random_media) { |
|
131 | - $content = "<div id=\"random_picture_container$block_id\">"; |
|
132 | - if ($controls) { |
|
133 | - if ($start) { |
|
134 | - $icon_class = 'icon-media-stop'; |
|
135 | - } else { |
|
136 | - $icon_class = 'icon-media-play'; |
|
137 | - } |
|
138 | - $content .= '<div dir="ltr" class="center" id="random_picture_controls' . $block_id . '"><br>'; |
|
139 | - $content .= "<a href=\"#\" onclick=\"togglePlay(); return false;\" id=\"play_stop\" class=\"" . $icon_class . "\" title=\"" . I18N::translate('Play') . "/" . I18N::translate('Stop') . '"></a>'; |
|
140 | - $content .= '<a href="#" onclick="jQuery(\'#block_' . $block_id . '\').load(\'index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '\');return false;" title="' . I18N::translate('Next image') . '" class="icon-media-next"></a>'; |
|
141 | - $content .= '</div><script> |
|
130 | + if ($random_media) { |
|
131 | + $content = "<div id=\"random_picture_container$block_id\">"; |
|
132 | + if ($controls) { |
|
133 | + if ($start) { |
|
134 | + $icon_class = 'icon-media-stop'; |
|
135 | + } else { |
|
136 | + $icon_class = 'icon-media-play'; |
|
137 | + } |
|
138 | + $content .= '<div dir="ltr" class="center" id="random_picture_controls' . $block_id . '"><br>'; |
|
139 | + $content .= "<a href=\"#\" onclick=\"togglePlay(); return false;\" id=\"play_stop\" class=\"" . $icon_class . "\" title=\"" . I18N::translate('Play') . "/" . I18N::translate('Stop') . '"></a>'; |
|
140 | + $content .= '<a href="#" onclick="jQuery(\'#block_' . $block_id . '\').load(\'index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '\');return false;" title="' . I18N::translate('Next image') . '" class="icon-media-next"></a>'; |
|
141 | + $content .= '</div><script> |
|
142 | 142 | var play = false; |
143 | 143 | function togglePlay() { |
144 | 144 | if (play) { |
@@ -163,140 +163,140 @@ discard block |
||
163 | 163 | } |
164 | 164 | } |
165 | 165 | </script>'; |
166 | - } |
|
167 | - if ($start) { |
|
168 | - $content .= '<script>togglePlay();</script>'; |
|
169 | - } |
|
170 | - $content .= '<div class="center" id="random_picture_content' . $block_id . '">'; |
|
171 | - $content .= '<table id="random_picture_box"><tr><td class="details1">'; |
|
172 | - $content .= $random_media->displayImage(); |
|
166 | + } |
|
167 | + if ($start) { |
|
168 | + $content .= '<script>togglePlay();</script>'; |
|
169 | + } |
|
170 | + $content .= '<div class="center" id="random_picture_content' . $block_id . '">'; |
|
171 | + $content .= '<table id="random_picture_box"><tr><td class="details1">'; |
|
172 | + $content .= $random_media->displayImage(); |
|
173 | 173 | |
174 | - $content .= '<br>'; |
|
175 | - $content .= '<a href="' . $random_media->getHtmlUrl() . '"><b>' . $random_media->getFullName() . '</b></a><br>'; |
|
176 | - foreach ($random_media->linkedIndividuals('OBJE') as $individual) { |
|
177 | - $content .= '<a href="' . $individual->getHtmlUrl() . '">' . I18N::translate('View this individual') . ' — ' . $individual->getFullName() . '</a><br>'; |
|
178 | - } |
|
179 | - foreach ($random_media->linkedFamilies('OBJE') as $family) { |
|
180 | - $content .= '<a href="' . $family->getHtmlUrl() . '">' . I18N::translate('View this family') . ' — ' . $family->getFullName() . '</a><br>'; |
|
181 | - } |
|
182 | - foreach ($random_media->linkedSources('OBJE') as $source) { |
|
183 | - $content .= '<a href="' . $source->getHtmlUrl() . '">' . I18N::translate('View this source') . ' — ' . $source->getFullName() . '</a><br>'; |
|
184 | - } |
|
185 | - $content .= '<br><div class="indent">'; |
|
186 | - $content .= FunctionsPrint::printFactNotes($random_media->getGedcom(), "1", false); |
|
187 | - $content .= '</div>'; |
|
188 | - $content .= '</td></tr></table>'; |
|
189 | - $content .= '</div>'; // random_picture_content |
|
190 | - $content .= '</div>'; // random_picture_container |
|
191 | - } else { |
|
192 | - $content = I18N::translate('This family tree has no images to display.'); |
|
193 | - } |
|
194 | - if ($template) { |
|
195 | - return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
196 | - } else { |
|
197 | - return $content; |
|
198 | - } |
|
199 | - } |
|
174 | + $content .= '<br>'; |
|
175 | + $content .= '<a href="' . $random_media->getHtmlUrl() . '"><b>' . $random_media->getFullName() . '</b></a><br>'; |
|
176 | + foreach ($random_media->linkedIndividuals('OBJE') as $individual) { |
|
177 | + $content .= '<a href="' . $individual->getHtmlUrl() . '">' . I18N::translate('View this individual') . ' — ' . $individual->getFullName() . '</a><br>'; |
|
178 | + } |
|
179 | + foreach ($random_media->linkedFamilies('OBJE') as $family) { |
|
180 | + $content .= '<a href="' . $family->getHtmlUrl() . '">' . I18N::translate('View this family') . ' — ' . $family->getFullName() . '</a><br>'; |
|
181 | + } |
|
182 | + foreach ($random_media->linkedSources('OBJE') as $source) { |
|
183 | + $content .= '<a href="' . $source->getHtmlUrl() . '">' . I18N::translate('View this source') . ' — ' . $source->getFullName() . '</a><br>'; |
|
184 | + } |
|
185 | + $content .= '<br><div class="indent">'; |
|
186 | + $content .= FunctionsPrint::printFactNotes($random_media->getGedcom(), "1", false); |
|
187 | + $content .= '</div>'; |
|
188 | + $content .= '</td></tr></table>'; |
|
189 | + $content .= '</div>'; // random_picture_content |
|
190 | + $content .= '</div>'; // random_picture_container |
|
191 | + } else { |
|
192 | + $content = I18N::translate('This family tree has no images to display.'); |
|
193 | + } |
|
194 | + if ($template) { |
|
195 | + return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
196 | + } else { |
|
197 | + return $content; |
|
198 | + } |
|
199 | + } |
|
200 | 200 | |
201 | - /** {@inheritdoc} */ |
|
202 | - public function loadAjax() { |
|
203 | - return true; |
|
204 | - } |
|
201 | + /** {@inheritdoc} */ |
|
202 | + public function loadAjax() { |
|
203 | + return true; |
|
204 | + } |
|
205 | 205 | |
206 | - /** {@inheritdoc} */ |
|
207 | - public function isUserBlock() { |
|
208 | - return true; |
|
209 | - } |
|
206 | + /** {@inheritdoc} */ |
|
207 | + public function isUserBlock() { |
|
208 | + return true; |
|
209 | + } |
|
210 | 210 | |
211 | - /** {@inheritdoc} */ |
|
212 | - public function isGedcomBlock() { |
|
213 | - return true; |
|
214 | - } |
|
211 | + /** {@inheritdoc} */ |
|
212 | + public function isGedcomBlock() { |
|
213 | + return true; |
|
214 | + } |
|
215 | 215 | |
216 | - /** |
|
217 | - * An HTML form to edit block settings |
|
218 | - * |
|
219 | - * @param int $block_id |
|
220 | - */ |
|
221 | - public function configureBlock($block_id) { |
|
222 | - if (Filter::postBool('save') && Filter::checkCsrf()) { |
|
223 | - $this->setBlockSetting($block_id, 'filter', Filter::post('filter', 'indi|event|all', 'all')); |
|
224 | - $this->setBlockSetting($block_id, 'controls', Filter::postBool('controls')); |
|
225 | - $this->setBlockSetting($block_id, 'start', Filter::postBool('start')); |
|
226 | - $this->setBlockSetting($block_id, 'filter_avi', Filter::postBool('filter_avi')); |
|
227 | - $this->setBlockSetting($block_id, 'filter_bmp', Filter::postBool('filter_bmp')); |
|
228 | - $this->setBlockSetting($block_id, 'filter_gif', Filter::postBool('filter_gif')); |
|
229 | - $this->setBlockSetting($block_id, 'filter_jpeg', Filter::postBool('filter_jpeg')); |
|
230 | - $this->setBlockSetting($block_id, 'filter_mp3', Filter::postBool('filter_mp3')); |
|
231 | - $this->setBlockSetting($block_id, 'filter_ole', Filter::postBool('filter_ole')); |
|
232 | - $this->setBlockSetting($block_id, 'filter_pcx', Filter::postBool('filter_pcx')); |
|
233 | - $this->setBlockSetting($block_id, 'filter_pdf', Filter::postBool('filter_pdf')); |
|
234 | - $this->setBlockSetting($block_id, 'filter_png', Filter::postBool('filter_png')); |
|
235 | - $this->setBlockSetting($block_id, 'filter_tiff', Filter::postBool('filter_tiff')); |
|
236 | - $this->setBlockSetting($block_id, 'filter_wav', Filter::postBool('filter_wav')); |
|
237 | - $this->setBlockSetting($block_id, 'filter_audio', Filter::postBool('filter_audio')); |
|
238 | - $this->setBlockSetting($block_id, 'filter_book', Filter::postBool('filter_book')); |
|
239 | - $this->setBlockSetting($block_id, 'filter_card', Filter::postBool('filter_card')); |
|
240 | - $this->setBlockSetting($block_id, 'filter_certificate', Filter::postBool('filter_certificate')); |
|
241 | - $this->setBlockSetting($block_id, 'filter_coat', Filter::postBool('filter_coat')); |
|
242 | - $this->setBlockSetting($block_id, 'filter_document', Filter::postBool('filter_document')); |
|
243 | - $this->setBlockSetting($block_id, 'filter_electronic', Filter::postBool('filter_electronic')); |
|
244 | - $this->setBlockSetting($block_id, 'filter_fiche', Filter::postBool('filter_fiche')); |
|
245 | - $this->setBlockSetting($block_id, 'filter_film', Filter::postBool('filter_film')); |
|
246 | - $this->setBlockSetting($block_id, 'filter_magazine', Filter::postBool('filter_magazine')); |
|
247 | - $this->setBlockSetting($block_id, 'filter_manuscript', Filter::postBool('filter_manuscript')); |
|
248 | - $this->setBlockSetting($block_id, 'filter_map', Filter::postBool('filter_map')); |
|
249 | - $this->setBlockSetting($block_id, 'filter_newspaper', Filter::postBool('filter_newspaper')); |
|
250 | - $this->setBlockSetting($block_id, 'filter_other', Filter::postBool('filter_other')); |
|
251 | - $this->setBlockSetting($block_id, 'filter_painting', Filter::postBool('filter_painting')); |
|
252 | - $this->setBlockSetting($block_id, 'filter_photo', Filter::postBool('filter_photo')); |
|
253 | - $this->setBlockSetting($block_id, 'filter_tombstone', Filter::postBool('filter_tombstone')); |
|
254 | - $this->setBlockSetting($block_id, 'filter_video', Filter::postBool('filter_video')); |
|
255 | - } |
|
216 | + /** |
|
217 | + * An HTML form to edit block settings |
|
218 | + * |
|
219 | + * @param int $block_id |
|
220 | + */ |
|
221 | + public function configureBlock($block_id) { |
|
222 | + if (Filter::postBool('save') && Filter::checkCsrf()) { |
|
223 | + $this->setBlockSetting($block_id, 'filter', Filter::post('filter', 'indi|event|all', 'all')); |
|
224 | + $this->setBlockSetting($block_id, 'controls', Filter::postBool('controls')); |
|
225 | + $this->setBlockSetting($block_id, 'start', Filter::postBool('start')); |
|
226 | + $this->setBlockSetting($block_id, 'filter_avi', Filter::postBool('filter_avi')); |
|
227 | + $this->setBlockSetting($block_id, 'filter_bmp', Filter::postBool('filter_bmp')); |
|
228 | + $this->setBlockSetting($block_id, 'filter_gif', Filter::postBool('filter_gif')); |
|
229 | + $this->setBlockSetting($block_id, 'filter_jpeg', Filter::postBool('filter_jpeg')); |
|
230 | + $this->setBlockSetting($block_id, 'filter_mp3', Filter::postBool('filter_mp3')); |
|
231 | + $this->setBlockSetting($block_id, 'filter_ole', Filter::postBool('filter_ole')); |
|
232 | + $this->setBlockSetting($block_id, 'filter_pcx', Filter::postBool('filter_pcx')); |
|
233 | + $this->setBlockSetting($block_id, 'filter_pdf', Filter::postBool('filter_pdf')); |
|
234 | + $this->setBlockSetting($block_id, 'filter_png', Filter::postBool('filter_png')); |
|
235 | + $this->setBlockSetting($block_id, 'filter_tiff', Filter::postBool('filter_tiff')); |
|
236 | + $this->setBlockSetting($block_id, 'filter_wav', Filter::postBool('filter_wav')); |
|
237 | + $this->setBlockSetting($block_id, 'filter_audio', Filter::postBool('filter_audio')); |
|
238 | + $this->setBlockSetting($block_id, 'filter_book', Filter::postBool('filter_book')); |
|
239 | + $this->setBlockSetting($block_id, 'filter_card', Filter::postBool('filter_card')); |
|
240 | + $this->setBlockSetting($block_id, 'filter_certificate', Filter::postBool('filter_certificate')); |
|
241 | + $this->setBlockSetting($block_id, 'filter_coat', Filter::postBool('filter_coat')); |
|
242 | + $this->setBlockSetting($block_id, 'filter_document', Filter::postBool('filter_document')); |
|
243 | + $this->setBlockSetting($block_id, 'filter_electronic', Filter::postBool('filter_electronic')); |
|
244 | + $this->setBlockSetting($block_id, 'filter_fiche', Filter::postBool('filter_fiche')); |
|
245 | + $this->setBlockSetting($block_id, 'filter_film', Filter::postBool('filter_film')); |
|
246 | + $this->setBlockSetting($block_id, 'filter_magazine', Filter::postBool('filter_magazine')); |
|
247 | + $this->setBlockSetting($block_id, 'filter_manuscript', Filter::postBool('filter_manuscript')); |
|
248 | + $this->setBlockSetting($block_id, 'filter_map', Filter::postBool('filter_map')); |
|
249 | + $this->setBlockSetting($block_id, 'filter_newspaper', Filter::postBool('filter_newspaper')); |
|
250 | + $this->setBlockSetting($block_id, 'filter_other', Filter::postBool('filter_other')); |
|
251 | + $this->setBlockSetting($block_id, 'filter_painting', Filter::postBool('filter_painting')); |
|
252 | + $this->setBlockSetting($block_id, 'filter_photo', Filter::postBool('filter_photo')); |
|
253 | + $this->setBlockSetting($block_id, 'filter_tombstone', Filter::postBool('filter_tombstone')); |
|
254 | + $this->setBlockSetting($block_id, 'filter_video', Filter::postBool('filter_video')); |
|
255 | + } |
|
256 | 256 | |
257 | - $filter = $this->getBlockSetting($block_id, 'filter', 'all'); |
|
258 | - $controls = $this->getBlockSetting($block_id, 'controls', '1'); |
|
259 | - $start = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start'); |
|
257 | + $filter = $this->getBlockSetting($block_id, 'filter', 'all'); |
|
258 | + $controls = $this->getBlockSetting($block_id, 'controls', '1'); |
|
259 | + $start = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start'); |
|
260 | 260 | |
261 | - echo '<tr><td class="descriptionbox wrap width33">'; |
|
262 | - echo /* I18N: Label for a configuration option */ I18N::translate('Show only individuals, events, or all'); |
|
263 | - echo '</td><td class="optionbox">'; |
|
264 | - echo FunctionsEdit::selectEditControl('filter', array('indi' => I18N::translate('Individuals'), 'event' => I18N::translate('Facts and events'), 'all' => I18N::translate('All')), null, $filter, ''); |
|
265 | - echo '</td></tr>'; |
|
261 | + echo '<tr><td class="descriptionbox wrap width33">'; |
|
262 | + echo /* I18N: Label for a configuration option */ I18N::translate('Show only individuals, events, or all'); |
|
263 | + echo '</td><td class="optionbox">'; |
|
264 | + echo FunctionsEdit::selectEditControl('filter', array('indi' => I18N::translate('Individuals'), 'event' => I18N::translate('Facts and events'), 'all' => I18N::translate('All')), null, $filter, ''); |
|
265 | + echo '</td></tr>'; |
|
266 | 266 | |
267 | - $filters = array( |
|
268 | - 'avi' => $this->getBlockSetting($block_id, 'filter_avi', '0'), |
|
269 | - 'bmp' => $this->getBlockSetting($block_id, 'filter_bmp', '1'), |
|
270 | - 'gif' => $this->getBlockSetting($block_id, 'filter_gif', '1'), |
|
271 | - 'jpeg' => $this->getBlockSetting($block_id, 'filter_jpeg', '1'), |
|
272 | - 'mp3' => $this->getBlockSetting($block_id, 'filter_mp3', '0'), |
|
273 | - 'ole' => $this->getBlockSetting($block_id, 'filter_ole', '1'), |
|
274 | - 'pcx' => $this->getBlockSetting($block_id, 'filter_pcx', '1'), |
|
275 | - 'pdf' => $this->getBlockSetting($block_id, 'filter_pdf', '0'), |
|
276 | - 'png' => $this->getBlockSetting($block_id, 'filter_png', '1'), |
|
277 | - 'tiff' => $this->getBlockSetting($block_id, 'filter_tiff', '1'), |
|
278 | - 'wav' => $this->getBlockSetting($block_id, 'filter_wav', '0'), |
|
279 | - 'audio' => $this->getBlockSetting($block_id, 'filter_audio', '0'), |
|
280 | - 'book' => $this->getBlockSetting($block_id, 'filter_book', '1'), |
|
281 | - 'card' => $this->getBlockSetting($block_id, 'filter_card', '1'), |
|
282 | - 'certificate' => $this->getBlockSetting($block_id, 'filter_certificate', '1'), |
|
283 | - 'coat' => $this->getBlockSetting($block_id, 'filter_coat', '1'), |
|
284 | - 'document' => $this->getBlockSetting($block_id, 'filter_document', '1'), |
|
285 | - 'electronic' => $this->getBlockSetting($block_id, 'filter_electronic', '1'), |
|
286 | - 'fiche' => $this->getBlockSetting($block_id, 'filter_fiche', '1'), |
|
287 | - 'film' => $this->getBlockSetting($block_id, 'filter_film', '1'), |
|
288 | - 'magazine' => $this->getBlockSetting($block_id, 'filter_magazine', '1'), |
|
289 | - 'manuscript' => $this->getBlockSetting($block_id, 'filter_manuscript', '1'), |
|
290 | - 'map' => $this->getBlockSetting($block_id, 'filter_map', '1'), |
|
291 | - 'newspaper' => $this->getBlockSetting($block_id, 'filter_newspaper', '1'), |
|
292 | - 'other' => $this->getBlockSetting($block_id, 'filter_other', '1'), |
|
293 | - 'painting' => $this->getBlockSetting($block_id, 'filter_painting', '1'), |
|
294 | - 'photo' => $this->getBlockSetting($block_id, 'filter_photo', '1'), |
|
295 | - 'tombstone' => $this->getBlockSetting($block_id, 'filter_tombstone', '1'), |
|
296 | - 'video' => $this->getBlockSetting($block_id, 'filter_video', '0'), |
|
297 | - ); |
|
267 | + $filters = array( |
|
268 | + 'avi' => $this->getBlockSetting($block_id, 'filter_avi', '0'), |
|
269 | + 'bmp' => $this->getBlockSetting($block_id, 'filter_bmp', '1'), |
|
270 | + 'gif' => $this->getBlockSetting($block_id, 'filter_gif', '1'), |
|
271 | + 'jpeg' => $this->getBlockSetting($block_id, 'filter_jpeg', '1'), |
|
272 | + 'mp3' => $this->getBlockSetting($block_id, 'filter_mp3', '0'), |
|
273 | + 'ole' => $this->getBlockSetting($block_id, 'filter_ole', '1'), |
|
274 | + 'pcx' => $this->getBlockSetting($block_id, 'filter_pcx', '1'), |
|
275 | + 'pdf' => $this->getBlockSetting($block_id, 'filter_pdf', '0'), |
|
276 | + 'png' => $this->getBlockSetting($block_id, 'filter_png', '1'), |
|
277 | + 'tiff' => $this->getBlockSetting($block_id, 'filter_tiff', '1'), |
|
278 | + 'wav' => $this->getBlockSetting($block_id, 'filter_wav', '0'), |
|
279 | + 'audio' => $this->getBlockSetting($block_id, 'filter_audio', '0'), |
|
280 | + 'book' => $this->getBlockSetting($block_id, 'filter_book', '1'), |
|
281 | + 'card' => $this->getBlockSetting($block_id, 'filter_card', '1'), |
|
282 | + 'certificate' => $this->getBlockSetting($block_id, 'filter_certificate', '1'), |
|
283 | + 'coat' => $this->getBlockSetting($block_id, 'filter_coat', '1'), |
|
284 | + 'document' => $this->getBlockSetting($block_id, 'filter_document', '1'), |
|
285 | + 'electronic' => $this->getBlockSetting($block_id, 'filter_electronic', '1'), |
|
286 | + 'fiche' => $this->getBlockSetting($block_id, 'filter_fiche', '1'), |
|
287 | + 'film' => $this->getBlockSetting($block_id, 'filter_film', '1'), |
|
288 | + 'magazine' => $this->getBlockSetting($block_id, 'filter_magazine', '1'), |
|
289 | + 'manuscript' => $this->getBlockSetting($block_id, 'filter_manuscript', '1'), |
|
290 | + 'map' => $this->getBlockSetting($block_id, 'filter_map', '1'), |
|
291 | + 'newspaper' => $this->getBlockSetting($block_id, 'filter_newspaper', '1'), |
|
292 | + 'other' => $this->getBlockSetting($block_id, 'filter_other', '1'), |
|
293 | + 'painting' => $this->getBlockSetting($block_id, 'filter_painting', '1'), |
|
294 | + 'photo' => $this->getBlockSetting($block_id, 'filter_photo', '1'), |
|
295 | + 'tombstone' => $this->getBlockSetting($block_id, 'filter_tombstone', '1'), |
|
296 | + 'video' => $this->getBlockSetting($block_id, 'filter_video', '0'), |
|
297 | + ); |
|
298 | 298 | |
299 | - ?> |
|
299 | + ?> |
|
300 | 300 | <tr> |
301 | 301 | <td class="descriptionbox wrap width33"> |
302 | 302 | <?php echo I18N::translate('Filter'); ?> |
@@ -385,19 +385,19 @@ discard block |
||
385 | 385 | <table class="width100"> |
386 | 386 | <tr> |
387 | 387 | <?php |
388 | - //-- Build the list of checkboxes |
|
389 | - $i = 0; |
|
390 | - foreach (GedcomTag::getFileFormTypes() as $typeName => $typeValue) { |
|
391 | - $i++; |
|
392 | - if ($i > 3) { |
|
393 | - $i = 1; |
|
394 | - echo '</tr><tr>'; |
|
395 | - } |
|
396 | - echo '<td class="width33"><label><input type="checkbox" value="yes" name="filter_' . $typeName . '" '; |
|
397 | - echo $filters[$typeName] ? 'checked' : ''; |
|
398 | - echo '> ' . $typeValue . '</label></td>'; |
|
399 | - } |
|
400 | - ?> |
|
388 | + //-- Build the list of checkboxes |
|
389 | + $i = 0; |
|
390 | + foreach (GedcomTag::getFileFormTypes() as $typeName => $typeValue) { |
|
391 | + $i++; |
|
392 | + if ($i > 3) { |
|
393 | + $i = 1; |
|
394 | + echo '</tr><tr>'; |
|
395 | + } |
|
396 | + echo '<td class="width33"><label><input type="checkbox" value="yes" name="filter_' . $typeName . '" '; |
|
397 | + echo $filters[$typeName] ? 'checked' : ''; |
|
398 | + echo '> ' . $typeValue . '</label></td>'; |
|
399 | + } |
|
400 | + ?> |
|
401 | 401 | </tr> |
402 | 402 | </table> |
403 | 403 | </td> |
@@ -405,16 +405,16 @@ discard block |
||
405 | 405 | |
406 | 406 | <?php |
407 | 407 | |
408 | - echo '<tr><td class="descriptionbox wrap width33">'; |
|
409 | - echo /* I18N: Label for a configuration option */ I18N::translate('Show slide show controls'); |
|
410 | - echo '</td><td class="optionbox">'; |
|
411 | - echo FunctionsEdit::editFieldYesNo('controls', $controls); |
|
412 | - echo '</td></tr>'; |
|
408 | + echo '<tr><td class="descriptionbox wrap width33">'; |
|
409 | + echo /* I18N: Label for a configuration option */ I18N::translate('Show slide show controls'); |
|
410 | + echo '</td><td class="optionbox">'; |
|
411 | + echo FunctionsEdit::editFieldYesNo('controls', $controls); |
|
412 | + echo '</td></tr>'; |
|
413 | 413 | |
414 | - echo '<tr><td class="descriptionbox wrap width33">'; |
|
415 | - echo /* I18N: Label for a configuration option */ I18N::translate('Start slide show on page load'); |
|
416 | - echo '</td><td class="optionbox">'; |
|
417 | - echo FunctionsEdit::editFieldYesNo('start', $start); |
|
418 | - echo '</td></tr>'; |
|
419 | - } |
|
414 | + echo '<tr><td class="descriptionbox wrap width33">'; |
|
415 | + echo /* I18N: Label for a configuration option */ I18N::translate('Start slide show on page load'); |
|
416 | + echo '</td><td class="optionbox">'; |
|
417 | + echo FunctionsEdit::editFieldYesNo('start', $start); |
|
418 | + echo '</td></tr>'; |
|
419 | + } |
|
420 | 420 | } |
@@ -28,14 +28,17 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * Class SlideShowModule |
30 | 30 | */ |
31 | -class SlideShowModule extends AbstractModule implements ModuleBlockInterface { |
|
31 | +class SlideShowModule extends AbstractModule implements ModuleBlockInterface |
|
32 | +{ |
|
32 | 33 | /** {@inheritdoc} */ |
33 | - public function getTitle() { |
|
34 | + public function getTitle() |
|
35 | + { |
|
34 | 36 | return /* I18N: Name of a module */ I18N::translate('Slide show'); |
35 | 37 | } |
36 | 38 | |
37 | 39 | /** {@inheritdoc} */ |
38 | - public function getDescription() { |
|
40 | + public function getDescription() |
|
41 | + { |
|
39 | 42 | return /* I18N: Description of the “Slide show” module */ I18N::translate('Random images from the current family tree.'); |
40 | 43 | } |
41 | 44 | |
@@ -48,7 +51,8 @@ discard block |
||
48 | 51 | * |
49 | 52 | * @return string |
50 | 53 | */ |
51 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
54 | + public function getBlock($block_id, $template = true, $cfg = array()) |
|
55 | + { |
|
52 | 56 | global $ctype, $WT_TREE; |
53 | 57 | |
54 | 58 | $filter = $this->getBlockSetting($block_id, 'filter', 'all'); |
@@ -199,17 +203,20 @@ discard block |
||
199 | 203 | } |
200 | 204 | |
201 | 205 | /** {@inheritdoc} */ |
202 | - public function loadAjax() { |
|
206 | + public function loadAjax() |
|
207 | + { |
|
203 | 208 | return true; |
204 | 209 | } |
205 | 210 | |
206 | 211 | /** {@inheritdoc} */ |
207 | - public function isUserBlock() { |
|
212 | + public function isUserBlock() |
|
213 | + { |
|
208 | 214 | return true; |
209 | 215 | } |
210 | 216 | |
211 | 217 | /** {@inheritdoc} */ |
212 | - public function isGedcomBlock() { |
|
218 | + public function isGedcomBlock() |
|
219 | + { |
|
213 | 220 | return true; |
214 | 221 | } |
215 | 222 | |
@@ -218,7 +225,8 @@ discard block |
||
218 | 225 | * |
219 | 226 | * @param int $block_id |
220 | 227 | */ |
221 | - public function configureBlock($block_id) { |
|
228 | + public function configureBlock($block_id) |
|
229 | + { |
|
222 | 230 | if (Filter::postBool('save') && Filter::checkCsrf()) { |
223 | 231 | $this->setBlockSetting($block_id, 'filter', Filter::post('filter', 'indi|event|all', 'all')); |
224 | 232 | $this->setBlockSetting($block_id, 'controls', Filter::postBool('controls')); |
@@ -24,61 +24,61 @@ |
||
24 | 24 | * Class FanChartModule |
25 | 25 | */ |
26 | 26 | class FanChartModule extends AbstractModule implements ModuleChartInterface { |
27 | - /** |
|
28 | - * How should this module be labelled on tabs, menus, etc.? |
|
29 | - * |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public function getTitle() { |
|
33 | - return /* I18N: Name of a module/chart */ I18N::translate('Fan chart'); |
|
34 | - } |
|
27 | + /** |
|
28 | + * How should this module be labelled on tabs, menus, etc.? |
|
29 | + * |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public function getTitle() { |
|
33 | + return /* I18N: Name of a module/chart */ I18N::translate('Fan chart'); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * A sentence describing what this module does. |
|
38 | - * |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public function getDescription() { |
|
42 | - return /* I18N: Description of the “Fan Chart” module */ I18N::translate('A fan chart of an individual’s ancestors.'); |
|
43 | - } |
|
36 | + /** |
|
37 | + * A sentence describing what this module does. |
|
38 | + * |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public function getDescription() { |
|
42 | + return /* I18N: Description of the “Fan Chart” module */ I18N::translate('A fan chart of an individual’s ancestors.'); |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * What is the default access level for this module? |
|
47 | - * |
|
48 | - * Some modules are aimed at admins or managers, and are not generally shown to users. |
|
49 | - * |
|
50 | - * @return int |
|
51 | - */ |
|
52 | - public function defaultAccessLevel() { |
|
53 | - return Auth::PRIV_PRIVATE; |
|
54 | - } |
|
45 | + /** |
|
46 | + * What is the default access level for this module? |
|
47 | + * |
|
48 | + * Some modules are aimed at admins or managers, and are not generally shown to users. |
|
49 | + * |
|
50 | + * @return int |
|
51 | + */ |
|
52 | + public function defaultAccessLevel() { |
|
53 | + return Auth::PRIV_PRIVATE; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Return a menu item for this chart. |
|
58 | - * |
|
59 | - * We can only do this if the GD2 library is installed with TrueType support. |
|
60 | - * |
|
61 | - * @return Menu|null |
|
62 | - */ |
|
63 | - public function getChartMenu(Individual $individual) { |
|
64 | - if (function_exists('imagettftext')) { |
|
65 | - return new Menu( |
|
66 | - $this->getTitle(), |
|
67 | - 'fanchart.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), |
|
68 | - 'menu-chart-fanchart', |
|
69 | - array('rel' => 'nofollow') |
|
70 | - ); |
|
71 | - } else { |
|
72 | - return null; |
|
73 | - } |
|
74 | - } |
|
56 | + /** |
|
57 | + * Return a menu item for this chart. |
|
58 | + * |
|
59 | + * We can only do this if the GD2 library is installed with TrueType support. |
|
60 | + * |
|
61 | + * @return Menu|null |
|
62 | + */ |
|
63 | + public function getChartMenu(Individual $individual) { |
|
64 | + if (function_exists('imagettftext')) { |
|
65 | + return new Menu( |
|
66 | + $this->getTitle(), |
|
67 | + 'fanchart.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), |
|
68 | + 'menu-chart-fanchart', |
|
69 | + array('rel' => 'nofollow') |
|
70 | + ); |
|
71 | + } else { |
|
72 | + return null; |
|
73 | + } |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * Return a menu item for this chart - for use in individual boxes. |
|
78 | - * |
|
79 | - * @return Menu|null |
|
80 | - */ |
|
81 | - public function getBoxChartMenu(Individual $individual) { |
|
82 | - return $this->getChartMenu($individual); |
|
83 | - } |
|
76 | + /** |
|
77 | + * Return a menu item for this chart - for use in individual boxes. |
|
78 | + * |
|
79 | + * @return Menu|null |
|
80 | + */ |
|
81 | + public function getBoxChartMenu(Individual $individual) { |
|
82 | + return $this->getChartMenu($individual); |
|
83 | + } |
|
84 | 84 | } |
@@ -23,13 +23,15 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * Class FanChartModule |
25 | 25 | */ |
26 | -class FanChartModule extends AbstractModule implements ModuleChartInterface { |
|
26 | +class FanChartModule extends AbstractModule implements ModuleChartInterface |
|
27 | +{ |
|
27 | 28 | /** |
28 | 29 | * How should this module be labelled on tabs, menus, etc.? |
29 | 30 | * |
30 | 31 | * @return string |
31 | 32 | */ |
32 | - public function getTitle() { |
|
33 | + public function getTitle() |
|
34 | + { |
|
33 | 35 | return /* I18N: Name of a module/chart */ I18N::translate('Fan chart'); |
34 | 36 | } |
35 | 37 | |
@@ -38,7 +40,8 @@ discard block |
||
38 | 40 | * |
39 | 41 | * @return string |
40 | 42 | */ |
41 | - public function getDescription() { |
|
43 | + public function getDescription() |
|
44 | + { |
|
42 | 45 | return /* I18N: Description of the “Fan Chart” module */ I18N::translate('A fan chart of an individual’s ancestors.'); |
43 | 46 | } |
44 | 47 | |
@@ -49,7 +52,8 @@ discard block |
||
49 | 52 | * |
50 | 53 | * @return int |
51 | 54 | */ |
52 | - public function defaultAccessLevel() { |
|
55 | + public function defaultAccessLevel() |
|
56 | + { |
|
53 | 57 | return Auth::PRIV_PRIVATE; |
54 | 58 | } |
55 | 59 | |
@@ -60,7 +64,8 @@ discard block |
||
60 | 64 | * |
61 | 65 | * @return Menu|null |
62 | 66 | */ |
63 | - public function getChartMenu(Individual $individual) { |
|
67 | + public function getChartMenu(Individual $individual) |
|
68 | + { |
|
64 | 69 | if (function_exists('imagettftext')) { |
65 | 70 | return new Menu( |
66 | 71 | $this->getTitle(), |
@@ -78,7 +83,8 @@ discard block |
||
78 | 83 | * |
79 | 84 | * @return Menu|null |
80 | 85 | */ |
81 | - public function getBoxChartMenu(Individual $individual) { |
|
86 | + public function getBoxChartMenu(Individual $individual) |
|
87 | + { |
|
82 | 88 | return $this->getChartMenu($individual); |
83 | 89 | } |
84 | 90 | } |