ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilShopVatsList Class Reference

Class ilShopVatsList. More...

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

Public Member Functions

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

Static Public Member Functions

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

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

ilShopVatsList::__construct ( )

Constructor.

public

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

References $ilDB.

{
global $ilDB;
$this->db = $ilDB;
}

Member Function Documentation

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

Checks if the passed vat rate already exists in database.

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.

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

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

{
global $ilDB;
$types = array();
$data = array();
$query = "SELECT * FROM payment_vats "
. "WHERE vat_rate = ? ";
$types[] = 'float';
$data[] = (float)$a_vat_rate;
if((int)$a_vat_id)
{
$query .= "AND vat_id != ? ";
$types[] = 'integer';
$data[] = $a_vat_id;
}
$statement = $ilDB->prepare(trim($query), $types);
$result = $ilDB->execute($statement, $data);
while($row = $ilDB->fetchObject($result))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilShopVatsList::current ( )

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

Referenced by valid().

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

+ Here is the caller graph for this function:

ilShopVatsList::getItems ( )

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

{
return is_array($this->vat_list) ? $this->vat_list : array();
}
ilShopVatsList::getListMax ( )

Getter for max value.

public

Returns
int

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

Referenced by read().

{
return $this->list_max;
}

+ Here is the caller graph for this function:

ilShopVatsList::getListStart ( )

Getter for start value.

public

Returns
int

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

{
return $this->list_start;
}
ilShopVatsList::getNumItems ( )

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

References $num_vat_list.

{
}
ilShopVatsList::getOrderColumn ( )

Getter for order column.

public

Returns
string

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

Referenced by read().

{
return $this->order_column;
}

+ Here is the caller graph for this function:

ilShopVatsList::getOrderDirection ( )

Getter for order direction.

public

Returns
string

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

Referenced by read().

{
return $this->order_direction;
}

+ Here is the caller graph for this function:

ilShopVatsList::hasItems ( )

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

{
return (bool)count($this->vat_list);
}
ilShopVatsList::key ( )

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

{
return key($this->vat_list);
}
ilShopVatsList::next ( )

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

{
return next($this->vat_list);
}
ilShopVatsList::read ( )

Reads the vat datasets from database.

public

Returns
ilShopVatsList

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

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

{
$this->vat_list = array();
$query = "SELECT * FROM payment_vats ";
$query.= "WHERE 1 = 1 ";
if(!in_array($this->getOrderColumn(), array('vat_title', 'vat_rate')))
{
$this->setOrderColumn('vat_rate');
$this->setOrderDirection('ASC');
}
$order_limit = " ORDER BY ".$this->getOrderColumn()." ".strtoupper($this->getOrderDirection())." ";
if((int)$this->getListMax())
{
$order_limit .= "LIMIT ".$this->getListStart().", ".$this->getListMax();
}
$res = $this->db->query($query.$order_limit);
while($row = $this->db->fetchObject($res))
{
$oVAT = new ilShopVats();
$oVAT->setId($row->vat_id);
$oVAT->setTitle($row->vat_title);
$oVAT->setRate($row->vat_rate);
$this->vat_list[$oVAT->getId()] = $oVAT;
}
$res = $this->db->query(str_replace('*', 'COUNT(vat_id) AS num_vat_list', $query));
while($row = $this->db->fetchObject($res))
{
$this->num_vat_list = $row->num_vat_list;
break;
}
return $this;
}

+ Here is the call graph for this function:

ilShopVatsList::rewind ( )

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

{
return reset($this->vat_list);
}
ilShopVatsList::setListMax (   $a_list_max)

Setter for max value.

public

Parameters
int$a_list_max
Returns
ilShopVatsList

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

{
$this->list_max = $a_list_max;
return $this;
}
ilShopVatsList::setListStart (   $a_list_start)

Setter for start value.

public

Parameters
int$a_list_start
Returns
ilShopVatsList

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

{
$this->list_start = $a_list_start;
return $this;
}
ilShopVatsList::setOrderColumn (   $a_order_column)

Setter for order column.

public

Parameters
string$a_order_column
Returns
ilShopVatsList

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

Referenced by read().

{
$this->order_column = $a_order_column;
return $this;
}

+ Here is the caller graph for this function:

ilShopVatsList::setOrderDirection (   $a_order_column)

Setter for order direction.

public

Parameters
string$a_order_column
Returns
ilShopVatsList

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

Referenced by read().

{
$this->order_direction = $a_order_column;
return $this;
}

+ Here is the caller graph for this function:

ilShopVatsList::valid ( )

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

References current().

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

+ Here is the call graph for this function:

Field Documentation

ilShopVatsList::$db = null
private

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

ilShopVatsList::$num_vat_list = 0
private

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

Referenced by getNumItems().

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: