From 346ba92334a82d354b85de45817b0451649cd26d Mon Sep 17 00:00:00 2001 From: Phyks Date: Sat, 7 Sep 2013 23:56:31 +0200 Subject: [PATCH] Found how to store UsersIn :) --- inc/Invoices.class.php | 17 ++++++++++-- inc/UsersIn.class.php | 63 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 inc/UsersIn.class.php diff --git a/inc/Invoices.class.php b/inc/Invoices.class.php index 35d705f..b2ad1aa 100644 --- a/inc/Invoices.class.php +++ b/inc/Invoices.class.php @@ -1,13 +1,13 @@ 'key', @@ -19,6 +19,7 @@ public function __construct() { parent::__construct(); + $users_in = new UsersIn(); } // Getters @@ -39,6 +40,10 @@ return $this->buyer; } + public function getUsersIn() { + return $this->users_in; + } + public function getAmount() { return $this->amount; } @@ -50,6 +55,7 @@ // Setters // ======= public function setId($id) { + $this->users_in->setId($id); $this->id = (int) $id; } @@ -75,6 +81,11 @@ $this->what = $what; } + public function setUsersIn($users_in) { + // Note : users_in in param is an array with users in listed and guests for each user + $this->users_in->set($users_in); + } + // Maps htmlspecialchars on the class before display // ================================================= public function secureDisplay() { diff --git a/inc/UsersIn.class.php b/inc/UsersIn.class.php new file mode 100644 index 0000000..6c4dd36 --- /dev/null +++ b/inc/UsersIn.class.php @@ -0,0 +1,63 @@ +'int', + 'user_id'=>'int', + 'guests'=>'int' + ); + + public function __construct() { + parent::__construct(); + $users_list = array(); + } + + // Getters + // ======= + public function getInvoiceId() { + return $this->invoice_id; + } + + public function get() { + return $this->users_list; + } + + // Setters + // ======= + public function setInvoiceId($id) { + $this->invoice_id = (int) $id; + } + + public function set($users_in) { + $this->users_list = $users_in; + } + + // Maps htmlspecialchars on the class before display + // ================================================= + public function secureDisplay() { + $this->invoice_id = (int) $this->invoice_id; + + $temp_array = array(); + foreach($this->users_list as $user=>$guests) { + $temp_array[(int) $user] = (int) $guests; + } + $this->users_in = $temp_array; + + return $this; + } + + // Restores object from array + // ========================== + public function sessionRestore($data, $serialized = false) { + // TODO *** + if($serialized) { + $data = unserialize($data); + } + } + }