ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

References read(), and setId().

21  {
22  if ($a_id > 0)
23  {
24  $this->setId($a_id);
25  $this->read();
26  }
27  }
setId($a_val)
Set id.
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilMediaPoolItem::create ( )

Create.

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

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

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  }
setId($a_val)
Set id.
getImportId()
Get import id.
global $ilDB
getForeignId()
Get foreign id.
+ Here is the call graph for this function:

◆ delete()

ilMediaPoolItem::delete ( )

Delete.

Parameters

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

References $ilDB.

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

◆ getForeignId()

ilMediaPoolItem::getForeignId ( )

Get foreign id.

Returns
int foreign id

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

Referenced by create().

85  {
86  return $this->foreign_id;
87  }
+ Here is the caller graph for this function:

◆ 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

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

References $a_type, $ilDB, and array.

Referenced by ilMediaPoolExporter\getXmlExportTailDependencies().

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  }
$a_type
Definition: workflow.php:93
Create styles array
The data for the language used.
global $ilDB
+ 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.

References $import_id.

Referenced by create().

105  {
106  return $this->import_id;
107  }
+ Here is the caller graph for this function:

◆ getPoolForItemId()

static ilMediaPoolItem::getPoolForItemId (   $a_id)
static

Get media pools for item id.

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

References $ilDB, and array.

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

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  }
Create styles array
The data for the language used.
global $ilDB
+ 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.

References $title.

Referenced by create().

125  {
126  return $this->title;
127  }
+ Here is the caller graph for this function:

◆ getType()

ilMediaPoolItem::getType ( )

Get type.

Returns
string type

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

Referenced by create().

65  {
66  return $this->type;
67  }
+ Here is the caller graph for this function:

◆ lookup()

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

Lookup.

Parameters

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

References $ilDB.

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  }
global $ilDB

◆ lookupForeignId()

static ilMediaPoolItem::lookupForeignId (   $a_id)
static

Lookup Foreign Id.

Parameters
intmep item id

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

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

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

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

236  {
237  return self::lookup($a_id, "type");
238  }
+ Here is the caller graph for this function:

◆ read()

ilMediaPoolItem::read ( )

Read.

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

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

Referenced by __construct().

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  }
setImportId($a_val)
Set import id.
setType($a_val)
Set type.
setForeignId($a_val)
Set foreign id.
global $ilDB
setTitle($a_val)
Set title.
+ 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.

Referenced by read().

75  {
76  $this->foreign_id = $a_val;
77  }
+ 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.

Referenced by __construct(), and create().

35  {
36  $this->id = $a_val;
37  }
+ 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.

Referenced by read().

95  {
96  $this->import_id = $a_val;
97  }
+ 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.

Referenced by read().

115  {
116  $this->title = $a_val;
117  }
+ 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.

Referenced by read().

55  {
56  $this->type = $a_val;
57  }
+ Here is the caller graph for this function:

◆ update()

ilMediaPoolItem::update ( )

Update.

Parameters

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

References $ilDB.

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  }
global $ilDB

◆ updateObjectTitle()

static ilMediaPoolItem::updateObjectTitle (   $a_obj)
static

Update object title.

Parameters

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

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

Referenced by ilMediaPoolAppEventListener\handleEvent().

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
global $ilDB
+ 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: