'hean', 2=> 'hebe'); public function IndexAction($param){ $dalData = FkMapsDAL::GetDalDataObj(); $dalData->setCondition(array()); // $dalData->setLimit(10); $dalData->setSortBy('city'); $arrayMaps = FkMapsDAL::GetResult($dalData); //Utils::ArrayDisplay($arrayMaps); $this->smarty->assign('arrayMapsType', self::ARRAY_MAPS_TYPE); } public function IndexStructureAction($param){ $this->smarty->assign('arrayMapsType', self::ARRAY_MAPS_TYPE); $this->smarty->assign('icon', true); //Utils::ArrayDisplay($param); if (isset($param['runSharedVariable'])) { $this->smarty->assign('moduleBoxId', $param['runSharedVariable']); $this->smarty->assign('moduleName', $param['moduleName']); } $lang = SessionProxy::GetValue('lang'); $data = array(); if (isset($param['id'])) { $data = array('fk_maps.id_structure' => $param['id'], 'lang' => $lang); } else { $this->smarty->assign('add', true); $this->smarty->assign('icon', false); } $dalData = FkMapsDAL::GetDalDataObj(); $dalData->setCondition($data); $dalData->setSortBy('weight'); $arrayMaps = FkMapsDAL::GetResult($dalData); $this->smarty->assign('arrayObj', $arrayMaps); //Utils::ArrayDisplay($arrayMaps); } public function EditStructureAction($param) { //Utils::ArrayDisplay($param); $lang = SessionProxy::GetValue('lang'); $dalData = FkMapsDAL::GetDalDataObj(); $dalData->setCondition(array('lang' => $lang, 'id_structure' => $param['id'])); $dalData->setSortBy('weight'); $arrayMaps = FkMapsDAL::GetResult($dalData); $this->smarty->assign('arrayObj', $arrayMaps); } /** * Akcja dodawania * * @param $param */ public function AddAction($param) { $lang = SessionProxy::GetValue('lang'); $idStructure = SessionProxy::GetValue('idStructure'); if (!$idStructure) { $this->AddRedirect(Router::GenerateUrl('IndexStructure', array('Structure' => 'Index')), 0); } $this->smarty->assign('idStructure', $idStructure); //$idCategory = SessionProxy::GetValue('idCategory'); // $idCategory = $idStructure; $arrayMapsType = Utils::GetArrayList('fk_maps_category', 'id_fk_maps_category','name'); $this->smarty->assign('arrayMapsType', $arrayMapsType); $objMaps = FkMapsDAL::GetEmptyObj(); if(Request::IsPost()) { $out = array(); $validator = new Validator(Request::GetAllPost()); $data = Request::GetAllPost(); $validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.'); //$validator->IsDate('datepublication', 'Pole data publikacji musi zostać wypełnione.'); //$validator->IsEmpty('description', 'Pole opis musi zostać wypełnione.'); $out = $validator->GetErrorList(); $publication = Request::Get('publication'); $publication ? $publication = 1 : $publication = '0'; //$data['timepublication'] = $data['timepublication'] ? $data['timepublication'] : '00'; // $objMaps->SetDate(Utils::GetNowDate()); // //$objMaps->SetDatePublication($data['datepublication']." ".$data['timepublication'].":00:00"); // $objMaps->SetDatePublication(Utils::GetNowDate()); $objMaps->SetName($data['name']); $objMaps->SetWeight($data['weight']); $objMaps->SetCity($data['city']); $objMaps->SetAddress($data['address']); $objMaps->SetLng($data['lng']); $objMaps->SetLat($data['lat']); $objMaps->setPublication($publication); // $objMaps->SetType($data['type']); $objMaps->SetIdStructure($idStructure); $objMaps->SetLang($lang); // $objMaps->SetDescription($data['description']); if(empty($out)) { $iid = FkMapsDAL::Save($objMaps); $this->smarty->assign('iid', $iid); //$this->AddRedirect(Router::GenerateUrl('indexMaps', array('Maps'=> 'Index')), 0); $this->AddRedirect(Router::GenerateUrl('editStructure', array('id' => $idStructure)), 0); } else { //$this->content=$this->FormatAjaxOutput($out, $param); //Utils::ArrayDisplay($out); $this->smarty->assign('objMaps',$objMaps); //$datePublished = explode(" ",$objMaps->GetDatePublication()); // foreach ($out as $item) { $error[$item['field']] = $item['msg']; } $this->smarty->assign('error',$error); } } } /** * Akcja dodawania * * @param $param */ public function EditAction($param) { //Utils::ArrayDisplay($_POST); $lang = SessionProxy::GetValue('lang'); $idStructure = SessionProxy::GetValue('idStructure'); $this->smarty->assign('idStructure', $idStructure); //$idCategory = SessionProxy::GetValue('idCategory'); // $idCategory = $idStructure; //$arrayMapsType = Utils::GetArrayList('fk_maps_type', 'name', $lang); //$this->smarty->assign('arrayMapsType', $arrayMapsType); //$objMaps = FkMapsDAL::GetEmptyObj(); $objMaps = FkMapsDAL::GetById($param['idMaps'], $lang); if(Request::IsPost()) { $out = array(); $validator = new Validator(Request::GetAllPost()); $data = Request::GetAllPost(); $validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.'); //$validator->IsDate('datepublication', 'Pole data publikacji musi zostać wypełnione.'); //$validator->IsEmpty('description', 'Pole opis musi zostać wypełnione.'); $out = $validator->GetErrorList(); $publication = Request::Get('publication'); $publication ? $publication = 1 : $publication = '0'; $objMaps->SetName($data['name']); $objMaps->SetWeight($data['weight']); $objMaps->SetCity($data['city']); $objMaps->SetAddress($data['address']); $objMaps->SetLng($data['lng']); $objMaps->SetLat($data['lat']); $objMaps->setPublication($publication); // $objMaps->SetType($data['type']); $objMaps->SetIdStructure($idStructure); $objMaps->SetLang($lang); if(empty($out)) { $iid = FkMapsDAL::Save($objMaps); $this->smarty->assign('iid', $iid); //$this->AddRedirect(Router::GenerateUrl('indexMaps', array('Maps'=> 'Index')), 0); $this->AddRedirect(Router::GenerateUrl('editStructure', array('id' => $idStructure)), 0); } else { //$this->content=$this->FormatAjaxOutput($out, $param); //Utils::ArrayDisplay($out); $this->smarty->assign('objMaps',$objMaps); foreach ($out as $item) { $error[$item['field']] = $item['msg']; } $this->smarty->assign('error',$error); } } $this->smarty->assign('objMaps', $objMaps); } public function DeleteAction($param) { $idStructure = SessionProxy::GetValue('idStructure'); //$logger = LoggerManager::getLogger(__CLASS__); $idMaps = $param['idMaps']; if ($idMaps) { try { $objMaps = FkMapsDAL::GetById($idMaps); $dalData = FkMapsDAL::GetDalDataObj(); $dalData->setId($idMaps); $dalData->setObj($objMaps); FkMapsDAL::Delete($dalData); } catch (Exception $e) { //Utils::ArrayDisplay($e); $logger->error('bład usunięcia elementu o id: '.$idMaps); } } $this->AddRedirect(Router::GenerateUrl('editStructure', array('id' => $idStructure)), 0); } /* * Import from xml * * TODO: Upload file. * */ public function ImportXmlAction($param) { //ini_set($varname, $newvalue) $xml = simplexml_load_file(PATH_STATIC_CONTENT . "/sklepy_stacjonarne-ania.xml"); // Utils::ArrayDisplay($xml->marker); //$arrayXml = XML2Array::createArray($xml->channel); $k = 0; foreach ($xml as $key => $entry) { Utils::ArrayDisplay($entry->attributes('id')); $arrayAtrib = $entry->attributes(); $objMaps = FkMapsDAL::GetEmptyObj(); $objMaps->setName((string)$arrayAtrib['name']); $objMaps->SetWeight((string)$arrayAtrib['id']); $objMaps->SetCity((string)$arrayAtrib['city']); $objMaps->SetAddress((string)$arrayAtrib['address']); $objMaps->SetLng((string)$arrayAtrib['lng']); $objMaps->SetLat((string)$arrayAtrib['lat']); $objMaps->setPublication(1); $objMaps->setType(1); $objMaps->setIdCategory(1); // $objMaps->SetType($data['type']); $objMaps->SetIdStructure(3); $objMaps->SetLang('pl'); Utils::ArrayDisplay($objMaps); //$iid = FkMapsDAL::Save($objMaps); $k++; } } /** * preDispatch * @param array $param * @return null */ public function preDispatch($param){ $this->Run($param); $this->AddScript('dropDown.js'); $this->AddScript('structure.js'); $this->AddScript('Dosia.js'); $this->AddScript('Link.js'); $this->AddScript('drag-drop-folder-tree.js'); // //$this->AddScript('Validator.js'); $this->AddScript('calendar.js'); $this->RunShared('Auth', array()); $this->RunShared('Structure', $param); $this->smarty->assign('arrayMapsType', self::ARRAY_MAPS_TYPE); $this->smarty->assign('idStucture', SessionProxy::GetValue('idStructure')); $this->smarty->assign('lang', 'pl'); $this->smarty->assign('titleAdmin', 'Pliki'); $this->smarty->assign('activeTab', 'index'); } /** * postDispatch * @param array $param * @return null */ public function postDispatch($param){ } }