3 #################################################################################
4 ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
5 ## --------------------------------------------------------------------------- ##
6 ## Filename Form.php ##
7 ## License: TravianX Project ##
8 ## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
10 #################################################################################
14 private $errorarray = array();
15 public $valuearray = array();
18 public function Form() {
19 if(isset($_SESSION['errorarray']) && isset($_SESSION['valuearray'])) {
20 $this->errorarray
= $_SESSION['errorarray'];
21 $this->valuearray
= $_SESSION['valuearray'];
22 $this->errorcount
= count($this->errorarray
);
24 unset($_SESSION['errorarray']);
25 unset($_SESSION['valuearray']);
28 $this->errorcount
= 0;
32 public function addError($field,$error) {
33 $this->errorarray
[$field] = $error;
34 $this->errorcount
= count($this->errorarray
);
37 public function getError($field) {
38 if(array_key_exists($field,$this->errorarray
)) {
39 return $this->errorarray
[$field];
46 public function getValue($field) {
47 if(array_key_exists($field,$this->valuearray
)) {
48 return $this->valuearray
[$field];
55 public function getDiff($field,$cookie) {
56 if(array_key_exists($field,$this->valuearray
) && $this->valuearray
[$field] != $cookie) {
57 return $this->valuearray
[$field];
64 public function getRadio($field,$value) {
65 if(array_key_exists($field,$this->valuearray
) && $this->valuearray
[$field] == $value) {
73 public function returnErrors() {
74 return $this->errorcount
;
77 public function getErrors() {
78 return $this->errorarray
;