$arID[] = $arRes['ID']; } } foreach ($arID as $ID) { $ID = intval($ID); if ($ID <= 0) { continue; } switch ($_REQUEST['action']) { case "delete": \Xpage\Seofilter\PageTable::delete($ID); break; } } } $obGroups = \Xpage\Seofilter\PageTable::getList(['order' => ['ID' => 'ASC']]); $obGroups = new CAdminResult($obGroups, $listTableId); $obGroups->NavStart(); $adminList->NavText($obGroups->GetNavPrint("Разделы")); $colHeaders = [["id" => 'ID', "content" => 'ID', "sort" => 1, "default" => true], ["id" => 'URL', "content" => 'URL', "sort" => 2, "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_page_edit.php?ID=" . $arRes["ID"] . "&lang=" . LANGUAGE_ID), "DEFAULT" => true]]; $row->AddActions($arActions); } $adminList->AddFooter([["title" => "Всего", "value" => $obGroups->SelectedRowsCount()], ["counter" => true, "title" => "Отмечено", "value" => "0"]]); $adminList->AddGroupActionTable(["delete" => "Удалить"]); $aContext = [["TEXT" => GetMessage("MAIN_ADD"), "LINK" => "seofilter_page_edit.php", "TITLE" => GetMessage("POST_ADD_TITLE"), "ICON" => "btn_new"]];
private static function getPageByUrl($url) { $page = PageTable::getList(['filter' => ['=URL' => $url]])->fetch(); return $page; }
LocalRedirect("/bitrix/admin/seofilter_page.php"); } } else { foreach ($res->getErrorMessages() as $error_message) { $message = new CAdminMessage($error_message); break; } $bVarsFromForm = true; } } // ******************************************************************** // // ВЫБОРКА И ПОДГОТОВКА ДАННЫХ ФОРМЫ // // ******************************************************************** // // выборка данных if ($ID > 0) { $arPage = \Xpage\SeoFilter\PageTable::getById($ID)->fetch(); $APPLICATION->SetTitle("Edit {$arPage['URL']}"); } // ******************************************************************** // // ВЫВОД ФОРМЫ // // ******************************************************************** // // не забудем разделить подготовку данных и вывод require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php"; // конфигурация административного меню $aMenu = [["TEXT" => "Список", "TITLE" => "Список", "LINK" => "seofilter_page.php", "ICON" => "btn_list"], ["TEXT" => "Удалить", "TITLE" => "Удалить", "LINK" => "javascript:if(confirm('" . "Да, прошу вас" . "')) window.location='/bitrix/admin/seofilter_page.php?ID=" . $ID . "&action=delete&lang=" . LANGUAGE_ID . "&" . bitrix_sessid_get() . "';", "ICON" => "btn_delete"]]; // создание экземпляра класса административного меню $context = new CAdminContextMenu($aMenu); // вывод административного меню $context->Show(); ?>