[Piwik-svn] r515 - in trunk: modules modules/Archive modules/Archive/Array modules/DataTable modules/DataTable/Filter modules/DataTable/Renderer modules/ViewDataTable plugins/Actions plugins/Home/templates plugins/Provider plugins/Referers plugins/UserCountry plugins/UserSettings tests/modules tests/modules/DataTable
svnmaster at piwik.org
svnmaster at piwik.org
Sun Jun 8 22:03:22 CEST 2008
Author: matt
Date: 2008-06-08 22:03:21 +0200 (Sun, 08 Jun 2008)
New Revision: 515
Added:
trunk/modules/DataTable/Filter/AddConstantMetadata.php
trunk/modules/DataTable/Filter/ColumnCallbackAddMetadata.php
trunk/modules/DataTable/Filter/MetadataCallbackAddMetadata.php
Removed:
trunk/modules/DataTable/Filter/AddConstantDetail.php
trunk/modules/DataTable/Filter/ColumnCallbackAddDetail.php
trunk/modules/DataTable/Filter/DetailCallbackAddDetail.php
Modified:
trunk/modules/Archive/Array.php
trunk/modules/Archive/Array/IndexedByDate.php
trunk/modules/Archive/Single.php
trunk/modules/Auth.php
trunk/modules/DataTable.php
trunk/modules/DataTable/Array.php
trunk/modules/DataTable/Filter.php
trunk/modules/DataTable/Renderer/Console.php
trunk/modules/DataTable/Renderer/Csv.php
trunk/modules/DataTable/Renderer/Html.php
trunk/modules/DataTable/Renderer/Php.php
trunk/modules/DataTable/Renderer/Rss.php
trunk/modules/DataTable/Row.php
trunk/modules/ViewDataTable/Cloud.php
trunk/modules/ViewDataTable/GenerateGraphData.php
trunk/modules/ViewDataTable/Html.php
trunk/plugins/Actions/API.php
trunk/plugins/Actions/Controller.php
trunk/plugins/Home/templates/cloud.tpl
trunk/plugins/Home/templates/datatable.tpl
trunk/plugins/Provider/API.php
trunk/plugins/Referers/API.php
trunk/plugins/UserCountry/API.php
trunk/plugins/UserSettings/API.php
trunk/tests/modules/DataTable.test.php
trunk/tests/modules/DataTable/Renderer.test.php
Log:
- renaming spree, let's rename all "details" columns by what they really are: metadata
I am NOT 100% confident that I'm not breaking something here, it's quite a large renaming.
Modified: trunk/modules/Archive/Array/IndexedByDate.php
===================================================================
--- trunk/modules/Archive/Array/IndexedByDate.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/Archive/Array/IndexedByDate.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -33,9 +33,9 @@
return 'date';
}
- protected function loadMetaData(Piwik_DataTable_Array $table, $archive)
+ protected function loadMetadata(Piwik_DataTable_Array $table, $archive)
{
- $table->metaData[$archive->getPrettyDate()] = array(
+ $table->metadata[$archive->getPrettyDate()] = array(
'timestamp' => $archive->getTimestampStartDate(),
'site' => $archive->getSite(),
);
@@ -119,7 +119,7 @@
foreach($contentArray as $timestamp => $aData)
{
$tableArray->addTable($aData['table'], $aData['prettyDate']);
- $this->loadMetaData($tableArray, $this->archives[$timestamp]);
+ $this->loadMetadata($tableArray, $this->archives[$timestamp]);
}
return $tableArray;
}
Modified: trunk/modules/Archive/Array.php
===================================================================
--- trunk/modules/Archive/Array.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/Archive/Array.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -51,13 +51,13 @@
/**
- * Adds metaData information to the Piwik_DataTable_Array
+ * Adds metadata information to the Piwik_DataTable_Array
* using the information given by the Archive
*
* @param Piwik_DataTable_Array $table
* @param unknown_type $archive
*/
- protected function loadMetaData(Piwik_DataTable_Array $table, $archive)
+ protected function loadMetadata(Piwik_DataTable_Array $table, $archive)
{
}
@@ -80,7 +80,7 @@
$subTable->loadFromArray( array( $numeric ) );
$table->addTable($subTable, $this->getDataTableLabelValue($archive));
- $this->loadMetaData($table, $archive);
+ $this->loadMetadata($table, $archive);
}
return $table;
@@ -109,7 +109,7 @@
$subTable->loadFromArray( array('blob' => $blob));
$table->addTable($subTable, $this->getDataTableLabelValue($archive));
- $this->loadMetaData($table, $archive);
+ $this->loadMetadata($table, $archive);
}
return $table;
}
@@ -131,7 +131,7 @@
$subTable = $archive->getDataTable( $name, $idSubTable ) ;
$table->addTable($subTable, $this->getDataTableLabelValue($archive));
- $this->loadMetaData($table, $archive);
+ $this->loadMetadata($table, $archive);
}
return $table;
}
@@ -154,7 +154,7 @@
$subTable = $archive->getDataTableExpanded( $name, $idSubTable ) ;
$table->addTable($subTable, $this->getDataTableLabelValue($archive));
- $this->loadMetaData($table, $archive);
+ $this->loadMetadata($table, $archive);
}
return $table;
}
Modified: trunk/modules/Archive/Single.php
===================================================================
--- trunk/modules/Archive/Single.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/Archive/Single.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -262,16 +262,16 @@
* This method loads in memory all the subtables for the main table called $name.
* You have to give it the parent table $dataTableToLoad so we can lookup the sub tables ids to load.
*
- * If $addDetailSubtableId set to true, it will add for each row a 'detail' called 'databaseSubtableId'
+ * If $addMetadataSubtableId set to true, it will add for each row a 'metadata' called 'databaseSubtableId'
* containing the child ID of the subtable associated to this row.
*
* @param string $name
* @param Piwik_DataTable $dataTableToLoad
- * @param bool $addDetailSubtableId
+ * @param bool $addMetadataSubtableId
*
* @return void
*/
- public function loadSubDataTables($name, Piwik_DataTable $dataTableToLoad, $addDetailSubtableId = false)
+ public function loadSubDataTables($name, Piwik_DataTable $dataTableToLoad, $addMetadataSubtableId = false)
{
// we have to recursively load all the subtables associated to this table's rows
// and update the subtableID so that it matches the newly instanciated table
@@ -289,9 +289,9 @@
// NB:
// we dont do that in the case we are displaying the table expanded.
// in this case we want the user to see the REAL dataId in the database
- if($addDetailSubtableId)
+ if($addMetadataSubtableId)
{
- $row->addDetail('databaseSubtableId', $row->getIdSubDataTable());
+ $row->addMetadata('databaseSubtableId', $row->getIdSubDataTable());
}
$row->setSubtable( $subDataTableLoaded );
}
@@ -456,7 +456,7 @@
{
$this->preFetchBlob($name);
$dataTableToLoad = $this->getDataTable($name, $idSubTable);
- $this->loadSubDataTables($name, $dataTableToLoad, $addDetailSubtableId = true);
+ $this->loadSubDataTables($name, $dataTableToLoad, $addMetadataSubtableId = true);
return $dataTableToLoad;
}
}
Modified: trunk/modules/Auth.php
===================================================================
--- trunk/modules/Auth.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/Auth.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -40,9 +40,9 @@
&& $this->_credential == $rootToken)
{
return new Piwik_Auth_Result(Piwik_Auth::SUCCESS_SUPERUSER_AUTH_CODE,
- $this->_identity,
- array() // message empty
- );
+ $this->_identity,
+ array() // message empty
+ );
}
// we then look if the user is API authenticated
Modified: trunk/modules/DataTable/Array.php
===================================================================
--- trunk/modules/DataTable/Array.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/DataTable/Array.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -24,7 +24,7 @@
*
* @var array of mixed
*/
- public $metaData = array();
+ public $metadata = array();
/**
* Array containing the DataTable withing this Piwik_DataTable_Array
Deleted: trunk/modules/DataTable/Filter/AddConstantDetail.php
===================================================================
--- trunk/modules/DataTable/Filter/AddConstantDetail.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/DataTable/Filter/AddConstantDetail.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -1,44 +0,0 @@
-<?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
- */
-
-/**
- * Add a new detail column to the table.
- *
- * This is used to add a column containing the logo width and height of the countries flag icons.
- * This value is fixed for all icons so we simply add the same value for all rows.
- *
- * @package Piwik_DataTable
- * @subpackage Piwik_DataTable_Filter
- */
-class Piwik_DataTable_Filter_AddConstantDetail extends Piwik_DataTable_Filter
-{
- private $detailToRead;
- private $functionToApply;
- private $detailToAdd;
-
-
- public function __construct( $table, $detailName, $detailValue )
- {
- parent::__construct($table);
- $this->name = $detailName;
- $this->value = $detailValue;
- $this->filter();
- }
-
- protected function filter()
- {
- foreach($this->table->getRows() as $row)
- {
- $row->addDetail($this->name, $this->value);
- }
- }
-}
-
Copied: trunk/modules/DataTable/Filter/AddConstantMetadata.php (from rev 495, trunk/modules/DataTable/Filter/AddConstantDetail.php)
===================================================================
--- trunk/modules/DataTable/Filter/AddConstantMetadata.php (rev 0)
+++ trunk/modules/DataTable/Filter/AddConstantMetadata.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -0,0 +1,44 @@
+<?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
+ */
+
+/**
+ * Add a new metadata column to the table.
+ *
+ * This is used to add a column containing the logo width and height of the countries flag icons.
+ * This value is fixed for all icons so we simply add the same value for all rows.
+ *
+ * @package Piwik_DataTable
+ * @subpackage Piwik_DataTable_Filter
+ */
+class Piwik_DataTable_Filter_AddConstantMetadata extends Piwik_DataTable_Filter
+{
+ private $metadataToRead;
+ private $functionToApply;
+ private $metadataToAdd;
+
+
+ public function __construct( $table, $metadataName, $metadataValue )
+ {
+ parent::__construct($table);
+ $this->name = $metadataName;
+ $this->value = $metadataValue;
+ $this->filter();
+ }
+
+ protected function filter()
+ {
+ foreach($this->table->getRows() as $row)
+ {
+ $row->addMetadata($this->name, $this->value);
+ }
+ }
+}
+
Deleted: trunk/modules/DataTable/Filter/ColumnCallbackAddDetail.php
===================================================================
--- trunk/modules/DataTable/Filter/ColumnCallbackAddDetail.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/DataTable/Filter/ColumnCallbackAddDetail.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -1,49 +0,0 @@
-<?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
- */
-
-
-/**
- * Add a new 'detail' column to the table based on the value resulting
- * from a callback function with the parameter being another column's value
- *
- * For example from the "label" column we can to create an "icon" 'detail' column
- * with the icon URI built from the label (LINUX => UserSettings/icons/linux.png)
- *
- * @package Piwik_DataTable
- * @subpackage Piwik_DataTable_Filter
- */
-
-class Piwik_DataTable_Filter_ColumnCallbackAddDetail extends Piwik_DataTable_Filter
-{
- private $columnToRead;
- private $functionToApply;
- private $detailToAdd;
-
- public function __construct( $table, $columnToRead, $detailToAdd, $functionToApply )
- {
- parent::__construct($table);
- $this->functionToApply = $functionToApply;
- $this->columnToRead = $columnToRead;
- $this->detailToAdd = $detailToAdd;
- $this->filter();
- }
-
- protected function filter()
- {
- foreach($this->table->getRows() as $key => $row)
- {
- $oldValue = $row->getColumn($this->columnToRead);
- $newValue = call_user_func( $this->functionToApply, $oldValue);
- $row->addDetail($this->detailToAdd, $newValue);
- }
- }
-}
-
Copied: trunk/modules/DataTable/Filter/ColumnCallbackAddMetadata.php (from rev 495, trunk/modules/DataTable/Filter/ColumnCallbackAddDetail.php)
===================================================================
--- trunk/modules/DataTable/Filter/ColumnCallbackAddMetadata.php (rev 0)
+++ trunk/modules/DataTable/Filter/ColumnCallbackAddMetadata.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -0,0 +1,49 @@
+<?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
+ */
+
+
+/**
+ * Add a new 'metadata' column to the table based on the value resulting
+ * from a callback function with the parameter being another column's value
+ *
+ * For example from the "label" column we can to create an "icon" 'metadata' column
+ * with the icon URI built from the label (LINUX => UserSettings/icons/linux.png)
+ *
+ * @package Piwik_DataTable
+ * @subpackage Piwik_DataTable_Filter
+ */
+
+class Piwik_DataTable_Filter_ColumnCallbackAddMetadata extends Piwik_DataTable_Filter
+{
+ private $columnToRead;
+ private $functionToApply;
+ private $metadataToAdd;
+
+ public function __construct( $table, $columnToRead, $metadataToAdd, $functionToApply )
+ {
+ parent::__construct($table);
+ $this->functionToApply = $functionToApply;
+ $this->columnToRead = $columnToRead;
+ $this->metadataToAdd = $metadataToAdd;
+ $this->filter();
+ }
+
+ protected function filter()
+ {
+ foreach($this->table->getRows() as $key => $row)
+ {
+ $oldValue = $row->getColumn($this->columnToRead);
+ $newValue = call_user_func( $this->functionToApply, $oldValue);
+ $row->addMetadata($this->metadataToAdd, $newValue);
+ }
+ }
+}
+
Deleted: trunk/modules/DataTable/Filter/DetailCallbackAddDetail.php
===================================================================
--- trunk/modules/DataTable/Filter/DetailCallbackAddDetail.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/DataTable/Filter/DetailCallbackAddDetail.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -1,48 +0,0 @@
-<?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
- */
-
-/**
- * Add a new detail to the table based on the value resulting
- * from a callback function with the parameter being another detail's value
- *
- * For example for the searchEngine we have a "details" information that gives
- * the URL of the search engine. We use this URL to add a new "details" that gives
- * the path of the logo for this search engine URL (which has the format URL.png).
- *
- * @package Piwik_DataTable
- * @subpackage Piwik_DataTable_Filter
- */
-class Piwik_DataTable_Filter_DetailCallbackAddDetail extends Piwik_DataTable_Filter
-{
- private $detailToRead;
- private $functionToApply;
- private $detailToAdd;
-
- public function __construct( $table, $detailToRead, $detailToAdd, $functionToApply )
- {
- parent::__construct($table);
- $this->functionToApply = $functionToApply;
- $this->detailToRead = $detailToRead;
- $this->detailToAdd = $detailToAdd;
- $this->filter();
- }
-
- protected function filter()
- {
- foreach($this->table->getRows() as $key => $row)
- {
- $oldValue = $row->getDetail($this->detailToRead);
- $newValue = call_user_func( $this->functionToApply, $oldValue);
- $row->addDetail($this->detailToAdd, $newValue);
- }
- }
-}
-
Copied: trunk/modules/DataTable/Filter/MetadataCallbackAddMetadata.php (from rev 495, trunk/modules/DataTable/Filter/DetailCallbackAddDetail.php)
===================================================================
--- trunk/modules/DataTable/Filter/MetadataCallbackAddMetadata.php (rev 0)
+++ trunk/modules/DataTable/Filter/MetadataCallbackAddMetadata.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -0,0 +1,48 @@
+<?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
+ */
+
+/**
+ * Add a new metadata to the table based on the value resulting
+ * from a callback function with the parameter being another metadata value
+ *
+ * For example for the searchEngine we have a "metadata" information that gives
+ * the URL of the search engine. We use this URL to add a new "metadata" that gives
+ * the path of the logo for this search engine URL (which has the format URL.png).
+ *
+ * @package Piwik_DataTable
+ * @subpackage Piwik_DataTable_Filter
+ */
+class Piwik_DataTable_Filter_MetadataCallbackAddMetadata extends Piwik_DataTable_Filter
+{
+ private $metadataToRead;
+ private $functionToApply;
+ private $metadataToAdd;
+
+ public function __construct( $table, $metadataToRead, $metadataToAdd, $functionToApply )
+ {
+ parent::__construct($table);
+ $this->functionToApply = $functionToApply;
+ $this->metadataToRead = $metadataToRead;
+ $this->metadataToAdd = $metadataToAdd;
+ $this->filter();
+ }
+
+ protected function filter()
+ {
+ foreach($this->table->getRows() as $key => $row)
+ {
+ $oldValue = $row->getMetadata($this->metadataToRead);
+ $newValue = call_user_func( $this->functionToApply, $oldValue);
+ $row->addMetadata($this->metadataToAdd, $newValue);
+ }
+ }
+}
+
Modified: trunk/modules/DataTable/Filter.php
===================================================================
--- trunk/modules/DataTable/Filter.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/DataTable/Filter.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -13,7 +13,7 @@
* A filter is applied instantly to a given DataTable and can
* - remove rows
* - change columns values (lowercase the strings, truncate, etc.)
- * - add/remove columns or details (compute percentage values, add an 'icon' detail based on the label, etc.)
+ * - add/remove columns or metadata (compute percentage values, add an 'icon' metadata based on the label, etc.)
* - add/remove/edit sub DataTable associated to some rows
* - whatever you can imagine
*
@@ -43,10 +43,10 @@
}
require_once "DataTable/Filter/ColumnCallbackDeleteRow.php";
-require_once "DataTable/Filter/ColumnCallbackAddDetail.php";
+require_once "DataTable/Filter/ColumnCallbackAddMetadata.php";
require_once "DataTable/Filter/ColumnCallbackReplace.php";
-require_once "DataTable/Filter/DetailCallbackAddDetail.php";
-require_once "DataTable/Filter/AddConstantDetail.php";
+require_once "DataTable/Filter/MetadataCallbackAddMetadata.php";
+require_once "DataTable/Filter/AddConstantMetadata.php";
require_once "DataTable/Filter/Null.php";
require_once "DataTable/Filter/ExcludeLowPopulation.php";
require_once "DataTable/Filter/Limit.php";
Modified: trunk/modules/DataTable/Renderer/Console.php
===================================================================
--- trunk/modules/DataTable/Renderer/Console.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/DataTable/Renderer/Console.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -66,15 +66,18 @@
$columns[] = "'$column' => $value";
}
$columns = implode(", ", $columns);
- $details=array();
- foreach($row->getDetails() as $detail => $value)
+ $metadata = array();
+ foreach($row->getMetadata() as $name => $value)
{
- if(is_string($value)) $value = "'$value'";
- $details[] = "'$detail' => $value";
+ if(is_string($value))
+ {
+ $value = "'$value'";
+ }
+ $metadata[] = "'$name' => $value";
}
- $details = implode(", ", $details);
+ $metadata = implode(", ", $metadata);
$output.= str_repeat($this->prefixRows, $depth)
- . "- $i [".$columns."] [".$details."] [idsubtable = "
+ . "- $i [".$columns."] [".$metadata."] [idsubtable = "
. $row->getIdSubDataTable()."]<br>\n";
if($row->getIdSubDataTable() !== null)
Modified: trunk/modules/DataTable/Renderer/Csv.php
===================================================================
--- trunk/modules/DataTable/Renderer/Csv.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/DataTable/Renderer/Csv.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -43,11 +43,11 @@
public $lineEnd = "\n";
/**
- * 'details' columns will be exported, prefixed by 'detail_'
+ * 'metadata' columns will be exported, prefixed by 'metadata_'
*
* @var bool
*/
- public $exportDetail = true;
+ public $exportMetadata = true;
/**
* idSubtable will be exported in a column called 'idsubdatatable'
@@ -137,13 +137,13 @@
$csvRow[$name] = $value;
}
- if($this->exportDetail)
+ if($this->exportMetadata)
{
- $details = $row->getDetails();
- foreach($details as $name => $value)
+ $metadata = $row->getMetadata();
+ foreach($metadata as $name => $value)
{
- //if a detail and a column have the same name make sure they dont overwrite
- $name = 'detail_'.$name;
+ //if a metadata and a column have the same name make sure they dont overwrite
+ $name = 'metadata_'.$name;
$allColumns[$name] = true;
$csvRow[$name] = $value;
Modified: trunk/modules/DataTable/Renderer/Html.php
===================================================================
--- trunk/modules/DataTable/Renderer/Html.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/DataTable/Renderer/Html.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -66,15 +66,15 @@
static $depth=0;
$i = 1;
- $someDetails = false;
+ $someMetadata = false;
$someIdSubTable = false;
$tableStructure = array();
/*
* table = array
- * ROW1 = col1 | col2 | col3 | details | idSubTable
- * ROW2 = col1 | col2 (no value but appears) | col3 | details | idSubTable
+ * ROW1 = col1 | col2 | col3 | metadata | idSubTable
+ * ROW2 = col1 | col2 (no value but appears) | col3 | metadata | idSubTable
* subtable here
*/
$allColumns = array();
@@ -87,18 +87,18 @@
$tableStructure[$i][$column] = $value;
}
- $details=array();
- foreach($row->getDetails() as $detail => $value)
+ $metadata=array();
+ foreach($row->getMetadata() as $name => $value)
{
if(is_string($value)) $value = "'$value'";
- $details[] = "'$detail' => $value";
+ $metadata[] = "'$name' => $value";
}
- if(count($details) != 0)
+ if(count($metadata) != 0)
{
- $someDetails = true;
- $details = implode("<br>", $details);
- $tableStructure[$i]['_details'] = $details;
+ $someMetadata = true;
+ $metadata = implode("<br>", $metadata);
+ $tableStructure[$i]['_metadata'] = $metadata;
}
$idSubtable = $row->getIdSubDataTable();
@@ -131,7 +131,7 @@
$allColumns = array_merge(array('label'=>true),$allColumns);
}
*/
- $allColumns['_details'] = $someDetails;
+ $allColumns['_metadata'] = $someMetadata;
$allColumns['_idSubtable'] = $someIdSubTable;
$html = "\n";
$html .= "<table border=1 width=70%>";
Modified: trunk/modules/DataTable/Renderer/Php.php
===================================================================
--- trunk/modules/DataTable/Renderer/Php.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/DataTable/Renderer/Php.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -65,16 +65,16 @@
}
/**
- * Produces a flat php array from the DataTable, putting "columns" and "details" on the same level.
+ * Produces a flat php array from the DataTable, putting "columns" and "metadata" 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) )
+ * 'metadata' => array( 'metadata1_name' => value_metadata) )
*
* a flatRender() is
* array( 'col1_name' => value1,
* 'col2_name' => value2,
- * 'detail1_name' => value_detail )
+ * 'metadata1_name' => value_metadata )
*
* @return array Php array representing the 'flat' version of the datatable
*
@@ -131,7 +131,7 @@
$flatArray = array();
foreach($array as $row)
{
- $newRow = $row['columns'] + $row['details'];
+ $newRow = $row['columns'] + $row['metadata'];
if(isset($row['idsubdatatable']))
{
$newRow += array('idsubdatatable' => $row['idsubdatatable']);
@@ -172,7 +172,7 @@
{
$newRow = array(
'columns' => $row->getColumns(),
- 'details' => $row->getDetails(),
+ 'metadata' => $row->getMetadata(),
'idsubdatatable' => $row->getIdSubDataTable(),
);
Modified: trunk/modules/DataTable/Renderer/Rss.php
===================================================================
--- trunk/modules/DataTable/Renderer/Rss.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/DataTable/Renderer/Rss.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -47,8 +47,8 @@
$moreRecentFirst = array_reverse($table->getArray(), true);
foreach($moreRecentFirst as $date => $subtable )
{
- $timestamp = $table->metaData[$date]['timestamp'];
- $site = $table->metaData[$date]['site'];
+ $timestamp = $table->metadata[$date]['timestamp'];
+ $site = $table->metadata[$date]['site'];
$pudDate = date('r', $timestamp);
$dateUrl = date('Y-m-d', $timestamp);
@@ -116,8 +116,8 @@
/*
* table = array
- * ROW1 = col1 | col2 | col3 | details | idSubTable
- * ROW2 = col1 | col2 (no value but appears) | col3 | details | idSubTable
+ * ROW1 = col1 | col2 | col3 | metadata | idSubTable
+ * ROW2 = col1 | col2 (no value but appears) | col3 | metadata | idSubTable
* subtable here
*/
$allColumns = array();
Modified: trunk/modules/DataTable/Row.php
===================================================================
--- trunk/modules/DataTable/Row.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/DataTable/Row.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -15,7 +15,7 @@
* A row is composed of:
* - columns often at least a 'label' column containing the description
* of the row, and some numeric values ('nb_visits', etc.)
- * - details: other information never to be shown as 'columns'
+ * - metadata: other information never to be shown as 'columns'
* - idSubtable: a row can be linked to a SubTable
*
* IMPORTANT: Make sure that the column named 'label' contains at least one non-numeric character.
@@ -31,7 +31,7 @@
/**
* This array contains the row information:
* - array indexed by self::COLUMNS contains the columns, pairs of (column names, value)
- * - (optional) array indexed by self::DETAILS contains the details, pairs of (detail names, value)
+ * - (optional) array indexed by self::METADATA contains the metadata, pairs of (metadata name, value)
* - (optional) integer indexed by self::DATATABLE_ASSOCIATED contains the ID of the Piwik_DataTable associated to this row.
* This ID can be used to read the DataTable from the DataTable_Manager.
*
@@ -41,7 +41,7 @@
public $c = array();
const COLUMNS = 0;
- const DETAILS = 1;
+ const METADATA = 1;
const DATATABLE_ASSOCIATED = 3;
@@ -56,7 +56,7 @@
* 'visits' => 657,
* 'time_spent' => 155744,
* ),
- * Piwik_DataTable_Row::DETAILS => array(
+ * Piwik_DataTable_Row::METADATA => array(
* 'logo' => 'test.png'
* ),
* Piwik_DataTable_Row::DATATABLE_ASSOCIATED => #Piwik_DataTable object (but in the row only the ID will be stored)
@@ -65,16 +65,16 @@
public function __construct( $row = array() )
{
$this->c[self::COLUMNS] = array();
- $this->c[self::DETAILS] = array();
+ $this->c[self::METADATA] = array();
$this->c[self::DATATABLE_ASSOCIATED] = null;
if(isset($row[self::COLUMNS]))
{
$this->c[self::COLUMNS] = $row[self::COLUMNS];
}
- if(isset($row[self::DETAILS]))
+ if(isset($row[self::METADATA]))
{
- $this->c[self::DETAILS] = $row[self::DETAILS];
+ $this->c[self::METADATA] = $row[self::METADATA];
}
if(isset($row[self::DATATABLE_ASSOCIATED])
&& $row[self::DATATABLE_ASSOCIATED] instanceof Piwik_DataTable)
@@ -110,16 +110,17 @@
$columns[] = "'$column' => $value";
}
$columns = implode(", ", $columns);
- $details=array();
-
- foreach($this->getDetails() as $detail => $value)
+ $metadata = array();
+ foreach($this->getMetadata() as $name => $value)
{
- if(is_string($value)) $value = "'$value'";
- $details[] = "'$detail' => $value";
+ if(is_string($value))
+ {
+ $name = "'$value'";
+ }
+ $metadata[] = "'$name' => $value";
}
- $details = implode(", ", $details);
- $output = "# [".$columns."] [".$details."] [idsubtable = "
- . $this->getIdSubDataTable()."]<br>\n";
+ $metadata = implode(", ", $metadata);
+ $output = "# [".$columns."] [".$metadata."] [idsubtable = " . $this->getIdSubDataTable()."]<br>\n";
return $output;
}
@@ -155,18 +156,23 @@
}
/**
- * Returns the given detail
+ * Returns the array of all metadata,
+ * or the specified metadata
*
- * @param string Detail name
- * @return mixed|false The detail value
+ * @param string Metadata name
+ * @return mixed|array|false
*/
- public function getDetail( $name )
+ public function getMetadata( $name = null )
{
- if(!isset($this->c[self::DETAILS][$name]))
+ if(is_null($name))
{
+ return $this->c[self::METADATA];
+ }
+ if(!isset($this->c[self::METADATA][$name]))
+ {
return false;
}
- return $this->c[self::DETAILS][$name];
+ return $this->c[self::METADATA][$name];
}
/**
@@ -184,19 +190,6 @@
}
/**
- * Returns the array containing all the details
- *
- * @return array Example: array(
- * 'logo' => 'images/logo/www.google.png',
- * 'url' => 'www.google.com'
- * )
- */
- public function getDetails()
- {
- return $this->c[self::DETAILS];
- }
-
- /**
* Returns the ID of the subDataTable.
* If there is no such a table, returns null.
*
@@ -311,19 +304,19 @@
/**
- * Add a new detail to the row. If the column already exists, throws an exception.
+ * Add a new metadata to the row. If the column already exists, throws an exception.
*
- * @param string $name of the detail to add
- * @param mixed $value of the detail to set
+ * @param string $name of the metadata to add
+ * @param mixed $value of the metadata to set
* @throws Exception
*/
- public function addDetail($name, $value)
+ public function addMetadata($name, $value)
{
- if(isset($this->c[self::DETAILS][$name]))
+ if(isset($this->c[self::METADATA][$name]))
{
- throw new Exception("Detail $name already in the array!");
+ throw new Exception("Metadata $name already in the array!");
}
- $this->c[self::DETAILS][$name] = $value;
+ $this->c[self::METADATA][$name] = $value;
}
/**
@@ -357,7 +350,7 @@
* Helper function to test if two rows are equal.
*
* Two rows are equal
- * - if they have exactly the same columns / details
+ * - if they have exactly the same columns / metadata
* - if they have a subDataTable associated, then we check that both of them are the same.
*
* @param Piwik_DataTable_Row row1 to compare
@@ -379,13 +372,12 @@
return false;
}
- $dets1 = $row1->getDetails();
- $dets2 = $row2->getDetails();
+ $dets1 = $row1->getMetadata();
+ $dets2 = $row2->getMetadata();
ksort($dets1);
ksort($dets2);
- // same details
if($dets1 != $dets2)
{
return false;
Modified: trunk/modules/DataTable.php
===================================================================
--- trunk/modules/DataTable.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/DataTable.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -36,8 +36,8 @@
*
* ---- DataTable_Row
* A DataTableRow in the table is defined by
- * - multiple column (a label, multiple values, ...)
- * - details
+ * - multiple columns (a label, multiple values, ...)
+ * - metadata
* - [a sub DataTable associated to this row]
*
* Simple row example:
@@ -45,7 +45,7 @@
* 'visitors' => 155,
* 'pages' => 214,
* 'bounce_rate' => 67)
- * - details = array('logo' => '/img/browsers/FF.png')
+ * - metadata = array('logo' => '/img/browsers/FF.png')
* - no sub DataTable
*
* A more complex example would be a DataTable_Row that is associated to a sub DataTable.
@@ -55,7 +55,7 @@
* 'visits' => 1550,
* 'visits_length' => 514214,
* 'returning_visits' => 77)
- * - details = array( 'logo' => '/img/search/google.png',
+ * - metadata = array( 'logo' => '/img/search/google.png',
* 'url' => 'http://google.com')
* - DataTable = DataTable containing several DataTable_Row containing the keywords information for this search engine
* Example of one DataTable_Row
@@ -64,7 +64,7 @@
* 'visitors' => 155, // Piwik has been searched on Google by 155 visitors
* 'pages' => 214 // Visitors coming from Google with the kwd Piwik have seen 214 pages
* )
- * - the keyword details = array() // nothing here, but we could imagining storing the URL of the search in Google for example
+ * - the keyword metadata = array() // nothing here, but we could imagining storing the URL of the search in Google for example
* - no subTable
*
*
@@ -80,7 +80,7 @@
* for example a function that apply a limit: $offset, $limit
* - add / remove columns
* for example adding a column that gives the percentage of a given value
- * - add some details
+ * - add some metadata
* for example the 'logo' path if the filter detects the logo
* - edit the value, the label
* - change the rows order
@@ -311,11 +311,9 @@
* Go through all the rows of the new DataTable and applies the algorithm:
* - if a row in $table doesnt exist in $this we add the new row to $this
* - if a row exists in both $table and $this we sum the columns values into $this
+ * - if a row in $this doesnt exist in $table we keep the row of $this without modification
*
* A common row to 2 DataTable is defined by the same label
- *
- * Details:
- * - if a row in $this doesnt exist in $table we simply keep the row of $this without modification
*
* @example @see tests/modules/DataTable.test.php
*/
@@ -806,7 +804,7 @@
* // row1
* array(
* Piwik_DataTable_Row::COLUMNS => array( col1_name => value1, col2_name => value2, ...),
- * Piwik_DataTable_Row::DETAILS => array( detail1_name => value1, ...), // see Piwik_DataTable_Row
+ * Piwik_DataTable_Row::METADATA => array( metadata1_name => value1, ...), // see Piwik_DataTable_Row
*
* ),
*
Modified: trunk/modules/ViewDataTable/Cloud.php
===================================================================
--- trunk/modules/ViewDataTable/Cloud.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/ViewDataTable/Cloud.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -64,7 +64,7 @@
$view = new Piwik_View($this->dataTableTemplate);
- $words = $labelDetails = array();
+ $words = $labelMetadata = array();
foreach($this->dataTable->getRows() as $row)
{
$label = $row->getColumn('label');
@@ -80,12 +80,12 @@
$logo = false;
if($this->displayLogoInsteadOfLabel)
{
- $logo = $row->getDetail('logo');
+ $logo = $row->getMetadata('logo');
}
- $labelDetails[$label] = array(
+ $labelMetadata[$label] = array(
'logo' => $logo,
- 'url' => $row->getDetail('url'),
+ 'url' => $row->getMetadata('url'),
'hits' => $value
);
}
@@ -96,9 +96,7 @@
{
$value['logoWidth'] = round(max(16, $value['percent']));
}
-// var_dump($cloudValues);exit;
-// var_dump($labelDetails);exit;
- $view->labelDetails = $labelDetails;
+ $view->labelMetadata = $labelMetadata;
$view->cloudValues = $cloudValues;
$view->method = $this->method;
Modified: trunk/modules/ViewDataTable/GenerateGraphData.php
===================================================================
--- trunk/modules/ViewDataTable/GenerateGraphData.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/ViewDataTable/GenerateGraphData.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -129,7 +129,7 @@
$data[] = array(
'label' => $label,
'value' => $value,
- 'url' => $row->getDetail('url'),
+ 'url' => $row->getMetadata('url'),
);
}
Modified: trunk/modules/ViewDataTable/Html.php
===================================================================
--- trunk/modules/ViewDataTable/Html.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/modules/ViewDataTable/Html.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -125,7 +125,7 @@
$renderer->setTable($this->dataTable);
$renderer->setSerialize( false );
// we get the php array from the datatable
- // but conserving the original datatable format, which means rows 'columns', 'details' and 'idsubdatatable'
+ // but conserving the original datatable format, which means rows 'columns', 'metadata' and 'idsubdatatable'
$phpArray = $renderer->originalRender();
return $phpArray;
}
Modified: trunk/plugins/Actions/API.php
===================================================================
--- trunk/plugins/Actions/API.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/plugins/Actions/API.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -61,7 +61,7 @@
public function getDownloads( $idSite, $period, $date, $expanded = false, $idSubtable = false )
{
$dataTable = $this->getDataTable('Actions_downloads', $idSite, $period, $date, $expanded, $idSubtable );
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array('full_url', 'url', create_function('$url', 'return $url;')));
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('full_url', 'url', create_function('$url', 'return $url;')));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getPathFromActionsUrl'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_truncateActionsPath'));
@@ -71,7 +71,7 @@
public function getOutlinks( $idSite, $period, $date, $expanded = false, $idSubtable = false )
{
$dataTable = $this->getDataTable('Actions_outlink', $idSite, $period, $date, $expanded, $idSubtable );
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array('full_url', 'url', create_function('$url', 'return $url;')));
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('full_url', 'url', create_function('$url', 'return $url;')));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getPathFromActionsUrl'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_truncateActionsPath'));
return $dataTable;
Modified: trunk/plugins/Actions/Controller.php
===================================================================
--- trunk/plugins/Actions/Controller.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/plugins/Actions/Controller.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -181,7 +181,7 @@
$newRow = array(
'level' => $depth,
'columns' => $row->getColumns(),
- 'details' => $row->getDetails(),
+ 'metadata' => $row->getMetadata(),
'idsubdatatable' => $row->getIdSubDataTable()
);
$table[] = $newRow;
Modified: trunk/plugins/Home/templates/cloud.tpl
===================================================================
--- trunk/plugins/Home/templates/cloud.tpl 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/plugins/Home/templates/cloud.tpl 2008-06-08 20:03:21 UTC (rev 515)
@@ -53,11 +53,11 @@
<div id="emptyDatatable">No data for this tag cloud.</div>
{else}
{foreach from=$cloudValues key=word item=value}
- <span title="{$value.word} ({$labelDetails[$value.word].hits} hits)" class="word size{$value.size} {* we strike tags with 0 hits *} {if $labelDetails[$value.word].hits == 0}valueIsZero{/if}">
- {if false !== $labelDetails[$value.word].url}<a href="{$labelDetails[$value.word].url}" target="_blank">{/if}
- {if false !== $labelDetails[$value.word].logo}<img src="{$labelDetails[$value.word].logo}" width="{$value.logoWidth}">{else}
+ <span title="{$value.word} ({$labelMetadata[$value.word].hits} hits)" class="word size{$value.size} {* we strike tags with 0 hits *} {if $labelMetadata[$value.word].hits == 0}valueIsZero{/if}">
+ {if false !== $labelMetadata[$value.word].url}<a href="{$labelMetadata[$value.word].url}" target="_blank">{/if}
+ {if false !== $labelMetadata[$value.word].logo}<img src="{$labelMetadata[$value.word].logo}" width="{$value.logoWidth}">{else}
- {$value.wordTruncated}{/if}{if false !== $labelDetails[$value.word].url}</a>{/if}</span>
+ {$value.wordTruncated}{/if}{if false !== $labelMetadata[$value.word].url}</a>{/if}</span>
{/foreach}
{/if}
{if $showFooter}
Modified: trunk/plugins/Home/templates/datatable.tpl
===================================================================
--- trunk/plugins/Home/templates/datatable.tpl 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/plugins/Home/templates/datatable.tpl 2008-06-08 20:03:21 UTC (rev 515)
@@ -20,8 +20,8 @@
<tr {if $row.idsubdatatable}class="subDataTable" id="{$row.idsubdatatable}"{/if}>
{foreach from=$dataTableColumns key=idColumn item=column}
<td>
- {if $idColumn==0 && isset($row.details.url)}<span id="urlLink">{$row.details.url}</span>{/if}
- {if $idColumn==0 && isset($row.details.logo)}<img {if isset($row.details.logoWidth)}width="{$row.details.logoWidth}"{/if} {if isset($row.details.logoHeight)}height="{$row.details.logoHeight}"{/if} src="{$row.details.logo}" />{/if}
+ {if $idColumn==0 && isset($row.metadata.url)}<span id="urlLink">{$row.metadata.url}</span>{/if}
+ {if $idColumn==0 && isset($row.metadata.logo)}<img {if isset($row.metadata.logoWidth)}width="{$row.metadata.logoWidth}"{/if} {if isset($row.metadata.logoHeight)}height="{$row.metadata.logoHeight}"{/if} src="{$row.metadata.logo}" />{/if}
{* sometimes all columns are not set in the datatable, we assume the value 0 *}
{if isset($row.columns[$column.name])}{$row.columns[$column.name]}{else}0{/if}
</td>
Modified: trunk/plugins/Provider/API.php
===================================================================
--- trunk/plugins/Provider/API.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/plugins/Provider/API.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -32,7 +32,7 @@
Piwik::checkUserHasViewAccess( $idSite );
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('Provider_hostnameExt');
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array('label', 'url', 'Piwik_getHostnameUrl'));
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'url', 'Piwik_getHostnameUrl'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getHostnameName'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
return $dataTable;
Modified: trunk/plugins/Referers/API.php
===================================================================
--- trunk/plugins/Referers/API.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/plugins/Referers/API.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -61,16 +61,16 @@
function getSearchEnginesFromKeywordId($idSite, $period, $date, $idSubtable)
{
$dataTable = $this->getDataTable('Referers_searchEngineByKeyword',$idSite, $period, $date, $expanded = false, $idSubtable);
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array( 'label', 'url', 'Piwik_getSearchEngineUrlFromName') );
- $dataTable->queueFilter('Piwik_DataTable_Filter_DetailCallbackAddDetail', array( 'url', 'logo', 'Piwik_getSearchEngineLogoFromName') );
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array( 'label', 'url', 'Piwik_getSearchEngineUrlFromName') );
+ $dataTable->queueFilter('Piwik_DataTable_Filter_MetadataCallbackAddMetadata', array( 'url', 'logo', 'Piwik_getSearchEngineLogoFromName') );
return $dataTable;
}
function getSearchEngines($idSite, $period, $date, $expanded = false)
{
$dataTable = $this->getDataTable('Referers_keywordBySearchEngine',$idSite, $period, $date, $expanded);
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array( 'label', 'url', 'Piwik_getSearchEngineUrlFromName') );
- $dataTable->queueFilter('Piwik_DataTable_Filter_DetailCallbackAddDetail', array( 'url', 'logo', 'Piwik_getSearchEngineLogoFromName') );
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array( 'label', 'url', 'Piwik_getSearchEngineUrlFromName') );
+ $dataTable->queueFilter('Piwik_DataTable_Filter_MetadataCallbackAddMetadata', array( 'url', 'logo', 'Piwik_getSearchEngineLogoFromName') );
return $dataTable;
}
@@ -100,7 +100,7 @@
function getUrlsFromWebsiteId($idSite, $period, $date, $idSubtable)
{
$dataTable = $this->getDataTable('Referers_urlByWebsite',$idSite, $period, $date, $expanded = false, $idSubtable);
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array( 'label', 'url', create_function('$label', 'return $label;')) );
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array( 'label', 'url', create_function('$label', 'return $label;')) );
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getPathFromUrl'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_truncatePath'));
return $dataTable;
@@ -115,7 +115,7 @@
function getUrlsFromPartnerId($idSite, $period, $date, $idSubtable)
{
$dataTable = $this->getDataTable('Referers_urlByPartner',$idSite, $period, $date, $expanded = false, $idSubtable);
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array( 'label', 'url', create_function('$label', 'return $label;')) );
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array( 'label', 'url', create_function('$label', 'return $label;')) );
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getPathFromUrl'));
return $dataTable;
}
Modified: trunk/plugins/UserCountry/API.php
===================================================================
--- trunk/plugins/UserCountry/API.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/plugins/UserCountry/API.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -32,12 +32,12 @@
Piwik::checkUserHasViewAccess( $idSite );
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('UserCountry_country');
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array('label', 'code', create_function('$label', 'return $label;')));
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array('label', 'logo', 'Piwik_getFlagFromCode'));
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'code', create_function('$label', 'return $label;')));
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getFlagFromCode'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_CountryTranslate'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
- $dataTable->queueFilter('Piwik_DataTable_Filter_AddConstantDetail', array('logoWidth', 18));
- $dataTable->queueFilter('Piwik_DataTable_Filter_AddConstantDetail', array('logoHeight', 12));
+ $dataTable->queueFilter('Piwik_DataTable_Filter_AddConstantMetadata', array('logoWidth', 18));
+ $dataTable->queueFilter('Piwik_DataTable_Filter_AddConstantMetadata', array('logoHeight', 12));
return $dataTable;
}
public function getContinent( $idSite, $period, $date )
@@ -45,7 +45,7 @@
Piwik::checkUserHasViewAccess( $idSite );
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('UserCountry_continent');
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array('label', 'code', create_function('$label', 'return $label;')));
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'code', create_function('$label', 'return $label;')));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_ContinentTranslate'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
return $dataTable;
Modified: trunk/plugins/UserSettings/API.php
===================================================================
--- trunk/plugins/UserSettings/API.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/plugins/UserSettings/API.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -56,8 +56,8 @@
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('UserSettings_os');
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array('label', 'logo', 'Piwik_getOSLogo'));
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array( 'label', 'shortLabel', 'Piwik_getOSShortLabel') );
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getOSLogo'));
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array( 'label', 'shortLabel', 'Piwik_getOSShortLabel') );
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array( 'label', 'Piwik_getOSLabel') );
return $dataTable;
}
@@ -68,8 +68,8 @@
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('UserSettings_browser');
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array('label', 'logo', 'Piwik_getBrowsersLogo'));
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array('label', 'shortLabel', 'Piwik_getBrowserShortLabel'));
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getBrowsersLogo'));
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'shortLabel', 'Piwik_getBrowserShortLabel'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getBrowserLabel'));
return $dataTable;
}
@@ -80,7 +80,7 @@
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('UserSettings_browserType');
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array('label', 'shortLabel', 'ucfirst'));
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'shortLabel', 'ucfirst'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getBrowserTypeLabel'));
return $dataTable;
}
@@ -91,7 +91,7 @@
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('UserSettings_wideScreen');
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array('label', 'logo', 'Piwik_getScreensLogo'));
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getScreensLogo'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'ucfirst'));
return $dataTable;
}
@@ -102,7 +102,7 @@
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('UserSettings_plugin');
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
- $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array('label', 'logo', 'Piwik_getPluginsLogo'));
+ $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getPluginsLogo'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'ucfirst'));
return $dataTable;
}
Modified: trunk/tests/modules/DataTable/Renderer.test.php
===================================================================
--- trunk/tests/modules/DataTable/Renderer.test.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/tests/modules/DataTable/Renderer.test.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -37,7 +37,7 @@
* -----------------------
* for each renderer we test the case
* - datatableSimple
- * - normal datatable with 2 row (including columns and details) *
+ * - normal datatable with 2 row (including columns and metadata) *
*/
protected function getDataTableTest()
{
@@ -51,10 +51,10 @@
$subtable =
$array = array (
array ( Piwik_DataTable_Row::COLUMNS => array( 'label' => 'Google', 'nb_uniq_visitors' => 11, 'nb_visits' => 11, 'nb_actions' => 17, 'max_actions' => '5', 'sum_visit_length' => 517, 'bounce_count' => 9),
- Piwik_DataTable_Row::DETAILS => array('url' => 'http://www.google.com', 'logo' => './plugins/Referers/images/searchEngines/www.google.com.png'),
+ Piwik_DataTable_Row::METADATA => array('url' => 'http://www.google.com', 'logo' => './plugins/Referers/images/searchEngines/www.google.com.png'),
),
array ( Piwik_DataTable_Row::COLUMNS => array( 'label' => 'Yahoo!', 'nb_uniq_visitors' => 15, 'nb_visits' => 151, 'nb_actions' => 147, 'max_actions' => '50', 'sum_visit_length' => 517, 'bounce_count' => 90),
- Piwik_DataTable_Row::DETAILS => array('url' => 'http://www.yahoo.com', 'logo' => './plugins/Referers/images/searchEngines/www.yahoo.com.png'),
+ Piwik_DataTable_Row::METADATA => array('url' => 'http://www.yahoo.com', 'logo' => './plugins/Referers/images/searchEngines/www.yahoo.com.png'),
Piwik_DataTable_Row::DATATABLE_ASSOCIATED => $subDataTableForRow2,
)
);
@@ -189,7 +189,7 @@
{
$dataTable = $this->getDataTableTest();
$render = new Piwik_DataTable_Renderer_Csv($dataTable);
- $expected = 'label,nb_uniq_visitors,nb_visits,nb_actions,max_actions,sum_visit_length,bounce_count,detail_url,detail_logo
+ $expected = 'label,nb_uniq_visitors,nb_visits,nb_actions,max_actions,sum_visit_length,bounce_count,metadata_url,metadata_logo
Google,11,11,17,5,517,9,http://www.google.com,./plugins/Referers/images/searchEngines/www.google.com.png
Yahoo!,15,151,147,50,517,90,http://www.yahoo.com,./plugins/Referers/images/searchEngines/www.yahoo.com.png';
@@ -373,10 +373,10 @@
{
$array1 = array (
array ( Piwik_DataTable_Row::COLUMNS => array( 'label' => 'Google', 'nb_uniq_visitors' => 11, 'nb_visits' => 11, ),
- Piwik_DataTable_Row::DETAILS => array('url' => 'http://www.google.com', 'logo' => './plugins/Referers/images/searchEngines/www.google.com.png'),
+ Piwik_DataTable_Row::METADATA => array('url' => 'http://www.google.com', 'logo' => './plugins/Referers/images/searchEngines/www.google.com.png'),
),
array ( Piwik_DataTable_Row::COLUMNS => array( 'label' => 'Yahoo!', 'nb_uniq_visitors' => 15, 'nb_visits' => 151, ),
- Piwik_DataTable_Row::DETAILS => array('url' => 'http://www.yahoo.com', 'logo' => './plugins/Referers/images/searchEngines/www.yahoo.com.png'),
+ Piwik_DataTable_Row::METADATA => array('url' => 'http://www.yahoo.com', 'logo' => './plugins/Referers/images/searchEngines/www.yahoo.com.png'),
)
);
$table1 = new Piwik_DataTable();
@@ -385,10 +385,10 @@
$array2 = array (
array ( Piwik_DataTable_Row::COLUMNS => array( 'label' => 'Google1', 'nb_uniq_visitors' => 110, 'nb_visits' => 110,),
- Piwik_DataTable_Row::DETAILS => array('url' => 'http://www.google.com1', 'logo' => './plugins/Referers/images/searchEngines/www.google.com.png1'),
+ Piwik_DataTable_Row::METADATA => array('url' => 'http://www.google.com1', 'logo' => './plugins/Referers/images/searchEngines/www.google.com.png1'),
),
array ( Piwik_DataTable_Row::COLUMNS => array( 'label' => 'Yahoo!1', 'nb_uniq_visitors' => 150, 'nb_visits' => 1510,),
- Piwik_DataTable_Row::DETAILS => array('url' => 'http://www.yahoo.com1', 'logo' => './plugins/Referers/images/searchEngines/www.yahoo.com.png1'),
+ Piwik_DataTable_Row::METADATA => array('url' => 'http://www.yahoo.com1', 'logo' => './plugins/Referers/images/searchEngines/www.yahoo.com.png1'),
)
);
$table2 = new Piwik_DataTable();
@@ -889,7 +889,7 @@
{
$dataTable = $this->getDataTableArrayTest();
$render = new Piwik_DataTable_Renderer_Csv($dataTable);
- $expected = 'testKey,label,nb_uniq_visitors,nb_visits,detail_url,detail_logo
+ $expected = 'testKey,label,nb_uniq_visitors,nb_visits,metadata_url,metadata_logo
date1,Google,11,11,http://www.google.com,./plugins/Referers/images/searchEngines/www.google.com.png
date1,Yahoo!,15,151,http://www.yahoo.com,./plugins/Referers/images/searchEngines/www.yahoo.com.png
date2,Google1,110,110,http://www.google.com1,./plugins/Referers/images/searchEngines/www.google.com.png1
@@ -925,7 +925,7 @@
{
$dataTable = $this->getDataTableArray_containsDataTableArray_normal();
$render = new Piwik_DataTable_Renderer_Csv($dataTable);
- $expected = 'parentArrayKey,testKey,label,nb_uniq_visitors,nb_visits,detail_url,detail_logo
+ $expected = 'parentArrayKey,testKey,label,nb_uniq_visitors,nb_visits,metadata_url,metadata_logo
idSite,date1,Google,11,11,http://www.google.com,./plugins/Referers/images/searchEngines/www.google.com.png
idSite,date1,Yahoo!,15,151,http://www.yahoo.com,./plugins/Referers/images/searchEngines/www.yahoo.com.png
idSite,date2,Google1,110,110,http://www.google.com1,./plugins/Referers/images/searchEngines/www.google.com.png1
@@ -971,7 +971,7 @@
$table = new Piwik_DataTable;
$idtable = $table->getId();
$table->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array( 'visits'=>245,'visitors'=>245),
- Piwik_DataTable_Row::DETAILS => array('logo' => 'test.png'),)
+ Piwik_DataTable_Row::METADATA => array('logo' => 'test.png'),)
);
@@ -1021,7 +1021,7 @@
$table = new Piwik_DataTable;
$table->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array( 'visits'=>245,'visitors'=>245),
- Piwik_DataTable_Row::DETAILS => array('logo' => 'test.png'),)
+ Piwik_DataTable_Row::METADATA => array('logo' => 'test.png'),)
);
Modified: trunk/tests/modules/DataTable.test.php
===================================================================
--- trunk/tests/modules/DataTable.test.php 2008-06-08 19:23:33 UTC (rev 514)
+++ trunk/tests/modules/DataTable.test.php 2008-06-08 20:03:21 UTC (rev 515)
@@ -67,15 +67,15 @@
*/
$row = array(Piwik_DataTable_Row::COLUMNS => array( 0 => 1554, 1 => 42, 2 => 657,3 => 155744,),
- Piwik_DataTable_Row::DETAILS => array('logo' => 'test.png'));
+ Piwik_DataTable_Row::METADATA => array('logo' => 'test.png'));
$row = new Piwik_DataTable_Row($row);
$table->addRow($row);
$table->addRowFromArray(array( Piwik_DataTable_Row::COLUMNS => array( 0 => 1554,1 => 42,),
- Piwik_DataTable_Row::DETAILS => array('url' => 'piwik.org')));
+ Piwik_DataTable_Row::METADATA => array('url' => 'piwik.org')));
$table->addRowFromArray(array( Piwik_DataTable_Row::COLUMNS => array( 0 => 787877888787,),
- Piwik_DataTable_Row::DETAILS => array('url' => 'OUPLA ADDED'),
+ Piwik_DataTable_Row::METADATA => array('url' => 'OUPLA ADDED'),
Piwik_DataTable_Row::DATATABLE_ASSOCIATED => $subtable));
/*
@@ -84,16 +84,16 @@
$row = array( Piwik_DataTable_Row::COLUMNS => array( 0 => 1554,),
- Piwik_DataTable_Row::DETAILS => array('searchengine' => 'google'),
+ Piwik_DataTable_Row::METADATA => array('searchengine' => 'google'),
);
$subtable->addRowFromArray($row);
$row = array( Piwik_DataTable_Row::COLUMNS => array( 0 => 84894,),
- Piwik_DataTable_Row::DETAILS => array('searchengine' => 'yahoo'),
+ Piwik_DataTable_Row::METADATA => array('searchengine' => 'yahoo'),
);
$subtable->addRowFromArray($row);
$row = array( Piwik_DataTable_Row::COLUMNS => array( 0 => 4898978989,),
- Piwik_DataTable_Row::DETAILS => array('searchengine' => 'ask'),
+ Piwik_DataTable_Row::METADATA => array('searchengine' => 'ask'),
);
$subtable->addRowFromArray($row);
@@ -103,15 +103,15 @@
*/
$subsubtable = new Piwik_DataTable;
$subsubtable->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array( 245),
- Piwik_DataTable_Row::DETAILS => array('yes' => 'subsubdetail1'),)
+ Piwik_DataTable_Row::METADATA => array('yes' => 'subsubmetadata1'),)
);
$subsubtable->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array( 13,),
- Piwik_DataTable_Row::DETAILS => array('yes' => 'subsubdetail2'),)
+ Piwik_DataTable_Row::METADATA => array('yes' => 'subsubmetadata2'),)
);
$row = array( Piwik_DataTable_Row::COLUMNS => array( 0 => 666666666666666,),
- Piwik_DataTable_Row::DETAILS => array('url' => 'NEW ROW ADDED'),
+ Piwik_DataTable_Row::METADATA => array('url' => 'NEW ROW ADDED'),
Piwik_DataTable_Row::DATATABLE_ASSOCIATED => $subsubtable);
$subtable->addRowFromArray($row);
@@ -233,17 +233,17 @@
$columns = array('test_column'=> 145,
092582495 => new Piwik_Timer,
'super'=>array('this column has an array value, amazing'));
- $details = array('logo'=> 'piwik.png',
+ $metadata = array('logo'=> 'piwik.png',
'super'=>array('this column has an array value, amazing'));
$arrayRow = array(
Piwik_DataTable_Row::COLUMNS => $columns,
- Piwik_DataTable_Row::DETAILS => $details,
+ Piwik_DataTable_Row::METADATA => $metadata,
'fake useless key'=>38959,
43905724897=>'value');
$row = new Piwik_DataTable_Row($arrayRow);
$this->assertEqual($row->getColumns(), $columns);
- $this->assertEqual($row->getDetails(), $details);
+ $this->assertEqual($row->getMetadata(), $metadata);
$this->assertEqual($row->getIdSubDataTable(), null);
}
@@ -260,11 +260,11 @@
"test" => 'string fake',
'super'=>array('this column has an array value, amazing')
);
- $details = array('logo'=> 'piwik.png',
+ $metadata = array('logo'=> 'piwik.png',
'super'=>array('this column has an array value, amazing'));
$arrayRow = array(
Piwik_DataTable_Row::COLUMNS => $columns,
- Piwik_DataTable_Row::DETAILS => $details,
+ Piwik_DataTable_Row::METADATA => $metadata,
'fake useless key'=>38959,
43905724897=>'value');
$row1 = new Piwik_DataTable_Row($arrayRow);
@@ -683,7 +683,7 @@
* for all datatable->addDatatable tests we check that
* - row uniqueness is based on the label + presence of the SUBTABLE id
* => the label is the criteria used to match 2 rows in 2 datatable
- * - no details are lost in the first datatable rows that have been changed
+ * - no metadata are lost in the first datatable rows that have been changed
* - when a subtable
*/
More information about the Piwik-svn
mailing list