本文整理汇总了PHP中Piwik_Archive类的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Archive类的具体用法?PHP Piwik_Archive怎么用?PHP Piwik_Archive使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Piwik_Archive类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadMetadata
/**
* Adds metadata information to the Piwik_DataTable_Array
* using the information given by the Archive
*
* @param Piwik_DataTable_Array $table
* @param Piwik_Archive $archive
*/
protected function loadMetadata(Piwik_DataTable_Array $table, $archive)
{
$table->metadata[$archive->getPrettyDate()] = array(
'timestamp' => $archive->getTimestampStartDate(),
'site' => $archive->getSite(),
'period' => $archive->getPeriod(),
);
}
示例2: advancedFactory
/**
* The advanced factory method is easier to use from the API than the factory
* method above. It doesn't require an instance of Piwik_Date and works for
* period=range. Generally speaking, anything that can be passed as period
* and range to the API methods can directly be forwarded to this factory
* method in order to get a suitable instance of Piwik_Period.
*
* @param string $strPeriod "day", "week", "month", "year", "range"
* @param string $strDate
* @return Piwik_Period
*/
public static function advancedFactory($strPeriod, $strDate)
{
if (Piwik_Archive::isMultiplePeriod($strDate, $strPeriod) || $strPeriod == 'range') {
return new Piwik_Period_Range($strPeriod, $strDate);
}
return self::factory($strPeriod, Piwik_Date::factory($strDate));
}
示例3: getByDayOfWeek
public function getByDayOfWeek($fetch = false)
{
$view = $this->getGraph(__FUNCTION__, 'VisitTime.getByDayOfWeek', 'VisitTime_DayOfWeek', $limit = 7, $sort = false);
$view->disableSort();
if ($view instanceof Piwik_ViewDataTable_GenerateGraphHTML) {
$view->showAllTicks();
}
// get query params
$idsite = Piwik_Common::getRequestVar('idSite');
$date = Piwik_Common::getRequestVar('date');
$period = Piwik_Common::getRequestVar('period');
// create a period instance
$oSite = new Piwik_Site($idsite);
$oPeriod = Piwik_Archive::makePeriodFromQueryParams($oSite, $period, $date);
// set the footer message using the period start & end date
$start = $oPeriod->getDateStart()->toString();
$end = $oPeriod->getDateEnd()->toString();
if ($start == $end) {
$dateRange = $start;
} else {
$dateRange = $start . " – " . $end;
}
$view->setFooterMessage(Piwik_Translate('General_ReportGeneratedFrom', $dateRange));
return $this->renderView($view, $fetch);
}
示例4: 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;
}
示例5: getDataTable
protected function getDataTable($idSite, $period, $date, $segment, $expanded, $idSubtable)
{
$dataTable = Piwik_Archive::getDataTableFromArchive('CustomVariables_valueByName', $idSite, $period, $date, $segment, $expanded, $idSubtable);
$dataTable->filter('Sort', array(Piwik_Archive::INDEX_NB_VISITS, 'desc', $naturalSort = false, $expanded));
$dataTable->queueFilter('ReplaceColumnNames');
return $dataTable;
}
示例6: __construct
public function __construct($string, $idSites)
{
$string = Piwik_Common::unsanitizeInputValue($string);
$string = trim($string);
if( !Piwik_Archive::isSegmentationEnabled()
&& !empty($string))
{
throw new Exception("The Super User has disabled the use of 'segments' for the anonymous user.
Please log in to use Segmentation in the API.");
}
// As a preventive measure, we restrict the filter size to a safe limit
$string = substr($string, 0, self::SEGMENT_TRUNCATE_LIMIT);
$this->string = $string;
$this->idSites = $idSites;
$segment = new Piwik_SegmentExpression($string);
$this->segment = $segment;
// parse segments
$expressions = $segment->parseSubExpressions();
// convert segments name to sql segment
// check that user is allowed to view this segment
// and apply a filter to the value to match if necessary (to map DB fields format)
$cleanedExpressions = array();
foreach($expressions as $expression)
{
$operand = $expression[Piwik_SegmentExpression::INDEX_OPERAND];
$cleanedExpression = $this->getCleanedExpression($operand);
$expression[Piwik_SegmentExpression::INDEX_OPERAND] = $cleanedExpression;
$cleanedExpressions[] = $expression;
}
$segment->setSubExpressionsAfterCleanup($cleanedExpressions);
}
示例7: 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;
}
示例8: 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;
}
示例9: __construct
/**
* @param Piwik_Site $oSite
* @param string $strPeriod eg. 'day' 'week' etc.
* @param string $strDate A date range, eg. 'last10', 'previous5' or 'YYYY-MM-DD,YYYY-MM-DD'
*/
function __construct($sites, $strPeriod, $strDate, Piwik_Segment $segment)
{
foreach ($sites as $idSite) {
$archive = Piwik_Archive::build($idSite, $strPeriod, $strDate, $segment);
$this->archives[$idSite] = $archive;
}
ksort($this->archives);
}
示例10: 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;
}
示例11: getSearchPercentageEvolution
/** Get evolution of search percentage
* @return Piwik_DataTable */
public function getSearchPercentageEvolution($idSite, $period, $date)
{
Piwik::checkUserHasViewAccess($idSite);
$archive = Piwik_Archive::build($idSite, $period, $date);
$dataTable = $archive->getDataTableFromNumeric(array('SiteSearch_visitsWithSearches', 'nb_visits'));
$dataTable->filter('ColumnCallbackAddColumnQuotient', array('search_percentage', 'SiteSearch_visitsWithSearches', 'nb_visits', 4));
$dataTable->filter('ColumnCallbackReplace', array('search_percentage', array($this, 'quotientToPercentageSafe')));
return $dataTable;
}
示例12: 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;
}
示例13: 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;
}
示例14: __construct
/**
* @param Piwik_Site $oSite
* @param string $strPeriod eg. 'day' 'week' etc.
* @param string $strDate A date range, eg. 'last10', 'previous5' or 'YYYY-MM-DD,YYYY-MM-DD'
*/
function __construct($sites, $strPeriod, $strDate)
{
foreach ($sites as $idSite) {
$archive = Piwik_Archive::build($idSite, $strPeriod, $strDate);
$archive->setSite(new Piwik_Site($idSite));
$archive->prepareArchive();
$this->archives[$idSite] = $archive;
}
ksort($this->archives);
}
示例15: addWidgets
/**
* Adds Referer widgets
*/
function addWidgets()
{
Piwik_AddWidget('Referers_Referers', 'Referers_WidgetKeywords', 'Referers', 'getKeywords');
Piwik_AddWidget('Referers_Referers', 'Referers_WidgetExternalWebsites', 'Referers', 'getWebsites');
Piwik_AddWidget('Referers_Referers', 'Referers_WidgetSearchEngines', 'Referers', 'getSearchEngines');
Piwik_AddWidget('Referers_Referers', 'Referers_WidgetCampaigns', 'Referers', 'getCampaigns');
Piwik_AddWidget('Referers_Referers', 'Referers_WidgetOverview', 'Referers', 'getRefererType');
if (Piwik_Archive::isSegmentationEnabled()) {
Piwik_AddWidget('SEO', 'Top Keywords for Page URL', 'Referers', 'getKeywordsForPage');
}
}