<?php
namespace App\EntityList; class UserTraces extends GeneralMtAbstract { public function __construct() { global $DBTUserTraces; $this->tableName = $DBTUserTraces; $this->tableAlias = 'userTraces'; $this->setColumn('timestamp'); parent::__construct(); } public function getMonthTablesList(): array { $period = $this->getMonthTablesList_period(['userTraces.timestamp', 'timestamp']); if ($period['startDate'] > $period['endDate']) { return []; } $userTracesMonthsList = array_keys(\App\Utils\Db\TablesUtilsCached::getInstance()->getExistingMonthTablesByInterval($this->tableName, $period['startDate'], $period['endDate'])); return $userTracesMonthsList; } protected function getMonthTablesList_period(array $columns): array { $startDate = 946684800; $endDate = 16756675200; foreach($this->filters as $filter) { if (in_array($filter['fullColumn'], $columns)) { if (($filter['sign'] == ">=" || $filter['sign'] == ">") && $startDate < $filter['value']) { $startDate = $filter['value']; } if (($filter['sign'] == "<=" || $filter['sign'] == "<") && $endDate > $filter['value']) { $endDate = $filter['value']; } if ($filter['sign'] == "BETWEEN") { if ($startDate < min($filter['value'])) { $startDate = min($filter['value']); } if ($endDate > max($filter['value'])) { $endDate = max($filter['value']); } } } } return ['startDate' => \Engine\DateTime::createFromTimestamp($startDate)->formatDateIso(), 'endDate' => \Engine\DateTime::createFromTimestamp($endDate)->formatDateIso()]; } protected function addUserRestrictionFilter() { } }