class_mcTableHtml.inc.php 929 Bytes
<?php
/** 
 * @copyright (c) 2014, netz.coop eG
 */
class mcTableHtml { 
	/**
	 *
	 * @param array $param_Table array ( 
	 *				array ('Vorname', 'Nachname', 'Ort'), 
	 *				array ('Peter', 'Petersen', 'Hamburg'), 
	 *			);
	 */
	public static function showTable(array $param_Table, $param_headline="", $param_exportcsv=null) {

		
		if($param_headline) {
			echo mcLanguage::getWord($param_headline);
		}
		
		if($param_exportcsv) {
			echo '<a href="">'.mcLanguage::getWord('exportAsCsv').'</a>';
		}
		
		
		$table_attr = array( 
							"width" => "100  %", 
							"bgcolor" => "#DDDDDD", 
							"border" => "1" 
					); 
		$table = new HTML_Table($table_attr); 
		if (true==PEAR::isError($table))  { 
			die ($table->getMessage()); 
		} 
		foreach ($param_Table as $zeile) { 
			$res=$table->addRow($zeile); 
			if (true==PEAR::isError($res)) { 
				die ($res->getMessage()); 
			} 
		} 
		echo $table->toHtml();		
	}
}
?>