本文整理汇总了PHP中Piwik_SitesManager_API::getSitesWithAtLeastViewAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_SitesManager_API::getSitesWithAtLeastViewAccess方法的具体用法?PHP Piwik_SitesManager_API::getSitesWithAtLeastViewAccess怎么用?PHP Piwik_SitesManager_API::getSitesWithAtLeastViewAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_SitesManager_API
的用法示例。
在下文中一共展示了Piwik_SitesManager_API::getSitesWithAtLeastViewAccess方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setGeneralVariablesView
protected function setGeneralVariablesView($view)
{
// date
$view->date = $this->strDate;
$oDate = new Piwik_Date($this->strDate);
$view->prettyDate = $oDate->getLocalized(Piwik_Translate('Home_LocalizedDateFormat'));
// period
$currentPeriod = Piwik_Common::getRequestVar('period');
$otherPeriodsAvailable = array('day', 'week', 'month', 'year');
$otherPeriodsNames = array('day' => Piwik_Translate('Home_PeriodDay'), 'week' => Piwik_Translate('Home_PeriodWeek'), 'month' => Piwik_Translate('Home_PeriodMonth'), 'year' => Piwik_Translate('Home_PeriodYear'));
$found = array_search($currentPeriod, $otherPeriodsAvailable);
if ($found !== false) {
unset($otherPeriodsAvailable[$found]);
}
$view->period = $currentPeriod;
$view->otherPeriods = $otherPeriodsAvailable;
$view->periodsNames = $otherPeriodsNames;
// other
$view->idSite = Piwik_Common::getRequestVar('idSite');
$view->userLogin = Piwik::getCurrentUserLogin();
$view->sites = Piwik_SitesManager_API::getSitesWithAtLeastViewAccess();
$view->url = Piwik_Url::getCurrentUrl();
$view->menu = Piwik_GetMenu();
$view->menuJson = json_encode($view->menu);
//var_dump($view->menuJson);
}
示例2: render
public function render()
{
try {
$this->currentModule = Piwik::getModule();
$this->currentPluginName = Piwik::getCurrentPlugin()->getName();
$this->userLogin = Piwik::getCurrentUserLogin();
$showWebsiteSelectorInUserInterface = Zend_Registry::get('config')->General->show_website_selector_in_user_interface;
if ($showWebsiteSelectorInUserInterface) {
$sites = Piwik_SitesManager_API::getSitesWithAtLeastViewAccess();
usort($sites, create_function('$site1, $site2', 'return strcasecmp($site1["name"], $site2["name"]);'));
$this->sites = $sites;
}
$this->showWebsiteSelectorInUserInterface = $showWebsiteSelectorInUserInterface;
$this->url = Piwik_Url::getCurrentUrl();
$this->token_auth = Piwik::getCurrentUserTokenAuth();
$this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
$this->userIsSuperUser = Piwik::isUserIsSuperUser();
$this->piwik_version = Piwik_Version::VERSION;
$this->latest_version_available = Piwik_UpdateCheck::isNewestVersionAvailable();
$this->loginModule = Zend_Registry::get('auth')->getName();
} catch (Exception $e) {
// can fail, for example at installation (no plugin loaded yet)
}
$this->totalTimeGeneration = Zend_Registry::get('timer')->getTime();
try {
$this->totalNumberOfQueries = Piwik::getQueryCount();
} catch (Exception $e) {
$this->totalNumberOfQueries = 0;
}
header('Content-Type: text/html; charset=utf-8');
header("Pragma: ");
header("Cache-Control: no-store, must-revalidate");
return $this->smarty->fetch($this->template);
}
示例3: getDefaultIndexView
protected function getDefaultIndexView()
{
$view = new Piwik_View('AdminHome/templates/index.tpl');
$view->menu = Piwik_GetAdminMenu();
$view->menuJson = json_encode($view->menu);
$view->userLogin = Piwik::getCurrentUserLogin();
$view->sites = Piwik_SitesManager_API::getSitesWithAtLeastViewAccess();
$view->url = Piwik_Url::getCurrentUrl();
$view->basicHtmlView = false;
$view->content = '';
return $view;
}
示例4: getSitesInfo
public function getSitesInfo()
{
$view = new Piwik_View("MultiSites/templates/index.tpl");
$mySites = Piwik_SitesManager_API::getSitesWithAtLeastViewAccess();
$params = $this->getGraphParamsModified();
$this->dateToStr = $params['date'];
$ids = 'all';
$this->period = PiwiK_Common::getRequestVar('period', 'day');
$this->date = PiwiK_Common::getRequestVar('date', 'today');
$lastDate = date('Y-m-d',strtotime("-1 ".$this->period, strtotime($this->date)));
$visits = Piwik_VisitsSummary_API::getVisits($ids, $this->period, $this->date);
$lastVisits = Piwik_VisitsSummary_API::getVisits($ids, $this->period, $lastDate);
$actions = Piwik_VisitsSummary_API::getActions($ids, $this->period, $this->date);
$lastActions = Piwik_VisitsSummary_API::getActions($ids, $this->period, $lastDate);
$uniqueUsers = Piwik_VisitsSummary_API::getUniqueVisitors($ids, $this->period, $this->date);
$lastUniqueUsers = Piwik_VisitsSummary_API::getUniqueVisitors($ids, $this->period, $lastDate);
$visitsSummary = $this->getSummary($lastVisits, $visits, $mySites, "visits");
$actionsSummary = $this->getSummary($lastActions, $actions, $mySites, "actions");
$uniqueSummary = $this->getSummary($lastUniqueUsers, $uniqueUsers, $mySites, "unique");
$visitsArray = $visits->getArray();
$actionsArray = $actions->getArray();
$uniqueUsersArray = $uniqueUsers->getArray();
$lastVisitsArray = $lastVisits->getArray();
$lastActionsArray = $lastActions->getArray();
$lastUniqueUsersArray = $lastUniqueUsers->getArray();
foreach($mySites as &$site)
{
$idSite = $site['idsite'];
$site['visits'] = array_shift($visitsArray[$idSite]->getColumn(0));
$site['actions'] = array_shift($actionsArray[$idSite]->getColumn(0));
$site['unique'] = array_shift($uniqueUsersArray[$idSite]->getColumn(0));
$site['lastVisits'] = array_shift($lastVisitsArray[$idSite]->getColumn(0));
$site['lastActions'] = array_shift($lastActionsArray[$idSite]->getColumn(0));
$site['lastUnique'] = array_shift($lastUniqueUsersArray[$idSite]->getColumn(0));
$site['visitsSummaryValue'] = $visitsSummary[$idSite];
$site['actionsSummaryValue'] = $actionsSummary[$idSite];
$site['uniqueSummaryValue'] = $uniqueSummary[$idSite];
}
$view->mySites = $mySites;
$view->arrowAsc = '<img src="plugins/MultiSites/images/arrow_asc.gif" width="16px" height="16px" />';
$view->arrowDesc = '<img src="plugins/MultiSites/images/arrow_desc.gif" width="16px" height="16px" />';
$view->evolutionBy = $this->evolutionBy;
$view->period = $this->period;
$view->date = $this->date;
$view->page = $this->page;
$view->limit = $this->limit;
$view->orderBy = $this->orderBy;
$view->order = $this->order;
$view->dateToStr = $this->dateToStr;
$this->setGeneralVariablesView($view);
$period = Piwik_Period::factory(Piwik_Common::getRequestVar('period'), Piwik_Date::factory($this->strDate));
$view->prettyDate = $period->getLocalizedLongString();
echo $view->render();
}
示例5: test_getSitesWithAtLeastViewAccess
/**
* normal case, admin and view and noaccess website => return only admin
*/
function test_getSitesWithAtLeastViewAccess()
{
$idsite = Piwik_SitesManager_API::addSite("site1", array("http://piwik.net", "http://piwik.com/test/"));
$idsite = Piwik_SitesManager_API::addSite("site2", array("http://piwik.com/test/"));
$idsite = Piwik_SitesManager_API::addSite("site3", array("http://piwik.org"));
$resultWanted = array(0 => array("idsite" => 1, "name" => "site1", "main_url" => "http://piwik.net"), 1 => array("idsite" => 3, "name" => "site3", "main_url" => "http://piwik.org"));
FakeAccess::setIdSitesView(array(1, 3));
FakeAccess::setIdSitesAdmin(array());
$sites = Piwik_SitesManager_API::getSitesWithAtLeastViewAccess();
// we dont test the ts_created
unset($sites[0]['ts_created']);
unset($sites[1]['ts_created']);
$this->assertEqual($sites, $resultWanted);
}