Skip to content

Commit

Permalink
[FEATURE] Update of Analysis/LinkListener/Detail view
Browse files Browse the repository at this point in the history
  • Loading branch information
einpraegsam committed Feb 26, 2024
1 parent b7f1a28 commit 3e9e248
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 75 deletions.
25 changes: 0 additions & 25 deletions Classes/Controller/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
use In2code\Lux\Domain\Service\RenderingTimeService;
use In2code\Lux\Utility\BackendUtility;
use In2code\Lux\Utility\ConfigurationUtility;
use In2code\Lux\Utility\ObjectUtility;
use In2code\Lux\Utility\StringUtility;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Backend\Module\ExtbaseModule;
Expand Down Expand Up @@ -160,30 +159,6 @@ protected function setFilter(int $timePeriod = FilterDto::PERIOD_DEFAULT): void
$this->request = $this->request->withArgument('filter', $filter);
}

protected function getFilterFromSessionForAjaxRequests(string $action, string $searchterm = ''): FilterDto
{
// Todo: Remove
die(__CLASS__ . ':' . __LINE__);
$filterValues = BackendUtility::getSessionValue('filter', $action, $this->getControllerName());
$filter = ObjectUtility::getFilterDto();
if (!empty($searchterm)) {
$filter->setSearchterm($searchterm);
}
if (!empty($filterValues['timeFrom'])) {
$filter->setTimeFrom((string)$filterValues['timeFrom']);
}
if (!empty($filterValues['timeTo'])) {
$filter->setTimeTo((string)$filterValues['timeTo']);
}
if (!empty($filterValues['scoring'])) {
$filter->setScoring((int)$filterValues['scoring']);
}
if (!empty($filterValues['categoryscoring'])) {
$filter->setCategoryScoring((int)$filterValues['categoryscoring']);
}
return $filter;
}

