diff options
author | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-03-30 06:42:28 +0400 |
---|---|---|
committer | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-03-30 06:42:28 +0400 |
commit | 17e3f31d8108b1fc5fbeea1b607be66f4dcde5fd (patch) | |
tree | 1a9487513ee48e3e4a3497bc7cf86aa8527b5a4d /core | |
parent | 241cd5c015c46945140be70c7daec15e166de29c (diff) |
- fixes #578 Actions API: clarify idsubdatatable VS databaseSubtableId in API response
Diffstat (limited to 'core')
-rw-r--r-- | core/Archive/Single.php | 11 | ||||
-rw-r--r-- | core/DataTable/Renderer/Php.php | 5 |
2 files changed, 10 insertions, 6 deletions
diff --git a/core/Archive/Single.php b/core/Archive/Single.php index 79003c3b62..e4d6c4d472 100644 --- a/core/Archive/Single.php +++ b/core/Archive/Single.php @@ -279,15 +279,14 @@ class Piwik_Archive_Single extends Piwik_Archive { $subDataTableLoaded = $this->getDataTable($name, $subTableID); - $this->loadSubDataTables($name, $subDataTableLoaded); - + $this->loadSubDataTables($name, $subDataTableLoaded, $addMetadataSubtableId); + // we edit the subtable ID so that it matches the newly table created in memory - // 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 + // NB: we dont overwrite the datatableid in the case we are displaying the table expanded. if($addMetadataSubtableId) { - $row->addMetadata('databaseSubtableId', $row->getIdSubDataTable()); + // this will be written back to the column 'idsubdatatable' just before rendering, see Renderer/Php.php + $row->addMetadata('idsubdatatable_in_db', $row->getIdSubDataTable()); } $row->setSubtable( $subDataTableLoaded ); } diff --git a/core/DataTable/Renderer/Php.php b/core/DataTable/Renderer/Php.php index 1d44869e86..b098fedeb8 100644 --- a/core/DataTable/Renderer/Php.php +++ b/core/DataTable/Renderer/Php.php @@ -180,6 +180,11 @@ class Piwik_DataTable_Renderer_Php extends Piwik_DataTable_Renderer try{ $subTable = $this->renderTable( Piwik_DataTable_Manager::getInstance()->getTable($row->getIdSubDataTable())); $newRow['subtable'] = $subTable; + if(isset($newRow['metadata']['idsubdatatable_in_db'])) + { + $newRow['columns']['idsubdatatable'] = $newRow['metadata']['idsubdatatable_in_db']; + unset($newRow['metadata']['idsubdatatable_in_db']); + } } catch (Exception $e) { // the subtables are not loaded we dont do anything } |