ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMediaPoolItem Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilMediaPoolItem:

Public Member Functions

 __construct (int $a_id=0)
 
 setId (int $a_val)
 
 getId ()
 
 setType (string $a_val)
 
 getType ()
 
 setForeignId (int $a_val)
 Set foreign id (mob id) More...
 
 getForeignId ()
 
 setImportId (string $a_val)
 
 getImportId ()
 
 setTitle (string $a_val)
 
 getTitle ()
 
 create ()
 
 read ()
 
 update ()
 
 delete ()
 

Static Public Member Functions

static lookupForeignId (int $a_id)
 
static lookupType (int $a_id)
 
static lookupTitle (int $a_id)
 
static updateObjectTitle (int $a_obj)
 
static getPoolForItemId (int $a_id)
 
static getIdsForType (int $a_id, string $a_type)
 Get all ids for type. More...
 

Protected Attributes

string $title = ""
 
int $foreign_id = 0
 
string $type = ""
 
int $id = 0
 
ilDBInterface $db
 
string $import_id = ""
 

Static Private Member Functions

static lookup (int $a_id, string $a_field)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Media Pool Item

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 23 of file class.ilMediaPoolItem.php.

Constructor & Destructor Documentation

◆ __construct()

ilMediaPoolItem::__construct ( int  $a_id = 0)
Parameters
int$a_idmedia pool item id

Definition at line 35 of file class.ilMediaPoolItem.php.

References $DIC, read(), and setId().

37  {
38  global $DIC;
39 
40  $this->db = $DIC->database();
41  if ($a_id > 0) {
42  $this->setId($a_id);
43  $this->read();
44  }
45  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilMediaPoolItem::create ( )

Definition at line 101 of file class.ilMediaPoolItem.php.

References $db, $ilDB, getForeignId(), getImportId(), getTitle(), getType(), and setId().

101  : void
102  {
103  $ilDB = $this->db;
104 
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") . "," .
109  $ilDB->quote($this->getType(), "text") . "," .
110  $ilDB->quote($this->getForeignId(), "integer") . "," .
111  $ilDB->quote($this->getTitle(), "text") . "," .
112  $ilDB->quote($this->getImportId(), "text") .
113  ")");
114  $this->setId($nid);
115  }
+ Here is the call graph for this function:

◆ delete()

ilMediaPoolItem::delete ( )

Definition at line 147 of file class.ilMediaPoolItem.php.

References $db, and $ilDB.

147  : void
148  {
149  $ilDB = $this->db;
150 
151  $ilDB->manipulate(
152  "DELETE FROM mep_item WHERE "
153  . " obj_id = " . $ilDB->quote($this->getId(), "integer")
154  );
155  }

◆ getForeignId()

ilMediaPoolItem::getForeignId ( )

Definition at line 76 of file class.ilMediaPoolItem.php.

References $foreign_id.

Referenced by create().

76  : int
77  {
78  return $this->foreign_id;
79  }
+ Here is the caller graph for this function:

◆ getId()

ilMediaPoolItem::getId ( )

Definition at line 52 of file class.ilMediaPoolItem.php.

References $id.

52  : int
53  {
54  return $this->id;
55  }

◆ getIdsForType()

static ilMediaPoolItem::getIdsForType ( int  $a_id,
string  $a_type 
)
static

Get all ids for type.

Parameters
int$a_idmedia pool id
string$a_typemedia item type
Returns
int[]

Definition at line 232 of file class.ilMediaPoolItem.php.

References $DIC, $ilDB, and ILIAS\Repository\int().

Referenced by ilMepMultiSrt\getMobIds(), and ilMediaPoolExporter\getXmlExportTailDependencies().

235  : array {
236  global $DIC;
237 
238  $ilDB = $DIC->database();
239 
240  $set = $ilDB->query(
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")
245  );
246 
247  $ids = array();
248  while ($rec = $ilDB->fetchAssoc($set)) {
249  $ids[] = (int) $rec["id"];
250  }
251  return $ids;
252  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImportId()

ilMediaPoolItem::getImportId ( )

Definition at line 86 of file class.ilMediaPoolItem.php.

References $import_id.

Referenced by create().

86  : string
87  {
88  return $this->import_id;
89  }
+ Here is the caller graph for this function:

◆ getPoolForItemId()

static ilMediaPoolItem::getPoolForItemId ( int  $a_id)
static
Returns
int[]

Definition at line 209 of file class.ilMediaPoolItem.php.

References $DIC, $ilDB, and ILIAS\Repository\int().

Referenced by ilMediaObjectUsagesTableGUI\fillRow(), ilMediaPoolImporter\finalProcessing(), ilMediaPoolDataSet\importRecord(), ilObjMediaPoolGUI\move(), and ilPageEditorGUI\showSnippetInfo().

209  : array
210  {
211  global $DIC;
212 
213  $ilDB = $DIC->database();
214 
215  $set = $ilDB->query(
216  "SELECT * FROM mep_tree " .
217  " WHERE child = " . $ilDB->quote($a_id, "integer")
218  );
219  $pool_ids = array();
220  while ($rec = $ilDB->fetchAssoc($set)) {
221  $pool_ids[] = (int) $rec["mep_id"];
222  }
223  return $pool_ids;
224  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilMediaPoolItem::getTitle ( )

Definition at line 96 of file class.ilMediaPoolItem.php.

References $title.

Referenced by create().

96  : string
97  {
98  return $this->title;
99  }
+ Here is the caller graph for this function:

◆ getType()

ilMediaPoolItem::getType ( )

Definition at line 62 of file class.ilMediaPoolItem.php.

References $type.

Referenced by create().

62  : string
63  {
64  return $this->type;
65  }
+ Here is the caller graph for this function:

◆ lookup()

static ilMediaPoolItem::lookup ( int  $a_id,
string  $a_field 
)
staticprivate

Definition at line 157 of file class.ilMediaPoolItem.php.

References $DIC, and $ilDB.

160  : ?string {
161  global $DIC;
162 
163  $ilDB = $DIC->database();
164 
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];
169  }
170  return null;
171  }
global $DIC
Definition: feed.php:28

