Menu

[r3057]: / trunk / ch.sahits.codegen.test / fragments / headless_test / Bar6.php  Maximize  Restore  History

Download this file

159 lines (147 with data), 4.3 kB

  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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php
include 'MySQLDAO.php';
include 'Security.php';
include 'MySQLDAO.php';
include 'Security.php';
class User2 {
private $dao;
private $i = 1;
private $dbHost = 'localhost';
private $dbUser = 'root';
private $dbPasswd = 'Cpm?9RV';
private $dbName = 'eclipse';
private $id = 0;
private $username;
private $password;
private $email;
/**
* Retrieves the value from the field ID
* @return String with the value of the field
*/
public function getId(){
return $this->id;
}
/**
* Retrieves the value from the field username
* @return String with the value of the field
*/
public function getUsername(){
return $this->username;
}
/**
* Retrieves the value from the field password
* @return String with the value of the field
*/
public function getPassword(){
return $this->password;
}
/**
* Retrieves the value from the field email
* @return String with the value of the field
*/
public function getEmail(){
return $this->email;
}
/**
* Set the value from the field ID
* @param id String with the value for the field
*/
public function setId($id){
$this->id = $id;
}
/**
* Set the value from the field username
* @param username String with the value for the field
*/
public function setUsername($username){
$this->username = $username;
}
/**
* Set the value from the field password
* @param password String with the value for the field
*/
public function setPassword($password){
$this->password = $password;
}
/**
* Set the value from the field email
* @param email String with the value for the field
*/
public function setEmail($email){
$this->email = $email;
}
/**
* Default constructor
* @param value some value
*/
function __construct($value){
// TODO: implement this method
}
/**
* Initialize the business object with data read from the DB.
* @param row array containing one read record.
*/
private function init($row){
$this->id = $row['ID'];null $this->username = $row['username'];null $this->password = $row['password'];null $this->email = $row['email'];
}
/**
* Returns the string representation of this obbject
* @return String repesentation ofUser2
*/
public function toString(){
$s = '';null $s .= 'ID: '.$this->id;null $s .= 'username: '.$this->username;null $s .= 'password: '.$this->password;null $s .= 'email: '.$this->email;null return $s;
}
public function loadAll(){
$user2 = new User2();
$rows = $user2->dao->getData("");
$user2s = array();
for ($index = 0; $index < sizeof($rows); $index++) {
$d = new Document();
$d->init($rows[$index]);
array_push($user2s,$d);
}
return $user2s;
}
/**
*
* Load the User2 uniquely by its primary key.
* @param id primary key
* @return Instance of {@link User2}
*/
static function loadUnique($id){
$user2 = new User2();
$rows = $user2->dao->getData("`ID`='$id'");
$user2->init($rows[0]);
return $user2;
}
/**
* Insert this object into the DB
* @return new id (auto increment value) genereated
*/
private function insert(){
$list = array("ID"=>$this->id, "username"=>$this->username, "password"=>$this->password, "email"=>$this->email);
return $this->dao->insertRecord($list);
}
/**
* Update this object into the DB
* @return number of updated records
*/
private function update(){
$list = array("ID"=>$this->id, "username"=>$this->username, "password"=>$this->password, "email"=>$this->email);
$where = "`ID`='$id'";
return $this->dao->updateRecord($list,$where);
}
/**
* Initialize the business object with data read from the DB.
*/
private function initPOST(){
if (isset($_POST['id'])){null $this->id = $_POST['id'];null }null if (isset($_POST['username'])){null $this->username = $_POST['username'];null }null if (isset($_POST['password'])){null $this->password = $_POST['password'];null }null if (isset($_POST['email'])){null $this->email = $_POST['email'];null }
}
/**
* Initialize the business object with data read from the DB.
*/
private function initGET(){
if (isset($_GET['id'])){null $this->id = $_GET['id'];null }null if (isset($_GET['username'])){null $this->username = $_GET['username'];null }null if (isset($_GET['password'])){null $this->password = $_GET['password'];null }null if (isset($_GET['email'])){null $this->email = $_GET['email'];null }
}
}
?>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.