PDF rausgenommen

This commit is contained in:
aschwarz
2023-01-23 11:03:31 +01:00
parent 82d562a322
commit a6523903eb
28078 changed files with 4247552 additions and 2 deletions

View File

@ -0,0 +1,60 @@
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Events\Columns;
use Piwik\Columns\Discriminator;
use Piwik\Columns\Join\ActionNameJoin;
use Piwik\Exception\InvalidRequestParameterException;
use Piwik\Plugin\Dimension\ActionDimension;
use Piwik\Plugins\Events\Actions\ActionEvent;
use Piwik\Tracker\Action;
use Piwik\Tracker\Request;
class EventAction extends ActionDimension
{
protected $columnName = 'idaction_event_action';
protected $columnType = 'INTEGER(10) UNSIGNED DEFAULT NULL';
protected $type = self::TYPE_TEXT;
protected $segmentName = 'eventAction';
protected $nameSingular = 'Events_EventAction';
protected $namePlural = 'Events_EventActions';
protected $category = 'Events_Events';
protected $sqlFilter = '\Piwik\Tracker\TableLogAction::getIdActionFromSegment';
public function getDbColumnJoin()
{
return new ActionNameJoin();
}
public function getDbDiscriminator()
{
return new Discriminator('log_action', 'type', $this->getActionId());
}
public function getActionId()
{
return Action::TYPE_EVENT_ACTION;
}
public function onLookupAction(Request $request, Action $action)
{
if (!($action instanceof ActionEvent)) {
return false;
}
$eventAction = $action->getEventAction();
$eventAction = trim($eventAction);
if (strlen($eventAction) > 0) {
return $eventAction;
}
throw new InvalidRequestParameterException('Param `e_a` must not be empty or filled with whitespaces');
}
}

View File

@ -0,0 +1,60 @@
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Events\Columns;
use Piwik\Columns\Discriminator;
use Piwik\Columns\Join\ActionNameJoin;
use Piwik\Exception\InvalidRequestParameterException;
use Piwik\Plugin\Dimension\ActionDimension;
use Piwik\Plugins\Events\Actions\ActionEvent;
use Piwik\Tracker\Action;
use Piwik\Tracker\Request;
class EventCategory extends ActionDimension
{
protected $columnName = 'idaction_event_category';
protected $columnType = 'INTEGER(10) UNSIGNED DEFAULT NULL';
protected $type = self::TYPE_TEXT;
protected $category = 'Events_Events';
protected $sqlFilter = '\Piwik\Tracker\TableLogAction::getIdActionFromSegment';
protected $segmentName = 'eventCategory';
protected $nameSingular = 'Events_EventCategory';
protected $namePlural = 'Events_EventCategories';
public function getDbColumnJoin()
{
return new ActionNameJoin();
}
public function getDbDiscriminator()
{
return new Discriminator('log_action', 'type', $this->getActionId());
}
public function getActionId()
{
return Action::TYPE_EVENT_CATEGORY;
}
public function onLookupAction(Request $request, Action $action)
{
if (!($action instanceof ActionEvent)) {
return false;
}
$eventCategory = $action->getEventCategory();
$eventCategory = trim($eventCategory);
if (strlen($eventCategory) > 0) {
return $eventCategory;
}
throw new InvalidRequestParameterException('Param `e_c` must not be empty or filled with whitespaces');
}
}

View File

@ -0,0 +1,58 @@
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Events\Columns;
use Piwik\Columns\Discriminator;
use Piwik\Columns\Join\ActionNameJoin;
use Piwik\Plugin\Dimension\ActionDimension;
use Piwik\Plugins\Events\Actions\ActionEvent;
use Piwik\Tracker\Action;
use Piwik\Tracker\Request;
class EventName extends ActionDimension
{
protected $columnName = 'idaction_name';
protected $type = self::TYPE_TEXT;
protected $category = 'Events_Events';
protected $sqlFilter = '\Piwik\Tracker\TableLogAction::getIdActionFromSegment';
protected $segmentName = 'eventName';
protected $nameSingular = 'Events_EventName';
protected $namePlural = 'Events_EventNames';
public function getDbColumnJoin()
{
return new ActionNameJoin();
}
public function getDbDiscriminator()
{
return new Discriminator('log_action', 'type', $this->getActionId());
}
public function getActionId()
{
return Action::TYPE_EVENT_NAME;
}
public function onLookupAction(Request $request, Action $action)
{
if (!($action instanceof ActionEvent)) {
return false;
}
$eventName = $action->getEventName();
$eventName = trim($eventName);
if (strlen($eventName) > 0) {
return $eventName;
}
return false;
}
}

View File

@ -0,0 +1,38 @@
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Events\Columns;
use Piwik\Columns\Discriminator;
use Piwik\Columns\Join\ActionNameJoin;
use Piwik\Plugin\Dimension\ActionDimension;
use Piwik\Tracker\Action;
class EventUrl extends ActionDimension
{
protected $columnName = 'idaction_url';
protected $segmentName = 'eventUrl';
protected $nameSingular = 'Events_EventUrl';
protected $namePlural = 'Events_EventUrls';
protected $type = self::TYPE_URL;
protected $acceptValues = 'The URL must be URL encoded, for example: http%3A%2F%2Fexample.com%2Fpath%2Fpage%3Fquery';
protected $category = 'Events_Events';
protected $sqlFilter = '\\Piwik\\Tracker\\TableLogAction::getIdActionFromSegment';
public function getDbColumnJoin()
{
return new ActionNameJoin();
}
public function getDbDiscriminator()
{
return new Discriminator('log_action', 'type', Action::TYPE_EVENT);
}
}

View File

@ -0,0 +1,57 @@
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Events\Columns;
use Piwik\Columns\DimensionMetricFactory;
use Piwik\Columns\Discriminator;
use Piwik\Columns\MetricsList;
use Piwik\Piwik;
use Piwik\Plugin\ArchivedMetric;
use Piwik\Plugin\ComputedMetric;
use Piwik\Plugin\Dimension\ActionDimension;
use Piwik\Tracker\Action;
class EventValue extends ActionDimension
{
protected $nameSingular = 'Events_EventValue';
protected $columnName = 'custom_float';
protected $category = 'Events_Events';
protected $type = self::TYPE_FLOAT;
protected $segmentName = 'eventValue';
public function getDbDiscriminator()
{
return new Discriminator('log_action', 'type', Action::TYPE_EVENT);
}
public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
{
$metric1 = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_SUM);
$metricsList->addMetric($metric1);
$metric2 = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_MAX);
$metric2->setDocumentation(Piwik::translate('Events_MaxValueDocumentation'));
$metricsList->addMetric($metric2);
$metric4 = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_MIN);
$metric4->setDocumentation(Piwik::translate('Events_MinValueDocumentation'));
$metricsList->addMetric($metric4);
$metric3 = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_COUNT_WITH_NUMERIC_VALUE);
$metric3->setName('events_with_event_value');
$metric3->setTranslatedName(Piwik::translate('Events_EventsWithValue'));
$metric3->setDocumentation(Piwik::translate('Events_EventsWithValueDocumentation'));
$metricsList->addMetric($metric3);
$metric = $dimensionMetricFactory->createComputedMetric($metric1->getName(), $metric3->getName(), ComputedMetric::AGGREGATION_AVG);
$metric->setName('avg_event_value');
$metric->setTranslatedName(Piwik::translate('Events_AvgValue'));
$metricsList->addMetric($metric);
}
}

View File

@ -0,0 +1,45 @@
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\Events\Columns\Metrics;
use Piwik\DataTable\Row;
use Piwik\Piwik;
use Piwik\Plugin\ProcessedMetric;
/**
* The average value for a triggered event. Calculated as:
*
* sum_event_value / nb_events_with_value
*
* sum_event_value and nb_events_with_value are calculated by the Event archiver.
*/
class AverageEventValue extends ProcessedMetric
{
public function getName()
{
return 'avg_event_value';
}
public function getTranslatedName()
{
return Piwik::translate('Events_AvgValueDocumentation');
}
public function compute(Row $row)
{
$sumEventValue = $this->getMetric($row, 'sum_event_value');
$eventsWithValue = $this->getMetric($row, 'nb_events_with_value');
return Piwik::getQuotientSafe($sumEventValue, $eventsWithValue, $precision = 2);
}
public function getDependentMetrics()
{
return array('sum_event_value', 'nb_events_with_value');
}
}

View File

@ -0,0 +1,64 @@
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Events\Columns;
use Piwik\Plugin\Dimension\VisitDimension;
use Piwik\Tracker\Action;
use Piwik\Tracker\Request;
use Piwik\Tracker\Visitor;
class TotalEvents extends VisitDimension
{
protected $columnName = 'visit_total_events';
protected $columnType = 'INT(11) UNSIGNED NULL';
protected $segmentName = 'events';
protected $nameSingular = 'Events_Events';
protected $acceptValues = 'To select all visits who triggered an Event, use: &segment=events>0';
protected $type = self::TYPE_NUMBER;
/**
* @param Request $request
* @param Visitor $visitor
* @param Action|null $action
* @return mixed
*/
public function onNewVisit(Request $request, Visitor $visitor, $action)
{
if ($this->isEventAction($action)) {
return 1;
}
return 0;
}
/**
* @param Request $request
* @param Visitor $visitor
* @param Action|null $action
* @return int
*/
public function onExistingVisit(Request $request, Visitor $visitor, $action)
{
if ($this->isEventAction($action)) {
return 'visit_total_events + 1';
}
return false;
}
/**
* @param Action|null $action
* @return bool
*/
private function isEventAction($action)
{
return ($action && $action->getActionType() == Action::TYPE_EVENT);
}
}