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