ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilMediaCreationGUI Class Reference
+ Collaboration diagram for ilMediaCreationGUI:

Public Member Functions

 __construct (array $accept_types, Closure $after_upload, Closure $after_url_saving, Closure $after_pool_insert, ?Closure $finish_single_upload=null, ?Closure $on_mob_update=null)
 
 setAllSuffixes (array $a_val)
 
 getAllSuffixes ()
 
 setAllMimeTypes (array $a_val)
 
 getAllMimeTypes ()
 
 executeCommand ()
 
 getUploadForm ()
 
 initUrlForm ()
 
 initPoolSelection ()
 
 performBulkUpload ()
 Save bulk upload form. More...
 
 initMediaBulkForm (string $a_id, string $a_title)
 
 listPoolItems ()
 Insert media object from pool. More...
 
 selectPool ()
 Select concrete pool. More...
 
 poolSelection ()
 

Data Fields

const TYPE_VIDEO = 1
 
const TYPE_AUDIO = 2
 
const TYPE_IMAGE = 3
 
const TYPE_OTHER = 4
 
const TYPE_ALL = 5
 
const POOL_VIEW_FOLDER = "fold"
 
const POOL_VIEW_ALL = "all"
 

Protected Member Functions

 getSuffixes ()
 
 getMimeTypes ($local_only=false)
 
 creationSelection ()
 
 handleUploadResult (FileUpload $upload, UploadResult $result)
 
 editTitlesAndDescriptions ()
 
 saveTitlesAndDescriptions ()
 
 cancel ()
 
 cancelCreate ()
 
 saveUrl ()
 
 applyFilter ()
 
 resetFilter ()
 
 getPoolTable ()
 
 insertFromPool ()
 Insert media from pool. More...
 

Protected Attributes

ILIAS MediaObjects MediaType MediaTypeManager $type_manager
 
InternalGUIService $gui
 
FormAdapterGUI $bulk_upload_form = null
 
CreationGUIRequest $request
 
array $accept_types = [1,2,3,4]
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $main_tpl
 
Closure $after_upload
 
Closure $after_url_saving
 
Closure $after_pool_insert
 
Closure $finish_single_upload
 
Closure $on_mob_update
 
ilAccessHandler $access
 
array $all_suffixes = []
 
array $all_mime_types = []
 
ILIAS DI UIServices $ui
 
int $requested_mep
 
string $pool_view = self::POOL_VIEW_FOLDER
 
ILIAS FileUpload FileUpload $upload
 
ilLogger $mob_log
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMediaCreationGUI::__construct ( array  $accept_types,
Closure  $after_upload,
Closure  $after_url_saving,
Closure  $after_pool_insert,
?Closure  $finish_single_upload = null,
?Closure  $on_mob_update = null 
)

Definition at line 70 of file class.ilMediaCreationGUI.php.

77 {
78 global $DIC;
79
80 $this->lng = $DIC->language();
81 $this->lng->loadLanguageModule("mob");
82 $this->lng->loadLanguageModule("content");
83 $this->access = $DIC->access();
84
85 $this->ctrl = $DIC->ctrl();
86 $this->main_tpl = $DIC->ui()->mainTemplate();
87 $this->ui = $DIC->ui();
88 $this->upload = $DIC->upload();
89 $this->mob_log = $DIC->logger()->mob();
90
91 $this->accept_types = $accept_types;
92 $this->after_upload = $after_upload;
93 $this->after_url_saving = $after_url_saving;
94 $this->after_pool_insert = $after_pool_insert;
95 $this->finish_single_upload = $finish_single_upload;
96 $this->on_mob_update = $on_mob_update;
97 $this->type_manager = $DIC->mediaObjects()
98 ->internal()
99 ->domain()
100 ->mediaType();
101
102 $this->ctrl->saveParameter($this, ["mep", "pool_view"]);
103
104 $this->request = $DIC->mediaObjects()
105 ->internal()
106 ->gui()
107 ->creation()
108 ->request();
109
110 $this->requested_mep = $this->request->getMediaPoolId();
111 $this->ctrl->setParameter($this, "mep", $this->requested_mep);
112
113 $pv = $this->request->getPoolView();
114 $this->pool_view = (in_array($pv, [self::POOL_VIEW_FOLDER, self::POOL_VIEW_ALL]))
115 ? $pv
116 : self::POOL_VIEW_FOLDER;
117 $this->gui = $DIC->mediaObjects()->internal()->gui();
118 }
global $DIC
Definition: shib_login.php:26

References $accept_types, $after_pool_insert, $after_upload, $after_url_saving, $DIC, $finish_single_upload, $on_mob_update, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\ui(), and ILIAS\Repository\upload().

+ Here is the call graph for this function:

Member Function Documentation

◆ applyFilter()

ilMediaCreationGUI::applyFilter ( )
protected

Definition at line 705 of file class.ilMediaCreationGUI.php.

705 : void
706 {
707 $mpool_table = $this->getPoolTable();
708 $mpool_table->resetOffset();
709 $mpool_table->writeFilterToSession();
710 $this->ctrl->redirect($this, "listPoolItems");
711 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ cancel()

ilMediaCreationGUI::cancel ( )
protected

Definition at line 563 of file class.ilMediaCreationGUI.php.

563 : void
564 {
566 $ctrl->returnToParent($this);
567 }
returnToParent(object $a_gui_obj, ?string $a_anchor=null)
@inheritDoc

References ilCtrl\returnToParent().

+ Here is the call graph for this function:

◆ cancelCreate()

ilMediaCreationGUI::cancelCreate ( )
protected

Definition at line 569 of file class.ilMediaCreationGUI.php.

569 : void
570 {
572 $ctrl->returnToParent($this);
573 }

References ilCtrl\returnToParent().

+ Here is the call graph for this function:

◆ creationSelection()

ilMediaCreationGUI::creationSelection ( )
protected

Definition at line 215 of file class.ilMediaCreationGUI.php.

215 : void
216 {
218
219 $acc = new \ilAccordionGUI();
220 $acc->setBehaviour(\ilAccordionGUI::FIRST_OPEN);
221 $cnt = 1;
222 $forms = [
223 $this->getUploadForm(),
224 $this->initUrlForm(),
225 $this->initPoolSelection()
226 ];
227 foreach ($forms as $form_type => $cf) {
228 $htpl = new \ilTemplate("tpl.creation_acc_head.html", true, true, "components/ILIAS/ILIASObject");
229
230 // using custom form titles (used for repository plugins)
231 $form_title = "";
232 if (method_exists($this, "getCreationFormTitle")) {
233 $form_title = $this->getCreationFormTitle($form_type);
234 }
235 if (!$form_title) {
236 $form_title = $cf->getTitle();
237 }
238
239 // move title from form to accordion
240 $htpl->setVariable("TITLE", $this->lng->txt("option") . " " . $cnt . ": " .
241 $form_title);
242 if (!($cf instanceof FormAdapterGUI)) {
243 $cf->setTitle("");
244 $cf->setTitleIcon("");
245 $cf->setTableWidth("100%");
246
247 $acc->addItem($htpl->get(), $cf->getHTML());
248 } else {
249 $acc->addItem($htpl->get(), $cf->render());
250 }
251
252 $cnt++;
253 }
254 $main_tpl->setContent($acc->getHTML());
255 }
ilGlobalTemplateInterface $main_tpl
setContent(string $a_html)
Sets content for standard template.

References ilAccordionGUI\FIRST_OPEN, ILIAS\Repository\lng(), and ILIAS\UICore\GlobalTemplate\setContent().

+ Here is the call graph for this function:

◆ editTitlesAndDescriptions()

ilMediaCreationGUI::editTitlesAndDescriptions ( )
protected

Definition at line 474 of file class.ilMediaCreationGUI.php.

474 : void
475 {
478
479 $ctrl->saveParameter($this, "mep_hash");
480
482
483 $media_items = ilMediaItem::getMediaItemsForUploadHash($this->request->getUploadHash());
484
485 $tb = new ilToolbarGUI();
486 $tb->setFormAction($ctrl->getFormAction($this));
487 $tb->addFormButton($lng->txt("save"), "saveTitlesAndDescriptions");
488 $tb->setOpenFormTag(true);
489 $tb->setCloseFormTag(false);
490 $tb->setId("tb_top");
491
492 if (count($media_items) == 1 && $this->finish_single_upload) {
493 $mi = current($media_items);
494 ($this->finish_single_upload)($mi["mob_id"]);
495 return;
496 }
497
498 $html = $tb->getHTML();
499 foreach ($media_items as $mi) {
500 $acc = new ilAccordionGUI();
501 $acc->setBehaviour(ilAccordionGUI::ALL_CLOSED);
502 $acc->setId("acc_" . $mi["mob_id"]);
503
504 $mob = new ilObjMediaObject($mi["mob_id"]);
505 $form = $this->initMediaBulkForm($mi["mob_id"], $mob->getTitle());
506 $acc->addItem($mob->getTitle(), $form->getHTML());
507
508 $html .= $acc->getHTML();
509 }
510
511 $html .= $tb->getHTML();
512 $tb->setOpenFormTag(false);
513 $tb->setCloseFormTag(true);
514 $tb->setId("tb_bottom");
515
516 $main_tpl->setContent($html);
517 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getFormAction(object $a_gui_obj, ?string $a_fallback_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
saveParameter(object $a_gui_obj, $a_parameter)
@inheritDoc
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...
initMediaBulkForm(string $a_id, string $a_title)
static getMediaItemsForUploadHash(string $a_hash)
Get media items for upload hash.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $lng, ilAccordionGUI\ALL_CLOSED, ilCtrl\getFormAction(), ilMediaItem\getMediaItemsForUploadHash(), ilCtrl\saveParameter(), and ILIAS\UICore\GlobalTemplate\setContent().

+ Here is the call graph for this function:

◆ executeCommand()

ilMediaCreationGUI::executeCommand ( )

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

187 : void
188 {
190
191 $next_class = $ctrl->getNextClass($this);
192 $cmd = $ctrl->getCmd("creationSelection");
193
194 switch ($next_class) {
195 case "ilpropertyformgui":
196 $form = $this->initPoolSelection();
197 $ctrl->forwardCommand($form);
198 break;
199
200 case strtolower(ilRepoStandardUploadHandlerGUI::class):
201 $form = $this->getUploadForm();
202 $gui = $form->getRepoStandardUploadHandlerGUI("media_files");
203 $this->ctrl->forwardCommand($gui);
204 break;
205
206 default:
207 if (in_array($cmd, ["creationSelection", "uploadFile", "saveUrl", "cancel", "cancelCreate", "listPoolItems",
208 "insertFromPool", "poolSelection", "selectPool", "applyFilter", "resetFilter", "performBulkUpload",
209 "editTitlesAndDescriptions", "saveTitlesAndDescriptions"])) {
210 $this->$cmd();
211 }
212 }
213 }
getNextClass($a_gui_class=null)
@inheritDoc
forwardCommand(object $a_gui_object)
@inheritDoc
getCmd(?string $fallback_command=null)
@inheritDoc

References ILIAS\Repository\ctrl(), ilCtrl\forwardCommand(), ilCtrl\getCmd(), and ilCtrl\getNextClass().

+ Here is the call graph for this function:

◆ getAllMimeTypes()

ilMediaCreationGUI::getAllMimeTypes ( )
Returns
string[]

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

140 : array
141 {
143 }

◆ getAllSuffixes()

ilMediaCreationGUI::getAllSuffixes ( )

Definition at line 126 of file class.ilMediaCreationGUI.php.

126 : array
127 {
128 return $this->all_suffixes;
129 }

◆ getMimeTypes()

ilMediaCreationGUI::getMimeTypes (   $local_only = false)
protected
Returns
string[]

Definition at line 169 of file class.ilMediaCreationGUI.php.

169 : array
170 {
171 $mimes = [];
172 if (in_array(self::TYPE_ALL, $this->accept_types)) {
173 $mimes = iterator_to_array($this->type_manager->getAllowedMimeTypes());
174 }
175 if (in_array(self::TYPE_VIDEO, $this->accept_types)) {
176 $mimes = array_merge($mimes, iterator_to_array($this->type_manager->getAllowedVideoMimeTypes($local_only)));
177 }
178 if (in_array(self::TYPE_AUDIO, $this->accept_types)) {
179 $mimes = array_merge($mimes, iterator_to_array($this->type_manager->getAllowedAudioMimeTypes()));
180 }
181 if (in_array(self::TYPE_IMAGE, $this->accept_types)) {
182 $mimes = array_merge($mimes, iterator_to_array($this->type_manager->getAllowedImageMimeTypes()));
183 }
184 return $mimes;
185 }

◆ getPoolTable()

ilMediaCreationGUI::getPoolTable ( )
protected

Definition at line 721 of file class.ilMediaCreationGUI.php.

722 {
723 $pool = new ilObjMediaPool($this->requested_mep);
724 $mpool_table = new ilMediaPoolTableGUI(
725 $this,
726 "listPoolItems",
727 $pool,
728 "mep_folder",
730 $this->pool_view == self::POOL_VIEW_ALL
731 );
732 $mpool_table->setFilterCommand("applyFilter");
733 $mpool_table->setResetCommand("resetFilter");
734 $mpool_table->setInsertCommand("insertFromPool");
735 return $mpool_table;
736 }
TableGUI class for recent changes in wiki.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilMediaPoolTableGUI\IL_MEP_SELECT.

◆ getSuffixes()

ilMediaCreationGUI::getSuffixes ( )
protected
Returns
string[]

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

148 : array
149 {
150 $suffixes = [];
151 if (in_array(self::TYPE_ALL, $this->accept_types, true)) {
152 $suffixes = iterator_to_array($this->type_manager->getAllowedSuffixes());
153 }
154 if (in_array(self::TYPE_VIDEO, $this->accept_types, true)) {
155 $suffixes = array_merge($suffixes, iterator_to_array($this->type_manager->getAllowedVideoSuffixes()));
156 }
157 if (in_array(self::TYPE_AUDIO, $this->accept_types, true)) {
158 $suffixes = array_merge($suffixes, iterator_to_array($this->type_manager->getAllowedAudioSuffixes()));
159 }
160 if (in_array(self::TYPE_IMAGE, $this->accept_types, true)) {
161 $suffixes = array_merge($suffixes, iterator_to_array($this->type_manager->getAllowedImageSuffixes()));
162 }
163 return $suffixes;
164 }

◆ getUploadForm()

ilMediaCreationGUI::getUploadForm ( )

Definition at line 257 of file class.ilMediaCreationGUI.php.

258 {
259 // $item->setSuffixes($this->getSuffixes());
260 if (is_null($this->bulk_upload_form)) {
261 $mep_hash = uniqid();
262 $this->ctrl->setParameter($this, "mep_hash", $mep_hash);
263 $this->bulk_upload_form = $this->gui
264 ->form([self::class], 'performBulkUpload')
265 ->section("props", $this->lng->txt('mob_upload_file'))
266 ->file(
267 "media_files",
268 $this->lng->txt("files"),
269 \Closure::fromCallable([$this, 'handleUploadResult']),
270 "mep_id",
271 "",
272 20,
273 $this->getMimeTypes(true)
274 )->required();
275 // ->meta()->text()->meta()->textarea()
276 }
278 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ handleUploadResult()

ilMediaCreationGUI::handleUploadResult ( FileUpload  $upload,
UploadResult  $result 
)
protected

Definition at line 396 of file class.ilMediaCreationGUI.php.

400 $title = $result->getName();
401
402 $mob = new ilObjMediaObject();
403 $mob->setTitle($title);
404 $mob->setDescription("");
405 $mob->create();
406
407 $media_item = $mob->addMediaItemFromUpload(
408 "Standard",
409 $result,
410 $this->request->getUploadHash()
411 );
412
413 /*
414 $mob->createDirectory();
415 $media_item = new ilMediaItem();
416 $mob->addMediaItem($media_item);
417 $media_item->setPurpose("Standard");
418
419 $mob_dir = ilObjMediaObject::_getRelativeDirectory($mob->getId());
420 $file_name = ilObjMediaObject::fixFilename($title);
421 $file = $mob_dir . "/" . $file_name;
422
423 $upload->moveOneFileTo(
424 $result,
425 $mob_dir,
426 Location::WEB,
427 $file_name,
428 true
429 );
430
431 // get mime type
432 $format = ilObjMediaObject::getMimeType($file);
433 $location = $file_name;
434
435 // set real meta and object data
436 $media_item->setFormat($format);
437 $media_item->setLocation($location);
438 $media_item->setLocationType("LocalFile");
439 $media_item->setUploadHash($this->request->getUploadHash());*/
440 $mob->update();
441 $item_ids[] = $mob->getId();
442
443 // duration
444 $med_item = $mob->getMediaItem("Standard");
445 $med_item->determineDuration();
446 $med_item->update();
447
448 ($this->after_upload)([$mob->getId()]);
449
450 return new BasicHandlerResult(
451 "mep_id",
452 HandlerResult::STATUS_OK,
453 $med_item->getId(),
454 ''
455 );
456 }

◆ initMediaBulkForm()

ilMediaCreationGUI::initMediaBulkForm ( string  $a_id,
string  $a_title 
)

Definition at line 519 of file class.ilMediaCreationGUI.php.

520 {
522
523 $form = new ilPropertyFormGUI();
524 $form->setOpenTag(false);
525 $form->setCloseTag(false);
526
527 // title
528 $ti = new ilTextInputGUI($lng->txt("title"), "title_" . $a_id);
529 $ti->setValue($a_title);
530 $form->addItem($ti);
531
532 // description
533 $ti = new ilTextAreaInputGUI($lng->txt("description"), "description_" . $a_id);
534 $form->addItem($ti);
535
536 return $form;
537 }
This class represents a property form user interface.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References $lng.

◆ initPoolSelection()

ilMediaCreationGUI::initPoolSelection ( )

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

307 {
310
311 $form = new \ilPropertyFormGUI();
312
314 $lng->txt("obj_mep"),
315 "mep",
316 false,
317 $form
318 );
319 $exp = $mcst->getExplorerGUI();
320 $exp->setSelectableTypes(["mep"]);
321 $exp->setTypeWhiteList(["root", "mep", "cat", "crs", "grp", "fold"]);
322 $mcst->setRequired(true);
323 $form->addItem($mcst);
324
325 $form->addCommandButton("listPoolItems", $lng->txt("continue"));
326 $form->addCommandButton("cancel", $lng->txt("cancel"));
327
328 $form->setTitle($lng->txt("mob_choose_from_pool"));
329 $form->setFormAction($ctrl->getFormAction($this));
330
331 return $form;
332 }

References $lng, and ilCtrl\getFormAction().

+ Here is the call graph for this function:

◆ initUrlForm()

ilMediaCreationGUI::initUrlForm ( )

Definition at line 280 of file class.ilMediaCreationGUI.php.

281 {
284
285 $form = new \ilPropertyFormGUI();
286
287 //
288 $ti = new \ilTextInputGUI($lng->txt("mob_url"), "url");
289 $info = $lng->txt("mob_url_info1") . " " . implode(", ", $this->getSuffixes()) . ".";
290 if (in_array(self::TYPE_VIDEO, $this->accept_types)) {
291 $info .= " " . $lng->txt("mob_url_info_video");
292 }
293 $ti->setInfo($info);
294 $ti->setRequired(true);
295 $form->addItem($ti);
296
297 $form->addCommandButton("saveUrl", $lng->txt("save"));
298 $form->addCommandButton("cancel", $lng->txt("cancel"));
299
300 $form->setTitle($lng->txt("mob_external_url"));
301 $form->setFormAction($ctrl->getFormAction($this));
302
303 return $form;
304 }
$info
Definition: entry_point.php:21

References $info, $lng, and ilCtrl\getFormAction().

+ Here is the call graph for this function:

◆ insertFromPool()

ilMediaCreationGUI::insertFromPool ( )
protected

Insert media from pool.

Definition at line 770 of file class.ilMediaCreationGUI.php.

770 : void
771 {
772 $ids = $this->request->getIds();
773 if (count($ids) == 0) {
774 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("select_one"));
775 $this->listPoolItems();
776 return;
777 }
778 $mob_ids = [];
779 foreach ($ids as $pool_entry_id) {
780 $id = ilMediaPoolItem::lookupForeignId($pool_entry_id);
781 $mob = new ilObjMediaObject((int) $id);
782 if (!in_array($mob->getMediaItem("Standard")->getFormat(), $this->getMimeTypes())) {
783 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("mob_mime_type_not_allowed") . ": " .
784 $mob->getMediaItem("Standard")->getFormat());
785 $this->listPoolItems();
786 return;
787 }
788 $mob_ids[] = $id;
789 }
790 ($this->after_pool_insert)($mob_ids);
791 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
listPoolItems()
Insert media object from pool.
static lookupForeignId(int $a_id)

References $id, ILIAS\Repository\lng(), and ilMediaPoolItem\lookupForeignId().

+ Here is the call graph for this function:

◆ listPoolItems()

ilMediaCreationGUI::listPoolItems ( )

Insert media object from pool.

Definition at line 654 of file class.ilMediaCreationGUI.php.

654 : void
655 {
659 $ui = $this->ui;
661
662 $form = $this->initPoolSelection();
663 if ($this->requested_mep === 0) {
664 $this->main_tpl->setOnScreenMessage("failure", $this->lng->txt("mob_please_select_pool"));
665 $form->setValuesByPost();
666 $this->main_tpl->setContent($form->getHTML());
667 return;
668 }
669
670 if ($this->requested_mep > 0 &&
671 $access->checkAccess("write", "", $this->requested_mep)
672 && ilObject::_lookupType(ilObject::_lookupObjId($this->requested_mep)) == "mep") {
673 $tb = new ilToolbarGUI();
674
675 // button: select pool
676 $tb->addButton(
677 $lng->txt("cont_switch_to_media_pool"),
678 $ctrl->getLinkTarget($this, "poolSelection")
679 );
680
681 // view mode: pool view (folders/all media objects)
682 $f = $ui->factory();
683 $lng->loadLanguageModule("mep");
684 $ctrl->setParameter($this, "pool_view", self::POOL_VIEW_FOLDER);
685 $actions[$lng->txt("folders")] = $ctrl->getLinkTarget($this, "listPoolItems");
686 $ctrl->setParameter($this, "pool_view", self::POOL_VIEW_ALL);
687 $actions[$lng->txt("mep_all_mobs")] = $ctrl->getLinkTarget($this, "listPoolItems");
688 $ctrl->setParameter($this, "pool_view", $this->pool_view);
689 $aria_label = $lng->txt("cont_change_pool_view");
690 $view_control = $f->viewControl()->mode($actions, $aria_label)->withActive(($this->pool_view == self::POOL_VIEW_FOLDER)
691 ? $lng->txt("folders") : $lng->txt("mep_all_mobs"));
692 $tb->addSeparator();
693 $tb->addComponent($view_control);
694
695 $html = $tb->getHTML();
696
697 $pool_table = $this->getPoolTable();
698
699 $html .= $pool_table->getHTML();
700
701 $main_tpl->setContent($html);
702 }
703 }
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
loadLanguageModule(string $a_module)
Load language module.
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance)

References Vendor\Package\$f, $lng, ilObject\_lookupObjId(), ilObject\_lookupType(), ilRBACAccessHandler\checkAccess(), ilCtrl\getLinkTarget(), ILIAS\Repository\lng(), ILIAS\UICore\GlobalTemplate\setContent(), and ilCtrl\setParameter().

+ Here is the call graph for this function:

◆ performBulkUpload()

ilMediaCreationGUI::performBulkUpload ( )

Save bulk upload form.

Definition at line 461 of file class.ilMediaCreationGUI.php.

461 : void
462 {
463 $form = $this->getUploadForm();
464 if (!$form->isValid()) {
465 $this->main_tpl->setContent($form->render());
466 return;
467 }
468
469 $this->ctrl->setParameter($this, "mep_hash", $this->request->getUploadHash());
470 $this->ctrl->redirect($this, "editTitlesAndDescriptions");
471 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ poolSelection()

ilMediaCreationGUI::poolSelection ( )

Definition at line 749 of file class.ilMediaCreationGUI.php.

749 : void
750 {
752 $exp = new ilPoolSelectorGUI(
753 $this,
754 "poolSelection",
755 null,
756 "selectPool",
757 "",
758 "mep_ref_id"
759 );
760 $exp->setTypeWhiteList(array("root", "cat", "grp", "fold", "crs", "mep"));
761 $exp->setClickableTypes(array('mep'));
762 if (!$exp->handleCommand()) {
763 $main_tpl->setContent($exp->getHTML());
764 }
765 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\UICore\GlobalTemplate\setContent().

+ Here is the call graph for this function:

◆ resetFilter()

ilMediaCreationGUI::resetFilter ( )
protected

Definition at line 713 of file class.ilMediaCreationGUI.php.

713 : void
714 {
715 $mpool_table = $this->getPoolTable();
716 $mpool_table->resetOffset();
717 $mpool_table->resetFilter();
718 $this->ctrl->redirect($this, "listPoolItems");
719 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ saveTitlesAndDescriptions()

ilMediaCreationGUI::saveTitlesAndDescriptions ( )
protected

Definition at line 539 of file class.ilMediaCreationGUI.php.

539 : void
540 {
543
544 $media_items = ilMediaItem::getMediaItemsForUploadHash($this->request->getUploadHash());
545
546 foreach ($media_items as $mi) {
547 $mob = new ilObjMediaObject($mi["mob_id"]);
548 $form = $this->initMediaBulkForm($mi["mob_id"], $mob->getTitle());
549 $form->checkInput();
550 $title = $form->getInput("title_" . $mi["mob_id"]);
551 $desc = $form->getInput("description_" . $mi["mob_id"]);
552 if (trim($title) != "") {
553 $mob->setTitle($title);
554 }
555 $mob->setDescription($desc);
556 $mob->update();
557 ($this->on_mob_update)($mob->getId());
558 }
559 $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
560 $ctrl->returnToParent($this);
561 }

References $lng, ilMediaItem\getMediaItemsForUploadHash(), and ilCtrl\returnToParent().

+ Here is the call graph for this function:

◆ saveUrl()

ilMediaCreationGUI::saveUrl ( )
protected

Definition at line 575 of file class.ilMediaCreationGUI.php.

575 : void
576 {
577 $form = $this->initUrlForm();
578
579 if (!$form->checkInput()) {
580 $form->setValuesByPost();
581 $this->main_tpl->setContent($form->getHTML());
582 } else {
583 $locationType = "Reference";
584 $url = $form->getInput("url");
585 $url_pi = pathinfo(basename($url));
586 $title = str_replace("_", " ", $url_pi["filename"]);
587
588 /*
589 * Creating the MediaObject also creates a LOM set for it,
590 * and a LOM set can not be created without a title.
591 */
592 $mob = new ilObjMediaObject();
593 $mob->setTitle($title);
594 $mob->create();
595
596 //handle standard purpose
597 $mediaItem = new ilMediaItem();
598 $mob->addMediaItem($mediaItem);
599 $mediaItem->setPurpose("Standard");
600
601 // determine and create mob directory, move uploaded file to directory
602 $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
603 if (!is_dir($mob_dir)) {
604 $mob->createDirectory();
605 }
606
607 // get mime type, if not already set!
608 $format = ilObjMediaObject::getMimeType($url, true);
609 if (!in_array($format, $this->getMimeTypes())) {
610 $this->main_tpl->setOnScreenMessage(
611 "failure",
612 $this->lng->txt("mob_type_not_supported") . " " . $format
613 );
614 $form->setValuesByPost();
615 $this->main_tpl->setContent($form->getHTML());
616 return;
617 }
618 // set real meta and object data
619 $mediaItem->setFormat($format);
620 $mediaItem->setLocation($url);
621 $mediaItem->setLocationType("Reference");
622 $mediaItem->setHAlign("Left");
623 try {
624 $mob->getExternalMetadata();
625 } catch (Exception $e) {
626 $this->main_tpl->setOnScreenMessage('failure', $e->getMessage(), true);
627 $form->setValuesByPost();
628 $this->main_tpl->setContent($form->getHTML());
629 return;
630 }
631
632 $long_desc = $mob->getLongDescription();
633 $mob->update();
634
635 $mob = new ilObjMediaObject($mob->getId());
636 $mob->generatePreviewPic(320, 240);
637
638 // duration
639 $med_item = $mob->getMediaItem("Standard");
640 $med_item->determineDuration();
641 $med_item->update();
642
643 //
644 // @todo: save usage
645 //
646
647 ($this->after_url_saving)($mob->getId(), $long_desc);
648 }
649 }
getMimeTypes($local_only=false)
Class ilMediaItem Media Item, component of a media object (file or reference)
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
static _getDirectory(int $a_mob_id)
Get absolute directory.
$url
Definition: shib_logout.php:68

References Vendor\Package\$e, $url, ilObjMediaObject\_getDirectory(), ilObjMediaObject\getMimeType(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ selectPool()

ilMediaCreationGUI::selectPool ( )

Select concrete pool.

Definition at line 741 of file class.ilMediaCreationGUI.php.

741 : void
742 {
744
745 $ctrl->setParameter($this, "mep", $this->request->getSelectedMediaPoolRefId());
746 $ctrl->redirect($this, "listPoolItems");
747 }
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc

References ilCtrl\redirect(), and ilCtrl\setParameter().

+ Here is the call graph for this function:

◆ setAllMimeTypes()

ilMediaCreationGUI::setAllMimeTypes ( array  $a_val)

Definition at line 131 of file class.ilMediaCreationGUI.php.

133 : void {
134 $this->all_mime_types = $a_val;
135 }

◆ setAllSuffixes()

ilMediaCreationGUI::setAllSuffixes ( array  $a_val)

Definition at line 120 of file class.ilMediaCreationGUI.php.

122 : void {
123 $this->all_suffixes = $a_val;
124 }

Field Documentation

◆ $accept_types

array ilMediaCreationGUI::$accept_types = [1,2,3,4]
protected

Definition at line 46 of file class.ilMediaCreationGUI.php.

Referenced by __construct().

◆ $access

ilAccessHandler ilMediaCreationGUI::$access
protected

Definition at line 55 of file class.ilMediaCreationGUI.php.

◆ $after_pool_insert

Closure ilMediaCreationGUI::$after_pool_insert
protected

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

Referenced by __construct().

◆ $after_upload

Closure ilMediaCreationGUI::$after_upload
protected

Definition at line 50 of file class.ilMediaCreationGUI.php.

Referenced by __construct().

◆ $after_url_saving

Closure ilMediaCreationGUI::$after_url_saving
protected

Definition at line 51 of file class.ilMediaCreationGUI.php.

Referenced by __construct().

◆ $all_mime_types

array ilMediaCreationGUI::$all_mime_types = []
protected

Definition at line 63 of file class.ilMediaCreationGUI.php.

◆ $all_suffixes

array ilMediaCreationGUI::$all_suffixes = []
protected

Definition at line 59 of file class.ilMediaCreationGUI.php.

◆ $bulk_upload_form

FormAdapterGUI ilMediaCreationGUI::$bulk_upload_form = null
protected

Definition at line 43 of file class.ilMediaCreationGUI.php.

◆ $ctrl

ilCtrl ilMediaCreationGUI::$ctrl
protected

Definition at line 48 of file class.ilMediaCreationGUI.php.

◆ $finish_single_upload

Closure ilMediaCreationGUI::$finish_single_upload
protected

Definition at line 53 of file class.ilMediaCreationGUI.php.

Referenced by __construct().

◆ $gui

InternalGUIService ilMediaCreationGUI::$gui
protected

Definition at line 42 of file class.ilMediaCreationGUI.php.

◆ $lng

ilLanguage ilMediaCreationGUI::$lng
protected

Definition at line 47 of file class.ilMediaCreationGUI.php.

◆ $main_tpl

ilGlobalTemplateInterface ilMediaCreationGUI::$main_tpl
protected

Definition at line 49 of file class.ilMediaCreationGUI.php.

◆ $mob_log

ilLogger ilMediaCreationGUI::$mob_log
protected

Definition at line 68 of file class.ilMediaCreationGUI.php.

◆ $on_mob_update

Closure ilMediaCreationGUI::$on_mob_update
protected

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

Referenced by __construct().

◆ $pool_view

string ilMediaCreationGUI::$pool_view = self::POOL_VIEW_FOLDER
protected

Definition at line 66 of file class.ilMediaCreationGUI.php.

◆ $request

CreationGUIRequest ilMediaCreationGUI::$request
protected

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

◆ $requested_mep

int ilMediaCreationGUI::$requested_mep
protected

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

◆ $type_manager

ILIAS MediaObjects MediaType MediaTypeManager ilMediaCreationGUI::$type_manager
protected

Definition at line 41 of file class.ilMediaCreationGUI.php.

◆ $ui

ILIAS DI UIServices ilMediaCreationGUI::$ui
protected

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

◆ $upload

ILIAS FileUpload FileUpload ilMediaCreationGUI::$upload
protected

Definition at line 67 of file class.ilMediaCreationGUI.php.

◆ POOL_VIEW_ALL

const ilMediaCreationGUI::POOL_VIEW_ALL = "all"

Definition at line 40 of file class.ilMediaCreationGUI.php.

◆ POOL_VIEW_FOLDER

const ilMediaCreationGUI::POOL_VIEW_FOLDER = "fold"

Definition at line 39 of file class.ilMediaCreationGUI.php.

◆ TYPE_ALL

const ilMediaCreationGUI::TYPE_ALL = 5

Definition at line 38 of file class.ilMediaCreationGUI.php.

Referenced by ilObjMediaPoolGUI\executeCommand().

◆ TYPE_AUDIO

const ilMediaCreationGUI::TYPE_AUDIO = 2

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

Referenced by ilObjMediaCastGUI\executeCommand().

◆ TYPE_IMAGE

const ilMediaCreationGUI::TYPE_IMAGE = 3

Definition at line 36 of file class.ilMediaCreationGUI.php.

Referenced by ilObjMediaCastGUI\executeCommand().

◆ TYPE_OTHER

const ilMediaCreationGUI::TYPE_OTHER = 4

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

◆ TYPE_VIDEO

const ilMediaCreationGUI::TYPE_VIDEO = 1

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

Referenced by ilObjMediaCastGUI\executeCommand().


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