28 protected int $id = 0;
40 $this->db = $DIC->database();
47 public function setId(
int $a_val): void
57 public function setType(
string $a_val): void
73 $this->foreign_id = $a_val;
83 $this->import_id = $a_val;
93 $this->title = $a_val;
105 $nid =
$ilDB->nextId(
"mep_item");
106 $ilDB->manipulate(
"INSERT INTO mep_item " .
107 "(obj_id, type, foreign_id, title, import_id) VALUES (" .
108 $ilDB->quote($nid,
"integer") .
"," .
122 "SELECT * FROM mep_item WHERE " .
123 "obj_id = " .
$ilDB->quote($this->getId(),
"integer")
125 if ($rec =
$ilDB->fetchAssoc($set)) {
138 "UPDATE mep_item SET " .
139 " type = " .
$ilDB->quote($this->getType(),
"text") .
"," .
140 " foreign_id = " .
$ilDB->quote($this->getForeignId(),
"integer") .
"," .
141 " title = " .
$ilDB->quote($this->getTitle(),
"text") .
"," .
142 " import_id = " .
$ilDB->quote($this->getImportId(),
"text") .
143 " WHERE obj_id = " .
$ilDB->quote($this->getId(),
"integer")
147 public function delete():
void 152 "DELETE FROM mep_item WHERE " 153 .
" obj_id = " .
$ilDB->quote($this->getId(),
"integer")
163 $ilDB = $DIC->database();
165 $set =
$ilDB->query(
"SELECT " . $a_field .
" FROM mep_item WHERE " .
166 " obj_id = " .
$ilDB->quote($a_id,
"integer"));
167 if ($rec =
$ilDB->fetchAssoc($set)) {
168 return $rec[$a_field];
175 return (
int) self::lookup($a_id,
"foreign_id");
180 return (
string) self::lookup($a_id,
"type");
185 return (
string) self::lookup($a_id,
"title");
193 $ilDB = $DIC->database();
198 "UPDATE mep_item SET " .
199 " title = " .
$ilDB->quote($title,
"text") .
200 " WHERE foreign_id = " .
$ilDB->quote($a_obj,
"integer") .
201 " AND type = " .
$ilDB->quote(
"mob",
"text")
213 $ilDB = $DIC->database();
216 "SELECT * FROM mep_tree " .
217 " WHERE child = " .
$ilDB->quote($a_id,
"integer")
220 while ($rec =
$ilDB->fetchAssoc($set)) {
221 $pool_ids[] = (
int) $rec[
"mep_id"];
238 $ilDB = $DIC->database();
241 "SELECT mep_tree.child as id" .
242 " FROM mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) WHERE " .
243 " mep_tree.mep_id = " .
$ilDB->quote($a_id,
"integer") .
" AND " .
244 " mep_item.type = " .
$ilDB->quote($a_type,
"text")
248 while ($rec =
$ilDB->fetchAssoc($set)) {
249 $ids[] = (
int) $rec[
"id"];
static _lookupTitle(int $obj_id)
static _lookupType(int $id, bool $reference=false)