本文整理汇总了PHP中Piwik_ViewDataTable::getRawSegmentFromRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_ViewDataTable::getRawSegmentFromRequest方法的具体用法?PHP Piwik_ViewDataTable::getRawSegmentFromRequest怎么用?PHP Piwik_ViewDataTable::getRawSegmentFromRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_ViewDataTable
的用法示例。
在下文中一共展示了Piwik_ViewDataTable::getRawSegmentFromRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initChartObjectData
protected function initChartObjectData()
{
// if the loaded datatable is a simple DataTable, it is most likely a plugin plotting some custom data
// we don't expect plugin developers to return a well defined Piwik_DataTable_Array
if ($this->dataTable instanceof Piwik_DataTable) {
return parent::initChartObjectData();
}
$this->dataTable->applyQueuedFilters();
if (!$this->dataTable instanceof Piwik_DataTable_Array) {
throw new Exception("Expecting a DataTable_Array with custom format to draw an evolution chart");
}
// the X label is extracted from the 'period' object in the table's metadata
$xLabels = $uniqueIdsDataTable = array();
foreach ($this->dataTable->getArray() as $idDataTable => $metadataDataTable) {
//eg. "Aug 2009"
$xLabels[] = $metadataDataTable->getMetadata('period')->getLocalizedShortString();
// we keep track of all unique data table that we need to set a Y value for
$uniqueIdsDataTable[] = $idDataTable;
}
$idSite = Piwik_Common::getRequestVar('idSite', null, 'int');
$requestedColumnNames = $this->getColumnsToDisplay();
$units = $this->getUnitsForColumnsToDisplay();
$yAxisLabelToUnit = array();
$yAxisLabelToValue = array();
foreach ($this->dataTable->getArray() as $idDataTable => $dataTable) {
foreach ($dataTable->getRows() as $row) {
$rowLabel = $row->getColumn('label');
// put together configuration for row picker.
// do this for every data table in the array because rows do not
// have to present for each date.
if ($this->rowPicker !== false) {
$rowVisible = $this->handleRowForRowPicker($rowLabel);
if (!$rowVisible) {
continue;
}
}
// build data for request columns
foreach ($requestedColumnNames as $requestedColumnName) {
$yAxisLabel = $this->getSeriesLabel($rowLabel, $requestedColumnName);
if (($columnValue = $row->getColumn($requestedColumnName)) !== false) {
$yAxisLabelToValue[$yAxisLabel][$idDataTable] = $columnValue;
$yAxisLabelToUnit[$yAxisLabel] = $units[$requestedColumnName];
}
}
}
}
// make sure all column values are set to at least zero (no gap in the graph)
$yAxisLabelToValueCleaned = array();
foreach ($uniqueIdsDataTable as $uniqueIdDataTable) {
foreach ($yAxisLabelToValue as $yAxisLabel => $idDataTableToColumnValue) {
if (isset($idDataTableToColumnValue[$uniqueIdDataTable])) {
$columnValue = $idDataTableToColumnValue[$uniqueIdDataTable];
} else {
$columnValue = 0;
}
$yAxisLabelToValueCleaned[$yAxisLabel][] = $columnValue;
}
}
$this->view->setAxisXLabels($xLabels);
$this->view->setAxisYValues($yAxisLabelToValueCleaned);
$this->view->setAxisYUnits($yAxisLabelToUnit);
$countGraphElements = $this->dataTable->getRowsCount();
$dataTables = $this->dataTable->getArray();
$firstDatatable = reset($dataTables);
$period = $firstDatatable->getMetadata('period');
$stepSize = $this->getXAxisStepSize($period->getLabel(), $countGraphElements);
$this->view->setXSteps($stepSize);
if ($this->isLinkEnabled()) {
$axisXOnClick = array();
$queryStringAsHash = $this->getQueryStringAsHash();
foreach ($this->dataTable->getArray() as $idDataTable => $metadataDataTable) {
$period = $metadataDataTable->getMetadata('period');
$dateInUrl = $period->getDateStart();
$parameters = array('idSite' => $idSite, 'period' => $period->getLabel(), 'date' => $dateInUrl->toString(), 'segment' => Piwik_ViewDataTable::getRawSegmentFromRequest());
$hash = '';
if (!empty($queryStringAsHash)) {
$hash = '#' . Piwik_Url::getQueryStringFromParameters($queryStringAsHash + $parameters);
}
$link = 'index.php?' . Piwik_Url::getQueryStringFromParameters(array('module' => 'CoreHome', 'action' => 'index') + $parameters) . $hash;
$axisXOnClick[] = $link;
}
$this->view->setAxisXOnClick($axisXOnClick);
}
$this->addSeriesPickerToView();
if ($this->rowPicker !== false) {
// configure the row picker
$this->view->setSelectableRows(array_values($this->rowPickerConfig));
}
}