ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilShopNewsItem Class Reference
+ Collaboration diagram for ilShopNewsItem:

Public Member Functions

 __construct ($a_id=0)
 Constructor. More...
 
 setId ($a_id)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setContent ($a_content)
 Set Content. More...
 
 getContent ()
 Get Content. More...
 
 setCreationDate ($a_creation_date)
 Set CreationDate. More...
 
 getCreationDate ()
 Get CreationDate. More...
 
 setUpdateDate ($a_update_date)
 Set UpdateDate. More...
 
 getUpdateDate ()
 Get UpdateDate. More...
 
 setVisibility ($a_visibility='users')
 Set Visibility. More...
 
 getVisibility ()
 Get Visibility. More...
 
 setUserId ($a_user_id)
 Set UserId. More...
 
 getUserId ()
 Get UserId. More...
 
 create ()
 Create new item. More...
 
 update ()
 Update item in database. More...
 
 delete ()
 Delete item from database. More...
 

Private Member Functions

 read ()
 Read item from database. More...
 

Private Attributes

 $id = 0
 
 $title = ''
 
 $content = ''
 
 $creation_date = null
 
 $update_date = null
 
 $user_id = 0
 
 $visibility = 'users'
 

Detailed Description

Author
Nadia Ahmad nahma.nosp@m.d@da.nosp@m.tabay.nosp@m..de
Version
$Id$

Definition at line 9 of file class.ilShopNewsItem.php.

Constructor & Destructor Documentation

◆ __construct()

ilShopNewsItem::__construct (   $a_id = 0)

Constructor.

Parameters
int$a_id

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

25 {
26 if((int)$a_id > 0)
27 {
28 $this->setId((int)$a_id);
29 $this->read();
30 }
31 }
read()
Read item from database.

References read(), and setId().

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilShopNewsItem::create ( )

Create new item.

Definition at line 178 of file class.ilShopNewsItem.php.

