Files
shopPRO/admin/templates/pages/pages-browse-list.php
Jacek Pyziak 431add234c ver. 0.283: Legacy class cleanup — S, Html, Email, Image, Log, Mobile_Detect → Shared namespace
- Migrate class.S → Shared\Helpers\Helpers (140+ files), remove 12 unused methods
- Migrate class.Html → Shared\Html\Html
- Migrate class.Email → Shared\Email\Email
- Migrate class.Image → Shared\Image\ImageManipulator
- Delete class.Log (unused), class.Mobile_Detect (outdated UA detection)
- Remove grid library loading from admin (index.php, ajax.php)
- Replace gridEdit usage in 10 admin templates with grid-edit-replacement.php
- Fix grid-edit-replacement.php AJAX to send values as JSON (grid.js compat)
- Remove mobile layout conditionals (m_html/m_css/m_js) from Site + LayoutsRepository
- Remove \Log::save_log() calls from OrderAdminService, ShopOrder, Order

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 23:06:06 +01:00

146 lines
4.4 KiB
PHP

<?php
global $gdb;
$menus = is_array($this->menus ?? null) ? $this->menus : [];
$modal = !empty($this->modal);
$cookiePages = is_array($this->cookie_pages ?? null) ? $this->cookie_pages : [];
$cookieMenus = is_array($this->cookie_menus ?? null) ? $this->cookie_menus : [];
ob_start();
foreach ($menus as $menu):
$menuId = (int)($menu['id'] ?? 0);
$menuName = (string)($menu['name'] ?? '');
$menuStatus = (int)($menu['status'] ?? 0);
?>
<div class="menu_sortable">
<ol class="sortable" id="sortable_<?= $menuId; ?>" menu-id="<?= $menuId; ?>">
<li id="list_<?= $menuId; ?>" class="menu_<?= $menuId; ?>" menu="<?= $menuId; ?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<?php if ($menuStatus !== 1): ?><i class="fa fa-ban fa-lg text-danger" title="Menu nieaktywne"></i><?php endif; ?>
Menu: <b><?= htmlspecialchars($menuName, ENT_QUOTES, 'UTF-8'); ?></b>
</div>
<?= \Tpl::view('pages/subpages-browse-list', [
'pages' => $menu['pages'] ?? [],
'step' => 1,
]); ?>
</li>
</ol>
</div>
<?php
endforeach;
$out = ob_get_clean();
$gridId = 'pages-list';
$gridTitle = 'Lista stron';
$gridSaveUrl = '';
$gridBackUrl = '';
$gridHidden = [];
$gridContent = $out;
$gridPersist = false;
include __DIR__ . '/../components/grid-edit-replacement.php';
?>
<style type="text/css">
<?php if ($modal): ?>.mfp-container<?php endif; ?> body.sb-top.sb-top-sm .navbar.navbar-fixed-top + #sidebar_left + #content_wrapper {
padding-top: 0;
}
<?php if ($modal): ?>.mfp-container<?php endif; ?> #content {
padding: 27px 0 0;
}
<?php if ($modal): ?>.mfp-container<?php endif; ?> #content > .row {
margin: 0;
}
<?php if ($modal): ?>.mfp-container<?php endif; ?> #content > .row > .col-lg-9 {
padding: 0;
width: 100%;
float: none;
}
</style>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript">
var cookiePages = <?= json_encode($cookiePages, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); ?>;
var cookieMenus = <?= json_encode($cookieMenus, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); ?>;
function getUrlParam(paramName) {
var reParam = new RegExp('(?:[\\?&]|&amp;)' + paramName + '=([^&]+)', 'i');
var match = window.location.search.match(reParam);
return (match && match.length > 1) ? match[1] : '';
}
$(document).ready(function() {
<?php if (!$modal): ?>
$('#sidebar_left, .navbar-fixed-top').hide();
<?php endif; ?>
var funcNum = getUrlParam('CKEditorFuncNum');
$('body').on('click', '.button', function() {
if (funcNum) {
window.opener.CKEDITOR.tools.callFunction(funcNum, $(this).attr('url'));
window.close();
}
});
$('ol.sortable').nestedSortable({
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: 0.9,
placeholder: 'placeholder',
revert: 250,
tabSize: 45,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 3,
isTree: true,
expandOnHover: 700,
isAllowed: function() {
return false;
}
});
$('.disclose').on('click', function() {
$(this).closest('li').toggleClass('sort-collapsed').toggleClass('sort-expanded');
});
$('.disclose').mousedown(function(e) {
if (e.which !== 1) {
return;
}
if ($(this).parent('div').hasClass('content_menu')) {
var menuId = $(this).parent('div').parent('li').attr('menu');
$.ajax({
type: 'POST',
cache: false,
url: '/admin/pages/cookieMenus/',
data: { menu_id: menuId }
});
} else {
var pageId = $(this).parent('div').parent('li').attr('id').replace('list_', '');
$.ajax({
type: 'POST',
cache: false,
url: '/admin/pages/cookiePages/',
data: { page_id: pageId }
});
}
});
Object.keys(cookiePages || {}).forEach(function(key) {
if (String(cookiePages[key]) === '1') {
$('.list_' + key).children('div').children('span.disclose').click();
}
});
Object.keys(cookieMenus || {}).forEach(function(key) {
if (String(cookieMenus[key]) === '1') {
$('.menu_' + key).children('div').children('span.disclose').click();
}
});
});
</script>