initial commit

This commit is contained in:
origin
2023-12-04 16:36:56 +01:00
commit e5dd88a27c
64 changed files with 4545 additions and 0 deletions

281
Classes/Domain/Model/MapEntry.php Executable file
View File

@ -0,0 +1,281 @@
<?php
declare(strict_types=1);
namespace A2G\A2gMaps\Domain\Model;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
use TYPO3\CMS\Extbase\Annotation\ORM\{
Cascade,
Lazy
};
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
/**
* This file is part of the "altogether Products" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* MapEntry
*/
class MapEntry extends AbstractEntity {
/**
*
* @var string
*/
protected $addressline = '';
/**
*
* @var string
*/
protected $zip = '';
/**
*
* @var string
*/
protected $city = '';
/**
*
* @var string
*/
protected $region = '';
/**
* latitude
*
* @var float
*/
protected $latitude = 0.0;
/**
* longitude
*
* @var float
*/
protected $longitude = 0.0;
/**
* title
*
* @var string
*/
protected $title = '';
/**
* pathSegment
*
* @var string
*/
protected $pathSegment = '';
/**
* popupContent
*
* @var string
*/
protected $popupContent = '';
/**
*
* @var string
*/
protected $navToUrl = '';
/**
* image
*
* @var FileReference
* @Cascade("remove")
* @Lazy
*/
protected $image = null;
/**
* relMarker
*
* @var Marker
* @Lazy
*/
protected $relMarker = null;
/**
*
* @return float
*/
public function getLatitude(): float {
return $this->latitude;
}
/**
*
* @return float
*/
public function getLongitude(): float {
return $this->longitude;
}
/**
*
* @return string
*/
public function getTitle(): string {
return $this->title;
}
/**
*
* @return string
*/
public function getPathSegment(): string {
return $this->pathSegment;
}
/**
*
* @return null|Marker
*/
public function getRelMarker(): ?Marker {
if ($this->relMarker instanceof LazyLoadingProxy) {
$this->relMarker = $this->relMarker->_loadRealInstance();
}
return $this->relMarker;
}
/**
*
* @param Marker $relMarker
* @return void
*/
public function setRelMarker(?Marker $relMarker): void {
$this->relMarker = $relMarker;
}
/**
*
* @return null|FileReference
*/
public function getImage(): ?FileReference {
if ($this->image instanceof LazyLoadingProxy) {
$this->image = $this->image->_loadRealInstance();
}
return $this->image;
}
/**
*
* @param float $latitude
* @return void
*/
public function setLatitude(float $latitude): void {
$this->latitude = $latitude;
}
/**
*
* @param float $longitude
* @return void
*/
public function setLongitude(float $longitude): void {
$this->longitude = $longitude;
}
/**
*
* @param string $title
* @return void
*/
public function setTitle(string $title): void {
$this->title = $title;
}
/**
*
* @param string $pathSegment
* @return void
*/
public function setPathSegment(string $pathSegment): void {
$this->pathSegment = $pathSegment;
}
/**
*
* @param null|FileReference $image
* @return void
*/
public function setImage(?FileReference $image): void {
$this->image = $image;
}
/**
*
* @return string
*/
public function getPopupContent(): string {
return $this->popupContent;
}
/**
*
* @param string $popupContent
* @return void
*/
public function setPopupContent(string $popupContent): void {
$this->popupContent = $popupContent;
}
public function getAddressline(): string {
return $this->addressline;
}
public function getZip(): string {
return $this->zip;
}
public function getCity(): string {
return $this->city;
}
public function getRegion(): string {
return $this->region;
}
public function setAddressline(string $addressline): void {
$this->addressline = $addressline;
}
public function setZip(string $zip): void {
$this->zip = $zip;
}
public function setCity(string $city): void {
$this->city = $city;
}
public function setRegion(string $region): void {
$this->region = $region;
}
public function getNavToUrl(): string {
return $this->navToUrl;
}
public function setNavToUrl(string $navToUrl): void {
$this->navToUrl = $navToUrl;
}
}

56
Classes/Domain/Model/Marker.php Executable file
View File

@ -0,0 +1,56 @@
<?php
declare(strict_types=1);
namespace A2G\A2gMaps\Domain\Model;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
use TYPO3\CMS\Extbase\Annotation\ORM\{
Cascade,
Lazy
};
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
/**
* This file is part of the "altogether Products" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* Marker
*/
class Marker extends AbstractEntity {
/**
* mapIcon
*
* @var FileReference
* @Cascade("remove")
* @Lazy
*/
protected $mapIcon = null;
/**
*
* @return null|FileReference
*/
public function getMapIcon(): ?FileReference {
if ($this->mapIcon instanceof LazyLoadingProxy) {
$this->mapIcon = $this->mapIcon->_loadRealInstance();
}
return $this->mapIcon;
}
/**
*
* @return string
*/
public function getMapConfig(): string {
return $this->mapConfig;
}
}

View File

@ -0,0 +1,18 @@
<?php
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
*/
namespace A2G\A2gMaps\Domain\Model;
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
/**
* Description of SysFileReference
*
* @author raphael
*/
class SysFileReference extends FileReference {
//put your code here
}

View File

