ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilShopTopics Class Reference

Class ilShopTopics. More...

+ Collaboration diagram for ilShopTopics:

Public Member Functions

 read ()
 getTopics ()
 setIdFilter ($a_id_filter)
 getIdFilter ()
 setSortingType ($a_sorting_type)
 getSortingType ()
 setSortingDirection ($a_sorting_direction)
 getSortingDirection ()
 enableCustomSorting ($a_enable_custom_sorting)
 isCustomSortingEnabled ()

Static Public Member Functions

static _getInstance ()

Data Fields

const TOPICS_SORT_BY_TITLE = 1
const TOPICS_SORT_BY_CREATEDATE = 2
const TOPICS_SORT_MANUALLY = 3
const DEFAULT_SORTING_TYPE = self::TOPICS_SORT_BY_TITLE
const DEFAULT_SORTING_DIRECTION = 'ASC'

Private Member Functions

 __construct ()

Private Attributes

 $db = null
 $sorting_type = self::TOPICS_SORT_BY_TITLE
 $sorting_direction = 'ASC'
 $enable_custom_sorting = false
 $id_filter = 0
 $topics = array()

Static Private Attributes

static $instance

Detailed Description

Class ilShopTopics.

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

Definition at line 36 of file class.ilShopTopics.php.

Constructor & Destructor Documentation

ilShopTopics::__construct ( )
private

Definition at line 54 of file class.ilShopTopics.php.

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

Member Function Documentation

static ilShopTopics::_getInstance ( )
static
ilShopTopics::enableCustomSorting (   $a_enable_custom_sorting)

Definition at line 204 of file class.ilShopTopics.php.

{
$this->enable_custom_sorting = (bool)$a_enable_custom_sorting;
}
ilShopTopics::getIdFilter ( )

Definition at line 184 of file class.ilShopTopics.php.

References $id_filter.

{
}
ilShopTopics::getSortingDirection ( )

Definition at line 200 of file class.ilShopTopics.php.

References $sorting_direction.

Referenced by read().

+ Here is the caller graph for this function:

ilShopTopics::getSortingType ( )

Definition at line 192 of file class.ilShopTopics.php.

References $sorting_type.

Referenced by read().

{
}

+ Here is the caller graph for this function:

ilShopTopics::getTopics ( )

Definition at line 175 of file class.ilShopTopics.php.

{
return is_array($this->topics) ? $this->topics : array();
}
ilShopTopics::isCustomSortingEnabled ( )

Definition at line 208 of file class.ilShopTopics.php.

References $enable_custom_sorting.

Referenced by read().

{
}

+ Here is the caller graph for this function:

ilShopTopics::read ( )

Definition at line 71 of file class.ilShopTopics.php.

References $res, DB_FETCHMODE_OBJECT, getSortingDirection(), getSortingType(), isCustomSortingEnabled(), setSortingDirection(), and setSortingType().

{
global $ilUser;
$oSettings = new ilGeneralSettings();
$this->topics = array();
if(!in_array($this->getSortingType(), array(self::TOPICS_SORT_BY_TITLE, self::TOPICS_SORT_BY_CREATEDATE, self::TOPICS_SORT_MANUALLY)))
{
$this->setSortingType(self::DEFAULT_SORTING_TYPE);
}
if(!in_array(strtoupper($this->getSortingDirection()), array('ASC', 'DESC')))
{
$this->setSortingDirection(self::DEFAULT_SORTING_DIRECTION);
}
if(!$this->isCustomSortingEnabled())
{
$query = "SELECT *
FROM payment_topics WHERE 1 ";
if((int)$this->id_filter > 0)
{
$query .= " AND pt_topic_pk = ".$this->db->quote($this->id_filter)." ";
}
switch($this->getSortingType())
{
case 3:
$query .= " ORDER BY pt_topic_sort ";
break;
case 2:
$query .= " ORDER BY pt_topic_created ";
break;
case 1:
default:
$query .= " ORDER BY pt_topic_title ";
break;
}
$query .= ' '.strtoupper($this->getSortingDirection()).' ';
$query .= " , pt_topic_title ";
$query .= ' '.strtoupper($this->getSortingDirection()).' ';
}
else
{
$query = "SELECT *
FROM payment_topics ";
switch($this->getSortingType())
{
case 3:
$query .= " LEFT JOIN payment_topics_user_sorting ON
ptus_pt_topic_fk = pt_topic_pk AND
ptus_usr_id = ".$this->db->quote($ilUser->getId())." ";
break;
}
$query .= " WHERE 1 ";
if((int)$this->id_filter > 0)
{
$query .= " AND pt_topic_pk = ".$this->db->quote($this->id_filter)." ";
}
switch($this->getSortingType())
{
case 3:
$query .= " ORDER BY ptus_sorting ";
break;
case 2:
$query .= " ORDER BY pt_topic_created ";
break;
case 1:
default:
$query .= " ORDER BY pt_topic_title ";
break;
}
$query .= ' '.strtoupper($this->getSortingDirection()).' ';
$query .= " , pt_topic_sort ";
$query .= ' '.strtoupper($this->getSortingDirection()).' ';
}
$res = $this->db->query($query);
$counter = 0;
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$oTopic = new ilShopTopic();
$oTopic->setId($row->pt_topic_pk);
$oTopic->setTitle($row->pt_topic_title);
$oTopic->setSorting($row->pt_topic_sort);
$oTopic->setCustomSorting((int)$row->ptus_sorting);
$oTopic->setCreateDate($row->pt_topic_created);
$oTopic->setChangeDate($row->pt_topic_changed);
$this->topics[$row->pt_topic_pk] = $oTopic;
++$counter;
}
return $this;
}

+ Here is the call graph for this function:

ilShopTopics::setIdFilter (   $a_id_filter)

Definition at line 180 of file class.ilShopTopics.php.

{
$this->id_filter = $a_id_filter;
}
ilShopTopics::setSortingDirection (   $a_sorting_direction)

Definition at line 196 of file class.ilShopTopics.php.

Referenced by read().

{
$this->sorting_direction = $a_sorting_direction;
}

+ Here is the caller graph for this function:

ilShopTopics::setSortingType (   $a_sorting_type)

Definition at line 188 of file class.ilShopTopics.php.

Referenced by read().

{
$this->sorting_type = $a_sorting_type;
}

+ Here is the caller graph for this function:

Field Documentation

ilShopTopics::$db = null
private

Definition at line 40 of file class.ilShopTopics.php.

ilShopTopics::$enable_custom_sorting = false
private

Definition at line 43 of file class.ilShopTopics.php.

Referenced by isCustomSortingEnabled().

ilShopTopics::$id_filter = 0
private

Definition at line 44 of file class.ilShopTopics.php.

Referenced by getIdFilter().

ilShopTopics::$instance
staticprivate

Definition at line 38 of file class.ilShopTopics.php.

Referenced by _getInstance().

ilShopTopics::$sorting_direction = 'ASC'
private

Definition at line 42 of file class.ilShopTopics.php.

Referenced by getSortingDirection().

ilShopTopics::$sorting_type = self::TOPICS_SORT_BY_TITLE
private

Definition at line 41 of file class.ilShopTopics.php.

Referenced by getSortingType().

ilShopTopics::$topics = array()
private

Definition at line 45 of file class.ilShopTopics.php.

const ilShopTopics::DEFAULT_SORTING_DIRECTION = 'ASC'
const ilShopTopics::DEFAULT_SORTING_TYPE = self::TOPICS_SORT_BY_TITLE

Definition at line 51 of file class.ilShopTopics.php.

const ilShopTopics::TOPICS_SORT_BY_CREATEDATE = 2

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