ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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

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

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

References read(), and setId().

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilMediaPoolItem::create ( )

Create.

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

133 {
134 global $ilDB;
135
136 $nid = $ilDB->nextId("mep_item");
137 $ilDB->manipulate("INSERT INTO mep_item ".
138 "(obj_id, type, foreign_id, title, import_id) VALUES (".
139 $ilDB->quote($nid, "integer").",".
140 $ilDB->quote($this->getType(), "text").",".
141 $ilDB->quote($this->getForeignId(), "integer").",".
142 $ilDB->quote($this->getTitle(), "text").",".
143 $ilDB->quote($this->getImportId(), "text").
144 ")");
145 $this->setId($nid);
146 }
global $ilDB

References $ilDB, and setId().

+ Here is the call graph for this function:

◆ delete()

ilMediaPoolItem::delete ( )

Delete.

Parameters

return

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

193 {
194 global $ilDB;
195
196 $ilDB->manipulate("DELETE FROM mep_item WHERE "
197 ." obj_id = ".$ilDB->quote($this->getId(), "integer")
198 );
199 }

References $ilDB.

◆ getForeignId()

ilMediaPoolItem::getForeignId ( )

Get foreign id.

Returns
int foreign id

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

85 {
86 return $this->foreign_id;
87 }

◆ getId()

ilMediaPoolItem::getId ( )

Get id.

Returns
int id

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

45 {
46 return $this->id;
47 }

◆ getIdsForType()

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

Get all ids for type.

Parameters

return

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

296 {
297 global $ilDB;
298
299 $set = $ilDB->query("SELECT mep_tree.child as id".
300 " FROM mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) WHERE ".
301 " mep_tree.mep_id = ".$ilDB->quote($a_id, "integer")." AND ".
302 " mep_item.type = ".$ilDB->quote($a_type, "text")
303 );
304
305 $ids = array();
306 while ($rec = $ilDB->fetchAssoc($set))
307 {
308 $ids[] = $rec["id"];
309 }
310 return $ids;
311 }

References $ilDB.

Referenced by ilMediaPoolExporter\getXmlExportTailDependencies().

+ Here is the caller graph for this function:

◆ getImportId()

ilMediaPoolItem::getImportId ( )

Get import id.

Returns
string import id

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

105 {
106 return $this->import_id;
107 }

References $import_id.

◆ getPoolForItemId()

static ilMediaPoolItem::getPoolForItemId (   $a_id)
static

Get media pools for item id.

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

275 {
276 global $ilDB;
277
278 $set = $ilDB->query("SELECT * FROM mep_tree ".
279 " WHERE child = ".$ilDB->quote($a_id, "integer")
280 );
281 $pool_ids = array();
282 while ($rec = $ilDB->fetchAssoc($set))
283 {
284 $pool_ids[] = $rec["mep_id"];
285 }
286 return $pool_ids; // currently this array should contain only one id
287 }

References $ilDB.

Referenced by 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 124 of file class.ilMediaPoolItem.php.

125 {
126 return $this->title;
127 }

◆ getType()

ilMediaPoolItem::getType ( )

Get type.

Returns
string type

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

65 {
66 return $this->type;
67 }

◆ lookup()

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

Lookup.

Parameters

return

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

208 {
209 global $ilDB;
210
211 $set = $ilDB->query("SELECT ".$a_field." FROM mep_item WHERE ".
212 " obj_id = ".$ilDB->quote($a_id, "integer"));
213 if ($rec = $ilDB->fetchAssoc($set))
214 {
215 return $rec[$a_field];
216 }
217 return false;
218 }

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

226 {
227 return self::lookup($a_id, "foreign_id");
228 }
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 245 of file class.ilMediaPoolItem.php.

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

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

236 {
237 return self::lookup($a_id, "type");
238 }

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

152 {
153 global $ilDB;
154
155 $set = $ilDB->query("SELECT * FROM mep_item WHERE ".
156 "obj_id = ".$ilDB->quote($this->getId(), "integer")
157 );
158 if ($rec = $ilDB->fetchAssoc($set))
159 {
160 $this->setType($rec["type"]);
161 $this->setForeignId($rec["foreign_id"]);
162 $this->setTitle($rec["title"]);
163 $this->setImportId($rec["import_id"]);
164 }
165 }
setTitle($a_val)
Set title.
setImportId($a_val)
Set import id.
setType($a_val)
Set type.
setForeignId($a_val)
Set foreign id.

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

75 {
76 $this->foreign_id = $a_val;
77 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setId()

ilMediaPoolItem::setId (   $a_val)

Set id.

Parameters
intid

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

35 {
36 $this->id = $a_val;
37 }

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

95 {
96 $this->import_id = $a_val;
97 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTitle()

ilMediaPoolItem::setTitle (   $a_val)

Set title.

Parameters
stringtitle

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

115 {
116 $this->title = $a_val;
117 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setType()

ilMediaPoolItem::setType (   $a_val)

Set type.

Parameters
stringtype

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

55 {
56 $this->type = $a_val;
57 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilMediaPoolItem::update ( )

Update.

Parameters

return

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

174 {
175 global $ilDB;
176
177 $ilDB->manipulate("UPDATE mep_item SET ".
178 " type = ".$ilDB->quote($this->getType(), "text").",".
179 " foreign_id = ".$ilDB->quote($this->getForeignId(), "integer").",".
180 " title = ".$ilDB->quote($this->getTitle(), "text").",".
181 " import_id = ".$ilDB->quote($this->getImportId(), "text").
182 " WHERE obj_id = ".$ilDB->quote($this->getId(), "integer")
183 );
184 }

References $ilDB.

◆ updateObjectTitle()

static ilMediaPoolItem::updateObjectTitle (   $a_obj)
static

Update object title.

Parameters

return

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

257 {
258 global $ilDB;
259
260 if (ilObject::_lookupType($a_obj) == "mob")
261 {
262 $title = ilObject::_lookupTitle($a_obj);
263 $ilDB->manipulate("UPDATE mep_item SET ".
264 " title = ".$ilDB->quote($title, "text").
265 " WHERE foreign_id = ".$ilDB->quote($a_obj, "integer").
266 " AND type = ".$ilDB->quote("mob", "text")
267 );
268 }
269 }
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:

Field Documentation

◆ $import_id

ilMediaPoolItem::$import_id
protected

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

Referenced by getImportId().


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