ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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 ()
 
 insertFromPool (?array $ids=null)
 Insert media from pool. More...
 

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 ()
 

Protected Attributes

ILIAS MediaObjects MediaType MediaTypeManager $type_manager
 
InternalGUIService $gui
 
ILIAS MediaPool InternalGUIService $media_pool_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 71 of file class.ilMediaCreationGUI.php.

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

719 : void
720 {
721 $this->ctrl->redirect($this, "listPoolItems");
722 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ cancel()

ilMediaCreationGUI::cancel ( )
protected

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

574 : void
575 {
577 $ctrl->returnToParent($this);
578 }
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 580 of file class.ilMediaCreationGUI.php.

580 : void
581 {
583 $ctrl->returnToParent($this);
584 }

References ilCtrl\returnToParent().

+ Here is the call graph for this function:

◆ creationSelection()

ilMediaCreationGUI::creationSelection ( )
protected

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

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

485 : void
486 {
489
490 $ctrl->saveParameter($this, "mep_hash");
491
493
494 $media_items = ilMediaItem::getMediaItemsForUploadHash($this->request->getUploadHash());
495
496 $tb = new ilToolbarGUI();
497 $tb->setFormAction($ctrl->getFormAction($this));
498 $tb->addFormButton($lng->txt("save"), "saveTitlesAndDescriptions");
499 $tb->setOpenFormTag(true);
500 $tb->setCloseFormTag(false);
501 $tb->setId("tb_top");
502
503 if (count($media_items) == 1 && $this->finish_single_upload) {
504 $mi = current($media_items);
505 ($this->finish_single_upload)($mi["mob_id"]);
506 return;
507 }
508
509 $html = $tb->getHTML();
510 foreach ($media_items as $mi) {
511 $acc = new ilAccordionGUI();
512 $acc->setBehaviour(ilAccordionGUI::ALL_CLOSED);
513 $acc->setId("acc_" . $mi["mob_id"]);
514
515 $mob = new ilObjMediaObject($mi["mob_id"]);
516 $form = $this->initMediaBulkForm($mi["mob_id"], $mob->getTitle());
517 $acc->addItem($mob->getTitle(), $form->getHTML());
518
519 $html .= $acc->getHTML();
520 }
521
522 $html .= $tb->getHTML();
523 $tb->setOpenFormTag(false);
524 $tb->setCloseFormTag(true);
525 $tb->setId("tb_bottom");
526
527 $main_tpl->setContent($html);
528 }
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|LanguageIdentifier $a_topic, ?int $n=null)
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 189 of file class.ilMediaCreationGUI.php.

189 : void
190 {
192
193 $next_class = $ctrl->getNextClass($this);
194 $cmd = $ctrl->getCmd("creationSelection");
195
196 switch ($next_class) {
197 case "ilpropertyformgui":
198 $form = $this->initPoolSelection();
199 $ctrl->forwardCommand($form);
200 break;
201
202 case strtolower(ilRepoStandardUploadHandlerGUI::class):
203 $form = $this->getUploadForm();
204 $gui = $form->getRepoStandardUploadHandlerGUI("media_files");
205 $this->ctrl->forwardCommand($gui);
206 break;
207
208 default:
209 if (in_array($cmd, ["creationSelection", "uploadFile", "saveUrl", "cancel", "cancelCreate", "listPoolItems",
210 "insertFromPool", "poolSelection", "selectPool", "applyFilter", "resetFilter", "performBulkUpload",
211 "editTitlesAndDescriptions", "saveTitlesAndDescriptions"])) {
212 $this->$cmd();
213 }
214 }
215 }
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 142 of file class.ilMediaCreationGUI.php.

142 : array
143 {
145 }

◆ getAllSuffixes()

ilMediaCreationGUI::getAllSuffixes ( )

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

128 : array
129 {
130 return $this->all_suffixes;
131 }

◆ getMimeTypes()

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

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

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

◆ getPoolTable()

ilMediaCreationGUI::getPoolTable ( )
protected

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

730 {
731 $pool = new ilObjMediaPool($this->requested_mep);
732 return $this->media_pool_gui->mediaPoolTableBuilder(
733 $pool,
734 "mep_folder",
735 "select",
736 $this->pool_view == self::POOL_VIEW_ALL,
737 "applyFilter",
738 "resetFilter",
739 "insertFromPool",
740 $this,
741 "listPoolItems"
742 );
743 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getSuffixes()

ilMediaCreationGUI::getSuffixes ( )
protected
Returns
string[]

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

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

◆ getUploadForm()

ilMediaCreationGUI::getUploadForm ( )

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

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

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 398 of file class.ilMediaCreationGUI.php.

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

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ initMediaBulkForm()

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

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

531 {
533
534 $form = new ilPropertyFormGUI();
535 $form->setOpenTag(false);
536 $form->setCloseTag(false);
537
538 // title
539 $ti = new ilTextInputGUI($lng->txt("title"), "title_" . $a_id);
540 $ti->setValue($a_title);
541 $form->addItem($ti);
542
543 // description
544 $ti = new ilTextAreaInputGUI($lng->txt("description"), "description_" . $a_id);
545 $form->addItem($ti);
546
547 return $form;
548 }
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 308 of file class.ilMediaCreationGUI.php.

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

References $lng, and ilCtrl\getFormAction().

+ Here is the call graph for this function:

◆ initUrlForm()

ilMediaCreationGUI::initUrlForm ( )

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

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

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

+ Here is the call graph for this function:

◆ insertFromPool()

ilMediaCreationGUI::insertFromPool ( ?array  $ids = null)

Insert media from pool.

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

777 : void
778 {
779 $ids ??= $this->request->getIds();
780 if (count($ids) == 0) {
781 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("select_one"));
782 $this->listPoolItems();
783 return;
784 }
785 $mob_ids = [];
786 foreach ($ids as $pool_entry_id) {
787 $id = ilMediaPoolItem::lookupForeignId($pool_entry_id);
788 $mob = new ilObjMediaObject((int) $id);
789 if (!in_array($mob->getMediaItem("Standard")->getFormat(), $this->getMimeTypes())) {
790 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("mob_mime_type_not_allowed") . ": " .
791 $mob->getMediaItem("Standard")->getFormat());
792 $this->listPoolItems();
793 return;
794 }
795 $mob_ids[] = $id;
796 }
797 ($this->after_pool_insert)($mob_ids);
798 }
$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 665 of file class.ilMediaCreationGUI.php.

665 : void
666 {
670 $ui = $this->ui;
672
673 $form = $this->initPoolSelection();
674 if ($this->requested_mep === 0) {
675 $this->main_tpl->setOnScreenMessage("failure", $this->lng->txt("mob_please_select_pool"));
676 $form->setValuesByPost();
677 $this->main_tpl->setContent($form->getHTML());
678 return;
679 }
680
681 if ($this->requested_mep > 0 &&
682 $access->checkAccess("write", "", $this->requested_mep)
683 && ilObject::_lookupType(ilObject::_lookupObjId($this->requested_mep)) == "mep") {
684 $tb = new ilToolbarGUI();
685
686 // button: select pool
687 $tb->addButton(
688 $lng->txt("cont_switch_to_media_pool"),
689 $ctrl->getLinkTarget($this, "poolSelection")
690 );
691
692 // view mode: pool view (folders/all media objects)
693 $f = $ui->factory();
694 $lng->loadLanguageModule("mep");
695 $ctrl->setParameter($this, "pool_view", self::POOL_VIEW_FOLDER);
696 $actions[$lng->txt("folders")] = $ctrl->getLinkTarget($this, "listPoolItems");
697 $ctrl->setParameter($this, "pool_view", self::POOL_VIEW_ALL);
698 $actions[$lng->txt("mep_all_mobs")] = $ctrl->getLinkTarget($this, "listPoolItems");
699 $ctrl->setParameter($this, "pool_view", $this->pool_view);
700 $aria_label = $lng->txt("cont_change_pool_view");
701 $view_control = $f->viewControl()->mode($actions, $aria_label)->withActive(($this->pool_view == self::POOL_VIEW_FOLDER)
702 ? $lng->txt("folders") : $lng->txt("mep_all_mobs"));
703 $tb->addSeparator();
704 $tb->addComponent($view_control);
705
706 $html = $tb->getHTML();
707
708 $pool_table = $this->getPoolTable();
709 if ($pool_table->getTable()->handleCommand()) {
710 return;
711 }
712
713 $html .= $pool_table->render();
714
715 $main_tpl->setContent($html);
716 }
717 }
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 472 of file class.ilMediaCreationGUI.php.

472 : void
473 {
474 $form = $this->getUploadForm();
475 if (!$form->isValid()) {
476 $this->main_tpl->setContent($form->render());
477 return;
478 }
479
480 $this->ctrl->setParameter($this, "mep_hash", $this->request->getUploadHash());
481 $this->ctrl->redirect($this, "editTitlesAndDescriptions");
482 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ poolSelection()

ilMediaCreationGUI::poolSelection ( )

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

756 : void
757 {
759 $exp = new ilPoolSelectorGUI(
760 $this,
761 "poolSelection",
762 null,
763 "selectPool",
764 "",
765 "mep_ref_id"
766 );
767 $exp->setTypeWhiteList(array("root", "cat", "grp", "fold", "crs", "mep"));
768 $exp->setClickableTypes(array('mep'));
769 if (!$exp->handleCommand()) {
770 $main_tpl->setContent($exp->getHTML());
771 }
772 }
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 724 of file class.ilMediaCreationGUI.php.

724 : void
725 {
726 $this->ctrl->redirect($this, "listPoolItems");
727 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ saveTitlesAndDescriptions()

ilMediaCreationGUI::saveTitlesAndDescriptions ( )
protected

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

550 : void
551 {
554
555 $media_items = ilMediaItem::getMediaItemsForUploadHash($this->request->getUploadHash());
556
557 foreach ($media_items as $mi) {
558 $mob = new ilObjMediaObject($mi["mob_id"]);
559 $form = $this->initMediaBulkForm($mi["mob_id"], $mob->getTitle());
560 $form->checkInput();
561 $title = $form->getInput("title_" . $mi["mob_id"]);
562 $desc = $form->getInput("description_" . $mi["mob_id"]);
563 if (trim($title) != "") {
564 $mob->setTitle($title);
565 }
566 $mob->setDescription($desc);
567 $mob->update();
568 ($this->on_mob_update)($mob->getId());
569 }
570 $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
571 $ctrl->returnToParent($this);
572 }

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

+ Here is the call graph for this function:

◆ saveUrl()

ilMediaCreationGUI::saveUrl ( )
protected

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

586 : void
587 {
588 $form = $this->initUrlForm();
589
590 if (!$form->checkInput()) {
591 $form->setValuesByPost();
592 $this->main_tpl->setContent($form->getHTML());
593 } else {
594 $locationType = "Reference";
595 $url = $form->getInput("url");
596 $url_pi = pathinfo(basename($url));
597 $title = str_replace("_", " ", $url_pi["filename"]);
598
599 /*
600 * Creating the MediaObject also creates a LOM set for it,
601 * and a LOM set can not be created without a title.
602 */
603 $mob = new ilObjMediaObject();
604 $mob->setTitle($title);
605 $mob->create();
606
607 //handle standard purpose
608 $mediaItem = new ilMediaItem();
609 $mob->addMediaItem($mediaItem);
610 $mediaItem->setPurpose("Standard");
611
612 // determine and create mob directory, move uploaded file to directory
613 $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
614 if (!is_dir($mob_dir)) {
615 $mob->createDirectory();
616 }
617
618 // get mime type, if not already set!
619 $format = ilObjMediaObject::getMimeType($url, true);
620 if (!in_array($format, $this->getMimeTypes())) {
621 $this->main_tpl->setOnScreenMessage(
622 "failure",
623 $this->lng->txt("mob_type_not_supported") . " " . $format
624 );
625 $form->setValuesByPost();
626 $this->main_tpl->setContent($form->getHTML());
627 return;
628 }
629 // set real meta and object data
630 $mediaItem->setFormat($format);
631 $mediaItem->setLocation($url);
632 $mediaItem->setLocationType("Reference");
633 $mediaItem->setHAlign("Left");
634 try {
635 $mob->getExternalMetadata();
636 } catch (Exception $e) {
637 $this->main_tpl->setOnScreenMessage('failure', $e->getMessage(), true);
638 $form->setValuesByPost();
639 $this->main_tpl->setContent($form->getHTML());
640 return;
641 }
642
643 $long_desc = $mob->getLongDescription();
644 $mob->update();
645
646 $mob = new ilObjMediaObject($mob->getId());
647 $mob->generatePreviewPic(320, 240);
648
649 // duration
650 $med_item = $mob->getMediaItem("Standard");
651 $med_item->determineDuration();
652 $med_item->update();
653
654 //
655 // @todo: save usage
656 //
657
658 ($this->after_url_saving)($mob->getId(), $long_desc);
659 }
660 }
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.

References Vendor\Package\$e, 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 748 of file class.ilMediaCreationGUI.php.

748 : void
749 {
751
752 $ctrl->setParameter($this, "mep", $this->request->getSelectedMediaPoolRefId());
753 $ctrl->redirect($this, "listPoolItems");
754 }
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 133 of file class.ilMediaCreationGUI.php.

135 : void {
136 $this->all_mime_types = $a_val;
137 }

◆ setAllSuffixes()

ilMediaCreationGUI::setAllSuffixes ( array  $a_val)

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

124 : void {
125 $this->all_suffixes = $a_val;
126 }

Field Documentation

◆ $accept_types

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

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

Referenced by __construct().

◆ $access

ilAccessHandler ilMediaCreationGUI::$access
protected

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

◆ $after_pool_insert

Closure ilMediaCreationGUI::$after_pool_insert
protected

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

Referenced by __construct().

◆ $after_upload

Closure ilMediaCreationGUI::$after_upload
protected

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

Referenced by __construct().

◆ $after_url_saving

Closure ilMediaCreationGUI::$after_url_saving
protected

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

Referenced by __construct().

◆ $all_mime_types

array ilMediaCreationGUI::$all_mime_types = []
protected

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

◆ $all_suffixes

array ilMediaCreationGUI::$all_suffixes = []
protected

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

◆ $bulk_upload_form

FormAdapterGUI ilMediaCreationGUI::$bulk_upload_form = null
protected

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

◆ $ctrl

ilCtrl ilMediaCreationGUI::$ctrl
protected

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

◆ $finish_single_upload

Closure ilMediaCreationGUI::$finish_single_upload
protected

Definition at line 54 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 48 of file class.ilMediaCreationGUI.php.

◆ $main_tpl

ilGlobalTemplateInterface ilMediaCreationGUI::$main_tpl
protected

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

◆ $media_pool_gui

ILIAS MediaPool InternalGUIService ilMediaCreationGUI::$media_pool_gui
protected

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

◆ $mob_log

ilLogger ilMediaCreationGUI::$mob_log
protected

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

◆ $on_mob_update

Closure ilMediaCreationGUI::$on_mob_update
protected

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

Referenced by __construct().

◆ $pool_view

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

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

◆ $request

CreationGUIRequest ilMediaCreationGUI::$request
protected

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

◆ $requested_mep

int ilMediaCreationGUI::$requested_mep
protected

Definition at line 66 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 65 of file class.ilMediaCreationGUI.php.

◆ $upload

ILIAS FileUpload FileUpload ilMediaCreationGUI::$upload
protected

Definition at line 68 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: