ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilShopTopic Class Reference

Class ilShopTopic. More...

+ Collaboration diagram for ilShopTopic:

Public Member Functions

 __construct ($a_id=0)
 
 save ()
 
 delete ()
 
 saveCustomSorting ()
 
 setId ($a_id)
 
 getId ()
 
 setTitle ($a_title)
 
 getTitle ()
 
 setCreateDate ($a_createdate)
 
 getCreateDate ()
 
 setChangeDate ($a_changedate)
 
 getChangeDate ()
 
 setSorting ($a_sorting)
 
 getSorting ()
 
 setCustomSorting ($a_custom_sorting)
 
 getCustomSorting ()
 

Static Public Member Functions

static _lookupTitle ($a_id)
 

Private Member Functions

 read ()
 

Private Attributes

 $id = 0
 
 $title = ''
 
 $sorting = 0
 
 $createdate = 0
 
 $changedate = 0
 
 $custom_sorting = 0
 
 $db = null
 

Detailed Description

Class ilShopTopic.

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

Definition at line 13 of file class.ilShopTopic.php.

Constructor & Destructor Documentation

◆ __construct()

ilShopTopic::__construct (   $a_id = 0)

Definition at line 24 of file class.ilShopTopic.php.

References $ilDB, and read().

25  {
26  global $ilDB;
27 
28  $this->db = $ilDB;
29 
30  if($a_id)
31  {
32  $this->id = $a_id;
33 
34  $this->read();
35  }
36  }
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupTitle()

static ilShopTopic::_lookupTitle (   $a_id)
static

Definition at line 146 of file class.ilShopTopic.php.

References $ilDB, $result, and $row.

Referenced by ilShopTopicsGUI\showTopicsList().

147  {
148  global $ilDB;
149 
150  $result = $ilDB->queryf("SELECT pt_topic_title FROM payment_topics WHERE pt_topic_pk = %s",
151  array('integer'), array($a_id));
152 
153  while($row = $ilDB->fetchObject($result))
154  {
155  return $row->pt_topic_title;
156  }
157 
158  return false;
159  }
$result
global $ilDB
+ Here is the caller graph for this function:

◆ delete()

ilShopTopic::delete ( )

Definition at line 113 of file class.ilShopTopic.php.

References $result, and getId().

114  {
115  if($this->id)
116  {
117 
118  $result = $this->db->manipulateF('
119  DELETE FROM payment_topics
120  WHERE pt_topic_pk = %s',
121  array('integer'),
122  array($this->getId())
123  );
124 
125  $result = $this->db->manipulateF('
126  DELETE FROM payment_topic_usr_sort
127  WHERE ptus_pt_topic_fk = %s',
128  array('integer'),
129  array($this->getId())
130  );
131 
132  $result = $this->db->manipulateF('
133  UPDATE payment_objects
134  SET pt_topic_fk = %s
135  WHERE pt_topic_fk = %s',
136  array('integer', 'integer'),
137  array(0, $this->getId())
138  );
139 
140  return true;
141  }
142 
143  return false;
144  }
$result
+ Here is the call graph for this function:

◆ getChangeDate()

ilShopTopic::getChangeDate ( )

Definition at line 233 of file class.ilShopTopic.php.

References $changedate.

Referenced by save().

234  {
235  return $this->changedate;
236  }
+ Here is the caller graph for this function:

◆ getCreateDate()

ilShopTopic::getCreateDate ( )

Definition at line 225 of file class.ilShopTopic.php.

References $createdate.

Referenced by save().

226  {
227  return $this->createdate;
228  }
+ Here is the caller graph for this function:

◆ getCustomSorting()

ilShopTopic::getCustomSorting ( )

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

References $custom_sorting.

Referenced by saveCustomSorting().

250  {
251  return $this->custom_sorting;
252  }
+ Here is the caller graph for this function:

◆ getId()

ilShopTopic::getId ( )

Definition at line 209 of file class.ilShopTopic.php.

References $id.

Referenced by delete(), save(), and saveCustomSorting().

210  {
211  return $this->id;
212  }
+ Here is the caller graph for this function:

◆ getSorting()

ilShopTopic::getSorting ( )

Definition at line 241 of file class.ilShopTopic.php.

References $sorting.

Referenced by save().

242  {
243  return $this->sorting;
244  }
+ Here is the caller graph for this function:

◆ getTitle()

ilShopTopic::getTitle ( )

Definition at line 217 of file class.ilShopTopic.php.

References $title.

Referenced by save().

218  {
219  return $this->title;
220  }
+ Here is the caller graph for this function:

◆ read()

ilShopTopic::read ( )
private

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

References $id, $ilUser, $result, $row, setChangeDate(), setCreateDate(), setCustomSorting(), setSorting(), and setTitle().

Referenced by __construct().

39  {
40  global $ilUser;
41 
42  if($this->id)
43  {
44  $result = $this->db->queryf('
45  SELECT * FROM payment_topics
46  LEFT JOIN payment_topic_usr_sort ON ptus_pt_topic_fk = pt_topic_pk
47  AND ptus_usr_id = %s
48  WHERE pt_topic_pk = %s',
49  array('integer', 'integer'),
50  array($ilUser->getId(), $this->id));
51 
52  while($row = $this->db->fetchObject($result))
53  {
54  $this->setTitle($row->pt_topic_title);
55  $this->setSorting($row->pt_topic_sort);
56  $this->setCreateDate($row->pt_topic_created);
57  $this->setChangeDate($row->pt_topic_changed);
58  $this->setCustomSorting($row->ptus_sorting);
59 
60  return true;
61  }
62  }
63 
64  return false;
65  }
$result
setChangeDate($a_changedate)
setCreateDate($a_createdate)
setTitle($a_title)
setCustomSorting($a_custom_sorting)
setSorting($a_sorting)
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilShopTopic::save ( )

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

