• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Piwik_DataTable_Manager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Piwik_DataTable_Manager的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_DataTable_Manager类的具体用法?PHP Piwik_DataTable_Manager怎么用?PHP Piwik_DataTable_Manager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Piwik_DataTable_Manager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     Piwik::createConfigObject();
     Piwik_Config::getInstance()->setTestEnvironment();
     Piwik_DataTable_Manager::getInstance()->deleteAll();
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:7,代码来源:Array.test.php


示例2: getInstance

 /**
  * Returns instance
  *
  * @return Piwik_DataTable_Manager
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:12,代码来源:Manager.php


示例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();
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:29,代码来源:PatternRecursive.php


示例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;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:13,代码来源:Manager.php


示例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);
     }
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:11,代码来源:DataTableSummary.php


示例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);
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:16,代码来源:Filter.php


示例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;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:10,代码来源:Database.test.php


示例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);
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:11,代码来源:PrivacyManagerTest.php


示例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
     }
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:12,代码来源:Filter.php


示例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
         }
     }
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:12,代码来源:ReplaceColumnNames.php


示例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));
         }
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:17,代码来源:Truncate.php


示例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
         }
     }
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:14,代码来源:Truncate.php


示例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;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:49,代码来源:Console.php


示例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
             }
         }
     }
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:16,代码来源:ReplaceColumnNames.php


示例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);
         }
     }
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:22,代码来源:ReplaceSummaryRowLabel.php


示例16: 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();
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:23,代码来源:DatabaseTestCase.php


示例17: 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;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:23,代码来源:IntegrationTestCase.php


示例18: getSerialized

 /**
  * The serialization returns a one dimension array containing all the 
  * serialized DataTable contained in this DataTable.
  * We save DataTable in serialized format in the Database.
  * Each row of this returned PHP array will be a row in the DB table.
  * At the end of the method execution, the dataTable may be truncated (if $maximum* parameters are set).
  * 
  * The keys of the array are very important as they are used to define the DataTable
  * 
  * IMPORTANT: The main table (level 0, parent of all tables) will always be indexed by 0
  * 	even it was created after some other tables.
  * 	It also means that all the parent tables (level 0) will be indexed with 0 in their respective 
  *  serialized arrays. You should never lookup a parent table using the getTable( $id = 0) as it 
  *  won't work.
  * 
  * @throws Exception if an infinite recursion is found (a table row's has a subtable that is one of its parent table)
  * @param int If not null, defines the number of rows maximum of the serialized dataTable
  * 	          If $addSummaryRowAfterNRows is less than the size of the table, a SummaryRow will be added at the end of the table, that
  *            is the sum of the values of all the rows after the Nth row. All the rows after the Nth row will be deleted.
  * 
  * @return array Serialized arrays	
  * 			array( 	// Datatable level0
  * 					0 => 'eghuighahgaueytae78yaet7yaetae', 
  * 
  * 					// first Datatable level1
  * 					1 => 'gaegae gh gwrh guiwh uigwhuige',
  * 					
  * 					//second Datatable level1 
  * 					2 => 'gqegJHUIGHEQjkgneqjgnqeugUGEQHGUHQE',  
  * 					
  * 					//first Datatable level3 (child of second Datatable level1 for example)
  *					3 => 'eghuighahgaueytae78yaet7yaetaeGRQWUBGUIQGH&QE',
  * 					);
  */
 public function getSerialized($maximumRowsInDataTable = null, $maximumRowsInSubDataTable = null, $columnToSortByBeforeTruncation = null)
 {
     static $depth = 0;
     if ($depth > self::MAXIMUM_DEPTH_LEVEL_ALLOWED) {
         $depth = 0;
         throw new Exception("Maximum recursion level of " . self::MAXIMUM_DEPTH_LEVEL_ALLOWED . " reached. You have probably set a DataTable_Row with an associated DataTable which belongs already to its parent hierarchy.");
     }
     if (!is_null($maximumRowsInDataTable)) {
         $this->filter('AddSummaryRow', array($maximumRowsInDataTable - 1, Piwik_DataTable::LABEL_SUMMARY_ROW, $columnToSortByBeforeTruncation));
     }
     // For each row, get the serialized row
     // If it is associated to a sub table, get the serialized table recursively ;
     // but returns all serialized tables and subtable in an array of 1 dimension
     $aSerializedDataTable = array();
     foreach ($this->rows as $row) {
         if (($idSubTable = $row->getIdSubDataTable()) !== null) {
             $subTable = Piwik_DataTable_Manager::getInstance()->getTable($idSubTable);
             $depth++;
             $aSerializedDataTable = $aSerializedDataTable + $subTable->getSerialized($maximumRowsInSubDataTable, $maximumRowsInSubDataTable, $columnToSortByBeforeTruncation);
             $depth--;
         }
     }
     // we load the current Id of the DataTable
     $forcedId = $this->getId();
     // if the datatable is the parent we force the Id at 0 (this is part of the specification)
     if ($depth == 0) {
         $forcedId = 0;
     }
     // we then serialize the rows and store them in the serialized dataTable
     $addToRows = array(self::ID_SUMMARY_ROW => $this->summaryRow);
     if ($this->parents && Zend_Registry::get('config')->General->enable_archive_parents_of_datatable) {
         $addToRows[self::ID_PARENTS] = $this->parents;
     }
     $aSerializedDataTable[$forcedId] = serialize($this->rows + $addToRows);
     return $aSerializedDataTable;
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:70,代码来源:DataTable.php


示例19: isEqual

 /**
  * Helper function to test if two rows are equal.
  * 
  * Two rows are equal 
  * - if they have exactly the same columns / details
  * - if they have a subDataTable associated, then we check that both of them are the same.
  * 
  * @param Piwik_DataTable_Row row1 to compare
  * @param Piwik_DataTable_Row row2 to compare
  * 
  * @return bool
  */
 public static function isEqual(Piwik_DataTable_Row $row1, Piwik_DataTable_Row $row2)
 {
     //same columns
     $cols1 = $row1->getColumns();
     $cols2 = $row2->getColumns();
     uksort($cols1, 'strnatcasecmp');
     uksort($cols2, 'strnatcasecmp');
     if ($cols1 != $cols2) {
         return false;
     }
     $dets1 = $row1->getDetails();
     $dets2 = $row2->getDetails();
     ksort($dets1);
     ksort($dets2);
     // same details
     if ($dets1 != $dets2) {
         return false;
     }
     // either both are null
     // or both have a value
     if (!(is_null($row1->getIdSubDataTable()) && is_null($row2->getIdSubDataTable()))) {
         $subtable1 = Piwik_DataTable_Manager::getInstance()->getTable($row1->getIdSubDataTable());
         $subtable2 = Piwik_DataTable_Manager::getInstance()->getTable($row2->getIdSubDataTable());
         if (!Piwik_DataTable::isEqual($subtable1, $subtable2)) {
             return false;
         }
     }
     return true;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:41,代码来源:Row.php


示例20: postCompute

 /**
  * Post processing called at the end of the main archive processing.
  * Makes sure the new archive is marked as "successful" in the DB
  * 
  * We also try to delete some stuff from memory but really there is still a lot...
  */
 protected function postCompute()
 {
     // delete the first done = ERROR
     Piwik_Query("/* SHARDING_ID_SITE = " . $this->idsite . " */ \n\t\t\t\t\t\t\tDELETE FROM " . $this->tableArchiveNumeric->getTableName() . " \n\t\t\t\t\t\t\tWHERE idarchive = ? AND name = 'done'", array($this->idArchive));
     $this->insertNumericRecord('done', Piwik_ArchiveProcessing::DONE_OK);
     Piwik_DataTable_Manager::getInstance()->deleteAll();
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:13,代码来源:ArchiveProcessing.php



注:本文中的Piwik_DataTable_Manager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Piwik_Date类代码示例发布时间:2022-05-23
下一篇:
PHP Piwik_DataTable_Filter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap