本文整理汇总了PHP中Piwik\DataTable::queueFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP DataTable::queueFilter方法的具体用法?PHP DataTable::queueFilter怎么用?PHP DataTable::queueFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\DataTable
的用法示例。
在下文中一共展示了DataTable::queueFilter方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter
/**
* @param DataTable $table
*/
public function filter($table)
{
// the htmlspecialchars_decode call is for BC for before 1.1
// as the Referrer URL was previously encoded in the log tables, but is now recorded raw
$table->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', function ($label) {
return htmlspecialchars_decode($label);
}));
$table->queueFilter('ColumnCallbackReplace', array('label', 'Piwik\\Plugins\\Referrers\\getPathFromUrl'));
foreach ($table->getRowsWithoutSummaryRow() as $row) {
$subtable = $row->getSubtable();
if ($subtable) {
$this->filter($subtable);
}
}
}
示例2: filter
/**
* @param DataTable $table
*/
public function filter($table)
{
$idSubtable = $this->idSubtable ?: $table->getId();
$subTableRow = $this->firstLevelSearchEnginesTable->getRowFromIdSubDataTable($idSubtable);
if (!empty($subTableRow)) {
$searchEngineUrl = $subTableRow->getMetadata('url');
$table->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', 'Piwik\\Plugins\\Referrers\\getSearchEngineUrlFromKeywordAndUrl', array($searchEngineUrl)));
$table->queueFilter(function (DataTable $table) {
$row = $table->getRowFromId(DataTable::ID_SUMMARY_ROW);
if ($row) {
$row->deleteMetadata('url');
}
});
}
$table->queueFilter('Piwik\\Plugins\\Referrers\\DataTable\\Filter\\KeywordNotDefined');
}
示例3: filterDataTable
/**
* @param DataTable $dataTable
*/
private function filterDataTable($dataTable)
{
$dataTable->queueFilter('ReplaceColumnNames');
$dataTable->queueFilter('ReplaceSummaryRowLabel');
$dataTable->filter(function (DataTable $table) {
$row = $table->getRowFromLabel(Archiver::CONTENT_PIECE_NOT_SET);
if ($row) {
$row->setColumn('label', Piwik::translate('General_NotDefined', Piwik::translate('Contents_ContentPiece')));
}
foreach ($table->getRows() as $row) {
if ($row->getMetadata('contentTarget') === Archiver::CONTENT_TARGET_NOT_SET) {
$row->setMetadata('contentTarget', '');
}
}
});
}
示例4: filter
/**
* @param DataTable $table
*/
public function filter($table)
{
$notDefinedLabel = Piwik::translate('General_NotDefined', Piwik::translate('CustomVariables_ColumnCustomVariableValue'));
$table->queueFilter('ColumnCallbackReplace', array('label', function ($label) use($notDefinedLabel) {
return $label == \Piwik\Plugins\CustomVariables\Archiver::LABEL_CUSTOM_VALUE_NOT_DEFINED ? $notDefinedLabel : $label;
}));
}
示例5: filter
/**
* @param DataTable $table
*/
public function filter($table)
{
// make url labels clickable
$table->filter('ColumnCallbackAddMetadata', array('label', 'url'));
// prettify the DataTable
$table->filter('ColumnCallbackReplace', array('label', 'Piwik\\Plugins\\Referrers\\removeUrlProtocol'));
$table->queueFilter('ReplaceColumnNames');
}
示例6: filter
/**
* @param DataTable $table
*/
public function filter($table)
{
$idSubtable = $this->idSubtable ?: $table->getId();
$table->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', 'Piwik\\Plugins\\Referrers\\getSearchEngineUrlFromName'));
$table->queueFilter('MetadataCallbackAddMetadata', array('url', 'logo', 'Piwik\\Plugins\\Referrers\\getSearchEngineLogoFromUrl'));
// get the keyword and create the URL to the search result page
$rootRow = $this->firstLevelKeywordTable->getRowFromIdSubDataTable($idSubtable);
if ($rootRow) {
$keyword = $rootRow->getColumn('label');
$table->queueFilter('MetadataCallbackReplace', array('url', 'Piwik\\Plugins\\Referrers\\getSearchEngineUrlFromUrlAndKeyword', array($keyword)));
$table->queueFilter(function (DataTable $table) {
$row = $table->getRowFromId(DataTable::ID_SUMMARY_ROW);
if ($row) {
$row->deleteMetadata('url');
}
});
}
}
示例7: filterDataTable
/**
* @param DataTable $dataTable
*/
private function filterDataTable($dataTable)
{
$dataTable->filter('Sort', array(Metrics::INDEX_NB_VISITS));
$dataTable->queueFilter('ReplaceColumnNames');
$dataTable->queueFilter('ReplaceSummaryRowLabel');
$dataTable->filter(function (DataTable $table) {
$row = $table->getRowFromLabel(Archiver::CONTENT_PIECE_NOT_SET);
if ($row) {
$row->setColumn('label', Piwik::translate('General_NotDefined', Piwik::translate('Contents_ContentPiece')));
}
foreach ($table->getRows() as $row) {
if ($row->getMetadata('contentTarget') === Archiver::CONTENT_TARGET_NOT_SET) {
$row->setMetadata('contentTarget', '');
}
}
});
// Content interaction rate = interactions / impressions
$dataTable->queueFilter('ColumnCallbackAddColumnPercentage', array('interaction_rate', 'nb_interactions', 'nb_impressions', $precision = 2));
}
示例8: generate
/**
* Generates JSON graph data and returns it.
*
* @param DataTable|DataTable\Map $dataTable
* @return string
*/
public function generate($dataTable)
{
$visualization = new Chart();
if ($dataTable->getRowsCount() > 0) {
// if addTotalRow was called in GenerateGraphHTML, add a row containing totals of
// different metrics
if ($this->properties['add_total_row']) {
$dataTable->queueFilter('AddSummaryRow', Piwik::translate('General_Total'));
}
$dataTable->applyQueuedFilters();
$this->initChartObjectData($dataTable, $visualization);
}
return $visualization->render();
}
示例9: filter
/**
* @param DataTable $table
*/
public function filter($table)
{
$idSubtable = $this->idSubtable ?: $table->getId();
$table->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', function ($url) {
return SearchEngine::getInstance()->getUrlFromName($url);
}));
$table->queueFilter('MetadataCallbackAddMetadata', array('url', 'logo', function ($url) {
return SearchEngine::getInstance()->getLogoFromUrl($url);
}));
// get the keyword and create the URL to the search result page
$rootRow = $this->firstLevelKeywordTable->getRowFromIdSubDataTable($idSubtable);
if ($rootRow) {
$keyword = $rootRow->getColumn('label');
$table->queueFilter('MetadataCallbackReplace', array('url', function ($url, $keyword) {
return SearchEngine::getInstance()->getBackLinkFromUrlAndKeyword($url, $keyword);
}, array($keyword)));
$table->queueFilter(function (DataTable $table) {
$row = $table->getRowFromId(DataTable::ID_SUMMARY_ROW);
if ($row) {
$row->deleteMetadata('url');
}
});
}
}
示例10: getVisitorsScores
public function getVisitorsScores()
{
$table = new DataTable();
$max_ids = Db::fetchAll("SELECT MAX(id) as id FROM " . Common::prefixTable(\Piwik\Plugins\SnoopyBehavioralScoring\SnoopyBehavioralScoring::getTableName()) . " GROUP BY idvisitor");
$max_ids_array = array();
foreach ($max_ids as $value) {
$max_ids_array[] = $value['id'];
}
$ids = implode(",", $max_ids_array);
$visitor_scores = Db::fetchAll("SELECT * FROM " . Common::prefixTable(\Piwik\Plugins\SnoopyBehavioralScoring\SnoopyBehavioralScoring::getTableName()) . "\n WHERE id IN ({$ids})");
//Create data to be used in report
$i = 0;
foreach ($visitor_scores as $visitor) {
$i++;
$email = Request::processRequest('SnoopyBehavioralScoring.getVisitorEmail', array('idvisitor' => $visitor['idvisitor'], 'format' => 'json'));
$status = Request::processRequest('SnoopyBehavioralScoring.heatStatus', array('idvisitor' => $visitor['idvisitor']));
$email = json_decode($email, true);
if (isset($email[0]['email'])) {
$email = $email[0]['email'];
} else {
$email = '/';
}
switch ($status) {
case 'cooling':
$icon = 'icon-arrow-bottom';
break;
case 'heating':
$icon = 'icon-arrow-top';
break;
case 'idle':
$icon = '';
break;
case 'new':
$icon = 'icon-plus';
break;
}
$table->addRowFromArray(array(Row::COLUMNS => array('label' => $i, 'idvisitor' => $visitor['idvisitor'], 'email' => $email, 'status' => $status, 'icon' => $icon, 'score' => $visitor['score'])));
}
$table->queueFilter("Sort", array('score', 'desc'));
return $table;
}
示例11: filter
/**
* @param DataTable $table
*/
public function filter($table)
{
$table->filter(function (DataTable $dataTable) {
foreach ($dataTable->getRows() as $row) {
$url = $row->getMetadata('url');
if ($url) {
$row->setMetadata('segmentValue', urldecode($url));
}
}
});
// TODO can we remove this one again?
$table->queueFilter('GroupBy', array('label', function ($label) {
return urldecode($label);
}));
foreach ($table->getRowsWithoutSummaryRow() as $row) {
$subtable = $row->getSubtable();
if ($subtable) {
$this->filter($subtable);
}
}
}
示例12: filterDataTable
/**
* @param DataTable $dataTable
*/
protected function filterDataTable($dataTable)
{
$dataTable->filter('Sort', array(Metrics::INDEX_NB_VISITS));
$dataTable->queueFilter('ReplaceColumnNames');
$dataTable->queueFilter('ReplaceSummaryRowLabel');
$dataTable->filter(function (DataTable $table) {
$row = $table->getRowFromLabel(Archiver::EVENT_NAME_NOT_SET);
if ($row) {
$row->setColumn('label', Piwik::translate('General_NotDefined', Piwik::translate('Events_EventName')));
}
});
// add processed metric avg_event_value
$dataTable->queueFilter('ColumnCallbackAddColumnQuotient', array('avg_event_value', 'sum_event_value', 'nb_events_with_value', $precision = 2, $shouldSkipRows = true));
}
示例13: addVisitsPercentColumn
/**
* Utility function that adds a visit percent column to a data table,
* regardless of whether the data table is an data table array or just
* a data table.
*
* @param DataTable $dataTable The data table to modify.
*/
private static function addVisitsPercentColumn($dataTable)
{
if ($dataTable instanceof DataTable\Map) {
foreach ($dataTable->getDataTables() as $table) {
self::addVisitsPercentColumn($table);
}
} else {
$totalVisits = array_sum($dataTable->getColumn(Metrics::INDEX_NB_VISITS));
$dataTable->queueFilter('ColumnCallbackAddColumnPercentage', array('nb_visits_percentage', 'nb_visits', $totalVisits));
}
}
示例14: filterActionsDataTable
/**
* Common filters for all Actions API
*
* @param DataTable|DataTable\Simple|DataTable\Map $dataTable
* @param bool $expanded
*/
protected function filterActionsDataTable($dataTable, $expanded = false)
{
// Must be applied before Sort in this case, since the DataTable can contain both int and strings indexes
// (in the transition period between pre 1.2 and post 1.2 datatable structure)
$dataTable->filter('ReplaceColumnNames');
$dataTable->filter('Sort', array('nb_visits', 'desc', $naturalSort = false, $expanded));
$dataTable->queueFilter('ReplaceSummaryRowLabel');
}