-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from docmcfly/development
Development
- Loading branch information
Showing
14 changed files
with
100 additions
and
595 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
namespace Cylancer\Participants\Service; | ||
use Cylancer\Participants\Domain\PublicOption; | ||
use Cylancer\Participants\Domain\Repository\EventRepository; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Extbase\Object\ObjectManager; | ||
use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; | ||
|
||
/** | ||
* This file is part of the "TaskManagement" 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) 2022 C. Gogolin <[email protected]> | ||
* | ||
* @package Cylancer\Participants\Service | ||
*/ | ||
class ReasonsForPreventionService | ||
{ | ||
|
||
public static function reasonsForPreventionAction(array $storageUids, \DateTime $from, \DateTime $until, string $visibility = 'ALL'): array | ||
{ | ||
|
||
$objectManager = GeneralUtility::makeInstance(ObjectManager::class); | ||
$persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); | ||
|
||
$eventRepository = GeneralUtility::makeInstance(EventRepository::class, $objectManager); | ||
|
||
$eventRepository->injectPersistenceManager($persistenceManager); | ||
$querySettings = $eventRepository->createQuery()->getQuerySettings(); | ||
$querySettings->setStoragePageIds($storageUids); | ||
$eventRepository->setDefaultQuerySettings($querySettings);# | ||
|
||
return $eventRepository->findEventsAt( $from, $until, ReasonsForPreventionService::mapVisiblity($visibility)); | ||
|
||
} | ||
|
||
|
||
private static function mapVisiblity($visibility): int | ||
{ | ||
if (!isset($visibility)) { | ||
return PublicOption::PUBLIC; | ||
} else if (strtoupper($visibility) === 'ALL') { | ||
return PublicOption::ALL; | ||
} else if (strtoupper($visibility) === 'INTERNAL') { | ||
return PublicOption::INTERNAL; | ||
} else { | ||
return PublicOption::PUBLIC; | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.