ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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)
 
- 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, int $new_obj_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
 
ExportFactoryInterface $export_factory
 
DataFactory $data_factory
 
- 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 28 of file class.ilObjMediaPool.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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

40  {
41  global $DIC;
42 
43  $this->export_factory = new ExportFactory();
44  $this->data_factory = new DataFactory();
45  $this->db = $DIC->database();
46  $this->lng = $DIC->language();
47  // this also calls read() method! (if $a_id is set)
48  $this->type = "mep";
49  parent::__construct($a_id, $a_call_by_reference);
50  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26
__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 113 of file class.ilObjMediaPool.php.

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

Referenced by ilMediaPoolTableGUI\__construct().

113  : ilTree
114  {
115  $tree = new ilTree($a_obj_id);
116  $tree->setTreeTablePK("mep_id");
117  $tree->setTableNames("mep_tree", "mep_item");
118 
119  return $tree;
120  }
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 467 of file class.ilObjMediaPool.php.

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

Referenced by createFolder().

471  : void {
472  // get all childs
473  $nodes = $this->getTree()->getChilds($a_source_parent);
474  foreach ($nodes as $node) {
475  $item = new ilMediaPoolItem();
476  $item->setType($node["type"]);
477  switch ($node["type"]) {
478  case "mob":
479  $mob_id = ilMediaPoolItem::lookupForeignId($node["child"]);
480  $mob = new ilObjMediaObject($mob_id);
481  $new_mob = $mob->duplicate();
482  $item->setForeignId($new_mob->getId());
483  $item->setTitle($new_mob->getTitle());
484  $item->create();
485  break;
486 
487  case "pg":
488  $item->setTitle($node["title"]);
489  $item->create();
490  $page = new ilMediaPoolPage($node["child"]);
491  $new_page = new ilMediaPoolPage();
492  $new_page->setParentId($a_new_obj->getId());
493  $new_page->setId($item->getId());
494  $new_page->create(false);
495 
496  // copy page
497  $page->copy($new_page->getId(), $new_page->getParentType(), $new_page->getParentId(), true);
498  break;
499 
500  case "fold":
501  $item->setTitle($node["title"]);
502  $item->create();
503  break;
504  }
505 
506  // insert item into tree
507  $a_new_obj->insertInTree($item->getId(), $a_target_parent);
508 
509  // handle childs
510  $this->copyTreeContent($a_new_obj, $item->getId(), $node["child"]);
511  }
512  }
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 127 of file class.ilObjMediaPool.php.

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

127  : int
128  {
129  $ilDB = $this->db;
130 
131  $id = parent::create();
132 
133  $this->createMetaData();
134 
135  $ilDB->manipulate("INSERT INTO mep_data " .
136  "(id, default_width, default_height, for_translation) VALUES (" .
137  $ilDB->quote($this->getId(), "integer") . ", " .
138  $ilDB->quote($this->getDefaultWidth(), "integer") . ", " .
139  $ilDB->quote($this->getDefaultHeight(), "integer") . ", " .
140  $ilDB->quote($this->getForTranslation(), "integer") .
141  ")");
142 
143  $this->createMepTree();
144  return $id;
145  }
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 419 of file class.ilObjMediaPool.php.

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

422  : ?int {
423  // perform save
424  $mep_item = new ilMediaPoolItem();
425  $mep_item->setTitle($a_title);
426  $mep_item->setType("fold");
427  $mep_item->create();
428  if ($mep_item->getId() > 0) {
429  $tree = $this->getTree();
430  $parent = $a_parent > 0
431  ? $a_parent
432  : $tree->getRootId();
433  $this->insertInTree($mep_item->getId(), $parent);
434  return $mep_item->getId();
435  }
436  return null;
437  }
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 147 of file class.ilObjMediaPool.php.

References ilObject\getId().

Referenced by create().

147  : void
148  {
149  // create media pool tree
150  $this->mep_tree = new ilTree($this->getId());
151  $this->mep_tree->setTreeTablePK("mep_id");
152  $this->mep_tree->setTableNames('mep_tree', 'mep_item');
153  $this->mep_tree->addTree($this->getId(), 1);
154  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilObjMediaPool::delete ( )

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

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

184  : bool
185  {
186  // always call parent delete function first!!
187  if (!parent::delete()) {
188  return false;
189  }
190 
191  $this->deleteMetaData();
192 
193  // get childs
194  $childs = $this->mep_tree->getSubTree($this->mep_tree->getNodeData($this->mep_tree->readRootId()));
195 
196  // delete tree
197  $this->mep_tree->removeTree($this->mep_tree->getTreeId());
198 
199  // delete childs
200  foreach ($childs as $child) {
201  $fid = ilMediaPoolItem::lookupForeignId($child["obj_id"]);
202  switch ($child["type"]) {
203  case "mob":
204  if (ilObject::_lookupType($fid) === "mob") {
205  $mob = new ilObjMediaObject($fid);
206  $mob->delete();
207  }
208  break;
209  }
210  }
211 
212  return true;
213  }
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 344 of file class.ilObjMediaPool.php.

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

344  : void
345  {
346  $node_data = $this->mep_tree->getNodeData($obj_id);
347  $subtree = $this->mep_tree->getSubTree($node_data);
348 
349  // delete tree
350  if ($this->mep_tree->isInTree($obj_id)) {
351  $this->mep_tree->deleteTree($node_data);
352  }
353 
354  // delete objects
355  foreach ($subtree as $node) {
356  $fid = ilMediaPoolItem::lookupForeignId($node["child"]);
357  if ($node["type"] === "mob" && ilObject::_lookupType($fid) === "mob") {
358  $obj = new ilObjMediaObject($fid);
359  $obj->delete();
360  }
361 
362  if ($node["type"] === "fold" && $fid > 0 && ilObject::_lookupType($fid) === "fold") {
363  $obj = new ilObjFolder($fid, false);
364  $obj->delete();
365  }
366 
367  if ($node["type"] === "pg" && ilPageObject::_exists("mep", $node["child"])) {
368  $pg = new ilMediaPoolPage($node["child"]);
369  $pg->delete();
370  }
371 
372  $item = new ilMediaPoolItem($node["child"]);
373  $item->delete();
374  }
375  }
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:

◆ getAdvMDSubItemTitle()

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

Implements ilAdvancedMetaDataSubItems.

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

528  : string
529  {
531  $snippets = $repo->getItems((int) $a_obj_id);
532  foreach ($snippets as $snippet) {
533  if ((int) $snippet['obj_id'] === (int) $a_sub_id) {
534  return $snippet['title'];
535  }
536  }
537  return '';
538  }
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 262 of file class.ilObjMediaPool.php.

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

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

262  : array
263  {
264  global $DIC;
265 
266  $ilDB = $DIC->database();
267 
268  $query = "SELECT foreign_id as id FROM " .
269  " mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) " .
270  " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) " .
271  " WHERE mep_tree.mep_id = " . $ilDB->quote($a_id, "integer") .
272  " AND mep_item.type = " . $ilDB->quote("mob", "text") .
273  " AND object_data.type = " . $ilDB->quote("mob", "text");
274  $set = $ilDB->query($query);
275  $ids = array();
276  while ($rec = $ilDB->fetchAssoc($set)) {
277  $ids[] = (int) $rec["id"];
278  }
279  return $ids;
280  }
global $DIC
Definition: shib_login.php:26
+ 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 218 of file class.ilObjMediaPool.php.

221  : array {
222  $objs = array();
223  $mobs = array();
224  $pgs = array();
225  if ($obj_id === 0) {
226  $obj_id = $this->mep_tree->getRootId();
227  }
228 
229  if ($a_type === "fold" || $a_type === "") {
230  $objs = $this->mep_tree->getChildsByType($obj_id, "fold");
231  }
232  if ($a_type === "mob" || $a_type === "") {
233  $mobs = $this->mep_tree->getChildsByType($obj_id, "mob");
234  }
235  foreach ($mobs as $key => $mob) {
236  $objs[] = $mob;
237  }
238  if ($a_type === "pg" || $a_type === "") {
239  $pgs = $this->mep_tree->getChildsByType($obj_id, "pg");
240  }
241  foreach ($pgs as $key => $pg) {
242  $objs[] = $pg;
243  }
244 
245  return $objs;
246  }

◆ getChildsExceptFolders()

ilObjMediaPool::getChildsExceptFolders ( int  $obj_id = 0)

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

250  : array {
251  if ($obj_id === 0) {
252  $obj_id = $this->mep_tree->getRootId();
253  }
254 
255  return $this->mep_tree->getFilteredChilds(array("fold", "dummy"), $obj_id);
256  }

◆ getDefaultHeight()

ilObjMediaPool::getDefaultHeight ( )

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

References $default_height.

Referenced by createFolder().

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

◆ getDefaultWidth()

ilObjMediaPool::getDefaultWidth ( )

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

References $default_width.

Referenced by createFolder().

60  : ?int
61  {
62  return $this->default_width;
63  }
+ Here is the caller graph for this function:

◆ getForTranslation()

ilObjMediaPool::getForTranslation ( )

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

References $for_translation.

86  : bool
87  {
89  }

◆ getParentId()

ilObjMediaPool::getParentId ( int  $obj_id = 0)

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

References null.

310  : ?int
311  {
312  if ($obj_id === 0) {
313  return null;
314  }
315  if ($obj_id === $this->mep_tree->getRootId()) {
316  return null;
317  }
318 
319  return (int) $this->mep_tree->getParentId($obj_id);
320  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getPoolTree()

ilObjMediaPool::getPoolTree ( )

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

References ilObject\getId().

122  : ilTree
123  {
124  return self::_getPoolTree($this->getId());
125  }
+ Here is the call graph for this function:

◆ getTree()

ilObjMediaPool::getTree ( )

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

References $mep_tree.

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

156  : ilTree
157  {
158  return $this->mep_tree;
159  }
+ Here is the caller graph for this function:

◆ getUsedFormats()

ilObjMediaPool::getUsedFormats ( )
Returns
string[]

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

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

285  : array
286  {
287  $ilDB = $this->db;
288  $lng = $this->lng;
289 
290  $query = "SELECT DISTINCT media_item.format f FROM mep_tree " .
291  " JOIN mep_item ON (mep_item.obj_id = mep_tree.child) " .
292  " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) " .
293  " JOIN media_item ON (media_item.mob_id = object_data.obj_id) " .
294  " WHERE mep_tree.mep_id = " . $ilDB->quote($this->getId(), "integer") .
295  " AND object_data.type = " . $ilDB->quote("mob", "text") .
296  " ORDER BY f";
297  $formats = array();
298  $set = $ilDB->query($query);
299  while ($rec = $ilDB->fetchAssoc($set)) {
300  if ($rec["f"] != "") {
301  $formats[$rec["f"]] = $rec["f"];
302  } else {
303  $formats["unknown"] = $lng->txt("mep_unknown");
304  }
305  }
306 
307  return $formats;
308  }
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 325 of file class.ilObjMediaPool.php.

Referenced by copyTreeContent(), and createFolder().

328  : bool {
329  if (!$this->mep_tree->isInTree($a_obj_id)) {
330  $parent = (is_null($a_parent))
331  ? $this->mep_tree->getRootId()
332  : $a_parent;
333  $this->mep_tree->insertNode($a_obj_id, $parent);
334  return true;
335  }
336 
337  return false;
338  }
+ 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 380 of file class.ilObjMediaPool.php.

References $DIC, and $ilDB.

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

383  : bool {
384  global $DIC;
385 
386  $ilDB = $DIC->database();
387 
388  $set = $ilDB->query(
389  "SELECT * FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE " .
390  " foreign_id = " . $ilDB->quote($a_foreign_id, "integer") .
391  " AND mep_id = " . $ilDB->quote($a_pool_id, "integer")
392  );
393  if ($rec = $ilDB->fetchAssoc($set)) {
394  return true;
395  }
396  return false;
397  }
global $DIC
Definition: shib_login.php:26
+ 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 402 of file class.ilObjMediaPool.php.

References $DIC, and $ilDB.

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

405  : bool {
406  global $DIC;
407 
408  $ilDB = $DIC->database();
409 
410  $set = $ilDB->query("SELECT * FROM mep_tree WHERE child = " .
411  $ilDB->quote($a_item_id, "integer") .
412  " AND mep_id = " . $ilDB->quote($a_pool_id, "integer"));
413  if ($rec = $ilDB->fetchAssoc($set)) {
414  return true;
415  }
416  return false;
417  }
global $DIC
Definition: shib_login.php:26
+ Here is the caller graph for this function:

◆ read()

ilObjMediaPool::read ( )

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

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

91  : void
92  {
93  $ilDB = $this->db;
94 
95  parent::read();
96 
97  $set = $ilDB->query(
98  "SELECT * FROM mep_data " .
99  " WHERE id = " . $ilDB->quote($this->getId(), "integer")
100  );
101  if ($rec = $ilDB->fetchAssoc($set)) {
102  $this->setDefaultWidth($rec["default_width"]);
103  $this->setDefaultHeight($rec["default_height"]);
104  $this->setForTranslation($rec["for_translation"]);
105  }
106  $this->mep_tree = self::_getPoolTree($this->getId());
107  }
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 65 of file class.ilObjMediaPool.php.

References null.

Referenced by read().

65  : void
66  {
67  if ($a_val === 0) {
68  $a_val = null;
69  }
70  $this->default_height = $a_val;
71  }
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 52 of file class.ilObjMediaPool.php.

References null.

Referenced by read().

52  : void
53  {
54  if ($a_val === 0) {
55  $a_val = null;
56  }
57  $this->default_width = $a_val;
58  }
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 81 of file class.ilObjMediaPool.php.

Referenced by read().

81  : void
82  {
83  $this->for_translation = $a_val;
84  }
+ Here is the caller graph for this function:

◆ update()

ilObjMediaPool::update ( )

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

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

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

Field Documentation

◆ $data_factory

DataFactory ilObjMediaPool::$data_factory
protected

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

◆ $default_height

int ilObjMediaPool::$default_height = null
protected

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

Referenced by getDefaultHeight().

◆ $default_width

int ilObjMediaPool::$default_width = null
protected

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

Referenced by getDefaultWidth().

◆ $export_factory

ExportFactoryInterface ilObjMediaPool::$export_factory
protected

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

◆ $for_translation

bool ilObjMediaPool::$for_translation = false

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

Referenced by getForTranslation().

◆ $mep_tree

ilTree ilObjMediaPool::$mep_tree
protected

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

Referenced by getTree().


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