/**
  * Add all fields to the form
  */
 protected function initForm()
 {
     $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
     $this->setTitle($this->lng->txt('orgu_type_custom_icon'));
     $item = new ilImageFileInputGUI($this->lng->txt('icon') . ' 32x32 px', 'icon');
     $item->setSuffixes(array('svg'));
     $item->setInfo($this->lng->txt('orgu_type_custom_icon_info'));
     if (is_file($this->type->getIconPath(true))) {
         $item->setImage($this->type->getIconPath(true));
     }
     $this->addItem($item);
     $this->addCommandButton('updateCustomIcons', $this->lng->txt('save'));
 }
 /**
  * Init add cast item form.
  */
 function initAddCastItemForm($a_mode = "create")
 {
     global $lng, $ilCtrl, $ilTabs;
     $this->checkPermission("write");
     $ilTabs->activateTab("edit_content");
     $lng->loadLanguageModule("mcst");
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     include "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form_gui = new ilPropertyFormGUI();
     $this->form_gui->setMultipart(true);
     // Property Title
     $text_input = new ilTextInputGUI($lng->txt("title"), "title");
     $text_input->setMaxLength(200);
     $this->form_gui->addItem($text_input);
     // Property Content
     $text_area = new ilTextAreaInputGUI($lng->txt("description"), "description");
     $text_area->setRequired(false);
     $this->form_gui->addItem($text_area);
     // Property Visibility
     if ($enable_internal_rss) {
         $radio_group = new ilRadioGroupInputGUI($lng->txt("access_scope"), "visibility");
         $radio_option = new ilRadioOption($lng->txt("access_users"), "users");
         $radio_group->addOption($radio_option);
         $radio_option = new ilRadioOption($lng->txt("access_public"), "public");
         $radio_group->addOption($radio_option);
         $radio_group->setInfo($lng->txt("mcst_visibility_info"));
         $radio_group->setRequired(true);
         $radio_group->setValue($this->object->getDefaultAccess() == 0 ? "users" : "public");
         $this->form_gui->addItem($radio_group);
     }
     // Duration
     $dur = new ilDurationInputGUI($lng->txt("mcst_duration"), "duration");
     $dur->setInfo($lng->txt("mcst_duration_info"));
     $dur->setShowDays(false);
     $dur->setShowHours(true);
     $dur->setShowSeconds(true);
     $this->form_gui->addItem($dur);
     foreach (ilObjMediaCast::$purposes as $purpose) {
         if ($purpose == "VideoAlternative" && $a_mode == "create") {
             continue;
         }
         $section = new ilFormSectionHeaderGUI();
         $section->setTitle($lng->txt("mcst_" . strtolower($purpose) . "_title"));
         $this->form_gui->addItem($section);
         if ($a_mode != "create") {
             $value = new ilHiddenInputGUI("value_" . $purpose);
             $label = new ilNonEditableValueGUI($lng->txt("value"));
             $label->setPostVar("label_value_" . $purpose);
             $label->setInfo($lng->txt("mcst_current_value_info"));
             $this->form_gui->addItem($label);
             $this->form_gui->addItem($value);
         }
         $file = new ilFileInputGUI($lng->txt("file"), "file_" . $purpose);
         $file->setSuffixes($this->purposeSuffixes[$purpose]);
         $this->form_gui->addItem($file);
         $text_input = new ilRegExpInputGUI($lng->txt("url"), "url_" . $purpose);
         $text_input->setPattern("/https?\\:\\/\\/.+/i");
         $text_input->setInfo($lng->txt("mcst_reference_info"));
         $this->form_gui->addItem($text_input);
         if ($purpose != "Standard") {
             $clearCheckBox = new ilCheckboxInputGUI();
             $clearCheckBox->setPostVar("delete_" . $purpose);
             $clearCheckBox->setTitle($lng->txt("mcst_clear_purpose_title"));
             $this->form_gui->addItem($clearCheckBox);
         } else {
             // mime type selection
             $mimeTypeSelection = new ilSelectInputGUI();
             $mimeTypeSelection->setPostVar("mimetype_" . $purpose);
             $mimeTypeSelection->setTitle($lng->txt("mcst_mimetype"));
             $mimeTypeSelection->setInfo($lng->txt("mcst_mimetype_info"));
             $options = array("" => $lng->txt("mcst_automatic_detection"));
             $options = array_merge($options, $this->mimeTypes);
             $mimeTypeSelection->setOptions($options);
             $this->form_gui->addItem($mimeTypeSelection);
             // preview picure
             $pp = new ilImageFileInputGUI($lng->txt("mcst_preview_picture"), "preview_pic");
             $pp->setSuffixes(array("png", "jpeg", "jpg"));
             $pp->setInfo($lng->txt("mcst_preview_picture_info") . " mp4, mp3, png, jp(e)g, gif");
             $this->form_gui->addItem($pp);
         }
     }
     // save/cancel button
     if ($a_mode == "create") {
         $this->form_gui->setTitle($lng->txt("mcst_add_new_item"));
         $this->form_gui->addCommandButton("saveCastItem", $lng->txt("save"));
     } else {
         $this->form_gui->setTitle($lng->txt("mcst_edit_item"));
         $this->form_gui->addCommandButton("updateCastItem", $lng->txt("save"));
     }
     $this->form_gui->addCommandButton("listItems", $lng->txt("cancel"));
     $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveCastItem"));
 }
 /**
  * Init the form to set the type icons
  * 
  * @param	integer		type id 
  */
 private function initFormIcons()
 {
     global $ilSetting, $lng, $ilCtrl;
     $type_id = $this->type->getTypeId();
     $svg = ilExternalContentPlugin::_getIcon("xxco", "svg", 0, $type_id, "type");
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     $form->setTitle($this->txt('icons'));
     $caption = $this->txt("svg_icon");
     $item = new ilImageFileInputGUI($caption, "svg_icon");
     $item->setSuffixes(array("svg"));
     $item->setImage($svg);
     $form->addItem($item);
     if (empty($svg)) {
         $caption = $lng->txt("big_icon") . " (" . ilExternalContentPlugin::BIG_ICON_SIZE . ")";
         $item = new ilImageFileInputGUI($caption, "big_icon");
         $item->setImage(ilExternalContentPlugin::_getIcon("xxco", "big", 0, $type_id, "type"));
         $form->addItem($item);
         $caption = $lng->txt("standard_icon") . " (" . ilExternalContentPlugin::SMALL_ICON_SIZE . ")";
         $item = new ilImageFileInputGUI($caption, "small_icon");
         $item->setImage(ilExternalContentPlugin::_getIcon("xxco", "small", 0, $type_id, "type"));
         $form->addItem($item);
         $caption = $lng->txt("tiny_icon") . " (" . ilExternalContentPlugin::TINY_ICON_SIZE . ")";
         $item = new ilImageFileInputGUI($caption, "tiny_icon");
         $item->setImage(ilExternalContentPlugin::_getIcon("xxco", "tiny", 0, $type_id, "type"));
         $form->addItem($item);
     }
     $form->addCommandButton('submitFormIcons', $lng->txt('save'));
     $this->form = $form;
 }
