Пример #1
0
 /**
  * Init table template generation form
  */
 function initTemplateGenerationForm()
 {
     global $lng, $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form_gui = new ilPropertyFormGUI();
     $this->form_gui->setTitle($lng->txt("sty_generate_template"));
     // name
     $name_input = new ilRegExpInputGUI($lng->txt("sty_template_name"), "name");
     $name_input->setPattern("/^[a-zA-Z]+[a-zA-Z0-9]*\$/");
     $name_input->setNoMatchMessage($lng->txt("sty_msg_color_must_only_include") . " A-Z, a-z, 1-9");
     $name_input->setRequired(true);
     $name_input->setSize(30);
     $name_input->setMaxLength(30);
     $this->form_gui->addItem($name_input);
     // basic layout
     $bl_input = new ilSelectInputGUI($lng->txt("sty_template_layout"), "layout");
     $options = array("coloredZebra" => $lng->txt("sty_table_template_colored_zebra"), "bwZebra" => $lng->txt("sty_table_template_bw_zebra"), "noZebra" => $lng->txt("sty_table_template_no_zebra"));
     $bl_input->setOptions($options);
     $this->form_gui->addItem($bl_input);
     // top bottom padding
     include_once "./Services/Style/classes/class.ilNumericStyleValueInputGUI.php";
     $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_top_bottom_padding"), "tb_padding");
     $num_input->setAllowPercentage(false);
     $num_input->setValue("3px");
     $this->form_gui->addItem($num_input);
     // left right padding
     $num_input = new ilNumericStyleValueInputGUI($lng->txt("sty_left_right_padding"), "lr_padding");
     $num_input->setAllowPercentage(false);
     $num_input->setValue("10px");
     $this->form_gui->addItem($num_input);
     // base color
     $bc_input = new ilSelectInputGUI($lng->txt("sty_base_color"), "base_color");
     $cs = $this->object->getColors();
     $options = array();
     foreach ($cs as $c) {
         $options[$c["name"]] = $c["name"];
     }
     $bc_input->setOptions($options);
     $this->form_gui->addItem($bc_input);
     // Lightness Settings
     $lss = array("border" => 90, "header_text" => 70, "header_bg" => 0, "cell1_text" => -60, "cell1_bg" => 90, "cell2_text" => -60, "cell2_bg" => 75);
     foreach ($lss as $ls => $v) {
         $l_input = new ilNumberInputGUI($lng->txt("sty_lightness_" . $ls), "lightness_" . $ls);
         $l_input->setMaxValue(100);
         $l_input->setMinValue(-100);
         $l_input->setValue($v);
         $l_input->setSize(4);
         $l_input->setMaxLength(4);
         $this->form_gui->addItem($l_input);
     }
     $this->form_gui->addCommandButton("templateGeneration", $lng->txt("generate"));
     $this->form_gui->addCommandButton("cancelTemplateSaving", $lng->txt("cancel"));
     $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
 }
 /**
  * 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"));
 }