getTotals() публичный Метод

public getTotals ( )
Пример #1
0
 public function test__construct_shouldFetchSitesWithNeededColumns_AndReturnEvenSitesHavingNoVisits()
 {
     $dayToFetch = '2012-12-13';
     $lastDate = '2012-12-12';
     $dashboard = new Dashboard('day', $dayToFetch, false);
     $this->assertSame($this->numSitesToCreate, $dashboard->getNumSites());
     $this->assertEquals($lastDate, $dashboard->getLastDate());
     $expectedTotals = array('nb_pageviews' => 0, 'nb_visits' => 0, 'nb_actions' => 0, 'revenue' => 0, 'nb_visits_lastdate' => 0);
     $this->assertEquals($expectedTotals, $dashboard->getTotals());
     $expectedSites = array(array('label' => 'Site 1', 'nb_visits' => 0, 'nb_actions' => 0, 'nb_pageviews' => 0, 'revenue' => '$ 0', 'visits_evolution' => '0%', 'actions_evolution' => '0%', 'pageviews_evolution' => '0%', 'revenue_evolution' => '0%', 'idsite' => 1, 'group' => '', 'main_url' => 'http://piwik.net'), array('label' => 'Site 2', 'nb_visits' => 0, 'nb_actions' => 0, 'nb_pageviews' => 0, 'revenue' => '$ 0', 'visits_evolution' => '0%', 'actions_evolution' => '0%', 'pageviews_evolution' => '0%', 'revenue_evolution' => '0%', 'idsite' => 2, 'group' => '', 'main_url' => 'http://piwik.net'), array('label' => 'Site 3', 'nb_visits' => 0, 'nb_actions' => 0, 'nb_pageviews' => 0, 'revenue' => '$ 0', 'visits_evolution' => '0%', 'actions_evolution' => '0%', 'pageviews_evolution' => '0%', 'revenue_evolution' => '0%', 'idsite' => 3, 'group' => '', 'main_url' => 'http://piwik.net'));
     $this->assertEquals($expectedSites, $dashboard->getSites(array(), $limit = 10));
 }
Пример #2
0
 public function getAllWithGroups()
 {
     Piwik::checkUserHasSomeViewAccess();
     $period = Common::getRequestVar('period', null, 'string');
     $date = Common::getRequestVar('date', null, 'string');
     $segment = Common::getRequestVar('segment', false, 'string');
     $pattern = Common::getRequestVar('pattern', '', 'string');
     $limit = Common::getRequestVar('filter_limit', 0, 'int');
     $segment = $segment ?: false;
     $request = $_GET + $_POST;
     $dashboard = new Dashboard($period, $date, $segment);
     if ($pattern !== '') {
         $dashboard->search(strtolower($pattern));
     }
     $response = array('numSites' => $dashboard->getNumSites(), 'totals' => $dashboard->getTotals(), 'lastDate' => $dashboard->getLastDate(), 'sites' => $dashboard->getSites($request, $limit));
     return json_encode($response);
 }