◆ lookupForeignId()

static ilMediaPoolItem::lookupForeignId ( int  $a_id)
static

◆ lookupTitle()

◆ lookupType()

static ilMediaPoolItem::lookupType ( int  $a_id)
static

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

Referenced by ilObjMediaPoolGUI\confirmRemove(), ilObjMediaPoolGUI\copyToClipboard(), ilObjMediaPoolSubItemListGUI\getHTML(), ilObjMediaPoolGUI\move(), and ilObjMediaPoolGUI\returnFromItem().

178  : string
179  {
180  return (string) self::lookup($a_id, "type");
181  }
+ Here is the caller graph for this function:

◆ read()

ilMediaPoolItem::read ( )

Definition at line 117 of file class.ilMediaPoolItem.php.

References $db, $ilDB, setForeignId(), setImportId(), setTitle(), and setType().

Referenced by __construct().

117  : void
118  {
119  $ilDB = $this->db;
120 
121  $set = $ilDB->query(
122  "SELECT * FROM mep_item WHERE " .
123  "obj_id = " . $ilDB->quote($this->getId(), "integer")
124  );
125  if ($rec = $ilDB->fetchAssoc($set)) {
126  $this->setType($rec["type"]);
127  $this->setForeignId((int) $rec["foreign_id"]);
128  $this->setTitle($rec["title"]);
129  $this->setImportId((string) $rec["import_id"]);
130  }
131  }
setTitle(string $a_val)
setImportId(string $a_val)
setType(string $a_val)
setForeignId(int $a_val)
Set foreign id (mob id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setForeignId()

ilMediaPoolItem::setForeignId ( int  $a_val)

Set foreign id (mob id)

Parameters
int$a_valforeign id

Definition at line 71 of file class.ilMediaPoolItem.php.

Referenced by read().

71  : void
72  {
73  $this->foreign_id = $a_val;
74  }
+ Here is the caller graph for this function:

◆ setId()

ilMediaPoolItem::setId ( int  $a_val)

Definition at line 47 of file class.ilMediaPoolItem.php.

Referenced by __construct(), and create().

47  : void
48  {
49  $this->id = $a_val;
50  }
+ Here is the caller graph for this function:

◆ setImportId()

ilMediaPoolItem::setImportId ( string  $a_val)

Definition at line 81 of file class.ilMediaPoolItem.php.

Referenced by read().

81  : void
82  {
83  $this->import_id = $a_val;
84  }
+ Here is the caller graph for this function:

◆ setTitle()

ilMediaPoolItem::setTitle ( string  $a_val)

Definition at line 91 of file class.ilMediaPoolItem.php.

Referenced by read(), and ilMediaPoolPageGUI\updateMediaPoolPage().

91  : void
92  {
93  $this->title = $a_val;
94  }
+ Here is the caller graph for this function:

◆ setType()

ilMediaPoolItem::setType ( string  $a_val)

Definition at line 57 of file class.ilMediaPoolItem.php.

Referenced by read().

57  : void
58  {
59  $this->type = $a_val;
60  }
+ Here is the caller graph for this function:

◆ update()

ilMediaPoolItem::update ( )

Definition at line 133 of file class.ilMediaPoolItem.php.

References $db, and $ilDB.

133  : void
134  {
135  $ilDB = $this->db;
136 
137  $ilDB->manipulate(
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")
144  );
145  }

◆ updateObjectTitle()

static ilMediaPoolItem::updateObjectTitle ( int  $a_obj)
static

Definition at line 189 of file class.ilMediaPoolItem.php.

References $DIC, $ilDB, ilObject\_lookupTitle(), and ilObject\_lookupType().

Referenced by ilMediaPoolAppEventListener\handleEvent().

189  : void
190  {
191  global $DIC;
192 
193  $ilDB = $DIC->database();
194 
195  if (ilObject::_lookupType($a_obj) === "mob") {
196  $title = ilObject::_lookupTitle($a_obj);
197  $ilDB->manipulate(
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")
202  );
203  }
204  }
global $DIC
Definition: feed.php:28
static _lookupTitle(int $obj_id)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilMediaPoolItem::$db
protected

Definition at line 29 of file class.ilMediaPoolItem.php.

Referenced by create(), delete(), read(), and update().

◆ $foreign_id

int ilMediaPoolItem::$foreign_id = 0
protected

Definition at line 26 of file class.ilMediaPoolItem.php.

Referenced by getForeignId().

◆ $id

int ilMediaPoolItem::$id = 0
protected

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

Referenced by getId().

◆ $import_id

string ilMediaPoolItem::$import_id = ""
protected

Definition at line 30 of file class.ilMediaPoolItem.php.

Referenced by getImportId().

◆ $title

string ilMediaPoolItem::$title = ""
protected

Definition at line 25 of file class.ilMediaPoolItem.php.

Referenced by getTitle().

◆ $type

string ilMediaPoolItem::$type = ""
protected

Definition at line 27 of file class.ilMediaPoolItem.php.

Referenced by getType().


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