-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
134 changed files
with
2,262 additions
and
2,070 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ var/ | |
/docker-compose.yml | ||
/config/ | ||
/.phpunit.cache/ | ||
/.env.local |
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,2 @@ | ||
WIREDMINDS_ENABLE=0 | ||
WIREDMINDS_TOKEN= |
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
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
FROM in2code/php-dev:8.1-fpm | ||
FROM in2code/php-dev:8.2-fpm | ||
|
||
COPY zz_xdebug.ini /usr/local/etc/php/conf.d/zz_xdebug.ini |
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,138 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace In2code\Lux\Backend\LiveSearch; | ||
|
||
use In2code\Lux\Domain\Model\Visitor as VisitorModel; | ||
use In2code\Lux\Domain\Repository\VisitorRepository; | ||
use In2code\Lux\Utility\BackendUtility; | ||
use In2code\Lux\Utility\ObjectUtility; | ||
use TYPO3\CMS\Backend\Module\ModuleProvider; | ||
use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException; | ||
use TYPO3\CMS\Backend\Routing\UriBuilder; | ||
use TYPO3\CMS\Backend\Search\LiveSearch\ResultItem; | ||
use TYPO3\CMS\Backend\Search\LiveSearch\ResultItemAction; | ||
use TYPO3\CMS\Backend\Search\LiveSearch\SearchDemand\SearchDemand; | ||
use TYPO3\CMS\Backend\Search\LiveSearch\SearchProviderInterface; | ||
use TYPO3\CMS\Core\Imaging\IconFactory; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException; | ||
|
||
class Visitor implements SearchProviderInterface | ||
{ | ||
protected string $title = 'LUX Marketing Automation'; | ||
protected int $limit = 10; | ||
protected array $results = []; | ||
|
||
public function __construct( | ||
readonly protected UriBuilder $uriBuilder, | ||
readonly protected VisitorRepository $visitorRepository, | ||
readonly protected IconFactory $iconFactory | ||
) { | ||
} | ||
|
||
/** | ||
* @param SearchDemand $searchDemand | ||
* @return int | ||
* @throws InvalidQueryException | ||
*/ | ||
public function count(SearchDemand $searchDemand): int | ||
{ | ||
if ($this->isEnabled() === false) { | ||
return 0; | ||
} | ||
return count($this->getResults($searchDemand->getQuery())); | ||
} | ||
|
||
/** | ||
* @param SearchDemand $searchDemand | ||
* @return array|ResultItem[] | ||
* @throws InvalidQueryException | ||
* @throws RouteNotFoundException | ||
*/ | ||
public function find(SearchDemand $searchDemand): array | ||
{ | ||
$resultItems = []; | ||
if ($this->isEnabled()) { | ||
foreach ($this->getResults($searchDemand->getQuery()) as $visitor) { | ||
$resultItems[] = $this->getResultItem($visitor); | ||
} | ||
} | ||
return $resultItems; | ||
} | ||
|
||
public function getFilterLabel(): string | ||
{ | ||
return $this->title; | ||
} | ||
|
||
/** | ||
* @param VisitorModel $visitor | ||
* @return ResultItem | ||
* @throws RouteNotFoundException | ||
*/ | ||
protected function getResultItem(VisitorModel $visitor): ResultItem | ||
{ | ||
return (new ResultItem(self::class)) | ||
->setItemTitle($visitor->getFullNameWithEmail()) | ||
->setTypeLabel($this->title) | ||
->setIcon($this->iconFactory->getIcon('extension-lux')) | ||
->setActions(...$this->getActionsForResult($visitor)); | ||
} | ||
|
||
/** | ||
* @param VisitorModel $visitor | ||
* @return array | ||
* @throws RouteNotFoundException | ||
*/ | ||
protected function getActionsForResult(VisitorModel $visitor): array | ||
{ | ||
$actions = []; | ||
|
||
$uri = $this->uriBuilder->buildUriFromRoute('lux_LuxLead.Lead_detail', ['visitor' => $visitor->getUid()]); | ||
$action = (new ResultItemAction('open_website')) | ||
->setLabel('Lead details') | ||
->setIcon($this->iconFactory->getIcon('extension-lux')) | ||
->setUrl($uri->__toString()); | ||
$actions[] = $action; | ||
|
||
if ($visitor->getCompanyrecord() !== null) { | ||
$uri = $this->uriBuilder->buildUriFromRoute('lux_LuxLead.Lead_company', ['company' => $visitor->getCompanyrecord()->getUid()]); | ||
$action = (new ResultItemAction('open_website')) | ||
->setLabel('Company details') | ||
->setIcon($this->iconFactory->getIcon('extension-lux')) | ||
->setUrl($uri->__toString()); | ||
$actions[] = $action; | ||
} | ||
|
||
return $actions; | ||
} | ||
|
||
/** | ||
* @param string $searchTerm | ||
* @return array | ||
* @throws InvalidQueryException | ||
*/ | ||
protected function getResults(string $searchTerm): array | ||
{ | ||
if ($this->results === []) { | ||
$filter = ObjectUtility::getFilterDto()->setLimit($this->limit)->setSearchTerm($searchTerm); | ||
$this->results = $this->visitorRepository->findAllWithIdentifiedFirst($filter); | ||
} | ||
return $this->results; | ||
} | ||
|
||
/** | ||
* Check if backend user has access to the leads module | ||
* | ||
* @return bool | ||
*/ | ||
protected function isEnabled(): bool | ||
{ | ||
/** @var ModuleProvider $moduleProvider */ | ||
$moduleProvider = GeneralUtility::makeInstance(ModuleProvider::class); | ||
return BackendUtility::getBackendUserAuthentication() !== null && | ||
$moduleProvider->accessGranted('lux_LuxLead', BackendUtility::getBackendUserAuthentication()); | ||
} | ||
} |
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,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
namespace In2code\Lux\Command; | ||
|
||
use In2code\Lux\Utility\ConfigurationUtility; | ||
use In2code\Lux\Utility\EnvironmentUtility; | ||
use TYPO3\CMS\Core\Core\Bootstrap; | ||
use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; | ||
use TYPO3\CMS\Core\Http\ServerRequest; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; | ||
|
||
trait ExtbaseCommandTrait | ||
{ | ||
public function initializeExtbase() | ||
{ | ||
if (EnvironmentUtility::isCli() && ConfigurationUtility::isTypo3Version12() === false) { | ||
Bootstrap::initializeBackendAuthentication(); | ||
$configurationManager = GeneralUtility::makeInstance(ConfigurationManagerInterface::class); | ||
$configurationManager->setRequest( | ||
(new ServerRequest())->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE) | ||
); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.