/** * Init alias form */ function initAliasForm() { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); // standard view resource $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard", $this->content_obj->getPcId()); $std_item = $this->content_obj->getMediaObject()->getMediaItem("Standard"); // title, location and format $title = new ilNonEditableValueGUI($lng->txt("title"), "title"); $this->form_gui->addItem($title); $loc = new ilNonEditableValueGUI($this->lng->txt("cont_" . strtolower($std_item->getLocationType())), "st_location"); $this->form_gui->addItem($loc); $format = new ilNonEditableValueGUI($this->lng->txt("cont_format"), "st_format"); $this->form_gui->addItem($format); // standard size $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "st_derive_size"); $op1 = new ilRadioOption($lng->txt("cont_default") . " (" . $std_item->getWidth() . " x " . $std_item->getHeight() . ")", "y"); $op2 = new ilRadioOption($lng->txt("cont_custom"), "n"); $radio_size->addOption($op1); // width height include_once "./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php"; $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width") . " / " . $lng->txt("cont_height"), "st_width_height"); $width_height->setConstrainProportions(true); $op2->addSubItem($width_height); $radio_size->addOption($op2); $this->form_gui->addItem($radio_size); // standard caption $rad_caption = new ilRadioGroupInputGUI($lng->txt("cont_caption"), "st_derive_caption"); $op1 = new ilRadioOption($lng->txt("cont_default"), "y"); $def_cap = new ilNonEditableValueGUI("", "def_caption"); $op1->addSubItem($def_cap); $op2 = new ilRadioOption($lng->txt("cont_custom"), "n"); $rad_caption->addOption($op1); $caption = new ilTextAreaInputGUI("", "st_caption"); $caption->setCols(30); $caption->setRows(2); $op2->addSubItem($caption); /*$caption = new ilTextInputGUI("", "st_caption"); $caption->setSize(40); $caption->setMaxLength(200); $op2->addSubItem($caption);*/ $rad_caption->addOption($op2); $this->form_gui->addItem($rad_caption); // standard text representation if (substr($std_item->getFormat(), 0, 5) == "image") { $rad_tr = new ilRadioGroupInputGUI($lng->txt("text_repr"), "st_derive_text_representation"); $op1 = new ilRadioOption($lng->txt("cont_default"), "y"); $def_tr = new ilNonEditableValueGUI("", "def_text_representation"); $op1->addSubItem($def_tr); $op2 = new ilRadioOption($lng->txt("cont_custom"), "n"); $tr = new ilTextAreaInputGUI("", "st_text_representation"); $tr->setCols(30); $tr->setRows(2); $rad_tr->addOption($op1); $op2->addSubItem($tr); $rad_tr->addOption($op2); $this->form_gui->addItem($rad_tr); $rad_tr->setInfo($lng->txt("text_repr_info")); } // standard parameters if (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) { if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(), $std_item->getFormat())) { $par = $std_item->getParameters(); $def_str = $par["autostart"] == "true" ? " (" . $lng->txt("yes") . ")" : " (" . $lng->txt("no") . ")"; $rad_auto = new ilRadioGroupInputGUI($lng->txt("cont_autostart"), "st_derive_parameters"); $op1 = new ilRadioOption($lng->txt("cont_default") . $def_str, "y"); $rad_auto->addOption($op1); $op2 = new ilRadioOption($lng->txt("cont_custom"), "n"); $auto = new ilCheckboxInputGUI($lng->txt("enabled"), "st_autostart"); $op2->addSubItem($auto); $rad_auto->addOption($op2); $this->form_gui->addItem($rad_auto); } else { $rad_parameters = new ilRadioGroupInputGUI($lng->txt("cont_parameter"), "st_derive_parameters"); $op1 = new ilRadioOption($lng->txt("cont_default"), "y"); $def_par = new ilNonEditableValueGUI("", "def_parameters"); $op1->addSubItem($def_par); $rad_parameters->addOption($op1); $op2 = new ilRadioOption($lng->txt("cont_custom"), "n"); $par = new ilTextAreaInputGUI("", "st_parameters"); $par->setRows(5); $par->setCols(50); $op2->addSubItem($par); $rad_parameters->addOption($op2); $this->form_gui->addItem($rad_parameters); } } // fullscreen view if ($this->content_obj->getMediaObject()->hasFullScreenItem()) { $full_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Fullscreen", $this->content_obj->getPcId()); $full_item = $this->content_obj->getMediaObject()->getMediaItem("Fullscreen"); $fs_sec = new ilFormSectionHeaderGUI(); $fs_sec->setTitle($lng->txt("cont_fullscreen")); $this->form_gui->addItem($fs_sec); // resource $radio_prop = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "fullscreen"); $op1 = new ilRadioOption($lng->txt("cont_none"), "n"); $radio_prop->addOption($op1); $op2 = new ilRadioOption($this->lng->txt("cont_" . strtolower($full_item->getLocationType())) . ": " . $full_item->getLocation(), "y"); $radio_prop->addOption($op2); $this->form_gui->addItem($radio_prop); // format $format = new ilNonEditableValueGUI($this->lng->txt("cont_format"), "full_format"); $this->form_gui->addItem($format); // full size $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "full_derive_size"); $op1 = new ilRadioOption($lng->txt("cont_default") . " (" . $full_item->getWidth() . " x " . $full_item->getHeight() . ")", "y"); $op2 = new ilRadioOption($lng->txt("cont_custom"), "n"); $radio_size->addOption($op1); // width height include_once "./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php"; $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width") . " / " . $lng->txt("cont_height"), "full_width_height"); $width_height->setConstrainProportions(true); $op2->addSubItem($width_height); $radio_size->addOption($op2); $this->form_gui->addItem($radio_size); // fullscreen caption $rad_caption = new ilRadioGroupInputGUI($lng->txt("cont_caption"), "full_derive_caption"); $op1 = new ilRadioOption($lng->txt("cont_default"), "y"); $def_cap = new ilNonEditableValueGUI("", "full_def_caption"); $op1->addSubItem($def_cap); $op2 = new ilRadioOption($lng->txt("cont_custom"), "n"); $rad_caption->addOption($op1); $caption = new ilTextAreaInputGUI("", "full_caption"); $caption->setCols(30); $caption->setRows(2); $op2->addSubItem($caption); /*$caption = new ilTextInputGUI("", "full_caption"); $caption->setSize(40); $caption->setMaxLength(200); $op2->addSubItem($caption);*/ $rad_caption->addOption($op2); $this->form_gui->addItem($rad_caption); // fullscreen text representation if (substr($full_item->getFormat(), 0, 5) == "image") { $rad_tr = new ilRadioGroupInputGUI($lng->txt("text_repr"), "full_derive_text_representation"); $op1 = new ilRadioOption($lng->txt("cont_default"), "y"); $def_tr = new ilNonEditableValueGUI("", "full_def_text_representation"); $op1->addSubItem($def_tr); $op2 = new ilRadioOption($lng->txt("cont_custom"), "n"); $tr = new ilTextAreaInputGUI("", "full_text_representation"); $tr->setCols(30); $tr->setRows(2); $rad_tr->addOption($op1); $op2->addSubItem($tr); $rad_tr->addOption($op2); $this->form_gui->addItem($rad_tr); $rad_tr->setInfo($lng->txt("text_repr_info")); } // fullscreen parameters if (!in_array($full_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) { if (ilObjMediaObject::_useAutoStartParameterOnly($full_item->getLocation(), $full_item->getFormat())) { $par = $full_item->getParameters(); $def_str = $par["autostart"] == "true" ? " (" . $lng->txt("yes") . ")" : " (" . $lng->txt("no") . ")"; $rad_auto = new ilRadioGroupInputGUI($lng->txt("cont_autostart"), "full_derive_parameters"); $op1 = new ilRadioOption($lng->txt("cont_default") . $def_str, "y"); $rad_auto->addOption($op1); $op2 = new ilRadioOption($lng->txt("cont_custom"), "n"); $auto = new ilCheckboxInputGUI($lng->txt("enabled"), "full_autostart"); $op2->addSubItem($auto); $rad_auto->addOption($op2); $this->form_gui->addItem($rad_auto); } else { $rad_parameters = new ilRadioGroupInputGUI($lng->txt("cont_parameter"), "full_derive_parameters"); $op1 = new ilRadioOption($lng->txt("cont_default"), "y"); $def_par = new ilNonEditableValueGUI("", "full_def_parameters"); $op1->addSubItem($def_par); $rad_parameters->addOption($op1); $op2 = new ilRadioOption($lng->txt("cont_custom"), "n"); $par = new ilTextAreaInputGUI("", "full_parameters"); $par->setRows(5); $par->setCols(50); $op2->addSubItem($par); $rad_parameters->addOption($op2); $this->form_gui->addItem($rad_parameters); } } } $this->form_gui->setTitle($lng->txt("cont_edit_mob_alias_prop")); $this->form_gui->addCommandButton("saveAliasProperties", $lng->txt("save")); $lm_set = new ilSetting("lm"); if ($lm_set->get("replace_mob_feature")) { $this->form_gui->addCommandButton("changeObjectReference", $lng->txt("cont_change_object_reference")); } $this->form_gui->setFormAction($ilCtrl->getFormAction($this)); }
/** * Init creation form */ function initForm($a_mode = "create") { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; if ($a_mode == "edit") { $std_item = $this->object->getMediaItem("Standard"); } $this->form_gui = new ilPropertyFormGUI(); // standard view resource $title = new ilTextInputGUI($lng->txt("title"), "standard_title"); $title->setSize(40); $title->setMaxLength(120); $this->form_gui->addItem($title); $radio_prop = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "standard_type"); $op1 = new ilRadioOption($lng->txt("cont_file"), "File"); $up = new ilFileInputGUI("", "standard_file"); $up->setSuffixes(ilObjMediaObject::getRestrictedFileTypes()); $up->setInfo(""); $op1->addSubItem($up); $radio_prop->addOption($op1); $op2 = new ilRadioOption($lng->txt("url"), "Reference"); $ref = new ilTextInputGUI("", "standard_reference"); $ref->setInfo($lng->txt("cont_ref_helptext")); $op2->addSubItem($ref); $radio_prop->addOption($op2); $radio_prop->setValue("File"); $this->form_gui->addItem($radio_prop); // standard format if ($a_mode == "edit") { $format = new ilNonEditableValueGUI($lng->txt("cont_format"), "standard_format"); $format->setValue($std_item->getFormat()); $this->form_gui->addItem($format); } // standard size $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "standard_size"); if ($a_mode == "edit") { if ($orig_size = $std_item->getOriginalSize()) { $add_str = " (" . $orig_size["width"] . " x " . $orig_size["height"] . ")"; } $op1 = new ilRadioOption($lng->txt("cont_resource_size") . $add_str, "original"); $op2 = new ilRadioOption($lng->txt("cont_custom_size"), "selected"); } else { $op1 = new ilRadioOption($lng->txt("cont_orig_size"), "original"); $op2 = new ilRadioOption($lng->txt("cont_adjust_size"), "selected"); } $radio_size->addOption($op1); // width height include_once "./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php"; $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width") . " / " . $lng->txt("cont_height"), "standard_width_height"); $width_height->setConstrainProportions(true); $op2->addSubItem($width_height); // resize image if ($a_mode == "edit") { $std_item = $this->object->getMediaItem("Standard"); if (is_int(strpos($std_item->getFormat(), "image")) && $std_item->getLocationType() == "LocalFile") { $resize = new ilCheckboxInputGUI($lng->txt("cont_resize_img"), "standard_resize"); $op2->addSubItem($resize); } } $radio_size->setValue("original"); if ($a_mode == "create" && ($this->getHeightPreset() > 0 || $this->getWidthPreset() > 0)) { $radio_size->setValue("selected"); $width_height->setWidth($this->getWidthPreset()); $width_height->setHeight($this->getHeightPreset()); } $radio_size->addOption($op2); $this->form_gui->addItem($radio_size); // standard caption $caption = new ilTextAreaInputGUI($lng->txt("cont_caption"), "standard_caption"); $caption->setCols(30); $caption->setRows(2); $this->form_gui->addItem($caption); /*$caption = new ilTextInputGUI($lng->txt("cont_caption"), "standard_caption"); $caption->setSize(40); $caption->setMaxLength(200); $this->form_gui->addItem($caption);*/ // text representation (alt text) if ($a_mode == "edit" && is_int(strpos($std_item->getFormat(), "image"))) { $ta = new ilTextAreaInputGUI($lng->txt("text_repr"), "text_representation"); $ta->setCols(30); $ta->setRows(2); $ta->setInfo($lng->txt("text_repr_info")); $this->form_gui->addItem($ta); } // standard parameters if ($a_mode == "edit" && !in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) { if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(), $std_item->getFormat())) { $auto = new ilCheckboxInputGUI($lng->txt("cont_autostart"), "standard_autostart"); $this->form_gui->addItem($auto); } else { $par = new ilTextAreaInputGUI($lng->txt("cont_parameter"), "standard_parameters"); $par->setRows(5); $par->setCols(50); $this->form_gui->addItem($par); } } if ($a_mode == "edit") { $full_item = $this->object->getMediaItem("Fullscreen"); } // fullscreen view resource $fs_sec = new ilFormSectionHeaderGUI(); $fs_sec->setTitle($lng->txt("cont_fullscreen")); $this->form_gui->addItem($fs_sec); $radio_prop2 = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "full_type"); $op1 = new ilRadioOption($lng->txt("cont_none"), "None"); $radio_prop2->addOption($op1); $op4 = new ilRadioOption($lng->txt("cont_use_same_resource_as_above"), "Standard"); $radio_prop2->addOption($op4); $op2 = new ilRadioOption($lng->txt("cont_file"), "File"); $up = new ilFileInputGUI("", "full_file"); $up->setSuffixes(ilObjMediaObject::getRestrictedFileTypes()); $up->setInfo(""); $op2->addSubItem($up); $radio_prop2->addOption($op2); $op3 = new ilRadioOption($lng->txt("url"), "Reference"); $ref = new ilTextInputGUI("", "full_reference"); $ref->setInfo($lng->txt("cont_ref_helptext")); $op3->addSubItem($ref); $radio_prop2->addOption($op3); $radio_prop2->setValue("None"); $this->form_gui->addItem($radio_prop2); // fullscreen format if ($a_mode == "edit") { if ($this->object->hasFullscreenItem()) { $format = new ilNonEditableValueGUI($lng->txt("cont_format"), "full_format"); $format->setValue($full_item->getFormat()); $this->form_gui->addItem($format); } } // fullscreen size $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "full_size"); if ($a_mode == "edit") { $add_str = ""; if ($this->object->hasFullscreenItem() && ($orig_size = $full_item->getOriginalSize())) { $add_str = " (" . $orig_size["width"] . " x " . $orig_size["height"] . ")"; } $op1 = new ilRadioOption($lng->txt("cont_resource_size") . $add_str, "original"); $op2 = new ilRadioOption($lng->txt("cont_custom_size"), "selected"); } else { $op1 = new ilRadioOption($lng->txt("cont_orig_size"), "original"); $op2 = new ilRadioOption($lng->txt("cont_adjust_size"), "selected"); } $radio_size->addOption($op1); // width/height $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width") . " / " . $lng->txt("cont_height"), "full_width_height"); $width_height->setConstrainProportions(true); $op2->addSubItem($width_height); // resize image if ($a_mode == "edit") { $full_item = $this->object->getMediaItem("Fullscreen"); if ($this->object->hasFullscreenItem() && is_int(strpos($full_item->getFormat(), "image")) && $full_item->getLocationType() == "LocalFile") { $resize = new ilCheckboxInputGUI($lng->txt("cont_resize_img"), "full_resize"); $op2->addSubItem($resize); } } $radio_size->setValue("original"); $radio_size->addOption($op2); $this->form_gui->addItem($radio_size); // fullscreen caption $caption = new ilTextAreaInputGUI($lng->txt("cont_caption"), "full_caption"); $caption->setCols(30); $caption->setRows(2); $this->form_gui->addItem($caption); /*$caption = new ilTextInputGUI($lng->txt("cont_caption"), "full_caption"); $caption->setSize(40); $caption->setMaxLength(200); $this->form_gui->addItem($caption);*/ // text representation (alt text) if ($a_mode == "edit" && $this->object->hasFullscreenItem() && is_int(strpos($std_item->getFormat(), "image"))) { $ta = new ilTextAreaInputGUI($lng->txt("text_repr"), "full_text_representation"); $ta->setCols(30); $ta->setRows(2); $ta->setInfo($lng->txt("text_repr_info")); $this->form_gui->addItem($ta); } // fullscreen parameters if ($a_mode == "edit" && $this->object->hasFullscreenItem() && !in_array($full_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) { if (ilObjMediaObject::_useAutoStartParameterOnly($full_item->getLocation(), $full_item->getFormat())) { $auto = new ilCheckboxInputGUI($lng->txt("cont_autostart"), "full_autostart"); $this->form_gui->addItem($auto); } else { $par = new ilTextAreaInputGUI($lng->txt("cont_parameter"), "full_parameters"); $par->setRows(5); $par->setCols(50); $this->form_gui->addItem($par); } } $this->form_gui->setTitle($lng->txt("cont_insert_mob")); if ($a_mode == "edit") { $this->form_gui->addCommandButton("saveProperties", $lng->txt("save")); } else { $this->form_gui->addCommandButton("save", $lng->txt("save")); $this->form_gui->addCommandButton("cancel", $lng->txt("cancel")); } $this->form_gui->setFormAction($ilCtrl->getFormAction($this)); }