public function resetFilterAction(string $redirectAction): ResponseInterface
{
BackendUtility::saveValueToSession('filter', $redirectAction, $this->getControllerName(), []);
Expand Down
42 changes: 18 additions & 24 deletions Classes/Controller/AnalysisController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public function initializeDashboardAction(): void
* @throws ExceptionDbal
* @throws InvalidConfigurationTypeException
* @throws InvalidQueryException
* @throws ExceptionDbalDriver
*/
public function dashboardAction(FilterDto $filter): ResponseInterface
{
Expand Down Expand Up @@ -141,7 +140,6 @@ public function initializeNewsAction(): void
* @param string $export
* @return ResponseInterface
* @throws Exception
* @throws ExceptionDbalDriver
*/
public function newsAction(FilterDto $filter, string $export = ''): ResponseInterface
{
Expand Down Expand Up @@ -188,7 +186,6 @@ public function initializeUtmAction(): void
* @param FilterDto $filter
* @param string $export
* @return ResponseInterface
* @throws ExceptionDbalDriver
* @throws InvalidQueryException
* @throws ExceptionDbal
*/
Expand Down Expand Up @@ -243,7 +240,6 @@ public function initializeLinkListenerAction(): void
* @param string $export
* @return ResponseInterface
* @throws ExceptionDbal
* @throws ExceptionDbalDriver
* @throws InvalidQueryException
*/
public function linkListenerAction(FilterDto $filter, string $export = ''): ResponseInterface
Expand Down Expand Up @@ -290,7 +286,6 @@ public function initializeSearchAction(): void
* @param FilterDto $filter
* @return ResponseInterface
* @throws ExceptionDbal
* @throws ExceptionDbalDriver
*/
public function searchAction(FilterDto $filter): ResponseInterface
{
Expand Down Expand Up @@ -320,7 +315,6 @@ public function deleteLinkListenerAction(LinkListener $linkListener): ResponseIn
* @param Page $page
* @return ResponseInterface
* @throws ExceptionDbal
* @throws ExceptionDbalDriver
* @throws ArgumentsException
*/
public function detailPageAction(Page $page): ResponseInterface
Expand All @@ -343,8 +337,8 @@ public function detailPageAction(Page $page): ResponseInterface
/**
* @param News $news
* @return ResponseInterface
* @throws ExceptionDbalDriver
* @throws ExceptionDbal
* @throws ArgumentsException
*/
public function detailNewsAction(News $news): ResponseInterface
{
Expand All @@ -368,7 +362,6 @@ public function detailNewsAction(News $news): ResponseInterface
* @param string $href
* @return ResponseInterface
* @throws ExceptionDbal
* @throws ExceptionDbalDriver
* @throws InvalidQueryException
*/
public function detailDownloadAction(string $href): ResponseInterface
Expand All @@ -392,14 +385,19 @@ public function detailDownloadAction(string $href): ResponseInterface
* @param Linklistener $linkListener
* @return ResponseInterface
* @throws ExceptionDbal
* @throws ExceptionDbalDriver
* @throws InvalidQueryException
*/
public function detailLinkListenerAction(Linklistener $linkListener): ResponseInterface
{
$filter = $this->getFilterFromSessionForAjaxRequests('linkListener', (string)$linkListener->getUid());
$filter = BackendUtility::getFilterFromSession(
'linkClick',
$this->getControllerName(),
['searchterm' => (string)$linkListener->getUid(), 'limit' => 100]
);
$this->view->assignMultiple([
'linkListener' => $linkListener,
'allLinkclickData' => GeneralUtility::makeInstance(AllLinkclickDataProvider::class, $filter),
'filter' => $filter,
'linkclicks' => $this->linkclickRepository->findByFilter($filter),
// 'allLinkclickData' => GeneralUtility::makeInstance(AllLinkclickDataProvider::class, $filter),
]);

$this->addDocumentHeaderForCurrentController();
Expand All @@ -410,7 +408,6 @@ public function detailLinkListenerAction(Linklistener $linkListener): ResponseIn
* @param string $searchterm
* @return ResponseInterface
* @throws ExceptionDbal
* @throws ExceptionDbalDriver
*/
public function detailSearchAction(string $searchterm): ResponseInterface
{
Expand Down Expand Up @@ -469,6 +466,7 @@ public function detailAjaxPage(ServerRequestInterface $request): ResponseInterfa
* @return ResponseInterface
* @noinspection PhpUnused
* @throws ExceptionDbal
* @throws ArgumentsException
*/
public function detailNewsAjaxPage(ServerRequestInterface $request): ResponseInterface
{
Expand Down Expand Up @@ -553,10 +551,7 @@ public function detailAjaxDownload(ServerRequestInterface $request): ResponseInt
$filter = BackendUtility::getFilterFromSession(
'content',
'Analysis',
[
'href' => (string)$request->getQueryParams()['download'],
'limit' => 10,
]
['href' => (string)$request->getQueryParams()['download'], 'limit' => 10]
);
$standaloneView = ObjectUtility::getStandaloneView();
$standaloneView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
Expand All @@ -578,22 +573,22 @@ public function detailAjaxDownload(ServerRequestInterface $request): ResponseInt
* @param ServerRequestInterface $request
* @return ResponseInterface
* @noinspection PhpUnused
* @throws InvalidQueryException
*/
public function detailAjaxLinklistener(ServerRequestInterface $request): ResponseInterface
{
/** @var Linklistener $linkListener */
$linkListener = $this->linklistenerRepository->findByIdentifier(
(int)$request->getQueryParams()['linkListener']
$filter = BackendUtility::getFilterFromSession(
'linkListener',
'Analysis',
['searchterm' => (string)$request->getQueryParams()['linkListener'], 'limit' => 10]
);
$filter = $this->getFilterFromSessionForAjaxRequests('linkListener', (string)$linkListener->getUid());
$standaloneView = ObjectUtility::getStandaloneView();
$standaloneView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
'EXT:lux/Resources/Private/Templates/Analysis/LinkListenerAjax.html'
));
$standaloneView->setPartialRootPaths(['EXT:lux/Resources/Private/Partials/']);
$standaloneView->assignMultiple([
'linkListener' => $linkListener,
'linkclicks' => $this->linkclickRepository->findByLinklistenerIdentifier($linkListener->getUid(), 10),
'linkclicks' => $this->linkclickRepository->findByFilter($filter),
'allLinkclickData' => GeneralUtility::makeInstance(AllLinkclickDataProvider::class, $filter),
]);
$response = GeneralUtility::makeInstance(JsonResponse::class);
Expand All @@ -606,7 +601,6 @@ public function detailAjaxLinklistener(ServerRequestInterface $request): Respons
/**
* @return void
* @throws ExceptionDbal
* @throws ExceptionDbalDriver
*/
protected function addDocumentHeaderForCurrentController(): void
{
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/DataProvider/AllLinkclickDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct(FilterDto $filter = null)
public function prepareData(): void
{
$intervals = $this->filter->getIntervals();
$frequency = $intervals['frequency'];
$frequency = (string)$intervals['frequency'];
$pageList = $this->getRelatedPageListToLinkclicks($intervals['intervals']);
foreach ($intervals['intervals'] as $interval) {
$clicks = $this->linkclickRepository->findByTimeFrame(
Expand Down
16 changes: 11 additions & 5 deletions Classes/Domain/Repository/LinkclickRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use In2code\Lux\Domain\Model\Transfer\FilterDto;
use In2code\Lux\Utility\DatabaseUtility;
use In2code\Lux\Utility\DateUtility;
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;

Expand Down Expand Up @@ -167,15 +168,20 @@ public function findLastDateByLinklistenerAndPage(int $linklistener, int $page):
}

/**
* @param int $linklistenerIdentifier
* @param int $limit
* @param FilterDto $filter
* @return QueryResultInterface
* @throws InvalidQueryException
*/
public function findByLinklistenerIdentifier(int $linklistenerIdentifier, int $limit): QueryResultInterface
public function findByFilter(FilterDto $filter): QueryResultInterface
{
$query = $this->createQuery();
$query->matching($query->equals('linklistener', $linklistenerIdentifier));
$query->setLimit($limit);
$logicalAnd = [
$query->equals('linklistener', (int)$filter->getSearchterm()),
];
$logicalAnd = $this->extendLogicalAndWithFilterConstraintsForCrdate($filter, $query, $logicalAnd);
$logicalAnd = $this->extendLogicalAndWithFilterConstraintsForSite($filter, $query, $logicalAnd);
$query->matching($query->logicalAnd(...$logicalAnd));
$query->setLimit($filter->getLimit());
$query->setOrderings(['crdate' => QueryInterface::ORDER_DESCENDING]);
return $query->execute();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,14 @@ <h3 class="panel-title">Filter</h3>
</td>
</tr>
</f:section>

<f:section name="linkListener">
<tr>
<th>
Link Listener UID
</th>
<td>
{filter.searchterm}
</td>
</tr>
</f:section>
20 changes: 19 additions & 1 deletion Resources/Private/Partials/Filter/Lead/Dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,25 @@
<div class="panel-body">
<f:form name="filter" class="form" action="{action}">
<div class="row">
<div class="col-md-10"></div>
<div class="col-md-8"></div>
<div class="col-md-2">
<div class="input-group">
<f:form.select
id="site"
class="form-control form-select"
property="site"
options="{filter.allowedSites}"
prependOptionLabel="{f:translate(key:'LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:module.analysis.dashboard.filter.sitesall')}"
prependOptionValue=""
optionValueField="identifier"
optionLabelField="configuration.websiteTitle"
value="{filter.site}"
additionalAttributes="{onchange:'this.form.submit();'}" />
<button type="button" class="btn btn-default" data-global-event="click" data-action-focus="#site">
<core:icon identifier="actions-globe" size="small" />
</button>
</div>
</div>
<div class="col-md-2">
<div class="input-group">
<f:form.select
Expand Down
27 changes: 12 additions & 15 deletions Resources/Private/Templates/Analysis/DetailLinkListener.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ <h3 class="panel-title">
</h3>
</div>
<div class="panel-body">
<f:if condition="{linkListener.linkclicks}">
<lux:pagination.paginate objects="{linkListener.linkclicks}" as="linkclickPaginator" itemsPerPage="25">
<f:if condition="{linkclicks}">
<lux:pagination.paginate objects="{linkclicks}" as="linkclickPaginator" itemsPerPage="25">
<table class="table table-striped">
<thead>
<tr>
Expand All @@ -25,26 +25,20 @@ <h3 class="panel-title">
</tr>
</thead>
<tbody>
<f:for each="{linkclickPaginator.paginator.paginatedItems}" as="linkClick">
<f:for each="{linkclickPaginator.paginator.paginatedItems}" as="linkclick">
<tr>
<td>{linkListener.title}</td>
<td>{linkclick.linkListener.title}</td>
<td>
<f:link.action action="detail" controller="Lead" arguments="{visitor:linkClick.visitor}">{linkClick.visitor.fullName}</f:link.action>
</td>
<td>
<span class="badge" title="{f:translate(key:'LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:tx_lux_domain_model_visitor.scoring')}">{linkClick.visitor.scoring}</span>
<f:if condition="{linkClick.visitor.hottestCategoryscoring}">
<span class="badge badge-primary" title="{linkClick.visitor.hottestCategoryscoring.category.title}">{linkClick.visitor.hottestCategoryscoring.scoring}</span>
</f:if>
</td>
<td>{linkClick.visitor.company}</td>
<td>{linkClick.visitor.location}</td>
<td></td>
<td></td>
<td>
{linkClick.visitor.latestFingerprint.value}
</td>
<td>
<span class="badge" title="{f:format.date(date:linkClick.crdate,format:'{f:translate(key:\'LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:date\')}')}">
<lux:format.readableDate>{linkClick.crdate}</lux:format.readableDate>
<span class="badge" title="{f:format.date(date:linkclick.crdate,format:'{f:translate(key:\'LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:date\')}')}">
<lux:format.readableDate>{linkclick.crdate}</lux:format.readableDate>
</span>
</td>
</tr>
Expand All @@ -61,7 +55,10 @@ <h3 class="panel-title">
</div>
</div>
<div class="col-md-4">
<f:alias map="{headerPostfix:linkListener.title}">
<f:alias map="{type:'linkListener'}">
<f:render partial="Box/Miscellaneous/FilterInformation" arguments="{_all}"/>
</f:alias>
<f:alias map="{headerPostfix:linkclicks.0.linkListener.title}">
<f:render partial="Box/Analysis/AllLinkclicks" arguments="{_all}"/>
</f:alias>
</div>
Expand Down
8 changes: 4 additions & 4 deletions Resources/Private/Templates/Analysis/LinkListenerAjax.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h3 class="panel-title">
</div>
<div class="panel-body">

<f:if condition="{linkListener.linkclicks}">
<f:if condition="{linkclicks}">
<f:then>
<table class="table table-striped">
<thead>
Expand All @@ -20,7 +20,7 @@ <h3 class="panel-title">
<tbody>
<f:for each="{linkclicks}" as="linkclick">
<tr>
<td>{linkListener.title}</td>
<td>{linkclick.linkListener.title}</td>
<td>
<span title="UID{linkclick.visitor.uid}">{linkclick.visitor.fullName}</span>
</td>
Expand All @@ -35,7 +35,7 @@ <h3 class="panel-title">
</tbody>
</table>

<button style="margin-top: 15px" class="btn btn-primary pull-right" data-lux-linkmock-event="{linkListener.uid}"><f:translate key="LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:module.detail.detail">show</f:translate></button>
<button style="margin-top: 15px" class="btn btn-primary pull-right" data-lux-linkmock-event="{linkclicks.0.linkListener.uid}"><f:translate key="LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:module.detail.detail">show</f:translate></button>
</f:then>
<f:else>
<f:render partial="Miscellaneous/NoValues" arguments="{_all}"/>
Expand All @@ -44,6 +44,6 @@ <h3 class="panel-title">
</div>
</div>

<f:alias map="{headerPostfix: linkListener.title}">
<f:alias map="{headerPostfix: linkclick.0.linkListener.title}">
<f:render partial="Box/Analysis/AllLinkclicks" arguments="{_all}"/>
</f:alias>

0 comments on commit 3e9e248

Please sign in to comment.