Commit a34f89ef authored by Leif Andersson's avatar Leif Andersson
Browse files

Ändrade namn på class Group till Groups. Städade upp.

parent c49d00b9
...@@ -12,12 +12,14 @@ foreach ($paramKeys as $key) { ...@@ -12,12 +12,14 @@ foreach ($paramKeys as $key) {
$this->Redirect($id, 'printGroup', $returnid, array('ID'=>$ID)); $this->Redirect($id, 'printGroup', $returnid, array('ID'=>$ID));
return; return;
} }
if (isset($params['back'])) {
$this->Redirect($id, 'defaultadmin', $returnid, array());
}
if (! $this->CheckPermission('Use ReglerAddress')) { if (! $this->CheckPermission('Use ReglerAddress')) {
return $this->DisplayErrorPage($id, $params, $returnid, return $this->DisplayErrorPage($id, $params, $returnid,
'ReglerAddress access denied.'); 'ReglerAddress access denied.');
} }
require_once 'lib/class.Group.php'; //require_once 'lib/class.Group.php';
if (isset($params['cancelUpdate'])) { if (isset($params['cancelUpdate'])) {
$paramsB = array(); $paramsB = array();
...@@ -26,8 +28,8 @@ if (isset($params['cancelUpdate'])) { ...@@ -26,8 +28,8 @@ if (isset($params['cancelUpdate'])) {
} }
if (isset($params['submit'])) { if (isset($params['submit'])) {
$record = new Group($params); $record = new Groups($params);
echo '<pre>'; print_r($record); echo '</pre>'; //echo '<pre>'; print_r($record); echo '</pre>';
$record->updateRecord(); $record->updateRecord();
$paramsB['module_message'] = 'Gruppen ändrad'; $paramsB['module_message'] = 'Gruppen ändrad';
$this->Redirect($id, 'editGroups', $returnid, $paramsB); $this->Redirect($id, 'editGroups', $returnid, $paramsB);
...@@ -48,16 +50,16 @@ foreach ($paramKeys as $key) { ...@@ -48,16 +50,16 @@ foreach ($paramKeys as $key) {
break; break;
} }
if (isset($params['new'])){ if (isset($params['new'])){
$group = new Group(); $group = new Groups();
$ID = ''; $ID = '';
} else { } else {
$group = new Group($ID); $group = new Groups($ID);
} }
$place = $this->CreateFormStart($id, 'add_edit_Group', $returnid); $place = $this->CreateFormStart($id, 'add_edit_Group', $returnid);
$smarty->assign('start_form', $place); $smarty->assign('start_form', $place);
$smarty->assign('end_form', $this->CreateFormEnd()); $smarty->assign('end_form', $this->CreateFormEnd());
$fields = Group::$groupFields; $fields = Groups::$groupFields;
$smarty->assign('title_ID','ID'); $smarty->assign('title_ID','ID');
$smarty->assign('value_ID',$ID); $smarty->assign('value_ID',$ID);
......
...@@ -6,7 +6,7 @@ if (! $this->CheckPermission('Use ReglerAddress')) { ...@@ -6,7 +6,7 @@ if (! $this->CheckPermission('Use ReglerAddress')) {
return $this->DisplayErrorPage($id, $params, $returnid, return $this->DisplayErrorPage($id, $params, $returnid,
'ReglerAddress access denied.'); 'ReglerAddress access denied.');
} }
require_once 'lib/class.Group.php'; //require_once 'lib/class.Group.php';
if (isset($params['back'])) { if (isset($params['back'])) {
$paramsB = array(); $paramsB = array();
...@@ -29,18 +29,18 @@ $smarty->assign('headline',$headline); ...@@ -29,18 +29,18 @@ $smarty->assign('headline',$headline);
if (isset($params['setMember'])) { if (isset($params['setMember'])) {
$GroupID = $params['nonmembers']; $GroupID = $params['nonmembers'];
Group::setMember($ID,$GroupID); Groups::setMember($ID,$GroupID);
Group::setMailLists(); Groups::setMailLists();
} }
if (isset($params['unsetMember'])) { if (isset($params['unsetMember'])) {
$GroupID = $params['members']; $GroupID = $params['members'];
Group::UnsetMember($ID,$GroupID); Groups::UnsetMember($ID,$GroupID);
Group::setMailLists(); Groups::setMailLists();
} }
$members = Group::getMembers($ID); $members = Groups::getMembers($ID);
$nonmembers = Group::getNonMembers($ID); $nonmembers = Groups::getNonMembers($ID);
// echo '<pre>'; print_r($nonmembers); echo '</pre>'; // echo '<pre>'; print_r($nonmembers); echo '</pre>';
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* line which check to make sure that method was called from the module * line which check to make sure that method was called from the module
* API, and that everything's safe to continue: * API, and that everything's safe to continue:
*/ */
require_once 'lib/class.Group.php'; // require_once 'lib/class.Group.php';
if (!isset($gCms)) exit; if (!isset($gCms)) exit;
//echo '<pre>'; print_r($params); echo '</pre>'; //echo '<pre>'; print_r($params); echo '</pre>';
...@@ -30,10 +30,9 @@ $canChangeRecord = $this->CheckPermission('Use ReglerAddress'); ...@@ -30,10 +30,9 @@ $canChangeRecord = $this->CheckPermission('Use ReglerAddress');
* wrapped in the DisplayAdminPanel() method in the module body. * wrapped in the DisplayAdminPanel() method in the module body.
*/ */
$groups = Group::getGroupList(); $groups = Groups::getGroupList();
//echo '<pre>'; print_r($groups); echo '</pre>'; exit; //echo '<pre>'; print_r($groups); echo '</pre>'; exit;
//file_put_contents("/tmp/defaultadmin.txt",print_r($params,TRUE));
$addrDB = AddressDB::getDB(); $addrDB = AddressDB::getDB();
$smarty = $this->smarty; $smarty = $this->smarty;
// echo '<pre>'; print_r($params); echo '</pre>'; // echo '<pre>'; print_r($params); echo '</pre>';
......
<?php <?php
if (!isset($gCms)) exit; if (!isset($gCms)) exit;
//echo '<pre>'; print_r($params); echo '</pre>'; //echo '<pre>'; print_r($params); echo '</pre>';
require_once 'lib/class.Group.php'; //require_once 'lib/class.Group.php';
$canChangeRecord = $this->CheckPermission('Use ReglerAddress'); $canChangeRecord = $this->CheckPermission('Use ReglerAddress');
/* if (! $this->CheckPermission('Use ReglerAddress')) { */ /* if (! $this->CheckPermission('Use ReglerAddress')) { */
...@@ -16,7 +16,7 @@ $place = $this->CreateFormStart($id, 'add_edit_Group', $returnid); ...@@ -16,7 +16,7 @@ $place = $this->CreateFormStart($id, 'add_edit_Group', $returnid);
$smarty->assign('start_form', $place); $smarty->assign('start_form', $place);
$smarty->assign('end_form', $this->CreateFormEnd()); $smarty->assign('end_form', $this->CreateFormEnd());
$groups = Group::GetGroupList(); $groups = Groups::GetGroupList();
foreach ($groups as $group) { foreach ($groups as $group) {
if ($canChangeRecord) { if ($canChangeRecord) {
$group->change = $this->CreateInputSubmit($id, 'change_'.$group->ID, $group->change = $this->CreateInputSubmit($id, 'change_'.$group->ID,
...@@ -26,6 +26,9 @@ foreach ($groups as $group) { ...@@ -26,6 +26,9 @@ foreach ($groups as $group) {
} }
$group->print = $this->CreateInputSubmit($id, 'print_'.$group->ID, 'Skriv ut'); $group->print = $this->CreateInputSubmit($id, 'print_'.$group->ID, 'Skriv ut');
} }
$place = $this->CreateInputSubmit($id, 'back', 'Tillbaka');
$smarty->assign('backButton',$place);
if ($canChangeRecord) { if ($canChangeRecord) {
$place = $this->CreateInputSubmit($id, 'new', 'Lägg till grupp'); $place = $this->CreateInputSubmit($id, 'new', 'Lägg till grupp');
} else { } else {
......
<?php <?php
class Group { class Groups {
private static $queryList = <<<EOS private static $queryList = <<<EOS
select ID, Gruppnamn, GruppInfo from Grupper order by Gruppnamn select ID, Gruppnamn, GruppInfo from Grupper order by Gruppnamn
...@@ -33,7 +33,8 @@ EOS; ...@@ -33,7 +33,8 @@ EOS;
EOS; EOS;
public static $groupFields = array('ID', 'Gruppnamn', 'GruppInfo'); //public static $groupFields = array('ID', 'Gruppnamn', 'GruppInfo');
public static $groupFields;
private static $buttonFields = array('change','print'); private static $buttonFields = array('change','print');
private static $instance; private static $instance;
...@@ -41,6 +42,10 @@ EOS; ...@@ -41,6 +42,10 @@ EOS;
private static $list = array(); private static $list = array();
public function __construct($param = NULL) { public function __construct($param = NULL) {
global $gCms; if (!isset($gCms)) exit;
if (!isset(self::$groupFields)) {
self::$groupFields = AddressDB::getFields('Grupper');
}
foreach (self::$groupFields as $field) {$this->$field = '';} foreach (self::$groupFields as $field) {$this->$field = '';}
foreach (self::$buttonFields as $field) {$this->$field = '';} foreach (self::$buttonFields as $field) {$this->$field = '';}
if (is_null($param)) return; if (is_null($param)) return;
...@@ -100,7 +105,7 @@ EOS; ...@@ -100,7 +105,7 @@ EOS;
} }
public static function getGroupList() { public static function getGroupList() {
if (count(self::$list) > 0) return $list; if (count(self::$list) > 0) return self::$list;
global $gCms; if (!isset($gCms)) exit; global $gCms; if (!isset($gCms)) exit;
$c = __CLASS__; $c = __CLASS__;
$db = AddressDB::getDB(); $db = AddressDB::getDB();
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
<td>{$group->print}</td></tr> <td>{$group->print}</td></tr>
{/foreach} {/foreach}
{/if} {/if}
<tr><td colspan="5" style="text-align: center;">{$newButton}</td></tr> <tr><td colspan="5" style="text-align: center;">{$newButton}&nbsp;
&nbsp;&nbsp;{$backButton}</td></tr>
</tbody></table> </tbody></table>
{if isset($hidden)}{$hidden}{/if} {if isset($hidden)}{$hidden}{/if}
{$end_form} {$end_form}
Supports Markdown
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