Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Leif Andersson
ReglerAddress
Commits
4e0809ab
Commit
4e0809ab
authored
Sep 20, 2015
by
Leif Andersson
Browse files
Lade till utskrift av grupper
parent
60a94dba
Changes
4
Hide whitespace changes
Inline
Side-by-side
action.add_edit_Group.php
View file @
4e0809ab
...
...
@@ -2,6 +2,17 @@
if
(
!
isset
(
$gCms
))
exit
;
//echo '<pre>'; print_r($params); echo '</pre>';
$ID
=
''
;
$paramKeys
=
array_keys
(
$params
);
$print
=
'print_'
;
foreach
(
$paramKeys
as
$key
)
{
$pos
=
strpos
(
$key
,
$print
);
if
(
$pos
===
false
)
continue
;
$ID
=
substr
(
$key
,
strlen
(
$print
));
$this
->
Redirect
(
$id
,
'printGroup'
,
$returnid
,
array
(
'ID'
=>
$ID
));
return
;
}
if
(
!
$this
->
CheckPermission
(
'Use ReglerAddress'
))
{
return
$this
->
DisplayErrorPage
(
$id
,
$params
,
$returnid
,
'ReglerAddress access denied.'
);
...
...
action.printGroup.php
0 → 100644
View file @
4e0809ab
<?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
)
{
$adr
=
''
;
if
(
trim
(
$member
->
Namn
))
$adr
.
=
$member
->
Namn
.
PHP_EOL
;
if
(
$member
->
SkolaForetag
)
$adr
.
=
$member
->
SkolaForetag
.
PHP_EOL
;
if
(
$member
->
Avdelning
)
$adr
.
=
$member
->
Avdelning
.
PHP_EOL
;
if
(
$member
->
Adress
)
$adr
.
=
$member
->
Adress
.
PHP_EOL
;
$addresses
[]
=
$adr
;
}
echo
$HEAD
;
echo
'<body>'
.
PHP_EOL
;
echo
'<pre>'
;
foreach
(
$addresses
as
$adr
)
echo
$adr
.
PHP_EOL
;
echo
'</pre>'
;
echo
'</body></html>'
;
exit
;
?>
lib/class.Group.php
View file @
4e0809ab
...
...
@@ -2,9 +2,6 @@
class
Group
{
private
static
$maildir
=
'/home/leif/slask/maildir'
;
private
static
$queryList
=
<<<EOS
select ID, Gruppnamn, GruppInfo from Grupper order by Gruppnamn
EOS;
...
...
@@ -165,14 +162,6 @@ EOS;
if
(
$result
===
false
)
{
die
(
"Database error!<br>"
.
$db
->
ErrorMsg
());
}
}
/* public static function getGroup() { */
/* if (!isset(self::$instance)) { */
/* $c = __CLASS__; */
/* self::$instance = new $c; */
/* } */
/* return self::$instance->list; */
/* } */
public
static
function
setMailLists
()
{
global
$gCms
;
if
(
!
isset
(
$gCms
))
exit
;
$config
=&
$gCms
->
GetConfig
();
...
...
lib/class.Person.php
View file @
4e0809ab
...
...
@@ -18,6 +18,11 @@ EOT;
Grupper.ID=GruppID and AdressID = ?
EOT;
private
static
$queryGroupMembers
=
<<<EOS
select distinct *, concat(Fornamn, ' ', Efternamn) as Namn
from Adresser,GruppAdress where Adresser.ID=AdressID and GruppID=?
EOS;
public
static
$firstFields
=
array
(
'ID'
,
'fornamn'
,
'efternamn'
,
'foretag'
,
'avdelning'
,
'adress'
,
'Grupp'
);
...
...
@@ -167,5 +172,22 @@ EOT;
}
return
$records
;
}
public
static
function
getGroupMembers
(
$groupID
)
{
global
$gCms
;
if
(
!
isset
(
$gCms
))
exit
;
$db
=
AddressDB
::
getDB
();
$class
=
__CLASS__
;
$records
=
array
();
$values
=
array
(
$groupID
);
$result
=
$db
->
Execute
(
self
::
$queryGroupMembers
,
$values
);
if
(
!
$result
)
{
die
(
"Database error!<br>"
.
$db
->
ErrorMsg
());
}
while
(
$row
=
$result
->
FetchRow
())
{
$person
=
new
$class
();
foreach
(
$row
as
$key
=>
$value
)
{
$person
->
$key
=
$value
;
}
$records
[]
=
$person
;
}
return
$records
;
}
}
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment