| | 344 | |
| | 345 | |
| | 346 | /** |
| | 347 | * display the config page |
| | 348 | * |
| | 349 | */ |
| | 350 | protected function displayConfig() |
| | 351 | { |
| | 352 | global $template; |
| | 353 | |
| | 354 | $this->updateConfig(); |
| | 355 | $this->configForTemplate(); |
| | 356 | |
| | 357 | $template->set_filename('body_page', |
| | 358 | dirname($this->getFileLocation()).'/admin/gmaps_config.tpl'); |
| | 359 | |
| | 360 | $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page'); |
| | 361 | } |
| | 362 | |
| | 363 | /** |
| | 364 | * update config values |
| | 365 | */ |
| | 366 | protected function updateConfig() |
| | 367 | { |
| | 368 | global $infos; |
| | 369 | |
| | 370 | if(!isset($_POST) or count($_POST)==0) return(false); |
| | 371 | |
| | 372 | |
| | 373 | if(isset($_POST['fBDPopupAutomaticSize']) and $_POST['fBDPopupAutomaticSize']>=0.5 and $_POST['fBDPopupAutomaticSize']<=0.95) |
| | 374 | { |
| | 375 | $this->config['popupAutomaticSize']=$_POST['fBDPopupAutomaticSize']; |
| | 376 | } |
| | 377 | else |
| | 378 | { |
| | 379 | return(false); |
| | 380 | } |
| | 381 | |
| | 382 | if($this->saveConfig()) |
| | 383 | { |
| | 384 | $this->displayResult(l10n('gmaps_config_saved'), true); |
| | 385 | return(true); |
| | 386 | } |
| | 387 | return(false); |
| | 388 | } |
| | 389 | |
| | 390 | |
| | 391 | |
| | 392 | |
| | 393 | |
| | 394 | |
| | 395 | |
| 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 | | |