Skip to content

Commit

Permalink
Merge branch 'release/33.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
einpraegsam committed Aug 19, 2023
2 parents d41541e + f3f6fde commit 249b1fb
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Classes/Controller/LeadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use In2code\Lux\Domain\DataProvider\CompanyCategoryScoringsDataProvider;
use In2code\Lux\Domain\DataProvider\CompanyScoringWeeksDataProvider;
use In2code\Lux\Domain\DataProvider\IdentificationMethodsDataProvider;
use In2code\Lux\Domain\DataProvider\LeadsPerTimeDataProvider;
use In2code\Lux\Domain\DataProvider\PagevisistsDataProvider;
use In2code\Lux\Domain\DataProvider\ReferrerAmountDataProvider;
use In2code\Lux\Domain\DataProvider\RevenueClassDataProvider;
Expand Down Expand Up @@ -122,6 +123,7 @@ public function listAction(FilterDto $filter, string $export = ''): ResponseInte
$this->view->assignMultiple([
'numberOfVisitorsData' => GeneralUtility::makeInstance(PagevisistsDataProvider::class, $filter),
'hottestVisitors' => $this->visitorRepository->findByHottestScorings($filter, 8),
'visitorsPerTimeData' => GeneralUtility::makeInstance(LeadsPerTimeDataProvider::class, $filter),
'filter' => $filter,
'allVisitors' => $this->visitorRepository->findAllWithIdentifiedFirst($filter),
'luxCategories' => $this->categoryRepository->findAllLuxCategories(),
Expand Down
8 changes: 4 additions & 4 deletions Classes/Domain/DataProvider/AbstractDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public function getTitlesList(): string

public function getAmountsFromData(): array
{
$amouts = [];
$amounts = [];
if (isset($this->getData()['amounts'])) {
$amouts = $this->getData()['amounts'];
$amounts = $this->getData()['amounts'];
}
return (array)$amouts;
return (array)$amounts;
}

public function getAmountsList(): string
Expand All @@ -69,7 +69,7 @@ public function getAmountsList(): string

public function getAmounts2FromData(): array
{
return (array)$this->getData()['amounts2'];
return (array)($this->getData()['amounts2'] ?? []);
}

public function getAmounts2List(): string
Expand Down
53 changes: 53 additions & 0 deletions Classes/Domain/DataProvider/LeadsPerTimeDataProvider.php
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);
}
}
2 changes: 1 addition & 1 deletion Classes/Domain/Model/Transfer/FilterDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ protected function getStartIntervals(): array
$start = $this->getStartTimeForFilter(true);
$end = $this->getEndTimeForFilter();
$deltaSeconds = $end->getTimestamp() - $start->getTimestamp();
if ($deltaSeconds <= 86400) { // until 1 days
if ($deltaSeconds <= 86400) { // until 1 day
return ['intervals' => $this->getHourIntervals(), 'frequency' => 'hour'];
}
if ($deltaSeconds <= 1209600) { // until 2 weeks
Expand Down
23 changes: 22 additions & 1 deletion Classes/Domain/Repository/VisitorRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function findByProperty(string $propertyName, string $propertyValue): ?Vi
}

/**
* Find a small couple of hottest visitors
* Find a small couple of the hottest visitors
*
* @param FilterDto $filter
* @param int $limit
Expand Down Expand Up @@ -482,6 +482,27 @@ public function findLatestVisitorsWithIpAddress(int $limit, DateTime $time, bool
return $connection->executeQuery($sql)->fetchAllKeyValue();
}

public function findAmountOfVisitorsInTimeFrame(DateTime $start, DateTime $end): int
{
$sql = 'select distinct v.uid from ' . Visitor::TABLE_NAME . ' v'
. ' left join ' . Pagevisit::TABLE_NAME . ' pv on v.uid = pv.visitor'
. ' where v.deleted=0 and v.blacklisted=0'
. ' and pv.crdate >= ' . $start->getTimestamp() . ' and pv.crdate <= ' . $end->getTimestamp()
. ' group by v.uid';
$connection = DatabaseUtility::getConnectionForTable(Visitor::TABLE_NAME);
$rows = $connection->executeQuery($sql)->fetchAllNumeric();
return count($rows);
}

public function findAmountOfNewVisitorsInTimeFrame(DateTime $start, DateTime $end): int
{
$sql = 'select count(uid) from ' . Visitor::TABLE_NAME
. ' where deleted=0 and blacklisted=0'
. ' and crdate >= ' . $start->getTimestamp() . ' and crdate <= ' . $end->getTimestamp();
$connection = DatabaseUtility::getConnectionForTable(Visitor::TABLE_NAME);
return (int)$connection->executeQuery($sql)->fetchOne();
}

public function getScoringSumFromCompany(Company $company): int
{
$connection = DatabaseUtility::getConnectionForTable(Visitor::TABLE_NAME);
Expand Down
1 change: 1 addition & 0 deletions Documentation/Technical/Changelog/Index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

| Version | Date | State | TYPO3 | Description |
|------------|------------|----------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 33.1.0 | 2023-08-19 | Feature | `11.5 + 12.4` | New diagram in lead list shows number of new or all leads within a timeframe |
| 33.0.1 | 2023-08-19 | Bugfix | `11.5 + 12.4` | Fix backend module configuration for TYPO3 12 (to set correct editor permissions) |
| 33.0.0 | 2023-08-14 | Feature | `11.5 + 12.4` | Color adjustments of LUX for a better readability, small improvements of readabledate viewhelper, don't show empty values in UTM diagrams |
| 32.2.3 | 2023-08-10 | Bugfix | `11.5 + 12.4` | Fix socialmedia diagram in analysis dashboard |
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Build/JavaScript/Backend/Diagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ define(['jquery', 'TYPO3/CMS/Lux/Vendor/Chart.min'], function($) {
}
}];

// Use a logarithmic y-axes (normally only if there is more then only one line with a big difference)
// Use a logarithmic y-axes (normally only if there is more than only one line with a big difference)
if (element.hasAttribute('data-chart-max-y') && element.hasAttribute('data-chart-max-y') > 0) {
yAxes = [{
type: 'logarithmic',
Expand Down
13 changes: 13 additions & 0 deletions Resources/Private/Language/de.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1843,6 +1843,19 @@
<target state="translated">Zeige die beisten UTM Media</target>
</trans-unit>

<trans-unit id="module.leadlist.box.timeframes">
<source>Leads per time</source>
<target state="translated">Leads pro Zeitraum</target>
</trans-unit>
<trans-unit id="module.leadlist.box.timeframes.label.new">
<source>New leads</source>
<target state="translated">Neue Leads</target>
</trans-unit>
<trans-unit id="module.leadlist.box.timeframes.label.any">
<source>Any leads</source>
<target state="translated">Alle Leads</target>
</trans-unit>

<trans-unit id="module.company.box.newest">
<source>Latest companies on your website</source>
<target state="translated">Letzte Firmen auf der Website</target>
Expand Down
10 changes: 10 additions & 0 deletions Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,16 @@
<source>Show best UTM media</source>
</trans-unit>

<trans-unit id="module.leadlist.box.timeframes">
<source>Leads per time</source>
</trans-unit>
<trans-unit id="module.leadlist.box.timeframes.label.new">
<source>New leads</source>
</trans-unit>
<trans-unit id="module.leadlist.box.timeframes.label.any">
<source>Any leads</source>
</trans-unit>

<trans-unit id="module.company.box.newest">
<source>Latest companies on your website</source>
</trans-unit>
Expand Down
26 changes: 26 additions & 0 deletions Resources/Private/Partials/Box/Leads/TimeFrames.html
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>
1 change: 1 addition & 0 deletions Resources/Private/Templates/Lead/List.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<div data-lux-container="detail">
<f:render partial="Box/Analysis/Pagevisits" arguments="{_all}"/>
<f:render partial="Box/Leads/Hottest" arguments="{_all}"/>
<f:render partial="Box/Leads/TimeFrames" arguments="{_all}"/>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'description' => 'Living User Experience - LUX - the Marketing Automation tool for TYPO3.
Turn your visitors to leads. Identification and profiling of your visitors within your TYPO3 website.',
'category' => 'plugin',
'version' => '33.0.1',
'version' => '33.1.0',
'author' => 'Alex Kellner',
'author_email' => 'alexander.kellner@in2code.de',
'author_company' => 'in2code.de',
Expand Down

0 comments on commit 249b1fb

Please sign in to comment.