Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorPeter Zhang <peter@innocraft.com>2022-03-07 16:49:49 +0300
committerGitHub <noreply@github.com>2022-03-07 16:49:49 +0300
commit8188140d9daf90b2aec1bbd6ff76b2218c288ad0 (patch)
treedb985a017982221f5e5daf5671dea5b2691e757f /core
parentd25af6d0a0db467ffd4d4e58540906e554483879 (diff)
[UI] add report date on overview reports and fix date display (#18838)
* update date on overview update date on overview * built vue files * Update plugins/CoreHome/templates/_dataTable.twig Co-authored-by: Stefan Giehl <stefan@matomo.org> * update largest key update largest key * update checks update checks * Update Map.php reset map class * Update Visualization.php update a condition * Update Visualization.php update some condition * Update Visualization.php convert meta data to local var * ini $metadata ini $metadata * Update Visualization.php update error * Update core/Plugin/Visualization.php Co-authored-by: Stefan Giehl <stefan@matomo.org> Co-authored-by: peterhashair <peterhashair@users.noreply.github.com> Co-authored-by: Stefan Giehl <stefan@matomo.org>
Diffstat (limited to 'core')
-rw-r--r--core/Plugin/Visualization.php36
1 files changed, 29 insertions, 7 deletions
diff --git a/core/Plugin/Visualization.php b/core/Plugin/Visualization.php
index dd99f5a5e8..b2ff753f31 100644
--- a/core/Plugin/Visualization.php
+++ b/core/Plugin/Visualization.php
@@ -157,7 +157,6 @@ class Visualization extends ViewDataTable
private $templateVars = array();
private $reportLastUpdatedMessage = null;
- private $metadata = null;
protected $metricsFormatter = null;
/**
@@ -458,14 +457,35 @@ class Visualization extends ViewDataTable
}
// deal w/ table metadata
+ $metadata = null;
if ($this->dataTable instanceof DataTable) {
- $this->metadata = $this->dataTable->getAllTableMetadata();
-
- if (isset($this->metadata[DataTable::ARCHIVED_DATE_METADATA_NAME])) {
- $this->reportLastUpdatedMessage = $this->makePrettyArchivedOnText();
+ $metadata = $this->dataTable->getAllTableMetadata();
+ } else {
+ // if the dataTable is Map
+ if ($this->dataTable instanceof DataTable\Map) {
+ // load all the data
+ $dataTable = $this->dataTable->getDataTables();
+ // find the latest key
+ foreach ($dataTable as $item) {
+ $itemMetaData = $item->getAllTableMetadata();
+ // initial metadata and update metadata if current is more recent
+ if (!empty($itemMetaData[DataTable::ARCHIVED_DATE_METADATA_NAME])
+ && (
+ empty($metadata[DataTable::ARCHIVED_DATE_METADATA_NAME])
+ || strtotime($itemMetaData[DataTable::ARCHIVED_DATE_METADATA_NAME]) > strtotime($metadata[DataTable::ARCHIVED_DATE_METADATA_NAME])
+ )
+ ) {
+ $metadata = $itemMetaData;
+ }
+ }
}
}
+ // if metadata set display report date
+ if (!empty($metadata[DataTable::ARCHIVED_DATE_METADATA_NAME])) {
+ $this->reportLastUpdatedMessage = $this->makePrettyArchivedOnText($metadata[DataTable::ARCHIVED_DATE_METADATA_NAME]);
+ }
+
$pivotBy = Common::getRequestVar('pivotBy', false) ?: $this->requestConfig->pivotBy;
if (empty($pivotBy)
&& $this->dataTable instanceof DataTable
@@ -558,14 +578,16 @@ class Visualization extends ViewDataTable
}
}
+
/**
* Returns prettified and translated text that describes when a report was last updated.
*
+ * @param $dateText
* @return string
+ * @throws \Exception
*/
- private function makePrettyArchivedOnText()
+ private function makePrettyArchivedOnText($dateText)
{
- $dateText = $this->metadata[DataTable::ARCHIVED_DATE_METADATA_NAME];
$date = Date::factory($dateText);
$today = mktime(0, 0, 0);
$metricsFormatter = new HtmlFormatter();