tables[$this->nextTableId] = $table; $this->nextTableId++; return $this->nextTableId - 1; } /** * Returns the DataTable associated to the ID $idTable. * NB: The datatable has to have been instanciated before! * This method will not fetch the DataTable from the DB. * * @exception If the table can't be found * @return Piwik_DataTable The table */ public function getTable( $idTable ) { if(!isset($this->tables[$idTable])) { throw new Exception(sprintf("The requested table (id = %d) couldn't be found in the DataTable Manager", $idTable)); } return $this->tables[$idTable]; } /** * Delete all the registered DataTables from the manager */ public function deleteAll() { foreach($this->tables as $id => $table) { $this->deleteTable($id); } $this->tables = array(); $this->nextTableId = 0; } /** * Deletes (unsets) the datatable given its id and removes it from the manager * Subsequent get for this table will fail * * @param int $id */ public function deleteTable( $id ) { if(isset($this->tables[$id])) { $this->setTableDeleted($id); destroy($this->tables[$id]); } } /** * Remove the table from the manager (table has already been unset) * * @param $id */ public function setTableDeleted($id) { $this->tables[$id] = null; } /** * Debug only. Dumps all tables currently registered in the Manager */ public function dumpAllTables() { echo "