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