ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 getPoolTree ()
 Get pool tree. 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_mode="")
 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...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. 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 ()
 Gets the disk usage of the object in bytes. 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...
 
 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...
 
 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 ()
 
 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 lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. 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. 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 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

 $for_translation = 0
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $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
 

Protected Attributes

 $mep_tree
 
- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

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 global $DIC;
35
36 $this->db = $DIC->database();
37 $this->lng = $DIC->language();
38 // this also calls read() method! (if $a_id is set)
39 $this->type = "mep";
40 parent::__construct($a_id, $a_call_by_reference);
41 }
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

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

133 {
134 $tree = new ilTree($a_obj_id);
135 $tree->setTreeTablePK("mep_id");
136 $tree->setTableNames("mep_tree", "mep_item");
137
138 return $tree;
139 }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...

References ilObject\$tree.

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

+ Here is the caller graph for this function:

◆ cloneObject()

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

Clone media pool.

Parameters
inttarget ref_id
intcopy id

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

567 {
568 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
569
570 $new_obj->setTitle($this->getTitle());
571 $new_obj->setDescription($this->getDescription());
572 $new_obj->setDefaultWidth($this->getDefaultWidth());
573 $new_obj->setDefaultHeight($this->getDefaultHeight());
574 $new_obj->update();
575
576 // copy content
577 $this->copyTreeContent(
578 $new_obj,
579 $new_obj->getTree()->readRootId(),
580 $this->getTree()->readRootId()
581 );
582
583 return $new_obj;
584 }
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 592 of file class.ilObjMediaPool.php.

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

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

156 {
158
159 parent::create();
160
161 $ilDB->manipulate("INSERT INTO mep_data " .
162 "(id, default_width, default_height, for_translation) VALUES (" .
163 $ilDB->quote($this->getId(), "integer") . ", " .
164 $ilDB->quote($this->getDefaultWidth(), "integer") . ", " .
165 $ilDB->quote($this->getDefaultHeight(), "integer") . ", " .
166 $ilDB->quote($this->getForTranslation(), "integer") .
167 ")");
168
169 $this->createMepTree();
170 }
createMepTree()
Create media pool tree.
global $ilDB

References ilObject\$db, $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 542 of file class.ilObjMediaPool.php.

543 {
544 // perform save
545 $mep_item = new ilMediaPoolItem();
546 $mep_item->setTitle($a_title);
547 $mep_item->setType("fold");
548 $mep_item->create();
549 if ($mep_item->getId() > 0) {
550 $tree = $this->getTree();
551 $parent = $a_parent > 0
552 ? $a_parent
553 : $tree->getRootId();
554 $this->insertInTree($mep_item->getId(), $parent);
555 return $mep_item->getId();
556 }
557 return false;
558 }
insertInTree($a_obj_id, $a_parent="")
Insert into tree.

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

+ Here is the call graph for this function:

◆ createMepTree()

ilObjMediaPool::createMepTree ( )

Create media pool tree.

Parameters

return

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

179 {
180 // create media pool tree
181 $this->mep_tree = new ilTree($this->getId());
182 $this->mep_tree->setTreeTablePK("mep_id");
183 $this->mep_tree->setTableNames('mep_tree', 'mep_item');
184 $this->mep_tree->addTree($this->getId(), 1);
185 }
getId()
get object id @access public

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

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

234 {
235 // always call parent delete function first!!
236 if (!parent::delete()) {
237 return false;
238 }
239
240 // get childs
241 $childs = $this->mep_tree->getSubTree($this->mep_tree->getNodeData($this->mep_tree->readRootId()));
242
243 // delete tree
244 $this->mep_tree->removeTree($this->mep_tree->getTreeId());
245
246 // delete childs
247 foreach ($childs as $child) {
248 $fid = ilMediaPoolItem::lookupForeignId($child["obj_id"]);
249 switch ($child["type"]) {
250 case "mob":
251 if (ilObject::_lookupType($fid) == "mob") {
252 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
253 $mob = new ilObjMediaObject($fid);
254 $mob->delete();
255 }
256 break;
257 }
258 }
259
260 return true;
261 }
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 454 of file class.ilObjMediaPool.php.

455 {
456 $node_data = $this->mep_tree->getNodeData($obj_id);
457 $subtree = $this->mep_tree->getSubtree($node_data);
458
459 // delete tree
460 if ($this->mep_tree->isInTree($obj_id)) {
461 $this->mep_tree->deleteTree($node_data);
462 }
463
464 // delete objects
465 foreach ($subtree as $node) {
466 $fid = ilMediaPoolItem::lookupForeignId($node["child"]);
467 if ($node["type"] == "mob") {
468 if (ilObject::_lookupType($fid) == "mob") {
469 $obj = new ilObjMediaObject($fid);
470 $obj->delete();
471 }
472 }
473
474 if ($node["type"] == "fold") {
475 if ($fid > 0 && ilObject::_lookupType($fid) == "fold") {
476 $obj = new ilObjFolder($fid, false);
477 $obj->delete();
478 }
479 }
480
481 if ($node["type"] == "pg") {
482 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
483 if (ilPageObject::_exists("mep", $node["child"])) {
484 $pg = new ilMediaPoolPage($node["child"]);
485 $pg->delete();
486 }
487 }
488
489 include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
490 $item = new ilMediaPoolItem($node["child"]);
491 $item->delete();
492 }
493 }
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_mode = "")

Export.

Parameters

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

646 {
647 if (in_array($a_mode, array("master", "masternomedia"))) {
648 include_once("./Services/Export/classes/class.ilExport.php");
649 $exp = new ilExport();
650 $conf = $exp->getConfig("Modules/MediaPool");
651 $conf->setMasterLanguageOnly(true, ($a_mode == "master"));
652 $exp->exportObject($this->getType(), $this->getId(), "4.4.0");
653 }
654 }
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 371 of file class.ilObjMediaPool.php.

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

References $DIC, $ilDB, and $query.

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

+ Here is the caller graph for this function:

◆ getChilds()

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

get childs of node

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

267 {
268 $objs = array();
269 $mobs = array();
270 $pgs = array();
271 if ($obj_id == "") {
272 $obj_id = $this->mep_tree->getRootId();
273 }
274
275 if ($a_type == "fold" || $a_type == "") {
276 $objs = $this->mep_tree->getChildsByType($obj_id, "fold");
277 }
278 if ($a_type == "mob" || $a_type == "") {
279 $mobs = $this->mep_tree->getChildsByType($obj_id, "mob");
280 }
281 foreach ($mobs as $key => $mob) {
282 $objs[] = $mob;
283 }
284 if ($a_type == "pg" || $a_type == "") {
285 $pgs = $this->mep_tree->getChildsByType($obj_id, "pg");
286 }
287 foreach ($pgs as $key => $pg) {
288 $objs[] = $pg;
289 }
290
291 return $objs;
292 }
$key
Definition: croninfo.php:18
$mobs
$a_type
Definition: workflow.php:92

References $a_type, $key, and $mobs.

◆ getChildsExceptFolders()

ilObjMediaPool::getChildsExceptFolders (   $obj_id = "")

get childs of node

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

298 {
299 if ($obj_id == "") {
300 $obj_id = $this->mep_tree->getRootId();
301 }
302
303 $objs = $this->mep_tree->getFilteredChilds(array("fold", "dummy"), $obj_id);
304 return $objs;
305 }

◆ getDefaultHeight()

ilObjMediaPool::getDefaultHeight ( )

Get default height.

Returns
int default height

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

79 {
80 return $this->default_height;
81 }

Referenced by cloneObject().

+ Here is the caller graph for this function:

◆ getDefaultWidth()

ilObjMediaPool::getDefaultWidth ( )

Get default width.

Returns
int default width

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

59 {
60 return $this->default_width;
61 }

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

99 {
101 }

References $for_translation.

◆ getMediaObjects()

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

Get media objects.

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

311 {
313
314 $query = "SELECT DISTINCT mep_tree.*, object_data.* " .
315 "FROM mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) " .
316 " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) ";
317
318 if ($a_format_filter != "" or $a_caption_filter != '') {
319 $query .= " JOIN media_item ON (media_item.mob_id = object_data.obj_id) ";
320 }
321
322 $query .=
323 " WHERE mep_tree.mep_id = " . $ilDB->quote($this->getId(), "integer") .
324 " AND object_data.type = " . $ilDB->quote("mob", "text");
325
326 // filter
327 if (trim($a_title_filter) != "") { // title
328 $query .= " AND " . $ilDB->like("object_data.title", "text", "%" . trim($a_title_filter) . "%");
329 }
330 if ($a_format_filter != "") { // format
331 $filter = ($a_format_filter == "unknown")
332 ? ""
333 : $a_format_filter;
334 $query .= " AND " . $ilDB->equals("media_item.format", $filter, "text", true);
335 }
336 if (trim($a_caption_filter)) {
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 $rec["foreign_id"] = $rec["obj_id"];
347 $rec["obj_id"] = "";
348 $objs[] = $rec;
349 }
350
351 // Keyword filter
352 if ($a_keyword_filter) {
353 include_once './Services/MetaData/classes/class.ilMDKeyword.php';
354 $res = ilMDKeyword::_searchKeywords($a_keyword_filter, 'mob', 0);
355
356 foreach ($objs as $obj) {
357 if (in_array($obj['foreign_id'], $res)) {
358 $filtered[] = $obj;
359 }
360 }
361 return (array) $filtered;
362 }
363 return $objs;
364 }
static _searchKeywords($a_query, $a_type, $a_rbac_id=0)
Search for objects by keywords.
foreach($_POST as $key=> $value) $res

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

+ Here is the call graph for this function:

◆ getParentId()

ilObjMediaPool::getParentId (   $obj_id = "")

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

420 {
421 if ($obj_id == "") {
422 return false;
423 }
424 if ($obj_id == $this->mep_tree->getRootId()) {
425 return false;
426 }
427
428 return $this->mep_tree->getParentId($obj_id);
429 }

◆ getPoolTree()

ilObjMediaPool::getPoolTree ( )

Get pool tree.

Returns
object

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

147 {
148 return self::_getPoolTree($this->getId());
149 }
static _getPoolTree($a_obj_id)
Get Pool Tree.

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

+ Here is the call graph for this function:

◆ getTree()

& ilObjMediaPool::getTree ( )

get media pool folder tree

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

192 {
193 return $this->mep_tree;
194 }

References $mep_tree.

Referenced by copyTreeContent(), and createFolder().

+ Here is the caller graph for this function:

◆ getUsedFormats()

ilObjMediaPool::getUsedFormats ( )

Get used formats.

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

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

References ilObject\$db, $formats, $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 436 of file class.ilObjMediaPool.php.

437 {
438 if (!$this->mep_tree->isInTree($a_obj_id)) {
439 $parent = ($a_parent == "")
440 ? $this->mep_tree->getRootId()
441 : $a_parent;
442 $this->mep_tree->insertNode($a_obj_id, $parent);
443 return true;
444 } else {
445 return false;
446 }
447 }

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

502 {
503 global $DIC;
504
505 $ilDB = $DIC->database();
506
507 $set = $ilDB->query(
508 "SELECT * FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE " .
509 " foreign_id = " . $ilDB->quote($a_foreign_id, "integer") .
510 " AND mep_id = " . $ilDB->quote($a_pool_id, "integer")
511 );
512 if ($rec = $ilDB->fetchAssoc($set)) {
513 return true;
514 }
515 return false;
516 }

References $DIC, and $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 521 of file class.ilObjMediaPool.php.

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

References $DIC, and $ilDB.

◆ read()

ilObjMediaPool::read ( )

Read pool data.

Reimplemented from ilObject.

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

107 {
109
110 parent::read();
111
112 $set = $ilDB->query(
113 "SELECT * FROM mep_data " .
114 " WHERE id = " . $ilDB->quote($this->getId(), "integer")
115 );
116 if ($rec = $ilDB->fetchAssoc($set)) {
117 $this->setDefaultWidth($rec["default_width"]);
118 $this->setDefaultHeight($rec["default_height"]);
119 $this->setForTranslation($rec["for_translation"]);
120 }
121 $this->mep_tree = ilObjMediaPool::_getPoolTree($this->getId());
122 }
setDefaultWidth($a_val)
Set default width.
setDefaultHeight($a_val)
Set default height.
setForTranslation($a_val)
Set for translation.

References ilObject\$db, $ilDB, _getPoolTree(), ilObject\getId(), 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 68 of file class.ilObjMediaPool.php.

69 {
70 $this->default_height = $a_val;
71 }

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

49 {
50 $this->default_width = $a_val;
51 }

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

89 {
90 $this->for_translation = $a_val;
91 }

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

203 {
205
206 if (!parent::update()) {
207 return false;
208 }
209
210 // put here object specific stuff
211 $ilDB->manipulate(
212 "UPDATE mep_data SET " .
213 " default_width = " . $ilDB->quote($this->getDefaultWidth(), "integer") . "," .
214 " default_height = " . $ilDB->quote($this->getDefaultHeight(), "integer") . "," .
215 " for_translation = " . $ilDB->quote($this->getForTranslation(), "integer") . " " .
216 " WHERE id = " . $ilDB->quote($this->getId(), "integer")
217 );
218
219 return true;
220 }
update($pash, $contents, Config $config)

References ilObject\$db, $ilDB, and League\Flysystem\Adapter\Polyfill\update().

+ Here is the call graph for this function:

Field Documentation

◆ $for_translation

ilObjMediaPool::$for_translation = 0

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

Referenced by getForTranslation().

◆ $mep_tree

ilObjMediaPool::$mep_tree
protected

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

Referenced by getTree().


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