Skip to content

Commit

Permalink
Own mapicon directory, code cleaning
Browse files Browse the repository at this point in the history
Mapicon directory automatically created if it not exist. Filled with default mapIcons.
  • Loading branch information
joachimruhs committed Nov 17, 2019
1 parent 79a2a66 commit ff4526e
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 31 deletions.
18 changes: 7 additions & 11 deletions Classes/Controller/AddressController.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,6 @@ public function ajaxSearchAction()
// alternative geocoder
//https://nominatim.openstreetmap.org/search/elzstr.%2010%20rheinhausen?format=json&addressdetails=1&limit=1&polygon_svg=1//
// $addressData = $this->get_webpage($apiURL);

//krexx($latLon);

// $addresses = $this->addressRepository->findAll();

/*
Expand All @@ -185,8 +182,13 @@ public function ajaxSearchAction()
*/
$iconPath = 'fileadmin/ext/myleaflet/Resources/Public/Icons/';
if (!is_dir(PATH_site . $iconPath)) {
$this->addFlashMessage('Please create directories "fileadmin/ext/myleaflet/Resources/Public/Icons/" for your mapIcons!', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
// GeneralUtility::mkdir_deep(PATH_site . $iconPath);
$this->addFlashMessage('Directory ' . $iconPath . ' created for use with own mapIcons!', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::INFO);
GeneralUtility::mkdir_deep(PATH_site . $iconPath);
$sourceDir = 'typo3conf/ext/myleaflet/Resources/Public/MapIcons/';
$files = GeneralUtility::getFilesInDir($sourceDir, 'png,gif,jpg');
foreach ($files as $file) {
copy($sourceDir . $file, $iconPath . $file);
}
}


Expand Down Expand Up @@ -219,10 +221,6 @@ public function ajaxSearchAction()
}
$categories = $this->buildTree($arr);




//Krexx($addresses);
$this->view->assign('L', $GLOBALS['TSFE']->config['config']['language']);
$this->view->assign('id' , $GLOBALS['TSFE']->id);
$this->view->assign('categories' , $categories);
Expand All @@ -233,7 +231,6 @@ public function ajaxSearchAction()


function get_webpage($url) {
//global $db;
if (ini_get('allow_url_fopen'))
$this->conf['useCurl'] = 0;
else
Expand All @@ -247,7 +244,6 @@ function get_webpage($url) {
$data = curl_exec($sessions);
curl_close($sessions);
} else {
// $data = t3lib_div::getUrl($url);
$data = \TYPO3\CMS\Core\Utility\GeneralUtility::getURL($url);
}
return $data;
Expand Down
21 changes: 3 additions & 18 deletions Classes/Domain/Repository/AddressRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public function findLocationsInRadius($latLon, $radius, $categories, $storagePid
having distance <=" . intval($radius) . " order by " . $orderBy . " limit " . $limit )->execute(TRUE);

} else {
$result = $query->statement("SELECT distinct a.*, (((acos(sin(($lat*$pi/180)) * sin((latitude*$pi/180)) + cos(($lat*$pi/180)) *
} else {
$result = $query->statement("SELECT distinct a.*, (((acos(sin(($lat*$pi/180)) * sin((latitude*$pi/180)) + cos(($lat*$pi/180)) *
cos((latitude*$pi/180)) * cos((($lon - longitude)*$pi/180)))))*6370) as distance,
(SELECT GROUP_CONCAT(e.title ORDER BY e.title SEPARATOR ', ') from tt_address d, sys_category
e, sys_category_record_mm f
Expand All @@ -121,22 +121,7 @@ public function findLocationsInRadius($latLon, $radius, $categories, $storagePid
WHERE a.latitude != 0 AND a.longitude != 0 AND a.hidden = 0 AND a.deleted = 0 AND a.pid in (" . $storagePid . ")
having distance <=" . intval($radius) . " order by " . $orderBy . " limit " . $limit )->execute(TRUE);

}

/* testing */
/*
for ($i = 0; $i < count($result) ; $i++) {
}
$fileRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\FileRepository::class);
$fileObjects = $fileRepository->findByRelation('sys_category', 'images', 4);
for ($i = 0; $i < count($fileObjects) ; $i++) {
print_r($fileObjects[$i]->getOriginalFile()->getPublicUrl());
}
*/


}
return $result;
}

Expand Down
2 changes: 1 addition & 1 deletion Documentation/Introduction/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ in the constants of myleaflet with the constant editor of TYPO3.
What's new?
^^^^^^^^^^^
New configuration option "categorySelectMode" implemented -> see administratormanual.
Mapicon handling changed. You have to create the directories fileadmin/ext/myleaflet/Resources/Public/Icons.
Mapicon handling changed. The directories fileadmin/ext/myleaflet/Resources/Public/Icons are created if they don't exist.
Insert here your mapIcons. These icons can then be selected in the tt_address record (leafletmapicon).
The templates AjaxSearch.html and Show.html changed.

Expand Down
Binary file added Resources/Public/MapIcons/pointerBlue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/Public/MapIcons/pointerGreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/Public/MapIcons/pointerOrange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/Public/MapIcons/pointerPurple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/Public/MapIcons/pointerRed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/Public/MapIcons/pointerWhite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/Public/MapIcons/pointerYellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'uploadfolder' => true,
'createDirs' => 'uploads/tx_myleaflet/icons',
'clearCacheOnLoad' => 0,
'version' => '0.4.0',
'version' => '0.4.1',
'constraints' =>
array (
'depends' =>
Expand Down

0 comments on commit ff4526e

Please sign in to comment.