[Piwik-svn] r185 - in trunk: config modules/DataTable modules/DataTable/Renderer plugins plugins/Actions plugins/Home plugins/Home/templates

svnmaster at piwik.org svnmaster at piwik.org
Fri Jan 18 15:10:01 CET 2008


Author: matt
Date: 2008-01-18 15:10:01 +0100 (Fri, 18 Jan 2008)
New Revision: 185

Modified:
   trunk/config/global.ini.php
   trunk/modules/DataTable/Renderer/Php.php
   trunk/modules/DataTable/Row.php
   trunk/plugins/Actions.php
   trunk/plugins/Actions/API.php
   trunk/plugins/Home/Controller.php
   trunk/plugins/Home/templates/datatable_actions_recursive.tpl
Log:
Fixed bug in PHP recursive search
Other fixes

Modified: trunk/config/global.ini.php
===================================================================
--- trunk/config/global.ini.php	2008-01-18 13:38:56 UTC (rev 184)
+++ trunk/config/global.ini.php	2008-01-18 14:10:01 UTC (rev 185)
@@ -48,7 +48,7 @@
 [Debug]
 ; if set to true, the archiving process will always be triggered, even if the archive has already been computed
 ; this is useful when making changes to the archiving code so we can 
-always_archive_data = false
+always_archive_data = true
 
 [General]
 ; Time in seconds after which an archive will be computed again. 

Modified: trunk/modules/DataTable/Renderer/Php.php
===================================================================
--- trunk/modules/DataTable/Renderer/Php.php	2008-01-18 13:38:56 UTC (rev 184)
+++ trunk/modules/DataTable/Renderer/Php.php	2008-01-18 14:10:01 UTC (rev 185)
@@ -96,21 +96,8 @@
 		// A normal DataTable needs to be handled specifically
 		else
 		{
-			$array = $this->renderTable($dataTable);
-			$flatArray = array();
-			foreach($array as $row)
-			{
-				$newRow = $row['columns'] + $row['details'];
-				if(isset($row['idsubdatatable']))
-				{
-					$newRow += array('idsubdatatable' => $row['idsubdatatable']);
-					if(isset($row['subtable']))
-					{
-						$newRow += array('subtable' => $row['subtable']);
-					}
-				}
-				$flatArray[] = $newRow;
-			}		
+			$array = $this->renderTable($dataTable);
+			$flatArray = $this->flattenArray($array);
 		}
 		
 		if($this->serialize)
@@ -120,7 +107,25 @@
 		
 		return $flatArray;
 	}
-	
+	
+	protected function flattenArray($array)
+	{
+		$flatArray = array();
+		foreach($array as $row)
+		{
+			$newRow = $row['columns'] + $row['details'];
+			if(isset($row['idsubdatatable']))
+			{
+				$newRow += array('idsubdatatable' => $row['idsubdatatable']);
+				if(isset($row['subtable']))
+				{
+					$newRow += array('subtable' => $this->flattenArray($row['subtable']) );
+				}
+			}
+			$flatArray[] = $newRow;
+		}		
+		return $flatArray;
+	}
 	public function render( $dataTable = null)
 	{
 		if(is_null($dataTable))

Modified: trunk/modules/DataTable/Row.php
===================================================================
--- trunk/modules/DataTable/Row.php	2008-01-18 13:38:56 UTC (rev 184)
+++ trunk/modules/DataTable/Row.php	2008-01-18 14:10:01 UTC (rev 185)
@@ -247,7 +247,16 @@
 	 */
 	public function setColumn($name, $value)
 	{
-		$this->c[self::COLUMNS][$name] = $value;
+		if(isset($this->c[self::COLUMNS][$name])
+			|| $name != 'label')
+		{
+			$this->c[self::COLUMNS][$name] = $value;
+		}
+		// we make sure when adding the label it goes first in the table
+		else
+		{
+			$this->c[self::COLUMNS] = array($name => $value) + $this->c[self::COLUMNS];
+		}
 	}
 	
 	/**

Modified: trunk/plugins/Actions/API.php
===================================================================
--- trunk/plugins/Actions/API.php	2008-01-18 13:38:56 UTC (rev 184)
+++ trunk/plugins/Actions/API.php	2008-01-18 14:10:01 UTC (rev 185)
@@ -55,9 +55,9 @@
 			$dataTable = $archive->getDataTable($name, $idSubtable);
 		}
 		
-		$dataTable->queueFilter(	'Piwik_DataTable_Filter_ReplaceColumnNames', 
-									array(Piwik_Actions::getColumnsMap())
-						);
+//		$dataTable->queueFilter(	'Piwik_DataTable_Filter_ReplaceColumnNames', 
+//									array(Piwik_Actions::getColumnsMap())
+//						);
 		return $dataTable;
 	}
 	

Modified: trunk/plugins/Actions.php
===================================================================
--- trunk/plugins/Actions.php	2008-01-18 13:38:56 UTC (rev 184)
+++ trunk/plugins/Actions.php	2008-01-18 14:10:01 UTC (rev 185)
@@ -253,7 +253,7 @@
 				// type is used to partition the different actions type in different table. Adding the info to the row would be a duplicate. 
 				if($name != 'name' && $name != 'type')
 				{
-					$name = $this->getIdColumn($name);
+//					$name = $this->getIdColumn($name);
 					$currentTable->addColumn($name, $value);
 				}
 			}

Modified: trunk/plugins/Home/Controller.php
===================================================================
--- trunk/plugins/Home/Controller.php	2008-01-18 13:38:56 UTC (rev 184)
+++ trunk/plugins/Home/Controller.php	2008-01-18 14:10:01 UTC (rev 185)
@@ -207,10 +207,10 @@
 					
 				if($subTable->getRowsCount() > 0)
 				{
-					$filter = new Piwik_DataTable_Filter_ReplaceColumnNames(
-									$subTable,
-									Piwik_Actions::getColumnsMap()
-								);				
+//					$filter = new Piwik_DataTable_Filter_ReplaceColumnNames(
+//									$subTable,
+//									Piwik_Actions::getColumnsMap()
+//								);				
 					$phpArray = $this->getArrayFromRecursiveDataTable( $subTable, $depth + 1 );
 				}
 			}

Modified: trunk/plugins/Home/templates/datatable_actions_recursive.tpl
===================================================================
--- trunk/plugins/Home/templates/datatable_actions_recursive.tpl	2008-01-18 13:38:56 UTC (rev 184)
+++ trunk/plugins/Home/templates/datatable_actions_recursive.tpl	2008-01-18 14:10:01 UTC (rev 185)
@@ -19,7 +19,7 @@
 		<tr {if $row.idsubdatatable}class="level{$row.level} rowToProcess subActionsDataTable" id="{$row.idsubdatatable}"{else}class="rowToProcess level{$row.level}"{/if}>
 			{foreach from=$dataTableColumns key=idColumn item=column}
 			<td>
-				{$row.columns[$column.name]}
+				{if isset($row.columns[$column.name])}{$row.columns[$column.name]}{else}0{/if}
 			</td>
 			{/foreach}
 		</tr>



More information about the Piwik-svn mailing list