ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTermsOfServiceTableDatabaseDataProvider Class Reference
+ Inheritance diagram for ilTermsOfServiceTableDatabaseDataProvider:
+ Collaboration diagram for ilTermsOfServiceTableDatabaseDataProvider:

Public Member Functions

 __construct (ilDB $db)
 getList (array $params, array $filter)

Protected Member Functions

 getSelectPart (array $params, array $filter)
 getFromPart (array $params, array $filter)
 getWherePart (array $params, array $filter)
 getGroupByPart (array $params, array $filter)
 getHavingPart (array $params, array $filter)
 getOrderByPart (array $params, array $filter)

Protected Attributes

 $db

Detailed Description

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

Definition at line 11 of file class.ilTermsOfServiceTableDatabaseDataProvider.php.

Constructor & Destructor Documentation

ilTermsOfServiceTableDatabaseDataProvider::__construct ( ilDB  $db)
Parameters
ilDB$db

Definition at line 21 of file class.ilTermsOfServiceTableDatabaseDataProvider.php.

References $db.

{
$this->db = $db;
}

Member Function Documentation

ilTermsOfServiceTableDatabaseDataProvider::getFromPart ( array  $params,
array  $filter 
)
abstractprotected
Parameters
array$params
array$filter
Returns
string

Reimplemented in ilTermsOfServiceAcceptanceHistoryProvider.

Referenced by getList().

+ Here is the caller graph for this function:

ilTermsOfServiceTableDatabaseDataProvider::getGroupByPart ( array  $params,
array  $filter 
)
abstractprotected
Parameters
array$params
array$filter
Returns
string

Reimplemented in ilTermsOfServiceAcceptanceHistoryProvider.

Referenced by getList().

+ Here is the caller graph for this function:

ilTermsOfServiceTableDatabaseDataProvider::getHavingPart ( array  $params,
array  $filter 
)
abstractprotected
Parameters
array$params
array$filter
Returns
string

Reimplemented in ilTermsOfServiceAcceptanceHistoryProvider.

Referenced by getList().

+ Here is the caller graph for this function:

ilTermsOfServiceTableDatabaseDataProvider::getList ( array  $params,
array  $filter 
)
Parameters
array$params
array$filter
Returns
array
Exceptions
InvalidArgumentException

Implements ilTermsOfServiceTableDataProvider.

Definition at line 80 of file class.ilTermsOfServiceTableDatabaseDataProvider.php.

References $query, $res, $row, getFromPart(), getGroupByPart(), getHavingPart(), getOrderByPart(), getSelectPart(), and getWherePart().

{
$data = array(
'items' => array(),
'cnt' => 0
);
$select = $this->getSelectPart($params, $filter);
$where = $this->getWherePart($params, $filter);
$from = $this->getFromPart($params, $filter);
$order = $this->getOrderByPart($params, $filter);
$group = $this->getGroupByPart($params, $filter);
$having = $this->getHavingPart($params, $filter);
if(isset($params['limit']))
{
if(!is_numeric($params['limit']))
{
throw new InvalidArgumentException('Please provide a valid numerical limit.');
}
if(!isset($params['offset']))
{
$params['offset'] = 0;
}
else if(!is_numeric($params['offset']))
{
throw new InvalidArgumentException('Please provide a valid numerical offset.');
}
$this->db->setLimit($params['limit'], $params['offset']);
}
$where = strlen($where) ? 'WHERE ' . $where : '';
$query = "SELECT {$select} FROM {$from} {$where}";
if(strlen($group))
{
$query .= " GROUP BY {$group}";
}
if(strlen($having))
{
$query .= " HAVING {$having}";
}
if(strlen($order))
{
$query .= " ORDER BY {$order}";
}
$res = $this->db->query($query);
while($row = $this->db->fetchAssoc($res))
{
$data['items'][] = $row;
}
if(isset($params['limit']))
{
$cnt_sql = "SELECT COUNT(*) cnt FROM ({$query}) subquery";
$row_cnt = $this->db->fetchAssoc($this->db->query($cnt_sql));
$data['cnt'] = $row_cnt['cnt'];
}
return $data;
}

+ Here is the call graph for this function:

ilTermsOfServiceTableDatabaseDataProvider::getOrderByPart ( array  $params,
array  $filter 
)
abstractprotected
Parameters
array$params
array$filter
Returns
string

Reimplemented in ilTermsOfServiceAcceptanceHistoryProvider.

Referenced by getList().

+ Here is the caller graph for this function:

ilTermsOfServiceTableDatabaseDataProvider::getSelectPart ( array  $params,
array  $filter 
)
abstractprotected
Parameters
array$params
array$filter
Returns
string

Reimplemented in ilTermsOfServiceAcceptanceHistoryProvider.

Referenced by getList().

+ Here is the caller graph for this function:

ilTermsOfServiceTableDatabaseDataProvider::getWherePart ( array  $params,
array  $filter 
)
abstractprotected
Parameters
array$params
array$filter
Returns
string

Reimplemented in ilTermsOfServiceAcceptanceHistoryProvider.

Referenced by getList().

+ Here is the caller graph for this function:

Field Documentation

ilTermsOfServiceTableDatabaseDataProvider::$db
protected

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

Referenced by __construct().


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