ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilShopNewsItemList Class Reference
+ Inheritance diagram for ilShopNewsItemList:
+ Collaboration diagram for ilShopNewsItemList:

Public Member Functions

 hasItems ()
 rewind ()
 valid ()
 current ()
 key ()
 next ()
 _getInstance ()
 read ()
 reload ()
 setArchiveDate ($a_archive_date)
 getArchiveDate ()
 setPublicSection ($a_public_section)
 isPublicSection ()
 setMode ($a_mode)
 getMode ()

Data Fields

const TYPE_NEWS = 1
const TYPE_ARCHIVE = 2

Private Member Functions

 __construct ()
 __clone ()

Private Attributes

 $news = array()
 $mode = self::TYPE_NEWS
 $archive_date = null
 $public_section = false

Static Private Attributes

static $instance = null

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.ilShopNewsItemList.php.

Constructor & Destructor Documentation

ilShopNewsItemList::__construct ( )
private

Definition at line 21 of file class.ilShopNewsItemList.php.

{
}

Member Function Documentation

ilShopNewsItemList::__clone ( )
private

Definition at line 25 of file class.ilShopNewsItemList.php.

{
}
ilShopNewsItemList::_getInstance ( )

Definition at line 59 of file class.ilShopNewsItemList.php.

References $instance.

Referenced by ilShopNewsGUI\showArchive(), and ilShopNewsGUI\showNews().

{
if(!isset(self::$instance))
{
self::$instance = new ilShopNewsItemList();
}
}

+ Here is the caller graph for this function:

ilShopNewsItemList::current ( )

Definition at line 44 of file class.ilShopNewsItemList.php.

Referenced by valid().

{
return current($this->news);
}

+ Here is the caller graph for this function:

ilShopNewsItemList::getArchiveDate ( )

Definition at line 136 of file class.ilShopNewsItemList.php.

References $archive_date.

Referenced by read().

{
}

+ Here is the caller graph for this function:

ilShopNewsItemList::getMode ( )

Definition at line 156 of file class.ilShopNewsItemList.php.

References $mode.

Referenced by read().

{
return $this->mode;
}

+ Here is the caller graph for this function:

ilShopNewsItemList::hasItems ( )

Definition at line 29 of file class.ilShopNewsItemList.php.

{
return (bool)count($this->news);
}
ilShopNewsItemList::isPublicSection ( )

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

References $public_section.

Referenced by read().

{
}

+ Here is the caller graph for this function:

ilShopNewsItemList::key ( )

Definition at line 49 of file class.ilShopNewsItemList.php.

{
return key($this->news);
}
ilShopNewsItemList::next ( )

Definition at line 54 of file class.ilShopNewsItemList.php.

{
return next($this->news);
}
ilShopNewsItemList::read ( )

Definition at line 69 of file class.ilShopNewsItemList.php.

References $data, $query, $result, getArchiveDate(), getMode(), and isPublicSection().

Referenced by reload().

{
global $ilDB;
$this->news = array();
$types = array();
$data = array();
$query = 'SELECT * FROM payment_news WHERE 1 = 1 ';
if($this->isPublicSection())
{
$query .= "AND visibility = %s ";
$types[] = 'text';
$data[] = 'public';
}
if($this->getArchiveDate() !== null && $this->getArchiveDate() > 0)
{
switch($this->getMode())
{
case self::TYPE_NEWS:
$query .= "AND creation_date >= %s ";
$types[] = 'timestamp';
$data[] = date('Y-m-d H:i:s', $this->getArchiveDate());
break;
case self::TYPE_ARCHIVE:
$query .= "AND creation_date < %s ";
$types[] = 'timestamp';
$data[] = date('Y-m-d H:i:s', $this->getArchiveDate());
break;
}
}
$query .= 'ORDER BY update_date DESC ';
$result = $ilDB->queryF($query, $types, $data);
while($record = $ilDB->fetchAssoc($result))
{
$oNewsItem = new ilShopNewsItem();
$oNewsItem->setId($record['news_id']);
$oNewsItem->setCreationDate($record['creation_date']);
$oNewsItem->setUpdateDate($record['update_date']);
$oNewsItem->setTitle($record['news_title']);
$oNewsItem->setContent($record['news_content']);
$oNewsItem->setVisibility($record['visibility']);
$oNewsItem->setUserId($record['user_id']);
$this->news[] = $oNewsItem;
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShopNewsItemList::reload ( )

Definition at line 123 of file class.ilShopNewsItemList.php.

References read().

{
$this->read();
return $this;
}

+ Here is the call graph for this function:

ilShopNewsItemList::rewind ( )

Definition at line 34 of file class.ilShopNewsItemList.php.

{
return reset($this->news);
}
ilShopNewsItemList::setArchiveDate (   $a_archive_date)

Definition at line 130 of file class.ilShopNewsItemList.php.

{
$this->archive_date = $a_archive_date;
return $this;
}
ilShopNewsItemList::setMode (   $a_mode)

Definition at line 150 of file class.ilShopNewsItemList.php.

{
$this->mode = $a_mode;
return $this;
}
ilShopNewsItemList::setPublicSection (   $a_public_section)

Definition at line 140 of file class.ilShopNewsItemList.php.

{
$this->public_section = $a_public_section;
return $this;
}
ilShopNewsItemList::valid ( )

Definition at line 39 of file class.ilShopNewsItemList.php.

References current().

{
return (bool)current($this->news);
}

+ Here is the call graph for this function:

Field Documentation

ilShopNewsItemList::$archive_date = null
private

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

Referenced by getArchiveDate().

ilShopNewsItemList::$instance = null
staticprivate

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

Referenced by _getInstance().

ilShopNewsItemList::$mode = self::TYPE_NEWS
private

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

Referenced by getMode().

ilShopNewsItemList::$news = array()
private

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

ilShopNewsItemList::$public_section = false
private

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

Referenced by isPublicSection().

const ilShopNewsItemList::TYPE_ARCHIVE = 2

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

Referenced by ilShopNewsGUI\showArchive().

const ilShopNewsItemList::TYPE_NEWS = 1

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

Referenced by ilShopNewsGUI\showNews().


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