Changeset 7125 for extensions/GMaps/gmaps_aip.class.inc.php
- Timestamp:
- Oct 7, 2010, 8:04:43 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GMaps/gmaps_aip.class.inc.php
r7054 r7125 22 22 { 23 23 protected $tabsheet; 24 protected $amdState; 24 25 25 26 public function __construct($prefixeTable, $filelocation) … … 28 29 $this->loadConfig(); 29 30 $this->configForTemplate(); 31 32 $this->amdState=GMaps_root::checkAMDActivated(); 33 34 $this->initRequest(); 30 35 $this->initEvents(); 31 36 32 37 $this->tabsheet = new tabsheet(); 38 39 40 if($this->amdState!='advanced') 41 { 42 $this->tabsheet->add('amd_warning', 43 l10n('gmaps_warning'), 44 $this->getAdminLink()."&fGMaps_tabsheet=amd_warning"); 45 } 33 46 $this->tabsheet->add('maps', 34 47 l10n('gmaps_maps'), … … 37 50 l10n('gmaps_associate_category_maps'), 38 51 $this->getAdminLink()."&fGMaps_tabsheet=category_maps"); 52 /* 53 $this->tabsheet->add('kml_files', 54 l10n('gmaps_kml_files_management'), 55 $this->getAdminLink()."&fGMaps_tabsheet=kml_files"); 56 $this->tabsheet->add('search', 57 l10n('gmaps_search'), 58 $this->getAdminLink()."&fGMaps_tabsheet=search"); 39 59 $this->tabsheet->add('help', 40 60 l10n('gmaps_help'), 41 61 $this->getAdminLink()."&fGMaps_tabsheet=help"); 62 */ 42 63 } 43 64 … … 72 93 switch($_REQUEST['fGMaps_tabsheet']) 73 94 { 95 case 'amd_warning': 96 $this->displayAmdWarning(); 97 break; 74 98 case 'maps': 75 99 $this->displayMaps(); … … 77 101 case 'category_maps': 78 102 $this->displayCategoryMaps(); 103 break; 104 case 'kml_files': 105 $this->displayKmlFiles(); 106 break; 107 case 'search': 108 $this->displaySearch(); 79 109 break; 80 110 case 'help': … … 116 146 117 147 if(!($_REQUEST['fGMaps_tabsheet']!="maps" or 118 $_REQUEST['fGMaps_tabsheet']!="category_maps")) $_REQUEST['fGMaps_tabsheet']="maps"; 148 $_REQUEST['fGMaps_tabsheet']!="category_maps" or 149 $_REQUEST['fGMaps_tabsheet']!="amd_warning" 150 //$_REQUEST['fGMaps_tabsheet']!="kml_files" or 151 //$_REQUEST['fGMaps_tabsheet']!="search" or 152 //$_REQUEST['fGMaps_tabsheet']!="help" 153 )) $_REQUEST['fGMaps_tabsheet']="maps"; 154 155 if($_REQUEST['fGMaps_tabsheet']=="amd_warning" and $this->amdState=='advanced') $_REQUEST['fGMaps_tabsheet']="maps"; 119 156 } 120 157 … … 137 174 $mapTabsheet->add('general', 138 175 l10n('gmaps_properties_general'), 139 '', true, "udm.display Prop('general');");176 '', true, "udm.displayTab('general');"); 140 177 $mapTabsheet->add('dimensions', 141 178 l10n('gmaps_dimensions'), 142 '', false, "udm.display Prop('dimensions');");179 '', false, "udm.displayTab('dimensions');"); 143 180 $mapTabsheet->add('mapType', 144 181 l10n('gmaps_properties_mapType'), 145 '', false, "udm.display Prop('mapType');");182 '', false, "udm.displayTab('mapType');"); 146 183 $mapTabsheet->add('zoomLevel', 147 184 l10n('gmaps_properties_zoomLevel'), 148 '', false, "udm.display Prop('zoomLevel');");185 '', false, "udm.displayTab('zoomLevel');"); 149 186 $mapTabsheet->assign(); 150 187 … … 167 204 global $template; 168 205 206 $template->set_filename('body_page', 207 dirname($this->getFileLocation()).'/admin/gmaps_category_maps.tpl'); 208 209 $mapTabsheet = new GPCTabSheet('mapTabsheet', $this->tabsheet->get_titlename(), 'tabsheet2 gcBorder', 'itab2'); 210 $mapTabsheet->add('assoc', 211 l10n('gmaps_map_assoc'), 212 '', false, "am.displayTab('assoc');"); 213 $mapTabsheet->add('integration', 214 l10n('gmaps_map_integration'), 215 '', true, "am.displayTab('integration');"); 216 $mapTabsheet->assign(); 217 218 219 $datas=Array( 220 'urlRequest' => $this->getAdminLink('ajax'), 221 'cats' => $this->makeCategoriesTree(), 222 'maps' => $this->makeMapsList(), 223 'icons' => $this->makeIconsList(), 224 ); 225 $template->assign('datas', $datas); 226 227 $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page'); 228 } 229 230 231 /** 232 * display the kml file management page 233 * 234 */ 235 protected function displayKmlFiles() 236 { 237 global $template; 238 169 239 /*$template->set_filename('body_page', 170 240 dirname($this->getFileLocation()).'/admin/plugin_admin_maps.tpl'); … … 174 244 } 175 245 176 /** 177 * display the help page 178 * 179 */ 180 protected function displayHelp() 246 247 248 /** 249 * display the search page 250 * 251 */ 252 protected function displaySearch() 181 253 { 182 254 global $template; … … 189 261 } 190 262 263 264 /** 265 * display the help page 266 * 267 */ 268 protected function displayHelp() 269 { 270 global $template; 271 272 /*$template->set_filename('body_page', 273 dirname($this->getFileLocation()).'/admin/plugin_admin_maps.tpl'); 274 275 276 $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page');*/ 277 } 278 279 280 281 /** 282 * display a warning page if AMD is not installed 283 * 284 */ 285 protected function displayAmdWarning() 286 { 287 global $template; 288 289 $template->set_filename('body_page', 290 dirname($this->getFileLocation()).'/admin/gmaps_amd_warning.tpl'); 291 292 switch(GMaps_root::checkAMDActivated()) 293 { 294 case 'none': 295 case 'inactive': 296 $template->assign('gmaps_amd_warning_inactive', sprintf(l10n('gmaps_amd_warning_inactive'), GMAPS_AMD_NEEDED)); 297 break; 298 case 'basic': 299 $template->assign('gmaps_amd_warning_basic', l10n('gmaps_amd_warning_basic')); 300 break; 301 } 302 $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page'); 303 } 304 305 306 /** 307 * build the categories tree 308 * @return Array : an array, ready to use in the template 309 */ 310 private function makeCategoriesTree() 311 { 312 $returned=array( 313 array( 314 'id' => 0, 315 'name' => '-- '.l10n('gmaps_applyForAllTheGallery').' --' 316 ) 317 ); 318 319 $sql="SELECT id, name, global_rank 320 FROM ".CATEGORIES_TABLE." 321 ORDER BY global_rank"; 322 $result = pwg_query($sql); 323 if($result) 324 { 325 while ($row = pwg_db_fetch_assoc($result)) 326 { 327 $returned[]=array( 328 'id' => $row['id'], 329 'name' => str_repeat(' ', substr_count($row['global_rank'], '.')).$row['name'] 330 ); 331 } 332 } 333 334 return($returned); 335 } //makeCategoriesTree 336 337 338 /** 339 * build a maps list 340 * @return Array : an array, ready to use in the template 341 */ 342 private function makeMapsList() 343 { 344 $returned=array( 345 'IC' => array(), 346 'IP' => array(), 347 'MP' => array() 348 ); 349 350 $sql="SELECT id, name, displayType 351 FROM ".$this->tables['maps']." 352 ORDER BY displayType, name"; 353 $result = pwg_query($sql); 354 if($result) 355 { 356 while($row = pwg_db_fetch_assoc($result)) 357 { 358 $returned[$row['displayType']][]=array( 359 'id' => $row['id'], 360 'name' => $row['name'] 361 ); 362 } 363 } 364 365 return($returned); 366 } //makeCategoriesTree 367 368 369 /** 370 * build THE ICON LIST 371 * @return Array : an array, ready to use in the template 372 */ 373 private function makeIconsList() 374 { 375 $returned=array(); 376 377 $directory=scandir(GMAPS_PATH.'img/'); 378 foreach($directory as $file) 379 { 380 $ext=(pathinfo($file, PATHINFO_EXTENSION)); 381 if(preg_match('/^i.*(?:jpg|jpeg|png|gif)$/i', $file)) 382 { 383 $returned[]=array( 384 'type' => (strtolower(substr($file,0,1))=='i')?'img':'other', 385 'file' => $file 386 ); 387 } 388 } 389 390 return($returned); 391 } //makeCategoriesTree 392 393 191 394 } //class 192 395
Note: See TracChangeset
for help on using the changeset viewer.