ILIAS  release_8 Revision v8.24
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 ()
 note: title, description and type should be set when this function is called More...
 
 createMepTree ()
 
 getTree ()
 
 update ()
 
 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...
 
 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
 __construct (int $id=0, bool $reference=true)
 
 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 $desc)
 
 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 _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)
 
static getAdvMDSubItemTitle (int $a_obj_id, string $a_sub_type, int $a_sub_id)
 

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
 
int $id
 
bool $referenced
 
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 = ""
 
bool $offline = false
 
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  $id = 0,
bool  $reference = true 
)
Parameters
int$idreference_id or object_id
bool$referencebool treat the id as reference_id (true) or object_id (false)

Reimplemented from ilObject.

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

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: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ 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.

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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...

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

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

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

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

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

+ Here is the call graph for this function:

◆ create()

ilObjMediaPool::create ( )

note: title, description and type should be set when this function is called

Reimplemented from ilObject.

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

119 : int
120 {
122
123 $id = parent::create();
124
125 $ilDB->manipulate("INSERT INTO mep_data " .
126 "(id, default_width, default_height, for_translation) VALUES (" .
127 $ilDB->quote($this->getId(), "integer") . ", " .
128 $ilDB->quote($this->getDefaultWidth(), "integer") . ", " .
129 $ilDB->quote($this->getDefaultHeight(), "integer") . ", " .
130 $ilDB->quote($this->getForTranslation(), "integer") .
131 ")");
132
133 $this->createMepTree();
134 return $id;
135 }
ilDBInterface $db

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

+ Here is the call graph for this function:

◆ createFolder()

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

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

408 : ?int {
409 // perform save
410 $mep_item = new ilMediaPoolItem();
411 $mep_item->setTitle($a_title);
412 $mep_item->setType("fold");
413 $mep_item->create();
414 if ($mep_item->getId() > 0) {
415 $tree = $this->getTree();
416 $parent = $a_parent > 0
417 ? $a_parent
418 : $tree->getRootId();
419 $this->insertInTree($mep_item->getId(), $parent);
420 return $mep_item->getId();
421 }
422 return null;
423 }

◆ createMepTree()

ilObjMediaPool::createMepTree ( )

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

137 : void
138 {
139 // create media pool tree
140 $this->mep_tree = new ilTree($this->getId());
141 $this->mep_tree->setTreeTablePK("mep_id");
142 $this->mep_tree->setTableNames('mep_tree', 'mep_item');
143 $this->mep_tree->addTree($this->getId(), 1);
144 }

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 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!!

Returns
bool true if object was removed completely; false if only a references was removed

Reimplemented from ilObject.

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

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

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

+ Here is the call graph for this function:

◆ deleteChild()

ilObjMediaPool::deleteChild ( int  $obj_id)

Delete a child of media tree.

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

330 : void
331 {
332 $node_data = $this->mep_tree->getNodeData($obj_id);
333 $subtree = $this->mep_tree->getSubTree($node_data);
334
335 // delete tree
336 if ($this->mep_tree->isInTree($obj_id)) {
337 $this->mep_tree->deleteTree($node_data);
338 }
339
340 // delete objects
341 foreach ($subtree as $node) {
342 $fid = ilMediaPoolItem::lookupForeignId($node["child"]);
343 if ($node["type"] === "mob" && ilObject::_lookupType($fid) === "mob") {
344 $obj = new ilObjMediaObject($fid);
345 $obj->delete();
346 }
347
348 if ($node["type"] === "fold" && $fid > 0 && ilObject::_lookupType($fid) === "fold") {
349 $obj = new ilObjFolder($fid, false);
350 $obj->delete();
351 }
352
353 if ($node["type"] === "pg" && ilPageObject::_exists("mep", $node["child"])) {
354 $pg = new ilMediaPoolPage($node["child"]);
355 $pg->delete();
356 }
357
358 $item = new ilMediaPoolItem($node["child"]);
359 $item->delete();
360 }
361 }
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.

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

+ Here is the call graph for this function:

◆ exportXML()

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

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

