ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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.

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

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  }
setId($a_val)
Set id.
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilMediaPoolItem::create ( )

Create.

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

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

140  {
141  $ilDB = $this->db;
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  }
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 200 of file class.ilMediaPoolItem.php.

References $db, and $ilDB.

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

◆ getForeignId()

ilMediaPoolItem::getForeignId ( )

Get foreign id.

Returns
int foreign id

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

Referenced by create().

92  {
93  return $this->foreign_id;
94  }
+ Here is the caller graph for this function:

◆ getId()

ilMediaPoolItem::getId ( )

Get id.

Returns
int id

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

References $id.

52  {
53  return $this->id;
54  }
if(!array_key_exists('StateId', $_REQUEST)) $id

◆ getIdsForType()

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

Get all ids for type.

Parameters

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

References $a_type, $DIC, and $ilDB.

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

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  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
global $ilDB
+ 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.

References $import_id.

Referenced by create().

112  {
113  return $this->import_id;
114  }
+ Here is the caller graph for this function:

◆ getPoolForItemId()

static ilMediaPoolItem::getPoolForItemId (   $a_id)
static

Get media pools for item id.

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

References $DIC, and $ilDB.

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

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  }
global $DIC
Definition: saml.php:7
global $ilDB
+ 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.

References $title.

Referenced by create().

132  {
133  return $this->title;
134  }
+ Here is the caller graph for this function:

◆ getType()

ilMediaPoolItem::getType ( )

Get type.

Returns
string type

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

References $type.

Referenced by create().

72  {
73  return $this->type;
74  }
$type
+ Here is the caller graph for this function:

◆ lookup()

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

Lookup.

Parameters

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

References $DIC, and $ilDB.

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  }
global $DIC
Definition: saml.php:7
global $ilDB

◆ lookupForeignId()

static ilMediaPoolItem::lookupForeignId (   $a_id)
static

Lookup Foreign Id.

Parameters
intmep item id

Definition at line 235 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().

236  {
237  return self::lookup($a_id, "foreign_id");
238  }
+ 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.

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

246  {
247  return self::lookup($a_id, "type");
248  }
+ Here is the caller graph for this function:

◆ read()

ilMediaPoolItem::read ( )

Read.

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

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

Referenced by __construct().

159  {
160  $ilDB = $this->db;
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  }
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 81 of file class.ilMediaPoolItem.php.

Referenced by read().

82  {
83  $this->foreign_id = $a_val;
84  }
+ 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.

Referenced by __construct(), and create().

42  {
43  $this->id = $a_val;
44  }
+ 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.

Referenced by read().

102  {
103  $this->import_id = $a_val;
104  }
+ 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.

Referenced by read().

122  {
123  $this->title = $a_val;
124  }
+ 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.

Referenced by read().

62  {
63  $this->type = $a_val;
64  }
+ Here is the caller graph for this function:

◆ update()

ilMediaPoolItem::update ( )

Update.

Parameters

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

References $db, and $ilDB.

181  {
182  $ilDB = $this->db;
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  }
global $ilDB

◆ updateObjectTitle()

static ilMediaPoolItem::updateObjectTitle (   $a_obj)
static

Update object title.

Parameters

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

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

Referenced by ilMediaPoolAppEventListener\handleEvent().

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  }
global $DIC
Definition: saml.php:7
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

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