Skip to content

Commit

Permalink
[FEATURE] Update of Analysis/Content view
Browse files Browse the repository at this point in the history
  • Loading branch information
einpraegsam committed Feb 23, 2024
1 parent 4d10318 commit 02a3913
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 68 deletions.
17 changes: 4 additions & 13 deletions Classes/Controller/AnalysisController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
declare(strict_types=1);
namespace In2code\Lux\Controller;

use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\Exception as ExceptionDbalDriver;
use Doctrine\DBAL\Exception as ExceptionDbal;
use Exception;
use In2code\Lux\Domain\DataProvider\AllLinkclickDataProvider;
use In2code\Lux\Domain\DataProvider\DomainDataProvider;
use In2code\Lux\Domain\DataProvider\DomainNewsDataProvider;
use In2code\Lux\Domain\DataProvider\DownloadsDataProvider;
use In2code\Lux\Domain\DataProvider\LanguagesDataProvider;
use In2code\Lux\Domain\DataProvider\LanguagesNewsDataProvider;
use In2code\Lux\Domain\DataProvider\LinkclickDataProvider;
use In2code\Lux\Domain\DataProvider\NewsvisistsDataProvider;
use In2code\Lux\Domain\DataProvider\PagevisistsDataProvider;
use In2code\Lux\Domain\DataProvider\ReferrerAmountDataProvider;
use In2code\Lux\Domain\DataProvider\SearchDataProvider;
use In2code\Lux\Domain\DataProvider\SocialMediaDataProvider;
use In2code\Lux\Domain\DataProvider\UtmCampaignDataProvider;
use In2code\Lux\Domain\DataProvider\UtmDataProvider;
use In2code\Lux\Domain\DataProvider\UtmMediaDataProvider;
Expand All @@ -36,7 +36,6 @@
use TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException;
use TYPO3\CMS\Extbase\Http\ForwardResponse;
use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException;
use TYPO3\CMS\Extbase\Object\Exception as ExceptionExtbaseObject;
use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException;
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException;

Expand Down Expand Up @@ -88,8 +87,6 @@ public function initializeContentAction(): void
* @throws ExceptionDbal
* @throws ExceptionDbalDriver
* @throws InvalidQueryException
* @throws DBALException
* @throws ExceptionExtbaseObject
*/
public function contentAction(FilterDto $filter, string $export = ''): ResponseInterface
{
Expand All @@ -105,7 +102,8 @@ public function contentAction(FilterDto $filter, string $export = ''): ResponseI
'pages' => $this->pagevisitsRepository->findCombinedByPageIdentifier($filter),
'downloads' => $this->downloadRepository->findCombinedByHref($filter),
'languageData' => GeneralUtility::makeInstance(LanguagesDataProvider::class, $filter),
'domainData' => GeneralUtility::makeInstance(DomainDataProvider::class, $filter),
'referrerAmountData' => GeneralUtility::makeInstance(ReferrerAmountDataProvider::class, $filter),
'socialMediaData' => GeneralUtility::makeInstance(SocialMediaDataProvider::class, $filter),
]);

$this->addDocumentHeaderForCurrentController();
Expand All @@ -118,7 +116,6 @@ public function contentAction(FilterDto $filter, string $export = ''): ResponseI
* @throws ExceptionDbal
* @throws InvalidQueryException
* @throws ExceptionDbalDriver
* @throws ExceptionExtbaseObject
*/
public function contentCsvAction(FilterDto $filter): ResponseInterface
{
Expand Down Expand Up @@ -170,7 +167,6 @@ public function newsAction(FilterDto $filter, string $export = ''): ResponseInte
* @return ResponseInterface
* @throws ExceptionDbal
* @throws ExceptionDbalDriver
* @throws DBALException
*/
public function newsCsvAction(FilterDto $filter): ResponseInterface
{
Expand All @@ -196,7 +192,6 @@ public function initializeUtmAction(): void
* @throws ExceptionDbalDriver
* @throws InvalidQueryException
* @throws ExceptionDbal
* @throws DBALException
*/
public function utmAction(FilterDto $filter, string $export = ''): ResponseInterface
{
Expand Down Expand Up @@ -326,7 +321,6 @@ public function deleteLinkListenerAction(LinkListener $linkListener): ResponseIn
* @return ResponseInterface
* @throws ExceptionDbal
* @throws ExceptionDbalDriver
* @throws DBALException
*/
public function detailPageAction(Page $page): ResponseInterface
{
Expand All @@ -345,7 +339,6 @@ public function detailPageAction(Page $page): ResponseInterface
* @return ResponseInterface
* @throws ExceptionDbalDriver
* @throws ExceptionDbal
* @throws DBALException
*/
public function detailNewsAction(News $news): ResponseInterface
{
Expand Down Expand Up @@ -423,7 +416,6 @@ public function detailSearchAction(string $searchterm): ResponseInterface
* @return ResponseInterface
* @noinspection PhpUnused
* @throws ExceptionDbalDriver
* @throws DBALException
*/
public function detailAjaxPage(ServerRequestInterface $request): ResponseInterface
{
Expand Down Expand Up @@ -453,7 +445,6 @@ public function detailAjaxPage(ServerRequestInterface $request): ResponseInterfa
* @return ResponseInterface
* @noinspection PhpUnused
* @throws ExceptionDbalDriver
* @throws DBALException
*/
public function detailNewsAjaxPage(ServerRequestInterface $request): ResponseInterface
{
Expand Down
3 changes: 2 additions & 1 deletion Classes/Domain/Model/Transfer/FilterDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use In2code\Lux\Domain\Repository\CategoryRepository;
use In2code\Lux\Domain\Service\SiteService;
use In2code\Lux\Utility\DateUtility;
use In2code\Lux\Utility\StringUtility;
use Throwable;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand Down Expand Up @@ -792,7 +793,7 @@ public function getAllowedSites(): array
public function getSitesForFilter(): array
{
if ($this->isSiteSet()) {
return [$this->getSite()];
return [StringUtility::cleanString($this->getSite())];
}
return array_merge(array_keys($this->getAllowedSites()), ['']);
}
Expand Down
25 changes: 4 additions & 21 deletions Classes/Domain/Repository/PagevisitRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
namespace In2code\Lux\Domain\Repository;

use DateTime;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\Exception as ExceptionDbalDriver;
use Doctrine\DBAL\Exception as ExceptionDbal;
use Exception;
Expand Down Expand Up @@ -196,8 +195,7 @@ public function findLastByVisitorAndTime(Visitor $visitor, DateTime $time): ?Pag
* @param Page $page
* @param int $limit
* @return array
* @throws DBALException
* @throws ExceptionDbalDriver
* @throws ExceptionDbal
*/
public function findByPage(Page $page, int $limit = 100): array
{
Expand All @@ -213,7 +211,6 @@ public function findByPage(Page $page, int $limit = 100): array
* @param Visitor $visitor
* @return DateTime|null
* @throws ExceptionDbal
* @throws ExceptionDbalDriver
*/
public function findLatestDateByVisitor(Visitor $visitor): ?DateTime
{
Expand All @@ -233,7 +230,6 @@ public function findLatestDateByVisitor(Visitor $visitor): ?DateTime
* @param int $pageIdentifier
* @return DateTime|null
* @throws ExceptionDbal
* @throws ExceptionDbalDriver
*/
public function findLatestDateByVisitorAndPageIdentifier(Visitor $visitor, int $pageIdentifier): ?DateTime
{
Expand All @@ -250,8 +246,7 @@ public function findLatestDateByVisitorAndPageIdentifier(Visitor $visitor, int $

/**
* @return int
* @throws DBALException
* @throws ExceptionDbalDriver
* @throws ExceptionDbal
*/
public function findAllAmount(): int
{
Expand All @@ -263,9 +258,7 @@ public function findAllAmount(): int
* @param int $pageIdentifier
* @param FilterDto $filter
* @return int
* @throws DBALException
* @throws Exception
* @throws ExceptionDbalDriver
*/
public function findAmountPerPage(int $pageIdentifier, FilterDto $filter): int
{
Expand All @@ -281,7 +274,6 @@ public function findAmountPerPage(int $pageIdentifier, FilterDto $filter): int
* @param Visitor $visitor
* @return int
* @throws ExceptionDbal
* @throws ExceptionDbalDriver
*/
public function findAmountPerPageAndVisitor(int $pageIdentifier, Visitor $visitor): int
{
Expand All @@ -304,7 +296,6 @@ public function findAmountPerPageAndVisitor(int $pageIdentifier, Visitor $visito
* @return array
* @throws Exception
* @throws ExceptionDbal
* @throws ExceptionDbalDriver
*/
public function getAmountOfReferrers(FilterDto $filter, int $limit = 100): array
{
Expand All @@ -314,6 +305,7 @@ public function getAmountOfReferrers(FilterDto $filter, int $limit = 100): array
. ' where referrer != ""'
. ' and referrer not like ' . $connection->quote('%' . $domainLike . '%')
. $this->extendWhereClauseWithFilterTime($filter)
. $this->extendWhereClauseWithFilterSite($filter)
. ' group by referrer having (count > 1) order by count desc limit ' . $limit;
$records = (array)$connection->executeQuery($sql)->fetchAllAssociative();
$result = [];
Expand Down Expand Up @@ -375,9 +367,7 @@ protected function getAmountOfSocialMediaReferrersFromShorteners(array $result,
/**
* @param FilterDto $filter
* @return array
* @throws DBALException
* @throws Exception
* @throws ExceptionDbalDriver
*/
public function getDomainsWithAmountOfVisits(FilterDto $filter): array
{
Expand All @@ -401,9 +391,7 @@ public function getDomainsWithAmountOfVisits(FilterDto $filter): array
*
* @param FilterDto $filter
* @return array
* @throws DBALException
* @throws Exception
* @throws ExceptionDbalDriver
*/
public function getAllDomains(FilterDto $filter): array
{
Expand All @@ -421,9 +409,7 @@ public function getAllDomains(FilterDto $filter): array
/**
* @param FilterDto $filter
* @return array
* @throws DBALException
* @throws Exception
* @throws ExceptionDbalDriver
*/
public function getAllLanguages(FilterDto $filter): array
{
Expand All @@ -443,9 +429,7 @@ public function getAllLanguages(FilterDto $filter): array
* @param int $pageIdentifier
* @param FilterDto $filter
* @return int
* @throws DBALException
* @throws Exception
* @throws ExceptionDbalDriver
*/
public function findAbandonsForPage(int $pageIdentifier, FilterDto $filter): int
{
Expand Down Expand Up @@ -501,8 +485,7 @@ protected function findOneByCompany(Company $company, string $orderings = 'asc')
* @param FilterDto $filter1
* @param FilterDto $filter2
* @return int positive if more visitors in filter1 period then in filter2, negative for the opposite situation
* @throws DBALException
* @throws ExceptionDbalDriver
* @throws Exception
*/
public function compareAmountPerPage(int $pageIdentifier, FilterDto $filter1, FilterDto $filter2): int
{
Expand Down
64 changes: 32 additions & 32 deletions Resources/Private/Partials/Filter/Analysis/Content.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,34 @@ <h5><f:translate key="LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:mo
</div>

<div class="input-group form-group">
<f:form.textfield
type="datetime-local"
property="timeFrom"
id="timeFrom"
class="form-control" />
<button type="button" class="btn btn-default" data-global-event="click" data-action-focus="#timeFrom">
{f:translate(key:'LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:module.list.filter.timeFrom')}
<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}" />
<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-4">
<h5><f:translate key="LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:module.list.filter.header.scoring">Scoring</f:translate></h5>
<h5><f:translate key="LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:dictionary.time">Zeit</f:translate></h5>

<div class="input-group form-group">
<f:form.textfield
type="range"
property="scoring"
class="form-control"
additionalAttributes="{min:0, max:200, onchange:'document.getElementById(\'scoring_label\').innerHTML = this.value;'}"
id="scoring"/>
<button type="button" class="btn btn-default" data-global-event="click" data-action-focus="#scoring">
Min: <strong id="scoring_label">{filter.scoring}</strong>
type="datetime-local"
property="timeFrom"
id="timeFrom"
class="form-control" />
<button type="button" class="btn btn-default" data-global-event="click" data-action-focus="#timeFrom">
{f:translate(key:'LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:module.list.filter.timeFrom')}
</button>
</div>

Expand All @@ -62,7 +66,19 @@ <h5><f:translate key="LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:mo


<div class="col-md-4">
<h5><f:translate key="LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:module.list.filter.header.categoryscoring">Category</f:translate></h5>
<h5>Scoring</h5>

<div class="input-group form-group">
<f:form.textfield
type="range"
property="scoring"
class="form-control"
additionalAttributes="{min:0, max:200, onchange:'document.getElementById(\'scoring_label\').innerHTML = this.value;'}"
id="scoring"/>
<button type="button" class="btn btn-default" data-global-event="click" data-action-focus="#scoring">
Min: <strong id="scoring_label">{filter.scoring}</strong>
</button>
</div>

<div class="input-group form-group">
<f:form.select
Expand All @@ -78,22 +94,6 @@ <h5><f:translate key="LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:mo
<core:icon identifier="actions-tag" />
</button>
</div>

<div class="input-group form-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}" />
<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>

Expand Down
3 changes: 2 additions & 1 deletion Resources/Private/Templates/Analysis/Content.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
</div>
<div class="col-md-4">
<div data-lux-container="detail">
<f:render partial="Box/Analysis/Domain" arguments="{_all}"/>
<f:render partial="Box/Leads/Referrer" arguments="{_all}"/>
<f:render partial="Box/Analysis/SocialMedia" arguments="{_all}"/>
<f:render partial="Box/Analysis/Language" arguments="{_all}"/>
</div>
</div>
Expand Down

0 comments on commit 02a3913

Please sign in to comment.