ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilShopVatsList Class Reference

Class ilShopVatsList. More...

+ Inheritance diagram for ilShopVatsList:
+ Collaboration diagram for ilShopVatsList:

Public Member Functions

 __construct ()
 Constructor. More...
 
 read ()
 Reads the vat datasets from database. More...
 
 getNumItems ()
 
 hasItems ()
 
 getItems ()
 
 rewind ()
 
 valid ()
 
 current ()
 
 key ()
 
 next ()
 
 setOrderColumn ($a_order_column)
 Setter for order column. More...
 
 getOrderColumn ()
 Getter for order column. More...
 
 setOrderDirection ($a_order_column)
 Setter for order direction. More...
 
 getOrderDirection ()
 Getter for order direction. More...
 
 setListStart ($a_list_start)
 Setter for start value. More...
 
 getListStart ()
 Getter for start value. More...
 
 setListMax ($a_list_max)
 Setter for max value. More...
 
 getListMax ()
 Getter for max value. More...
 

Static Public Member Functions

static _isVATAlreadyCreated ($a_vat_rate, $a_vat_id=null)
 Checks if the passed vat rate already exists in database. More...
 

Private Attributes

 $db = null
 
 $num_vat_list = 0
 
 $vat_list = array()
 

Detailed Description

Class ilShopVatsList.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 16 of file class.ilShopVatsList.php.

Constructor & Destructor Documentation

◆ __construct()

ilShopVatsList::__construct ( )

Constructor.

@access public

Definition at line 67 of file class.ilShopVatsList.php.

68 {
69 global $ilDB;
70
71 $this->db = $ilDB;
72 }
global $ilDB

References $ilDB.

Member Function Documentation

◆ _isVATAlreadyCreated()

static ilShopVatsList::_isVATAlreadyCreated (   $a_vat_rate,
  $a_vat_id = null 
)
static

Checks if the passed vat rate already exists in database.

@access public

Parameters
string$a_vat_rateThe vat rate wish should be checked.
int$a_vat_idId of an existing vat rate. (optional)
Returns
bool

Definition at line 32 of file class.ilShopVatsList.php.

33 {
34 global $ilDB;
35
36 $types = array();
37 $data = array();
38
39 $query = "SELECT * FROM payment_vats "
40 . "WHERE vat_rate = ? ";
41 $types[] = 'float';
42 $data[] = (float)$a_vat_rate;
43
44 if((int)$a_vat_id)
45 {
46 $query .= "AND vat_id != ? ";
47 $types[] = 'integer';
48 $data[] = $a_vat_id;
49 }
50
51 $statement = $ilDB->prepare(trim($query), $types);
52 $result = $ilDB->execute($statement, $data);
53 while($row = $ilDB->fetchObject($result))
54 {
55 return true;
56 }
57
58 return false;
59 }
$result
$data

References $data, $ilDB, $query, $result, and $row.

Referenced by ilShopVats\save(), and ilShopVats\update().

+ Here is the caller graph for this function:

◆ current()

ilShopVatsList::current ( )

Definition at line 140 of file class.ilShopVatsList.php.

141 {
142 return current($this->vat_list);
143 }

References current().

Referenced by current(), and valid().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItems()

ilShopVatsList::getItems ( )

Definition at line 128 of file class.ilShopVatsList.php.

129 {
130 return is_array($this->vat_list) ? $this->vat_list : array();
131 }

◆ getListMax()

ilShopVatsList::getListMax ( )

Getter for max value.

@access public

Returns
int

Definition at line 249 of file class.ilShopVatsList.php.

250 {
251 return $this->list_max;
252 }

Referenced by read().

+ Here is the caller graph for this function:

◆ getListStart()

ilShopVatsList::getListStart ( )

Getter for start value.

@access public

Returns
int

Definition at line 224 of file class.ilShopVatsList.php.

225 {
226 return $this->list_start;
227 }

◆ getNumItems()

ilShopVatsList::getNumItems ( )

Definition at line 120 of file class.ilShopVatsList.php.

121 {
122 return $this->num_vat_list;
123 }

References $num_vat_list.

◆ getOrderColumn()

ilShopVatsList::getOrderColumn ( )

Getter for order column.

@access public

Returns
string

Definition at line 174 of file class.ilShopVatsList.php.

175 {
176 return $this->order_column;
177 }

Referenced by read().

+ Here is the caller graph for this function:

◆ getOrderDirection()

ilShopVatsList::getOrderDirection ( )

Getter for order direction.

@access public

Returns
string

Definition at line 199 of file class.ilShopVatsList.php.

200 {
201 return $this->order_direction;
202 }

Referenced by read().

+ Here is the caller graph for this function:

◆ hasItems()

ilShopVatsList::hasItems ( )

Definition at line 124 of file class.ilShopVatsList.php.

125 {
126 return (bool)count($this->vat_list);
127 }

◆ key()

ilShopVatsList::key ( )

Definition at line 144 of file class.ilShopVatsList.php.

145 {
146 return key($this->vat_list);
147 }

References key().

Referenced by key().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ next()

ilShopVatsList::next ( )

Definition at line 148 of file class.ilShopVatsList.php.

149 {
150 return next($this->vat_list);
151 }

References next().

Referenced by next().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilShopVatsList::read ( )

Reads the vat datasets from database.

@access public

Returns
ilShopVatsList

Definition at line 81 of file class.ilShopVatsList.php.

82 {
83 $this->vat_list = array();
84
85 $query = "SELECT * FROM payment_vats ";
86 $query.= "WHERE 1 = 1 ";
87 if(!in_array($this->getOrderColumn(), array('vat_title', 'vat_rate')))
88 {
89 $this->setOrderColumn('vat_rate');
90 $this->setOrderDirection('ASC');
91 }
92
93 $order_limit = " ORDER BY ".$this->getOrderColumn()." ".strtoupper($this->getOrderDirection())." ";
94 if((int)$this->getListMax())
95 {
96 $order_limit .= "LIMIT ".$this->getListStart().", ".$this->getListMax();
97 }
98
99 $res = $this->db->query($query.$order_limit);
100 while($row = $this->db->fetchObject($res))
101 {
102 $oVAT = new ilShopVats();
103 $oVAT->setId($row->vat_id);
104 $oVAT->setTitle($row->vat_title);
105 $oVAT->setRate($row->vat_rate);
106
107 $this->vat_list[$oVAT->getId()] = $oVAT;
108 }
109
110 $res = $this->db->query(str_replace('*', 'COUNT(vat_id) AS num_vat_list', $query));
111 while($row = $this->db->fetchObject($res))
112 {
113 $this->num_vat_list = $row->num_vat_list;
114 break;
115 }
116
117 return $this;
118 }
getOrderDirection()
Getter for order direction.
getOrderColumn()
Getter for order column.
setOrderDirection($a_order_column)
Setter for order direction.
getListMax()
Getter for max value.
setOrderColumn($a_order_column)
Setter for order column.
Class ilShopVats.

References $query, $res, $row, getListMax(), getOrderColumn(), getOrderDirection(), setOrderColumn(), and setOrderDirection().

+ Here is the call graph for this function:

◆ rewind()

ilShopVatsList::rewind ( )

Definition at line 132 of file class.ilShopVatsList.php.

133 {
134 return reset($this->vat_list);
135 }

◆ setListMax()

ilShopVatsList::setListMax (   $a_list_max)

Setter for max value.

@access public

Parameters
int$a_list_max
Returns
ilShopVatsList

Definition at line 236 of file class.ilShopVatsList.php.

237 {
238 $this->list_max = $a_list_max;
239
240 return $this;
241 }

◆ setListStart()

ilShopVatsList::setListStart (   $a_list_start)

Setter for start value.

@access public

Parameters
int$a_list_start
Returns
ilShopVatsList

Definition at line 211 of file class.ilShopVatsList.php.

212 {
213 $this->list_start = $a_list_start;
214
215 return $this;
216 }

◆ setOrderColumn()

ilShopVatsList::setOrderColumn (   $a_order_column)

Setter for order column.

@access public

Parameters
string$a_order_column
Returns
ilShopVatsList

Definition at line 161 of file class.ilShopVatsList.php.

162 {
163 $this->order_column = $a_order_column;
164
165 return $this;
166 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setOrderDirection()

ilShopVatsList::setOrderDirection (   $a_order_column)

Setter for order direction.

@access public

Parameters
string$a_order_column
Returns
ilShopVatsList

Definition at line 186 of file class.ilShopVatsList.php.

187 {
188 $this->order_direction = $a_order_column;
189
190 return $this;
191 }

Referenced by read().

+ Here is the caller graph for this function:

◆ valid()

ilShopVatsList::valid ( )

Definition at line 136 of file class.ilShopVatsList.php.

137 {
138 return (bool)current($this->vat_list);
139 }

References current().

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilShopVatsList::$db = null
private

Definition at line 18 of file class.ilShopVatsList.php.

◆ $num_vat_list

ilShopVatsList::$num_vat_list = 0
private

Definition at line 19 of file class.ilShopVatsList.php.

Referenced by getNumItems().

◆ $vat_list

ilShopVatsList::$vat_list = array()
private

Definition at line 20 of file class.ilShopVatsList.php.


The documentation for this class was generated from the following file: