ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

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: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilMediaPoolItem::create ( )

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

101 : void
102 {
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 }

References $db, $ilDB, and setId().

+ Here is the call graph for this function:

◆ delete()

ilMediaPoolItem::delete ( )

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

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

References $db, and $ilDB.

◆ getForeignId()

ilMediaPoolItem::getForeignId ( )

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

76 : int
77 {
78 return $this->foreign_id;
79 }

References $foreign_id.

◆ getId()

ilMediaPoolItem::getId ( )

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

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

References $id.

◆ 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.

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 }

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

+ Here is the caller graph for this function:

◆ getImportId()

ilMediaPoolItem::getImportId ( )

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

86 : string
87 {
88 return $this->import_id;
89 }

References $import_id.

◆ getPoolForItemId()

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

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

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 }

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

Referenced by ILIAS\MediaPool\MediaPoolManager\copyItemFromEditClipboard(), ilMediaObjectUsagesTableGUI\fillRow(), ilMediaPoolImporter\finalProcessing(), ilMediaPoolDataSet\importRecord(), ILIAS\MediaPool\MediaPoolManager\isTargetWithinSource(), ILIAS\MediaPool\MediaPoolManager\pasteFromClipboard(), and ilPageEditorGUI\showSnippetInfo().

+ 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.

96 : string
97 {
98 return $this->title;
99 }

References $title.

◆ getType()

ilMediaPoolItem::getType ( )

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

62 : string
63 {
64 return $this->type;
65 }

References $type.

◆ lookup()

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

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

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 }

◆ lookupForeignId()

static ilMediaPoolItem::lookupForeignId ( int  $a_id)
static

◆ lookupTitle()

static ilMediaPoolItem::lookupTitle ( int  $a_id)
static

◆ lookupType()

static ilMediaPoolItem::lookupType ( int  $a_id)
static

◆ read()

ilMediaPoolItem::read ( )

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

117 : void
118 {
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 }
setImportId(string $a_val)
setTitle(string $a_val)
setForeignId(int $a_val)
Set foreign id (mob id)
setType(string $a_val)

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

Referenced by __construct().

+ 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.

71 : void
72 {
73 $this->foreign_id = $a_val;
74 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setId()

ilMediaPoolItem::setId ( int  $a_val)

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

47 : void
48 {
49 $this->id = $a_val;
50 }

Referenced by __construct(), and create().

+ Here is the caller graph for this function:

◆ setImportId()

ilMediaPoolItem::setImportId ( string  $a_val)

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

81 : void
82 {
83 $this->import_id = $a_val;
84 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTitle()

ilMediaPoolItem::setTitle ( string  $a_val)

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

91 : void
92 {
93 $this->title = $a_val;
94 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setType()

ilMediaPoolItem::setType ( string  $a_val)

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

57 : void
58 {
59 $this->type = $a_val;
60 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilMediaPoolItem::update ( )

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

133 : void
134 {
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 }

References $db, and $ilDB.

◆ updateObjectTitle()

static ilMediaPoolItem::updateObjectTitle ( int  $a_obj)
static

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

189 : void
190 {
191 global $DIC;
192
193 $ilDB = $DIC->database();
194
195 if (ilObject::_lookupType($a_obj) === "mob") {
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 }
static _lookupType(int $id, bool $reference=false)
static _lookupTitle(int $obj_id)

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

Referenced by ilMediaPoolAppEventListener\handleEvent().

+ 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: