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
diff options
context:
space:
mode:
authormatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2008-04-17 02:28:03 +0400
committermatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2008-04-17 02:28:03 +0400
commitf85e6caa77c092cfb736b4d0250bec92a0d973a3 (patch)
tree87b870466b3ae7e36f3bddca06b3dbc82ec37c31 /plugins/VisitTime
parent48187389f65599017f4f1fabcc8054069015e445 (diff)
[mauser]- refs #62 commited huge work by Maciej ZawadziƄski: thanks! still some work to do + QA but looks really good :)
[mauser]- refs #116 commited partial fix [mauser]- refs #65 commited partial fix - fixed broken tests
Diffstat (limited to 'plugins/VisitTime')
-rw-r--r--plugins/VisitTime/VisitTime.php195
-rw-r--r--plugins/VisitTime/index.tpl17
-rw-r--r--plugins/VisitTime/lang/en.php10
3 files changed, 117 insertions, 105 deletions
diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php
index 484e3f0b2b..99389c148d 100644
--- a/plugins/VisitTime/VisitTime.php
+++ b/plugins/VisitTime/VisitTime.php
@@ -1,96 +1,99 @@
-<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
- * @version $Id$
- *
- *
- * @package Piwik_VisitTime
- */
-
-/**
- *
- * @package Piwik_VisitTime
- */
-class Piwik_VisitTime extends Piwik_Plugin
-{
- public function __construct()
- {
- parent::__construct();
- }
-
- public function getInformation()
- {
- $info = array(
- 'name' => 'VisitTime',
- 'description' => 'Visit Local & Server Time',
- 'author' => 'Piwik',
- 'homepage' => 'http://piwik.org/',
- 'version' => '0.1',
- );
-
- return $info;
- }
-
- function getListHooksRegistered()
- {
- $hooks = array(
- 'ArchiveProcessing_Day.compute' => 'archiveDay',
- 'ArchiveProcessing_Period.compute' => 'archiveMonth',
- );
- return $hooks;
- }
-
- function archiveMonth( $notification )
- {
- $archiveProcessing = $notification->getNotificationObject();
-
- $dataTableToSum = array(
- 'VisitTime_localTime',
- 'VisitTime_serverTime',
- );
-
- $archiveProcessing->archiveDataTable($dataTableToSum);
- }
- public function archiveDay( $notification )
- {
- $archiveProcessing = $notification->getNotificationObject();
-
- $this->archiveProcessing = $archiveProcessing;
-
- $recordName = 'VisitTime_localTime';
- $labelSQL = "HOUR(visitor_localtime)";
- $tableLocalTime = $archiveProcessing->getDataTableInterestForLabel($labelSQL);
- $this->makeSureAllHoursAreSet($tableLocalTime);
- $record = new Piwik_ArchiveProcessing_Record_BlobArray($recordName, $tableLocalTime->getSerialized());
-// echo $tableLocalTime;
-
- $recordName = 'VisitTime_serverTime';
- $labelSQL = "HOUR(visit_first_action_time)";
- $tableServerTime = $archiveProcessing->getDataTableInterestForLabel($labelSQL);
- $this->makeSureAllHoursAreSet($tableServerTime);
- $record = new Piwik_ArchiveProcessing_Record_BlobArray($recordName, $tableServerTime->getSerialized());
-// echo $tableServerTime;
- }
-
- private function makeSureAllHoursAreSet($table)
- {
- for($i=0;$i<=23;$i++)
- {
- if($table->getRowFromLabel($i) === false)
- {
- $row = $this->archiveProcessing->getNewInterestRowLabeled($i);
- $table->addRow( $row );
- }
- }
- }
-}
-
-
-Piwik_AddWidget( 'VisitTime', 'getVisitInformationPerLocalTime', 'Visits by local time');
-Piwik_AddWidget( 'VisitTime', 'getVisitInformationPerServerTime', 'Visits by server time');
-
-Piwik_AddMenu('Visitors', 'Times', array('module' => 'VisitTime'));
-
+<?php
+/**
+ * Piwik - Open source web analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
+ * @version $Id$
+ *
+ *
+ * @package Piwik_VisitTime
+ */
+
+/**
+ *
+ * @package Piwik_VisitTime
+ */
+class Piwik_VisitTime extends Piwik_Plugin
+{
+ public function __construct()
+ {
+ parent::__construct();
+ }
+
+ public function getInformation()
+ {
+ $info = array(
+ 'name' => 'VisitTime',
+ 'description' => 'Visit Local & Server Time',
+ 'author' => 'Piwik',
+ 'homepage' => 'http://piwik.org/',
+ 'version' => '0.1',
+ 'translationAvailable' => true
+ );
+
+ return $info;
+ }
+
+ function postLoad()
+ {
+ Piwik_AddWidget( 'VisitTime', 'getVisitInformationPerLocalTime', Piwik_Translate('VisitTime_WidgetLocalTime'));
+ Piwik_AddWidget( 'VisitTime', 'getVisitInformationPerServerTime', Piwik_Translate('VisitTime_WidgetServerTime'));
+
+ Piwik_AddMenu('Visitors', Piwik_Translate('VisitTime_SubmenuTimes'), array('module' => 'VisitTime'));
+ }
+
+ function getListHooksRegistered()
+ {
+ $hooks = array(
+ 'ArchiveProcessing_Day.compute' => 'archiveDay',
+ 'ArchiveProcessing_Period.compute' => 'archiveMonth',
+ );
+ return $hooks;
+ }
+
+ function archiveMonth( $notification )
+ {
+ $archiveProcessing = $notification->getNotificationObject();
+
+ $dataTableToSum = array(
+ 'VisitTime_localTime',
+ 'VisitTime_serverTime',
+ );
+
+ $archiveProcessing->archiveDataTable($dataTableToSum);
+ }
+ public function archiveDay( $notification )
+ {
+ $archiveProcessing = $notification->getNotificationObject();
+
+ $this->archiveProcessing = $archiveProcessing;
+
+ $recordName = 'VisitTime_localTime';
+ $labelSQL = "HOUR(visitor_localtime)";
+ $tableLocalTime = $archiveProcessing->getDataTableInterestForLabel($labelSQL);
+ $this->makeSureAllHoursAreSet($tableLocalTime);
+ $record = new Piwik_ArchiveProcessing_Record_BlobArray($recordName, $tableLocalTime->getSerialized());
+// echo $tableLocalTime;
+
+ $recordName = 'VisitTime_serverTime';
+ $labelSQL = "HOUR(visit_first_action_time)";
+ $tableServerTime = $archiveProcessing->getDataTableInterestForLabel($labelSQL);
+ $this->makeSureAllHoursAreSet($tableServerTime);
+ $record = new Piwik_ArchiveProcessing_Record_BlobArray($recordName, $tableServerTime->getSerialized());
+// echo $tableServerTime;
+ }
+
+ private function makeSureAllHoursAreSet($table)
+ {
+ for($i=0;$i<=23;$i++)
+ {
+ if($table->getRowFromLabel($i) === false)
+ {
+ $row = $this->archiveProcessing->getNewInterestRowLabeled($i);
+ $table->addRow( $row );
+ }
+ }
+ }
+}
+
diff --git a/plugins/VisitTime/index.tpl b/plugins/VisitTime/index.tpl
index 9b8223ddad..befd61e2ec 100644
--- a/plugins/VisitTime/index.tpl
+++ b/plugins/VisitTime/index.tpl
@@ -1,9 +1,8 @@
-<div id='leftcolumn'>
-<h2>Visit per local time</h2>
-{$dataTableVisitInformationPerLocalTime}
-</div>
-
-<div id='rightcolumn'>
-<h2>Visit per server time</h2>
-{$dataTableVisitInformationPerServerTime}
-</div> \ No newline at end of file
+<div id='leftcolumn'>
+<h2>{'VisitTime_LocalTime'|translate}</h2>
+{$dataTableVisitInformationPerLocalTime}
+</div>
+
+<div id='rightcolumn'>
+<h2>{'VisitTime_ServerTime'|translate}</h2>
+{$dataTableVisitInformationPerServerTime}
diff --git a/plugins/VisitTime/lang/en.php b/plugins/VisitTime/lang/en.php
new file mode 100644
index 0000000000..058800818e
--- /dev/null
+++ b/plugins/VisitTime/lang/en.php
@@ -0,0 +1,10 @@
+<?php
+$translations = array(
+ 'VisitTime_LocalTime' => 'Visit per local time',
+ 'VisitTime_ServerTime' => 'Visit per server time',
+
+ 'VisitTime_WidgetLocalTime' => 'Visits by local time',
+ 'VisitTime_WidgetServerTime' => 'Visits by server time',
+
+ 'VisitTime_SubmenuTimes' => 'Times',
+);