class_mcTableHtml.inc.php
929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?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();
}
}
?>