ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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...
 
 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...
 

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 18 of file class.ilMediaPoolItem.php.

19 {
20 if ($a_id > 0)
21 {
22 $this->setId($a_id);
23 $this->read();
24 }
25 }

References read(), and setId().

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilMediaPoolItem::create ( )

Create.

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

111 {
112 global $ilDB;
113
114 $nid = $ilDB->nextId("mep_item");
115 $ilDB->manipulate("INSERT INTO mep_item ".
116 "(obj_id, type, foreign_id, title) VALUES (".
117 $ilDB->quote($nid, "integer").",".
118 $ilDB->quote($this->getType(), "text").",".
119 $ilDB->quote($this->getForeignId(), "integer").",".
120 $ilDB->quote($this->getTitle(), "text").
121 ")");
122 $this->setId($nid);
123 }
global $ilDB

References $ilDB, and setId().

+ Here is the call graph for this function:

◆ delete()

ilMediaPoolItem::delete ( )

Delete.

Parameters

return

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

168 {
169 global $ilDB;
170
171 $ilDB->manipulate("DELETE FROM mep_item WHERE "
172 ." obj_id = ".$ilDB->quote($this->getId(), "integer")
173 );
174 }

References $ilDB.

◆ getForeignId()

ilMediaPoolItem::getForeignId ( )

Get foreign id.

Returns
int foreign id

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

83 {
84 return $this->foreign_id;
85 }

◆ getId()

ilMediaPoolItem::getId ( )

Get id.

Returns
int id

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

43 {
44 return $this->id;
45 }

◆ getIdsForType()

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

Get all ids for type.

Parameters

return

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

271 {
272 global $ilDB;
273
274 $set = $ilDB->query("SELECT mep_tree.child as id".
275 " FROM mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) WHERE ".
276 " mep_tree.mep_id = ".$ilDB->quote($a_id, "integer")." AND ".
277 " mep_item.type = ".$ilDB->quote($a_type, "text")
278 );
279
280 $ids = array();
281 while ($rec = $ilDB->fetchAssoc($set))
282 {
283 $ids[] = $rec["id"];
284 }
285 return $ids;
286 }

References $ilDB.

Referenced by ilMediaPoolExporter\getXmlExportTailDependencies().

+ Here is the caller graph for this function:

◆ getPoolForItemId()

static ilMediaPoolItem::getPoolForItemId (   $a_id)
static

Get media pools for item id.

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

250 {
251 global $ilDB;
252
253 $set = $ilDB->query("SELECT * FROM mep_tree ".
254 " WHERE child = ".$ilDB->quote($a_id, "integer")
255 );
256 $pool_ids = array();
257 while ($rec = $ilDB->fetchAssoc($set))
258 {
259 $pool_ids[] = $rec["mep_id"];
260 }
261 return $pool_ids; // currently this array should contain only one id
262 }

References $ilDB.

Referenced by ilPageEditorGUI\showSnippetInfo().

+ Here is the caller graph for this function:

◆ getTitle()

ilMediaPoolItem::getTitle ( )

Get title.

Returns
string title

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

103 {
104 return $this->title;
105 }

◆ getType()

ilMediaPoolItem::getType ( )

Get type.

Returns
string type

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

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

◆ lookup()

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

Lookup.

Parameters

return

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

183 {
184 global $ilDB;
185
186 $set = $ilDB->query("SELECT ".$a_field." FROM mep_item WHERE ".
187 " obj_id = ".$ilDB->quote($a_id, "integer"));
188 if ($rec = $ilDB->fetchAssoc($set))
189 {
190 return $rec[$a_field];
191 }
192 return false;
193 }

References $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 200 of file class.ilMediaPoolItem.php.

201 {
202 return self::lookup($a_id, "foreign_id");
203 }
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

Lookup title.

Parameters
intmep item id

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

221 {
222 return self::lookup($a_id, "title");
223 }

References lookup().

Referenced by ilObjMediaPoolGUI\allMedia(), ilObjMediaPoolGUI\confirmRemove(), ilObjMediaPool\deleteChild(), ilObjMediaPoolGUI\getFolderValues(), ilObjMediaPoolSubItemListGUI\getHTML(), ilObjMediaPoolGUI\getMediaPoolPageValues(), ilObjMediaPoolGUI\insertFromClipboard(), ilMediaPoolPage\lookupTitle(), and ilMediaPoolPageGUI\showPage().

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

◆ lookupType()

static ilMediaPoolItem::lookupType (   $a_id)
static

Lookup type.

Parameters
intmep item id

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

211 {
212 return self::lookup($a_id, "type");
213 }

References lookup().

Referenced by ilObjMediaPoolGUI\confirmRemove(), ilObjMediaPoolGUI\copyToClipboard(), ilObjMediaPool\deleteChild(), 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 128 of file class.ilMediaPoolItem.php.

129 {
130 global $ilDB;
131
132 $set = $ilDB->query("SELECT * FROM mep_item WHERE ".
133 "obj_id = ".$ilDB->quote($this->getId(), "integer")
134 );
135 if ($rec = $ilDB->fetchAssoc($set))
136 {
137 $this->setType($rec["type"]);
138 $this->setForeignId($rec["foreign_id"]);
139 $this->setTitle($rec["title"]);
140 }
141 }
setTitle($a_val)
Set title.
setType($a_val)
Set type.
setForeignId($a_val)
Set foreign id.

References $ilDB, setForeignId(), 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 72 of file class.ilMediaPoolItem.php.

73 {
74 $this->foreign_id = $a_val;
75 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setId()

ilMediaPoolItem::setId (   $a_val)

Set id.

Parameters
intid

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

33 {
34 $this->id = $a_val;
35 }

Referenced by __construct(), and create().

+ Here is the caller graph for this function:

◆ setTitle()

ilMediaPoolItem::setTitle (   $a_val)

Set title.

Parameters
stringtitle

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

93 {
94 $this->title = $a_val;
95 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setType()

ilMediaPoolItem::setType (   $a_val)

Set type.

Parameters
stringtype

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

53 {
54 $this->type = $a_val;
55 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilMediaPoolItem::update ( )

Update.

Parameters

return

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

150 {
151 global $ilDB;
152
153 $ilDB->manipulate("UPDATE mep_item SET ".
154 " type = ".$ilDB->quote($this->getType(), "text").",".
155 " foreign_id = ".$ilDB->quote($this->getForeignId(), "integer").",".
156 " title = ".$ilDB->quote($this->getTitle(), "text").
157 " WHERE obj_id = ".$ilDB->quote($this->getId(), "integer")
158 );
159 }

References $ilDB.

◆ updateObjectTitle()

static ilMediaPoolItem::updateObjectTitle (   $a_obj)
static

Update object title.

Parameters

return

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

232 {
233 global $ilDB;
234
235 if (ilObject::_lookupType($a_obj) == "mob")
236 {
237 $title = ilObject::_lookupTitle($a_obj);
238 $ilDB->manipulate("UPDATE mep_item SET ".
239 " title = ".$ilDB->quote($title, "text").
240 " WHERE foreign_id = ".$ilDB->quote($a_obj, "integer").
241 " AND type = ".$ilDB->quote("mob", "text")
242 );
243 }
244 }
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type

References $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:

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