}
    } else {
        foreach ($res->getErrorMessages() as $error_message) {
            $message = new CAdminMessage($error_message);
            break;
        }
        $bVarsFromForm = true;
    }
}
// ******************************************************************** //
//                ВЫБОРКА И ПОДГОТОВКА ДАННЫХ ФОРМЫ                     //
// ******************************************************************** //
$allProperties = [];
// выборка данных
if ($ID > 0) {
    $seoProperty = \Xpage\SeoFilter\PropertyTable::getById($ID)->fetch();
    $APPLICATION->SetTitle("Edit {$seoProperty['ID']}");
}
$obProperties = \Bitrix\Iblock\PropertyTable::getList(['select' => ['ID', 'NAME'], 'filter' => ['IBLOCK_ID' => \Bitrix\Main\Config\Option::get('xpage.seofilter', 'IBLOCK', 1), 'SECTION_PROPERTY.SMART_FILTER' => 'Y', 'PROPERTY_TYPE' => \Bitrix\Iblock\PropertyTable::TYPE_LIST], 'runtime' => [new Bitrix\Main\Entity\ReferenceField('SECTION_PROPERTY', 'Bitrix\\Iblock\\SectionProperty', ['this.ID' => 'ref.PROPERTY_ID'], ['join_type' => 'LEFT'])]]);
while ($arProperty = $obProperties->fetch()) {
    $allProperties[] = $arProperty;
}
// ******************************************************************** //
//                ВЫВОД ФОРМЫ                                           //
// ******************************************************************** //
// не забудем разделить подготовку данных и вывод
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
// конфигурация административного меню
$aMenu = [["TEXT" => "Список", "TITLE" => "Список", "LINK" => "seofilter_property.php", "ICON" => "btn_list"], ["TEXT" => "Удалить", "TITLE" => "Удалить", "LINK" => "javascript:if(confirm('" . "Да, прошу вас" . "')) window.location='/bitrix/admin/seofilter_property.php?ID=" . $ID . "&action=delete&lang=" . LANGUAGE_ID . "&" . bitrix_sessid_get() . "';", "ICON" => "btn_delete"]];
// создание экземпляра класса административного меню
$context = new CAdminContextMenu($aMenu);
Exemplo n.º 2
0
            $arID[] = $arRes['ID'];
        }
    }
    foreach ($arID as $ID) {
        $ID = intval($ID);
        if ($ID <= 0) {
            continue;
        }
        switch ($_REQUEST['action']) {
            case "delete":
                \Xpage\Seofilter\PropertyTable::delete($ID);
                break;
        }
    }
}
$obGroups = \Xpage\Seofilter\PropertyTable::getList(['order' => ['ID' => 'ASC'], 'select' => ['ID', 'TITLE', 'SORT', 'PROPERTY_ID', 'PROPERTY_NAME' => 'PROPERTY.NAME']]);
$obGroups = new CAdminResult($obGroups, $listTableId);
$obGroups->NavStart();
$adminList->NavText($obGroups->GetNavPrint("Разделы"));
$colHeaders = [["id" => 'ID', "content" => 'ID', "sort" => 1, "default" => true], ["id" => 'TITLE', "content" => 'TITLE', "sort" => 2, "default" => true], ["id" => 'SORT', "content" => 'SORT', "sort" => 3, "default" => true], ["id" => 'PROPERTY_NAME', "content" => 'PROPERTY_NAME', "sort" => 4, "default" => true]];
$adminList->AddHeaders($colHeaders);
$visibleHeaderColumns = $adminList->GetVisibleHeaderColumns();
$arUsersCache = [];
while ($arRes = $obGroups->GetNext()) {
    $row =& $adminList->AddRow($arRes["ID"], $arRes);
    $arActions = [["ICON" => "delete", "TEXT" => "Удалить", "ACTION" => $adminList->ActionDoGroup($arRes["ID"], "delete")], ["ICON" => "edit", "TEXT" => "Редактировать", "ACTION" => $adminList->ActionRedirect("seofilter_property_edit.php?ID=" . $arRes["ID"] . "&lang=" . LANGUAGE_ID), "DEFAULT" => true], ["ICON" => "", "TEXT" => "Замена", "ACTION" => $adminList->ActionRedirect("seofilter_property_values_edit.php?ID=" . $arRes["PROPERTY_ID"] . "&lang=" . LANGUAGE_ID)]];
    $row->AddActions($arActions);
}
$adminList->AddFooter([["title" => "Всего", "value" => $obGroups->SelectedRowsCount()], ["counter" => true, "title" => "Отмечено", "value" => "0"]]);
$adminList->AddGroupActionTable(["delete" => "Удалить"]);
$aContext = [["TEXT" => GetMessage("MAIN_ADD"), "LINK" => "seofilter_property_edit.php", "TITLE" => GetMessage("POST_ADD_TITLE"), "ICON" => "btn_new"]];