179 {
180 global $ilDB;
181
182 $createdate = new ilDateTime(time(), IL_CAL_UNIX);
183
184 $next_id = $ilDB->nextId('payment_news');
185 if((int)$next_id)
186 {
187 $ilDB->insert('payment_news', array(
188 'news_id' => array('integer', $next_id),
189 'news_title' => array('text', $this->getTitle()),
190 'news_content' => array('clob', $this->getContent()),
191 'visibility' => array('text', $this->getVisibility()),
192 'creation_date' => array('timestamp', $createdate->get(IL_CAL_DATETIME)),
193 'update_date' => array('timestamp', $createdate->get(IL_CAL_DATETIME)),
194 'user_id' => array('integer', $this->getUserId())
195 ));
196 $this->id = $next_id;
197 return true;
198 }
199
200 return false;
201 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
@classDescription Date and time handling
getContent()
Get Content.
getVisibility()
Get Visibility.
global $ilDB

References $ilDB, getContent(), getTitle(), getUserId(), getVisibility(), IL_CAL_DATETIME, and IL_CAL_UNIX.

+ Here is the call graph for this function:

◆ delete()

ilShopNewsItem::delete ( )

Delete item from database.

Definition at line 263 of file class.ilShopNewsItem.php.

264 {
265 global $ilDB;
266
267 if((int)$this->getId())
268 {
269 $query = 'DELETE FROM payment_news WHERE news_id = %s';
270 $statement = $ilDB->manipulateF($query, array('integer'),array($this->getId()));
271
272 return true;
273 }
274
275 return false;
276 }

References $ilDB, $query, and getId().

+ Here is the call graph for this function:

◆ getContent()

ilShopNewsItem::getContent ( )

Get Content.

Returns
string Content of news.

Definition at line 88 of file class.ilShopNewsItem.php.

89 {
90 return $this->content;
91 }

References $content.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getCreationDate()

ilShopNewsItem::getCreationDate ( )

Get CreationDate.

Returns
string Date of creation.

Definition at line 109 of file class.ilShopNewsItem.php.

110 {
112 }

References $creation_date.

◆ getId()

ilShopNewsItem::getId ( )

Get Id.

Returns
int

Definition at line 48 of file class.ilShopNewsItem.php.

49 {
50 return $this->id;
51 }

References $id.

Referenced by delete(), read(), and update().

+ Here is the caller graph for this function:

◆ getTitle()

ilShopNewsItem::getTitle ( )

Get Title.

Returns
string Title of news item.

Definition at line 68 of file class.ilShopNewsItem.php.

69 {
70 return $this->title;
71 }

References $title.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getUpdateDate()

ilShopNewsItem::getUpdateDate ( )

Get UpdateDate.

Returns
string Date of last update.

Definition at line 129 of file class.ilShopNewsItem.php.

130 {
131 return $this->update_date;
132 }

References $update_date.

◆ getUserId()

ilShopNewsItem::getUserId ( )

Get UserId.

Returns
int

Definition at line 169 of file class.ilShopNewsItem.php.

170 {
171 return $this->user_id;
172 }

References $user_id.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getVisibility()

ilShopNewsItem::getVisibility ( )

Get Visibility.

Returns
string Access level of news.

Definition at line 149 of file class.ilShopNewsItem.php.

150 {
151 return $this->visibility;
152 }

References $visibility.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ read()

ilShopNewsItem::read ( )
private

Read item from database.

Definition at line 207 of file class.ilShopNewsItem.php.

208 {
209 global $ilDB;
210
211 $result = $ilDB->queryf('SELECT * FROM payment_news WHERE news_id = %s',
212 array('integer'),
213 array($this->getId())
214 );
215
216 while($record = $ilDB->fetchAssoc($result))
217 {
218 $this->setTitle($record['news_title']);
219 $this->setCreationDate($record['creation_date']);
220 $this->setVisibility($record['visibility']);
221 $this->setContent($record['news_content']);
222 $this->setUpdateDate($record['update_date']);
223 $this->setUserId($record['user_id']);
224 break;
225 }
226 }
$result
setCreationDate($a_creation_date)
Set CreationDate.
setTitle($a_title)
Set Title.
setVisibility($a_visibility='users')
Set Visibility.
setUserId($a_user_id)
Set UserId.
setContent($a_content)
Set Content.
setUpdateDate($a_update_date)
Set UpdateDate.

References $ilDB, $result, getId(), setContent(), setCreationDate(), setTitle(), setUpdateDate(), setUserId(), and setVisibility().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContent()

ilShopNewsItem::setContent (   $a_content)

Set Content.

Parameters
string$a_contentContent of news.

Definition at line 78 of file class.ilShopNewsItem.php.

79 {
80 $this->content = $a_content;
81 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCreationDate()

ilShopNewsItem::setCreationDate (   $a_creation_date)

Set CreationDate.

Parameters
string$a_creation_dateDate of creation.

Definition at line 99 of file class.ilShopNewsItem.php.

100 {
101 $this->creation_date = $a_creation_date;
102 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setId()

ilShopNewsItem::setId (   $a_id)

Set Id.

Parameters
int$a_id

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

39 {
40 $this->id = $a_id;
41 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setTitle()

ilShopNewsItem::setTitle (   $a_title)

Set Title.

Parameters
string$a_titleTitle of news item.

Definition at line 58 of file class.ilShopNewsItem.php.

59 {
60 $this->title = $a_title;
61 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUpdateDate()

ilShopNewsItem::setUpdateDate (   $a_update_date)

Set UpdateDate.

Parameters
string$a_update_dateDate of last update.

Definition at line 119 of file class.ilShopNewsItem.php.

120 {
121 $this->update_date = $a_update_date;
122 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUserId()

ilShopNewsItem::setUserId (   $a_user_id)

Set UserId.

Parameters
int$a_user_id

Definition at line 159 of file class.ilShopNewsItem.php.

160 {
161 $this->user_id = $a_user_id;
162 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setVisibility()

ilShopNewsItem::setVisibility (   $a_visibility = 'users')

Set Visibility.

Parameters
string$a_visibilityAccess level of news.

Definition at line 139 of file class.ilShopNewsItem.php.

140 {
141 $this->visibility = $a_visibility;
142 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilShopNewsItem::update ( )

Update item in database.

Definition at line 232 of file class.ilShopNewsItem.php.

233 {
234 global $ilDB;
235
236 $updatedate = new ilDateTime(time(), IL_CAL_UNIX);
237
238 if((int)$this->getId())
239 {
240 $ilDB->update('payment_news',
241 array(
242 'news_title' => array('text', $this->getTitle()),
243 'news_content' => array('clob', $this->getContent()),
244 'visibility' => array('text', $this->getVisibility()),
245 'update_date' => array('timestamp', $updatedate->get(IL_CAL_DATETIME)),
246 'user_id' => array('integer', $this->getUserId())
247 ),
248 array(
249 'news_id' => array('integer', $this->getId())
250 )
251 );
252
253 return true;
254 }
255
256 return false;
257 }

References $ilDB, getContent(), getId(), getTitle(), getUserId(), getVisibility(), IL_CAL_DATETIME, and IL_CAL_UNIX.

+ Here is the call graph for this function:

Field Documentation

◆ $content

ilShopNewsItem::$content = ''
private

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

Referenced by getContent().

◆ $creation_date

ilShopNewsItem::$creation_date = null
private

Definition at line 14 of file class.ilShopNewsItem.php.

Referenced by getCreationDate().

◆ $id

ilShopNewsItem::$id = 0
private

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

Referenced by getId().

◆ $title

ilShopNewsItem::$title = ''
private

Definition at line 12 of file class.ilShopNewsItem.php.

Referenced by getTitle().

◆ $update_date

ilShopNewsItem::$update_date = null
private

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

Referenced by getUpdateDate().

◆ $user_id

ilShopNewsItem::$user_id = 0
private

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

Referenced by getUserId().

◆ $visibility

ilShopNewsItem::$visibility = 'users'
private

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

Referenced by getVisibility().


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