本文整理汇总了PHP中Piwik_Archive::build方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Archive::build方法的具体用法?PHP Piwik_Archive::build怎么用?PHP Piwik_Archive::build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Archive
的用法示例。
在下文中一共展示了Piwik_Archive::build方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: __construct
/**
* @param array $sites array of siteIds
* @param string $strPeriod eg. 'day' 'week' etc.
* @param string $strDate A date range, eg. 'last10', 'previous5' or 'YYYY-MM-DD,YYYY-MM-DD'
* @param Piwik_Segment $segment
* @param string $_restrictSitesToLogin
*/
function __construct($sites, $strPeriod, $strDate, Piwik_Segment $segment, $_restrictSitesToLogin)
{
foreach ($sites as $idSite) {
$archive = Piwik_Archive::build($idSite, $strPeriod, $strDate, $segment, $_restrictSitesToLogin);
$this->archives[$idSite] = $archive;
}
ksort($this->archives);
}
示例5: 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;
}
示例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: 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;
}
示例8: __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);
}
示例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->getString());
$archive->setSite(new Piwik_Site($idSite));
$archive->setSegment($segment);
$this->archives[$idSite] = $archive;
}
ksort($this->archives);
}
示例10: 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;
}
示例11: 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;
}
示例12: __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, Piwik_Segment $segment)
{
$rangePeriod = new Piwik_Period_Range($strPeriod, $strDate, $oSite->getTimezone());
foreach ($rangePeriod->getSubperiods() as $subPeriod) {
$startDate = $subPeriod->getDateStart();
$archive = Piwik_Archive::build($oSite->getId(), $strPeriod, $startDate, $segment->getString());
$archive->setSegment($segment);
$this->archives[] = $archive;
}
}
示例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: __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);
}
示例15: 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");
}