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
89b27838
Commit
89b27838
authored
Sep 11, 2015
by
Leif Andersson
Browse files
First reasonably working version
parent
03b36c86
Changes
6
Show whitespace changes
Inline
Side-by-side
action.add_edit.php
View file @
89b27838
<?php
if
(
!
isset
(
$gCms
))
exit
;
echo
'<pre>'
;
print_r
(
$params
);
echo
'</pre>'
;
//
echo '<pre>'; print_r($params); echo '</pre>';
if
(
!
$this
->
CheckPermission
(
'Use ReglerAddress'
))
{
return
$this
->
DisplayErrorPage
(
$id
,
$params
,
$returnid
,
...
...
@@ -41,12 +41,13 @@ if (isset($params['ID'])) {
$person
=
new
Person
(
$ID
);
}
else
{
$person
=
new
Person
();
$ID
=
null
;
}
$smarty
=
$this
->
smarty
;
$headline
=
$person
->
Fornamn
.
' '
.
$person
->
Efternamn
;
if
(
strlen
(
$headline
)
==
1
)
$headline
=
$person
->
SkolaForetag
;
$headline
=
'Redigera
post
: '
.
$headline
;
$headline
=
'Redigera
adress
: '
.
$headline
;
$smarty
->
assign
(
'headline'
,
$headline
);
...
...
@@ -74,10 +75,17 @@ foreach ($areaFields as $key => $name) {
$smarty
->
assign
(
'title_Grupper'
,
'Medlem av grupper'
);
$name
=
'Grupper'
;
$place
=
$this
->
CreateInputSelectList
(
$id
,
$name
,
$person
->
Grupper
,
$grupper
=
array
();
if
(
$ID
)
$grupper
=
$person
->
Grupper
;
$place
=
$this
->
CreateInputSelectList
(
$id
,
$name
,
$grupper
,
array
(),
5
,
''
,
false
);
$smarty
->
assign
(
'select_Grupper'
,
$place
);
$place
=
$this
->
CreateInputSubmit
(
$id
,
'doGroups'
,
'Ändra grupper'
);
if
(
$ID
)
{
$place
=
$this
->
CreateInputSubmit
(
$id
,
'doGroups'
,
'Ändra grupper'
);
}
else
{
$place
=
''
;
}
$smarty
->
assign
(
'groupsButton'
,
$place
);
...
...
@@ -104,7 +112,7 @@ $smarty->assign('cancelButton',$place);
$smarty
->
assign
(
'person'
,
$person
);
echo
'<pre>'
;
print_r
(
$person
);
echo
'</pre>'
;
//
echo '<pre>'; print_r($person); echo '</pre>';
...
...
action.changeGroups.php
View file @
89b27838
<?php
if
(
!
isset
(
$gCms
))
exit
;
echo
'<pre>'
;
print_r
(
$params
);
echo
'</pre>'
;
//
echo '<pre>'; print_r($params); echo '</pre>';
if
(
!
$this
->
CheckPermission
(
'Use ReglerAddress'
))
{
return
$this
->
DisplayErrorPage
(
$id
,
$params
,
$returnid
,
...
...
@@ -20,6 +20,12 @@ if (isset($params['back'])) {
}
$ID
=
$params
[
'ID'
];
$person
=
new
Person
(
$ID
);
$headline
=
$person
->
Fornamn
.
' '
.
$person
->
Efternamn
;
if
(
strlen
(
$headline
)
==
1
)
$headline
=
$person
->
SkolaForetag
;
$headline
=
'Grupper: '
.
$headline
;
$smarty
->
assign
(
'headline'
,
$headline
);
if
(
isset
(
$params
[
'setMember'
]))
{
$GroupID
=
$params
[
'nonmembers'
];
...
...
action.defaultadmin.php
View file @
89b27838
...
...
@@ -13,7 +13,7 @@
require_once
'lib/class.Group.php'
;
if
(
!
isset
(
$gCms
))
exit
;
echo
'<pre>'
;
print_r
(
$params
);
echo
'</pre>'
;
//
echo '<pre>'; print_r($params); echo '</pre>';
/**
* For separated methods, you won't be able to do permission checks in
...
...
lib/class.Person.php
View file @
89b27838
...
...
@@ -91,9 +91,9 @@ EOT;
private
function
createRecord
()
{
$db
=
AddressDB
::
getDB
();
$query
=
'insert into Adresser set
Fornamn=?
'
;
$values
=
array
(
'Förnamn'
);
$result
=
$db
->
Execute
(
$query
,
$values
);
$query
=
'insert into Adresser set
Andrad=null
'
;
//
$values = array('Förnamn');
$result
=
$db
->
Execute
(
$query
,
array
()
);
if
(
$result
===
false
)
{
die
(
"Database error!<br>"
.
$publDB
->
ErrorMsg
());
}
$this
->
ID
=
$db
->
Insert_ID
();
}
...
...
@@ -111,6 +111,7 @@ EOT;
if
(
!
isset
(
$this
->
$field
))
$this
->
field
=
'null'
;
$val
=
trim
(
$this
->
$field
);
if
(
strlen
(
$val
)
==
0
)
$val
=
null
;
if
(
$field
==
'Andrad'
)
$val
=
null
;
$qfields
[]
=
sprintf
(
'%s = ?'
,
$field
);
$values
[]
=
$val
;
}
...
...
@@ -159,9 +160,6 @@ EOT;
$query
=
self
::
$queryPersons
.
' '
.
join
(
' and '
,
$andQuery
);
$values
=
$andValues
;
}
// echo '<pre>'; echo $query; echo '</pre>';
// echo '<pre>'; print_r($values); echo '</pre>';
// return array();
$db
=
AddressDB
::
getDB
();
$class
=
__CLASS__
;
$records
=
array
();
...
...
templates/adminpanel.tpl
View file @
89b27838
{
$start_form
}
<table
align=
"center"
bgcolor=
"#f0f0ff"
><thead><tr><td
colspan=
"2"
style=
"text-align: center; font-size:
3
00%;"
>
Adressregister
</td></tr></thead><tbody>
<table
align=
"center"
bgcolor=
"#f0f0ff"
><thead><tr><td
colspan=
"2"
bgcolor=
"#000080"
style=
"text-align: center;
font-weight:bold;
font-size:
2
00%;
color: white;
"
>
Adressregister
</td></tr></thead><tbody>
<tr><td
style=
"vertical-align:top;"
>
<table><tbody>
<table>
<tbody>
{
foreach
$fields
as
$key
=>
$val
}
<tr
><td
style=
"text-align:right;padding-right:1em;"
>
{
$title_
{
$key
}}
</td>
<td>
{
$input_
{
$key
}}
</td></tr>
...
...
@@ -14,9 +15,24 @@
</tr></tbody></table>
{
$end_form
}
<table
CELLPADDING=
"3"
align=
"center"
><tbody>
{
if
!
empty
(
$Persons
)
}
<table
CELLPADDING=
"3"
align=
"center"
>
<thead><tr>
<td
style=
"background-color:#000080; font-weight:bold; font-size: 130%; color: white;"
>
Namn
</td>
<td
style=
"background-color:#000080; font-weight:bold; font-size: 130%; color: white;"
>
Företag/Adress
</td>
<td
style=
"background-color:#000080; font-weight:bold; font-size: 130%; color: white;"
>
Avdelning
</td>
<td
style=
"background-color:#000080; font-weight:bold; font-size: 130%; color: white;"
>
</td>
</tr></thead>
<tbody>
{
foreach
$Persons
as
$person
}
<tr><td>
{
$person
->
Namn
}
</td><td>
{
$person
->
ForetagAdress
}
</td>
<td>
{
$person
->
Avdelning
}
</td><td>
{
$person
->
link
}
</td></tr>
{/
foreach
}
</tbody></table>
{/
if
}
\ No newline at end of file
templates/groupMembers.tpl
View file @
89b27838
{
$start_form
}
<table
CELLPADDING=
"3"
align=
"center"
><tbody>
<tr><td>
Medlem av
</td><td></td><td>
Icke medlem av
</td></tr>
<tr><td>
{
$members
}
</td><td
style=
"font-weiht:bold;"
>
{
$setMember
}
<br
/>
{
$setNonmember
}
</td><td>
{
$nonmembers
}
</td></tr>
<table
CELLPADDING=
"3"
align=
"center"
bgcolor=
"#f0f0ff"
>
<thead><tr><td
bgcolor=
"#000080"
colspan=
"3"
style=
"text-align: center;
font-size: 200%; font-weight:bold; color: white;"
>
{
$headline
}
</td></tr>
<tr><td
colspan=
"3"
><td>
</td></tr>
</thead>
<tbody>
<tr><td
with=
"33%"
>
Medlem av
</td><td
width=
"33%"
></td>
<td
width=
"33%"
>
Icke medlem av
</td></tr>
<tr><td>
{
$members
}
</td><td
style=
"font-weight:bold;"
>
{
$setMember
}
<br
/>
{
$setNonmember
}
</td><td>
{
$nonmembers
}
</td></tr>
<tr><td
colspan=
"3"
style=
"text-align: center;"
>
{
$back
}
</td></tr>
</tbody></table>
{
$hidden
}
{
$end_form
}
Write
Preview
Supports
Markdown
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