コード例 #1
0
ファイル: group_edit.php プロジェクト: mrdeadmouse/u136006
    $arSysLangs[$langCount] = $arLang["LID"];
    $arSysLangNames[$langCount] = htmlspecialcharsbx($arLang["NAME"]);
    $langCount++;
}
$arGroups = CForumGroup::GetByLang(LANGUAGE_ID);
array_unshift($arGroups, array("ID" => 0, "NAME" => "..."));
if ((strlen($save) > 0 || strlen($apply) > 0) && $REQUEST_METHOD == "POST" && $forumPermissions == "W" && check_bitrix_sessid()) {
    $arFields = array("SORT" => intVal(intVal($SORT) <= 0 ? 150 : $SORT), "PARENT_ID" => $_REQUEST["FORUM_GROUP"]["PARENT_ID"]);
    for ($i = 0; $i < count($arSysLangs); $i++) {
        $arFields["LANG"][] = array("LID" => $arSysLangs[$i], "NAME" => $_REQUEST["FORUM_GROUP"]["LANG"][$arSysLangs[$i]]["NAME"], "DESCRIPTION" => $_REQUEST["FORUM_GROUP"]["LANG"][$arSysLangs[$i]]["DESCRIPTION"]);
    }
    if (!CForumGroup::CheckFields($ID > 0 ? "UPDATE" : "ADD", $arFields, $ID > 0 ? $ID : false)) {
        $arError[] = array("code" => "error_checkfields", "title" => GetMessage("ERROR_ADD_GROUP_BAD_FIELDS"));
    } else {
        if ($ID > 0) {
            if (!CForumGroup::CanUserUpdateGroup($ID, $USER->GetUserGroupArray())) {
                $arError[] = array("code" => "not_right_for_edit", "title" => GetMessage("ERROR_EDIT_GROUP_NOT_RIGHT"));
            } else {
                $ID1 = CForumGroup::Update($ID, $arFields);
                if (IntVal($ID1) <= 0) {
                    $arError[] = array("code" => "not_edit", "title" => GetMessage("ERROR_EDIT_GROUP"));
                }
            }
        } else {
            if (!CForumGroup::CanUserAddGroup($USER->GetUserGroupArray())) {
                $arError[] = array("code" => "not_right_for_add", "title" => GetMessage("ERROR_ADD_GROUP_NOT_RIGHT"));
            } else {
                $ID = CForumGroup::Add($arFields);
                if (IntVal($ID) <= 0) {
                    $arError[] = array("code" => "not_add", "title" => GetMessage("ERROR_ADD_GROUP"));
                }
コード例 #2
0
ファイル: group.php プロジェクト: mrdeadmouse/u136006
$dbResultList->NavStart();
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("GROUP_NAV")));
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => GetMessage("GROUP_ID"), "sort" => "ID", "default" => true), array("id" => "NAME", "content" => GetMessage('FORUM_NAME'), "sort" => "", "default" => true), array("id" => "SORT", "content" => GetMessage("GROUP_SORT"), "sort" => "SORT", "default" => true, "align" => "right")));
$arVisibleColumns = $lAdmin->GetVisibleHeaderColumns();
/*******************************************************************/
while ($arGroup = $dbResultList->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arGroup);
    $row->AddField("ID", $f_ID);
    $row->AddInputField("SORT", array("size" => 5));
    if (in_array("NAME", $arVisibleColumns)) {
        $arGroupLang = CForumGroup::GetLangByID($f_ID, LANG);
        $fieldShow = htmlspecialcharsbx($arGroupLang["NAME"]);
        $row->AddViewField("NAME", '<a title="' . GetMessage("FORUM_EDIT_DESCR") . '" href="' . "forum_group_edit.php?ID=" . $f_ID . "&lang=" . LANG . "&" . GetFilterParams("filter_") . '">' . $fieldShow . '</a>');
    }
    $arActions = array();
    if ($forumModulePermissions >= "R" && CForumGroup::CanUserUpdateGroup(0, $USER->GetUserGroupArray())) {
        $arActions[] = array("ICON" => "edit", "TEXT" => GetMessage("FORUM_EDIT_DESCR"), "ACTION" => $lAdmin->ActionRedirect("forum_group_edit.php?ID=" . $f_ID . "&lang=" . LANG . "&" . GetFilterParams("filter_", false)), "DEFAULT" => true);
    }
    if ($forumModulePermissions >= "W" && CForumGroup::CanUserDeleteGroup(0, $USER->GetUserGroupArray())) {
        $arActions[] = array("SEPARATOR" => true);
        $arActions[] = array("ICON" => "delete", "TEXT" => GetMessage("FORUM_DELETE_DESCR"), "ACTION" => "if(confirm('" . GetMessage('GROUP_DEL_CONF') . "')) " . $lAdmin->ActionDoGroup($f_ID, "delete"));
    }
    $row->AddActions($arActions);
}
/*******************************************************************/
$lAdmin->AddFooter(array(array("title" => GetMessage("MAIN_ADMIN_LIST_SELECTED"), "value" => $dbResultList->SelectedRowsCount()), array("counter" => true, "title" => GetMessage("MAIN_ADMIN_LIST_CHECKED"), "value" => "0")));
/*******************************************************************/
$lAdmin->AddGroupActionTable(array("delete" => GetMessage("MAIN_ADMIN_LIST_DELETE")));
if ($forumModulePermissions >= "W" && CForumGroup::CanUserAddGroup($USER->GetUserGroupArray())) {
    $aContext = array(array("TEXT" => GetMessage("FGAN_ADD_NEW"), "LINK" => "forum_group_edit.php?lang=" . LANG, "TITLE" => GetMessage("FGAN_ADD_NEW_ALT"), "ICON" => "btn_new"));
    $lAdmin->AddAdminContextMenu($aContext);