References getChangeDate(), getCreateDate(), getId(), getSorting(), and getTitle().

68  {
69  if($this->id)
70  {
71  $this->changedate = time();
72 
73  $statement = $this->db->manipulateF('
74  UPDATE payment_topics
75  SET pt_topic_title = %s,
76  pt_topic_sort = %s,
77  pt_topic_changed = %s
78  WHERE pt_topic_pk = %s',
79  array('text', 'integer', 'integer', 'integer'),
80  array(
81  $this->getTitle(),
82  $this->getSorting(),
83  $this->getChangeDate(),
84  $this->getId()
85  ));
86 
87 
88 
89  return true;
90  }
91  else
92  {
93  $this->createdate = time();
94 
95  $next_id = $this->db->nextId('payment_topics');
96  $statement = $this->db->manipulateF('
97  INSERT INTO payment_topics
98  ( pt_topic_pk,
99  pt_topic_title,
100  pt_topic_sort,
101  pt_topic_created
102  ) VALUES (%s, %s, %s, %s)',
103  array('integer','text', 'integer', 'integer'),
104  array($next_id, $this->getTitle(), $this->getSorting(), $this->getCreateDate()));
105 
106  $this->id = $next_id;
107  if($this->id) return true;
108  }
109 
110  return false;
111  }
+ Here is the call graph for this function:

◆ saveCustomSorting()

ilShopTopic::saveCustomSorting ( )

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

References $ilUser, $res, getCustomSorting(), and getId().

162  {
163  global $ilUser;
164 
165  if($this->id)
166  {
167  $res = $this->db->queryf('
168  SELECT * FROM payment_topic_usr_sort
169  WHERE ptus_pt_topic_fk = %s
170  AND ptus_usr_id = %s',
171  array('integer', 'integer'),
172  array($this->getId(), $ilUser->getId())
173  );
174 
175  if($this->db->numRows($res) > 0)
176  {
177  $statement = $this->db->manipulateF('
178  UPDATE payment_topic_usr_sort
179  SET ptus_sorting = %s
180  WHERE ptus_usr_id = %s
181  AND ptus_pt_topic_fk = %s',
182  array('integer', 'integer', 'integer'),
183  array( $this->getCustomSorting(),$ilUser->getId(), $this->getId())
184  );
185  }
186  else
187  {
188  $statement = $this->db->manipulateF('
189  INSERT INTO payment_topic_usr_sort
190  ( ptus_pt_topic_fk,
191  ptus_usr_id,
192  ptus_sorting
193  ) VALUES (%s,%s,%s)',
194  array('integer', 'integer', 'integer'),
195  array($this->getId(), $ilUser->getId(), $this->getCustomSorting())
196  );
197  }
198 
199  return true;
200  }
201 
202  return false;
203  }
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ setChangeDate()

ilShopTopic::setChangeDate (   $a_changedate)

Definition at line 229 of file class.ilShopTopic.php.

Referenced by read().

230  {
231  $this->changedate = $a_changedate;
232  }
+ Here is the caller graph for this function:

◆ setCreateDate()

ilShopTopic::setCreateDate (   $a_createdate)

Definition at line 221 of file class.ilShopTopic.php.

Referenced by read().

222  {
223  $this->createdate = $a_createdate;
224  }
+ Here is the caller graph for this function:

◆ setCustomSorting()

ilShopTopic::setCustomSorting (   $a_custom_sorting)

Definition at line 245 of file class.ilShopTopic.php.

Referenced by read().

246  {
247  $this->custom_sorting = $a_custom_sorting;
248  }
+ Here is the caller graph for this function:

◆ setId()

ilShopTopic::setId (   $a_id)

Definition at line 205 of file class.ilShopTopic.php.

206  {
207  $this->id = $a_id;
208  }

◆ setSorting()

ilShopTopic::setSorting (   $a_sorting)

Definition at line 237 of file class.ilShopTopic.php.

Referenced by read().

238  {
239  $this->sorting = $a_sorting;
240  }
+ Here is the caller graph for this function:

◆ setTitle()

ilShopTopic::setTitle (   $a_title)

Definition at line 213 of file class.ilShopTopic.php.

Referenced by read().

214  {
215  $this->title = $a_title;
216  }
+ Here is the caller graph for this function:

Field Documentation

◆ $changedate

ilShopTopic::$changedate = 0
private

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

Referenced by getChangeDate().

◆ $createdate

ilShopTopic::$createdate = 0
private

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

Referenced by getCreateDate().

◆ $custom_sorting

ilShopTopic::$custom_sorting = 0
private

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

Referenced by getCustomSorting().

◆ $db

ilShopTopic::$db = null
private

Definition at line 22 of file class.ilShopTopic.php.

◆ $id

ilShopTopic::$id = 0
private

Definition at line 15 of file class.ilShopTopic.php.

Referenced by getId(), and read().

◆ $sorting

ilShopTopic::$sorting = 0
private

Definition at line 17 of file class.ilShopTopic.php.

Referenced by getSorting().

◆ $title

ilShopTopic::$title = ''
private

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

Referenced by getTitle().


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