ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjMediaPool Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct (int $a_id=0, bool $a_call_by_reference=true)
 
 setDefaultWidth (?int $a_val)
 
 getDefaultWidth ()
 
 setDefaultHeight (?int $a_val)
 
 getDefaultHeight ()
 
 setForTranslation (bool $a_val)
 
 getForTranslation ()
 
 read ()
 
 getPoolTree ()
 
 create ()
 
 createMepTree ()
 
 getTree ()
 
 update ()
 
 delete ()
 
 getChilds (int $obj_id=0, string $a_type="")
 
 getChildsExceptFolders (int $obj_id=0)
 
 getUsedFormats ()
 
 getParentId (int $obj_id=0)
 
 insertInTree (int $a_obj_id, ?int $a_parent=null)
 Insert into tree. More...
 
 deleteChild (int $obj_id)
 Delete a child of media tree. More...
 
 createFolder (string $a_title, int $a_parent=0)
 
 copyTreeContent (ilObjMediaPool $a_new_obj, int $a_target_parent, int $a_source_parent)
 
 exportXML (string $a_mode="")
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 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. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _getPoolTree (int $a_obj_id)
 
static getAllMobIds (int $a_id)
 
static isForeignIdInTree (int $a_pool_id, int $a_foreign_id)
 Check whether foreign id is in tree. More...
 
static isItemIdInTree (int $a_pool_id, int $a_item_id)
 Check whether a mep item id is in the media pool. More...
 
static getAdvMDSubItemTitle (int $a_obj_id, string $a_sub_type, int $a_sub_id)
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", ?int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static getIconForType (string $type)
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, ?\ilDBInterface $ilDB=null)
 

Data Fields

bool $for_translation = false
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Protected Attributes

int $default_width = null
 
int $default_height = null
 
ilTree $mep_tree
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
LOMServices $lom_services
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Additional Inherited Members

- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Media pool object

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\lng().

34  {
35  global $DIC;
36 
37  $this->db = $DIC->database();
38  $this->lng = $DIC->language();
39  // this also calls read() method! (if $a_id is set)
40  $this->type = "mep";
41  parent::__construct($a_id, $a_call_by_reference);
42  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _getPoolTree()

static ilObjMediaPool::_getPoolTree ( int  $a_obj_id)
static
Parameters
int$a_obj_idmedia pool id

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

References ilObject\$tree, ilTree\setTableNames(), and ilTree\setTreeTablePK().

Referenced by ilMediaPoolTableGUI\__construct().

105  : ilTree
106  {
107  $tree = new ilTree($a_obj_id);
108  $tree->setTreeTablePK("mep_id");
109  $tree->setTableNames("mep_tree", "mep_item");
110 
111  return $tree;
112  }
ilTree $tree
setTreeTablePK(string $a_column_name)
set column containing primary key in tree table
setTableNames(string $a_table_tree, string $a_table_obj_data, string $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be 'obj_id' You may use...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyTreeContent()

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

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

References ilObject\getId(), getTree(), insertInTree(), and ilMediaPoolItem\lookupForeignId().

Referenced by createFolder().

464  : void {
465  // get all childs
466  $nodes = $this->getTree()->getChilds($a_source_parent);
467  foreach ($nodes as $node) {
468  $item = new ilMediaPoolItem();
469  $item->setType($node["type"]);
470  switch ($node["type"]) {
471  case "mob":
472  $mob_id = ilMediaPoolItem::lookupForeignId($node["child"]);
473  $mob = new ilObjMediaObject($mob_id);
474  $new_mob = $mob->duplicate();
475  $item->setForeignId($new_mob->getId());
476  $item->setTitle($new_mob->getTitle());
477  $item->create();
478  break;
479 
480  case "pg":
481  $item->setTitle($node["title"]);
482  $item->create();
483  $page = new ilMediaPoolPage($node["child"]);
484  $new_page = new ilMediaPoolPage();
485  $new_page->setParentId($a_new_obj->getId());
486  $new_page->setId($item->getId());
487  $new_page->create(false);
488 
489  // copy page
490  $page->copy($new_page->getId(), $new_page->getParentType(), $new_page->getParentId(), true);
491  break;
492 
493  case "fold":
494  $item->setTitle($node["title"]);
495  $item->create();
496  break;
497  }
498 
499  // insert item into tree
500  $a_new_obj->insertInTree($item->getId(), $a_target_parent);
501 
502  // handle childs
503  $this->copyTreeContent($a_new_obj, $item->getId(), $node["child"]);
504  }
505  }
static lookupForeignId(int $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
insertInTree(int $a_obj_id, ?int $a_parent=null)
Insert into tree.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
copyTreeContent(ilObjMediaPool $a_new_obj, int $a_target_parent, int $a_source_parent)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilObjMediaPool::create ( )

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

References ilObject\$db, $id, $ilDB, createMepTree(), and ilObject\createMetaData().

119  : int
120  {
121  $ilDB = $this->db;
122 
123  $id = parent::create();
124 
125  $this->createMetaData();
126 
127  $ilDB->manipulate("INSERT INTO mep_data " .
128  "(id, default_width, default_height, for_translation) VALUES (" .
129  $ilDB->quote($this->getId(), "integer") . ", " .
130  $ilDB->quote($this->getDefaultWidth(), "integer") . ", " .
131  $ilDB->quote($this->getDefaultHeight(), "integer") . ", " .
132  $ilDB->quote($this->getForTranslation(), "integer") .
133  ")");
134 
135  $this->createMepTree();
136  return $id;
137  }
ilDBInterface $db
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ createFolder()

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

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

References ilObject\$tree, ilObject\cloneMetaData(), copyTreeContent(), getDefaultHeight(), getDefaultWidth(), ilObject\getDescription(), ilTree\getRootId(), ilObject\getTitle(), getTree(), insertInTree(), and null.

414  : ?int {
415  // perform save
416  $mep_item = new ilMediaPoolItem();
417  $mep_item->setTitle($a_title);
418  $mep_item->setType("fold");
419  $mep_item->create();
420  if ($mep_item->getId() > 0) {
421  $tree = $this->getTree();
422  $parent = $a_parent > 0
423  ? $a_parent
424  : $tree->getRootId();
425  $this->insertInTree($mep_item->getId(), $parent);
426  return $mep_item->getId();
427  }
428  return null;
429  }
ilTree $tree
insertInTree(int $a_obj_id, ?int $a_parent=null)
Insert into tree.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ createMepTree()

ilObjMediaPool::createMepTree ( )

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

References ilObject\getId().

Referenced by create().

139  : void
140  {
141  // create media pool tree
142  $this->mep_tree = new ilTree($this->getId());
143  $this->mep_tree->setTreeTablePK("mep_id");
144  $this->mep_tree->setTableNames('mep_tree', 'mep_item');
145  $this->mep_tree->addTree($this->getId(), 1);
146  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilObjMediaPool::delete ( )

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

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

176  : bool
177  {
178  // always call parent delete function first!!
179  if (!parent::delete()) {
180  return false;
181  }
182 
183  $this->deleteMetaData();
184 
185  // get childs
186  $childs = $this->mep_tree->getSubTree($this->mep_tree->getNodeData($this->mep_tree->readRootId()));
187 
188  // delete tree
189  $this->mep_tree->removeTree($this->mep_tree->getTreeId());
190 
191  // delete childs
192  foreach ($childs as $child) {
193  $fid = ilMediaPoolItem::lookupForeignId($child["obj_id"]);
194  switch ($child["type"]) {
195  case "mob":
196  if (ilObject::_lookupType($fid) === "mob") {
197  $mob = new ilObjMediaObject($fid);
198  $mob->delete();
199  }
200  break;
201  }
202  }
203 
204  return true;
205  }
static lookupForeignId(int $a_id)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ deleteChild()

ilObjMediaPool::deleteChild ( int  $obj_id)

Delete a child of media tree.

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

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

336  : void
337  {
338  $node_data = $this->mep_tree->getNodeData($obj_id);
339  $subtree = $this->mep_tree->getSubTree($node_data);
340 
341  // delete tree
342  if ($this->mep_tree->isInTree($obj_id)) {
343  $this->mep_tree->deleteTree($node_data);
344  }
345 
346  // delete objects
347  foreach ($subtree as $node) {
348  $fid = ilMediaPoolItem::lookupForeignId($node["child"]);
349  if ($node["type"] === "mob" && ilObject::_lookupType($fid) === "mob") {
350  $obj = new ilObjMediaObject($fid);
351  $obj->delete();
352  }
353 
354  if ($node["type"] === "fold" && $fid > 0 && ilObject::_lookupType($fid) === "fold") {
355  $obj = new ilObjFolder($fid, false);
356  $obj->delete();
357  }
358 
359  if ($node["type"] === "pg" && ilPageObject::_exists("mep", $node["child"])) {
360  $pg = new ilMediaPoolPage($node["child"]);
361  $pg->delete();
362  }
363 
364  $item = new ilMediaPoolItem($node["child"]);
365  $item->delete();
366  }
367  }
Class ilObjFolder.
static lookupForeignId(int $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ exportXML()

ilObjMediaPool::exportXML ( string  $a_mode = "")
Exceptions
ilExportException

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

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

510  : void
511  {
512  if (in_array($a_mode, array("master", "masternomedia"))) {
513  $exp = new ilExport();
514  $conf = $exp->getConfig("components/ILIAS/MediaPool");
515  $conf->setMasterLanguageOnly(true, ($a_mode === "master"));
516  $exp->exportObject($this->getType(), $this->getId(), "4.4.0");
517  }
518  }
+ Here is the call graph for this function:

◆ getAdvMDSubItemTitle()

static ilObjMediaPool::getAdvMDSubItemTitle ( int  $a_obj_id,
string  $a_sub_type,
int  $a_sub_id 
)
static

Implements ilAdvancedMetaDataSubItems.

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

520  : string
521  {
523  $snippets = $repo->getItems((int) $a_obj_id);
524  foreach ($snippets as $snippet) {
525  if ((int) $snippet['obj_id'] === (int) $a_sub_id) {
526  return $snippet['title'];
527  }
528  }
529  return '';
530  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getAllMobIds()

static ilObjMediaPool::getAllMobIds ( int  $a_id)
static
Parameters
int$a_idmedia pool id
Returns
int[] object ids of media objects

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

References $DIC, $ilDB, and ILIAS\Repository\int().

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

254  : array
255  {
256  global $DIC;
257 
258  $ilDB = $DIC->database();
259 
260  $query = "SELECT foreign_id as id FROM " .
261  " mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) " .
262  " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) " .
263  " WHERE mep_tree.mep_id = " . $ilDB->quote($a_id, "integer") .
264  " AND mep_item.type = " . $ilDB->quote("mob", "text") .
265  " AND object_data.type = " . $ilDB->quote("mob", "text");
266  $set = $ilDB->query($query);
267  $ids = array();
268  while ($rec = $ilDB->fetchAssoc($set)) {
269  $ids[] = (int) $rec["id"];
270  }
271  return $ids;
272  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getChilds()

ilObjMediaPool::getChilds ( int  $obj_id = 0,
string  $a_type = "" 
)
Parameters
int$obj_idnode id

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

213  : array {
214  $objs = array();
215  $mobs = array();
216  $pgs = array();
217  if ($obj_id === 0) {
218  $obj_id = $this->mep_tree->getRootId();
219  }
220 
221  if ($a_type === "fold" || $a_type === "") {
222  $objs = $this->mep_tree->getChildsByType($obj_id, "fold");
223  }
224  if ($a_type === "mob" || $a_type === "") {
225  $mobs = $this->mep_tree->getChildsByType($obj_id, "mob");
226  }
227  foreach ($mobs as $key => $mob) {
228  $objs[] = $mob;
229  }
230  if ($a_type === "pg" || $a_type === "") {
231  $pgs = $this->mep_tree->getChildsByType($obj_id, "pg");
232  }
233  foreach ($pgs as $key => $pg) {
234  $objs[] = $pg;
235  }
236 
237  return $objs;
238  }

◆ getChildsExceptFolders()

ilObjMediaPool::getChildsExceptFolders ( int  $obj_id = 0)

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

242  : array {
243  if ($obj_id === 0) {
244  $obj_id = $this->mep_tree->getRootId();
245  }
246 
247  return $this->mep_tree->getFilteredChilds(array("fold", "dummy"), $obj_id);
248  }

◆ getDefaultHeight()

ilObjMediaPool::getDefaultHeight ( )

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

References $default_height.

Referenced by createFolder().

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

◆ getDefaultWidth()

ilObjMediaPool::getDefaultWidth ( )

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

References $default_width.

Referenced by createFolder().

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

◆ getForTranslation()

ilObjMediaPool::getForTranslation ( )

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

References $for_translation.

78  : bool
79  {
81  }

◆ getParentId()

ilObjMediaPool::getParentId ( int  $obj_id = 0)

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

References null.

302  : ?int
303  {
304  if ($obj_id === 0) {
305  return null;
306  }
307  if ($obj_id === $this->mep_tree->getRootId()) {
308  return null;
309  }
310 
311  return (int) $this->mep_tree->getParentId($obj_id);
312  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getPoolTree()

ilObjMediaPool::getPoolTree ( )

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

References ilObject\getId().

114  : ilTree
115  {
116  return self::_getPoolTree($this->getId());
117  }
+ Here is the call graph for this function:

◆ getTree()

ilObjMediaPool::getTree ( )

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

References $mep_tree.

Referenced by ilMediaPoolExplorerGUI\__construct(), copyTreeContent(), and createFolder().

148  : ilTree
149  {
150  return $this->mep_tree;
151  }
+ Here is the caller graph for this function:

◆ getUsedFormats()

ilObjMediaPool::getUsedFormats ( )
Returns
string[]

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

References ilObject\$db, $ilDB, ilObject\$lng, ilObject\getId(), and ilLanguage\txt().

277  : array
278  {
279  $ilDB = $this->db;
280  $lng = $this->lng;
281 
282  $query = "SELECT DISTINCT media_item.format f FROM mep_tree " .
283  " JOIN mep_item ON (mep_item.obj_id = mep_tree.child) " .
284  " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) " .
285  " JOIN media_item ON (media_item.mob_id = object_data.obj_id) " .
286  " WHERE mep_tree.mep_id = " . $ilDB->quote($this->getId(), "integer") .
287  " AND object_data.type = " . $ilDB->quote("mob", "text") .
288  " ORDER BY f";
289  $formats = array();
290  $set = $ilDB->query($query);
291  while ($rec = $ilDB->fetchAssoc($set)) {
292  if ($rec["f"] != "") {
293  $formats[$rec["f"]] = $rec["f"];
294  } else {
295  $formats["unknown"] = $lng->txt("mep_unknown");
296  }
297  }
298 
299  return $formats;
300  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilLanguage $lng
ilDBInterface $db
+ Here is the call graph for this function:

◆ insertInTree()

ilObjMediaPool::insertInTree ( int  $a_obj_id,
?int  $a_parent = null 
)

Insert into tree.

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

Referenced by copyTreeContent(), and createFolder().

320  : bool {
321  if (!$this->mep_tree->isInTree($a_obj_id)) {
322  $parent = (is_null($a_parent))
323  ? $this->mep_tree->getRootId()
324  : $a_parent;
325  $this->mep_tree->insertNode($a_obj_id, $parent);
326  return true;
327  }
328 
329  return false;
330  }
+ Here is the caller graph for this function:

◆ isForeignIdInTree()

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

Check whether foreign id is in tree.

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

References $DIC, and $ilDB.

Referenced by ILIAS\MediaPool\MediaPoolManager\copyItemFromEditClipboard().

375  : bool {
376  global $DIC;
377 
378  $ilDB = $DIC->database();
379 
380  $set = $ilDB->query(
381  "SELECT * FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE " .
382  " foreign_id = " . $ilDB->quote($a_foreign_id, "integer") .
383  " AND mep_id = " . $ilDB->quote($a_pool_id, "integer")
384  );
385  if ($rec = $ilDB->fetchAssoc($set)) {
386  return true;
387  }
388  return false;
389  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ isItemIdInTree()

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

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

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

References $DIC, and $ilDB.

Referenced by ILIAS\MediaPool\MediaPoolManager\copyItemFromEditClipboard().

397  : bool {
398  global $DIC;
399 
400  $ilDB = $DIC->database();
401 
402  $set = $ilDB->query("SELECT * FROM mep_tree WHERE child = " .
403  $ilDB->quote($a_item_id, "integer") .
404  " AND mep_id = " . $ilDB->quote($a_pool_id, "integer"));
405  if ($rec = $ilDB->fetchAssoc($set)) {
406  return true;
407  }
408  return false;
409  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ read()

ilObjMediaPool::read ( )

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

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

83  : void
84  {
85  $ilDB = $this->db;
86 
87  parent::read();
88 
89  $set = $ilDB->query(
90  "SELECT * FROM mep_data " .
91  " WHERE id = " . $ilDB->quote($this->getId(), "integer")
92  );
93  if ($rec = $ilDB->fetchAssoc($set)) {
94  $this->setDefaultWidth($rec["default_width"]);
95  $this->setDefaultHeight($rec["default_height"]);
96  $this->setForTranslation($rec["for_translation"]);
97  }
98  $this->mep_tree = self::_getPoolTree($this->getId());
99  }
setForTranslation(bool $a_val)
ilDBInterface $db
setDefaultWidth(?int $a_val)
setDefaultHeight(?int $a_val)
+ Here is the call graph for this function:

◆ setDefaultHeight()

ilObjMediaPool::setDefaultHeight ( ?int  $a_val)

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

References null.

Referenced by read().

57  : void
58  {
59  if ($a_val === 0) {
60  $a_val = null;
61  }
62  $this->default_height = $a_val;
63  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ setDefaultWidth()

ilObjMediaPool::setDefaultWidth ( ?int  $a_val)

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

References null.

Referenced by read().

44  : void
45  {
46  if ($a_val === 0) {
47  $a_val = null;
48  }
49  $this->default_width = $a_val;
50  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ setForTranslation()

ilObjMediaPool::setForTranslation ( bool  $a_val)
Parameters
bool$a_vallm has been imported for translation purposes

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

Referenced by read().

73  : void
74  {
75  $this->for_translation = $a_val;
76  }
+ Here is the caller graph for this function:

◆ update()

ilObjMediaPool::update ( )

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

References ilObject\$db, $ilDB, and ilObject\updateMetaData().

153  : bool
154  {
155  $ilDB = $this->db;
156 
157  if (!parent::update()) {
158  return false;
159  }
160 
161  $this->updateMetaData();
162 
163  // put here object specific stuff
164  $ilDB->manipulate(
165  "UPDATE mep_data SET " .
166  " default_width = " . $ilDB->quote($this->getDefaultWidth(), "integer") . "," .
167  " default_height = " . $ilDB->quote($this->getDefaultHeight(), "integer") . "," .
168  " for_translation = " . $ilDB->quote($this->getForTranslation(), "integer") . " " .
169  " WHERE id = " . $ilDB->quote($this->getId(), "integer")
170  );
171 
172  return true;
173  }
ilDBInterface $db
+ Here is the call graph for this function:

Field Documentation

◆ $default_height

int ilObjMediaPool::$default_height = null
protected

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

Referenced by getDefaultHeight().

◆ $default_width

int ilObjMediaPool::$default_width = null
protected

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

Referenced by getDefaultWidth().

◆ $for_translation

bool ilObjMediaPool::$for_translation = false

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

Referenced by getForTranslation().

◆ $mep_tree

ilTree ilObjMediaPool::$mep_tree
protected

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

Referenced by getTree().


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