Skip to content
Snippets Groups Projects
Commit 1a09d905 authored by Kevin Abel's avatar Kevin Abel
Browse files

Add support for building code aliases and hide aliased buildings

parent e84238f1
No related branches found
No related tags found
No related merge requests found
<?php
return array(
// EAST CAMPUS
// CITY CAMPUS
'HEPP' => 'NRC',
'PIPH' => 'NRC',
'RAYH' => 'NRC',
'LOVH' => 'NRC',
'SELD' => 'SELQ',
'SELE' => 'SELQ',
'SELF' => 'SELQ',
'SELG' => 'SELQ',
'SELH' => 'SELQ',
'SELJ' => 'SELQ',
'SELK' => 'SELQ',
'SELL' => 'SELQ',
'STE' => 'MEMS',
'STNO' => 'MEMS',
'STSO' => 'MEMS',
'STW' => 'MEMS',
);
...@@ -46,7 +46,6 @@ return array( ...@@ -46,7 +46,6 @@ return array(
'SVC', 'SVC',
'UTPE', 'UTPE',
'W1', 'W1',
'W2',
'WAST', 'WAST',
'WEED', 'WEED',
...@@ -55,6 +54,7 @@ return array( ...@@ -55,6 +54,7 @@ return array(
'2', '2',
'1631', '1631',
'1740', '1740',
'1820', // Demo'd
'ARCL', 'ARCL',
'ARCW', 'ARCW',
'BOAT', 'BOAT',
...@@ -66,22 +66,35 @@ return array( ...@@ -66,22 +66,35 @@ return array(
'FMF', 'FMF',
'GE', 'GE',
'HAY', 'HAY',
'HEPP', // Aliased to unofficial
'HZM', 'HZM',
'HZMC', 'HZMC',
'LOVH', // Aliased to unofficial
'LSMB', 'LSMB',
'LSS', 'LSS',
'LSCS', 'LSCS',
'MAIN', 'MAIN',
'MSTO', 'MSTO',
'PIPH', // Aliased to unofficial
'RAYH', // Aliased to unofficial
'REUN', 'REUN',
'SELD', // Aliased to unofficial
'SELE', // Aliased to unofficial
'SELF', // Aliased to unofficial
'SELG', // Aliased to unofficial
'SELH', // Aliased to unofficial
'SELJ', // Aliased to unofficial
'SELK', // Aliased to unofficial
'SELL',
'SPCW', 'SPCW',
'STSB', 'STSB',
'STS', 'STS',
'STSC', 'STSC',
'STNO', 'STE', // Aliased to unofficial
'STSO', 'STNO', // Aliased to unofficial
'STSO', // Aliased to unofficial
'SSTD', 'SSTD',
'STW', 'STW', // Aliased to unofficial
'STNC', 'STNC',
'STN', 'STN',
'SYF', 'SYF',
......
...@@ -11,10 +11,13 @@ class UNL_TourMap_BuildingData ...@@ -11,10 +11,13 @@ class UNL_TourMap_BuildingData
{ {
protected $db; protected $db;
protected $codeAliases;
public function __construct(Adapter $db) public function __construct(Adapter $db)
{ {
$this->db = $db; $this->db = $db;
$this->checkDb(); $this->checkDb();
$this->codeAliases = require UNL_TourMap::getDataDir() . '/php/building_aliases.inc.php';
} }
public function checkDb() public function checkDb()
...@@ -140,9 +143,18 @@ class UNL_TourMap_BuildingData ...@@ -140,9 +143,18 @@ class UNL_TourMap_BuildingData
public function getByCode($code) public function getByCode($code)
{ {
if (isset($this->codeAliases[$code])) {
$code = $this->codeAliases[$code];
}
return $this->executeSelect(array('code' => $code)); return $this->executeSelect(array('code' => $code));
} }
public function getAliases()
{
return $this->codeAliases;
}
public function getAllBuildings() public function getAllBuildings()
{ {
return $this->executeSelect(array('location' => array( return $this->executeSelect(array('location' => array(
......
...@@ -48,4 +48,9 @@ class UNL_TourMap_MarkerList_Buildings extends FilterIterator implements UNL_Tou ...@@ -48,4 +48,9 @@ class UNL_TourMap_MarkerList_Buildings extends FilterIterator implements UNL_Tou
{ {
return new UNL_TourMap_Marker_Building(parent::current()); return new UNL_TourMap_Marker_Building(parent::current());
} }
public function getAliases()
{
return $this->buildingDriver->getAliases();
}
} }
\ No newline at end of file
...@@ -85,6 +85,15 @@ WDN.loadCSS('<?php echo UNL_TourMap::getURL(); ?>css/map.css'); ...@@ -85,6 +85,15 @@ WDN.loadCSS('<?php echo UNL_TourMap::getURL(); ?>css/map.css');
UNLTourMap.initialize(); UNLTourMap.initialize();
<?php endif; ?> <?php endif; ?>
<?php
if ($context->getRaw('markers') instanceof UNL_TourMap_MarkerList_Buildings) {
$buildings = $context->getRaw('markers');
} else {
$buildings = new UNL_TourMap_MarkerList_Buildings();
}
?>
UNLTourMap.setBuildingAliases(<?php echo json_encode($buildings->getAliases()) ?>);
<?php if ($context->getRawObject() instanceof UNL_TourMap_GoogleMap_DynamicCenter) : ?> <?php if ($context->getRawObject() instanceof UNL_TourMap_GoogleMap_DynamicCenter) : ?>
UNLTourMap.openBuildingInfo("<?php echo $context->getRawObject()->options['code']; ?>", true); UNLTourMap.openBuildingInfo("<?php echo $context->getRawObject()->options['code']; ?>", true);
<?php endif; ?> <?php endif; ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment