ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjMediaPool Class Reference

Media pool object. More...

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

Public Member Functions

 __construct ($a_id=0, $a_call_by_reference=true)
 Constructor @access 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...
 
 setForTranslation ($a_val)
 Set for translation. More...
 
 getForTranslation ()
 Get for translation. 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...
 
 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...
 
 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, $a_omit_tree=false)
 Clone media pool. More...
 
 copyTreeContent ($a_new_obj, $a_target_parent, $a_source_parent)
 Copy tree content. More...
 
 exportXML ($a_master_only=false)
 Export. More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access 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 ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 
 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...
 
 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) @access public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. 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...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static getPoolTree ($a_obj_id)
 Get Pool Tree. More...
 
static getAllMobIds ($a_id)
 
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 _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date @global type $ilDB. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data@access public 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 fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

 $tree
 
 $for_translation = 0
 
- 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
 

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.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor @access public.

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

Reimplemented from ilObject.

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

33 {
34 // this also calls read() method! (if $a_id is set)
35 $this->type = "mep";
36 parent::__construct($a_id,$a_call_by_reference);
37 }

Member Function Documentation

◆ cloneObject()

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

Clone media pool.

Parameters
inttarget ref_id
intcopy id

Reimplemented from ilObject.

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

584 {
585 $new_obj = parent::cloneObject($a_target_id,$a_copy_id, $a_omit_tree);
586
587 $new_obj->setTitle($this->getTitle());
588 $new_obj->setDescription($this->getDescription());
589 $new_obj->setDefaultWidth($this->getDefaultWidth());
590 $new_obj->setDefaultHeight($this->getDefaultHeight());
591 $new_obj->update();
592
593 // copy content
594 $this->copyTreeContent($new_obj, $new_obj->getTree()->readRootId(),
595 $this->getTree()->readRootId());
596
597 return $new_obj;
598 }
getDefaultWidth()
Get default width.
getDefaultHeight()
Get default height.
copyTreeContent($a_new_obj, $a_target_parent, $a_source_parent)
Copy tree content.
getDescription()
get object description
getTitle()
get object title @access public

References copyTreeContent(), getDefaultHeight(), getDefaultWidth(), ilObject\getDescription(), and ilObject\getTitle().

+ Here is the call graph for this function:

◆ copyTreeContent()

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

Copy tree content.

Parameters

return

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

607 {
608 include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
609 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
610 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
611
612 // get all chapters of root lm
613 $nodes = $this->getTree()->getChilds($a_source_parent);
614 foreach ($nodes as $node)
615 {
616 $item = new ilMediaPoolItem();
617 $item->setType($node["type"]);
618 switch ($node["type"])
619 {
620 case "mob":
621 $mob_id = ilMediaPoolItem::lookupForeignId($node["child"]);
622 $mob = new ilObjMediaObject($mob_id);
623 $new_mob = $mob->duplicate();
624 $item->setForeignId($new_mob->getId());
625 $item->setTitle($new_mob->getTitle());
626 $item->create();
627 break;
628
629 case "pg":
630 $item->setTitle($node["title"]);
631 $item->create();
632 $page = new ilMediaPoolPage($node["child"]);
633 $new_page = new ilMediaPoolPage();
634 $new_page->setParentId($a_new_obj->getId());
635 $new_page->setId($item->getId());
636 $new_page->create();
637
638 // copy page
639 $page->copy($new_page->getId(), $new_page->getParentType(), $new_page->getParentId(), true);
640 break;
641
642 case "fold":
643 $item->setTitle($node["title"]);
644 $item->create();
645 break;
646 }
647
648 // insert item into tree
649 $a_new_obj->insertInTree($item->getId(), $a_target_parent);
650
651 // handle childs
652 $this->copyTreeContent($a_new_obj, $item->getId(), $node["child"]);
653 }
654 }
static lookupForeignId($a_id)
Lookup Foreign Id.
Class ilMediaPoolPage.
Class ilObjMediaObject.
& getTree()
get media pool folder tree

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

Referenced by cloneObject(), and copyTreeContent().

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

◆ create()

ilObjMediaPool::create ( )

create new media pool

Reimplemented from ilObject.

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

141 {
142 global $ilDB;
143
144 parent::create();
145
146 $ilDB->manipulate("INSERT INTO mep_data ".
147 "(id, default_width, default_height, for_translation) VALUES (".
148 $ilDB->quote($this->getId(), "integer").", ".
149 $ilDB->quote($this->getDefaultWidth(), "integer").", ".
150 $ilDB->quote($this->getDefaultHeight(), "integer").", ".
151 $ilDB->quote($this->getForTranslation(), "integer").
152 ")");
153
154 $this->createMepTree();
155 }
createMepTree()
Create media pool tree.
global $ilDB

References $ilDB, and createMepTree().

+ Here is the call graph for this function:

◆ createFolder()

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

Create a new folder.

Parameters

return

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

559 {
560 // perform save
561 $mep_item = new ilMediaPoolItem();
562 $mep_item->setTitle($a_title);
563 $mep_item->setType("fold");
564 $mep_item->create();
565 if ($mep_item->getId() > 0)
566 {
567 $tree = $this->getTree();
568 $parent = $a_parent > 0
569 ? $a_parent
570 : $tree->getRootId();
571 $this->insertInTree($mep_item->getId(), $parent);
572 return $mep_item->getId();
573 }
574 return false;
575 }
insertInTree($a_obj_id, $a_parent="")
Insert into tree.

References $tree, getTree(), and insertInTree().

+ Here is the call graph for this function:

◆ createMepTree()

ilObjMediaPool::createMepTree ( )

Create media pool tree.

Parameters

return

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

164 {
165 // create media pool tree
166 $this->tree = new ilTree($this->getId());
167 $this->tree->setTreeTablePK("mep_id");
168 $this->tree->setTableNames('mep_tree','mep_item');
169 $this->tree->addTree($this->getId(), 1);
170 }
getId()
get object id @access public
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...

References ilObject\getId().

Referenced by create().

+ 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

@access public

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

Reimplemented from ilObject.

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

219 {
220 // always call parent delete function first!!
221 if (!parent::delete())
222 {
223 return false;
224 }
225
226 // get childs
227 $childs = $this->tree->getSubTree($this->tree->getNodeData($this->tree->readRootId()));
228
229 // delete tree
230 $this->tree->removeTree($this->tree->getTreeId());
231
232 // delete childs
233 foreach ($childs as $child)
234 {
235 $fid = ilMediaPoolItem::lookupForeignId($child["obj_id"]);
236 switch ($child["type"])
237 {
238 case "mob":
239 if (ilObject::_lookupType($fid) == "mob")
240 {
241 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
242 $mob = new ilObjMediaObject($fid);
243 $mob->delete();
244 }
245 break;
246 }
247 }
248
249 return true;
250 }
static _lookupType($a_id, $a_reference=false)
lookup object type

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

+ 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 465 of file class.ilObjMediaPool.php.

466 {
467 $node_data = $this->tree->getNodeData($obj_id);
468 $subtree = $this->tree->getSubtree($node_data);
469
470 // delete tree
471 if($this->tree->isInTree($obj_id))
472 {
473 $this->tree->deleteTree($node_data);
474 }
475
476 // delete objects
477 foreach ($subtree as $node)
478 {
479 $fid = ilMediaPoolItem::lookupForeignId($node["child"]);
480 if ($node["type"] == "mob")
481 {
482 if (ilObject::_lookupType($fid) == "mob")
483 {
484 $obj = new ilObjMediaObject($fid);
485 $obj->delete();
486 }
487 }
488
489 if ($node["type"] == "fold")
490 {
491 if ($fid > 0 && ilObject::_lookupType($fid) == "fold")
492 {
493 $obj = new ilObjFolder($fid, false);
494 $obj->delete();
495 }
496 }
497
498 if ($node["type"] == "pg")
499 {
500 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
501 if (ilPageObject::_exists("mep", $node["child"]))
502 {
503 $pg = new ilMediaPoolPage($node["child"]);
504 $pg->delete();
505 }
506 }
507
508 include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
509 $item = new ilMediaPoolItem($node["child"]);
510 $item->delete();
511 }
512 }
Class ilObjFolder.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.

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

+ Here is the call graph for this function:

◆ exportXML()

ilObjMediaPool::exportXML (   $a_master_only = false)

Export.

Parameters

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

662 {
663 if ($a_master_only)
664 {
665 include_once("./Services/Export/classes/class.ilExport.php");
666 $exp = new ilExport();
667 $conf = $exp->getConfig("Modules/MediaPool");
668 $conf->setMasterLanguageOnly(true);
669 $exp->exportObject($this->getType(),$this->getId(), "4.4.0");
670 }
671 }
getType()
get object type @access public

References ilObject\getId(), and ilObject\getType().

+ Here is the call graph for this function:

◆ getAllMobIds()

static ilObjMediaPool::getAllMobIds (   $a_id)
static
Parameters
int$a_idof the media pool
Returns
array of obj_id's (int) of media objects

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

376 {
377 global $ilDB;
378
379 $query = "SELECT foreign_id as id FROM ".
380 " mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) ".
381 " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) ".
382 " WHERE mep_tree.mep_id = ".$ilDB->quote($a_id, "integer").
383 " AND mep_item.type = ".$ilDB->quote("mob", "text").
384 " AND object_data.type = ".$ilDB->quote("mob", "text");
385 $set = $ilDB->query($query);
386 $ids = array();
387 while ($rec = $ilDB->fetchAssoc($set))
388 {
389 $ids[] = $rec["id"];
390 }
391 return $ids;
392 }

References $ilDB, and $query.

Referenced by ilMediaPoolExporter\getXmlExportHeadDependencies().

+ Here is the caller graph for this function:

◆ getChilds()

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

get childs of node

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

256 {
257 $objs = array();
258 $mobs = array();
259 $pgs = array();
260 if ($obj_id == "")
261 {
262 $obj_id = $this->tree->getRootId();
263 }
264
265 if ($a_type == "fold" || $a_type == "")
266 {
267 $objs = $this->tree->getChildsByType($obj_id, "fold");
268 }
269 if ($a_type == "mob" || $a_type == "")
270 {
271 $mobs = $this->tree->getChildsByType($obj_id, "mob");
272 }
273 foreach($mobs as $key => $mob)
274 {
275 $objs[] = $mob;
276 }
277 if ($a_type == "pg" || $a_type == "")
278 {
279 $pgs = $this->tree->getChildsByType($obj_id, "pg");
280 }
281 foreach($pgs as $key => $pg)
282 {
283 $objs[] = $pg;
284 }
285
286 return $objs;
287 }
$mobs
$a_type
Definition: workflow.php:93

References $a_type, and $mobs.

◆ getChildsExceptFolders()

ilObjMediaPool::getChildsExceptFolders (   $obj_id = "")

get childs of node

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

293 {
294 if ($obj_id == "")
295 {
296 $obj_id = $this->tree->getRootId();
297 }
298
299 $objs = $this->tree->getFilteredChilds(array("fold", "dummy"), $obj_id);
300 return $objs;
301 }

◆ getDefaultHeight()

ilObjMediaPool::getDefaultHeight ( )

Get default height.

Returns
int default height

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

75 {
76 return $this->default_height;
77 }

Referenced by cloneObject().

+ Here is the caller graph for this function:

◆ getDefaultWidth()

ilObjMediaPool::getDefaultWidth ( )

Get default width.

Returns
int default width

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

55 {
56 return $this->default_width;
57 }

Referenced by cloneObject().

+ Here is the caller graph for this function:

◆ getForTranslation()

ilObjMediaPool::getForTranslation ( )

Get for translation.

Returns
bool lm has been imported for translation purposes

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

References $for_translation.

◆ getMediaObjects()

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

Get media objects.

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

307 {
308 global $ilDB;
309
310 $query = "SELECT DISTINCT mep_tree.*, object_data.* ".
311 "FROM mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) ".
312 " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) ";
313
314 if ($a_format_filter != "" or $a_caption_filter != '')
315 {
316 $query.= " JOIN media_item ON (media_item.mob_id = object_data.obj_id) ";
317 }
318
319 $query .=
320 " WHERE mep_tree.mep_id = ".$ilDB->quote($this->getId(), "integer").
321 " AND object_data.type = ".$ilDB->quote("mob", "text");
322
323 // filter
324 if (trim($a_title_filter) != "") // title
325 {
326 $query.= " AND ".$ilDB->like("object_data.title", "text", "%".trim($a_title_filter)."%");
327 }
328 if ($a_format_filter != "") // format
329 {
330 $filter = ($a_format_filter == "unknown")
331 ? ""
332 : $a_format_filter;
333 $query.= " AND ".$ilDB->equals("media_item.format", $filter, "text", true);
334 }
335 if(trim($a_caption_filter))
336 {
337 $query .= 'AND '.$ilDB->like('media_item.caption', 'text', '%'.trim($a_caption_filter).'%');
338 }
339
340 $query.=
341 " ORDER BY object_data.title";
342
343 $objs = array();
344 $set = $ilDB->query($query);
345 while ($rec = $ilDB->fetchAssoc($set))
346 {
347 $rec["foreign_id"] = $rec["obj_id"];
348 $rec["obj_id"] = "";
349 $objs[] = $rec;
350 }
351
352 // Keyword filter
353 if($a_keyword_filter)
354 {
355 include_once './Services/MetaData/classes/class.ilMDKeyword.php';
356 $res = ilMDKeyword::_searchKeywords($a_keyword_filter,'mob',0);
357
358 foreach($objs as $obj)
359 {
360 if(in_array($obj['foreign_id'],$res))
361 {
362 $filtered[] = $obj;
363 }
364 }
365 return (array) $filtered;
366 }
367 return $objs;
368 }
static _searchKeywords($a_query, $a_type, $a_rbac_id=0)
Search for objects by keywords.

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

+ Here is the call graph for this function:

◆ getParentId()

ilObjMediaPool::getParentId (   $obj_id = "")

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

426 {
427 if ($obj_id == "")
428 {
429 return false;
430 }
431 if ($obj_id == $this->tree->getRootId())
432 {
433 return false;
434 }
435
436 return $this->tree->getParentId($obj_id);
437 }

◆ 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 128 of file class.ilObjMediaPool.php.

129 {
130 $tree = new ilTree($a_obj_id);
131 $tree->setTreeTablePK("mep_id");
132 $tree->setTableNames("mep_tree", "mep_item");
133
134 return $tree;
135 }

References $tree.

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

+ Here is the caller graph for this function:

◆ getTree()

& ilObjMediaPool::getTree ( )

get media pool folder tree

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

177 {
178 return $this->tree;
179 }

References $tree.

Referenced by copyTreeContent(), and createFolder().

+ Here is the caller graph for this function:

◆ getUsedFormats()

ilObjMediaPool::getUsedFormats ( )

Get used formats.

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

398 {
399 global $ilDB, $lng;
400
401 $query = "SELECT DISTINCT media_item.format f FROM mep_tree ".
402 " JOIN mep_item ON (mep_item.obj_id = mep_tree.child) ".
403 " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) ".
404 " JOIN media_item ON (media_item.mob_id = object_data.obj_id) ".
405 " WHERE mep_tree.mep_id = ".$ilDB->quote($this->getId(), "integer").
406 " AND object_data.type = ".$ilDB->quote("mob", "text").
407 " ORDER BY f";
408 $formats = array();
409 $set = $ilDB->query($query);
410 while ($rec = $ilDB->fetchAssoc($set))
411 {
412 if ($rec["f"] != "")
413 {
414 $formats[$rec["f"]] = $rec["f"];
415 }
416 else
417 {
418 $formats["unknown"] = $lng->txt("mep_unknown");
419 }
420 }
421
422 return $formats;
423 }

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

