action.printGroup.php 1.07 KB
Newer Older
Leif Andersson's avatar
Leif Andersson committed
1
<?php
2
if( !defined('CMS_VERSION') ) exit;
Leif Andersson's avatar
Leif Andersson committed
3
4
5
6
7
8
9
10
11
12
//echo '<pre>'; print_r($params); echo '</pre>';

$ID = $params['ID'];

$HEAD = <<<EOS
<!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<title>Grupp $ID</title>
Leif Andersson's avatar
Leif Andersson committed
13
<!-- meta http-equiv="Content-Type" content="text/html"/ -->
Leif Andersson's avatar
Leif Andersson committed
14
</head>
Leif Andersson's avatar
Leif Andersson committed
15
16
17
18
19
<body>
<table>
<tr><td>Kolumn1</td><td>Kolumn2</td><td>Kolumn3</td><td>Kolumn4</td>
<td>Kolumn5</td><td>Kolumn6</td></tr>
  
Leif Andersson's avatar
Leif Andersson committed
20
21
22
23
24
25
EOS;


$members = Person::getGroupMembers($ID);
$addresses = array();
foreach ($members as $member) {
Leif Andersson's avatar
Leif Andersson committed
26
27
  $adr = '<tr>';
  if (trim($member->Namn)) $adr .= '<td>'.$member->Namn.'</td>';
Leif Andersson's avatar
Leif Andersson committed
28
  
Leif Andersson's avatar
Leif Andersson committed
29
30
  if ($member->SkolaForetag) $adr .= '<td>'.$member->SkolaForetag.'</td>';
  if ($member->Avdelning) $adr .=  '<td>'.$member->Avdelning.'</td>';
Leif Andersson's avatar
Leif Andersson committed
31
  if (!$member->Adress) {$member->Adress = $member->Hem;}
Leif Andersson's avatar
Leif Andersson committed
32
33
  if ($member->Adress) {
    $aas = explode("\n",$member->Adress);
Leif Andersson's avatar
Leif Andersson committed
34
    foreach($aas as $aa) $adr .= '<td>'. $aa .'</td>';
Leif Andersson's avatar
Leif Andersson committed
35
  }
Leif Andersson's avatar
Leif Andersson committed
36
37
  $adr .= '</tr>';
  $addresses[] = $adr;
Leif Andersson's avatar
Leif Andersson committed
38
39
}
//print_r($addresses);
Leif Andersson's avatar
Leif Andersson committed
40
41
42
43
44
45
echo $HEAD;
foreach ($addresses as $adr) echo $adr.PHP_EOL;
echo '</body></html>';

exit;
?>