예제 #4
0
 /**
  * show edit section of custom icons for container
  * 
  */
 function showCustomIconsEditing($a_input_colspan = 1, ilPropertyFormGUI $a_form = null, $a_as_section = true)
 {
     if ($this->ilias->getSetting("custom_icons")) {
         if (!$a_form) {
             /*
             $this->tpl->addBlockFile("CONTAINER_ICONS", "container_icon_settings",
             	"tpl.container_icon_settings.html", "Services/Container");
             
             if (($big_icon = $this->object->getBigIconPath()) != "")
             {
             	$this->tpl->setCurrentBlock("big_icon");
             	$this->tpl->setVariable("SRC_BIG_ICON", $big_icon);
             	$this->tpl->parseCurrentBlock();
             }
             if ($this->object->getType() != "root")
             {
             	if (($small_icon = $this->object->getSmallIconPath()) != "")
             	{
             		$this->tpl->setCurrentBlock("small_icon");
             		$this->tpl->setVariable("SRC_SMALL_ICON", $small_icon);
             		$this->tpl->parseCurrentBlock();
             	}
             	$this->tpl->setCurrentBlock("small_icon_row");
             	$this->tpl->setVariable("SMALL_ICON", $this->lng->txt("standard_icon"));
             	$this->tpl->setVariable("SMALL_SIZE", "(".
             		$this->ilias->getSetting("custom_icon_small_width")."x".
             		$this->ilias->getSetting("custom_icon_small_height").")");
             	$this->tpl->setVariable("TXT_REMOVE_S", $this->lng->txt("remove"));
             	$this->tpl->parseCurrentBlock();
             }
             if (($tiny_icon = $this->object->getTinyIconPath()) != "")
             {
             	$this->tpl->setCurrentBlock("tiny_icon");
             	$this->tpl->setVariable("SRC_TINY_ICON", $tiny_icon);
             	$this->tpl->parseCurrentBlock();
             }
             $this->tpl->setCurrentBlock("container_icon_settings");
             $this->tpl->setVariable("SPAN_TITLE", $a_input_colspan + 1);
             $this->tpl->setVariable("SPAN_INPUT", $a_input_colspan);
             $this->tpl->setVariable("ICON_SETTINGS", $this->lng->txt("icon_settings"));
             $this->tpl->setVariable("BIG_ICON", $this->lng->txt("big_icon"));
             $this->tpl->setVariable("TINY_ICON", $this->lng->txt("tiny_icon"));
             $this->tpl->setVariable("BIG_SIZE", "(".
             	$this->ilias->getSetting("custom_icon_big_width")."x".
             	$this->ilias->getSetting("custom_icon_big_height").")");
             $this->tpl->setVariable("TINY_SIZE", "(".
             	$this->ilias->getSetting("custom_icon_tiny_width")."x".
             	$this->ilias->getSetting("custom_icon_tiny_height").")");
             $this->tpl->setVariable("TXT_REMOVE", $this->lng->txt("remove"));
             $this->tpl->parseCurrentBlock();
             */
         } else {
             //$big_icon = $this->object->getBigIconPath();
             $custom_icon = $this->object->getCustomIconPath();
             //$tiny_icon = $this->object->getTinyIconPath();
             if ($a_as_section) {
                 $title = new ilFormSectionHeaderGUI();
                 $title->setTitle($this->lng->txt("icon_settings"));
             } else {
                 $title = new ilCustomInputGUI($this->lng->txt("icon_settings"), "");
             }
             $a_form->addItem($title);
             // big
             /*
             				$caption = $this->lng->txt("big_icon")." (".
             					$this->ilias->getSetting("custom_icon_big_width")."x".
             					$this->ilias->getSetting("custom_icon_big_height").")";
             				$icon = new ilImageFileInputGUI($caption, "cont_big_icon");
             				$icon->setImage($big_icon);
             				if($a_as_section)
             				{
             					$a_form->addItem($icon);
             				}
             				else
             				{
             					$title->addSubItem($icon);
             				}*/
             // small/standard
             //if ($this->object->getType() != "root")
             //{
             /*$caption = $this->lng->txt("standard_icon")." (".
             		$this->ilias->getSetting("custom_icon_small_width")."x".
             		$this->ilias->getSetting("custom_icon_small_height").")";*/
             $caption = $this->lng->txt("cont_custom_icon");
             $icon = new ilImageFileInputGUI($caption, "cont_icon");
             $icon->setSuffixes(array("svg"));
             $icon->setImage($custom_icon);
             if ($a_as_section) {
                 $a_form->addItem($icon);
             } else {
                 $title->addSubItem($icon);
             }
             //}
             // tiny
             /*
             $caption = $this->lng->txt("tiny_icon")." (".
             	$this->ilias->getSetting("custom_icon_tiny_width")."x".
             	$this->ilias->getSetting("custom_icon_tiny_height").")";
             $icon = new ilImageFileInputGUI($caption, "cont_tiny_icon");
             $icon->setImage($tiny_icon);
             if($a_as_section)
             {
             	$a_form->addItem($icon);
             }
             else
             {
             	$title->addSubItem($icon);
             }
             */
         }
     }
 }
 /**
  * Init form
  */
 protected function initForm()
 {
     $title = $this->signature->getId() ? $this->pl->txt('edit_signature') : $this->pl->txt('add_new_signature');
     $this->setTitle($title);
     $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
     $item = new ilTextInputGUI($this->pl->txt('first_name'), 'first_name');
     $item->setValue($this->signature->getFirstName());
     $item->setRequired(true);
     $this->addItem($item);
     $item = new ilTextInputGUI($this->pl->txt('last_name'), 'last_name');
     $item->setValue($this->signature->getLastName());
     $item->setRequired(true);
     $this->addItem($item);
     // If the signature is a rasterized image, we display it base64 encoded
     $is_vector = in_array(strtolower($this->signature->getSuffix()), array('svg'));
     if ($is_vector) {
         $item = new ilFileInputGUI($this->pl->txt('signature_file'), 'signature_file');
     } else {
         $item = new ilImageFileInputGUI($this->pl->txt('signature_file'), 'signature_file');
     }
     $item->setSuffixes(array('jpeg', 'jpg', 'gif', 'bmp', 'png', 'svg'));
     $signature_file = $this->signature->getFilePath(true);
     if (is_file($signature_file) && !$is_vector) {
         $item->setValue($signature_file);
         $base64 = base64_encode(file_get_contents($signature_file));
         $suffix = $this->signature->getSuffix();
         $item->setImage("data:image/{$suffix};base64,{$base64}");
     }
     $item->setFilename($signature_file);
     $item->setInfo($this->pl->txt('signature_file_info'));
     $item->setRequired(!is_file($signature_file));
     $item->setValue($this->signature->getFilePath(true));
     $this->addItem($item);
     $command = $this->signature->getId() ? 'updateSignature' : 'createSignature';
     $this->addCommandButton($command, $this->lng->txt('save'));
 }