ver 0.262 - pages module refactor and admin UX fixes

This commit is contained in:
2026-02-13 21:17:21 +01:00
parent 26ebf59849
commit 67705f1f56
44 changed files with 2235 additions and 1803 deletions

View File

@@ -1,42 +1 @@
<?php
global $gdb;
$grid = new \gridEdit;
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Zapisz menu';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> menu['id']
],
[
'name' => 'Nazwa',
'db' => 'name',
'type' => 'text',
'value' => $this -> menu['name'],
'params' => [ 'class' => 'require' ]
],
[
'name' => 'Aktywne',
'db' => 'status',
'type' => 'input_switch',
'checked' => $this -> menu['status'] ? true : false,
'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ]
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/pages/menu_save/', 'back_url' => '/admin/pages/view_list/' ],
'cancel' => [ 'url' => '/admin/pages/view_list/' ]
];
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
$( document ).ready( function()
{
disable_menu();
});
</script>
<?= \Tpl::view('components/form-edit', ['form' => $this->form]); ?>

View File

@@ -1,89 +1,87 @@
<?
<?php
global $gdb;
$pageId = (int)($this->page_id ?? 0);
$articles = is_array($this->articles ?? null) ? $this->articles : [];
ob_start();
?>
<ol class="sortable" id="article-list">
<?
if ( is_array( $this -> articles ) ) foreach ( $this -> articles as $article )
{
?>
<li id="list_<?= $article['article_id'];?>">
<div class="content <? if ( !$article['status'] ) echo 'text-danger';?>"><span class="disclose"><span></span></span> <?= $article['title'];?></div>
</li>
<?
}
<ol class="sortable" id="article-list">
<?php foreach ($articles as $article): ?>
<?php
$articleId = (int)($article['article_id'] ?? 0);
$title = (string)($article['title'] ?? '');
$status = (int)($article['status'] ?? 0);
?>
</ol>
<?
<li id="list_<?= $articleId; ?>">
<div class="content <?= $status === 1 ? '' : 'text-danger'; ?>"><span class="disclose"><span></span></span> <?= htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); ?></div>
</li>
<?php endforeach; ?>
</ol>
<?php
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> default_buttons = false;
$grid -> external_code = $out;
$grid -> title = 'Lista artykułów';
$grid -> buttons = [
[
'label' => 'Wstecz',
'url' => '/admin/pages/view_list/',
'icon' => 'fa-reply',
'class' => 'btn-dark'
]
];
echo $grid -> draw();
$grid->gdb_opt = $gdb;
$grid->include_plugins = true;
$grid->default_buttons = false;
$grid->external_code = $out;
$grid->title = 'Lista artyku&#322;&#243;w';
$grid->buttons = [
[
'label' => 'Wstecz',
'url' => '/admin/pages/list/',
'icon' => 'fa-reply',
'class' => 'btn-dark',
],
];
echo $grid->draw();
?>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript">
$( document ).ready( function()
{
$( 'ol.sortable' ).nestedSortable(
{
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .6,
placeholder: 'placeholder',
revert: 250,
tabSize: 25,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 1,
isTree: true,
expandOnHover: 700,
$(document).ready(function() {
$('ol.sortable').nestedSortable({
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: 0.6,
placeholder: 'placeholder',
revert: 250,
tabSize: 25,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 1,
isTree: true,
expandOnHover: 700,
save_articles_order: true
});
});
});
function save_articles_order()
{
articles = $( 'ol.sortable' ).nestedSortable( 'toArray', { startDepthCount: 0 } );
$.ajax(
{
function save_articles_order() {
var articles = $('ol.sortable').nestedSortable('toArray', { startDepthCount: 0 });
$.ajax({
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data:
{
a: 'save_articles_order',
page_id: <?= $this -> page_id;?>,
url: '/admin/pages/saveArticlesOrder/',
data: {
page_id: <?= $pageId; ?>,
articles: articles
},
beforeSend: function()
{
$.prompt( 'Trwa zapisywanie...', { title: 'Proszę czekać' } );
beforeSend: function() {
$.prompt('Trwa zapisywanie...', { title: 'Prosz\\u0119 czeka\\u0107' });
},
success: function( data )
{
$( '.jqibox' ).remove();
response = jQuery.parseJSON( data );
success: function(data) {
$('.jqibox').remove();
var response = jQuery.parseJSON(data);
if ( response.status === 'error' )
create_error( response.msg );
if (response.status === 'error') {
create_error(response.msg);
}
}
});
}
</script>
</script>

View File

@@ -1,400 +1 @@
<script type="text/javascript">
var link_lang = '';
$( function()
{
disable_menu();
$('body').on( 'change', '#page_type', function ()
{
var page_type = $(this).val();
if ( page_type == 0 || page_type == 1 || page_type == 2 )
{
$( '#articles_limit' ).parents( '.form-group' ).show();
$( '#link-content' ).addClass( 'hide' );
$( '#category-content' ).addClass( 'hide' );
$( '#sort_type' ).parents( '.form-group' ).show();
}
else if ( page_type == 3 )
{
$( '#link-content' ).removeClass( 'hide' );
$( '#articles_limit' ).parents( '.form-group' ).hide();
$( '#sort_type' ).parents( '.form-group' ).hide();
$( '#category-content' ).addClass( 'hide' );
}
else if ( page_type == 5 )
{
$( '#category-content' ).removeClass( 'hide' );
$( '#articles_limit' ).parents( '.form-group' ).hide();
$( '#sort_type' ).parents( '.form-group' ).hide();
$( '#link-content' ).addClass( 'hide' );
}
else
{
$( '#articles_limit' ).parents( '.form-group' ).hide();
$( '#link-content' ).addClass( 'hide' );
$( '#category-content' ).addClass( 'hide' );
$( '#sort_type' ).parents( '.form-group' ).hide();
}
});
$( '#settings-tabs' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
$( '#page_type' ).trigger( 'change' );
$( 'body').on( 'click', '.url-select', function() {
$( '#link_' + link_lang ).val( $( this ).attr( 'url' ) );
$.magnificPopup.close();
});
$( 'body').on( 'click', '.category-select', function() {
$( '#category_id' ).val( $( this ).attr( 'category-id' ) );
$( '#category_title' ).val( $( this ).attr( 'category-title' ) );
$.magnificPopup.close();
});
});
function generate_seo_links( lang, title, page_id )
{
if ( title === '' )
return false;
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'generate_seo_link',
title: title,
page_id: page_id
},
beforeSend: function()
{
$( '#overlay' ).show();
},
success: function( data )
{
$( '#overlay' ).hide();
response = jQuery.parseJSON( data );
if ( response.status === 'ok' )
$( '#seo_link_' + lang ).val( response.seo_link );
else
create_error( response.msg );
}
});
}
function pages_url_browser( lang_id ) {
link_lang = lang_id;
$.magnificPopup.open({
removalDelay: 500,
items: {
src: '/admin/pages/pages_url_browser/modal=true'
},
type: 'ajax',
overflowY: 'scroll'
});
}
function category_url_browser() {
$.magnificPopup.open({
removalDelay: 500,
items: {
src: '/admin/shop_category/category_url_browser/modal=true'
},
type: 'ajax',
overflowY: 'scroll'
});
}
</script>
<?
global $db;
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-file"></i>Treść</li>
<li><i class="fa fa-wrench"></i>Ustawienia</li>
<li><i class="fa fa-globe"></i>SEO</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<div class="panel">
<div class="panel-heading">
<ul class="nav panel-tabs-border panel-tabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li>
<a href="#laguages-main-<?= $lg['id'];?>" data-toggle="tab" aria-expanded="true"><? if ( $lg['id'] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg['name'];?></a>
</li>
<? endif;?>
<? endforeach; endif;?>
</ul>
</div>
<div class="panel-body">
<div class="tab-content pn br-n">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div id="laguages-main-<?= $lg['id'];?>" class="tab-pane <? if ( !$z01++ ):?>active<? endif;?>">
<?= \Html::input(
array(
'label' => 'Nazwa strony',
'name' => 'title[' . $lg['id'] . ']',
'id' => 'title_' . $lg['id'],
'value' => $this -> page[ 'languages' ][ $lg['id'] ]['title'],
)
);?>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
</div>
</div>
</div>
<div style="padding: 15px;">
<?
if ( is_array( $this -> menus ) ): foreach ( $this -> menus as $menu ):
$menus[ $menu['id'] ] = $menu['name'];
endforeach; endif;
?>
<?= \Html::select(
array(
'label' => 'Menu',
'name' => 'menu_id',
'values' => $menus,
'value' => $this -> page['id'] ? $this -> page['menu_id'] : $this -> menu_id
)
);?>
<?= \Html::select(
array(
'label' => 'Typ strony',
'name' => 'page_type',
'id' => 'page_type',
'values' => \admin\factory\Pages::$_page_types,
'value' => $this -> page['page_type']
)
);?>
<div id="link-content" class="hide">
<div class="panel">
<div class="panel-heading">
<ul class="nav panel-tabs-border panel-tabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li>
<a href="#languages-links-<?= $lg['id'];?>" data-toggle="tab" aria-expanded="true"><? if ( $lg['id'] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg['name'];?></a>
</li>
<? endif;?>
<? endforeach; endif;?>
</ul>
</div>
<div class="panel-body">
<div class="tab-content pn br-n">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div id="languages-links-<?= $lg['id'];?>" class="tab-pane <? if ( !$z02++ ):?>active<? endif;?>">
<?= \Html::input_icon( [
'label' => 'Link',
'name' => 'link[' . $lg['id'] . ']',
'id' => 'link_' . $lg['id'],
'value' => $this -> page['languages'][$lg['id']]['link'],
'icon_class' => 'fa fa-link',
'icon_js' => 'pages_url_browser( "' . $lg['id'] . '");'
] );
?>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
</div>
</div>
</div>
<div id="category-content" class="hide">
<div id="languages-category">
<?= \Html::input(
array(
'type' => 'hidden',
'name' => 'category_id',
'id' => 'category_id',
'value' => $this -> page['category_id']
)
);
?>
<?= \Html::input_icon(
array(
'label' => 'Kategoria',
'name' => 'category_title',
'id' => 'category_title',
'value' => $this -> page['category_id'] ? \admin\factory\ShopCategory::category_title( $this -> page['category_id'] ) : '',
'icon_class' => 'fa fa-link',
'icon_js' => 'category_url_browser();'
)
);
?>
</div>
</div>
<?= \Html::select(
array(
'label' => 'Sortowanie artykułów',
'name' => 'sort_type',
'id' => 'sort_type',
'values' => \admin\factory\Pages::$_sort_types,
'value' => $this -> page['sort_type']
)
);?>
<?
$layouts[''] = '---- szablon ----';
if ( is_array( $this -> layouts ) ): foreach ( $this -> layouts as $layout ):
$layouts[ $layout['id'] ] = $layout['name'];
endforeach; endif;
?>
<?= \Html::select(
array(
'label' => 'Szablon',
'name' => 'layout_id',
'id' => 'layout_id',
'values' => $layouts,
'value' => $this -> page['layout_id']
)
);?>
<?= \Html::input(
array(
'label' => 'Liczba artykułów na stronę',
'name' => 'articles_limit',
'id' => 'articles_limit',
'value' => $this -> page['articles_limit'] ? $this -> page['articles_limit'] : 2
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Pokaż tytuł',
'name' => 'show_title',
'checked' => $this -> page['show_title'] == 1 or !$this -> page['id'] ? true : false
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Aktywna',
'name' => 'status',
'checked' => $this -> page['status'] == 1 or !$this -> page['id'] ? true : false
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Strona startowa',
'name' => 'start',
'checked' => $this -> page['start'] == 1 ? true : false
)
);?>
</div>
<div>
<div class="panel">
<div class="panel-heading">
<ul class="nav panel-tabs-border panel-tabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li>
<a href="#languages-seo-<?= $lg['id'];?>" data-toggle="tab" aria-expanded="true"><? if ( $lg['id'] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg['name'];?></a>
</li>
<? endif;?>
<? endforeach; endif;?>
</ul>
</div>
<div class="panel-body">
<div class="tab-content pn br-n">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div id="languages-seo-<?= $lg['id'];?>" class="tab-pane <? if ( !$z03++ ):?>active<? endif;?>">
<?= \Html::input_icon( [
'label' => 'Link SEO',
'name' => 'seo_link[' . $lg['id'] . ']',
'id' => 'seo_link_' . $lg['id'],
'value' => $this -> page['languages' ][ $lg['id'] ]['seo_link'],
'icon_content' => 'generuj',
'icon_js' => 'generate_seo_links( "' . $lg['id'] . '", $( "#title_' . $lg['id'] . '" ).val(), ' . (int)$this -> page['id'] . ' );'
] );?>
<?= \Html::input( [
'label' => 'Tytuł strony (h1)',
'name' => 'page_title[' . $lg['id'] . ']',
'id' => 'page_title_' . $lg['id'],
'value' => $this -> page['languages' ][ $lg['id'] ]['page_title']
] );?>
<?= \Html::input( [
'label' => 'Meta title',
'name' => 'meta_title[' . $lg['id'] . ']',
'id' => 'meta_title_' . $lg['id'],
'value' => $this -> page['languages'][ $lg['id'] ]['meta_title']
] );?>
<?= \Html::textarea( [
'label' => 'Meta description',
'name' => 'meta_description[' . $lg['id'] . ']',
'id' => 'meta_description_' . $lg['id'],
'value' => $this -> page['languages'][ $lg['id'] ]['meta_description']
] );?>
<?= \Html::textarea( [
'label' => 'Meta keywords',
'name' => 'meta_keywords[' . $lg['id'] . ']',
'id' => 'meta_keywords_' . $lg['id'],
'value' => $this -> page['languages'][ $lg['id'] ]['meta_keywords']
] );?>
<?= \Html::select( [
'label' => 'Blokuj indeksację',
'name' => 'noindex[' . $lg['id'] . ']',
'id' => 'noindex_' . $lg['id'],
'values' => [ 0 => 'nie', 1 => 'tak' ],
'value' => $this -> page['languages'][ $lg['id'] ]['noindex'] == 1 ? 1 : 0
] );?>
<?= \Html::input( [
'label' => 'Rel canonical',
'name' => 'canonical[' . $lg['id'] . ']',
'id' => 'canonical_' . $lg['id'],
'value' => $this -> page['languages'][ $lg['id'] ]['canonical']
] );?>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
</div>
</div>
</div>
</div>
<div class="clear"></div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'page-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja strony';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> page['id']
],
[
'db' => 'parent_id',
'type' => 'hidden',
'value' => $this -> page['id'] ? $this -> page['parent_id'] : $this -> parent_id
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/pages/page_save/', 'back_url' => '/admin/pages/view_list/' ],
'cancel' => [ 'url' => '/admin/pages/view_list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<?= \Tpl::view('components/form-edit', ['form' => $this->form]); ?>

View File

@@ -1,48 +1,57 @@
<?
<?php
global $gdb;
ob_start();
if ( is_array( $this -> menus ) ) foreach ( $this -> menus as $menu )
{
?>
<div class="menu_sortable">
<ol class="sortable" id="sortable_<?= $menu['id'];?>" menu-id="<?= $menu['id'];?>">
<li id="list_<?= $menu['id'];?>" class="menu_<?= $menu['id'];?>" menu="<?= $menu['id'];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$menu['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Menu nieaktywne"></i>';?>
Menu: <b><?= $menu['name'];?></b>
</div>
<?= \admin\view\Pages::subpages_browse_list( \admin\factory\Pages::menu_pages( $menu['id'] ) );?>
</li>
</ol>
</div>
<?
}
$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();
$grid = new \gridEdit;
$grid -> id = 'pages-list';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Lista stron';
$grid -> default_buttons = false;
$grid -> external_code = $out;
$grid->id = 'pages-list';
$grid->gdb_opt = $gdb;
$grid->include_plugins = true;
$grid->title = 'Lista stron';
$grid->default_buttons = false;
$grid->external_code = $out;
echo $grid -> draw();
echo $grid->draw();
?>
<style type="text/css">
<? if ( $this -> modal ): echo '.mfp-container'; endif;?> body.sb-top.sb-top-sm .navbar.navbar-fixed-top + #sidebar_left + #content_wrapper {
<?php if ($modal): ?>.mfp-container<?php endif; ?> body.sb-top.sb-top-sm .navbar.navbar-fixed-top + #sidebar_left + #content_wrapper {
padding-top: 0;
}
<? if ( $this -> modal ): echo '.mfp-container'; endif;?> #content {
<?php if ($modal): ?>.mfp-container<?php endif; ?> #content {
padding: 27px 0 0;
}
<? if ( $this -> modal ): echo '.mfp-container'; endif;?> #content > .row {
<?php if ($modal): ?>.mfp-container<?php endif; ?> #content > .row {
margin: 0;
}
<? if ( $this -> modal ): echo '.mfp-container'; endif;?> #content > .row > .col-lg-9 {
<?php if ($modal): ?>.mfp-container<?php endif; ?> #content > .row > .col-lg-9 {
padding: 0;
width: 100%;
float: none;
@@ -50,113 +59,88 @@ echo $grid -> draw();
</style>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript">
var menu_id = 0;
function getUrlParam(paramName)
{
var reParam = new RegExp('(?:[\?&]|&amp;)' + paramName + '=([^&]+)', 'i');
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()
{
<? if ( !$this -> modal ):?>
$( '#sidebar_left, .navbar-fixed-top' ).hide();
<? endif;?>
$(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' ) );
$('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: .9,
placeholder: 'placeholder',
revert: 250,
tabSize: 45,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 3,
isTree: true,
expandOnHover: 700,
stop: function() {
save_pages_order();
}
});
$( '.disclose' ).on( 'click', function()
{
$( this ).closest( 'li' ).toggleClass( 'sort-collapsed' ).toggleClass( 'sort-expanded' );
});
$( ".sortable *" ).mousedown( function(e)
{
menu_id = $( this ).parents( 'ol.sortable' ).attr( 'menu-id' );
});
$( '.disclose' ).mousedown( function(e)
{
if ( e.which === 1 ) {
if ( $( this ).parent( 'div' ).hasClass( 'content_menu' ) )
{
var menu_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'menu' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_menus',
menu_id: menu_id
}
});
}
else
{
var page_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'id' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_pages',
page_id: page_id
}
});
}
$('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();
}
});
<?php
$array = unserialize( $_COOKIE[ 'cookie_pages' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '.<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
$array = unserialize( $_COOKIE[ 'cookie_menus' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '.menu_<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
?>
});
</script>
</script>

View File

@@ -1,208 +1,249 @@
<?
<?php
global $gdb;
ob_start();
if ( is_array( $this -> menus ) ) foreach ( $this -> menus as $menu )
{
?>
<div class="menu_sortable">
<ol class="sortable" id="sortable_<?= $menu['id'];?>" menu-id="<?= $menu['id'];?>">
<li id="list_<?= $menu['id'];?>" class="menu_<?= $menu['id'];?>" menu="<?= $menu['id'];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$menu['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Menu nieaktywne"></i>';?>
<b>Menu: <?= $menu['name'];?></b>
<div class="btn-group ml20 pull-right">
<a href="/admin/pages/menu_edit/id=<?= $menu['id'];?>" title="Edytuj menu" class="btn btn-sm btn-system">
<i class="fa fa-file-text"></i> <span class="hidden-xs">Edytuj menu</span>
</a>
<a href="#" title="Usuń menu" class="btn btn-sm btn-danger menu-delete" menu-id="<?= $menu['id'];?>">
<i class="fa fa-trash"></i> <span class="hidden-xs">Usuń menu</span>
</a>
<a href="/admin/pages/page_edit/pid=0&menu_id=<?= $menu['id'];?>" title="Dodaj stronę" class="btn btn-sm btn-success">
<i class="fa fa-plus-circle"></i> <span class="hidden-xs">Dodaj stronę</span>
</a>
</div>
</div>
<?= \Tpl::view( 'pages/subpages-list', [
'pages' => \admin\factory\Pages::menu_pages( $menu['id'] ),
'menu_id' => $menu['id']
] );
?>
</li>
</ol>
</div>
<?
}
$menus = is_array($this->menus ?? null) ? $this->menus : [];
$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; ?>
<b>Menu: <?= htmlspecialchars($menuName, ENT_QUOTES, 'UTF-8'); ?></b>
<div class="btn-group ml20 pull-right">
<a href="/admin/pages/menuEdit/id=<?= $menuId; ?>" title="Edytuj menu" class="btn btn-sm btn-system">
<i class="fa fa-file-text"></i> <span class="hidden-xs">Edytuj menu</span>
</a>
<a href="#" title="Usu&#324; menu" class="btn btn-sm btn-danger menu-delete" menu-id="<?= $menuId; ?>">
<i class="fa fa-trash"></i> <span class="hidden-xs">Usu&#324; menu</span>
</a>
<a href="/admin/pages/edit/pid=0&menu_id=<?= $menuId; ?>" title="Dodaj stron&#281;" class="btn btn-sm btn-success">
<i class="fa fa-plus-circle"></i> <span class="hidden-xs">Dodaj stron&#281;</span>
</a>
</div>
</div>
<?= \Tpl::view('pages/subpages-list', [
'pages' => $menu['pages'] ?? [],
'step' => 1,
]); ?>
</li>
</ol>
</div>
<?php
endforeach;
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'pages-list';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Lista stron';
$grid -> default_buttons = false;
$grid -> buttons = [
[
'label' => 'Dodaj menu',
'url' => '/admin/pages/menu_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
$grid -> external_code = $out;
$grid->id = 'pages-list';
$grid->gdb_opt = $gdb;
$grid->include_plugins = true;
$grid->title = 'Lista stron';
$grid->default_buttons = false;
$grid->buttons = [
[
'label' => 'Dodaj menu',
'url' => '/admin/pages/menuEdit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success',
],
];
$grid->external_code = $out;
echo $grid -> draw();
echo $grid->draw();
?>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<style type="text/css">
.jconfirm.table-list-confirm-dialog .jconfirm-row {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.jconfirm.table-list-confirm-dialog .jconfirm-box-container {
width: 100%;
max-width: 560px;
padding-left: 12px;
padding-right: 12px;
margin: 0 auto;
}
.jconfirm.table-list-confirm-dialog .jconfirm-box {
width: 100% !important;
}
</style>
<script type="text/javascript">
var menu_id = 0;
var menu_id = 0;
var cookiePages = <?= json_encode($cookiePages, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); ?>;
var cookieMenus = <?= json_encode($cookieMenus, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); ?>;
$( document ).ready( function()
{
$( 'body' ).on( 'click', '.menu-delete', function()
{
var menu_id = $( this ).attr( 'menu-id' );
$(document).ready(function() {
function confirmDialog(message, onConfirm) {
if (typeof $.confirm === 'function') {
$.confirm({
title: 'Potwierdzenie',
content: String(message),
type: 'red',
boxWidth: '560px',
useBootstrap: false,
animation: 'scale',
closeAnimation: 'scale',
backgroundDismissAnimation: 'shake',
container: 'body',
theme: 'modern',
columnClass: '',
typeAnimated: true,
lazyOpen: false,
draggable: false,
closeIcon: true,
containerFluid: true,
escapeKey: true,
backgroundDismiss: true,
animationBounce: 1.1,
watchInterval: 100,
offsetTop: 0,
offsetBottom: 0,
customClass: 'table-list-confirm-dialog',
buttons: {
cancel: {
text: 'Anuluj',
btnClass: 'btn-default'
},
confirm: {
text: 'Usuń',
btnClass: 'btn-danger',
action: function() {
if (typeof onConfirm === 'function') {
onConfirm();
}
}
}
}
});
return;
}
$.prompt( "Na pewno chcesz usunąć wybrane menu?",
{
title: "Potwierdź?",
buttons: { "Tak": true, "Nie": false },
submit: function( e, v, m, f )
{
if ( v === true )
document.location.href = '/admin/pages/menu_delete/id=' + menu_id;
}
if (window.confirm(message) && typeof onConfirm === 'function') {
onConfirm();
}
}
$('body').on('click', '.menu-delete', function() {
var selectedMenuId = $(this).attr('menu-id');
confirmDialog('Na pewno chcesz usunąć wybrane menu?', function() {
document.location.href = '/admin/pages/menuDelete/id=' + selectedMenuId;
});
});
$( 'body' ).on( 'click', '.page-delete', function()
{
var page_id = $( this ).attr( 'page-id' );
$('body').on('click', '.page-delete', function() {
var pageId = $(this).attr('page-id');
$.prompt( "Na pewno chcesz usunąć wybraną stronę?",
{
title: "Potwierdź?",
buttons: { "Tak": true, "Nie": false },
submit: function( e, v, m, f )
{
if ( v === true )
document.location.href = '/admin/pages/page_delete/id=' + page_id;
}
confirmDialog('Na pewno chcesz usunąć wybraną stronę?', function() {
document.location.href = '/admin/pages/delete/id=' + pageId;
});
});
$( 'ol.sortable' ).nestedSortable(
{
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .9,
placeholder: 'placeholder',
revert: 250,
tabSize: 45,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 4,
isTree: true,
expandOnHover: 700,
$('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: 4,
isTree: true,
expandOnHover: 700,
stop: function() {
save_pages_order();
}
});
$( '.disclose' ).on( 'click', function()
{
$( this ).closest( 'li' ).toggleClass( 'sort-collapsed' ).toggleClass( 'sort-expanded' );
});
$( ".sortable *" ).mousedown( function(e)
{
menu_id = $( this ).parents( 'ol.sortable' ).attr( 'menu-id' );
});
$( '.disclose' ).mousedown( function(e)
{
if ( e.which === 1 ) {
if ( $( this ).parent( 'div' ).hasClass( 'content_menu' ) )
{
var menu_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'menu' );
$('.disclose').on('click', function() {
$(this).closest('li').toggleClass('sort-collapsed').toggleClass('sort-expanded');
});
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_menus',
menu_id: menu_id
}
});
}
else
{
var page_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'id' );
$('.sortable *').mousedown(function() {
menu_id = $(this).parents('ol.sortable').attr('menu-id');
});
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_pages',
page_id: page_id
}
});
}
$('.disclose').mousedown(function(e) {
if (e.which !== 1) {
return;
}
if ($(this).parent('div').hasClass('content_menu')) {
var selectedMenuId = $(this).parent('div').parent('li').attr('menu');
$.ajax({
type: 'POST',
cache: false,
url: '/admin/pages/cookieMenus/',
data: { menu_id: selectedMenuId }
});
} 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 }
});
}
});
<?php
$array = unserialize( $_COOKIE[ 'cookie_pages' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '.<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
Object.keys(cookiePages || {}).forEach(function(key) {
if (String(cookiePages[key]) === '1') {
$('.list_' + key).children('div').children('span.disclose').click();
}
});
$array = unserialize( $_COOKIE[ 'cookie_menus' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '.menu_<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
?>
Object.keys(cookieMenus || {}).forEach(function(key) {
if (String(cookieMenus[key]) === '1') {
$('.menu_' + key).children('div').children('span.disclose').click();
}
});
});
function save_pages_order( )
{
pages = $( '#sortable_' + menu_id ).nestedSortable( 'toArray', { startDepthCount: 0 } );
function save_pages_order() {
if (!menu_id) {
return;
}
$.ajax(
{
var pages = $('#sortable_' + menu_id).nestedSortable('toArray', { startDepthCount: 0 });
$.ajax({
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data:
{
a: 'save_pages_order',
url: '/admin/pages/savePagesOrder/',
data: {
menu_id: menu_id,
pages: pages
},
beforeSend: function()
{
$.prompt( 'Trwa zapisywanie...', { title: 'Proszę czekać' } );
beforeSend: function() {
$.prompt('Trwa zapisywanie...', { title: 'Prosz\\u0119 czeka\\u0107' });
},
success: function( data )
{
$( '.jqibox' ).remove();
response = jQuery.parseJSON( data );
success: function(data) {
$('.jqibox').remove();
if ( response.status === 'error' )
create_error( response.msg );
var response = jQuery.parseJSON(data);
if (response.status === 'error') {
create_error(response.msg);
}
}
});
}
</script>
</script>

View File

@@ -1,77 +1,60 @@
<? if ( is_array( $this -> pages ) ):?>
<? $settings = \front\factory\Settings::settings_details();?>
<ol>
<? foreach ( $this -> pages as $page ):?>
<li id="list_<?= $page['id'];?>" idk="<?= $page['id'];?>" class="list_<?= $page['id'];?>" menu="<?= $page['menu_id'];?>">
<div class="content">
<span class="disclose"><span></span></span>
<?
if ( !$page['status'] )
echo '<i class="fa fa-ban fa-lg text-danger" title="Strona nieaktywna"></i>';
<?php
$pages = is_array($this->pages ?? null) ? $this->pages : [];
$step = (int)($this->step ?? 1);
if ( $page['start'] )
echo '<i class="fa fa-star fa-lg text-system" title="Strona startowa"></i>';
echo $page['title'];
if ( is_array( $page['languages'] ) ):
echo '<div class="btn-group flags" style="display: inline-block;">';
foreach ( $page['languages'] as $lg )
echo '<img src="/admin/layout/lang-' . $lg['lang_id'] . '.jpg" />';
echo '</div>';
endif;
$default_language = \front\factory\Languages::default_language();
if ( is_array( $page['languages'] ) ):
foreach ( $page['languages'] as $lg ):
echo '<div class="btn-group ml20 pull-right">';
echo '<a href="#" title="Wybierz stronę" class="btn btn-sm btn-system button url-select" url="';
if ( $settings['links_structure'] )
{
if ( $lg['seo_link'] )
{
$seo = '/' . \admin\factory\Pages::google_url_preview( $page['id'],
$lg['title'], $lg['lang_id'], 0, 0,
$lg['seo_link'] );
echo $seo;
}
else
{
$seo = '/' . \admin\factory\Pages::google_url_preview( $page['id'],
$lg['title'], $lg['lang_id'], 0, 0, 0 );
echo $seo;
}
}
else
{
if ( $lg['seo_link'] )
{
if ( $default_language != $lg['lang_id'] )
echo '/' . $lg['lang_id'];
echo '/' . $lg['seo_link'];
}
else
{
if ( $default_language != $lg['lang_id'] )
echo '/' . $lg['lang_id'];
echo '/s-' . $page['id'] . '-' . \S::seo( $lg['title'] );
}
}
echo '">';
echo '<i class="fa fa-check"></i> <span class="hidden-xs">' . strtoupper( $lg['lang_id'] ) . '</span>';
echo '</a>';
echo '</div>';
endforeach;
endif;
?>
</div>
<?
if ( is_array( $page['subpages'] ) )
echo \admin\view\Pages::subpages_browse_list( $page['subpages'],
$page['id'], $this -> step + 1 );
if (empty($pages)) {
return;
}
?>
<ol>
<?php foreach ($pages as $page): ?>
<?php
$pageId = (int)($page['id'] ?? 0);
$menuId = (int)($page['menu_id'] ?? 0);
$title = (string)($page['title'] ?? '');
$status = (int)($page['status'] ?? 0);
$start = (int)($page['start'] ?? 0);
$languages = is_array($page['languages'] ?? null) ? $page['languages'] : [];
$previewUrls = is_array($page['preview_urls'] ?? null) ? $page['preview_urls'] : [];
?>
</li>
<? endforeach;?>
</ol>
<? endif;?>
<li id="list_<?= $pageId; ?>" class="list_<?= $pageId; ?>" menu="<?= $menuId; ?>">
<div class="content">
<span class="disclose"><span></span></span>
<?php if ($status !== 1): ?><i class="fa fa-ban fa-lg text-danger" title="Strona nieaktywna"></i><?php endif; ?>
<?php if ($start === 1): ?><i class="fa fa-star fa-lg text-system" title="Strona startowa"></i><?php endif; ?>
<?= htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); ?>
<?php if (!empty($languages)): ?>
<div class="btn-group flags" style="display: inline-block;">
<?php foreach ($languages as $language): ?>
<?php $langId = (string)($language['lang_id'] ?? ''); ?>
<?php if ($langId !== ''): ?>
<img src="/admin/layout/lang-<?= htmlspecialchars($langId, ENT_QUOTES, 'UTF-8'); ?>.jpg" />
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php foreach ($languages as $language): ?>
<?php
$langId = (string)($language['lang_id'] ?? '');
if ($langId === '') {
continue;
}
$url = (string)($previewUrls[$langId] ?? '#');
?>
<div class="btn-group ml20 pull-right">
<a href="#" title="Wybierz stronę" class="btn btn-sm btn-system button url-select" url="<?= htmlspecialchars($url, ENT_QUOTES, 'UTF-8'); ?>">
<i class="fa fa-check"></i> <span class="hidden-xs"><?= strtoupper(htmlspecialchars($langId, ENT_QUOTES, 'UTF-8')); ?></span>
</a>
</div>
<?php endforeach; ?>
</div>
<?= \Tpl::view('pages/subpages-browse-list', [
'pages' => $page['subpages'] ?? [],
'step' => $step + 1,
]); ?>
</li>
<?php endforeach; ?>
</ol>

View File

@@ -1,60 +1,75 @@
<? if ( is_array( $this -> pages ) ):?>
<ol>
<? foreach ( $this -> pages as $page ):?>
<li id="list_<?= $page['id'];?>" idk="<?= $page['id'];?>" class="list_<?= $page['id'];?>" menu="<?= $page['menu_id'];?>">
<div class="content">
<div class="menu-box-title">
<?php
$pages = is_array($this->pages ?? null) ? $this->pages : [];
$step = (int)($this->step ?? 1);
if (empty($pages)) {
return;
}
?>
<ol>
<?php foreach ($pages as $page): ?>
<?php
$pageId = (int)($page['id'] ?? 0);
$menuId = (int)($page['menu_id'] ?? 0);
$title = (string)($page['title'] ?? '');
$status = (int)($page['status'] ?? 0);
$start = (int)($page['start'] ?? 0);
$languages = is_array($page['languages'] ?? null) ? $page['languages'] : [];
?>
<li id="list_<?= $pageId; ?>" class="list_<?= $pageId; ?>" menu="<?= $menuId; ?>">
<div class="content">
<div class="menu-box-title">
<span class="disclose"><span></span></span>
<? if ( !$page['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Strona nieaktywna"></i>';?>
<? if ( $page['start'] ) echo '<i class="fa fa-star fa-lg text-system" title="Strona startowa"></i>';?>
<?= $page['title'];?>
<?
if ( is_array( $page['languages'] ) ):
echo '<div class="btn-group flags" style="display: inline-block;">';
foreach ( $page['languages'] as $lg )
echo '<img src="/admin/layout/lang-' . $lg['lang_id'] . '.jpg" />';
echo '</div>';
endif;
?>
<?php if ($status !== 1): ?><i class="fa fa-ban fa-lg text-danger" title="Strona nieaktywna"></i><?php endif; ?>
<?php if ($start === 1): ?><i class="fa fa-star fa-lg text-system" title="Strona startowa"></i><?php endif; ?>
<?= htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); ?>
<?php if (!empty($languages)): ?>
<div class="btn-group flags" style="display: inline-block;">
<?php foreach ($languages as $language): ?>
<?php $langId = (string)($language['lang_id'] ?? ''); ?>
<?php if ($langId !== ''): ?>
<img src="/admin/layout/lang-<?= htmlspecialchars($langId, ENT_QUOTES, 'UTF-8'); ?>.jpg" />
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<? if ( $this -> step < 3 ):?>
<div class="btn-group ml20 pull-right">
<a href="/admin/pages/page_edit/id=<?= $page['id'];?>&menu_id=<?= $page['menu_id'];?>" title="Edytuj stronę" class="btn btn-sm btn-system">
<i class="fa fa-file-text"></i> <span class="hidden-xs">Edytuj stronę</span>
</a>
<a href="#" title="Usuń stronę" class="btn btn-sm btn-danger page-delete" page-id="<?= $page['id'];?>">
<i class="fa fa-trash"></i> <span class="hidden-xs">Usuń stronę</span>
</a>
<a href="/admin/pages/page_articles/id=<?= $page['id'];?>" title="Lista artykułów" class="btn btn-sm btn-info" page-id="<?= $page['id'];?>">
<i class="fa fa-bars"></i> <span class="hidden-xs">Lista artykułów</span>
</a>
<a href="/admin/pages/page_edit/pid=<?= $page['id'];?>&menu_id=<?= $page['menu_id'];?>" title="Dodaj podstronę" class="btn btn-sm btn-success">
<i class="fa fa-plus-circle"></i> <span class="hidden-xs">Dodaj podstronę</span>
</a>
</div>
<? else:?>
<div class="btn-group ml20 pull-right">
<a href="/admin/pages/page_edit/id=<?= $page['id'];?>&menu_id=<?= $page['menu_id'];?>" title="Edytuj stronę" class="btn btn-sm btn-system">
<i class="fa fa-file-text"></i> <span class="hidden-xs">Edytuj stronę</span>
</a>
<a href="#" title="Usuń stronę" class="btn btn-sm btn-danger page-delete" page-id="<?= $page['id'];?>">
<i class="fa fa-trash"></i> <span class="hidden-xs">Usuń stronę</span>
</a>
<a href="/admin/pages/page_articles/id=<?= $page['id'];?>" title="Lista artykułów" class="btn btn-sm btn-info" page-id="<?= $page['id'];?>">
<i class="fa fa-bars"></i> <span class="hidden-xs">Lista artykułów</span>
</a>
</div>
<? endif;?>
</div>
<?= \Tpl::view( 'pages/subpages-list', [
'pages' => \admin\factory\Pages::menu_pages( $this -> menu_id, $page['id'] ),
'menu_id' => $this -> menu_id,
'parent_id' => $page['id'],
'step' => $this -> step + 1
] );
?>
</li>
<? endforeach;?>
</ol>
<? endif;?>
<?php if ($step < 3): ?>
<div class="btn-group ml20 pull-right">
<a href="/admin/pages/edit/id=<?= $pageId; ?>&menu_id=<?= $menuId; ?>" title="Edytuj stron&#281;" class="btn btn-sm btn-system">
<i class="fa fa-file-text"></i> <span class="hidden-xs">Edytuj stron&#281;</span>
</a>
<a href="#" title="Usu&#324; stron&#281;" class="btn btn-sm btn-danger page-delete" page-id="<?= $pageId; ?>">
<i class="fa fa-trash"></i> <span class="hidden-xs">Usu&#324; stron&#281;</span>
</a>
<a href="/admin/pages/pageArticles/id=<?= $pageId; ?>" title="Lista artyku&#322;&#243;w" class="btn btn-sm btn-info" page-id="<?= $pageId; ?>">
<i class="fa fa-bars"></i> <span class="hidden-xs">Lista artyku&#322;&#243;w</span>
</a>
<a href="/admin/pages/edit/pid=<?= $pageId; ?>&menu_id=<?= $menuId; ?>" title="Dodaj podstron&#281;" class="btn btn-sm btn-success">
<i class="fa fa-plus-circle"></i> <span class="hidden-xs">Dodaj podstron&#281;</span>
</a>
</div>
<?php else: ?>
<div class="btn-group ml20 pull-right">
<a href="/admin/pages/edit/id=<?= $pageId; ?>&menu_id=<?= $menuId; ?>" title="Edytuj stron&#281;" class="btn btn-sm btn-system">
<i class="fa fa-file-text"></i> <span class="hidden-xs">Edytuj stron&#281;</span>
</a>
<a href="#" title="Usu&#324; stron&#281;" class="btn btn-sm btn-danger page-delete" page-id="<?= $pageId; ?>">
<i class="fa fa-trash"></i> <span class="hidden-xs">Usu&#324; stron&#281;</span>
</a>
<a href="/admin/pages/pageArticles/id=<?= $pageId; ?>" title="Lista artyku&#322;&#243;w" class="btn btn-sm btn-info" page-id="<?= $pageId; ?>">
<i class="fa fa-bars"></i> <span class="hidden-xs">Lista artyku&#322;&#243;w</span>
</a>
</div>
<?php endif; ?>
</div>
<?= \Tpl::view('pages/subpages-list', [
'pages' => $page['subpages'] ?? [],
'step' => $step + 1,
]); ?>
</li>
<?php endforeach; ?>
</ol>