4 include_once
'Services/Payment/classes/class.ilShopTopic.php';
43 if(!isset(self::$instance))
48 return self::$instance;
55 $this->topics = array();
57 if(!in_array($this->
getSortingType(), array(self::TOPICS_SORT_BY_TITLE, self::TOPICS_SORT_BY_CREATEDATE, self::TOPICS_SORT_MANUALLY)))
69 $data_types = array();
70 $data_values = array();
72 $query =
'SELECT * FROM payment_topics WHERE 1 = 1 ';
75 $query .=
' AND pt_topic_pk = %s';
76 array_push($data_types,
'integer');
83 $query .=
' ORDER BY pt_topic_sort ';
87 $query .=
' ORDER BY pt_topic_created ';
92 $query .=
' ORDER BY pt_topic_title ';
96 $query .=
" , pt_topic_title ";
104 $data_types = array();
105 $data_values = array();
107 $query =
'SELECT * FROM payment_topics ';
111 $query .=
' LEFT JOIN payment_topic_usr_sort ON 112 ptus_pt_topic_fk = pt_topic_pk AND 114 array_push($data_types,
'integer');
115 array_push($data_values, $ilUser->getId());
119 $query .=
' WHERE 1 = 1 ';
121 if((
int)$this->id_filter > 0)
123 $query .=
' AND pt_topic_pk = %s';
124 array_push($data_types,
'integer');
131 $query .=
' ORDER BY ptus_sorting ';
135 $query .=
' ORDER BY pt_topic_created ';
140 $query .=
' ORDER BY pt_topic_title ';
144 $query .=
" , pt_topic_sort ";
148 if(count($data_types) > 0 && count($data_values > 0))
150 $res = $this->db->queryf(
$query, $data_types, $data_values);
158 while(
$row = $this->db->fetchObject(
$res))
161 $oTopic->setId(
$row->pt_topic_pk);
162 $oTopic->setTitle(
$row->pt_topic_title);
163 $oTopic->setSorting(
$row->pt_topic_sort);
164 $oTopic->setCustomSorting((
int)
$row->ptus_sorting);
165 $oTopic->setCreateDate(
$row->pt_topic_created);
166 $oTopic->setChangeDate(
$row->pt_topic_changed);
167 $this->topics[
$row->pt_topic_pk] = $oTopic;
177 return is_array($this->topics) ? $this->topics : array();
182 $this->id_filter = $a_id_filter;
190 $this->sorting_type = $a_sorting_type;
198 $this->sorting_direction = $a_sorting_direction;
206 $this->enable_custom_sorting = (bool)$a_enable_custom_sorting;
217 $res = $ilDB->query(
'SELECT pt_topic_fk, count(pt_topic_fk) cnt FROM payment_objects GROUP BY pt_topic_fk');
219 $topics_count = array();
220 while(
$row = $ilDB->fetchAssoc(
$res))
222 $topics_count[
$row[
'pt_topic_fk']] = (int)$row[
'cnt'];
225 return $topics_count;
enableCustomSorting($a_enable_custom_sorting)
const TOPICS_SORT_BY_CREATEDATE
setSortingType($a_sorting_type)
const TOPICS_SORT_MANUALLY
const DEFAULT_SORTING_DIRECTION
const TOPICS_SORT_BY_TITLE
setIdFilter($a_id_filter)
setSortingDirection($a_sorting_direction)
const DEFAULT_SORTING_TYPE