+ 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 444 of file class.ilObjMediaPool.php.

445 {
446 if (!$this->tree->isInTree($a_obj_id))
447 {
448 $parent = ($a_parent == "")
449 ? $this->tree->getRootId()
450 : $a_parent;
451 $this->tree->insertNode($a_obj_id, $parent);
452 return true;
453 }
454 else
455 {
456 return false;
457 }
458 }

Referenced by createFolder().

+ 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

return

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

521 {
522 global $ilDB;
523
524 $set = $ilDB->query("SELECT * FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE ".
525 " foreign_id = ".$ilDB->quote($a_foreign_id, "integer").
526 " AND mep_id = ".$ilDB->quote($a_pool_id, "integer")
527 );
528 if ($rec = $ilDB->fetchAssoc($set))
529 {
530 return true;
531 }
532 return false;
533 }

References $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 538 of file class.ilObjMediaPool.php.

539 {
540 global $ilDB;
541
542 $set = $ilDB->query("SELECT * FROM mep_tree WHERE child = ".
543 $ilDB->quote($a_item_id, "integer").
544 " AND mep_id = ".$ilDB->quote($a_pool_id, "integer"));
545 if ($rec = $ilDB->fetchAssoc($set))
546 {
547 return true;
548 }
549 return false;
550 }

References $ilDB.

◆ read()

ilObjMediaPool::read ( )

Read pool data.

Reimplemented from ilObject.

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

103 {
104 global $ilDB;
105
106 parent::read();
107
108 $set = $ilDB->query("SELECT * FROM mep_data ".
109 " WHERE id = ".$ilDB->quote($this->getId(), "integer")
110 );
111 if ($rec = $ilDB->fetchAssoc($set))
112 {
113 $this->setDefaultWidth($rec["default_width"]);
114 $this->setDefaultHeight($rec["default_height"]);
115 $this->setForTranslation($rec["for_translation"]);
116 }
117 $this->tree = ilObjMediaPool::getPoolTree($this->getId());
118 }
setDefaultWidth($a_val)
Set default width.
setDefaultHeight($a_val)
Set default height.
static getPoolTree($a_obj_id)
Get Pool Tree.
setForTranslation($a_val)
Set for translation.

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

+ Here is the call graph for this function:

◆ setDefaultHeight()

ilObjMediaPool::setDefaultHeight (   $a_val)

Set default height.

Parameters
intdefault height

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

65 {
66 $this->default_height = $a_val;
67 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDefaultWidth()

ilObjMediaPool::setDefaultWidth (   $a_val)

Set default width.

Parameters
intdefault width

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

45 {
46 $this->default_width = $a_val;
47 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setForTranslation()

ilObjMediaPool::setForTranslation (   $a_val)

Set for translation.

Parameters
bool$a_vallm has been imported for translation purposes

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

85 {
86 $this->for_translation = $a_val;
87 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilObjMediaPool::update ( )

update object data

@access public

Returns
boolean

Reimplemented from ilObject.

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

188 {
189 global $ilDB;
190
191 if (!parent::update())
192 {
193 return false;
194 }
195
196 // put here object specific stuff
197 $ilDB->manipulate("UPDATE mep_data SET ".
198 " default_width = ".$ilDB->quote($this->getDefaultWidth(), "integer").",".
199 " default_height = ".$ilDB->quote($this->getDefaultHeight(), "integer").",".
200 " for_translation = ".$ilDB->quote($this->getForTranslation(), "integer")." ".
201 " WHERE id = ".$ilDB->quote($this->getId(), "integer")
202 );
203
204 return true;
205 }

References $ilDB.

Field Documentation

◆ $for_translation

ilObjMediaPool::$for_translation = 0

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

Referenced by getForTranslation().

◆ $tree

ilObjMediaPool::$tree

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

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


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