ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilRatingCategory Class Reference

Class ilRatingCategory. More...

+ Collaboration diagram for ilRatingCategory:

Public Member Functions

 __construct ($a_id=null)
 Constructor.
 setId ($a_value)
 Set id.
 getId ()
 Get id.
 setParentId ($a_value)
 Set parent id.
 getParentId ()
 Get parent object id.
 setTitle ($a_value)
 Set title.
 getTitle ()
 Get title.
 setDescription ($a_value)
 Set description.
 getDescription ()
 Get description.
 setPosition ($a_value)
 Set position.
 getPosition ()
 Get position.
 update ()
 Update db entry.
 save ()
 Create db entry.

Static Public Member Functions

static delete ($a_id)
 Delete db entry.
static getAllForObject ($a_parent_obj_id)
 Get all categories for object.
static deleteForObject ($a_parent_obj_id)
 Delete all categories for object.

Protected Member Functions

 read ($a_id)
 Load db entry.
 getDBProperties ()
 Parse properties into db definition.

Protected Attributes

 $id
 $parent_id
 $title
 $description
 $pos

Detailed Description

Class ilRatingCategory.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

ilRatingCategory::__construct (   $a_id = null)

Constructor.

Parameters
int$a_id

Definition at line 28 of file class.ilRatingCategory.php.

References read().

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

+ Here is the call graph for this function:

Member Function Documentation

static ilRatingCategory::delete (   $a_id)
static

Delete db entry.

Parameters
int$a_id

Definition at line 221 of file class.ilRatingCategory.php.

Referenced by deleteForObject().

{
global $ilDB;
if((int)$a_id)
{
$sql = "DELETE FROM il_rating".
" WHERE category_id = ".$ilDB->quote($a_id, "integer");
$ilDB->manipulate($sql);
$sql = "DELETE FROM il_rating_cat".
" WHERE id = ".$ilDB->quote($a_id, "integer");
$ilDB->manipulate($sql);
}
}

+ Here is the caller graph for this function:

static ilRatingCategory::deleteForObject (   $a_parent_obj_id)
static

Delete all categories for object.

Parameters
int$a_parent_obj_id

Definition at line 266 of file class.ilRatingCategory.php.

References delete().

{
if((int)$a_parent_obj_id)
{
foreach(self::getAllForObject($a_parent_obj_id) as $item)
{
self::delete($item["id"]);
}
}
}

+ Here is the call graph for this function:

static ilRatingCategory::getAllForObject (   $a_parent_obj_id)
static

Get all categories for object.

Parameters
int$a_parent_obj_id
Returns
array

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

References $row.

Referenced by ilObjWiki\cloneObject(), ilRatingCategoryGUI\delete(), ilRatingCategoryGUI\export(), ilRatingGUI\getBlockHTML(), ilRatingGUI\getHTML(), and ilRatingCategoryTableGUI\getItems().

{
global $ilDB;
$cats = array();
$sql = "SELECT * FROM il_rating_cat".
" WHERE parent_id = ".$ilDB->quote($a_parent_obj_id, "integer").
" ORDER BY pos";
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
$cats[] = $row;
}
return $cats;
}

+ Here is the caller graph for this function:

ilRatingCategory::getDBProperties ( )
protected

Parse properties into db definition.

Returns
array

Definition at line 165 of file class.ilRatingCategory.php.

References getDescription(), getPosition(), and getTitle().

Referenced by save(), and update().

{
// parent id must not change
$fields = array("title" => array("text", $this->getTitle()),
"description" => array("text", $this->getDescription()),
"pos" => array("integer", $this->getPosition()));
return $fields;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRatingCategory::getDescription ( )

Get description.

Returns
string

Definition at line 108 of file class.ilRatingCategory.php.

References $description.

Referenced by getDBProperties().

{
}

+ Here is the caller graph for this function:

ilRatingCategory::getId ( )

Get id.

Returns
int

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

References $id.

Referenced by update().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilRatingCategory::getParentId ( )

Get parent object id.

Returns
int

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

References $parent_id.

Referenced by save().

{
}

+ Here is the caller graph for this function:

ilRatingCategory::getPosition ( )

Get position.

Returns
int

Definition at line 128 of file class.ilRatingCategory.php.

References $pos.

Referenced by getDBProperties().

{
return $this->pos;
}

+ Here is the caller graph for this function:

ilRatingCategory::getTitle ( )

Get title.

Returns
string

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

References $title.

Referenced by getDBProperties().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilRatingCategory::read (   $a_id)
protected

Load db entry.

Parameters
int$a_id

Definition at line 138 of file class.ilRatingCategory.php.

References $row, setDescription(), setId(), setParentId(), setPosition(), and setTitle().

Referenced by __construct().

{
global $ilDB;
$a_id = (int)$a_id;
if($a_id)
{
$sql = "SELECT * FROM il_rating_cat".
" WHERE id = ".$ilDB->quote($a_id, "integer");
$set = $ilDB->query($sql);
$row = $ilDB->fetchAssoc($set);
if($row["id"])
{
$this->setId($row["id"]);
$this->setParentId($row["parent_id"]);
$this->setTitle($row["title"]);
$this->setDescription($row["description"]);
$this->setPosition($row["pos"]);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRatingCategory::save ( )

Create db entry.

Definition at line 194 of file class.ilRatingCategory.php.

References $id, $pos, getDBProperties(), getParentId(), setId(), and setPosition().

{
global $ilDB;
$id = $ilDB->nextId("il_rating_cat");
$this->setId($id);
// append
$sql = "SELECT max(pos) pos FROM il_rating_cat".
" WHERE parent_id = ".$ilDB->quote($this->getParentId(), "integer");
$set = $ilDB->query($sql);
$pos = $ilDB->fetchAssoc($set);
$pos = $pos["pos"];
$this->setPosition($pos+10);
$fields = $this->getDBProperties();
$fields["id"] = array("integer", $id);
$fields["parent_id"] = array("integer", $this->getParentId());
$ilDB->insert("il_rating_cat", $fields);
}

+ Here is the call graph for this function:

ilRatingCategory::setDescription (   $a_value)

Set description.

Parameters
string$a_value

Definition at line 98 of file class.ilRatingCategory.php.

Referenced by read().

{
$this->description = (string)$a_value;
}

+ Here is the caller graph for this function:

ilRatingCategory::setId (   $a_value)

Set id.

Parameters
int$a_value

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

Referenced by read(), and save().

{
$this->id = (int)$a_value;
}

+ Here is the caller graph for this function:

ilRatingCategory::setParentId (   $a_value)

Set parent id.

Parameters
int$a_value

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

Referenced by read().

{
$this->parent_id = (int)$a_value;
}

+ Here is the caller graph for this function:

ilRatingCategory::setPosition (   $a_value)

Set position.

Parameters
int$a_value

Definition at line 118 of file class.ilRatingCategory.php.

Referenced by read(), and save().

{
$this->pos = (int)$a_value;
}

+ Here is the caller graph for this function:

ilRatingCategory::setTitle (   $a_value)

Set title.

Parameters
string$a_value

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

Referenced by read().

{
$this->title = (string)$a_value;
}

+ Here is the caller graph for this function:

ilRatingCategory::update ( )

Update db entry.

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

References getDBProperties(), and getId().

{
global $ilDB;
if($this->getId())
{
$fields = $this->getDBProperties();
$ilDB->update("il_rating_cat", $fields,
array("id" => array("integer", $this->getId())));
}
}

+ Here is the call graph for this function:

Field Documentation

ilRatingCategory::$description
protected

Definition at line 20 of file class.ilRatingCategory.php.

Referenced by getDescription().

ilRatingCategory::$id
protected

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

Referenced by getId(), and save().

ilRatingCategory::$parent_id
protected

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

Referenced by getParentId().

ilRatingCategory::$pos
protected

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

Referenced by getPosition(), and save().

ilRatingCategory::$title
protected

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

Referenced by getTitle().


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