Exemplo n.º 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));
 }