Commit 45649f50 authored by Leif Andersson's avatar Leif Andersson
Browse files

Lade till printICE

parent 315d42a7
......@@ -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());
}
......
......@@ -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);
......
<?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;
?>
......@@ -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();
......
......@@ -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
......
......@@ -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}&nbsp;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment