ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilObjMediaPool Class Reference

Media pool object. More...

+ Inheritance diagram for ilObjMediaPool:
+ Collaboration diagram for ilObjMediaPool:

Public Member Functions

 ilObjMediaPool ($a_id=0, $a_call_by_reference=true)
 Constructor public. More...
 
 setDefaultWidth ($a_val)
 Set default width. More...
 
 getDefaultWidth ()
 Get default width. More...
 
 setDefaultHeight ($a_val)
 Set default height. More...
 
 getDefaultHeight ()
 Get default height. More...
 
 read ()
 Read pool data. More...
 
 create ()
 create new media pool More...
 
 createMepTree ()
 Create media pool tree. More...
 
getTree ()
 get media pool folder tree More...
 
 update ()
 update object data More...
 
 delete ()
 delete object and all related data More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event happend, each object may decide how it reacts. More...
 
 getChilds ($obj_id="", $a_type="")
 get childs of node More...
 
 getChildsExceptFolders ($obj_id="")
 get childs of node More...
 
 getMediaObjects ($a_title_filter="", $a_format_filter="", $a_keyword_filter='', $a_caption_filter)
 Get media objects. More...
 
 getAllMobIds ($a_id)
 Get all media object ids. More...
 
 getUsedFormats ()
 Get used formats. More...
 
 getParentId ($obj_id="")
 
 insertInTree ($a_obj_id, $a_parent="")
 Insert into tree. More...
 
 deleteChild ($obj_id)
 Delete a child of media tree. More...
 
 createFolder ($a_title, $a_parent=0)
 Create a new folder. More...
 
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone media pool. More...
 
 copyTreeContent ($a_new_obj, $a_target_parent, $a_source_parent)
 Copy tree content. More...
 
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. More...
 

Static Public Member Functions

static getPoolTree ($a_obj_id)
 Get Pool Tree. More...
 
static isForeignIdInTree ($a_pool_id, $a_foreign_id)
 Check whether foreign id is in tree. More...
 
static isItemIdInTree ($a_pool_id, $a_item_id)
 Check wheter a mep item id is in the media pool. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

 $tree
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $ilias
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 
 $obj_data_record
 object_data record More...
 

Detailed Description

Media pool object.

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

$Id$

Definition at line 21 of file class.ilObjMediaPool.php.

Member Function Documentation

◆ cloneObject()

ilObjMediaPool::cloneObject (   $a_target_id,
  $a_copy_id = 0 
)

Clone media pool.

Parameters
inttarget ref_id
intcopy id

Definition at line 640 of file class.ilObjMediaPool.php.

References $ilDB, ilObject\$ilias, $ilUser, copyTreeContent(), getDefaultHeight(), getDefaultWidth(), ilObject\getDescription(), ilObject\getTitle(), and getTree().

641  {
642  global $ilDB, $ilUser, $ilias;
643 
644  $new_obj = parent::cloneObject($a_target_id,$a_copy_id);
645 
646  $new_obj->setTitle($this->getTitle());
647  $new_obj->setDescription($this->getDescription());
648  $new_obj->setDefaultWidth($this->getDefaultWidth());
649  $new_obj->setDefaultHeight($this->getDefaultHeight());
650  $new_obj->update();
651 
652  // copy content
653  $this->copyTreeContent($new_obj, $new_obj->getTree()->readRootId(),
654  $this->getTree()->readRootId());
655 
656  return $new_obj;
657  }
getDefaultWidth()
Get default width.
getTitle()
get object title public
getDescription()
get object description
getDefaultHeight()
Get default height.
global $ilUser
Definition: imgupload.php:15
global $ilDB
& getTree()
get media pool folder tree
copyTreeContent($a_new_obj, $a_target_parent, $a_source_parent)
Copy tree content.
+ Here is the call graph for this function:

◆ copyTreeContent()

ilObjMediaPool::copyTreeContent (   $a_new_obj,
  $a_target_parent,
  $a_source_parent 
)

Copy tree content.

Parameters

Definition at line 665 of file class.ilObjMediaPool.php.

References getTree(), and ilMediaPoolItem\lookupForeignId().

Referenced by cloneObject().

666  {
667  include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
668  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
669  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
670 
671  // get all chapters of root lm
672  $nodes = $this->getTree()->getChilds($a_source_parent);
673  foreach ($nodes as $node)
674  {
675  $item = new ilMediaPoolItem();
676  $item->setType($node["type"]);
677  switch ($node["type"])
678  {
679  case "mob":
680  $mob_id = ilMediaPoolItem::lookupForeignId($node["child"]);
681  $mob = new ilObjMediaObject($mob_id);
682  $new_mob = $mob->duplicate();
683  $item->setForeignId($new_mob->getId());
684  $item->setTitle($new_mob->getTitle());
685  $item->create();
686  break;
687 
688  case "pg":
689  $item->setTitle($node["title"]);
690  $item->create();
691  $page = new ilMediaPoolPage($node["child"]);
692  $new_page = new ilMediaPoolPage();
693  $new_page->setId($item->getId());
694  $new_page->create();
695 
696  // copy page
697  $page->copy($new_page->getId(), $new_page->getParentType(), $new_page->getParentId(), true);
698  //$new_page->setXMLContent($page->copyXMLContent(true));
699  //$new_page->buildDom();
700  //$new_page->update();
701  break;
702 
703  case "fold":
704  $item->setTitle($node["title"]);
705  $item->create();
706  break;
707  }
708 
709  // insert item into tree
710  $a_new_obj->insertInTree($item->getId(), $a_target_parent);
711 
712  // handle childs
713  $this->copyTreeContent($a_new_obj, $item->getId(), $node["child"]);
714  }
715  }
Class ilMediaPoolPage.
static lookupForeignId($a_id)
Lookup Foreign Id.
Class ilObjMediaObject.
Media Pool Item.
& getTree()
get media pool folder tree
copyTreeContent($a_new_obj, $a_target_parent, $a_source_parent)
Copy tree content.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilObjMediaPool::create ( )

create new media pool

Definition at line 118 of file class.ilObjMediaPool.php.

References $ilDB, and createMepTree().

119  {
120  global $ilDB;
121 
122  parent::create();
123 
124  $ilDB->manipulate("INSERT INTO mep_data ".
125  "(id, default_width, default_height) VALUES (".
126  $ilDB->quote($this->getId(), "integer").", ".
127  $ilDB->quote($this->getDefaultWidth(), "integer").", ".
128  $ilDB->quote($this->getDefaultHeight(), "integer").
129  ")");
130 
131  $this->createMepTree();
132  }
createMepTree()
Create media pool tree.
global $ilDB
+ Here is the call graph for this function:

◆ createFolder()

ilObjMediaPool::createFolder (   $a_title,
  $a_parent = 0 
)

Create a new folder.

Parameters

Definition at line 615 of file class.ilObjMediaPool.php.

References getTree(), and insertInTree().

616  {
617  // perform save
618  $mep_item = new ilMediaPoolItem();
619  $mep_item->setTitle($a_title);
620  $mep_item->setType("fold");
621  $mep_item->create();
622  if ($mep_item->getId() > 0)
623  {
624  $tree = $this->getTree();
625  $parent = $a_parent > 0
626  ? $a_parent
627  : $tree->getRootId();
628  $this->insertInTree($mep_item->getId(), $parent);
629  return $mep_item->getId();
630  }
631  return false;
632  }
insertInTree($a_obj_id, $a_parent="")
Insert into tree.
Media Pool Item.
& getTree()
get media pool folder tree
+ Here is the call graph for this function:

◆ createMepTree()

ilObjMediaPool::createMepTree ( )

Create media pool tree.

Parameters

Definition at line 140 of file class.ilObjMediaPool.php.

References ilObject\getId().

Referenced by create().

141  {
142  // create media pool tree
143  $this->tree = new ilTree($this->getId());
144  $this->tree->setTreeTablePK("mep_id");
145  $this->tree->setTableNames('mep_tree','mep_item');
146  $this->tree->addTree($this->getId(), 1);
147  }
getId()
get object id public
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilObjMediaPool::delete ( )

delete object and all related data

this method has been tested on may 9th 2004 media pool tree, media objects and folders have been deleted correctly as desired

public

Returns
boolean true if all object data were removed; false if only a references were removed

Definition at line 194 of file class.ilObjMediaPool.php.

References ilObject\_lookupType(), and ilMediaPoolItem\lookupForeignId().

195  {
196  // always call parent delete function first!!
197  if (!parent::delete())
198  {
199  return false;
200  }
201 
202  // get childs
203  $childs = $this->tree->getSubTree($this->tree->getNodeData($this->tree->readRootId()));
204 
205  // delete tree
206  $this->tree->removeTree($this->tree->getTreeId());
207 
208  // delete childs
209  foreach ($childs as $child)
210  {
211  $fid = ilMediaPoolItem::lookupForeignId($child["obj_id"]);
212  switch ($child["type"])
213  {
214  case "mob":
215  if (ilObject::_lookupType($fid) == "mob")
216  {
217  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
218  $mob = new ilObjMediaObject($fid);
219  $mob->delete();
220  }
221  break;
222 
223 /* case "fold":
224  if (ilObject::_lookupType($fid) == "fold")
225  {
226  include_once("./Modules/Folder/classes/class.ilObjFolder.php");
227  $fold = new ilObjFolder($fid, false);
228  $fold->delete();
229  }
230  break;*/
231  }
232  }
233 
234  return true;
235  }
static lookupForeignId($a_id)
Lookup Foreign Id.
Class ilObjMediaObject.
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:

◆ deleteChild()

ilObjMediaPool::deleteChild (   $obj_id)

Delete a child of media tree.

Parameters
intmep_item id

Definition at line 518 of file class.ilObjMediaPool.php.

References ilObject\$title, ilObject\$type, ilMediaPoolPage\_exists(), ilObject\_lookupType(), ilMediaPoolItem\lookupForeignId(), ilMediaPoolItem\lookupTitle(), and ilMediaPoolItem\lookupType().

519  {
520  $fid = ilMediaPoolItem::lookupForeignId($obj_id);
523 
524  $node_data = $this->tree->getNodeData($obj_id);
525  $subtree = $this->tree->getSubtree($node_data);
526 
527  // delete tree
528  if($this->tree->isInTree($obj_id))
529  {
530  $this->tree->deleteTree($node_data);
531  }
532 
533  // delete objects
534  foreach ($subtree as $node)
535  {
536  $fid = ilMediaPoolItem::lookupForeignId($node["child"]);
537  if ($node["type"] == "mob")
538  {
539  if (ilObject::_lookupType($fid) == "mob")
540  {
541  $obj =& new ilObjMediaObject($fid);
542  $obj->delete();
543  }
544  }
545 
546  if ($node["type"] == "fold")
547  {
548  if ($fid > 0 && ilObject::_lookupType($fid) == "fold")
549  {
550  $obj = new ilObjFolder($fid, false);
551  $obj->delete();
552  }
553  }
554 
555  if ($node["type"] == "pg")
556  {
557  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
558  if (ilMediaPoolPage::_exists($node["child"]))
559  {
560  $pg = new ilMediaPoolPage($node["child"]);
561  $pg->delete();
562  }
563  }
564 
565  include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
566  $item = new ilMediaPoolItem($node["child"]);
567  $item->delete();
568  }
569  }
static lookupType($a_id)
Lookup type.
Class ilObjFolder.
Class ilMediaPoolPage.
static lookupForeignId($a_id)
Lookup Foreign Id.
Class ilObjMediaObject.
static _lookupType($a_id, $a_reference=false)
lookup object type
Media Pool Item.
static lookupTitle($a_id)
Lookup title.
static _exists($a_id)
Check whether meida pool page exists.
+ Here is the call graph for this function:

◆ getAllMobIds()

ilObjMediaPool::getAllMobIds (   $a_id)

Get all media object ids.

Definition at line 428 of file class.ilObjMediaPool.php.

References $ilDB, and $query.

Referenced by ilMediaPoolExporter\getXmlExportHeadDependencies(), and ilDataCollectionExporter\getXmlExportHeadDependencies().

429  {
430  global $ilDB;
431 
432  $query = "SELECT foreign_id as id FROM ".
433  " mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) ".
434  " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) ".
435  " WHERE mep_tree.mep_id = ".$ilDB->quote($a_id, "integer").
436  " AND mep_item.type = ".$ilDB->quote("mob", "text").
437  " AND object_data.type = ".$ilDB->quote("mob", "text");
438  $set = $ilDB->query($query);
439  $ids = array();
440  while ($rec = $ilDB->fetchAssoc($set))
441  {
442  $ids[] = $rec["id"];
443  }
444  return $ids;
445  }
global $ilDB
+ Here is the caller graph for this function:

◆ getChilds()

ilObjMediaPool::getChilds (   $obj_id = "",
  $a_type = "" 
)

get childs of node

Definition at line 308 of file class.ilObjMediaPool.php.

References $mobs.

309  {
310  $objs = array();
311  $mobs = array();
312  $pgs = array();
313  if ($obj_id == "")
314  {
315  $obj_id = $this->tree->getRootId();
316  }
317 
318  if ($a_type == "fold" || $a_type == "")
319  {
320  $objs = $this->tree->getChildsByType($obj_id, "fold");
321  }
322  if ($a_type == "mob" || $a_type == "")
323  {
324  $mobs = $this->tree->getChildsByType($obj_id, "mob");
325  }
326  foreach($mobs as $key => $mob)
327  {
328  $objs[] = $mob;
329  }
330  if ($a_type == "pg" || $a_type == "")
331  {
332  $pgs = $this->tree->getChildsByType($obj_id, "pg");
333  }
334  foreach($pgs as $key => $pg)
335  {
336  $objs[] = $pg;
337  }
338 
339  return $objs;
340  }
$mobs

◆ getChildsExceptFolders()

ilObjMediaPool::getChildsExceptFolders (   $obj_id = "")

get childs of node

Definition at line 345 of file class.ilObjMediaPool.php.

References $mobs.

346  {
347  $objs = array();
348  $mobs = array();
349  if ($obj_id == "")
350  {
351  $obj_id = $this->tree->getRootId();
352  }
353 
354  $objs = $this->tree->getFilteredChilds(array("fold", "dummy"), $obj_id);
355  return $objs;
356  }
$mobs

◆ getDefaultHeight()

ilObjMediaPool::getDefaultHeight ( )

Get default height.

Returns
int default height

Definition at line 73 of file class.ilObjMediaPool.php.

Referenced by cloneObject().

74  {
75  return $this->default_height;
76  }
+ Here is the caller graph for this function:

◆ getDefaultWidth()

ilObjMediaPool::getDefaultWidth ( )

Get default width.

Returns
int default width

Definition at line 53 of file class.ilObjMediaPool.php.

Referenced by cloneObject().

54  {
55  return $this->default_width;
56  }
+ Here is the caller graph for this function:

◆ getMediaObjects()

ilObjMediaPool::getMediaObjects (   $a_title_filter = "",
  $a_format_filter = "",
  $a_keyword_filter = '',
  $a_caption_filter 
)

Get media objects.

Definition at line 361 of file class.ilObjMediaPool.php.

References $ilDB, $query, $res, ilMDKeyword\_searchKeywords(), and ilObject\getId().

362  {
363  global $ilDB;
364 
365  $query = "SELECT DISTINCT mep_tree.*, object_data.* ".
366  "FROM mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) ".
367  " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) ";
368 
369  if ($a_format_filter != "" or $a_caption_filter != '')
370  {
371  $query.= " JOIN media_item ON (media_item.mob_id = object_data.obj_id) ";
372  }
373 
374  $query .=
375  " WHERE mep_tree.mep_id = ".$ilDB->quote($this->getId(), "integer").
376  " AND object_data.type = ".$ilDB->quote("mob", "text");
377 
378  // filter
379  if (trim($a_title_filter) != "") // title
380  {
381  $query.= " AND ".$ilDB->like("object_data.title", "text", "%".trim($a_title_filter)."%");
382  }
383  if ($a_format_filter != "") // format
384  {
385  $filter = ($a_format_filter == "unknown")
386  ? ""
387  : $a_format_filter;
388  $query.= " AND ".$ilDB->equals("media_item.format", $filter, "text", true);
389  }
390  if(trim($a_caption_filter))
391  {
392  $query .= 'AND '.$ilDB->like('media_item.caption', 'text', '%'.trim($a_caption_filter).'%');
393  }
394 
395  $query.=
396  " ORDER BY object_data.title";
397 
398  $objs = array();
399  $set = $ilDB->query($query);
400  while ($rec = $ilDB->fetchAssoc($set))
401  {
402  $rec["foreign_id"] = $rec["obj_id"];
403  $rec["obj_id"] = "";
404  $objs[] = $rec;
405  }
406 
407  // Keyword filter
408  if($a_keyword_filter)
409  {
410  include_once './Services/MetaData/classes/class.ilMDKeyword.php';
411  $res = ilMDKeyword::_searchKeywords($a_keyword_filter,'mob',0);
412 
413  foreach($objs as $obj)
414  {
415  if(in_array($obj['foreign_id'],$res))
416  {
417  $filtered[] = $obj;
418  }
419  }
420  return (array) $filtered;
421  }
422  return $objs;
423  }
static _searchKeywords($a_query, $a_type, $a_rbac_id=0)
Search for objects by keywords.
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:

◆ getParentId()

ilObjMediaPool::getParentId (   $obj_id = "")

Definition at line 478 of file class.ilObjMediaPool.php.

479  {
480  if ($obj_id == "")
481  {
482  return false;
483  }
484  if ($obj_id == $this->tree->getRootId())
485  {
486  return false;
487  }
488 
489  return $this->tree->getParentId($obj_id);
490  }

◆ getPoolTree()

static ilObjMediaPool::getPoolTree (   $a_obj_id)
static

Get Pool Tree.

Parameters
intMedia pool ID
Returns
object Tree object of media pool

Definition at line 106 of file class.ilObjMediaPool.php.

References $tree.

Referenced by ilMediaPoolTableGUI\__construct(), and read().

107  {
108  $tree = new ilTree($a_obj_id);
109  $tree->setTreeTablePK("mep_id");
110  $tree->setTableNames("mep_tree", "mep_item");
111 
112  return $tree;
113  }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
+ Here is the caller graph for this function:

◆ getTree()

& ilObjMediaPool::getTree ( )

get media pool folder tree

Definition at line 153 of file class.ilObjMediaPool.php.

References $tree.

Referenced by cloneObject(), copyTreeContent(), and createFolder().

154  {
155  return $this->tree;
156  }
+ Here is the caller graph for this function:

◆ getUsedFormats()

ilObjMediaPool::getUsedFormats ( )

Get used formats.

Definition at line 450 of file class.ilObjMediaPool.php.

References $ilDB, ilObject\$lng, $query, and ilObject\getId().

451  {
452  global $ilDB, $lng;
453 
454  $query = "SELECT DISTINCT media_item.format f FROM mep_tree ".
455  " JOIN mep_item ON (mep_item.obj_id = mep_tree.child) ".
456  " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) ".
457  " JOIN media_item ON (media_item.mob_id = object_data.obj_id) ".
458  " WHERE mep_tree.mep_id = ".$ilDB->quote($this->getId(), "integer").
459  " AND object_data.type = ".$ilDB->quote("mob", "text").
460  " ORDER BY f";
461  $formats = array();
462  $set = $ilDB->query($query);
463  while ($rec = $ilDB->fetchAssoc($set))
464  {
465  if ($rec["f"] != "")
466  {
467  $formats[$rec["f"]] = $rec["f"];
468  }
469  else
470  {
471  $formats["unknown"] = $lng->txt("mep_unknown");
472  }
473  }
474 
475  return $formats;
476  }
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:

◆ ilObjMediaPool()

ilObjMediaPool::ilObjMediaPool (   $a_id = 0,
  $a_call_by_reference = true 
)

Constructor public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Definition at line 31 of file class.ilObjMediaPool.php.

References ilObject\ilObject().

32  {
33  // this also calls read() method! (if $a_id is set)
34  $this->type = "mep";
35  $this->ilObject($a_id,$a_call_by_reference);
36  }
ilObject($a_id=0, $a_reference=true)
Constructor public.
+ Here is the call graph for this function:

◆ insertInTree()

ilObjMediaPool::insertInTree (   $a_obj_id,
  $a_parent = "" 
)

Insert into tree.

Parameters
int$a_obj_id(mep_item obj_id)
int$a_parent

Definition at line 497 of file class.ilObjMediaPool.php.

Referenced by createFolder().

498  {
499  if (!$this->tree->isInTree($a_obj_id))
500  {
501  $parent = ($a_parent == "")
502  ? $this->tree->getRootId()
503  : $a_parent;
504  $this->tree->insertNode($a_obj_id, $parent);
505  return true;
506  }
507  else
508  {
509  return false;
510  }
511  }
+ Here is the caller graph for this function:

◆ isForeignIdInTree()

static ilObjMediaPool::isForeignIdInTree (   $a_pool_id,
  $a_foreign_id 
)
static

Check whether foreign id is in tree.

Parameters

Definition at line 577 of file class.ilObjMediaPool.php.

References $ilDB.

578  {
579  global $ilDB;
580 
581  $set = $ilDB->query("SELECT * FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE ".
582  " foreign_id = ".$ilDB->quote($a_foreign_id, "integer").
583  " AND mep_id = ".$ilDB->quote($a_pool_id, "integer")
584  );
585  if ($rec = $ilDB->fetchAssoc($set))
586  {
587  return true;
588  }
589  return false;
590  }
global $ilDB

◆ isItemIdInTree()

static ilObjMediaPool::isItemIdInTree (   $a_pool_id,
  $a_item_id 
)
static

Check wheter a mep item id is in the media pool.

Definition at line 595 of file class.ilObjMediaPool.php.

References $ilDB.

