diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2019-06-19 01:05:52 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2019-06-19 01:05:52 +0300 |
commit | b3555e1f1efcbb63158e6c116e1fb5c8805851f8 (patch) | |
tree | 5a3cd39cc9051cda2b949669530c5cde753ce92d /plugins/Tour/Dao | |
parent | 57f7184a0dc49df4eacbbd27ca0aef909668b410 (diff) |
Add widget to help users getting started and complete important steps with Matomo (#12468)
* added Tour plugin
* enable tour plugin by default
* better logic to handle steps
* refactor plugin, add more steps
* lots more code improvements, ui improvements, translations, challenges
* lots of more improvements
* adding more challenges
* improve detection
* more tweaks and tests
* a few more tweaks
* update some wordings
* switch two levels talent and professional
* apply review feedback
* Update ChallengeCustomLogo.php
* Expected files for system tests
Diffstat (limited to 'plugins/Tour/Dao')
-rw-r--r-- | plugins/Tour/Dao/DataFinder.php | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/plugins/Tour/Dao/DataFinder.php b/plugins/Tour/Dao/DataFinder.php new file mode 100644 index 0000000000..587f062222 --- /dev/null +++ b/plugins/Tour/Dao/DataFinder.php @@ -0,0 +1,61 @@ +<?php +/** + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\Tour\Dao; + +use Piwik\Common; + +class DataFinder +{ + + public function hasTrackedData() + { + $sql = sprintf('SELECT idsite FROM %s LIMIT 1', Common::prefixTable('log_visit')); + + $result = \Piwik\Db::fetchOne($sql, array()); + + return !empty($result); + } + + public function hasAddedWebsite($login) + { + $sql = sprintf("SELECT count(*) as num_websites FROM %s WHERE idsite != 1 and creator_login = ? LIMIT 1", Common::prefixTable('site')); + + $result = \Piwik\Db::fetchOne($sql, array($login)); + + return $result > 0; + } + + public function hasAddedNewEmailReport($login) + { + $sql = sprintf("SELECT count(*) as num_reports FROM %s WHERE login = ? LIMIT 1", Common::prefixTable('report')); + + $result = \Piwik\Db::fetchOne($sql, array($login)); + + return $result > 0; + } + + public function hasAddedOrCustomisedDashboard($login) + { + $sql = sprintf("SELECT count(*) as num_dashboards FROM %s WHERE login = ? LIMIT 1", Common::prefixTable('user_dashboard')); + + $result = \Piwik\Db::fetchOne($sql, array($login)); + + return $result > 0; + } + + public function hasAddedSegment($login) + { + $sql = sprintf("SELECT count(*) as num_segments FROM %s WHERE login = ? LIMIT 1", Common::prefixTable('segment')); + + $result = \Piwik\Db::fetchOne($sql, array($login)); + + return $result > 0; + } + +}
\ No newline at end of file |