502 : void
503 {
504 if (in_array($a_mode, array("master", "masternomedia"))) {
505 $exp = new ilExport();
506 $conf = $exp->getConfig("Modules/MediaPool");
507 $conf->setMasterLanguageOnly(true, ($a_mode === "master"));
508 $exp->exportObject($this->getType(), $this->getId(), "4.4.0");
509 }
510 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Survey\Mode\getId().

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

512 : string
513 {
515 $snippets = $repo->getItems((int) $a_obj_id);
516 foreach ($snippets as $snippet) {
517 if ((int) $snippet['obj_id'] === (int) $a_sub_id) {
518 return $snippet['title'];
519 }
520 }
521 return '';
522 }

◆ getAllMobIds()

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

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

248 : array
249 {
250 global $DIC;
251
252 $ilDB = $DIC->database();
253
254 $query = "SELECT foreign_id as id FROM " .
255 " mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) " .
256 " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) " .
257 " WHERE mep_tree.mep_id = " . $ilDB->quote($a_id, "integer") .
258 " AND mep_item.type = " . $ilDB->quote("mob", "text") .
259 " AND object_data.type = " . $ilDB->quote("mob", "text");
260 $set = $ilDB->query($query);
261 $ids = array();
262 while ($rec = $ilDB->fetchAssoc($set)) {
263 $ids[] = (int) $rec["id"];
264 }
265 return $ids;
266 }
$query

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

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

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

207 : array {
208 $objs = array();
209 $mobs = array();
210 $pgs = array();
211 if ($obj_id === 0) {
212 $obj_id = $this->mep_tree->getRootId();
213 }
214
215 if ($a_type === "fold" || $a_type === "") {
216 $objs = $this->mep_tree->getChildsByType($obj_id, "fold");
217 }
218 if ($a_type === "mob" || $a_type === "") {
219 $mobs = $this->mep_tree->getChildsByType($obj_id, "mob");
220 }
221 foreach ($mobs as $key => $mob) {
222 $objs[] = $mob;
223 }
224 if ($a_type === "pg" || $a_type === "") {
225 $pgs = $this->mep_tree->getChildsByType($obj_id, "pg");
226 }
227 foreach ($pgs as $key => $pg) {
228 $objs[] = $pg;
229 }
230
231 return $objs;
232 }
$mobs
Definition: imgupload.php:70
string $key
Consumer key/client ID value.
Definition: System.php:193

◆ getChildsExceptFolders()

ilObjMediaPool::getChildsExceptFolders ( int  $obj_id = 0)

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

236 : array {
237 if ($obj_id === 0) {
238 $obj_id = $this->mep_tree->getRootId();
239 }
240
241 return $this->mep_tree->getFilteredChilds(array("fold", "dummy"), $obj_id);
242 }

◆ getDefaultHeight()

ilObjMediaPool::getDefaultHeight ( )

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

65 : ?int
66 {
68 }

References $default_height.

◆ getDefaultWidth()

ilObjMediaPool::getDefaultWidth ( )

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

52 : ?int
53 {
55 }

References $default_width.

◆ getForTranslation()

ilObjMediaPool::getForTranslation ( )

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

78 : bool
79 {
81 }

References $for_translation.

◆ getParentId()

ilObjMediaPool::getParentId ( int  $obj_id = 0)

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

296 : ?int
297 {
298 if ($obj_id === 0) {
299 return null;
300 }
301 if ($obj_id === $this->mep_tree->getRootId()) {
302 return null;
303 }
304
305 return (int) $this->mep_tree->getParentId($obj_id);
306 }

◆ getPoolTree()

ilObjMediaPool::getPoolTree ( )

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

114 : ilTree
115 {
116 return self::_getPoolTree($this->getId());
117 }
static _getPoolTree(int $a_obj_id)

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

+ Here is the call graph for this function:

◆ getTree()

ilObjMediaPool::getTree ( )

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

146 : ilTree
147 {
148 return $this->mep_tree;
149 }

References $mep_tree.

Referenced by ilMediaPoolExplorerGUI\__construct().

+ Here is the caller graph for this function:

◆ getUsedFormats()

ilObjMediaPool::getUsedFormats ( )
Returns
string[]

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

271 : array
272 {
275
276 $query = "SELECT DISTINCT media_item.format f FROM mep_tree " .
277 " JOIN mep_item ON (mep_item.obj_id = mep_tree.child) " .
278 " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) " .
279 " JOIN media_item ON (media_item.mob_id = object_data.obj_id) " .
280 " WHERE mep_tree.mep_id = " . $ilDB->quote($this->getId(), "integer") .
281 " AND object_data.type = " . $ilDB->quote("mob", "text") .
282 " ORDER BY f";
283 $formats = array();
284 $set = $ilDB->query($query);
285 while ($rec = $ilDB->fetchAssoc($set)) {
286 if ($rec["f"] != "") {
287 $formats[$rec["f"]] = $rec["f"];
288 } else {
289 $formats["unknown"] = $lng->txt("mep_unknown");
290 }
291 }
292
293 return $formats;
294 }
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
$formats
Definition: date.php:77

References $formats, $ilDB, $lng, $query, and ILIAS\Survey\Mode\getId().

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

314 : bool {
315 if (!$this->mep_tree->isInTree($a_obj_id)) {
316 $parent = (is_null($a_parent))
317 ? $this->mep_tree->getRootId()
318 : $a_parent;
319 $this->mep_tree->insertNode($a_obj_id, $parent);
320 return true;
321 }
322
323 return false;
324 }

Referenced by copyTreeContent().

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

369 : bool {
370 global $DIC;
371
372 $ilDB = $DIC->database();
373
374 $set = $ilDB->query(
375 "SELECT * FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE " .
376 " foreign_id = " . $ilDB->quote($a_foreign_id, "integer") .
377 " AND mep_id = " . $ilDB->quote($a_pool_id, "integer")
378 );
379 if ($rec = $ilDB->fetchAssoc($set)) {
380 return true;
381 }
382 return false;
383 }

Referenced by ilObjMediaPoolGUI\insertFromClipboard().

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

391 : bool {
392 global $DIC;
393
394 $ilDB = $DIC->database();
395
396 $set = $ilDB->query("SELECT * FROM mep_tree WHERE child = " .
397 $ilDB->quote($a_item_id, "integer") .
398 " AND mep_id = " . $ilDB->quote($a_pool_id, "integer"));
399 if ($rec = $ilDB->fetchAssoc($set)) {
400 return true;
401 }
402 return false;
403 }

Referenced by ilObjMediaPoolGUI\insertFromClipboard().

+ Here is the caller graph for this function:

◆ read()

ilObjMediaPool::read ( )

Reimplemented from ilObject.

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

83 : void
84 {
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 }
setDefaultWidth(?int $a_val)
setDefaultHeight(?int $a_val)
setForTranslation(bool $a_val)

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

+ Here is the call graph for this function:

◆ setDefaultHeight()

ilObjMediaPool::setDefaultHeight ( ?int  $a_val)

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

57 : void
58 {
59 if ($a_val === 0) {
60 $a_val = null;
61 }
62 $this->default_height = $a_val;
63 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDefaultWidth()

ilObjMediaPool::setDefaultWidth ( ?int  $a_val)

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

44 : void
45 {
46 if ($a_val === 0) {
47 $a_val = null;
48 }
49 $this->default_width = $a_val;
50 }

Referenced by read().

+ 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.

73 : void
74 {
75 $this->for_translation = $a_val;
76 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilObjMediaPool::update ( )

Reimplemented from ilObject.

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

151 : bool
152 {
154
155 if (!parent::update()) {
156 return false;
157 }
158
159 // put here object specific stuff
160 $ilDB->manipulate(
161 "UPDATE mep_data SET " .
162 " default_width = " . $ilDB->quote($this->getDefaultWidth(), "integer") . "," .
163 " default_height = " . $ilDB->quote($this->getDefaultHeight(), "integer") . "," .
164 " for_translation = " . $ilDB->quote($this->getForTranslation(), "integer") . " " .
165 " WHERE id = " . $ilDB->quote($this->getId(), "integer")
166 );
167
168 return true;
169 }

References ilObject\$db, and $ilDB.

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: