ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilMediaPoolItem Class Reference

Media Pool Item. More...

+ Collaboration diagram for ilMediaPoolItem:

Public Member Functions

 __construct ($a_id=0)
 Construtor. More...
 
 setId ($a_val)
 Set id. More...
 
 getId ()
 Get id. More...
 
 setType ($a_val)
 Set type. More...
 
 getType ()
 Get type. More...
 
 setForeignId ($a_val)
 Set foreign id. More...
 
 getForeignId ()
 Get foreign id. More...
 
 setImportId ($a_val)
 Set import id. More...
 
 getImportId ()
 Get import id. More...
 
 setTitle ($a_val)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 create ()
 Create. More...
 
 read ()
 Read. More...
 
 update ()
 Update. More...
 
 delete ()
 Delete. More...
 

Static Public Member Functions

static lookupForeignId ($a_id)
 Lookup Foreign Id. More...
 
static lookupType ($a_id)
 Lookup type. More...
 
static lookupTitle ($a_id)
 Lookup title. More...
 
static updateObjectTitle ($a_obj)
 Update object title. More...
 
static getPoolForItemId ($a_id)
 Get media pools for item id. More...
 
static getIdsForType ($a_id, $a_type)
 Get all ids for type. More...
 

Protected Attributes

 $db
 
 $import_id
 

Static Private Member Functions

static lookup ($a_id, $a_field)
 Lookup. More...
 

Detailed Description

Media Pool Item.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilMediaPoolItem::__construct (   $a_id = 0)

Construtor.

Parameters
intmedia pool item id

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

26 {
27 global $DIC;
28
29 $this->db = $DIC->database();
30 if ($a_id > 0) {
31 $this->setId($a_id);
32 $this->read();
33 }
34 }
$DIC
Definition: xapitoken.php:46

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

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilMediaPoolItem::create ( )

Create.

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

140 {
142
143 $nid = $ilDB->nextId("mep_item");
144 $ilDB->manipulate("INSERT INTO mep_item " .
145 "(obj_id, type, foreign_id, title, import_id) VALUES (" .
146 $ilDB->quote($nid, "integer") . "," .
147 $ilDB->quote($this->getType(), "text") . "," .
148 $ilDB->quote($this->getForeignId(), "integer") . "," .
149 $ilDB->quote($this->getTitle(), "text") . "," .
150 $ilDB->quote($this->getImportId(), "text") .
151 ")");
152 $this->setId($nid);
153 }
global $ilDB

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

+ Here is the call graph for this function:

◆ delete()

ilMediaPoolItem::delete ( )

Delete.

Parameters

return

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

201 {
203
204 $ilDB->manipulate(
205 "DELETE FROM mep_item WHERE "
206 . " obj_id = " . $ilDB->quote($this->getId(), "integer")
207 );
208 }

References $db, and $ilDB.

◆ getForeignId()

ilMediaPoolItem::getForeignId ( )

Get foreign id.

Returns
int foreign id

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

92 {
93 return $this->foreign_id;
94 }

◆ getId()

ilMediaPoolItem::getId ( )

Get id.

Returns
int id

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

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

◆ getIdsForType()

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

Get all ids for type.

Parameters

return

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

310 {
311 global $DIC;
312
313 $ilDB = $DIC->database();
314
315 $set = $ilDB->query(
316 "SELECT mep_tree.child as id" .
317 " FROM mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) WHERE " .
318 " mep_tree.mep_id = " . $ilDB->quote($a_id, "integer") . " AND " .
319 " mep_item.type = " . $ilDB->quote($a_type, "text")
320 );
321
322 $ids = array();
323 while ($rec = $ilDB->fetchAssoc($set)) {
324 $ids[] = $rec["id"];
325 }
326 return $ids;
327 }
$a_type
Definition: workflow.php:92

References $a_type, $DIC, and $ilDB.

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

+ Here is the caller graph for this function:

◆ getImportId()

ilMediaPoolItem::getImportId ( )

Get import id.

Returns
string import id

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

112 {
113 return $this->import_id;
114 }

References $import_id.

◆ getPoolForItemId()

static ilMediaPoolItem::getPoolForItemId (   $a_id)
static

Get media pools for item id.

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

287 {
288 global $DIC;
289
290 $ilDB = $DIC->database();
291
292 $set = $ilDB->query(
293 "SELECT * FROM mep_tree " .
294 " WHERE child = " . $ilDB->quote($a_id, "integer")
295 );
296 $pool_ids = array();
297 while ($rec = $ilDB->fetchAssoc($set)) {
298 $pool_ids[] = $rec["mep_id"];
299 }
300 return $pool_ids; // currently this array should contain only one id
301 }

References $DIC, and $ilDB.

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

+ Here is the caller graph for this function:

◆ getTitle()

ilMediaPoolItem::getTitle ( )

Get title.

Returns
string title

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

132 {
133 return $this->title;
134 }

◆ getType()

ilMediaPoolItem::getType ( )

Get type.

Returns
string type

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

72 {
73 return $this->type;
74 }
$type

References $type.

◆ lookup()

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

Lookup.

Parameters

return

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

217 {
218 global $DIC;
219
220 $ilDB = $DIC->database();
221
222 $set = $ilDB->query("SELECT " . $a_field . " FROM mep_item WHERE " .
223 " obj_id = " . $ilDB->quote($a_id, "integer"));
224 if ($rec = $ilDB->fetchAssoc($set)) {
225 return $rec[$a_field];
226 }
227 return false;
228 }

References $DIC, and $ilDB.

Referenced by lookupForeignId(), lookupTitle(), and lookupType().

+ Here is the caller graph for this function:

◆ lookupForeignId()

static ilMediaPoolItem::lookupForeignId (   $a_id)
static

Lookup Foreign Id.

Parameters
intmep item id

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

236 {
237 return self::lookup($a_id, "foreign_id");
238 }
static lookup($a_id, $a_field)
Lookup.

References lookup().

Referenced by ilObjMediaPoolGUI\copyToClipboard(), ilObjMediaPool\copyTreeContent(), ilPCMediaObjectGUI\create(), ilObjMediaPool\delete(), ilObjMediaPool\deleteChild(), ilObjMediaPoolGUI\executeCommand(), ilObjMediaPoolSubItemListGUI\parseImage(), ilPCMediaObjectGUI\selectObjectReference(), and ilInternalLinkGUI\showLinkHelp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupTitle()

static ilMediaPoolItem::lookupTitle (   $a_id)
static

◆ lookupType()

static ilMediaPoolItem::lookupType (   $a_id)
static

Lookup type.

Parameters
intmep item id

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

246 {
247 return self::lookup($a_id, "type");
248 }

References lookup().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilMediaPoolItem::read ( )

Read.

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

159 {
161
162 $set = $ilDB->query(
163 "SELECT * FROM mep_item WHERE " .
164 "obj_id = " . $ilDB->quote($this->getId(), "integer")
165 );
166 if ($rec = $ilDB->fetchAssoc($set)) {
167 $this->setType($rec["type"]);
168 $this->setForeignId($rec["foreign_id"]);
169 $this->setTitle($rec["title"]);
170 $this->setImportId($rec["import_id"]);
171 }
172 }
setTitle($a_val)
Set title.
setImportId($a_val)
Set import id.
setType($a_val)
Set type.
setForeignId($a_val)
Set foreign id.

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 (   $a_val)

Set foreign id.

Parameters
intforeign id

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

82 {
83 $this->foreign_id = $a_val;
84 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setId()

ilMediaPoolItem::setId (   $a_val)

Set id.

Parameters
intid

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

42 {
43 $this->id = $a_val;
44 }

Referenced by __construct(), and create().

+ Here is the caller graph for this function:

◆ setImportId()

ilMediaPoolItem::setImportId (   $a_val)

Set import id.

Parameters
string$a_valimport id

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

102 {
103 $this->import_id = $a_val;
104 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTitle()

ilMediaPoolItem::setTitle (   $a_val)

Set title.

Parameters
stringtitle

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

122 {
123 $this->title = $a_val;
124 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setType()

ilMediaPoolItem::setType (   $a_val)

Set type.

Parameters
stringtype

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

62 {
63 $this->type = $a_val;
64 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilMediaPoolItem::update ( )

Update.

Parameters

return

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

181 {
183
184 $ilDB->manipulate(
185 "UPDATE mep_item SET " .
186 " type = " . $ilDB->quote($this->getType(), "text") . "," .
187 " foreign_id = " . $ilDB->quote($this->getForeignId(), "integer") . "," .
188 " title = " . $ilDB->quote($this->getTitle(), "text") . "," .
189 " import_id = " . $ilDB->quote($this->getImportId(), "text") .
190 " WHERE obj_id = " . $ilDB->quote($this->getId(), "integer")
191 );
192 }

References $db, and $ilDB.

◆ updateObjectTitle()

static ilMediaPoolItem::updateObjectTitle (   $a_obj)
static

Update object title.

Parameters

return

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

267 {
268 global $DIC;
269
270 $ilDB = $DIC->database();
271
272 if (ilObject::_lookupType($a_obj) == "mob") {
273 $title = ilObject::_lookupTitle($a_obj);
274 $ilDB->manipulate(
275 "UPDATE mep_item SET " .
276 " title = " . $ilDB->quote($title, "text") .
277 " WHERE foreign_id = " . $ilDB->quote($a_obj, "integer") .
278 " AND type = " . $ilDB->quote("mob", "text")
279 );
280 }
281 }
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type

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

ilMediaPoolItem::$db
protected

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

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

◆ $import_id

ilMediaPoolItem::$import_id
protected

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

Referenced by getImportId().


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