本文整理汇总了PHP中Piwik_Archive类的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Archive类的具体用法?PHP Piwik_Archive怎么用?PHP Piwik_Archive使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Piwik_Archive类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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(),
);
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:15,代码来源:IndexedByDate.php
示例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));
}
开发者ID:nnnnathann,项目名称:piwik,代码行数:18,代码来源:Period.php
示例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);
}
开发者ID:nnnnathann,项目名称:piwik,代码行数:25,代码来源:Controller.php
示例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;
}
开发者ID:BeezyT,项目名称:piwik-sitesearch,代码行数:27,代码来源:Archive.php
示例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;
}
开发者ID:Gninety,项目名称:Microweber,代码行数:7,代码来源:API.php
示例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);
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:34,代码来源:Segment.php
示例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;
}
开发者ID:Gninety,项目名称:Microweber,代码行数:7,代码来源:API.php
示例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;
}
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:8,代码来源:API.php
示例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);
}
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:13,代码来源:IndexedBySite.php
示例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;
}
开发者ID:BeezyT,项目名称:piwik-siteusers,代码行数:10,代码来源:Archive.php
示例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;
}
开发者ID:BeezyT,项目名称:piwik-sitesearch,代码行数:11,代码来源:API.php
示例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;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:10,代码来源:API.php
示例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;
}
开发者ID:klando,项目名称:pgpiwik,代码行数:10,代码来源:API.php
示例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);
}
开发者ID:Doluci,项目名称:tomatocart,代码行数:15,代码来源:IndexedBySite.php
示例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');
}
}
开发者ID:nnnnathann,项目名称:piwik,代码行数:14,代码来源:Referers.php
示例16: 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;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:11,代码来源:API.php
示例17: __construct
/**
* Builds an array of Piwik_Archive of a given date range
*
* @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(Piwik_Site $oSite, $strPeriod, $strDate)
{
$rangePeriod = new Piwik_Period_Range($strPeriod, $strDate);
foreach ($rangePeriod->getSubperiods() as $subPeriod) {
$startDate = $subPeriod->getDateStart();
$archive = Piwik_Archive::build($oSite->getId(), $strPeriod, $startDate);
$archive->prepareArchive();
$timestamp = $archive->getTimestampStartDate();
$this->archives[$timestamp] = $archive;
}
ksort($this->archives);
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:19,代码来源:IndexedByDate.php
示例18: testArchiveSinglePreFetchBlob
/**
* Test that Archive_Single::preFetchBlob won't fetch extra unnecessary blobs.
*
* @group Integration
* @group OneVisitorTwoVisits
*/
public function testArchiveSinglePreFetchBlob()
{
$archive = Piwik_Archive::build(self::$idSite, 'day', self::$dateTime);
$archive->preFetchBlob('Actions_actions');
$cache = $archive->getBlobCache();
$foundSubtable = false;
$this->assertTrue(count($cache) > 0, "empty blob cache");
foreach ($cache as $name => $value) {
$this->assertTrue(strpos($name, "Actions_actions_url") === false, "found blob w/ name '{$name}'");
if (strpos($name, "Actions_actions_") !== false) {
$foundSubtable = true;
}
}
$this->assertTrue($foundSubtable, "Actions_actions subtable was not loaded");
}
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:21,代码来源:OneVisitorTwoVisitsTest.php
示例19: getDataTable
protected function getDataTable($name, $idSite, $period, $date, $expanded, $idSubtable)
{
Piwik::checkUserHasViewAccess($idSite);
$archive = Piwik_Archive::build($idSite, $period, $date);
if ($idSubtable === false) {
$idSubtable = null;
}
if ($expanded) {
$dataTable = $archive->getDataTableExpanded($name, $idSubtable);
} else {
$dataTable = $archive->getDataTable($name, $idSubtable);
}
$dataTable->filter('Sort', array('nb_visits', 'desc', $naturalSort = false, $expanded));
$dataTable->queueFilter('ReplaceSummaryRowLabel');
return $dataTable;
}
开发者ID:Doluci,项目名称:tomatocart,代码行数:16,代码来源:API.php
示例20: getByDayOfWeek
/**
* Returns datatable describing the number of visits for each day of the week.
*
* @param string $idSite The site ID. Cannot refer to multiple sites.
* @param string $period The period type: day, week, year, range...
* @param string $date The start date of the period. Cannot refer to multiple dates.
* @param string $segment The segment.
* @return Piwik_DataTable
*/
public function getByDayOfWeek($idSite, $period, $date, $segment = false)
{
Piwik::checkUserHasViewAccess($idSite);
// disabled for multiple sites/dates
if (Piwik_Archive::isMultipleSites($idSite)) {
throw new Exception("VisitTime.getByDayOfWeek does not support multiple sites.");
}
if (Piwik_Archive::isMultiplePeriod($date, $period)) {
throw new Exception("VisitTime.getByDayOfWeek does not support multiple dates.");
}
// metrics to query
$metrics = Piwik_ArchiveProcessing::getCoreMetrics();
// get metric data for every day within the supplied period
$oSite = new Piwik_Site($idSite);
$oPeriod = Piwik_Archive::makePeriodFromQueryParams($oSite, $period, $date);
$dateRange = $oPeriod->getDateStart()->toString() . ',' . $oPeriod->getDateEnd()->toString();
$archive = Piwik_Archive::build($idSite, 'day', $dateRange, $segment);
$dataTable = $archive->getDataTableFromNumeric($metrics)->mergeChildren();
// if there's no data for this report, don't bother w/ anything else
if ($dataTable->getRowsCount() == 0) {
return $dataTable;
}
// group by the day of the week (see below for dayOfWeekFromDate function)
$dataTable->filter('GroupBy', array('label', 'Piwik_VisitTime_dayOfWeekFromDate'));
// create new datatable w/ empty rows, then add calculated datatable
$rows = array();
foreach (array(1, 2, 3, 4, 5, 6, 7) as $day) {
$rows[] = array('label' => $day, 'nb_visits' => 0);
}
$result = new Piwik_DataTable();
$result->addRowsFromSimpleArray($rows);
$result->addDataTable($dataTable);
// set day of week integer as metadata
$result->filter('ColumnCallbackAddMetadata', array('label', 'day_of_week'));
// translate labels
$result->filter('ColumnCallbackReplace', array('label', 'Piwik_VisitTime_translateDayOfWeek'));
// set datatable metadata for period start & finish
$result->setMetadata('date_start', $oPeriod->getDateStart());
$result->setMetadata('date_end', $oPeriod->getDateEnd());
return $result;
}
开发者ID:nnnnathann,项目名称:piwik,代码行数:50,代码来源:API.php
注:本文中的Piwik_Archive类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论