/** * Get character style selector */ static function getCharStyleSelector($a_par_type, $a_use_callback = true) { global $lng; include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $selection = new ilAdvancedSelectionListGUI(); $selection->setFormSelectMode("char_characteristic", "", false, "", "", "", "", "", "", ""); $selection->setId("char_style_selection"); $selection->setSelectionHeaderClass("ilEditSubmit"); $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK); //$selection->setSelectedValue($a_selected); $selection->setUseImages(false); $selection->setOnClickMode(ilAdvancedSelectionListGUI::ON_ITEM_CLICK_NOP); if ($a_use_callback) { $selection->setSelectCallback("ilCOPage.setCharacterClass"); } //$chars = $a_chars; //$title_char = ($chars[$a_selected] != "") // ? $chars[$a_selected] // : $a_selected; $selection->setListTitle(" <i>A</i>"); /*if ($chars[$a_seleted] == "" && ($a_seleted != "")) { $chars = array_merge(array($a_seleted => $a_seleted), $chars); }*/ $chars = array("Comment" => array("code" => "com", "txt" => $lng->txt("cont_char_style_com")), "Quotation" => array("code" => "quot", "txt" => $lng->txt("cont_char_style_quot")), "Accent" => array("code" => "acc", "txt" => $lng->txt("cont_char_style_acc")), "Code" => array("code" => "code", "txt" => $lng->txt("cont_char_style_code"))); foreach ($chars as $key => $char) { if (ilPageEditorSettings::lookupSettingByParentType($a_par_type, "active_" . $char["code"], true)) { $t = "text_inline"; $tag = "span"; switch ($key) { case "Code": $tag = "code"; break; } $html = '<' . $tag . ' class="ilc_' . $t . '_' . $key . '" style="font-size:90%; margin-top:2px; margin-bottom:2px; position:static;">' . $char["txt"] . "</" . $tag . ">"; // this next line is very important for IE. The real onclick event is on the surrounding <tr> of the // advanced selection list. But it is impossible to prevent the tr-event from removing the focus // on tiny withouth the following line, that receives the click event before and stops the faulty default // bevaviour of IE, see bug report #8723 $html = '<a class="nostyle" style="display:block;" href="#" onclick="return false;">' . $html . "</a>"; $selection->addItem($char["txt"], $key, "", "", $key, "", $html); } } return $selection->getHTML(); }