86 $this->lng = $DIC->language();
87 $this->lng->loadLanguageModule(
"mob");
88 $this->lng->loadLanguageModule(
"content");
89 $this->access = $DIC->access();
91 $this->ctrl = $DIC->ctrl();
92 $this->main_tpl = $DIC->ui()->mainTemplate();
93 $this->
ui = $DIC->ui();
100 $this->ctrl->saveParameter($this, [
"mep",
"pool_view"]);
102 $this->requested_mep = ((int)
$_POST[
"mep"] > 0)
104 : (
int)
$_GET[
"mep"];
106 $this->pool_view = (in_array(
$_GET[
"pool_view"], [self::POOL_VIEW_FOLDER, self::POOL_VIEW_ALL]))
108 : self::POOL_VIEW_FOLDER;
117 $this->all_suffixes = $a_val;
135 $this->all_mime_types = $a_val;
155 if (in_array(self::TYPE_ALL, $this->accept_types)) {
158 if (in_array(self::TYPE_VIDEO, $this->accept_types)) {
171 if (in_array(self::TYPE_ALL, $this->accept_types)) {
174 if (in_array(self::TYPE_VIDEO, $this->accept_types)) {
175 $mimes[] =
"video/vimeo";
176 $mimes[] =
"video/mp4";
188 $next_class =
$ctrl->getNextClass($this);
189 $cmd =
$ctrl->getCmd(
"creationSelection");
191 switch ($next_class) {
193 case "ilpropertyformgui":
195 $ctrl->forwardCommand($form);
199 if (in_array($cmd, [
"creationSelection",
"uploadFile",
"saveUrl",
"cancel",
"listPoolItems",
200 "insertFromPool",
"poolSelection",
"selectPool",
"applyFilter",
"resetFilter"])) {
213 $acc = new \ilAccordionGUI();
221 foreach ($forms as $form_type => $cf) {
222 $htpl = new \ilTemplate(
"tpl.creation_acc_head.html",
true,
true,
"Services/Object");
226 if (method_exists($this,
"getCreationFormTitle")) {
227 $form_title = $this->getCreationFormTitle($form_type);
230 $form_title = $cf->getTitle();
234 $htpl->setVariable(
"TITLE", $this->lng->txt(
"option") .
" " . $cnt .
": " .
237 $cf->setTitleIcon(null);
238 $cf->setTableWidth(
"100%");
240 $acc->addItem($htpl->get(), $cf->getHTML());
255 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
256 $form = new \ilPropertyFormGUI();
258 $fi = new \ilFileInputGUI(
$lng->txt(
"file"),
"file");
260 $fi->setRequired(
true);
263 $form->addCommandButton(
"uploadFile",
$lng->txt(
"upload"));
264 $form->addCommandButton(
"cancel",
$lng->txt(
"cancel"));
266 $form->setTitle(
$lng->txt(
"mob_upload_file"));
267 $form->setFormAction(
$ctrl->getFormAction($this));
280 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
281 $form = new \ilPropertyFormGUI();
284 $ti = new \ilTextInputGUI(
$lng->txt(
"mob_url"),
"url");
285 $ti->setInfo(
$lng->txt(
"mob_url_info"));
286 $ti->setRequired(
true);
289 $form->addCommandButton(
"saveUrl",
$lng->txt(
"save"));
290 $form->addCommandButton(
"cancel",
$lng->txt(
"cancel"));
292 $form->setTitle(
$lng->txt(
"mob_external_url"));
293 $form->setFormAction(
$ctrl->getFormAction($this));
306 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
307 $form = new \ilPropertyFormGUI();
312 $exp->setSelectableTypes([
"mep"]);
313 $exp->setTypeWhiteList([
"root",
"mep",
"cat",
"crs",
"grp",
"fold"]);
315 $form->addItem($mcst);
317 $form->addCommandButton(
"listPoolItems",
$lng->txt(
"continue"));
318 $form->addCommandButton(
"cancel",
$lng->txt(
"cancel"));
320 $form->setTitle(
$lng->txt(
"mob_choose_from_pool"));
321 $form->setFormAction(
$ctrl->getFormAction($this));
333 if (!$form->checkInput()) {
334 $form->setValuesByPost();
335 $this->main_tpl->setContent($form->getHTML());
343 $mob->addMediaItem($mediaItem);
344 $mediaItem->setPurpose(
"Standard");
348 if (!is_dir($mob_dir)) {
349 $mob->createDirectory();
352 $file_name = str_replace(
" ",
"_", $file_name);
354 $file = $mob_dir .
"/" . $file_name;
356 $locationType =
"LocalFile";
365 $mediaItem->setFormat(
$format);
367 $mediaItem->setLocationType($locationType);
368 $mediaItem->setHAlign(
"Left");
369 $mob->setTitle($title);
375 $mob->generatePreviewPic(320, 240);
391 $ctrl->returnToParent($this);
401 if (!$form->checkInput()) {
402 $form->setValuesByPost();
403 $this->main_tpl->setContent($form->getHTML());
410 $mob->addMediaItem($mediaItem);
411 $mediaItem->setPurpose(
"Standard");
415 if (!is_dir($mob_dir)) {
416 $mob->createDirectory();
418 $locationType =
"Reference";
419 $url = $form->getInput(
"url");
426 $mediaItem->setFormat(
$format);
427 $mediaItem->setLocation(
$url);
428 $mediaItem->setLocationType(
"Reference");
429 $mediaItem->setHAlign(
"Left");
430 $mob->setTitle($title);
441 $long_desc = $mob->getLongDescription();
463 if ($this->requested_mep > 0 &&
464 $access->checkAccess(
"write",
"", $this->requested_mep)
470 $lng->txt(
"cont_switch_to_media_pool"),
471 $ctrl->getLinkTarget($this,
"poolSelection")
476 $lng->loadLanguageModule(
"mep");
477 $ctrl->setParameter($this,
"pool_view", self::POOL_VIEW_FOLDER);
478 $actions[
$lng->txt(
"folders")] =
$ctrl->getLinkTarget($this,
"listPoolItems");
479 $ctrl->setParameter($this,
"pool_view", self::POOL_VIEW_ALL);
480 $actions[
$lng->txt(
"mep_all_mobs")] =
$ctrl->getLinkTarget($this,
"listPoolItems");
481 $ctrl->setParameter($this,
"pool_view", $this->pool_view);
482 $aria_label =
$lng->txt(
"cont_change_pool_view");
483 $view_control =
$f->viewControl()->mode($actions, $aria_label)->withActive(($this->pool_view == self::POOL_VIEW_FOLDER)
484 ?
$lng->txt(
"folders") :
$lng->txt(
"mep_all_mobs"));
486 $tb->addComponent($view_control);
488 $html = $tb->getHTML();
492 $html .= $pool_table->getHTML();
504 $mpool_table->resetOffset();
505 $mpool_table->writeFilterToSession();
506 $this->ctrl->redirect($this,
"listPoolItems");
515 $mpool_table->resetOffset();
516 $mpool_table->resetFilter();
517 $this->ctrl->redirect($this,
"listPoolItems");
534 $this->pool_view == self::POOL_VIEW_ALL
536 $mpool_table->setFilterCommand(
"applyFilter");
537 $mpool_table->setResetCommand(
"resetFilter");
538 $mpool_table->setInsertCommand(
"insertFromPool");
549 $ctrl->setParameter($this,
"mep",
$_GET[
"mep_ref_id"]);
550 $ctrl->redirect($this,
"listPoolItems");
567 $exp->setTypeWhiteList(array(
"root",
"cat",
"grp",
"fold",
"crs",
"mep"));
568 $exp->setClickableTypes(array(
'mep'));
569 if (!$exp->handleCommand()) {
579 if (!is_array(
$_POST[
"id"])) {
585 foreach (
$_POST[
"id"] as $pool_entry_id) {
588 if (!in_array($mob->getMediaItem(
"Standard")->getFormat(), $this->
getMimeTypes())) {
590 $mob->getMediaItem(
"Standard")->getFormat());
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
Select media pool for adding objects into pages.