diff --git a/action.add_edit_Group.php b/action.add_edit_Group.php index 8bc150a49c772da90bcf1d2b6ef45ac046d8b1eb..0a6bdfffec5054deee03d817fb49470d89418b24 100644 --- a/action.add_edit_Group.php +++ b/action.add_edit_Group.php @@ -4,7 +4,7 @@ if (!isset($gCms)) exit; $ID=''; $paramKeys = array_keys($params); -$print = 'print_'; +$print = 'print_'; $ICE = 'ICE_'; foreach ($paramKeys as $key) { $pos = strpos($key,$print); if ($pos === false) continue; @@ -12,6 +12,13 @@ foreach ($paramKeys as $key) { $this->Redirect($id, 'printGroup', $returnid, array('ID'=>$ID)); return; } +foreach ($paramKeys as $key) { + $pos = strpos($key,$ICE); + if ($pos === false) continue; + $ID = substr($key,strlen($ICE)); + $this->Redirect($id, 'printICE', $returnid, array('ID'=>$ID)); + return; +} if (isset($params['back'])) { $this->Redirect($id, 'defaultadmin', $returnid, array()); } diff --git a/action.editGroups.php b/action.editGroups.php index 68c70e58ecc8fa8e44e753372523bd293b00a74b..dd564dd29c934eace3dfdab2cf2d55ba56f7eccd 100644 --- a/action.editGroups.php +++ b/action.editGroups.php @@ -25,6 +25,7 @@ foreach ($groups as $group) { $group->change = ''; } $group->print = $this->CreateInputSubmit($id, 'print_'.$group->ID, 'Skriv ut'); + $group->ICE = $this->CreateInputSubmit($id, 'ICE_'.$group->ID, 'ICE'); } $place = $this->CreateInputSubmit($id, 'back', 'Tillbaka'); $smarty->assign('backButton',$place); diff --git a/action.printICE.php b/action.printICE.php new file mode 100644 index 0000000000000000000000000000000000000000..c5b73d33202628af361393c07287bce4e7849d41 --- /dev/null +++ b/action.printICE.php @@ -0,0 +1,50 @@ +<?php +if (!isset($gCms)) exit; +//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> +<meta http-equiv="Content-Type" content="text/plain"/> +</head> +EOS; + + +$members = Person::getGroupMembers($ID); +$addresses = array(); +foreach ($members as $member) { + $rec = ''; + if (trim($member->Namn)) $rec .= $member->Namn.PHP_EOL; + if ($member->Telefon) $rec .= + ' Telefon Kontor: ' . $member->Telefon.PHP_EOL; + if ($member->TelefonMobil) $rec .= + ' Telefon Mobil: ' . $member->TelefonMobil.PHP_EOL; + if ($member->ICE) { + $rec .= ' ICE:'.PHP_EOL; + $ICErows = explode(PHP_EOL, $member->ICE); + foreach ($ICErows as $row) { + $rec .= ' ' . $row . PHP_EOL; + } + } + + $records[] = $rec; +} + + + + + +echo $HEAD; +echo '<body>'.PHP_EOL; +echo '<pre>'; +foreach ($records as $rec) echo $rec.PHP_EOL; + echo '</pre>'; +echo '</body></html>'; + +exit; +?> diff --git a/lib/class.Groups.php b/lib/class.Groups.php index 23ce4685debc0acefbdd498c4a44e8d8b442e420..f3c191b6b28c9ae1f1e5772194b712ee1c55f1ff 100644 --- a/lib/class.Groups.php +++ b/lib/class.Groups.php @@ -38,7 +38,7 @@ EOS; //public static $groupFields = array('ID', 'Gruppnamn', 'GruppInfo'); public static $groupFields; - private static $buttonFields = array('change','print'); + private static $buttonFields = array('change','print','ICE'); private static $instance; @@ -64,7 +64,7 @@ EOS; $count = $result->RecordCount(); switch ($count) { case 0: - die(sprintf('Bad group ID %s'.PHP_EOL,$adressID)); + die(sprintf('Bad group ID %s'.PHP_EOL,$param[0])); break; case 1: $row = $result->FetchRow(); diff --git a/lib/class.Person.php b/lib/class.Person.php index e67127aefbdef117b88ab5adf8878555d83793c0..fe6f8fd59bb1706f968b8c8fff465724d5ab4a5d 100644 --- a/lib/class.Person.php +++ b/lib/class.Person.php @@ -6,7 +6,7 @@ class Person { select distinct Adresser.ID, concat(Fornamn, ' ', Efternamn) as Namn, case when SkolaForetag is not null then SkolaForetag when Adress is not null then Adress else Hem end as ForetagAdress, - Avdelning from Adresser,GruppAdress where + Avdelning, Telefon, TelefonMobil, ICE from Adresser,GruppAdress where EOT; private static $queryOne = <<<EOT diff --git a/templates/groupEditPanel.tpl b/templates/groupEditPanel.tpl index b85cbc44cde0657056b6312efe5ad0d273264737..8b261882a291808dec67552639bed41562a5bb3c 100644 --- a/templates/groupEditPanel.tpl +++ b/templates/groupEditPanel.tpl @@ -9,7 +9,7 @@ {foreach $Groups as $group} <tr><td>{$group->ID}</td><td>{$group->Gruppnamn}</td> <td>{$group->GruppInfo}</td><td>{$group->change}</td> - <td>{$group->print}</td></tr> + <td>{$group->print}</td><td>{$group->ICE}</td></tr> {/foreach} {/if} <tr><td colspan="5" style="text-align: center;">{$newButton}