596  {
597  global $ilDB;
598 
599  $set = $ilDB->query("SELECT * FROM mep_tree WHERE child = ".
600  $ilDB->quote($a_item_id, "integer").
601  " AND mep_id = ".$ilDB->quote($a_pool_id, "integer"));
602  if ($rec = $ilDB->fetchAssoc($set))
603  {
604  return true;
605  }
606  return false;
607  }
global $ilDB

◆ notify()

ilObjMediaPool::notify (   $a_event,
  $a_ref_id,
  $a_parent_non_rbac_id,
  $a_node_id,
  $a_params = 0 
)

notifys an object about an event occured Based on the event happend, each object may decide how it reacts.

If you are not required to handle any events related to your module, just delete this method. (For an example how this method is used, look at ilObjGroup)

public

Parameters
stringevent
integerreference id of object where the event occured
arraypasses optional parameters if required
Returns
boolean

Definition at line 251 of file class.ilObjMediaPool.php.

References $_GET, $tree, and ilObject\getType().

252  {
253  global $tree;
254 
255  switch ($a_event)
256  {
257  case "link":
258 
259  //var_dump("<pre>",$a_params,"</pre>");
260  //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
261  //exit;
262  break;
263 
264  case "cut":
265 
266  //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
267  //exit;
268  break;
269 
270  case "copy":
271 
272  //var_dump("<pre>",$a_params,"</pre>");
273  //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
274  //exit;
275  break;
276 
277  case "paste":
278 
279  //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
280  //exit;
281  break;
282 
283  case "new":
284 
285  //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
286  //exit;
287  break;
288  }
289 
290  // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
291  if ($a_node_id==$_GET["ref_id"])
292  {
293  $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
294  $parent_type = $parent_obj->getType();
295  if($parent_type == $this->getType())
296  {
297  $a_node_id = (int) $tree->getParentId($a_node_id);
298  }
299  }
300 
301  parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
302  }
$_GET["client_id"]
redirection script todo: (a better solution should control the processing via a xml file) ...
getType()
get object type public
+ Here is the call graph for this function:

◆ read()

ilObjMediaPool::read ( )

Read pool data.

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

References $ilDB, ilObject\getId(), getPoolTree(), setDefaultHeight(), and setDefaultWidth().

82  {
83  global $ilDB;
84 
85  parent::read();
86 
87  $set = $ilDB->query("SELECT * FROM mep_data ".
88  " WHERE id = ".$ilDB->quote($this->getId(), "integer")
89  );
90  if ($rec = $ilDB->fetchAssoc($set))
91  {
92  $this->setDefaultWidth($rec["default_width"]);
93  $this->setDefaultHeight($rec["default_height"]);
94  }
95  $this->tree = ilObjMediaPool::getPoolTree($this->getId());
96  }
getId()
get object id public
setDefaultWidth($a_val)
Set default width.
static getPoolTree($a_obj_id)
Get Pool Tree.
global $ilDB
setDefaultHeight($a_val)
Set default height.
+ Here is the call graph for this function:

◆ setDefaultHeight()

ilObjMediaPool::setDefaultHeight (   $a_val)

Set default height.

Parameters
intdefault height

Definition at line 63 of file class.ilObjMediaPool.php.

Referenced by read().

64  {
65  $this->default_height = $a_val;
66  }
+ Here is the caller graph for this function:

◆ setDefaultWidth()

ilObjMediaPool::setDefaultWidth (   $a_val)

Set default width.

Parameters
intdefault width

Definition at line 43 of file class.ilObjMediaPool.php.

Referenced by read().

44  {
45  $this->default_width = $a_val;
46  }
+ Here is the caller graph for this function:

◆ update()

ilObjMediaPool::update ( )

update object data

public

Returns
boolean

Definition at line 164 of file class.ilObjMediaPool.php.

References $ilDB.

165  {
166  global $ilDB;
167 
168  if (!parent::update())
169  {
170  return false;
171  }
172 
173  // put here object specific stuff
174  $ilDB->manipulate("UPDATE mep_data SET ".
175  " default_width = ".$ilDB->quote($this->getDefaultWidth(), "integer").",".
176  " default_height = ".$ilDB->quote($this->getDefaultHeight(), "integer").
177  " WHERE id = ".$ilDB->quote($this->getId(), "integer")
178  );
179 
180  return true;
181  }
global $ilDB

Field Documentation

◆ $tree

ilObjMediaPool::$tree

Definition at line 23 of file class.ilObjMediaPool.php.

Referenced by getPoolTree(), getTree(), and notify().


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