update
This commit is contained in:
158
controller/ModuleController.php
Normal file
158
controller/ModuleController.php
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Przykładowe moduły
|
||||
*
|
||||
*/
|
||||
class ModuleController extends MainController implements ControllerInterface {
|
||||
|
||||
/**
|
||||
* Strona glowna
|
||||
*
|
||||
*/
|
||||
public function IndexAction($param) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Moduł Timeline
|
||||
*
|
||||
* np. Nagrody, Historia, itp.
|
||||
*/
|
||||
|
||||
public function TimelineAction($param) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Moduł Mapy -
|
||||
*
|
||||
* np. sklepów, oddziałów, itp.
|
||||
*/
|
||||
|
||||
public function MapsAction($param) {
|
||||
// Utils::ArrayDisplay($param);
|
||||
|
||||
$dalData = FkMapsDAL::GetDalDataObj();
|
||||
$dalData->addCondition('publication', 1);
|
||||
$dalData->setSortBy('weight');
|
||||
//$dalData->setLimit(6);
|
||||
|
||||
|
||||
// $arrayMaps = FkMapsDAL::GetResult($dalData);
|
||||
|
||||
$arrayMaps = FkMapsDAL::GetResult($dalData);
|
||||
$arrayMapsByType = array();
|
||||
foreach ($arrayMaps as $objMaps) {
|
||||
if ($objMaps->GetType() == 1) {
|
||||
$arrayMapsByType[1][] = $objMaps;
|
||||
} else {
|
||||
$arrayMapsByType[2][] = $objMaps;
|
||||
}
|
||||
}
|
||||
// Utils::ArrayDisplay($arrayMapsByType);
|
||||
// $arrayJsByType = array();
|
||||
// foreach ($arrayMapsByType as $keyType => $arrayMaps) {
|
||||
$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': {
|
||||
'id': '" . $objMaps->GetId() . "',
|
||||
'name': '" . $objMaps->GetName() . "',
|
||||
'address': '" . $objMaps->GetAddress() . "',
|
||||
'city': '" . $objMaps->GetCity() . "',
|
||||
'type': '" . $objMaps->GetType() . "',
|
||||
'description': '" . $objMaps->GetDescription() . "',
|
||||
'description': '" . $objMaps->GetDescription() . "',
|
||||
'googleCor': '" . $objMaps->GetLat() . ", " . $objMaps->GetLng() . "',
|
||||
'country': 'Polska'
|
||||
}
|
||||
}";
|
||||
if ($key + 1 != $count) {
|
||||
$mapsListJs .= ",
|
||||
";
|
||||
}
|
||||
// Utils::ArrayDisplay($key+1 ." = ". $count);
|
||||
}
|
||||
$mapsListJs .= "]};";
|
||||
// $arrayJsByType[$keyType][] = $mapsListJs;
|
||||
// }
|
||||
//Utils::ArrayDisplay($arrayJsByType);
|
||||
|
||||
|
||||
// $this->smarty->assign('arrayJsHean', $arrayJsByType[1]);
|
||||
// $this->smarty->assign('arrayJsHebe', $arrayJsByType[2]);
|
||||
// $url =
|
||||
// Utils::ArrayDisplay(URL_MAIN);
|
||||
$this->smarty->assign('url', URL_MAIN."/".$param['lang']."/ModuleMaps");
|
||||
$this->smarty->assign('mapsListJs', $mapsListJs);
|
||||
}
|
||||
|
||||
public function AjaxMapsListAction($param) {
|
||||
$this->SetAjaxRender();
|
||||
|
||||
$dalData = FkMapsDAL::GetDalDataObj();
|
||||
// $dalData->setCondition($data);
|
||||
$dalData->addCondition('publication', 1);
|
||||
$dalData->setSortBy('weight');
|
||||
|
||||
$search= trim(Request::GetPost('search'));
|
||||
$arraySearch = explode(' ', $search);
|
||||
if (count($arraySearch) > 0) {
|
||||
$where = ' ( ';
|
||||
foreach ($arraySearch as $key => $search) {
|
||||
$where .= $key == 0 ? '' : ' OR ';
|
||||
$where .= ' city LIKE "%'.addslashes($search).'%" ';
|
||||
}
|
||||
$where .= ' ) ';
|
||||
$dalData->addCondition(' ', $where, ' ');
|
||||
}
|
||||
|
||||
//$dalData->setLimit(6);
|
||||
|
||||
|
||||
// $arrayMaps = FkMapsDAL::GetResult($dalData);
|
||||
|
||||
$arrayMaps = FkMapsDAL::GetResult($dalData);
|
||||
|
||||
|
||||
// Utils::ArrayDisplay($objMaps);
|
||||
$this->smarty->assign('arrayObj', $arrayMaps);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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