37 $this->db = $DIC->database();
48 $this->
id = (int) $a_value;
68 $this->parent_id = (int) $a_value;
88 $this->title = (string) $a_value;
108 $this->description = (string) $a_value;
128 $this->pos = (int) $a_value;
152 $sql =
"SELECT * FROM il_rating_cat" .
153 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
154 $set =
$ilDB->query($sql);
174 $fields = array(
"title" => array(
"text", $this->
getTitle()),
188 if ($this->
getId()) {
194 array(
"id" => array(
"integer", $this->
getId()))
206 $id =
$ilDB->nextId(
"il_rating_cat");
210 $sql =
"SELECT max(pos) pos FROM il_rating_cat" .
212 $set =
$ilDB->query($sql);
218 $fields[
"id"] = array(
"integer",
$id);
219 $fields[
"parent_id"] = array(
"integer", $this->
getParentId());
221 $ilDB->insert(
"il_rating_cat", $fields);
229 public static function delete($a_id)
233 $ilDB = $DIC->database();
236 $sql =
"DELETE FROM il_rating" .
237 " WHERE category_id = " .
$ilDB->quote($a_id,
"integer");
238 $ilDB->manipulate($sql);
240 $sql =
"DELETE FROM il_rating_cat" .
241 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
242 $ilDB->manipulate($sql);
256 $ilDB = $DIC->database();
260 $sql =
"SELECT * FROM il_rating_cat" .
261 " WHERE parent_id = " .
$ilDB->quote($a_parent_obj_id,
"integer") .
263 $set =
$ilDB->query($sql);
278 if ((
int) $a_parent_obj_id) {
279 foreach (self::getAllForObject($a_parent_obj_id) as $item) {
280 self::delete($item[
"id"]);
setPosition($a_value)
Set position.
getParentId()
Get parent object id.
static deleteForObject($a_parent_obj_id)
Delete all categories for object.
getPosition()
Get position.
static getAllForObject($a_parent_obj_id)
Get all categories for object.
getDescription()
Get description.
setParentId($a_value)
Set parent id.
getDBProperties()
Parse properties into db definition.
setTitle($a_value)
Set title.
setDescription($a_value)
Set description.
read($a_id)
Load db entry.
__construct($a_id=null)
Constructor.