26 protected \ilDBInterface
$db;
27 protected int $id = 0;
40 $this->db = (is_null($db))
49 public function setId(
int $a_value): void
61 $this->parent_id = $a_value;
69 public function setTitle(
string $a_value): void
71 $this->title = $a_value;
81 $this->description = $a_value;
91 $this->pos = $a_value;
100 protected function read(
int $a_id): void
105 $sql =
"SELECT * FROM il_rating_cat" .
106 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
107 $set =
$ilDB->query($sql);
108 $row =
$ilDB->fetchAssoc($set);
110 $this->
setId($row[
"id"]);
123 $fields = array(
"title" => array(
"text", $this->
getTitle()),
134 if ($this->
getId()) {
140 array(
"id" => array(
"integer", $this->
getId()))
149 $id =
$ilDB->nextId(
"il_rating_cat");
153 $sql =
"SELECT max(pos) pos FROM il_rating_cat" .
155 $set =
$ilDB->query($sql);
156 $pos =
$ilDB->fetchAssoc($set);
161 $fields[
"id"] = array(
"integer", $id);
162 $fields[
"parent_id"] = array(
"integer", $this->
getParentId());
164 $ilDB->insert(
"il_rating_cat", $fields);
167 public static function delete(
int $a_id):
void 171 $ilDB = $DIC->database();
174 $sql =
"DELETE FROM il_rating" .
175 " WHERE category_id = " .
$ilDB->quote($a_id,
"integer");
176 $ilDB->manipulate($sql);
178 $sql =
"DELETE FROM il_rating_cat" .
179 " WHERE id = " .
$ilDB->quote($a_id,
"integer");
180 $ilDB->manipulate($sql);
189 $ilDB = $DIC->database();
193 $sql =
"SELECT * FROM il_rating_cat" .
194 " WHERE parent_id = " .
$ilDB->quote($a_parent_obj_id,
"integer") .
196 $set =
$ilDB->query($sql);
197 while ($row =
$ilDB->fetchAssoc($set)) {
207 if ($a_parent_obj_id) {
208 foreach (self::getAllForObject($a_parent_obj_id) as $item) {
209 self::delete($item[
"id"]);
setDescription(string $a_value)
__construct(?int $a_id=null, ?\ilDBInterface $db=null)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getAllForObject(int $a_parent_obj_id)
setPosition(int $a_value)
static deleteForObject(int $a_parent_obj_id)
setParentId(int $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_value)