/** * Edit section form. */ function edit($a_insert = false) { global $ilCtrl, $tpl, $lng; $this->displayValidationError(); // edit form include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); if ($a_insert) { $form->setTitle($this->lng->txt("cont_insert_section")); } else { $form->setTitle($this->lng->txt("cont_update_section")); } // characteristic selection require_once "./Services/Form/classes/class.ilAdvSelectInputGUI.php"; $char_prop = new ilAdvSelectInputGUI($this->lng->txt("cont_characteristic"), "characteristic"); $chars = $this->getCharacteristics(); if (is_object($this->content_obj)) { if ($chars[$a_seleted_value] == "" && $this->content_obj->getCharacteristic() != "") { $chars = array_merge(array($this->content_obj->getCharacteristic() => $this->content_obj->getCharacteristic()), $chars); } } $selected = $a_insert ? "Block" : $this->content_obj->getCharacteristic(); foreach ($chars as $k => $char) { $html = '<div class="ilCOPgEditStyleSelectionItem"><div class="ilc_section_' . $k . '" style="' . self::$style_selector_reset . '">' . $char . '</div></div>'; $char_prop->addOption($k, $char, $html); } $char_prop->setValue($selected); $form->addItem($char_prop); // save/cancel buttons if ($a_insert) { $form->addCommandButton("create_section", $lng->txt("save")); $form->addCommandButton("cancelCreate", $lng->txt("cancel")); } else { $form->addCommandButton("update", $lng->txt("save")); $form->addCommandButton("cancelUpdate", $lng->txt("cancel")); } $html = $form->getHTML(); $tpl->setContent($html); return $ret; }
/** * Insert tabs form. */ function initForm($a_mode = "edit") { global $ilCtrl, $tpl, $lng; include_once "./Services/Accordion/classes/class.ilAccordionGUI.php"; ilAccordionGUI::addCss(); // edit form include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($ilCtrl->getFormAction($this)); if ($a_mode != "edit") { $this->form->setTitle($lng->txt("cont_ed_insert_tabs")); } else { $this->form->setTitle($lng->txt("cont_edit_tabs")); } // tabs type /*$type_prop = new ilSelectInputGUI($lng->txt("cont_type"), "type"); $types = array(ilPCTabs::ACCORDION_VER => $lng->txt("cont_tabs_acc_ver"), ilPCTabs::ACCORDION_HOR => $lng->txt("cont_tabs_acc_hor")); $type_prop->setOptions($types); $this->form->addItem($type_prop);*/ $templ = $this->getTemplateOptions("vaccordion"); require_once "./Services/Form/classes/class.ilAdvSelectInputGUI.php"; $vchar_prop = new ilAdvSelectInputGUI($this->lng->txt("cont_characteristic"), "vaccord_templ"); $vchars = array(); foreach ($templ as $k => $te) { $t = explode(":", $k); $html = $this->style->lookupTemplatePreview($t[1]) . '<div style="clear:both" class="small">' . $te . "</div>"; $vchar_prop->addOption($k, $te, $html); if ($t[2] == "VerticalAccordion") { $vchar_prop->setValue($k); } } $templ = $this->getTemplateOptions("haccordion"); $hchar_prop = new ilAdvSelectInputGUI($this->lng->txt("cont_characteristic"), "haccord_templ"); $hchars = array(); foreach ($templ as $k => $te) { $t = explode(":", $k); $html = $this->style->lookupTemplatePreview($t[1]) . '<div style="clear:both" class="small">' . $te . "</div>"; $hchar_prop->addOption($k, $te, $html); if ($t[2] == "HorizontalAccordion") { $hchar_prop->setValue($k); } } $radg = new ilRadioGroupInputGUI($lng->txt("cont_type"), "type"); $radg->setValue(ilPCTabs::ACCORDION_VER); $op1 = new ilRadioOption($lng->txt("cont_tabs_acc_ver"), ilPCTabs::ACCORDION_VER); $op1->addSubItem($vchar_prop); $radg->addOption($op1); $op2 = new ilRadioOption($lng->txt("cont_tabs_acc_hor"), ilPCTabs::ACCORDION_HOR); $op2->addSubItem($hchar_prop); $radg->addOption($op2); $this->form->addItem($radg); // number of initial tabs if ($a_mode == "create") { $nr_prop = new ilSelectInputGUI($lng->txt("cont_number_of_tabs"), "nr"); $nrs = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10); $nr_prop->setOptions($nrs); $this->form->addItem($nr_prop); } $ni = new ilNumberInputGUI($this->lng->txt("cont_tab_cont_width"), "content_width"); $ni->setMaxLength(4); $ni->setSize(4); $this->form->addItem($ni); $ni = new ilNumberInputGUI($this->lng->txt("cont_tab_cont_height"), "content_height"); $ni->setMaxLength(4); $ni->setSize(4); $this->form->addItem($ni); // behaviour $options = array("AllClosed" => $lng->txt("cont_all_closed"), "FirstOpen" => $lng->txt("cont_first_open"), "ForceAllOpen" => $lng->txt("cont_force_all_open")); $si = new ilSelectInputGUI($this->lng->txt("cont_behavior"), "behavior"); $si->setOptions($options); $this->form->addItem($si); // alignment $align_opts = array("Left" => $lng->txt("cont_left"), "Right" => $lng->txt("cont_right"), "Center" => $lng->txt("cont_center"), "LeftFloat" => $lng->txt("cont_left_float"), "RightFloat" => $lng->txt("cont_right_float")); $align = new ilSelectInputGUI($this->lng->txt("cont_align"), "align"); $align->setOptions($align_opts); $align->setValue("Center"); $align->setInfo($lng->txt("cont_tabs_hor_align_info")); $this->form->addItem($align); // save/cancel buttons if ($a_mode == "create") { $this->form->addCommandButton("create_section", $lng->txt("save")); $this->form->addCommandButton("cancelCreate", $lng->txt("cancel")); } else { $this->form->addCommandButton("update", $lng->txt("save")); $this->form->addCommandButton("cancelUpdate", $lng->txt("cancel")); } }
/** * Edit cell styles */ function editCellStyle() { global $ilCtrl, $tpl, $lng, $ilTabs; $this->displayValidationError(); $this->setTabs(); $this->setCellPropertiesSubTabs(); $ilTabs->setSubTabActive("cont_style"); // edit form include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($this->lng->txt("cont_table_cell_properties")); // first row style require_once "./Services/Form/classes/class.ilAdvSelectInputGUI.php"; $style = new ilAdvSelectInputGUI($this->lng->txt("cont_style"), "style"); $this->setBasicTableCellStyles(); $this->getCharacteristicsOfCurrentStyle("table_cell"); // scorm-2004 $chars = $this->getCharacteristics(); // scorm-2004 $options = array_merge(array("" => $this->lng->txt("none")), $chars); // scorm-2004 foreach ($options as $k => $option) { $html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td class="ilc_table_cell_' . $k . '">' . $option . '</td></tr></table>'; $style->addOption($k, $option, $html); } $style->setValue(""); $style->setInfo($lng->txt("cont_set_tab_style_info")); $form->addItem($style); $form->setKeepOpen(true); $form->addCommandButton("setStyles", $lng->txt("cont_set_styles")); $html = $form->getHTML(); $html .= "<br />" . $this->renderTable("table_edit", "style") . "</form>"; $tpl->setContent($html); }
/** * Edit Style */ function editStyle() { global $ilCtrl, $tpl, $lng; $this->displayValidationError(); // edit form include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($this->lng->txt("cont_edit_style")); // characteristic selection require_once "./Services/Form/classes/class.ilAdvSelectInputGUI.php"; $char_prop = new ilAdvSelectInputGUI($this->lng->txt("cont_characteristic"), "characteristic"); $chars = $this->getCharacteristics(); if (is_object($this->content_obj)) { if ($chars[$a_seleted_value] == "" && $this->content_obj->getClass() != "") { $chars = array_merge(array($this->content_obj->getClass() => $this->content_obj->getClass()), $chars); } } $selected = $this->content_obj->getClass(); if ($selected == "") { $selected = "MediaContainer"; } foreach ($chars as $k => $char) { $html = '<table class="ilc_media_cont_' . $k . '"><tr><td>' . $char . '</td></tr></table>'; $char_prop->addOption($k, $char, $html); } $char_prop->setValue($selected); $form->addItem($char_prop); // save button $form->addCommandButton("saveStyle", $lng->txt("save")); $html = $form->getHTML(); $tpl->setContent($html); return $ret; }
/** * Init list form. * * @param int $a_mode Edit Mode */ public function initListForm($a_mode = "edit") { global $lng; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); // type $radg = new ilRadioGroupInputGUI($lng->txt("type"), "list_type"); $op1 = new ilRadioOption($lng->txt("cont_bullet_list"), "Unordered"); // style of bullet list require_once "./Services/Form/classes/class.ilAdvSelectInputGUI.php"; $style = new ilAdvSelectInputGUI($this->lng->txt("cont_style"), "bullet_style"); $this->getCharacteristicsOfCurrentStyle("list_u"); $options = $this->getCharacteristics(); if ($a_mode == "edit" && $this->content_obj->getListType() == "Unordered" && $this->content_obj->getStyleClass() != "" && !in_array($this->content_obj->getStyleClass(), $options)) { $options[$this->content_obj->getStyleClass()] = $this->content_obj->getStyleClass(); } if (count($options) > 1) { foreach ($options as $k => $option) { $html = '<ul class="ilc_list_u_' . $k . '"><li class="ilc_list_item_StandardListItem">' . $option . '</li></ul>'; if ($k == "BulletedList") { $k = ""; } $style->addOption($k, $option, $html); } $style->setValue(""); $op1->addSubItem($style); } $radg->addOption($op1); $op2 = new ilRadioOption($lng->txt("cont_numbered_list"), "Ordered"); // style of numbered list require_once "./Services/Form/classes/class.ilAdvSelectInputGUI.php"; $style = new ilAdvSelectInputGUI($this->lng->txt("cont_style"), "number_style"); $this->getCharacteristicsOfCurrentStyle("list_o"); $options = $this->getCharacteristics(); if ($a_mode == "edit" && $this->content_obj->getListType() == "Ordered" && $this->content_obj->getStyleClass() != "" && !in_array($this->content_obj->getStyleClass(), $options)) { $options[$this->content_obj->getStyleClass()] = $this->content_obj->getStyleClass(); } if (count($options) > 1) { foreach ($options as $k => $option) { $html = '<ol class="ilc_list_o_' . $k . '"><li class="ilc_list_item_StandardListItem">' . $option . '</li></ol>'; if ($k == "NumberedList") { $k = ""; } $style->addOption($k, $option, $html); } $style->setValue(""); $op2->addSubItem($style); } // numeric type $options = array("Number" => $this->lng->txt("cont_number_std"), "Decimal" => $this->lng->txt("cont_decimal"), "Roman" => $this->lng->txt("cont_roman"), "roman" => $this->lng->txt("cont_roman_s"), "Alphabetic" => $this->lng->txt("cont_alphabetic"), "alphabetic" => $this->lng->txt("cont_alphabetic_s")); $si = new ilSelectInputGUI($this->lng->txt("cont_number_type"), "numbering_type"); $si->setOptions($options); $op2->addSubItem($si); // starting value $ni = new ilNumberInputGUI($this->lng->txt("cont_start_value"), "start_value"); $ni->setMaxLength(3); $ni->setSize(3); $ni->setInfo($lng->txt("cont_start_value_info")); $op2->addSubItem($ni); $radg->addOption($op2); $radg->setValue("Unordered"); $this->form->addItem($radg); // nr of items $options = array(); if ($a_mode == "create") { for ($i = 1; $i <= 10; $i++) { $options[$i] = $i; } $si = new ilSelectInputGUI($this->lng->txt("cont_nr_items"), "nr_items"); $si->setOptions($options); $si->setValue(2); $this->form->addItem($si); } // save and cancel commands if ($a_mode == "create") { $this->form->addCommandButton("create_list", $lng->txt("save")); $this->form->addCommandButton("cancelCreate", $lng->txt("cancel")); $this->form->setTitle($lng->txt("cont_insert_list")); } else { $this->form->addCommandButton("saveProperties", $lng->txt("save")); $this->form->addCommandButton("cancelUpdate", $lng->txt("cancel")); $this->form->setTitle($lng->txt("cont_list_properties")); } $this->form->setFormAction($this->ctrl->getFormAction($this)); }