action.printGroup.php 987 Bytes
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
15
16
17
18
19
</head>
EOS;


$members = Person::getGroupMembers($ID);
$addresses = array();
Leif Andersson's avatar
Leif Andersson committed
20
$addresses[] = 'Kolumn1;Kolumn2;Kolumn3;Kolumn4;Kolumn5;Kolumn6';
Leif Andersson's avatar
Leif Andersson committed
21
22
foreach ($members as $member) {
  $adr = '';
Leif Andersson's avatar
Leif Andersson committed
23
  if (trim($member->Namn)) $adr .= $member->Namn.';';
Leif Andersson's avatar
Leif Andersson committed
24
  
Leif Andersson's avatar
Leif Andersson committed
25
26
27
28
29
30
  if ($member->SkolaForetag) $adr .= $member->SkolaForetag.';';
  if ($member->Avdelning) $adr .= $member->Avdelning.';';
  if ($member->Adress) {
    $aas = explode("\n",$member->Adress);
    foreach($aas as $aa) $adr .= $aa .';';
  }
Leif Andersson's avatar
Leif Andersson committed
31
  
Leif Andersson's avatar
Leif Andersson committed
32
33
34
  $addresses[] = rtrim($adr,';');
}
//print_r($addresses);
Leif Andersson's avatar
Leif Andersson committed
35
36
echo $HEAD;
echo '<body>'.PHP_EOL;
Leif Andersson's avatar
Leif Andersson committed
37
echo '<pre>'.PHP_EOL;
Leif Andersson's avatar
Leif Andersson committed
38
foreach ($addresses as $adr) echo $adr.PHP_EOL;
Leif Andersson's avatar
Leif Andersson committed
39
echo '</pre>';
Leif Andersson's avatar
Leif Andersson committed
40
41
42
43
echo '</body></html>';

exit;
?>