本文整理汇总了PHP中Piwik_DataTable_Manager::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_DataTable_Manager::getInstance方法的具体用法?PHP Piwik_DataTable_Manager::getInstance怎么用?PHP Piwik_DataTable_Manager::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_DataTable_Manager
的用法示例。
在下文中一共展示了Piwik_DataTable_Manager::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
Piwik::createConfigObject();
Piwik_Config::getInstance()->setTestEnvironment();
Piwik_DataTable_Manager::getInstance()->deleteAll();
}
示例2: 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();
}
示例3: 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);
}
}
示例4: 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);
}
}
示例5: 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;
}
示例6: 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);
}
示例7: 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
}
}
示例8: 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
}
}
}
示例9: 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));
}
}
}
示例10: 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
}
}
}
示例11: 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;
}
示例12: 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
}
}
}
}
示例13: 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);
}
}
}
示例14: tearDown
/**
* Resets all caches and drops the database
*/
public function tearDown()
{
parent::tearDown();
try {
$plugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins();
foreach ($plugins as $plugin) {
$plugin->uninstall();
}
Piwik_PluginsManager::getInstance()->unloadPlugins();
} catch (Exception $e) {
}
Piwik::dropDatabase();
Piwik_DataTable_Manager::getInstance()->deleteAll();
Piwik_Option::getInstance()->clearCache();
Piwik_Site::clearCache();
Piwik_Common::deleteTrackerCache();
Piwik_Config::getInstance()->clear();
Piwik_TablePartitioning::$tablesAlreadyInstalled = null;
Zend_Registry::_unsetInstance();
}
示例15: tearDownAfterClass
public static function tearDownAfterClass()
{
try {
$plugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins();
foreach ($plugins as $plugin) {
$plugin->uninstall();
}
Piwik_PluginsManager::getInstance()->unloadPlugins();
} catch (Exception $e) {
}
Piwik::dropDatabase();
Piwik_DataTable_Manager::getInstance()->deleteAll();
Piwik_Option::getInstance()->clearCache();
Piwik_Site::clearCache();
Piwik_Common::deleteTrackerCache();
Piwik_Config::getInstance()->clear();
Piwik_TablePartitioning::$tablesAlreadyInstalled = null;
Zend_Registry::_unsetInstance();
$_GET = $_REQUEST = array();
Piwik_Translate::getInstance()->unloadEnglishTranslation();
// re-enable tag cloud shuffling
Piwik_Visualization_Cloud::$debugDisableShuffle = true;
}