@ -0,0 +1,79 @@
<?php
declare(strict_types=1);
namespace A2G\A2gMaps\Domain\Repository;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
/**
* This file is part of the "Products" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* The repository for MapEntry
*/
class MapEntryRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
/**
* @var array
*/
// protected $defaultOrderings = [
// 'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
// ];
public function initializeObject() {
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
$querySettings->setRespectStoragePage(false);
$this->setDefaultQuerySettings($querySettings);
}
static private function mapInt($value){
if(MathUtility::canBeInterpretedAsInteger($value)){
return (int)$value;
} else {
return null;
}
}
public function getFromUids(array $uids, ?string $orderBy = null){
$arguments = [];
$uidsFiltered = array_filter(array_map('self::mapInt', $uids));
if(count($uidsFiltered) === 0){
return null;
}
$query = $this->createQuery();
$sql = 'SELECT meT.* FROM tx_a2gmaps_domain_model_mapentry AS meT ';
$sqlWhere = 'WHERE meT.hidden=0 AND meT.deleted=0 AND meT.uid IN ('.implode(',', $uidsFiltered).')';
$query->statement($sql . $sqlWhere, $arguments);
return $query->execute();
}
public function getEntriesFromMap(int $ttContentUid){
$query = $this->createQuery();
$sql = 'SELECT tcT.* FROM tt_content AS tcT ';
$sqlWhere = 'WHERE tcT.hidden=0 AND tcT.deleted=0 AND tcT.uid = :dcUid ';
$arguments = [
':dcUid' => $ttContentUid
];
$query->statement($sql . $sqlWhere, $arguments);
return explode(',',GeneralUtility::xml2array($query->execute(1)[0]['pi_flexform'])['data']['sDEF']['lDEF']['settings.markers']['vDEF']);
}
}

View File

@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace A2G\A2gMaps\Domain\Repository;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* This file is part of the "Products" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* The repository for Marker
*/
class MarkerRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
/**
* @var array
*/
// protected $defaultOrderings = [
// 'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
// ];
public function initializeObject() {
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
$querySettings->setRespectStoragePage(false);
$this->setDefaultQuerySettings($querySettings);
}
}

View File

@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace A2G\A2gMaps\Domain\Repository;
/**
* This file is part of the "Products" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* The repository for SysFileReference
*/
class SysFileReferenceRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
/**
* @var array
*/
// protected $defaultOrderings = [
// 'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
// ];
public function initializeObject() {
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
$querySettings->setRespectStoragePage(false);
$this->setDefaultQuerySettings($querySettings);
}
public function findByTablename(string $tableName, int $uid){
$query = $this->createQuery();
$sql = 'SELECT sfrT.* FROM sys_file_reference AS sfrT ';
$sqlWhere = 'WHERE sfrT.hidden=0 AND sfrT.deleted=0 AND sfrT.tablenames = :dcTablename AND sfrT.uid_foreign = :dcUid ';
$arguments = [
':dcTablename' => $tableName,
':dcUid' => $uid
];
$query->statement($sql . $sqlWhere, $arguments);
return $query->execute();
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
declare(strict_types=1);
namespace A2G\A2gMaps\Domain\Traits;
use TYPO3\CMS\Extbase\Service\ImageService;
/**
* Description of InjectImageServiceTrait
*
* @author Raphael Martin
*/
trait InjectImageServiceTrait {
/**
* imageService
*
* @var ImageService
*/
protected $imageService = null;
/**
* @param ImageService $imageService
*/
public function injectImageService(ImageService $imageService) {
$this->imageService = $imageService;
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace A2G\A2gMaps\Domain\Traits;
use A2G\A2gMaps\Domain\Repository\MapEntryRepository;
/**y
* Description of InjectMapEntryRepositoryTrait
*
* @author Raphael Martin
*/
trait InjectMapEntryRepositoryTrait {
/**
*
* @var MapEntryRepository
*/
protected $mapEntryRepository = null;
/**
* @param MapEntryRepository $mapEntryRepository
*/
public function injectMapEntryRepository(MapEntryRepository $mapEntryRepository) {
$this->mapEntryRepository = $mapEntryRepository;
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace A2G\A2gMaps\Domain\Traits;
use A2G\A2gMaps\Domain\Repository\MarkerRepository;
/**y
* Description of InjectMarkerRepositoryTrait
*
* @author Raphael Martin
*/
trait InjectMarkerRepositoryTrait {
/**
*
* @var MarkerRepository
*/
protected $markerRepository = null;
/**
* @param MarkerRepository $markerRepository
*/
public function injectMarkerRepository(MarkerRepository $markerRepository) {
$this->markerRepository = $markerRepository;
}
}

View File

@ -0,0 +1,21 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* declare(strict_types=1);
namespace A2G\A2gMaps\Domain\Traits;
use TYPO3\CMS\Extbase\Object\ObjectManager;
/**
* Description of InjectObjectManagerTrait
*
* @author Raphael Martin
*/

View File

@ -0,0 +1,27 @@
<?php
namespace A2G\A2gMaps\Domain\Traits;
use A2G\A2gMaps\Domain\Repository\SysFileReferenceRepository;
/**y
* Description of InjectSysFileReferenceRepositoryTrait
*
* @author Raphael Martin
*/
trait InjectSysFileReferenceRepositoryTrait {
/**
*
* @var SysFileReferenceRepository
*/
protected $sysFileReferenceRepository = null;
/**
* @param SysFileReferenceRepository $sysFileReferenceRepository
*/
public function injectSysFileReferenceRepository(SysFileReferenceRepository $sysFileReferenceRepository) {
$this->sysFileReferenceRepository = $sysFileReferenceRepository;
}
}