From 09e6dea62a549fe78acb9a35d892bda58ef7acd1 Mon Sep 17 00:00:00 2001 From: Leif Andersson <leif.andersson@control.lth.se> Date: Tue, 15 Sep 2015 10:03:35 +0200 Subject: [PATCH] B --- action.defaultadmin.php | 6 ++++++ action.editGroups.php | 15 +++++++++++++++ lib/class.Group.php | 3 ++- templates/adminpanel.tpl | 4 +++- templates/groupEditPanel.tpl | 17 +++++++++++++++++ 5 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 templates/groupEditPanel.tpl diff --git a/action.defaultadmin.php b/action.defaultadmin.php index fc7527d..1eaf183 100644 --- a/action.defaultadmin.php +++ b/action.defaultadmin.php @@ -55,6 +55,10 @@ if (isset($params['new'])) { $this->Redirect($id, 'add_edit', $returnid, array()); } +if (isset($params['groupChange'])) { + $this->Redirect($id,'editGroups',$returnid,array()); +} + foreach ($fields as $key => $res) { $value = ''; if (isset($params[$key])) {$value = trim($params[$key]); } @@ -70,6 +74,8 @@ $smarty->assign('searchButton',$place); $place = $this->CreateInputSubmit($id, 'new', 'Ny post'); $smarty->assign('newButton',$place); +$place = $this->CreateInputSubmit($id, 'groupChange', 'Hantera grupper'); +$smarty->assign('groupButton',$place); $name = 'Grupp'; $groupNames = array(' ' => 'None'); diff --git a/action.editGroups.php b/action.editGroups.php index 6f2cb87..03dc047 100644 --- a/action.editGroups.php +++ b/action.editGroups.php @@ -8,8 +8,23 @@ if (! $this->CheckPermission('Use ReglerAddress')) { } require_once 'lib/class.Group.php'; +$smarty = $this->smarty; +$smarty->assign('headline','Grupphantering'); +$place = $this->CreateFormStart($id, 'editGroups', $returnid); +$smarty->assign('start_form', $place); +$smarty->assign('end_form', $this->CreateFormEnd()); +$groups = Group::GetGroupList(); +foreach ($groups as $group) { + $group->change = 'Change'; + $group->print = 'Print'; +} + +$smarty->assign('Groups',$groups); + +echo $this->ProcessTemplate('groupEditPanel.tpl'); + diff --git a/lib/class.Group.php b/lib/class.Group.php index f6708e9..8db34fd 100644 --- a/lib/class.Group.php +++ b/lib/class.Group.php @@ -28,7 +28,7 @@ EOS; EOS; private static $groupFields = array('ID', 'Gruppnamn', 'GruppInfo'); - + private static $buttonFields = array('change','print'); private static $instance; @@ -36,6 +36,7 @@ EOS; private function __construct($param = NULL) { foreach (self::$groupFields as $field) {$this->$field = '';} + foreach (self::$buttonFields as $field) {$this->$field = '';} if (is_null($param)) return; if (is_array($param)) { foreach (self::$groupFields as $field) { diff --git a/templates/adminpanel.tpl b/templates/adminpanel.tpl index 9185aa9..e9290da 100644 --- a/templates/adminpanel.tpl +++ b/templates/adminpanel.tpl @@ -12,7 +12,9 @@ <td style="vertical-align:top;">{$selectgroup}</td></tr> <tr><td colspan="2" style="text-align: center;">{$searchButton} {$newButton}</td> -</tr></tbody></table> +</tr> +<tr><td colspan="2" style="text-align: center;">{$groupButton}</td></tr> +</tbody></table> {$end_form} {if !empty($Persons)} diff --git a/templates/groupEditPanel.tpl b/templates/groupEditPanel.tpl new file mode 100644 index 0000000..8ca44f3 --- /dev/null +++ b/templates/groupEditPanel.tpl @@ -0,0 +1,17 @@ +{$start_form} +<table CELLPADDING="3" align="center" bgcolor="#f0f0ff"> +<thead><tr><td bgcolor="#000080" colspan="5" style="text-align: center; + font-size: 200%; font-weight:bold; color: white;">{$headline}</td></tr> + <tr><td colspan="3"><td> </td></tr> + </thead> +<tbody> +{if !empty($groups)} +{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> +{/foreach} +{/if} +</tbody></table> +{$hidden} +{$end_form} -- GitLab