本文整理汇总了PHP中Piwik::checkUserHasViewAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::checkUserHasViewAccess方法的具体用法?PHP Piwik::checkUserHasViewAccess怎么用?PHP Piwik::checkUserHasViewAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik
的用法示例。
在下文中一共展示了Piwik::checkUserHasViewAccess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Returns the list of metrics (pages, downloads, outlinks)
*
* @param int $idSite
* @param string $period
* @param string $date
* @param string $segment
*/
public function get($idSite, $period, $date, $segment = false, $columns = false)
{
Piwik::checkUserHasViewAccess($idSite);
$archive = Piwik_Archive::build($idSite, $period, $date, $segment);
$metrics = array('Actions_nb_pageviews' => 'nb_pageviews', 'Actions_nb_uniq_pageviews' => 'nb_uniq_pageviews', 'Actions_nb_downloads' => 'nb_downloads', 'Actions_nb_uniq_downloads' => 'nb_uniq_downloads', 'Actions_nb_outlinks' => 'nb_outlinks', 'Actions_nb_uniq_outlinks' => 'nb_uniq_outlinks');
// get requested columns
$columns = Piwik::getArrayFromApiParameter($columns);
if (!empty($columns)) {
// get the columns that are available and requested
$columns = array_intersect($columns, array_values($metrics));
$columns = array_values($columns);
// make sure indexes are right
$nameReplace = array();
foreach ($columns as $i => $column) {
$fullColumn = array_search($column, $metrics);
$columns[$i] = $fullColumn;
$nameReplace[$fullColumn] = $column;
}
} else {
// get all columns
$columns = array_keys($metrics);
$nameReplace =& $metrics;
}
$table = $archive->getDataTableFromNumeric($columns);
// replace labels (remove Actions_)
$table->filter('ReplaceColumnNames', array($nameReplace));
return $table;
}
示例2: getDataTable
/** Get data table from archive
* @return Piwik_DataTable */
public static function getDataTable($name, $idsite, $period, $date, $numeric = false)
{
Piwik::checkUserHasViewAccess($idsite);
if (is_array($name)) {
foreach ($name as &$col) {
$col = 'SiteSearch_' . $col;
}
} else {
$name = 'SiteSearch_' . $name;
}
if (!is_string($period) && get_class($period) != 'Piwik_Period_Range') {
$periodMap = array('Piwik_Period_Day' => 'day', 'Piwik_Period_Week' => 'week', 'Piwik_Period_Month' => 'month', 'Piwik_Period_Year' => 'year');
$period = $periodMap[get_class($period)];
}
$archive = Piwik_Archive::build($idsite, $period, $date);
if ($numeric) {
// numeric archives are only used for search evolution
$dataTable = $archive->getDataTableFromNumeric($name);
$dataTable->queueFilter('ReplaceColumnNames', array(array('SiteSearch_totalSearches' => self::HITS, 'SiteSearch_visitsWithSearches' => self::UNIQUE_HITS)));
$dataTable->applyQueuedFilters();
} else {
$dataTable = $archive->getDataTable($name);
}
return $dataTable;
}
示例3: worldMap
function worldMap()
{
if (!Piwik_PluginsManager::getInstance()->isPluginActivated('UserCountry')) {
return '';
}
$idSite = Piwik_Common::getRequestVar('idSite', 1, 'int');
Piwik::checkUserHasViewAccess($idSite);
$period = Piwik_Common::getRequestVar('period');
$date = Piwik_Common::getRequestVar('date');
$token_auth = Piwik::getCurrentUserTokenAuth();
$view = Piwik_View::factory('worldmap');
$view->dataUrl = "?module=API" . "&method=API.getProcessedReport&format=XML" . "&apiModule=UserCountry&apiAction=getCountry" . "&idSite=" . $idSite . "&period=" . $period . "&date=" . $date . "&token_auth=" . $token_auth . "&segment=" . Piwik_Common::unsanitizeInputValue(Piwik_Common::getRequestVar('segment', '')) . "&filter_limit=-1";
// definition of the color scale
$view->hueMin = 218;
$view->hueMax = 216;
$view->satMin = "0.285";
$view->satMax = "0.9";
$view->lgtMin = ".97";
$view->lgtMax = ".44";
$request = new Piwik_API_Request('method=API.getMetadata&format=PHP' . '&apiModule=UserCountry&apiAction=getCountry' . '&idSite=' . $idSite . '&period=' . $period . '&date=' . $date . '&token_auth=' . $token_auth . '&filter_limit=-1');
$metaData = $request->process();
$metrics = array();
foreach ($metaData[0]['metrics'] as $id => $val) {
if (Piwik_Common::getRequestVar('period') == 'day' || $id != 'nb_uniq_visitors') {
$metrics[] = array($id, $val);
}
}
foreach ($metaData[0]['processedMetrics'] as $id => $val) {
$metrics[] = array($id, $val);
}
$view->metrics = $metrics;
$view->defaultMetric = 'nb_visits';
echo $view->render();
}
示例4: getNumeric
protected function getNumeric($idSite, $period, $date, $segment, $toFetch)
{
Piwik::checkUserHasViewAccess($idSite);
$archive = Piwik_Archive::build($idSite, $period, $date, $segment);
$dataTable = $archive->getNumeric($toFetch);
return $dataTable;
}
示例5: getSiteUrlsFromId
/**
* Returns the list of all URLs registered for the given idSite (main_url + alias URLs).
*
* @exception if the website ID doesn't exist or the user doesn't have access to it
* @return array list of URLs
*/
public static function getSiteUrlsFromId($idSite)
{
Piwik::checkUserHasViewAccess($idSite);
$site = self::getSiteFromId($idSite);
$urls = self::getAliasSiteUrlsFromId($idSite);
return array_merge(array($site['main_url']), $urls);
}
示例6: getDataTable
/** Get data table from archive
* @return Piwik_DataTable */
public static function getDataTable($name, $idsite, $period, $date)
{
Piwik::checkUserHasViewAccess($idsite);
$name = 'SiteUsers_' . $name;
$archive = Piwik_Archive::build($idsite, $period, $date);
$dataTable = $archive->getDataTable($name);
return $dataTable;
}
示例7: getDataTable
protected function getDataTable($name, $idSite, $period, $date, $segment, $column = Piwik_Archive::INDEX_NB_VISITS)
{
Piwik::checkUserHasViewAccess($idSite);
$archive = Piwik_Archive::build($idSite, $period, $date, $segment);
$dataTable = $archive->getDataTable($name);
$dataTable->queueFilter('ReplaceColumnNames');
return $dataTable;
}
示例8: getDataTable
protected function getDataTable($name, $idSite, $period, $date, $segment )
{
Piwik::checkUserHasViewAccess( $idSite );
$archive = Piwik_Archive::build($idSite, $period, $date, $segment );
$dataTable = $archive->getDataTable($name);
$dataTable->filter('Sort', array('label', 'asc', true));
$dataTable->queueFilter('ColumnCallbackReplace', array('label', 'Piwik_getTimeLabel'));
$dataTable->queueFilter('ReplaceColumnNames');
return $dataTable;
}
示例9: getDataTable
protected function getDataTable($name, $idSite, $period, $date)
{
Piwik::checkUserHasViewAccess($idSite);
$archive = Piwik_Archive::build($idSite, $period, $date);
$dataTable = $archive->getDataTable($name);
$dataTable->filter('Sort', array(Piwik_Archive::INDEX_NB_VISITS));
$dataTable->queueFilter('ReplaceColumnNames');
$dataTable->queueFilter('Sort', array('label', 'asc', true));
return $dataTable;
}
示例10: displayJavascriptCode
function displayJavascriptCode()
{
$idSite = Piwik_Common::getRequestVar('idsite', 1);
Piwik::checkUserHasViewAccess($idSite);
$jsTag = Piwik::getJavascriptCode($idSite, Piwik_Url::getCurrentUrlWithoutFileName());
$view = new Piwik_View('SitesManager/templates/DisplayJavascriptCode.tpl');
$view->menu = Piwik_GetAdminMenu();
$view->jsTag = $jsTag;
echo $view->render();
}
示例11: getLastVisits
public function getLastVisits($idSite = false, $limit = 10, $minIdVisit = false)
{
if (is_null($idSite)) {
Piwik::checkUserIsSuperUser();
} else {
Piwik::checkUserHasViewAccess($idSite);
}
$visitorDetails = self::loadLastVisitorDetailsFromDatabase(null, $idSite, $limit, $minIdVisit);
$table = self::getCleanedVisitorsFromDetails($visitorDetails);
return $table;
}
示例12: displayJavascriptCode
function displayJavascriptCode()
{
$idSite = Piwik_Common::getRequestVar('idsite', 1);
Piwik::checkUserHasViewAccess($idSite);
$jsTag = Piwik::getJavascriptCode($idSite, Piwik_Url::getCurrentUrlWithoutFileName());
$view = Piwik_View::factory('DisplayJavascriptCode');
$this->setGeneralVariablesView($view);
$view->menu = Piwik_GetAdminMenu();
$view->jsTag = $jsTag;
echo $view->render();
}
示例13: getProvider
public function getProvider($idSite, $period, $date)
{
Piwik::checkUserHasViewAccess($idSite);
$archive = Piwik_Archive::build($idSite, $period, $date);
$dataTable = $archive->getDataTable('Provider_hostnameExt');
$dataTable->filter('Sort', array(Piwik_Archive::INDEX_NB_VISITS));
$dataTable->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', 'Piwik_getHostnameUrl'));
$dataTable->queueFilter('ColumnCallbackReplace', array('label', 'Piwik_getHostnameName'));
$dataTable->queueFilter('ReplaceColumnNames');
return $dataTable;
}
示例14: displayJavascriptCode
/**
* Displays the admin UI page showing all tracking tags
* @return unknown_type
*/
function displayJavascriptCode()
{
$idSite = Piwik_Common::getRequestVar('idSite');
Piwik::checkUserHasViewAccess($idSite);
$jsTag = Piwik::getJavascriptCode($idSite, Piwik_Url::getCurrentUrlWithoutFileName());
$view = Piwik_View::factory('Tracking');
$this->setBasicVariablesView($view);
$view->menu = Piwik_GetAdminMenu();
$view->idSite = $idSite;
$site = new Piwik_Site($idSite);
$view->displaySiteName = $site->getName();
$view->jsTag = $jsTag;
echo $view->render();
}
示例15: getTransitionsForAction
/**
* General method to get transitions for an action
*
* @param $actionName
* @param $actionType "url"|"title"
* @param $idSite
* @param $period
* @param $date
* @param bool $segment
* @param bool $limitBeforeGrouping
* @param string $parts
* @param bool $returnNormalizedUrls
* @return array
* @throws Exception
*/
public function getTransitionsForAction($actionName, $actionType, $idSite, $period, $date, $segment = false, $limitBeforeGrouping = false, $parts = 'all', $returnNormalizedUrls = false)
{
Piwik::checkUserHasViewAccess($idSite);
// get idaction of the requested action
$idaction = $this->deriveIdAction($actionName, $actionType);
if ($idaction < 0) {
throw new Exception('NoDataForAction');
}
// prepare archive processing that can be used by the archiving code
$archiveProcessing = new Piwik_ArchiveProcessing_Day();
$archiveProcessing->setSite(new Piwik_Site($idSite));
$archiveProcessing->setPeriod(Piwik_Period::advancedFactory($period, $date));
$archiveProcessing->setSegment(new Piwik_Segment($segment, $idSite));
$archiveProcessing->initForLiveUsage();
// prepare the report
$report = array('date' => Piwik_Period_Day::advancedFactory($period, $date)->getLocalizedShortString());
// add data to the report
$transitionsArchiving = new Piwik_Transitions();
if ($returnNormalizedUrls) {
$transitionsArchiving->returnNormalizedUrls();
}
$partsArray = explode(',', $parts);
if ($parts == 'all' || in_array('internalReferrers', $partsArray)) {
$this->addInternalReferrers($transitionsArchiving, $archiveProcessing, $report, $idaction, $actionType, $limitBeforeGrouping);
}
if ($parts == 'all' || in_array('followingActions', $partsArray)) {
$includeLoops = $parts != 'all' && !in_array('internalReferrers', $partsArray);
$this->addFollowingActions($transitionsArchiving, $archiveProcessing, $report, $idaction, $actionType, $limitBeforeGrouping, $includeLoops);
}
if ($parts == 'all' || in_array('externalReferrers', $partsArray)) {
$this->addExternalReferrers($transitionsArchiving, $archiveProcessing, $report, $idaction, $actionType, $limitBeforeGrouping);
}
// derive the number of exits from the other metrics
if ($parts == 'all') {
$report['pageMetrics']['exits'] = $report['pageMetrics']['pageviews'] - $transitionsArchiving->getTotalTransitionsToFollowingActions() - $report['pageMetrics']['loops'];
}
// replace column names in the data tables
$reportNames = array('previousPages' => true, 'previousSiteSearches' => false, 'followingPages' => true, 'followingSiteSearches' => false, 'outlinks' => true, 'downloads' => true);
foreach ($reportNames as $reportName => $replaceLabel) {
if (isset($report[$reportName])) {
$columnNames = array(Piwik_Archive::INDEX_NB_ACTIONS => 'referrals');
if ($replaceLabel) {
$columnNames[Piwik_Archive::INDEX_NB_ACTIONS] = 'referrals';
}
$report[$reportName]->filter('ReplaceColumnNames', array($columnNames));
}
}
return $report;
}