Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
ReglerAddress
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Leif Andersson
ReglerAddress
Commits
2529cd37
Commit
2529cd37
authored
9 years ago
by
Leif Andersson
Browse files
Options
Downloads
Patches
Plain Diff
Flyttade definitionen av $personFields till class.AddressDB.php
parent
31dfdf6c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/class.AddressDB.php
+17
-2
17 additions, 2 deletions
lib/class.AddressDB.php
lib/class.Person.php
+5
-12
5 additions, 12 deletions
lib/class.Person.php
with
22 additions
and
14 deletions
lib/class.AddressDB.php
+
17
−
2
View file @
2529cd37
...
...
@@ -3,7 +3,7 @@
class
AddressDB
{
private
static
$instance
;
private
$PDB
;
private
$database
=
'NyAdresser'
;
private
static
$database
=
'NyAdresser'
;
private
function
__construct
()
{
global
$gCms
;
...
...
@@ -14,7 +14,7 @@ class AddressDB {
$result
=
$this
->
PDB
->
Connect
(
$config
[
'db_hostname'
],
$config
[
'db_username'
],
$config
[
'db_password'
],
$this
->
database
);
self
::
$
database
);
if
(
$result
)
{
$result
=
$this
->
PDB
->
Execute
(
"SET NAMES 'utf8'"
);
}
else
{
...
...
@@ -30,4 +30,19 @@ class AddressDB {
}
return
self
::
$instance
->
PDB
;
}
public
static
function
getFields
(
$tableName
)
{
$db
=
self
::
getDB
();
$query
=
'select column_name from information_schema.columns where '
.
'table_schema="'
.
self
::
$database
.
'" and table_name=?'
;
$values
=
array
(
$tableName
);
$result
=
$db
->
Execute
(
$query
,
$values
);
if
(
$result
===
false
)
{
die
(
"Database error!<br>"
.
$db
->
ErrorMsg
());
}
$fields
=
array
();
while
(
$row
=
$result
->
FetchRow
())
{
$fields
[]
=
$row
[
'column_name'
];
}
return
$fields
;
}
}
This diff is collapsed.
Click to expand it.
lib/class.Person.php
+
5
−
12
View file @
2529cd37
...
...
@@ -18,23 +18,16 @@ EOT;
Grupper.ID=GruppID and AdressID = ?
EOT;
/* private static $queryUpdate = <<<EOT */
/* update Adresser set */
/* EOT; */
public
static
$firstFields
=
array
(
'ID'
,
'fornamn'
,
'efternamn'
,
'foretag'
,
'avdelning'
,
'adress'
,
'Grupp'
);
private
static
$personFields
=
array
(
'ID'
,
'Fornamn'
,
'Efternamn'
,
'Titel'
,
'Personnummer'
,
'SkolaForetag'
,
'Avdelning'
,
'Adress'
,
'Besok'
,
'Hem'
,
'Epost'
,
'Telefon'
,
'TelefonMobil'
,
'TelefonHem'
,
'URL'
,
'AnknytningTillInst'
,
'DiverseInfo'
,
'Andrad'
);
private
static
$personFields
;
public
function
__construct
(
$param
=
NULL
)
{
global
$gCms
;
if
(
!
isset
(
$gCms
))
exit
;
global
$gCms
;
if
(
!
isset
(
$gCms
))
exit
;
if
(
!
isset
(
self
::
$personFields
))
{
self
::
$personFields
=
AddressDB
::
getFields
(
'Adresser'
);
}
foreach
(
self
::
$personFields
as
$field
)
{
$this
->
$field
=
''
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment