update
This commit is contained in:
105
controller/MapsController.php
Normal file
105
controller/MapsController.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Mapy moduł
|
||||
*
|
||||
*/
|
||||
class MapsController extends MainController implements ControllerInterface {
|
||||
|
||||
/**
|
||||
* Strona glowna
|
||||
*
|
||||
*/
|
||||
public function IndexAction($param) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Moduł Mapy -
|
||||
*
|
||||
* np. sklepów, oddziałów, itp.
|
||||
*/
|
||||
public function IndexModuleAction($param) {
|
||||
|
||||
$dalData = FkMapsDAL::GetDalDataObj();
|
||||
// $dalData->setCondition($data);
|
||||
$dalData->addCondition('publication', 1);
|
||||
$dalData->setSortBy('weight');
|
||||
//$dalData->setLimit(6);
|
||||
|
||||
|
||||
$arrayMaps = FkMapsDAL::GetResult($dalData);
|
||||
$arrayMapsByType = array();
|
||||
foreach ($arrayMaps as $objMaps) {
|
||||
if ($objMaps->GetType() == 1) {
|
||||
$arrayMapsByType[1][] = $objMaps;
|
||||
} else {
|
||||
$arrayMapsByType[2][] = $objMaps;
|
||||
}
|
||||
}
|
||||
Utils::ArrayDisplay($arrayMapsByType);
|
||||
|
||||
$count = count($arrayMaps);
|
||||
// Utils::ArrayDisplay($count);
|
||||
$mapsListJs = "{
|
||||
'type': 'FeatureCollection',
|
||||
'features': [
|
||||
";
|
||||
foreach ($arrayMaps as $key => $objMaps) {
|
||||
$mapsListJs .= "{"
|
||||
. "
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Point',
|
||||
'coordinates': [".$objMaps->GetLng().", ".$objMaps->GetLat()."]
|
||||
},
|
||||
'properties': {
|
||||
'name': '".$objMaps->GetName()."',
|
||||
'address': '".$objMaps->GetAddress()."',
|
||||
'city': '".$objMaps->GetCity()."',
|
||||
'country': 'Polska'
|
||||
}
|
||||
}";
|
||||
if ($key+1 != $count) {
|
||||
$mapsListJs .= ",
|
||||
";
|
||||
|
||||
}
|
||||
// Utils::ArrayDisplay($key+1 ." = ". $count);
|
||||
}
|
||||
$mapsListJs .= "]};";
|
||||
// Utils::ArrayDisplay($mapsListJs);
|
||||
|
||||
|
||||
$this->smarty->assign('mapsListJs', $mapsListJs);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Czesc wspolna wszystkich podstron
|
||||
*
|
||||
*/
|
||||
public function PreDispatch($param) {
|
||||
|
||||
//$this->AddScript('swfobject.js');
|
||||
$this->smarty->assign('lang', $param['lang']);
|
||||
$this->smarty->assign('indexSG', true);
|
||||
$this->Run($param);
|
||||
|
||||
|
||||
$this->RunShared('MenuBox', $param);
|
||||
//$this->RunShared('TagCloudBox', $param);
|
||||
//$this->RunShared('News', $param);
|
||||
//$this->RunShared('CustomerBox', $param);
|
||||
//$this->RunShared('LinksBox', $param);
|
||||
}
|
||||
|
||||
public function PostDispatch($param) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user