本文整理汇总了PHP中Piwik_DataTable_Manager类的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_DataTable_Manager类的具体用法?PHP Piwik_DataTable_Manager怎么用?PHP Piwik_DataTable_Manager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Piwik_DataTable_Manager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
Piwik::createConfigObject();
Piwik_Config::getInstance()->setTestEnvironment();
Piwik_DataTable_Manager::getInstance()->deleteAll();
}
示例2: getInstance
/**
* Returns instance
*
* @return Piwik_DataTable_Manager
*/
public static function getInstance()
{
if (self::$instance == null) {
self::$instance = new self();
}
return self::$instance;
}
示例3: filter
protected function filter($table = null)
{
if (is_null($table)) {
$table = $this->table;
}
$rows = $table->getRows();
foreach ($rows as $key => $row) {
// A row is deleted if
// 1 - its label doesnt contain the pattern
// AND 2 - the label is not found in the children
$patternNotFoundInChildren = false;
try {
$idSubTable = $row->getIdSubDataTable();
$subTable = Piwik_DataTable_Manager::getInstance()->getTable($idSubTable);
// we delete the row if we couldn't find the pattern in any row in the
// children hierarchy
if ($this->filter($subTable) == 0) {
$patternNotFoundInChildren = true;
}
} catch (Exception $e) {
// there is no subtable loaded for example
$patternNotFoundInChildren = true;
}
if ($patternNotFoundInChildren && !Piwik_DataTable_Filter_Pattern::match($this->patternToSearch, $this->patternToSearchQuoted, $row->getColumn($this->columnToFilter))) {
$table->deleteRow($key);
}
}
return $table->getRowsCount();
}
示例4: getInstance
/**
* Returns instance
*
* @return Piwik_DataTable_Manager
*/
public static function getInstance()
{
if (self::$instance == null) {
$c = __CLASS__;
self::$instance = new $c();
}
return self::$instance;
}
示例5: recalculate
/**
* Reset this row to an empty one and sum the associated subtable again.
*/
public function recalculate()
{
$id = $this->getIdSubDataTable();
if ($id !== null) {
$subtable = Piwik_DataTable_Manager::getInstance()->getTable($id);
$this->sumTable($subtable);
}
}
示例6: filterSubTable
/**
* Filters a subtable
*
* @param Piwik_DataTable_Row $row
* @return mixed
*/
public function filterSubTable(Piwik_DataTable_Row $row)
{
if (!$this->enableRecursive) {
return;
}
if ($row->isSubtableLoaded()) {
$subTable = Piwik_DataTable_Manager::getInstance()->getTable($row->getIdSubDataTable());
$this->filter($subTable);
}
}
示例7: tearDown
public function tearDown()
{
parent::tearDown();
Piwik_DataTable_Manager::getInstance()->deleteAll();
Piwik_Option::getInstance()->clearCache();
Piwik_Common::deleteTrackerCache();
Piwik_Site::clearCache();
Piwik::truncateAllTables();
Piwik_TablePartitioning::$tablesAlreadyInstalled = null;
}
示例8: tearDown
public function tearDown()
{
parent::tearDown();
Piwik_DataTable_Manager::getInstance()->deleteAll();
Piwik_Option::getInstance()->clearCache();
Piwik_Site::clearCache();
Piwik_Common::deleteTrackerCache();
Piwik_TablePartitioning::$tablesAlreadyInstalled = null;
$tempTableName = Piwik_Common::prefixTable(Piwik_PrivacyManager_LogDataPurger::TEMP_TABLE_NAME);
Piwik_Query("DROP TABLE IF EXISTS " . $tempTableName);
}
示例9: filterSubTable
public function filterSubTable(Piwik_DataTable_Row $row)
{
if (!$this->enableRecursive) {
return;
}
try {
$subTable = Piwik_DataTable_Manager::getInstance()->getTable($row->getIdSubDataTable());
$this->filter($subTable);
} catch (Exception $e) {
// case idSubTable == null, or if the table is not loaded in memory
}
}
示例10: filterTable
protected function filterTable($table)
{
foreach ($table->getRows() as $key => $row) {
$this->renameColumns($row);
try {
$subTable = Piwik_DataTable_Manager::getInstance()->getTable($row->getIdSubDataTable());
$this->filterTable($subTable);
} catch (Exception $e) {
// case idSubTable == null, or if the table is not loaded in memory
}
}
}
示例11: filter
/**
* Truncates the table after X rows and adds a summary row
*
* @param Piwik_DataTable $table
*/
public function filter($table)
{
$table->filter('AddSummaryRow', array($this->truncateAfter));
$table->filter('ReplaceSummaryRowLabel');
foreach ($table->getRows() as $row) {
if ($row->isSubtableLoaded()) {
$idSubTable = $row->getIdSubDataTable();
$subTable = Piwik_DataTable_Manager::getInstance()->getTable($idSubTable);
$subTable->filter('Truncate', array($this->truncateAfter));
}
}
}
示例12: filter
public function filter($table)
{
$table->filter('AddSummaryRow', array($this->truncateAfter));
$table->filter('ReplaceSummaryRowLabel');
foreach ($table->getRows() as $row) {
try {
$idSubTable = $row->getIdSubDataTable();
$subTable = Piwik_DataTable_Manager::getInstance()->getTable($idSubTable);
$subTable->filter('Truncate', array($this->truncateAfter));
} catch (Exception $e) {
// there is no subtable loaded for example
}
}
}
示例13: renderTable
protected function renderTable($table)
{
if ($table instanceof Piwik_DataTable_Array) {
$output = '';
$output .= "Piwik_DataTable_Array<hr>";
foreach ($table->getArray() as $descTable => $table) {
$output .= "<b>" . $descTable . "</b><br>";
$output .= $table;
$output .= "<hr>";
}
return $output;
}
if ($table->getRowsCount() == 0) {
return "Empty table <br>\n";
}
static $depth = 0;
$output = '';
$i = 1;
foreach ($table->getRows() as $row) {
$columns = array();
foreach ($row->getColumns() as $column => $value) {
if (is_string($value)) {
$value = "'{$value}'";
}
$columns[] = "'{$column}' => {$value}";
}
$columns = implode(", ", $columns);
$details = array();
foreach ($row->getDetails() as $detail => $value) {
if (is_string($value)) {
$value = "'{$value}'";
}
$details[] = "'{$detail}' => {$value}";
}
$details = implode(", ", $details);
$output .= str_repeat($this->prefixRows, $depth) . "- {$i} [" . $columns . "] [" . $details . "] [idsubtable = " . $row->getIdSubDataTable() . "]<br>\n";
if ($row->getIdSubDataTable() !== null) {
$depth++;
try {
$output .= $this->renderTable(Piwik_DataTable_Manager::getInstance()->getTable($row->getIdSubDataTable()));
} catch (Exception $e) {
$output .= "-- Sub DataTable not loaded<br>\n";
}
$depth--;
}
$i++;
}
return $output;
}
示例14: filterTable
protected function filterTable($table)
{
foreach ($table->getRows() as $key => $row) {
$oldColumns = $row->getColumns();
$newColumns = $this->getRenamedColumns($oldColumns);
$row->setColumns($newColumns);
if ($this->applyFilterRecursively) {
try {
$subTable = Piwik_DataTable_Manager::getInstance()->getTable($row->getIdSubDataTable());
$this->filterTable($subTable);
} catch (Exception $e) {
// case idSubTable == null, or if the table is not loaded in memory
}
}
}
}
示例15: filter
/**
* Updates the summary row label
*
* @param Piwik_DataTable $table
*/
public function filter($table)
{
$rows = $table->getRows();
foreach ($rows as $row) {
if ($row->getColumn('label') == Piwik_DataTable::LABEL_SUMMARY_ROW) {
$row->setColumn('label', $this->newLabel);
break;
}
}
// recurse
foreach ($rows as $row) {
if ($row->isSubtableLoaded()) {
$subTable = Piwik_DataTable_Manager::getInstance()->getTable($row->getIdSubDataTable());
$this->filter($subTable);
}
}
}