[7054] | 1 | <?php |
---|
| 2 | /* ----------------------------------------------------------------------------- |
---|
| 3 | Plugin : GMaps |
---|
| 4 | Author : Grum |
---|
| 5 | email : grum@piwigo.org |
---|
| 6 | website : http://photos.grum.fr |
---|
| 7 | |
---|
| 8 | << May the Little SpaceFrog be with you ! >> |
---|
| 9 | ------------------------------------------------------------------------------ |
---|
| 10 | See main.inc.php for release information |
---|
| 11 | |
---|
| 12 | GMaps_AIP : classe to manage plugin admin pages |
---|
| 13 | |
---|
| 14 | --------------------------------------------------------------------------- */ |
---|
| 15 | |
---|
| 16 | include_once('gmaps_root.class.inc.php'); |
---|
| 17 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php'); |
---|
| 18 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTabSheet.class.inc.php'); |
---|
[7177] | 19 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php'); |
---|
[7054] | 20 | include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); |
---|
| 21 | |
---|
| 22 | class GMaps_AIP extends GMaps_root |
---|
| 23 | { |
---|
| 24 | protected $tabsheet; |
---|
[7125] | 25 | protected $amdState; |
---|
[7054] | 26 | |
---|
| 27 | public function __construct($prefixeTable, $filelocation) |
---|
| 28 | { |
---|
| 29 | parent::__construct($prefixeTable, $filelocation); |
---|
[7139] | 30 | |
---|
[7054] | 31 | $this->loadConfig(); |
---|
| 32 | $this->configForTemplate(); |
---|
[7125] | 33 | |
---|
| 34 | $this->amdState=GMaps_root::checkAMDActivated(); |
---|
| 35 | |
---|
| 36 | $this->initRequest(); |
---|
[7054] | 37 | $this->initEvents(); |
---|
| 38 | |
---|
| 39 | $this->tabsheet = new tabsheet(); |
---|
[7125] | 40 | |
---|
| 41 | if($this->amdState!='advanced') |
---|
| 42 | { |
---|
| 43 | $this->tabsheet->add('amd_warning', |
---|
| 44 | l10n('gmaps_warning'), |
---|
| 45 | $this->getAdminLink()."&fGMaps_tabsheet=amd_warning"); |
---|
| 46 | } |
---|
[7054] | 47 | $this->tabsheet->add('maps', |
---|
| 48 | l10n('gmaps_maps'), |
---|
| 49 | $this->getAdminLink()."&fGMaps_tabsheet=maps"); |
---|
| 50 | $this->tabsheet->add('category_maps', |
---|
| 51 | l10n('gmaps_associate_category_maps'), |
---|
| 52 | $this->getAdminLink()."&fGMaps_tabsheet=category_maps"); |
---|
[7125] | 53 | $this->tabsheet->add('kml_files', |
---|
| 54 | l10n('gmaps_kml_files_management'), |
---|
[7132] | 55 | $this->getAdminLink()."&fGMaps_tabsheet=kml_files"); |
---|
[7125] | 56 | $this->tabsheet->add('search', |
---|
| 57 | l10n('gmaps_search'), |
---|
| 58 | $this->getAdminLink()."&fGMaps_tabsheet=search"); |
---|
[7308] | 59 | $this->tabsheet->add('config', |
---|
| 60 | l10n('gmaps_config'), |
---|
| 61 | $this->getAdminLink()."&fGMaps_tabsheet=config"); |
---|
| 62 | |
---|
[7128] | 63 | /* $this->tabsheet->add('help', |
---|
[7054] | 64 | l10n('gmaps_help'), |
---|
| 65 | $this->getAdminLink()."&fGMaps_tabsheet=help"); |
---|
[7125] | 66 | */ |
---|
[7054] | 67 | } |
---|
| 68 | |
---|
| 69 | public function __destruct() |
---|
| 70 | { |
---|
| 71 | unset($this->tabsheet); |
---|
| 72 | parent::__destruct(); |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | /** |
---|
| 76 | * initialize events call for the plugin |
---|
| 77 | */ |
---|
| 78 | public function initEvents() |
---|
| 79 | { |
---|
[7128] | 80 | parent::initEvents(); |
---|
| 81 | |
---|
| 82 | if($_REQUEST['fGMaps_tabsheet']=='search') |
---|
| 83 | { |
---|
| 84 | // load request builder JS only on the search page |
---|
| 85 | GPCRequestBuilder::loadJSandCSS(); |
---|
| 86 | } |
---|
[7054] | 87 | add_event_handler('loc_end_page_header', array(&$this->css, 'applyCSS')); |
---|
| 88 | GPCCss::applyGpcCss(); |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | /** |
---|
| 92 | * display the administration page |
---|
| 93 | */ |
---|
| 94 | public function manage() |
---|
| 95 | { |
---|
| 96 | global $template; |
---|
| 97 | |
---|
[7616] | 98 | $this->cleanCache(); |
---|
[7054] | 99 | $this->initRequest(); |
---|
| 100 | |
---|
| 101 | $template->set_filename('plugin_admin_content', dirname(__FILE__)."/admin/gmaps_admin.tpl"); |
---|
| 102 | |
---|
| 103 | switch($_REQUEST['fGMaps_tabsheet']) |
---|
| 104 | { |
---|
[7125] | 105 | case 'amd_warning': |
---|
| 106 | $this->displayAmdWarning(); |
---|
| 107 | break; |
---|
[7054] | 108 | case 'maps': |
---|
| 109 | $this->displayMaps(); |
---|
| 110 | break; |
---|
| 111 | case 'category_maps': |
---|
| 112 | $this->displayCategoryMaps(); |
---|
| 113 | break; |
---|
[7125] | 114 | case 'kml_files': |
---|
| 115 | $this->displayKmlFiles(); |
---|
| 116 | break; |
---|
| 117 | case 'search': |
---|
| 118 | $this->displaySearch(); |
---|
| 119 | break; |
---|
[7308] | 120 | case 'config': |
---|
| 121 | $this->displayConfig(); |
---|
| 122 | break; |
---|
[7054] | 123 | case 'help': |
---|
| 124 | $this->displayHelp(); |
---|
| 125 | break; |
---|
| 126 | } |
---|
| 127 | |
---|
| 128 | $this->tabsheet->select($_REQUEST['fGMaps_tabsheet']); |
---|
| 129 | $this->tabsheet->assign(); |
---|
| 130 | $selected_tab=$this->tabsheet->get_selected(); |
---|
| 131 | $template->assign($this->tabsheet->get_titlename(), "[".$selected_tab['caption']."]"); |
---|
| 132 | |
---|
| 133 | $template_plugin["GMAPS_VERSION"] = "<i>".$this->getPluginName()."</i> ".l10n('gmaps_release').GMAPS_VERSION; |
---|
| 134 | $template_plugin["GMAPS_PAGE"] = $_REQUEST['fGMaps_tabsheet']; |
---|
| 135 | $template_plugin["GMAPS_TITLE"] = ""; |
---|
| 136 | |
---|
| 137 | $template->assign('plugin', $template_plugin); |
---|
[7132] | 138 | |
---|
| 139 | if($_REQUEST['errcode']!='') |
---|
| 140 | { |
---|
| 141 | $template->assign('errcode', l10n('gmaps_error_code_'.$_REQUEST['errcode'])); |
---|
| 142 | } |
---|
| 143 | |
---|
[7054] | 144 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
| 145 | |
---|
| 146 | } |
---|
| 147 | |
---|
| 148 | |
---|
| 149 | |
---|
| 150 | |
---|
| 151 | /** |
---|
| 152 | * if empty, initialize the $_REQUEST var |
---|
| 153 | * |
---|
| 154 | * if not empty, check validity for the request values |
---|
| 155 | * |
---|
| 156 | */ |
---|
| 157 | private function initRequest() |
---|
| 158 | { |
---|
| 159 | //initialise $REQUEST values if not defined |
---|
| 160 | |
---|
[7132] | 161 | if(!isset($_REQUEST['errcode'])) $_REQUEST['errcode']=''; |
---|
| 162 | |
---|
[7054] | 163 | if(!isset($_REQUEST['fGMaps_tabsheet'])) |
---|
| 164 | { |
---|
[7177] | 165 | if($this->amdState!='advanced' ) |
---|
| 166 | { |
---|
| 167 | $_REQUEST['fGMaps_tabsheet']="amd_warning"; |
---|
| 168 | } |
---|
| 169 | else |
---|
| 170 | { |
---|
| 171 | $_REQUEST['fGMaps_tabsheet']="maps"; |
---|
| 172 | } |
---|
[7054] | 173 | } |
---|
| 174 | |
---|
| 175 | if(!($_REQUEST['fGMaps_tabsheet']!="maps" or |
---|
[7125] | 176 | $_REQUEST['fGMaps_tabsheet']!="category_maps" or |
---|
[7177] | 177 | $_REQUEST['fGMaps_tabsheet']!="amd_warning" or |
---|
| 178 | $_REQUEST['fGMaps_tabsheet']!="kml_files" or |
---|
| 179 | $_REQUEST['fGMaps_tabsheet']!="search" |
---|
[7125] | 180 | //$_REQUEST['fGMaps_tabsheet']!="help" |
---|
| 181 | )) $_REQUEST['fGMaps_tabsheet']="maps"; |
---|
| 182 | |
---|
| 183 | if($_REQUEST['fGMaps_tabsheet']=="amd_warning" and $this->amdState=='advanced') $_REQUEST['fGMaps_tabsheet']="maps"; |
---|
[7054] | 184 | } |
---|
| 185 | |
---|
| 186 | |
---|
| 187 | |
---|
| 188 | |
---|
| 189 | |
---|
| 190 | /** |
---|
| 191 | * display de maps page |
---|
| 192 | * |
---|
| 193 | */ |
---|
| 194 | protected function displayMaps() |
---|
| 195 | { |
---|
| 196 | global $template; |
---|
| 197 | |
---|
| 198 | $template->set_filename('body_page', |
---|
| 199 | dirname($this->getFileLocation()).'/admin/gmaps_maps.tpl'); |
---|
| 200 | |
---|
| 201 | $mapTabsheet = new GPCTabSheet('mapTabsheet', $this->tabsheet->get_titlename(), 'tabsheet2 gcBorder', 'itab2'); |
---|
| 202 | $mapTabsheet->add('general', |
---|
| 203 | l10n('gmaps_properties_general'), |
---|
[7125] | 204 | '', true, "udm.displayTab('general');"); |
---|
[7054] | 205 | $mapTabsheet->add('dimensions', |
---|
| 206 | l10n('gmaps_dimensions'), |
---|
[7125] | 207 | '', false, "udm.displayTab('dimensions');"); |
---|
[7054] | 208 | $mapTabsheet->add('mapType', |
---|
| 209 | l10n('gmaps_properties_mapType'), |
---|
[7125] | 210 | '', false, "udm.displayTab('mapType');"); |
---|
[7054] | 211 | $mapTabsheet->add('zoomLevel', |
---|
| 212 | l10n('gmaps_properties_zoomLevel'), |
---|
[7125] | 213 | '', false, "udm.displayTab('zoomLevel');"); |
---|
[7054] | 214 | $mapTabsheet->assign(); |
---|
| 215 | |
---|
| 216 | |
---|
| 217 | $datas=Array( |
---|
| 218 | 'urlRequest' => $this->getAdminLink('ajax') |
---|
| 219 | ); |
---|
| 220 | $template->assign('datas', $datas); |
---|
| 221 | |
---|
| 222 | $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page'); |
---|
| 223 | } |
---|
| 224 | |
---|
| 225 | |
---|
| 226 | /** |
---|
| 227 | * display the category_maps page |
---|
| 228 | * |
---|
| 229 | */ |
---|
| 230 | protected function displayCategoryMaps() |
---|
| 231 | { |
---|
| 232 | global $template; |
---|
| 233 | |
---|
[7176] | 234 | GPCCore::addHeaderCSS('iconSelector', 'plugins/GrumPluginClasses/css/iconSelector_'.$template->get_themeconf('name').'.css'); |
---|
| 235 | GPCCore::addHeaderCSS('categorySelector', 'plugins/GrumPluginClasses/css/categorySelector_'.$template->get_themeconf('name').'.css'); |
---|
| 236 | |
---|
[7125] | 237 | $template->set_filename('body_page', |
---|
| 238 | dirname($this->getFileLocation()).'/admin/gmaps_category_maps.tpl'); |
---|
| 239 | |
---|
| 240 | $mapTabsheet = new GPCTabSheet('mapTabsheet', $this->tabsheet->get_titlename(), 'tabsheet2 gcBorder', 'itab2'); |
---|
| 241 | $mapTabsheet->add('assoc', |
---|
| 242 | l10n('gmaps_map_assoc'), |
---|
| 243 | '', false, "am.displayTab('assoc');"); |
---|
| 244 | $mapTabsheet->add('integration', |
---|
| 245 | l10n('gmaps_map_integration'), |
---|
| 246 | '', true, "am.displayTab('integration');"); |
---|
| 247 | $mapTabsheet->assign(); |
---|
| 248 | |
---|
| 249 | |
---|
| 250 | $datas=Array( |
---|
| 251 | 'urlRequest' => $this->getAdminLink('ajax'), |
---|
[7139] | 252 | 'cats' => $this->makeCategoryList(), |
---|
[7125] | 253 | 'maps' => $this->makeMapsList(), |
---|
| 254 | 'icons' => $this->makeIconsList(), |
---|
[7139] | 255 | 'markers' => $this->makeMarkersList(), |
---|
[7132] | 256 | 'kmlFiles' => $this->makeKmlFilesList() |
---|
[7125] | 257 | ); |
---|
| 258 | $template->assign('datas', $datas); |
---|
| 259 | |
---|
| 260 | $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page'); |
---|
| 261 | } |
---|
| 262 | |
---|
| 263 | |
---|
| 264 | /** |
---|
| 265 | * display the kml file management page |
---|
| 266 | * |
---|
| 267 | */ |
---|
| 268 | protected function displayKmlFiles() |
---|
| 269 | { |
---|
| 270 | global $template; |
---|
| 271 | |
---|
[7132] | 272 | $template->set_filename('body_page', |
---|
| 273 | dirname($this->getFileLocation()).'/admin/gmaps_kmlfiles.tpl'); |
---|
[7054] | 274 | |
---|
[7132] | 275 | $datas=Array( |
---|
| 276 | 'urlRequest' => $this->getAdminLink('ajax'), |
---|
| 277 | ); |
---|
| 278 | $template->assign('datas', $datas); |
---|
[7054] | 279 | |
---|
[7132] | 280 | $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page'); |
---|
[7054] | 281 | } |
---|
| 282 | |
---|
[7125] | 283 | |
---|
| 284 | |
---|
[7054] | 285 | /** |
---|
[7125] | 286 | * display the search page |
---|
| 287 | * |
---|
| 288 | */ |
---|
| 289 | protected function displaySearch() |
---|
| 290 | { |
---|
| 291 | global $template; |
---|
| 292 | |
---|
[7128] | 293 | $template->set_filename('body_page', |
---|
| 294 | dirname($this->getFileLocation()).'/admin/gmaps_search.tpl'); |
---|
[7125] | 295 | |
---|
[7128] | 296 | $template->assign('gmaps_search_page', GPCRequestBuilder::displaySearchPage($this->getPluginName())); |
---|
[7125] | 297 | |
---|
[7128] | 298 | $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page'); |
---|
[7125] | 299 | } |
---|
| 300 | |
---|
| 301 | |
---|
| 302 | /** |
---|
[7054] | 303 | * display the help page |
---|
| 304 | * |
---|
| 305 | */ |
---|
| 306 | protected function displayHelp() |
---|
| 307 | { |
---|
| 308 | global $template; |
---|
| 309 | |
---|
| 310 | /*$template->set_filename('body_page', |
---|
| 311 | dirname($this->getFileLocation()).'/admin/plugin_admin_maps.tpl'); |
---|
| 312 | |
---|
| 313 | |
---|
| 314 | $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page');*/ |
---|
| 315 | } |
---|
| 316 | |
---|
[7125] | 317 | |
---|
| 318 | |
---|
| 319 | /** |
---|
| 320 | * display a warning page if AMD is not installed |
---|
| 321 | * |
---|
| 322 | */ |
---|
| 323 | protected function displayAmdWarning() |
---|
| 324 | { |
---|
| 325 | global $template; |
---|
| 326 | |
---|
| 327 | $template->set_filename('body_page', |
---|
| 328 | dirname($this->getFileLocation()).'/admin/gmaps_amd_warning.tpl'); |
---|
| 329 | |
---|
| 330 | switch(GMaps_root::checkAMDActivated()) |
---|
| 331 | { |
---|
| 332 | case 'none': |
---|
| 333 | case 'inactive': |
---|
[7177] | 334 | $template->assign('gmaps_amd_warning', sprintf(l10n('gmaps_amd_warning_inactive'), GMAPS_AMD_NEEDED)); |
---|
[7125] | 335 | break; |
---|
| 336 | case 'basic': |
---|
[7177] | 337 | $template->assign('gmaps_amd_warning', l10n('gmaps_amd_warning_basic')); |
---|
[7125] | 338 | break; |
---|
| 339 | } |
---|
| 340 | $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page'); |
---|
| 341 | } |
---|
| 342 | |
---|
| 343 | |
---|
[7139] | 344 | |
---|
[7308] | 345 | |
---|
| 346 | |
---|
[7125] | 347 | /** |
---|
[7308] | 348 | * display the config page |
---|
| 349 | * |
---|
| 350 | */ |
---|
| 351 | protected function displayConfig() |
---|
| 352 | { |
---|
| 353 | global $template; |
---|
| 354 | |
---|
| 355 | $this->updateConfig(); |
---|
| 356 | $this->configForTemplate(); |
---|
| 357 | |
---|
| 358 | $template->set_filename('body_page', |
---|
| 359 | dirname($this->getFileLocation()).'/admin/gmaps_config.tpl'); |
---|
| 360 | |
---|
| 361 | $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page'); |
---|
| 362 | } |
---|
| 363 | |
---|
| 364 | /** |
---|
| 365 | * update config values |
---|
| 366 | */ |
---|
| 367 | protected function updateConfig() |
---|
| 368 | { |
---|
| 369 | global $infos; |
---|
| 370 | |
---|
| 371 | if(!isset($_POST) or count($_POST)==0) return(false); |
---|
| 372 | |
---|
| 373 | |
---|
| 374 | if(isset($_POST['fBDPopupAutomaticSize']) and $_POST['fBDPopupAutomaticSize']>=0.5 and $_POST['fBDPopupAutomaticSize']<=0.95) |
---|
| 375 | { |
---|
| 376 | $this->config['popupAutomaticSize']=$_POST['fBDPopupAutomaticSize']; |
---|
| 377 | } |
---|
| 378 | else |
---|
| 379 | { |
---|
| 380 | return(false); |
---|
| 381 | } |
---|
| 382 | |
---|
| 383 | if($this->saveConfig()) |
---|
| 384 | { |
---|
| 385 | $this->displayResult(l10n('gmaps_config_saved'), true); |
---|
| 386 | return(true); |
---|
| 387 | } |
---|
| 388 | return(false); |
---|
| 389 | } |
---|
| 390 | |
---|
| 391 | |
---|
| 392 | |
---|
| 393 | |
---|
| 394 | |
---|
| 395 | |
---|
| 396 | |
---|
| 397 | /** |
---|
[7139] | 398 | * build an ordered category list |
---|
| 399 | * returns an array, each item is an array like : |
---|
| 400 | * 'id' => the category Id |
---|
| 401 | * 'name' => the category name |
---|
| 402 | * 'rank' => the category rank (global) |
---|
| 403 | * 'level' => the category level |
---|
| 404 | * |
---|
| 405 | * @return Array : the list |
---|
[7125] | 406 | */ |
---|
[7139] | 407 | protected function makeCategoryList() |
---|
[7125] | 408 | { |
---|
| 409 | $returned=array( |
---|
| 410 | array( |
---|
[7139] | 411 | 'id' => 0, |
---|
| 412 | 'name' => l10n('gmaps_applyForAllTheGallery'), |
---|
| 413 | 'rank' => '0000', |
---|
| 414 | 'level' => 0, |
---|
| 415 | 'status' => 'public', |
---|
| 416 | 'childs' => false |
---|
[7125] | 417 | ) |
---|
| 418 | ); |
---|
| 419 | |
---|
[7139] | 420 | $sql="SELECT DISTINCT pct.id, pct.name, pct.global_rank AS rank |
---|
| 421 | FROM ".CATEGORIES_TABLE." pct |
---|
| 422 | JOIN ( |
---|
| 423 | SELECT DISTINCT pgat.cat_id AS catId FROM ".GROUP_ACCESS_TABLE." pgat |
---|
| 424 | UNION DISTINCT |
---|
| 425 | SELECT DISTINCT puat.cat_id AS catId FROM ".USER_ACCESS_TABLE." puat |
---|
| 426 | ) pat |
---|
| 427 | ON (pat.catId = pct.id AND pct.status = 'private') OR (pct.status = 'public') |
---|
| 428 | ORDER BY global_rank;"; |
---|
| 429 | $result=pwg_query($sql); |
---|
[7125] | 430 | if($result) |
---|
| 431 | { |
---|
[7139] | 432 | while($row=pwg_db_fetch_assoc($result)) |
---|
[7125] | 433 | { |
---|
[7139] | 434 | $row['level']=1+substr_count($row['rank'], '.'); |
---|
| 435 | $returned[]=$row; |
---|
[7125] | 436 | } |
---|
| 437 | } |
---|
| 438 | |
---|
[7139] | 439 | usort($returned, array(&$this, 'compareCat')); |
---|
| 440 | |
---|
[7125] | 441 | return($returned); |
---|
[7139] | 442 | } |
---|
[7125] | 443 | |
---|
[7139] | 444 | /** |
---|
| 445 | * used for sort comparison |
---|
| 446 | * defined as public, but don't use it directly |
---|
| 447 | * |
---|
| 448 | * this function compare two categorie with their rank value |
---|
| 449 | */ |
---|
| 450 | public function compareCat($catA, $catB) |
---|
| 451 | { |
---|
[7308] | 452 | return(strnatcmp($catA['rank'], $catB['rank'])); |
---|
[7139] | 453 | } |
---|
[7125] | 454 | |
---|
[7139] | 455 | |
---|
[7125] | 456 | /** |
---|
| 457 | * build a maps list |
---|
| 458 | * @return Array : an array, ready to use in the template |
---|
| 459 | */ |
---|
| 460 | private function makeMapsList() |
---|
| 461 | { |
---|
| 462 | $returned=array( |
---|
| 463 | 'IC' => array(), |
---|
| 464 | 'IP' => array(), |
---|
| 465 | 'MP' => array() |
---|
| 466 | ); |
---|
| 467 | |
---|
| 468 | $sql="SELECT id, name, displayType |
---|
| 469 | FROM ".$this->tables['maps']." |
---|
| 470 | ORDER BY displayType, name"; |
---|
| 471 | $result = pwg_query($sql); |
---|
| 472 | if($result) |
---|
| 473 | { |
---|
| 474 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 475 | { |
---|
| 476 | $returned[$row['displayType']][]=array( |
---|
| 477 | 'id' => $row['id'], |
---|
| 478 | 'name' => $row['name'] |
---|
| 479 | ); |
---|
| 480 | } |
---|
| 481 | } |
---|
| 482 | |
---|
| 483 | return($returned); |
---|
[7132] | 484 | } //makeMapsList |
---|
[7125] | 485 | |
---|
| 486 | |
---|
| 487 | /** |
---|
| 488 | * build THE ICON LIST |
---|
| 489 | * @return Array : an array, ready to use in the template |
---|
| 490 | */ |
---|
| 491 | private function makeIconsList() |
---|
| 492 | { |
---|
| 493 | $returned=array(); |
---|
| 494 | |
---|
| 495 | $directory=scandir(GMAPS_PATH.'img/'); |
---|
| 496 | foreach($directory as $file) |
---|
| 497 | { |
---|
| 498 | $ext=(pathinfo($file, PATHINFO_EXTENSION)); |
---|
| 499 | if(preg_match('/^i.*(?:jpg|jpeg|png|gif)$/i', $file)) |
---|
| 500 | { |
---|
| 501 | $returned[]=array( |
---|
| 502 | 'file' => $file |
---|
| 503 | ); |
---|
| 504 | } |
---|
| 505 | } |
---|
| 506 | |
---|
| 507 | return($returned); |
---|
[7132] | 508 | } //makeIconsList |
---|
| 509 | |
---|
| 510 | |
---|
| 511 | /** |
---|
[7139] | 512 | * build the markers list |
---|
| 513 | * @return Array : an array, ready to use in the template |
---|
| 514 | */ |
---|
| 515 | private function makeMarkersList() |
---|
| 516 | { |
---|
| 517 | $returned=array(); |
---|
| 518 | |
---|
| 519 | $directory=scandir(GMAPS_PATH.'img/'); |
---|
| 520 | foreach($directory as $file) |
---|
| 521 | { |
---|
| 522 | $ext=(pathinfo($file, PATHINFO_EXTENSION)); |
---|
| 523 | if(preg_match('/^mS(\d\d)_(\d\d)\.png$/i', $file)) |
---|
| 524 | { |
---|
| 525 | $returned[]=array( |
---|
| 526 | 'file' => $file |
---|
| 527 | ); |
---|
| 528 | } |
---|
| 529 | } |
---|
| 530 | |
---|
| 531 | return($returned); |
---|
| 532 | } //makeIconsList |
---|
| 533 | |
---|
| 534 | /** |
---|
[7132] | 535 | * build the kml files list |
---|
| 536 | * @return Array : an array, ready to use in the template |
---|
| 537 | */ |
---|
| 538 | private function makeKmlFilesList() |
---|
| 539 | { |
---|
| 540 | $returned=array(); |
---|
| 541 | |
---|
| 542 | $sql="SELECT id, name |
---|
| 543 | FROM ".$this->tables['kmlfiles']." |
---|
| 544 | ORDER BY name, id"; |
---|
| 545 | $result = pwg_query($sql); |
---|
| 546 | if($result) |
---|
| 547 | { |
---|
| 548 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 549 | { |
---|
| 550 | $returned[]=$row; |
---|
| 551 | } |
---|
| 552 | } |
---|
| 553 | |
---|
| 554 | return($returned); |
---|
[7125] | 555 | } //makeCategoriesTree |
---|
| 556 | |
---|
[7054] | 557 | } //class |
---|
| 558 | |
---|
| 559 | |
---|
| 560 | ?> |
---|