diff options
author | robocoder <anthon.pang@gmail.com> | 2010-02-24 01:47:29 +0300 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2010-02-24 01:47:29 +0300 |
commit | eb9a42abee1dd06fae0acb63890d0829bc72b4dc (patch) | |
tree | fa3593fbfa9a18a99f45e8f5c3bbfc83d237b081 /plugins/Live/Visitor.php | |
parent | 8ff1cae24b55a85a3f87b7400f8b701bd65a6a1f (diff) |
refs #1120 - merged from Live.zip as there were too many conflicts with piwik.patch against the svn trunk
git-svn-id: http://dev.piwik.org/svn/trunk@1868 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/Live/Visitor.php')
-rw-r--r-- | plugins/Live/Visitor.php | 121 |
1 files changed, 81 insertions, 40 deletions
diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php index 6afce54ddb..a90ba8f94a 100644 --- a/plugins/Live/Visitor.php +++ b/plugins/Live/Visitor.php @@ -1,11 +1,11 @@ <?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$ - * + * * @category Piwik_Plugins * @package Piwik_Live */ @@ -35,7 +35,7 @@ class Piwik_Live_Visitor { $this->details = $visitorRawData; } - + function getAllVisitorDetails() { return array( @@ -54,7 +54,7 @@ class Piwik_Live_Visitor 'visitLengthPretty' => $this->getVisitLengthPretty(), 'firstActionTimestamp' => $this->getTimestampFirstAction(), 'lastActionTimestamp' => $this->getTimestampLastAction(), - + 'refererType' => $this->getRefererType(), 'refererName' => $this->getRefererTypeName(), 'keywords' => $this->getKeywords(), @@ -62,7 +62,7 @@ class Piwik_Live_Visitor 'refererName' => $this->getRefererName(), 'searchEngineUrl' => $this->getSearchEngineUrl(), 'searchEngineIcon' => $this->getSearchEngineIcon(), - + 'operatingSystem' => $this->getOperatingSystem(), 'operatingSystemShortName' => $this->getOperatingSystemShortName(), 'operatingSystemIcon' => $this->getOperatingSystemIcon(), @@ -75,14 +75,17 @@ class Piwik_Live_Visitor 'screenIcon' => $this->getScreenTypeIcon(), 'plugins' => $this->getPlugins(), 'lastActionDateTime' => $this->getDateTimeLastAction(), + 'isVisitorGoalConverted' => $this->isVisitorGoalConverted(), + 'goalIcon' => $this->getGoalIcon(), + 'goalType' => $this->getGoalType(), ); } - + function getServerDate() { return $this->details['visit_server_date']; } - + function getIp() { if(isset($this->details['location_ip'])) @@ -91,17 +94,17 @@ class Piwik_Live_Visitor } return false; } - + function getIdVisit() { return $this->details['idvisit']; } - + function getIdSite() { return $this->details['idsite']; } - + function getNumberOfActions() { return $this->details['visit_total_actions']; @@ -111,42 +114,42 @@ class Piwik_Live_Visitor { return $this->details['visit_total_time']; } - + function getVisitLengthPretty() { return Piwik::getPrettyTimeFromSeconds($this->details['visit_total_time']); } - + function isVisitorReturning() { return $this->details['visitor_returning']; } - + function getTimestampFirstAction() { return strtotime($this->details['visit_first_action_time']); } - + function getTimestampLastAction() { return strtotime($this->details['visit_last_action_time']); } - + function getCountryName() { return Piwik_CountryTranslate($this->details['location_country']); } - + function getCountryFlag() { return Piwik_getFlagFromCode($this->details['location_country']); } - + function getContinent() { return Piwik_ContinentTranslate($this->details['location_continent']); } - + function getRefererType() { $map = array( @@ -161,27 +164,27 @@ class Piwik_Live_Visitor } return $map[Piwik_Common::REFERER_TYPE_DIRECT_ENTRY]; } - + function getRefererTypeName() { return Piwik_getRefererTypeLabel($this->details['referer_type']); } - + function getKeywords() { return $this->details['referer_keyword']; } - + function getRefererUrl() { - return $this->details['referer_url']; + return $this->details['referer_url']; } - + function getRefererName() { - return $this->details['referer_name']; + return $this->details['referer_name']; } - + function getSearchEngineUrl() { if($this->getRefererType() == 'searchEngine' @@ -191,7 +194,7 @@ class Piwik_Live_Visitor } return null; } - + function getSearchEngineIcon() { $searchEngineUrl = $this->getSearchEngineUrl(); @@ -204,7 +207,7 @@ class Piwik_Live_Visitor function getPlugins() { - $plugins = array( + $plugins = array( 'config_pdf', 'config_flash', 'config_java', @@ -218,10 +221,10 @@ class Piwik_Live_Visitor $return = array(); foreach($plugins as $plugin) { - if($this->details[$plugin] == 1) + if($this->details[$plugin] == 1) { $pluginShortName = substr($plugin, 7); - $return[] = $pluginShortName; + $return[] = $pluginShortName; } } return implode(", ", $return); @@ -231,12 +234,12 @@ class Piwik_Live_Visitor { return Piwik_getOSLabel($this->details['config_os']); } - + function getOperatingSystemShortName() { return Piwik_getOSShortLabel($this->details['config_os']); } - + function getOperatingSystemIcon() { return Piwik_getOSLogo($this->details['config_os']); @@ -246,49 +249,87 @@ class Piwik_Live_Visitor { return Piwik_getBrowserTypeLabel($this->getBrowserFamily()); } - + function getBrowserFamily() { return Piwik_getBrowserFamily($this->details['config_browser_name']); } - + function getBrowser() { return Piwik_getBrowserLabel($this->details['config_browser_name'] . ";" . $this->details['config_browser_version']); } - + function getBrowserIcon() { return Piwik_getBrowsersLogo($this->details['config_browser_name'] . ";" . $this->details['config_browser_version']); } - + function getScreenType() { return Piwik_getScreenTypeFromResolution($this->details['config_resolution']); } - + function getResolution() { return $this->details['config_resolution']; } - + function getScreenTypeIcon() { return Piwik_getScreensLogo($this->getScreenType()); } - + function getProvider() { return Piwik_getHostnameName($this->details['location_provider']); } - + function getProviderUrl() { return Piwik_getHostnameUrl($this->details['location_provider']); } - + function getDateTimeLastAction() { return date('Y-m-d H:i:s', strtotime($this->details['visit_last_action_time'])); } + + function isVisitorGoalConverted() + { + return $this->details['visit_goal_converted']; + } + + function getGoalType() + { + if(isset($this->details['match_attribute'])){ + return $this->details['match_attribute']; + } + else { + return false; + } + } + + function getGoalIcon() + { + $goalicon = ""; + if(isset($this->details['match_attribute'])){ + switch ($this->details['match_attribute']) { + case "url": + $goalicon = "plugins/Live/templates/images/goal.png"; + break; + case "file": + $goalicon = "plugins/Live/templates/images/download.png"; + break; + case "external_website": + $goalicon = "plugins/Live/templates/images/outboundlink.png"; + break; + } + return $goalicon; + } + else { + return false; + } + } + } |