1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
<?php
/**
* Bayonet Content Management System - RUDI
* Copyright (C) 2008-2011 Joseph Hunkeler & Evan O'Connell
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
class Rank
{
public function __toString()
{
return $this->longname;
}
}
class Award
{
public function __toString()
{
return $this->name;
}
}
*/
class AdminCommon extends RUDI_Common
{
public function __construct()
{
parent::__construct();
$this->Update();
}
public function getRanks()
{
$result = $this->db->Query("SELECT * FROM rudi_ranks");
while(($row = $this->db->FetchObject($result,'Rank'))!=false)
{
$ranks[] = $row;
}
return $ranks;
}
public function getAwards()
{
$result = $this->db->Query("SELECT * FROM rudi_awards");
while(($row = $this->db->FetchObject($result,'Award'))!=false)
{
$awards[] = $row;
}
return $awards;
}
}
class AdminAdd
{
protected $db, $link, $id;
public $data;
public function __construct()
{
if(is_null($id))
{
decho("No ID");
return;
}
$this->id = $id;
$this->db = new RUDI_SQL();
$this->link = $this->db->Connect('localhost','hunkeler','proball');
$this->db->Select_db('rudi');
//$result = $this->db->Query("INSERT INTO rudi_unit_members VALUES()");
//$name = $this->db->FetchArray($result);
echo "Current soldier selected: '{$name['last_name']}, {$name['first_name']}'";
}
public function __set($var, $val)
{
//echo "UPDATE rudi_unit_members SET $var = '$val';";
//mysql_query("UPDATE rudi_unit_members SET $var = '$val';");
$this->id = addslashes($this->id);
$this->db->Query("UPDATE rudi_unit_members SET $var = '$val' WHERE member_id = '{$this->id}';");
}
}
class AdminModify
{
protected $db, $link, $id;
public $data;
public function __construct($id)
{
if(is_null($id))
{
decho("No ID");
return;
}
else
{
decho(get_class($this) . "received: $id" );
}
$this->id = $id;
$this->db = new RUDI_SQL();
$this->link = $this->db->Connect('localhost','hunkeler','proball');
$this->db->Select_db('rudi');
$result = $this->db->Query("SELECT last_name, first_name FROM rudi_unit_members WHERE member_id = '$id'");
$name = $this->db->FetchArray($result);
echo "Current soldier selected: '{$name['last_name']}, {$name['first_name']}'";
}
public function __set($var, $val)
{
//echo "UPDATE rudi_unit_members SET $var = '$val';";
//mysql_query("UPDATE rudi_unit_members SET $var = '$val';");
$this->id = addslashes($this->id);
$this->db->Query("UPDATE rudi_unit_members SET $var = '$val' WHERE member_id = '{$this->id}';");
}
}
?>
|