/**
  * Get Tiny Menu
  */
 static function getTinyMenu($a_par_type, $a_int_links = false, $a_wiki_links = false, $a_keywords = false, $a_style_id = 0, $a_paragraph_styles = true, $a_save_return = true, $a_anchors = false, $a_save_new = true)
 {
     global $lng, $ilCtrl;
     $mathJaxSetting = new ilSetting("MathJax");
     include_once "./Services/COPage/classes/class.ilPageEditorSettings.php";
     include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php";
     $btpl = new ilTemplate("tpl.tiny_menu.html", true, true, "Services/COPage");
     // debug ghost element
     if (DEVMODE == 1) {
         $btpl->touchBlock("debug_ghost");
     }
     // bullet list
     $btpl->touchBlock("blist_button");
     ilTooltipGUI::addTooltip("il_edm_blist", $lng->txt("cont_blist"), "iltinymenu_bd");
     // numbered list
     $btpl->touchBlock("nlist_button");
     ilTooltipGUI::addTooltip("il_edm_nlist", $lng->txt("cont_nlist"), "iltinymenu_bd");
     // list indent
     $btpl->touchBlock("list_indent");
     ilTooltipGUI::addTooltip("ilIndentBut", $lng->txt("cont_list_indent"), "iltinymenu_bd");
     // list outdent
     $btpl->touchBlock("list_outdent");
     ilTooltipGUI::addTooltip("ilOutdentBut", $lng->txt("cont_list_outdent"), "iltinymenu_bd");
     if ($a_int_links) {
         $btpl->touchBlock("bb_ilink_button");
         ilTooltipGUI::addTooltip("iosEditInternalLinkTrigger", $lng->txt("cont_link_to_internal"), "iltinymenu_bd");
     }
     ilTooltipGUI::addTooltip("il_edm_xlink", $lng->txt("cont_link_to_external"), "iltinymenu_bd");
     // remove format
     $btpl->touchBlock("rformat_button");
     ilTooltipGUI::addTooltip("il_edm_rformat", $lng->txt("cont_remove_format"), "iltinymenu_bd");
     if ($a_paragraph_styles) {
         // new paragraph
         $btpl->setCurrentBlock("new_par");
         $btpl->setVariable("IMG_NEWPAR", "+");
         $btpl->parseCurrentBlock();
         ilTooltipGUI::addTooltip("il_edm_newpar", $lng->txt("cont_insert_new_paragraph"), "iltinymenu_bd");
         $btpl->setCurrentBlock("par_edit");
         $btpl->setVariable("TXT_PAR_FORMAT", $lng->txt("cont_par_format"));
         include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php";
         $btpl->setVariable("STYLE_SELECTOR", ilPCParagraphGUI::getStyleSelector($a_selected, ilPCParagraphGUI::_getCharacteristics($a_style_id), true));
         ilTooltipGUI::addTooltip("ilAdvSelListAnchorText_style_selection", $lng->txt("cont_paragraph_styles"), "iltinymenu_bd");
         $btpl->parseCurrentBlock();
     }
     if ($a_keywords) {
         $btpl->setCurrentBlock("bb_kw_button");
         $btpl->setVariable("CC_KW", "kw");
         $btpl->parseCurrentBlock();
         ilTooltipGUI::addTooltip("il_edm_kw", $lng->txt("cont_text_keyword"), "iltinymenu_bd");
     }
     if ($a_wiki_links) {
         $btpl->setCurrentBlock("bb_wikilink_button2");
         $btpl->setVariable("TXT_WIKI_BUTTON2", $lng->txt("obj_wiki"));
         $btpl->setVariable("WIKI_BUTTON2_URL", $ilCtrl->getLinkTargetByClass("ilwikipagegui", ""));
         $btpl->parseCurrentBlock();
         $btpl->setCurrentBlock("bb_wikilink_button");
         $btpl->setVariable("TXT_WLN2", $lng->txt("obj_wiki"));
         $btpl->parseCurrentBlock();
         ilTooltipGUI::addTooltip("il_edm_wlink", $lng->txt("cont_link_to_wiki"), "iltinymenu_bd");
     }
     $aset = new ilSetting("adve");
     include_once "./Services/COPage/classes/class.ilPageContentGUI.php";
     foreach (ilPageContentGUI::_getCommonBBButtons() as $c => $st) {
         // these are handled via drop down now...
         if (in_array($c, array("com", "quot", "acc", "code"))) {
             continue;
         }
         if (ilPageEditorSettings::lookupSettingByParentType($a_par_type, "active_" . $c, true)) {
             $cc_code = $c;
             if ($aset->get("use_physical")) {
                 $cc_code = str_replace(array("str", "emp", "imp"), array("B", "I", "U"), $cc_code);
             }
             if ($c != "tex" || $mathJaxSetting->get("enable") || defined("URL_TO_LATEX")) {
                 $btpl->setCurrentBlock("bb_" . $c . "_button");
                 $btpl->setVariable("CC_" . strtoupper($c), $cc_code);
                 $btpl->parseCurrentBlock();
                 ilTooltipGUI::addTooltip("il_edm_cc_" . $c, $lng->txt("cont_cc_" . $c), "iltinymenu_bd");
                 //					$btpl->setVariable("TXT_".strtoupper($c), $this->lng->txt("cont_text_".$c));
             }
         }
     }
     if ($mathJaxSetting->get("enable") || defined("URL_TO_LATEX")) {
         ilTooltipGUI::addTooltip("il_edm_tex", $lng->txt("cont_tex"), "iltinymenu_bd");
     }
     ilTooltipGUI::addTooltip("il_edm_fn", $lng->txt("cont_fn"), "iltinymenu_bd");
     include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
     $sdd = new ilAdvancedSelectionListGUI();
     $sdd->setPullRight(false);
     $sdd->setListTitle($lng->txt("save") . "...");
     if ($a_save_return) {
         $btpl->setCurrentBlock("save_return");
         $btpl->setVariable("TXT_SAVE_RETURN", $lng->txt("save_return"));
         $btpl->parseCurrentBlock();
         $sdd->addItem($lng->txt("save_return"), "", "#", "", "", "", "", "", "ilCOPage.cmdSaveReturn(false); return false;");
     }
     if ($a_save_new) {
         $btpl->setCurrentBlock("save_new");
         $btpl->setVariable("TXT_SAVE_NEW", $lng->txt("save_new"));
         $btpl->parseCurrentBlock();
         $sdd->addItem($lng->txt("save_new"), "", "#", "", "", "", "", "", "ilCOPage.cmdSaveReturn(true); return false;");
     }
     $sdd->addItem($lng->txt("save"), "", "#", "", "", "", "", "", "ilCOPage.cmdSave(null); return false;");
     $sdd->addItem($lng->txt("cancel"), "", "#", "", "", "", "", "", "ilCOPage.cmdCancel(); return false;");
     if ($a_anchors) {
         $btpl->setCurrentBlock("bb_anc_button");
         $btpl->setVariable("CC_ANC", "anc");
         $btpl->parseCurrentBlock();
         ilTooltipGUI::addTooltip("il_edm_anc", $lng->txt("cont_anchor"), "iltinymenu_bd");
     }
     $btpl->setVariable("SAVE_DROPDOWN", $sdd->getHTML());
     /*		// footnote
     		$btpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln"));
     		$btpl->setVariable("TXT_BB_TIP", $this->lng->txt("cont_bb_tip"));
     		$btpl->setVariable("TXT_WLN", $lng->txt("wiki_wiki_page"));
     */
     //		$btpl->setVariable("PAR_TA_NAME", $a_ta_name);
     $btpl->setVariable("TXT_SAVE", $lng->txt("save"));
     $btpl->setVariable("TXT_CANCEL", $lng->txt("cancel"));
     $btpl->setVariable("TXT_CHAR_FORMAT", $lng->txt("cont_char_format"));
     $btpl->setVariable("TXT_LISTS", $lng->txt("cont_lists"));
     $btpl->setVariable("TXT_LINKS", $lng->txt("cont_links"));
     $btpl->setVariable("TXT_MORE_FUNCTIONS", $lng->txt("cont_more_functions"));
     $btpl->setVariable("TXT_SAVING", $lng->txt("cont_saving"));
     include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php";
     $btpl->setVariable("CHAR_STYLE_SELECTOR", ilPCParagraphGUI::getCharStyleSelector($a_par_type));
     ilTooltipGUI::addTooltip("ilAdvSelListAnchorElement_char_style_selection", $lng->txt("cont_more_character_styles"), "iltinymenu_bd");
     return $btpl->get();
 }
 /**
  * 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->setPullRight(false);
     $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("&nbsp;<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();
 }