From 562321e32b41c97e01c00d8588cb7bbcb1462d3b Mon Sep 17 00:00:00 2001
From: clearcode <mzawadzinski@gmail.com>
Date: Tue, 22 Jun 2010 07:31:26 +0000
Subject: [PATCH] Added methods to get current value of and override
 $uniqIdTable variable that is used as the DIV ID in the rendered HTML

git-svn-id: http://dev.piwik.org/svn/trunk@2337 59fd770c-687e-43c8-a1e3-f5a4ff64c105
---
 core/ViewDataTable.php | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php
index f5be1df1b4..f66010b7c6 100644
--- a/core/ViewDataTable.php
+++ b/core/ViewDataTable.php
@@ -135,6 +135,8 @@ abstract class Piwik_ViewDataTable
 	 * @var array
 	 */
 	protected $columnsToDisplay = array();
+
+	protected $uniqIdTable = null;
 	
 	/**
 	 * Method to be implemented by the ViewDataTable_*.
@@ -442,7 +444,7 @@ abstract class Piwik_ViewDataTable
 	 * @see datatable.js
 	 * @return string
 	 */
-	protected function getUniqueIdViewDataTable()
+	protected function loadUniqueIdViewDataTable()
 	{
 		// if we request a subDataTable the $this->currentControllerAction DIV ID is already there in the page
 		// we make the DIV ID really unique by appending the ID of the subtable requested
@@ -461,6 +463,27 @@ abstract class Piwik_ViewDataTable
 		}
 		return $uniqIdTable;
 	}
+
+	/**
+	 *  Sets the $uniqIdTable variable that is used as the DIV ID in the rendered HTML
+	 */
+	public function setUniqueIdViewDataTable($uniqIdTable)
+	{
+		$this->viewProperties['uniqueId'] = $uniqIdTable;
+		$this->uniqIdTable = $uniqIdTable;
+	}
+
+	/**
+	 *  Returns current value of $uniqIdTable variable that is used as the DIV ID in the rendered HTML
+	 */
+	public function getUniqueIdViewDataTable()
+	{
+		if( $this->uniqIdTable == null )
+		{
+			$this->uniqIdTable = $this->loadUniqueIdViewDataTable();
+		}
+		return $this->uniqIdTable;
+	}
 	
 	/**
 	 * Returns array of properties, eg. "show_footer", "show_search", etc.
-- 
GitLab