ILIAS  release_8 Revision v8.24
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 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
92 $this->accept_types = $accept_types;
93 $this->after_upload = $after_upload;
94 $this->after_url_saving = $after_url_saving;
95 $this->after_pool_insert = $after_pool_insert;
96 $this->finish_single_upload = $finish_single_upload;
97 $this->on_mob_update = $on_mob_update;
98 $this->type_manager = $DIC->mediaObjects()
99 ->internal()
100 ->domain()
101 ->mediaType();
102
103 $this->ctrl->saveParameter($this, ["mep", "pool_view"]);
104
105 $this->request = $DIC->mediaObjects()
106 ->internal()
107 ->gui()
108 ->creation()
109 ->request();
110
111 $this->requested_mep = $this->request->getMediaPoolId();
112 $this->ctrl->setParameter($this, "mep", $this->requested_mep);
113
114 $pv = $this->request->getPoolView();
115 $this->pool_view = (in_array($pv, [self::POOL_VIEW_FOLDER, self::POOL_VIEW_ALL]))
116 ? $pv
117 : self::POOL_VIEW_FOLDER;
118 $this->gui = $DIC->mediaObjects()->internal()->gui();
119 }
global $DIC
Definition: feed.php:28

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

568 : void
569 {
571 $ctrl->returnToParent($this);
572 }
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 574 of file class.ilMediaCreationGUI.php.

574 : void
575 {
577 $ctrl->returnToParent($this);
578 }

References ilCtrl\returnToParent().

+ Here is the call graph for this function:

◆ creationSelection()

ilMediaCreationGUI::creationSelection ( )
protected

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

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

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

+ Here is the call graph for this function:

◆ editTitlesAndDescriptions()

ilMediaCreationGUI::editTitlesAndDescriptions ( )
protected

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

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

+ Here is the call graph for this function:

◆ executeCommand()

ilMediaCreationGUI::executeCommand ( )

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

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

141 : array
142 {
144 }

◆ getAllSuffixes()

ilMediaCreationGUI::getAllSuffixes ( )

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

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

◆ getMimeTypes()

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

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

170 : array
171 {
172 $mimes = [];
173 if (in_array(self::TYPE_ALL, $this->accept_types)) {
174 $mimes = $this->getAllMimeTypes();
175 }
176 if (in_array(self::TYPE_VIDEO, $this->accept_types)) {
177 $mimes[] = "video/mp4";
178 if (!$local_only) {
179 $mimes[] = "video/vimeo";
180 $mimes[] = "video/youtube";
181 }
182 }
183 if (in_array(self::TYPE_AUDIO, $this->accept_types)) {
184 $mimes[] = "audio/mpeg";
185 }
186 if (in_array(self::TYPE_IMAGE, $this->accept_types)) {
187 $mimes[] = "image/png";
188 $mimes[] = "image/jpeg";
189 $mimes[] = "image/gif";
190 }
191 return $mimes;
192 }

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

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

◆ getUploadForm()

ilMediaCreationGUI::getUploadForm ( )

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

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

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

409 $title = $result->getName();
410
411 $mob = new ilObjMediaObject();
412 $mob->setTitle($title);
413 $mob->setDescription("");
414 $mob->create();
415
416 $mob->createDirectory();
417 $media_item = new ilMediaItem();
418 $mob->addMediaItem($media_item);
419 $media_item->setPurpose("Standard");
420
421 $mob_dir = ilObjMediaObject::_getRelativeDirectory($mob->getId());
422 $file_name = ilObjMediaObject::fixFilename($title);
423 $file = $mob_dir . "/" . $file_name;
424
425 $upload->moveOneFileTo(
426 $result,
427 $mob_dir,
428 Location::WEB,
429 $file_name,
430 true
431 );
432
433 // get mime type
435 $location = $file_name;
436
437 // set real meta and object data
438 $media_item->setFormat($format);
439 $media_item->setLocation($location);
440 $media_item->setLocationType("LocalFile");
441 $media_item->setUploadHash($this->request->getUploadHash());
442 $mob->update();
443 $item_ids[] = $mob->getId();
444
445 $mob = new ilObjMediaObject($mob->getId());
446 $mob->generatePreviewPic(320, 240);
447
448 // duration
449 $med_item = $mob->getMediaItem("Standard");
450 $med_item->determineDuration();
451 $med_item->update();
452
453 ($this->after_upload)([$mob->getId()]);
454
455 return new BasicHandlerResult(
456 "mep_id",
457 HandlerResult::STATUS_OK,
458 $med_item->getId(),
459 ''
460 );
461 }
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
ILIAS FileUpload FileUpload $upload
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static fixFilename(string $a_name)
Fix filename of uploaded file.
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
static _getRelativeDirectory(int $a_mob_id)
Get relative (to webspace dir) directory.
$format
Definition: metadata.php:235

◆ initMediaBulkForm()

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

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

525 {
527
528 $form = new ilPropertyFormGUI();
529 $form->setOpenTag(false);
530 $form->setCloseTag(false);
531
532 // title
533 $ti = new ilTextInputGUI($lng->txt("title"), "title_" . $a_id);
534 $ti->setValue($a_title);
535 $form->addItem($ti);
536
537 // description
538 $ti = new ilTextAreaInputGUI($lng->txt("description"), "description_" . $a_id);
539 $form->addItem($ti);
540
541 return $form;
542 }
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 315 of file class.ilMediaCreationGUI.php.

316 {
319
320 $form = new \ilPropertyFormGUI();
321
323 $lng->txt("obj_mep"),
324 "mep",
325 false,
326 $form
327 );
328 $exp = $mcst->getExplorerGUI();
329 $exp->setSelectableTypes(["mep"]);
330 $exp->setTypeWhiteList(["root", "mep", "cat", "crs", "grp", "fold"]);
331 $mcst->setRequired(true);
332 $form->addItem($mcst);
333
334 $form->addCommandButton("listPoolItems", $lng->txt("continue"));
335 $form->addCommandButton("cancel", $lng->txt("cancel"));
336
337 $form->setTitle($lng->txt("mob_choose_from_pool"));
338 $form->setFormAction($ctrl->getFormAction($this));
339
340 return $form;
341 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $lng, and ilCtrl\getFormAction().

+ Here is the call graph for this function:

◆ initUrlForm()

ilMediaCreationGUI::initUrlForm ( )

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

290 {
293
294 $form = new \ilPropertyFormGUI();
295
296 //
297 $ti = new \ilTextInputGUI($lng->txt("mob_url"), "url");
298 $info = $lng->txt("mob_url_info1") . " " . implode(", ", $this->getSuffixes()) . ".";
299 if (in_array(self::TYPE_VIDEO, $this->accept_types)) {
300 $info.= " " . $lng->txt("mob_url_info_video");
301 }
302 $ti->setInfo($info);
303 $ti->setRequired(true);
304 $form->addItem($ti);
305
306 $form->addCommandButton("saveUrl", $lng->txt("save"));
307 $form->addCommandButton("cancel", $lng->txt("cancel"));
308
309 $form->setTitle($lng->txt("mob_external_url"));
310 $form->setFormAction($ctrl->getFormAction($this));
311
312 return $form;
313 }

References $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 }
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@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(), ilGlobalTemplateInterface\setContent(), and ilCtrl\setParameter().

+ Here is the call graph for this function:

◆ performBulkUpload()

ilMediaCreationGUI::performBulkUpload ( )

Save bulk upload form.

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

466 : void
467 {
468 $form = $this->getUploadForm();
469 if (!$form->isValid()) {
470 $this->main_tpl->setContent($form->render());
471 return;
472 }
473
474 $this->ctrl->setParameter($this, "mep_hash", $this->request->getUploadHash());
475 $this->ctrl->redirect($this, "editTitlesAndDescriptions");
476 }

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 ilGlobalTemplateInterface\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 544 of file class.ilMediaCreationGUI.php.

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

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

+ Here is the call graph for this function:

◆ saveUrl()

ilMediaCreationGUI::saveUrl ( )
protected

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

580 : void
581 {
582 $form = $this->initUrlForm();
583
584 if (!$form->checkInput()) {
585 $form->setValuesByPost();
586 $this->main_tpl->setContent($form->getHTML());
587 } else {
588 $mob = new ilObjMediaObject();
589 $mob->create();
590
591 //handle standard purpose
592 $mediaItem = new ilMediaItem();
593 $mob->addMediaItem($mediaItem);
594 $mediaItem->setPurpose("Standard");
595
596 // determine and create mob directory, move uploaded file to directory
597 $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
598 if (!is_dir($mob_dir)) {
599 $mob->createDirectory();
600 }
601 $locationType = "Reference";
602 $url = $form->getInput("url");
603 $url_pi = pathinfo(basename($url));
604 $title = str_replace("_", " ", $url_pi["filename"]);
605
606 // get mime type, if not already set!
608 if (!in_array($format, $this->getMimeTypes())) {
609 $this->main_tpl->setOnScreenMessage(
610 "failure",
611 $this->lng->txt("mob_type_not_supported") . " " . $format
612 );
613 $form->setValuesByPost();
614 $this->main_tpl->setContent($form->getHTML());
615 return;
616 }
617 // set real meta and object data
618 $mediaItem->setFormat($format);
619 $mediaItem->setLocation($url);
620 $mediaItem->setLocationType("Reference");
621 $mediaItem->setHAlign("Left");
622 $mob->setTitle($title);
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)
static _getDirectory(int $a_mob_id)
Get absolute directory.
$url

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

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

◆ setAllSuffixes()

ilMediaCreationGUI::setAllSuffixes ( array  $a_val)

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

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

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

◆ $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 42 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 41 of file class.ilMediaCreationGUI.php.

◆ POOL_VIEW_FOLDER

const ilMediaCreationGUI::POOL_VIEW_FOLDER = "fold"

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

◆ TYPE_ALL

const ilMediaCreationGUI::TYPE_ALL = 5

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

◆ TYPE_AUDIO

const ilMediaCreationGUI::TYPE_AUDIO = 2

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

Referenced by ilObjMediaCastGUI\executeCommand().

◆ TYPE_IMAGE

const ilMediaCreationGUI::TYPE_IMAGE = 3

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

Referenced by ilObjMediaCastGUI\executeCommand().

◆ TYPE_OTHER

const ilMediaCreationGUI::TYPE_OTHER = 4

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

◆ TYPE_VIDEO

const ilMediaCreationGUI::TYPE_VIDEO = 1

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

Referenced by ilObjMediaCastGUI\executeCommand().


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