ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups 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 34 of file class.ilShopTopic.php.

Constructor & Destructor Documentation

ilShopTopic::__construct (   $a_id = 0)

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

References $ilDB, and read().

{
global $ilDB;
$this->db = $ilDB;
if($a_id)
{
$this->id = $a_id;
$this->read();
}
}

+ Here is the call graph for this function:

Member Function Documentation

static ilShopTopic::_lookupTitle (   $a_id)
static

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

References $ilDB, $result, and $row.

Referenced by ilShopTopicsGUI\showTopicsList().

{
global $ilDB;
$result = $ilDB->queryf("SELECT pt_topic_title FROM payment_topics WHERE pt_topic_pk = %s",
array('integer'), array($a_id));
while($row = $ilDB->fetchObject($result))
{
return $row->pt_topic_title;
}
return false;
}

+ Here is the caller graph for this function:

ilShopTopic::delete ( )

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

References $result, and getId().

{
if($this->id)
{
$result = $this->db->manipulateF('
DELETE FROM payment_topics
WHERE pt_topic_pk = %s',
array('integer'),
array($this->getId())
);
$result = $this->db->manipulateF('
DELETE FROM payment_topic_usr_sort
WHERE ptus_pt_topic_fk = %s',
array('integer'),
array($this->getId())
);
$result = $this->db->manipulateF('
UPDATE payment_objects
SET pt_topic_fk = %s
WHERE pt_topic_fk = %s',
array('integer', 'integer'),
array(0, $this->getId())
);
return true;
}
return false;
}

+ Here is the call graph for this function:

ilShopTopic::getChangeDate ( )

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

References $changedate.

Referenced by save().

{
}

+ Here is the caller graph for this function:

ilShopTopic::getCreateDate ( )

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

References $createdate.

Referenced by save().

{
}

+ Here is the caller graph for this function:

ilShopTopic::getCustomSorting ( )

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

References $custom_sorting.

Referenced by saveCustomSorting().

{
}

+ Here is the caller graph for this function:

ilShopTopic::getId ( )

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

References $id.

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

{
return $this->id;
}

+ Here is the caller graph for this function:

ilShopTopic::getSorting ( )

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

References $sorting.

Referenced by save().

{
}

+ Here is the caller graph for this function:

ilShopTopic::getTitle ( )

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

References $title.

Referenced by save().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilShopTopic::read ( )
private

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

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

Referenced by __construct().

{
global $ilUser;
if($this->id)
{
$result = $this->db->queryf('
SELECT * FROM payment_topics
LEFT JOIN payment_topic_usr_sort ON ptus_pt_topic_fk = pt_topic_pk
AND ptus_usr_id = %s
WHERE pt_topic_pk = %s',
array('integer', 'integer'),
array($ilUser->getId(), $this->id));
while($row = $this->db->fetchObject($result))
{
$this->setTitle($row->pt_topic_title);
$this->setSorting($row->pt_topic_sort);
$this->setCreateDate($row->pt_topic_created);
$this->setChangeDate($row->pt_topic_changed);
$this->setCustomSorting($row->ptus_sorting);
return true;
}
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShopTopic::save ( )

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

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

{
if($this->id)
{
$this->changedate = time();
$statement = $this->db->manipulateF('
UPDATE payment_topics
SET pt_topic_title = %s,
pt_topic_sort = %s,
pt_topic_changed = %s
WHERE pt_topic_pk = %s',
array('text', 'integer', 'integer', 'integer'),
array(
$this->getTitle(),
$this->getSorting(),
$this->getChangeDate(),
$this->getId()
));
return true;
}
else
{
$this->createdate = time();
$next_id =$this->db->nextId('payment_topics');
$statement = $this->db->manipulateF('
INSERT INTO payment_topics
( pt_topic_pk,
pt_topic_title,
pt_topic_sort,
pt_topic_created
) VALUES (%s, %s, %s, %s)',
array('integer','text', 'integer', 'integer'),
array($next_id, $this->getTitle(), $this->getSorting(), $this->getCreateDate()));
$this->id = $next_id;
if($this->id) return true;
}
return false;
}

+ Here is the call graph for this function:

ilShopTopic::saveCustomSorting ( )

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

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

{
global $ilUser;
if($this->id)
{
$res = $this->db->queryf('
SELECT * FROM payment_topic_usr_sort
WHERE ptus_pt_topic_fk = %s
AND ptus_usr_id = %s',
array('integer', 'integer'),
array($this->getId(), $ilUser->getId())
);
if($res->numRows() > 0)
{
$statement = $this->db->manipulateF('
UPDATE payment_topic_usr_sort
SET ptus_pt_topic_fk = %s,
ptus_usr_id = %s,
ptus_sorting = %s',
array('integer', 'integer', 'integer'),
array($this->getId(), $ilUser->getId(), $this->getCustomSorting())
);
}
else
{
$statement = $this->db->manipulateF('
INSERT INTO payment_topic_usr_sort
( ptus_pt_topic_fk,
ptus_usr_id,
ptus_sorting
) VALUES (%s,%s,%s)',
array('integer', 'integer', 'integer'),
array($this->getId(), $ilUser->getId(), $this->getCustomSorting())
);
}
return true;
}
return false;
}

+ Here is the call graph for this function:

ilShopTopic::setChangeDate (   $a_changedate)

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

Referenced by read().

{
$this->changedate = $a_changedate;
}

+ Here is the caller graph for this function:

ilShopTopic::setCreateDate (   $a_createdate)

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

Referenced by read().

{
$this->createdate = $a_createdate;
}

+ Here is the caller graph for this function:

ilShopTopic::setCustomSorting (   $a_custom_sorting)

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

Referenced by read().

{
$this->custom_sorting = $a_custom_sorting;
}

+ Here is the caller graph for this function:

ilShopTopic::setId (   $a_id)

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

{
$this->id = $a_id;
}
ilShopTopic::setSorting (   $a_sorting)

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

Referenced by read().

{
$this->sorting = $a_sorting;
}

+ Here is the caller graph for this function:

ilShopTopic::setTitle (   $a_title)

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

Referenced by read().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

Field Documentation

ilShopTopic::$changedate = 0
private

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

Referenced by getChangeDate().

ilShopTopic::$createdate = 0
private

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

Referenced by getCreateDate().

ilShopTopic::$custom_sorting = 0
private

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

Referenced by getCustomSorting().

ilShopTopic::$db = null
private

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

ilShopTopic::$id = 0
private

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

Referenced by getId(), and read().

ilShopTopic::$sorting = 0
private

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

Referenced by getSorting().

ilShopTopic::$title = ''
private

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

Referenced by getTitle().


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