diff options
Diffstat (limited to 'modules/DataTable/Renderer')
-rw-r--r-- | modules/DataTable/Renderer/Console.php | 22 | ||||
-rw-r--r-- | modules/DataTable/Renderer/Csv.php | 40 | ||||
-rw-r--r-- | modules/DataTable/Renderer/Html.php | 22 | ||||
-rw-r--r-- | modules/DataTable/Renderer/Json.php | 26 | ||||
-rw-r--r-- | modules/DataTable/Renderer/Php.php | 112 | ||||
-rw-r--r-- | modules/DataTable/Renderer/Xml.php | 24 |
6 files changed, 123 insertions, 123 deletions
diff --git a/modules/DataTable/Renderer/Console.php b/modules/DataTable/Renderer/Console.php index b092ef94b9..97d0f114c2 100644 --- a/modules/DataTable/Renderer/Console.php +++ b/modules/DataTable/Renderer/Console.php @@ -1,14 +1,14 @@ -<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
- * @version $Id$
- *
- * @package Piwik_DataTable
- */
-
+<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later + * @version $Id$ + * + * @package Piwik_DataTable + */ + /** * Simple output * diff --git a/modules/DataTable/Renderer/Csv.php b/modules/DataTable/Renderer/Csv.php index ea4c7920a1..0e00028904 100644 --- a/modules/DataTable/Renderer/Csv.php +++ b/modules/DataTable/Renderer/Csv.php @@ -1,30 +1,30 @@ -<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
- * @version $Id$
- *
- * @package Piwik_DataTable
- */
-
-require_once "DataTable/Renderer/Php.php";
+<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later + * @version $Id$ + * + * @package Piwik_DataTable + */ + +require_once "DataTable/Renderer/Php.php"; /** * CSV export - *
- * When rendered using the default settings, a CSV report has the following characteristics:
- * The first record contains headers for all the columns in the report.
- * All rows have the same number of columns.
- * The default field delimiter string is a comma (,).
- * Formatting and layout are ignored.
+ * + * When rendered using the default settings, a CSV report has the following characteristics: + * The first record contains headers for all the columns in the report. + * All rows have the same number of columns. + * The default field delimiter string is a comma (,). + * Formatting and layout are ignored. * * Note that CSV output doesn't handle recursive dataTable. It will output only the first parent level of the tables. * * @package Piwik_DataTable - * @subpackage Piwik_DataTable_Renderer
+ * @subpackage Piwik_DataTable_Renderer * - */
+ */ class Piwik_DataTable_Renderer_Csv extends Piwik_DataTable_Renderer { diff --git a/modules/DataTable/Renderer/Html.php b/modules/DataTable/Renderer/Html.php index a80230a137..2ef404653c 100644 --- a/modules/DataTable/Renderer/Html.php +++ b/modules/DataTable/Renderer/Html.php @@ -1,14 +1,14 @@ -<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
- * @version $Id$
- *
- * @package Piwik_DataTable
- */
-
+<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later + * @version $Id$ + * + * @package Piwik_DataTable + */ + /** * Simple HTML output * Works with recursive DataTable (when a row can be associated with a subDataTable). diff --git a/modules/DataTable/Renderer/Json.php b/modules/DataTable/Renderer/Json.php index 2a91b754e4..158fa8dae8 100644 --- a/modules/DataTable/Renderer/Json.php +++ b/modules/DataTable/Renderer/Json.php @@ -1,15 +1,15 @@ -<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
- * @version $Id$
- *
- * @package Piwik_DataTable
- */
-
-require_once "DataTable/Renderer/Php.php";
+<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later + * @version $Id$ + * + * @package Piwik_DataTable + */ + +require_once "DataTable/Renderer/Php.php"; /** * JSON export. Using the php 5.2 feature json_encode. * Works with recursive DataTable (when a row can be associated with a subDataTable). @@ -37,7 +37,7 @@ class Piwik_DataTable_Renderer_Json extends Piwik_DataTable_Renderer if(!is_array($array)) { $array = array('value' => $array); - }
+ } $str = json_encode($array); return $str; } diff --git a/modules/DataTable/Renderer/Php.php b/modules/DataTable/Renderer/Php.php index 50aa9df284..7d80ed23e4 100644 --- a/modules/DataTable/Renderer/Php.php +++ b/modules/DataTable/Renderer/Php.php @@ -1,18 +1,18 @@ -<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
- * @version $Id$
- *
- * @package Piwik_DataTable
- */
-
+<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later + * @version $Id$ + * + * @package Piwik_DataTable + */ + /** * Returns the equivalent PHP array for a given DataTable. - * You can specify in the constructor if you want the serialized version.
- * Please note that by default it will produce a flat version of the array.
+ * You can specify in the constructor if you want the serialized version. + * Please note that by default it will produce a flat version of the array. * See the method flatRender() for details. @see flatRender(); * * Works with recursive DataTable (when a row can be associated with a subDataTable). @@ -44,23 +44,23 @@ class Piwik_DataTable_Renderer_Php extends Piwik_DataTable_Renderer } return $data; } -
- /**
- * Produces a flat php array from the DataTable, putting "columns" and "details" on the same level.
- *
- * For example, when a originalRender() would be
- * array( 'columns' => array( 'col1_name' => value1, 'col2_name' => value2 ),
- * 'details' => array( 'detail1_name' => value_detail) )
- *
- * a flatRender() is
- * array( 'col1_name' => value1,
- * 'col2_name' => value2,
- * 'detail1_name' => value_detail )
- *
- * @return array Php array representing the 'flat' version of the datatable
- *
- */
- public function flatRender( $dataTable = null, $doRenderSubTablesIfAvailable = true )
+ + /** + * Produces a flat php array from the DataTable, putting "columns" and "details" on the same level. + * + * For example, when a originalRender() would be + * array( 'columns' => array( 'col1_name' => value1, 'col2_name' => value2 ), + * 'details' => array( 'detail1_name' => value_detail) ) + * + * a flatRender() is + * array( 'col1_name' => value1, + * 'col2_name' => value2, + * 'detail1_name' => value_detail ) + * + * @return array Php array representing the 'flat' version of the datatable + * + */ + public function flatRender( $dataTable = null, $doRenderSubTablesIfAvailable = true ) { if(is_null($dataTable)) { @@ -78,10 +78,10 @@ class Piwik_DataTable_Renderer_Php extends Piwik_DataTable_Renderer $this->serialize = $serializeSave; } } -
- // A DataTable_Simple is already flattened so no need to do some crazy stuff to convert it
- else if($dataTable instanceof Piwik_DataTable_Simple)
- {
+ + // A DataTable_Simple is already flattened so no need to do some crazy stuff to convert it + else if($dataTable instanceof Piwik_DataTable_Simple) + { $flatArray = $this->renderSimpleTable($dataTable); // if we return only one numeric value then we print out the result in a simple <result> tag @@ -90,22 +90,22 @@ class Piwik_DataTable_Renderer_Php extends Piwik_DataTable_Renderer { $flatArray = current($flatArray); } -
- }
- // A normal DataTable needs to be handled specifically
- else
- {
+ + } + // A normal DataTable needs to be handled specifically + else + { $array = $this->renderTable($dataTable, $doRenderSubTablesIfAvailable); - $flatArray = $this->flattenArray($array);
- }
-
- if($this->serialize)
- {
- $flatArray = serialize($flatArray);
- }
-
- return $flatArray;
- }
+ $flatArray = $this->flattenArray($array); + } + + if($this->serialize) + { + $flatArray = serialize($flatArray); + } + + return $flatArray; + } protected function flattenArray($array) { @@ -124,13 +124,13 @@ class Piwik_DataTable_Renderer_Php extends Piwik_DataTable_Renderer $flatArray[] = $newRow; } return $flatArray; - }
- public function render( $dataTable = null)
+ } + public function render( $dataTable = null) { if(is_null($dataTable)) { $dataTable = $this->table; - }
+ } $toReturn = $this->flatRender( $dataTable ); if( false !== Piwik_Common::getRequestVar('prettyDisplay', false) ) @@ -140,9 +140,9 @@ class Piwik_DataTable_Renderer_Php extends Piwik_DataTable_Renderer $toReturn = unserialize($toReturn); } $toReturn = "<pre>" . var_export($toReturn, true ) . "</pre>"; - }
- return $toReturn;
- }
+ } + return $toReturn; + } public function originalRender() { @@ -162,7 +162,7 @@ class Piwik_DataTable_Renderer_Php extends Piwik_DataTable_Renderer return $array; } -
+ protected function renderTable($table, $doRenderSubTablesIfAvailable = true) { diff --git a/modules/DataTable/Renderer/Xml.php b/modules/DataTable/Renderer/Xml.php index ec6f6cff06..1792b33261 100644 --- a/modules/DataTable/Renderer/Xml.php +++ b/modules/DataTable/Renderer/Xml.php @@ -1,15 +1,15 @@ -<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
- * @version $Id$
- *
- * @package Piwik_DataTable
- */
-
-require_once "DataTable/Renderer/Php.php";
+<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later + * @version $Id$ + * + * @package Piwik_DataTable + */ + +require_once "DataTable/Renderer/Php.php"; /** * XML export of a given DataTable. * See the tests cases for more information about the XML format (/tests/modules/DataTable/Renderer.test.php) |