-
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
12 changed files
with
135 additions
and
8 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,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
namespace In2code\Lux\Domain\DataProvider; | ||
|
||
use Exception; | ||
use In2code\Lux\Domain\Repository\VisitorRepository; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
class LeadsPerTimeDataProvider extends AbstractDynamicFilterDataProvider | ||
{ | ||
/** | ||
* Set values like: | ||
* [ | ||
* 'amounts' => [ | ||
* 50, | ||
* 88, | ||
* 33 | ||
* ], | ||
* 'titles' => [ | ||
* 'January', | ||
* 'February', | ||
* 'Now' | ||
* ] | ||
* ] | ||
* | ||
* @return void | ||
* @throws Exception | ||
*/ | ||
public function prepareData(): void | ||
{ | ||
$this->filter->removeShortMode(); | ||
|
||
$visitorRepository = GeneralUtility::makeInstance(VisitorRepository::class); | ||
$intervals = $this->filter->getIntervals(); | ||
$frequency = (string)$intervals['frequency']; | ||
foreach ($intervals['intervals'] as $interval) { | ||
// New visitors | ||
$this->data['amounts'][] = $visitorRepository->findAmountOfNewVisitorsInTimeFrame( | ||
$interval['start'], | ||
$interval['end'] | ||
); | ||
|
||
// Any visitors | ||
$this->data['amounts2'][] = $visitorRepository->findAmountOfVisitorsInTimeFrame( | ||
$interval['start'], | ||
$interval['end'] | ||
); | ||
$this->data['titles'][] = $this->getLabelForFrequency($frequency, $interval['start']); | ||
} | ||
$this->overruleLatestTitle($frequency); | ||
} | ||
} |
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
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
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 @@ | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<h3 class="panel-title"> | ||
<f:translate key="LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:module.leadlist.box.timeframes">Leads per time</f:translate> | ||
</h3> | ||
</div> | ||
<div class="panel-body"> | ||
<f:if condition="{visitorsPerTimeData.dataAvailable}"> | ||
<f:then> | ||
<div> | ||
<canvas width="750" | ||
height="350" | ||
data-chart="line" | ||
data-chart-data="{visitorsPerTimeData.amountsList}" | ||
data-chart-data2="{visitorsPerTimeData.amounts2List}" | ||
data-chart-label="{f:translate(key:'LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:module.leadlist.box.timeframes.label.new')}" | ||
data-chart-label2="{f:translate(key:'LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:module.leadlist.box.timeframes.label.any')}" | ||
data-chart-labels="{visitorsPerTimeData.titlesList}"></canvas> | ||
</div> | ||
</f:then> | ||
<f:else> | ||
<f:render partial="Miscellaneous/NoValues" arguments="{_all}"/> | ||
</f:else> | ||
</f:if> | ||
</div> | ||
</div> |
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