Ticket #1120: #1120-27LivePlugin.diff

File #1120-27LivePlugin.diff, 22.4 KB (added by peterb, 22 months ago)

Fixing #1375, #1319

  • plugins/Live/API.php

    ### Eclipse Workspace Patch 1.0
    #P trunk
     
    3333                } 
    3434                return self::$instance; 
    3535        } 
    36          
     36 
    3737        const TYPE_FETCH_VISITS = 1; 
    3838        const TYPE_FETCH_PAGEVIEWS = 2; 
    3939 
     
    7070        /* 
    7171         * @return Piwik_DataTable 
    7272         */ 
    73         public function getLastVisitsDetails( $idSite, $limit = 1000, $minIdVisit = false ) 
     73        public function getLastVisitsDetails( $idSite, $limit = 25, $minIdVisit = false ) 
    7474        { 
    7575                Piwik::checkUserHasViewAccess($idSite); 
    76                 $visitorDetails = $this->loadLastVisitorDetailsFromDatabase($idSite, $visitorId = null, $limit, $minIdVisit); 
     76                $visitorDetails = $this->loadLastVisitorDetailsFromDatabase($idSite, $visitorId = null, $limit, $minIdVisit, true); 
    7777                $dataTable = $this->getCleanedVisitorsFromDetails($visitorDetails, $idSite); 
    7878                return $dataTable; 
    7979        } 
     
    118118                $visitorData = $this->loadLastVisitorInLastXTimeFromDatabase($idSite, $minutes, $days = 0, self::TYPE_FETCH_PAGEVIEWS); 
    119119                return $visitorData; 
    120120        } 
    121          
     121 
    122122        /* 
    123123         * @return Piwik_DataTable 
    124124         */ 
     
    144144                        $sql = " 
    145145                                SELECT DISTINCT " .Piwik_Common::prefixTable('log_action').".name AS pageUrl 
    146146                                FROM " .Piwik_Common::prefixTable('log_link_visit_action')." 
    147                                         INNER JOIN " .Piwik_Common::prefixTable('log_action')."  
     147                                        INNER JOIN " .Piwik_Common::prefixTable('log_action')." 
    148148                                        ON  " .Piwik_Common::prefixTable('log_link_visit_action').".idaction_url = " .Piwik_Common::prefixTable('log_action').".idaction 
    149149                                WHERE " .Piwik_Common::prefixTable('log_link_visit_action').".idvisit = $idvisit; 
    150150                                 "; 
     
    154154                        $sql = " 
    155155                                SELECT DISTINCT " .Piwik_Common::prefixTable('log_action').".name AS pageUrl 
    156156                                FROM " .Piwik_Common::prefixTable('log_link_visit_action')." 
    157                                         INNER JOIN " .Piwik_Common::prefixTable('log_action')."  
     157                                        INNER JOIN " .Piwik_Common::prefixTable('log_action')." 
    158158                                        ON  " .Piwik_Common::prefixTable('log_link_visit_action').".idaction_name = " .Piwik_Common::prefixTable('log_action').".idaction 
    159159                                WHERE " .Piwik_Common::prefixTable('log_link_visit_action').".idvisit = $idvisit; 
    160160                                 "; 
     
    169169        /* 
    170170         * @return array 
    171171         */ 
    172         private function loadLastVisitorDetailsFromDatabase($idSite, $visitorId = null, $limit = null, $minIdVisit = false ) 
     172        private function loadLastVisitorDetailsFromDatabase($idSite, $visitorId = null, $limit = null, $minIdVisit = false, $dateDependant = null) 
    173173        { 
    174174                $where = $whereBind = array(); 
    175175 
     
    188188                        $whereBind[] = $minIdVisit; 
    189189                } 
    190190 
     191                if(!empty($dateDependant)) { 
     192                        $period = Piwik_Common::getRequestVar('period', false); 
     193                        $date = Piwik_Common::getRequestVar('date',  false); 
     194                        $offset = Piwik_Common::getRequestVar('filter_offset', 0, "int"); 
     195 
     196                        $limit = 25+(int)$offset; 
     197                } 
     198 
     199                // SQL Filter with provided period 
     200                if (!empty($period) && !empty($date)) { 
     201 
     202                        $currentSite = new Piwik_Site($idSite); 
     203                        $currentTimezone = $currentSite->getTimezone(); 
     204                        $processedDate = Piwik_Date::factory($date, $currentTimezone); 
     205                        $processedPeriod = Piwik_Period::factory($period, $processedDate); 
     206 
     207                        array_push(     $where, Piwik_Common::prefixTable('log_visit') . ".visit_first_action_time BETWEEN ? AND ?"); 
     208                        array_push(     $whereBind, 
     209                        $processedPeriod->getDateStart()->toString(), 
     210                        $processedPeriod->getDateEnd()->addDay(1)->toString()); 
     211                } 
     212 
    191213                $sqlWhere = ""; 
    192214                if(count($where) > 0) 
    193215                { 
    194216                        $sqlWhere = " WHERE " . join(' AND ', $where); 
    195217                } 
    196218 
    197                 $sql = "SELECT  " . Piwik_Common::prefixTable('log_visit') . ".* ,  
     219                $sql = "SELECT  " . Piwik_Common::prefixTable('log_visit') . ".* , 
    198220                                                " . Piwik_Common::prefixTable ( 'goal' ) . ".match_attribute 
    199221                                FROM " . Piwik_Common::prefixTable('log_visit') . " 
    200                                         LEFT JOIN ".Piwik_Common::prefixTable('log_conversion')."  
     222                                        LEFT JOIN ".Piwik_Common::prefixTable('log_conversion')." 
    201223                                        ON " . Piwik_Common::prefixTable('log_visit') . ".idvisit = " . Piwik_Common::prefixTable('log_conversion') . ".idvisit 
    202                                         LEFT JOIN ".Piwik_Common::prefixTable('goal')."  
     224                                        LEFT JOIN ".Piwik_Common::prefixTable('goal')." 
    203225                                        ON (" . Piwik_Common::prefixTable('goal') . ".idsite = " . Piwik_Common::prefixTable('log_visit') . ".idsite 
    204226                                                AND  " . Piwik_Common::prefixTable('goal') . ".idgoal = " . Piwik_Common::prefixTable('log_conversion') . ".idgoal) 
    205227                                        AND " . Piwik_Common::prefixTable('goal') . ".deleted = 0 
    206                                 $sqlWhere 
     228                                        $sqlWhere 
    207229                                ORDER BY idsite,idvisit DESC 
    208230                                LIMIT $limit"; 
    209231 
     
    235257 
    236258                if($days != 0) 
    237259                { 
    238                         $timeLimit = mktime(0, 0, 0, date("m"),   date("d") - $days + 1,   date("Y")); 
    239                         $where[] = " visit_last_action_time > '".date('Y-m-d H:i:s', $timeLimit)."'"; 
     260                        $oSite = new Piwik_Site($idSite); 
     261                        $sTimezone = $oSite->getTimezone(); 
     262 
     263                        $oDateLocalized = Piwik_Date::factory("now", $sTimezone); 
     264                        $oDateUTC = Piwik_Date::factory("now"); 
     265 
     266                        $aDate["utc"] = $oDateUTC->getTimestamp(); 
     267                        $aDate["localized"] = $oDateLocalized->getTimestamp(); 
     268 
     269                        $siDateOffsetInSeconds = $aDate["localized"] - $aDate["utc"]; 
     270 
     271                        $dateWithOffsetToUTC = date('Y-m-d H:i:s', strtotime($oDateLocalized->toString("Y-m-d 00:00:00"))-($siDateOffsetInSeconds)); 
     272 
     273                        $where[] = " visit_last_action_time > '".$dateWithOffsetToUTC."'"; 
    240274                } 
    241275 
    242276                $sqlWhere = ""; 
     
    252286                                FROM " . Piwik_Common::prefixTable('log_visit') . " 
    253287                                $sqlWhere 
    254288                                ORDER BY idsite,idvisit DESC"; 
    255                  } 
    256                  // Pages 
    257                  elseif($type == self::TYPE_FETCH_PAGEVIEWS) 
    258                  { 
     289                } 
     290                // Pages 
     291                elseif($type == self::TYPE_FETCH_PAGEVIEWS) 
     292                { 
    259293                        $sql = "SELECT " . Piwik_Common::prefixTable('log_link_visit_action') . ".idaction_url 
    260294                                        FROM " . Piwik_Common::prefixTable('log_link_visit_action') . " 
    261                                         INNER JOIN " . Piwik_Common::prefixTable('log_visit') . "  
     295                                        INNER JOIN " . Piwik_Common::prefixTable('log_visit') . " 
    262296                                        ON " . Piwik_Common::prefixTable('log_visit') . ".idvisit = " . Piwik_Common::prefixTable('log_link_visit_action') . ".idvisit 
    263                                 $sqlWhere"; 
    264                  } 
    265                  else 
    266                  { 
    267                         // no $type is set --> ERROR 
    268                         throw new Exception("type parameter is not properly set."); 
    269                  } 
     297                                        $sqlWhere"; 
     298                } 
     299                else 
     300                { 
     301                        // no $type is set --> ERROR 
     302                        throw new Exception("type parameter is not properly set."); 
     303                } 
    270304 
    271305                // return $sql by fetching 
    272306                return Piwik_FetchAll($sql, $whereBind); 
    273307        } 
    274          
    275          
     308 
     309 
    276310        /** 
    277311         * Removes fields that are not meant to be displayed (md5 config hash) 
    278312         * Or that the user should only access if he is super user (cookie, IP) 
    279          *  
     313         * 
    280314         * @return void 
    281315         */ 
    282316        private function cleanVisitorDetails( &$visitorDetails ) 
     
    295329                        } 
    296330                } 
    297331        } 
    298          
     332 
    299333} 
  • plugins/Live/templates/index.tpl

     
    6161                $("#visitsTotal").load("index.php?module=Live&idSite={/literal}{$idSite}{literal}&action=ajaxTotalVisitors"); 
    6262        } 
    6363 
    64         // updates the visit table, to refresh the already presented visotors pages 
     64        // updates the visit table, to refresh the already presented visitors pages 
    6565        function updateVisitBox() 
    6666        { 
    6767                $("#visitsLive").load("index.php?module=Live&idSite={/literal}{$idSite}{literal}&action=getLastVisitsStart"); 
     
    7979</script> 
    8080 
    8181<style> 
    82 #visitsLive { 
    83         text-align:left; 
    84         font-size:90%; 
     82 #visitsLive { 
     83        text-align:left; 
     84        font-size:90%; 
     85        color:#444444; 
     86 } 
     87 #visitsLive .datetime, #visitsLive .country, #visitsLive .referer, #visitsLive .settings, #visitsLive .returning , #visitsLive .countActions{ 
     88        border-bottom: 1px solid #d3d1c5; 
     89        border-right:1px solid #d3d1c5; 
     90        padding:5px 5px 5px 12px; 
    8591} 
    86 #visitsLive .datetime, #visitsLive .country, #visitsLive .referer, #visitsLive .settings, #visitsLive .returning , #visitsLive .countActions{ 
    87         border-bottom:1px solid #C1DAD7; 
    88         border-right:1px solid #C1DAD7; 
    89         padding:5px 5px 5px 12px; 
    90 } 
    9192 
    92 #visitsLive .datetime { 
    93         background:#D4E3ED url(plugins/CoreHome/templates/images/bg_header.jpg) repeat-x scroll 0 0; 
    94         border-top:1px solid #C1DAD7; 
    95         color:#6D929B; 
    96         margin:0; 
    97         text-align:left; 
     93 #visitsLive .datetime { 
     94        background:#E4E2D7; 
     95        border-top:1px solid #d3d1c5; 
     96        margin:0; 
     97        text-align:left; 
    9898} 
    9999 
    100 #visitsLive .country { 
    101         color:#4F6B72; 
    102         background:#FFFFFF url(plugins/CoreHome/templates/images/bullet1.gif) no-repeat scroll 0 0; 
     100 #visitsLive .country { 
     101        background:#FFFFFF url(plugins/CoreHome/templates/images/bullet1.gif) no-repeat scroll 0 0; 
    103102} 
    104103 
    105 #visitsLive .referer { 
    106         background:#F9FAFA none repeat scroll 0 0; 
    107         color:#797268; 
     104 #visitsLive .referer { 
     105        background:#F9FAFA none repeat scroll 0 0; 
    108106} 
    109107 
    110 #visitsLive .pagesTitle { 
    111         display:block; 
    112         float:left; 
    113         padding-top: 3px; 
     108#visitsLive .referer:hover { 
     109        background:#FFFFF7; 
    114110} 
    115111 
    116 #visitsLive .countActions { 
    117         background:#FFFFFF none repeat scroll 0 0; 
    118         color:#4F6B72; 
     112 #visitsLive .pagesTitle { 
     113         display:block; 
     114         float:left; 
    119115} 
    120116 
    121 #visitsLive .settings { 
    122         background:#FFFFFF none repeat scroll 0 0; 
    123         color:#4F6B72; 
    124 } 
     117 #visitsLive .countActions { 
     118         background:#FFFFFF none repeat scroll 0 0; 
     119 } 
    125120 
    126 #visitsLive .returning { 
    127         background:#F9FAFA none repeat scroll 0 0; 
    128         color:#797268; 
    129 } 
     121 #visitsLive .settings { 
     122         background:#FFFFFF none repeat scroll 0 0; 
     123 } 
    130124 
    131 #visitsLive .visit { 
    132 } 
     125 #visitsLive .returning { 
     126         background:#F9FAFA none repeat scroll 0 0; 
     127 } 
    133128 
    134 #visitsLive .alt { 
    135 } 
     129 #visitsLive .actions { 
     130         background:#F9FAFA none repeat scroll 0 0; 
     131         padding:0px 5px 0px 12px; 
     132 } 
    136133 
    137 #visitsLive .actions { 
    138         background:#F9FAFA none repeat scroll 0 0; 
    139         color:#797268; 
    140         padding:0px 5px 0px 12px; 
    141 } 
    142  
    143134</style> 
    144135{/literal} 
    145136 
  • plugins/Live/templates/visitorLog.tpl

     
     1<div class="home" id="content" style="display: block;"><a graphid="VisitsSummarygetEvolutionGraph" name="evolutionGraph"></a> 
     2<h2>Besucherverlauf</h2> 
     3 
     4<div id="{$properties.uniqueId}"> 
     5 
     6{if isset($arrayDataTable.result) and $arrayDataTable.result == 'error'} 
     7                {$arrayDataTable.message} 
     8        {else} 
     9                {if count($arrayDataTable) == 0} 
     10                <a name="{$properties.uniqueId}"></a> 
     11                <div class="pk-emptyDataTable">{'CoreHome_ThereIsNoDataForThisReport'|translate}</div> 
     12                {else} 
     13                        <a name="{$properties.uniqueId}"></a> 
     14 
     15        <table class="dataTable" cellspacing="0" width="100%" style="width:100%;"> 
     16        <thead> 
     17        <tr> 
     18        <th style="display:none"></th> 
     19        <th id="label" class="sortable label" style="cursor: auto;width:20%" width="20%"> 
     20        <div id="thDIV">{'Live_VisitorLog'|translate}<div></th> 
     21        <th id="label" class="sortable label" style="cursor: auto;width:20%" width="20%"> 
     22        <div id="thDIV">{'Source'|translate}<div></th> 
     23        <th id="label" class="sortable label" style="cursor: auto;width:60%" width="60%"> 
     24        <div id="thDIV">{'Actions_Actions'|translate}<div></th> 
     25        </tr> 
     26        </thead> 
     27        <tbody> 
     28{php} $col = 0; {/php} 
     29 
     30{foreach from=$arrayDataTable item=visitor} 
     31        <tr> 
     32 
     33{php} 
     34$col++; 
     35if ($col % 2 ) 
     36                { 
     37                $label = "odd"; 
     38                 } else { 
     39                $label = "even"; 
     40                 } 
     41{/php} 
     42 
     43        <td style="display:none;"></td> 
     44        <td class="label label{php} echo $label; {/php}" style="width:20%" width="20%"> 
     45 
     46                                {$visitor.columns.serverDatePretty} - {$visitor.columns.serverTimePretty}<br/> 
     47                                &nbsp;<img src="{$visitor.columns.countryFlag}" title="{$visitor.columns.country}, Provider {$visitor.columns.provider}" /> 
     48                                &nbsp;<img src="{$visitor.columns.browserIcon}" title="{$visitor.columns.browser} with plugins {$visitor.columns.plugins} enabled" /> 
     49                                &nbsp;<img src="{$visitor.columns.operatingSystemIcon}" title="{$visitor.columns.operatingSystem}, {$visitor.columns.resolution} ({$visitor.columns.screen})" /> 
     50                                &nbsp;{if $visitor.columns.isVisitorGoalConverted}<img src="{$visitor.columns.goalIcon}" title="{$visitor.columns.goalType}" />{/if} 
     51                                {if $visitor.columns.isVisitorReturning}&nbsp;<img src="plugins/Live/templates/images/returningVisitor.gif" title="Returning Visitor" />{/if} 
     52                                <br/> 
     53                                IP: {$visitor.columns.ip}<br/> 
     54                                {if count($visitor.columns.pluginIcons) > 0} 
     55                                <hr /> 
     56                                {'UserSettings_Plugins'|translate}:     {foreach from=$visitor.columns.pluginIcons item=pluginIcon} 
     57                                                <img src="{$pluginIcon.pluginIcon}" title="{$pluginIcon.pluginName|capitalize:true}" alt="{$pluginIcon.pluginName|capitalize:true}" /> 
     58                                        {/foreach} 
     59                                {/if} 
     60        </td> 
     61 
     62        <td class="column{php} echo $label; {/php}" style="width:20%" width="20%"> 
     63                        <div class="referer"> 
     64                                {if $visitor.columns.refererType != 'directEntry'}{'Referer'|translate}: 
     65                                {if !empty($visitor.columns.searchEngineIcon)} 
     66                                        <img src="{$visitor.columns.searchEngineIcon}" alt="{$visitor.columns.refererName}" /> 
     67                                {/if} 
     68                                <a href="{$visitor.columns.refererUrl}" target="_blank" style="text-decoration:underline;"> 
     69                                        {$visitor.columns.refererName} 
     70 
     71                                        {if !empty($visitor.columns.keywords)} 
     72                                                - "{$visitor.columns.keywords}"{/if} 
     73                                        {/if} 
     74                                </a> 
     75 
     76                                {if $visitor.columns.refererType == 'directEntry'}{'Direct_Entry'|translate}{/if} 
     77                        </div> 
     78        </td> 
     79        <td class="column{php} echo $label; {/php}" style="width:60%" width="60%"> 
     80                        <strong>{$visitor.columns.actionDetails|@count} {'Actions_Actions'|translate} - {$visitor.columns.visitLengthPretty}</strong> 
     81                        <br /><br /> 
     82                        <ol style="list-style:decimal inside none;"> 
     83                        {foreach from=$visitor.columns.actionDetails item=action} 
     84                                <li> 
     85                                        <a href="{$action.pageUrl}" target="_blank" style="text-decoration:underline;" title="{$action.pageUrl}"> 
     86                                                {$action.pageUrl|truncate:80:"...":true} 
     87                                        </a> 
     88                                </li> 
     89                        {/foreach} 
     90                        </ol> 
     91        </td> 
     92        </tr> 
     93{/foreach} 
     94        </tbody> 
     95        </table> 
     96 
     97                {/if} 
     98                {if $properties.show_footer} 
     99                        {include file="CoreHome/templates/datatable_footer.tpl"} 
     100                {/if} 
     101                {include file="CoreHome/templates/datatable_js.tpl"} 
     102        {/if} 
     103</div> 
     104 
     105{literal} 
     106<style> 
     107 hr { 
     108        background:none repeat scroll 0 0 transparent; 
     109        border-color:-moz-use-text-color -moz-use-text-color #EEEEEE; 
     110        border-style:none none solid; 
     111        border-width:0 0 1px; 
     112        color:#CCCCCC; 
     113        margin:0 2em 0.5em; 
     114        padding:0 0 0.5em; 
     115 } 
     116 
     117</style> 
     118{/literal} 
     119</div> 
     120 No newline at end of file 
  • plugins/Live/Controller.php

     
    3030        public function widget($fetch = false) 
    3131        { 
    3232                $view = Piwik_View::factory('index'); 
    33                 $view->idSite = Piwik_Common::getRequestVar('idSite');           
     33                $view->idSite = Piwik_Common::getRequestVar('idSite'); 
    3434                $view->visitorsCountHalfHour = $this->getUsersInLastXMin(30); 
    3535                $view->visitorsCountToday = $this->getUsersInLastXDays(1); 
    3636                $view->pisHalfhour = $this->getPageImpressionsInLastXMin(30); 
     
    4242 
    4343        public function getLastVisitsDetails($fetch = false) 
    4444        { 
    45                 $view = Piwik_ViewDataTable::factory(''); 
     45                $view = Piwik_ViewDataTable::factory(); 
    4646                $view->init( $this->pluginName, 
    4747                                                        __FUNCTION__, 
    48                                                 'Live.getLastVisitsDetails', 
    49                                                 'getPagesFromVisitId'); 
    50 // All colomns in DB which could be shown 
    51 //'ip', 'idVisit', 'countActions', 'isVisitorReturning', 'country', 'countryFlag', 'continent', 'provider', 'providerUrl', 'idSite', 
    52 //'serverDate', 'visitLength', 'visitLengthPretty', 'firstActionTimestamp', 'lastActionTimestamp', 'refererType', 'refererName', 
    53 //'keywords', 'refererUrl', 'searchEngineUrl', 'searchEngineIcon', 'operatingSystem', 'operatingSystemShortName', 'operatingSystemIcon', 
    54 //'browserFamily', 'browserFamilyDescription', 'browser', 'browserIcon', 'screen', 'resolution', 'screenIcon', 'plugins', 'lastActionDateTime', 
    55 //'serverDatePretty', 'serverTimePretty', 'actionDetails' 
     48                                                'Live.getLastVisitsDetails'); 
    5649 
    57                 $view->setColumnsToDisplay(array( 
    58                         'idVisit', 
    59                         'serverDatePretty', 
    60                         'serverTimePretty', 
    61                         'ip', 
    62                         'countActions', 
    63                         'visitLengthPretty', 
    64                         'keywords', 
    65                         'refererUrl', 
    66                         'operatingSystemShortName', 
    67                         'browser', 
    68                         'screen', 
    69                         'resolution', 
    70                         'plugins', 
    71                 )); 
     50                // All colomns in DB which could be shown 
     51                //'ip', 'idVisit', 'countActions', 'isVisitorReturning', 'country', 'countryFlag', 'continent', 'provider', 'providerUrl', 'idSite', 
     52                //'serverDate', 'visitLength', 'visitLengthPretty', 'firstActionTimestamp', 'lastActionTimestamp', 'refererType', 'refererName', 
     53                //'keywords', 'refererUrl', 'searchEngineUrl', 'searchEngineIcon', 'operatingSystem', 'operatingSystemShortName', 'operatingSystemIcon', 
     54                //'browserFamily', 'browserFamilyDescription', 'browser', 'browserIcon', 'screen', 'resolution', 'screenIcon', 'plugins', 'lastActionDateTime', 
     55                //'serverDatePretty', 'serverTimePretty', 'actionDetails' 
    7256 
    73                 $view->setColumnsTranslations(array( 
    74                         'idVisit' => Piwik_Translate(''), 
    75                         'serverDatePretty' => Piwik_Translate('Live_Date'), 
    76                         'serverTimePretty' => Piwik_Translate('Live_Time'), 
    77                         'ip' => 'IP', 
    78                         'countActions' => Piwik_Translate('VisitorInterest_ColumnPagesPerVisit'), 
    79                         'visitLengthPretty' => Piwik_Translate('VisitorInterest_ColumnVisitDuration'), 
    80                         'keywords' => Piwik_Translate('Referers_ColumnKeyword'), 
    81                         'refererUrl' => Piwik_Translate('Live_Referrer_URL'), 
    82                         'operatingSystemShortName' => Piwik_Translate('UserSettings_ColumnOperatingSystem'), 
    83                         'browser' => Piwik_Translate('UserSettings_ColumnBrowser'), 
    84                         'screen' => Piwik_Translate('UserSettings_ColumnTypeOfScreen'), 
    85                         'resolution' => Piwik_Translate('UserSettings_ColumnResolution'), 
    86                         'plugins' => Piwik_Translate('UserSettings_ColumnPlugin'), 
    87                 )); 
    88  
    8957                $view->disableSort(); 
    90                 $view->setLimit(10); 
    91                 $view->disableExcludeLowPopulation(); 
     58                $view->setLimit(20); 
     59                $view->setTemplate("Live/templates/visitorLog.tpl"); 
     60                //$view->disableOffsetInformation(); 
    9261                $view->setSortedColumn('idVisit', 'ASC'); 
    9362                $view->disableSearchBox(); 
     63                $view->disableOffsetInformation(); 
    9464                // "Include low population" link won't be displayed under this table 
    9565                $view->disableExcludeLowPopulation(); 
     66                $view->queueFilter('ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getPluginsLogo')); 
    9667                // disable the tag cloud,  pie charts, bar chart icons 
    9768                $view->disableShowAllViewsIcons(); 
    9869                // disable the button "show more datas" 
     
    10172                return $this->renderView($view, $fetch); 
    10273        } 
    10374 
    104         function getPagesFromVisitId( $fetch = false) 
    105         { 
    106                 $view = Piwik_ViewDataTable::factory(''); 
    107                 $view->init( $this->pluginName, 
    108                                                         __FUNCTION__, 
    109                                                 'Live.getLastVisitsForVisitor', 
    110                                                 'getPagesFromVisitId'); 
    111  
    112                 return $this->renderView($view, $fetch); 
    113         } 
    114  
    11575        public function getLastVisitsStart($fetch = false) 
    11676        { 
    11777                $view = Piwik_View::factory('lastVisits'); 
    118                 $view->idSite = Piwik_Common::getRequestVar('idSite');           
    119                  
     78                $view->idSite = Piwik_Common::getRequestVar('idSite'); 
     79 
    12080                $view->visitors = $this->getLastVisits(10); 
    12181 
    12282                $rendered = $view->render($fetch); 
     
    167127        public function ajaxTotalVisitors($fetch = false) 
    168128        { 
    169129                $view = Piwik_View::factory('totalVisits'); 
    170                 $view->idSite = Piwik_Common::getRequestVar('idSite');           
     130                $view->idSite = Piwik_Common::getRequestVar('idSite'); 
    171131                $view->visitorsCountHalfHour = $this->getUsersInLastXMin(30); 
    172132                $view->visitorsCountToday = $this->getUsersInLastXDays(1); 
    173133                $view->pisHalfhour = $this->getPageImpressionsInLastXMin(30); 
     
    179139                { 
    180140                        return $rendered; 
    181141                } 
    182                 echo $rendered;  
     142                echo $rendered; 
    183143        } 
    184144} 
  • plugins/Live/Visitor.php

     
    7171                        'resolution' => $this->getResolution(), 
    7272                        'screenIcon' => $this->getScreenTypeIcon(), 
    7373                        'plugins' => $this->getPlugins(), 
     74                        'pluginIcons' => $this->getPluginIcons(), 
    7475                        'lastActionDateTime' => $this->getDateTimeLastAction(), 
    7576                        'isVisitorGoalConverted' => $this->isVisitorGoalConverted(), 
    7677                        'goalIcon' => $this->getGoalIcon(), 
     
    8081 
    8182        function getServerDate() 
    8283        { 
    83                 return date('Y-m-d', strtotime($this->details['visit_last_action_time']));  
     84                return date('Y-m-d', strtotime($this->details['visit_last_action_time'])); 
    8485        } 
    8586 
    8687        function getIp() 
     
    150151        function getRefererType() 
    151152        { 
    152153                $map = array( 
    153                         Piwik_Common::REFERER_TYPE_SEARCH_ENGINE => 'searchEngine', 
    154                         Piwik_Common::REFERER_TYPE_WEBSITE => 'website', 
    155                         Piwik_Common::REFERER_TYPE_DIRECT_ENTRY => 'directEntry', 
    156                         Piwik_Common::REFERER_TYPE_CAMPAIGN => 'campaign', 
     154                Piwik_Common::REFERER_TYPE_SEARCH_ENGINE => 'searchEngine', 
     155                Piwik_Common::REFERER_TYPE_WEBSITE => 'website', 
     156                Piwik_Common::REFERER_TYPE_DIRECT_ENTRY => 'directEntry', 
     157                Piwik_Common::REFERER_TYPE_CAMPAIGN => 'campaign', 
    157158                ); 
    158159                if(isset($map[$this->details['referer_type']])) 
    159160                { 
     
    185186        function getSearchEngineUrl() 
    186187        { 
    187188                if($this->getRefererType() == 'searchEngine' 
    188                         && !empty($this->details['referer_name'])) 
     189                && !empty($this->details['referer_name'])) 
    189190                { 
    190191                        return Piwik_getSearchEngineUrlFromName($this->details['referer_name']); 
    191192                } 
     
    227228                return implode(", ", $return); 
    228229        } 
    229230 
     231        function getPluginIcons() 
     232        { 
     233                $sPluginNames = $this->getPlugins(); 
     234                if( !empty($sPluginNames) ) 
     235                { 
     236                        $aPluginNames = explode(", ", $sPluginNames); 
     237                        $aPluginIcons = array(); 
     238 
     239                        foreach($aPluginNames as $sPlugin) { 
     240                                $aPluginIcons[] = array("pluginIcon" =>Piwik_getPluginsLogo($sPlugin), "pluginName" =>$sPlugin); 
     241                        } 
     242                        return $aPluginIcons; 
     243                } 
     244                return null; 
     245        } 
     246 
    230247        function getOperatingSystem() 
    231248        { 
    232249                return Piwik_getOSLabel($this->details['config_os']); 
     
    310327                if(isset($this->details['match_attribute'])){ 
    311328                        $goalicon = ""; 
    312329                        switch ($this->details['match_attribute']) { 
    313                         case "url": 
    314                                 $goalicon = "plugins/Live/templates/images/goal.png"; 
    315                                 break; 
    316                             case "file": 
    317                                 $goalicon = "plugins/Live/templates/images/download.png"; 
    318                                 break; 
    319                             case "external_website": 
    320                                 $goalicon = "plugins/Live/templates/images/outboundlink.png"; 
    321                                 break; 
     330                                case "url": 
     331                                        $goalicon = "plugins/Live/templates/images/goal.png"; 
     332                                        break; 
     333                                case "file": 
     334                                        $goalicon = "plugins/Live/templates/images/download.png"; 
     335                                        break; 
     336                                case "external_website": 
     337                                        $goalicon = "plugins/Live/templates/images/outboundlink.png"; 
     338                                        break; 
    322339                        } 
    323340                        return $goalicon; 
    324341                }