ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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.

References read(), and setId().

25  {
26  if((int)$a_id > 0)
27  {
28  $this->setId((int)$a_id);
29  $this->read();
30  }
31  }
read()
Read item from database.
setId($a_id)
Set Id.
+ 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.

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

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_DATETIME
const IL_CAL_UNIX
getUserId()
Get UserId.
getVisibility()
Get Visibility.
Date and time handling
global $ilDB
getContent()
Get Content.
+ Here is the call graph for this function:

◆ delete()

ilShopNewsItem::delete ( )

Delete item from database.

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

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

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  }
global $ilDB
+ 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.

References $content.

Referenced by create(), and update().

89  {
90  return $this->content;
91  }
+ 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.

References $creation_date.

110  {
111  return $this->creation_date;
112  }

◆ getId()

ilShopNewsItem::getId ( )

Get Id.

Returns
int

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

References $id.

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

49  {
50  return $this->id;
51  }
+ 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.

References $title.

Referenced by create(), and update().

69  {
70  return $this->title;
71  }
+ 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.

References $update_date.

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

◆ getUserId()

ilShopNewsItem::getUserId ( )

Get UserId.

Returns
int

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

References $user_id.

Referenced by create(), and update().

170  {
171  return $this->user_id;
172  }
+ 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.

References $visibility.

Referenced by create(), and update().

150  {
151  return $this->visibility;
152  }
+ 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.

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

Referenced by __construct().

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
setUserId($a_user_id)
Set UserId.
setContent($a_content)
Set Content.
setVisibility($a_visibility='users')
Set Visibility.
global $ilDB
setTitle($a_title)
Set Title.
setUpdateDate($a_update_date)
Set UpdateDate.
setCreationDate($a_creation_date)
Set CreationDate.
+ 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.

Referenced by read().

79  {
80  $this->content = $a_content;
81  }
+ 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.

Referenced by read().

100  {
101  $this->creation_date = $a_creation_date;
102  }
+ 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.

Referenced by __construct().

39  {
40  $this->id = $a_id;
41  }
+ 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.

Referenced by read().

59  {
60  $this->title = $a_title;
61  }
+ 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.

Referenced by read().

120  {
121  $this->update_date = $a_update_date;
122  }
+ 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.

Referenced by read().

160  {
161  $this->user_id = $a_user_id;
162  }
+ 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.

Referenced by read().

140  {
141  $this->visibility = $a_visibility;
142  }
+ Here is the caller graph for this function:

◆ update()

ilShopNewsItem::update ( )

Update item in database.

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

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

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  }
const IL_CAL_DATETIME
const IL_CAL_UNIX
getUserId()
Get UserId.
getVisibility()
Get Visibility.
Date and time handling
global $ilDB
getContent()
Get Content.
+ 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: