ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilShopNewsItem Class Reference
+ Collaboration diagram for ilShopNewsItem:

Public Member Functions

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

Private Member Functions

 read ()
 Read item from database.

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

ilShopNewsItem::__construct (   $a_id = 0)

Constructor.

Parameters
int$a_id

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

References read(), and setId().

{
if((int)$a_id > 0)
{
$this->setId((int)$a_id);
$this->read();
}
}

+ Here is the call graph for this function:

Member Function Documentation

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.

{
global $ilDB;
$createdate = new ilDateTime(time(), IL_CAL_UNIX);
$next_id = $ilDB->nextId('payment_news');
if((int)$next_id)
{
$ilDB->insert('payment_news', array(
'news_id' => array('integer', $next_id),
'news_title' => array('text', $this->getTitle()),
'news_content' => array('clob', $this->getContent()),
'visibility' => array('text', $this->getVisibility()),
'creation_date' => array('timestamp', $createdate->get(IL_CAL_DATETIME)),
'update_date' => array('timestamp', $createdate->get(IL_CAL_DATETIME)),
'user_id' => array('integer', $this->getUserId())
));
$this->id = $next_id;
return true;
}
return false;
}

+ Here is the call graph for this function:

ilShopNewsItem::delete ( )

Delete item from database.

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

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

{
global $ilDB;
if((int)$this->getId())
{
$query = 'DELETE FROM payment_news WHERE news_id = %s';
$statement = $ilDB->manipulateF($query, array('integer'),array($this->getId()));
return true;
}
return false;
}

+ Here is the call graph for this function:

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().

{
}

+ Here is the caller graph for this function:

ilShopNewsItem::getCreationDate ( )

Get CreationDate.

Returns
string Date of creation.

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

References $creation_date.

{
}
ilShopNewsItem::getId ( )

Get Id.

Returns
int

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

References $id.

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

{
return $this->id;
}

+ Here is the caller graph for this function:

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().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilShopNewsItem::getUpdateDate ( )

Get UpdateDate.

Returns
string Date of last update.

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

References $update_date.

{
}
ilShopNewsItem::getUserId ( )

Get UserId.

Returns
int

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

References $user_id.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

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().

{
}

+ Here is the caller graph for this function:

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().

{
global $ilDB;
$result = $ilDB->queryf('SELECT * FROM payment_news WHERE news_id = %s',
array('integer'),
array($this->getId())
);
while($record = $ilDB->fetchAssoc($result))
{
$this->setTitle($record['news_title']);
$this->setCreationDate($record['creation_date']);
$this->setVisibility($record['visibility']);
$this->setContent($record['news_content']);
$this->setUpdateDate($record['update_date']);
$this->setUserId($record['user_id']);
break;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShopNewsItem::setContent (   $a_content)

Set Content.

Parameters
string$a_contentContent of news.

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

Referenced by read().

{
$this->content = $a_content;
}

+ Here is the caller graph for this function:

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().

{
$this->creation_date = $a_creation_date;
}

+ Here is the caller graph for this function:

ilShopNewsItem::setId (   $a_id)

Set Id.

Parameters
int$a_id

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

Referenced by __construct().

{
$this->id = $a_id;
}

+ Here is the caller graph for this function:

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().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

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().

{
$this->update_date = $a_update_date;
}

+ Here is the caller graph for this function:

ilShopNewsItem::setUserId (   $a_user_id)

Set UserId.

Parameters
int$a_user_id

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

Referenced by read().

{
$this->user_id = $a_user_id;
}

+ Here is the caller graph for this function:

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().

{
$this->visibility = $a_visibility;
}

+ Here is the caller graph for this function:

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.

{
global $ilDB;
$updatedate = new ilDateTime(time(), IL_CAL_UNIX);
if((int)$this->getId())
{
$ilDB->update('payment_news',
array(
'news_title' => array('text', $this->getTitle()),
'news_content' => array('clob', $this->getContent()),
'visibility' => array('text', $this->getVisibility()),
'update_date' => array('timestamp', $updatedate->get(IL_CAL_DATETIME)),
'user_id' => array('integer', $this->getUserId())
),
array(
'news_id' => array('integer', $this->getId())
)
);
return true;
}
return false;
}

+ Here is the call graph for this function:

Field Documentation

ilShopNewsItem::$content = ''
private

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

Referenced by getContent().

ilShopNewsItem::$creation_date = null
private

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

Referenced by getCreationDate().

ilShopNewsItem::$id = 0
private

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

Referenced by getId().

ilShopNewsItem::$title = ''
private

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

Referenced by getTitle().

ilShopNewsItem::$update_date = null
private

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

Referenced by getUpdateDate().

ilShopNewsItem::$user_id = 0
private

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

Referenced by getUserId().

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: