function __forum_chapter_menu_gen() { $Dict = array("W" => array(), "T" => array()); CModule::IncludeModule("forum"); $db_res = CFilterDictionary::GetList(); while ($res = $db_res->Fetch()) { $Dict[$res["TYPE"]][] = array("text" => htmlspecialcharsEx($res["TITLE"]), "url" => "/bitrix/admin/forum_" . ($res["TYPE"] == "T" ? "letter" : "words") . ".php?DICTIONARY_ID=" . $res["ID"] . "&lang=" . LANG, "more_url" => array("/bitrix/admin/forum_" . ($res["TYPE"] == "T" ? "letter" : "words") . ".php?DICTIONARY_ID=" . $res["ID"] . "&lang=" . LANG, "/bitrix/admin/forum_dictionary_edit.php?DICTIONARY_ID=" . $res["ID"] . "&lang=" . LANG, "/bitrix/admin/forum_" . ($res["TYPE"] == "T" ? "letter" : "words") . "_edit.php?DICTIONARY_ID=" . $res["ID"] . "&lang=" . LANG), "title" => htmlspecialcharsEx($res["TITLE"])); } return $Dict; }
function Delete($ID) { global $DB, $USER; $ID = IntVal($ID); $Dictionary = ""; $Dictionary = CFilterDictionary::GetList(array(), array("ID" => $ID)); $Dictionary = $Dictionary->Fetch(); $res = false; $DB->StartTransaction(); if ($Dictionary["TYPE"] == "T") { $res = $DB->Query("DELETE FROM b_forum_letter WHERE DICTIONARY_ID=" . $ID); } else { $res = $DB->Query("DELETE FROM b_forum_filter WHERE DICTIONARY_ID=" . $ID); } if ($res) { $res = $DB->Query("DELETE FROM b_forum_dictionary WHERE ID=" . $ID); } if ($res) { $DB->Commit(); } else { $DB->Rollback(); } return $res; }
<table border="0" cellspacing="6" class="internal" style="width:auto;"> <tr class="heading"> <td align="center"><?php echo GetMessage("LANG"); ?> </td> <td align="center"><?php echo GetMessage("DICTINARY_AND_EREG"); ?> </td> <td align="center"><span id="SECTION_NAME_TITLE"><?php echo GetMessage("TRANSCRIPTION_DICTIONARY"); ?> </span></td> </tr><?php $db_res = CFilterDictionary::GetList(); $Dict = array(); while ($res = $db_res->Fetch()) { $Dict[$res["TYPE"]]["reference_id"][] = $res["ID"]; $Dict[$res["TYPE"]]["reference"][] = $res["TITLE"]; } $Dict['W']["reference_id"][] = ""; $Dict['W']["reference"][] = GetMessage("DICTIONARY_NONE"); $Dict['T']["reference_id"][] = ""; $Dict['T']["reference"][] = GetMessage("DICTIONARY_NONE"); $l = CLanguage::GetList($lby = "sort", $lorder = "asc"); while ($ar = $l->ExtractFields("l_")) { ?> <tr class="adm-detail-required-field"> <td><span class="tablefieldtext"><?php echo $ar["NAME"];
if ($bVarsFromForm) { $DB->InitTableVarsForEdit("b_forum_letter", "", "str_"); } $aMenu = array(array("TEXT" => GetMessage("FLTR_LIST"), "LINK" => "/bitrix/admin/forum_letter.php?DICTIONARY_ID=" . $DICTIONARY_ID . "&lang=" . LANG, "ICON" => "btn_list")); if ($ID > 0 && $forumPermWrite) { $aMenu[] = array("SEPARATOR" => "Y"); $aMenu[] = array("TEXT" => GetMessage("FLTR_NEW"), "LINK" => "/bitrix/admin/forum_dictionary_edit.php?DICTIONARY_ID=" . $DICTIONARY_ID . "&lang=" . LANG, "ICON" => "btn_new"); $aMenu[] = array("TEXT" => GetMessage("FLTR_DEL"), "LINK" => "javascript:if(confirm('" . GetMessage("FLTR_DEL_CONFIRM") . "')) window.location='/bitrix/admin/forum_letter.php?DICTIONARY_ID=" . $DICTIONARY_ID . "&lang=" . LANG . "&action=delete&ID[]=" . $ID . "&" . bitrix_sessid_get() . "';", "ICON" => "btn_delete"); } $context = new CAdminContextMenu($aMenu); $context->Show(); if ($err = $APPLICATION->GetException()) { CAdminMessage::ShowMessage($err->GetString()); } /*******************************************************************/ $db_res = CFilterDictionary::GetList(array(), array("TYPE" => "T")); $Dict = array(); while ($res = $db_res->Fetch()) { $Dict["reference_id"][] = $res["ID"]; $Dict["reference"][] = $res["TITLE"]; } ?> <form method="POST" action="<?php echo $APPLICATION->GetCurPage(); ?> " name="forum_edit"> <input type="hidden" name="Update" value="Y"> <input type="hidden" name="lang" value="<?php echo LANG; ?> ">
} } $err = $APPLICATION->GetException(); if (!$err && !empty($_REQUEST['save'])) { LocalRedirect("forum_dictionary.php?TYPE=" . $arFields["TYPE"] . "&lang=" . LANG); } elseif ($err) { $bVarsFromForm = true; if ($err = $APPLICATION->GetException()) { $sError = $err->GetString(); } } } $arFields = array(); $bAdd = true; if ($_REQUEST["DICTIONARY_ID"] > 0) { $db_res = CFilterDictionary::GetList(array(), array("ID" => $_REQUEST["DICTIONARY_ID"])); if ($db_res && ($res = $db_res->Fetch())) { $arFields = array("ID" => $res["ID"], "TYPE" => $res["TYPE"], "TITLE" => $res["TITLE"]); $bAdd = false; } } if ($bAdd) { $arFields = array("ID" => 0, "TYPE" => "", "TITLE" => ""); } if ($bVarsFromForm) { $arFields = array("ID" => $_REQUEST["DICTIONARY_ID"], "TYPE" => $_REQUEST["TYPE"], "TITLE" => $_REQUEST["TITLE"]); } if ($bAdd) { $APPLICATION->SetTitle(GetMessage("FLTR_NEW")); } else { $APPLICATION->SetTitle(GetMessage("FLTR_UPDATE"));