first commit

This commit is contained in:
2024-10-25 23:02:37 +02:00
commit faeb2e52e8
7653 changed files with 1095335 additions and 0 deletions

View File

@@ -0,0 +1,163 @@
<?
global $gdb;
ob_start();
?>
<div class="menu_sortable">
<ol class="sortable" id="sortable">
<? if ( is_array( $this -> categories ) ): foreach ( $this -> categories as $category ):?>
<li id="list_<?= $category['id'];?>" class="category_<?= $category['id'];?>" category="<?= $category['id'];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$category['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
<b><?= $category['languages'][$this -> dlang]['title'];?></b>
<div class="btn-group ml20 pull-right">
<a href="/admin/shop_category/category_edit/id=<?= $category['id'];?>" title="Edytuj kategorię" class="btn btn-sm btn-system">
<i class="fa fa-file-text"></i> <span class="hidden-xs">Edytuj kategorię</span>
</a>
<a href="#" title="Usuń kategorię" class="btn btn-sm btn-danger category-delete" category-id="<?= $category['id'];?>">
<i class="fa fa-trash"></i> <span class="hidden-xs">Usuń kategorię</span>
</a>
<a href="/admin/shop_category/category_products/id=<?= $category['id'];?>" title="Lista produktów" class="btn btn-sm btn-info" category-id="<?= $category['id'];?>">
<i class="fa fa-bars"></i> <span class="hidden-xs">Lista produków</span>
</a>
<a href="/admin/shop_category/category_edit/pid=<?= $category['id'];?>" title="Dodaj podkategorię" class="btn btn-sm btn-success">
<i class="fa fa-plus-circle"></i> <span class="hidden-xs">Dodaj podkategorię</span>
</a>
</div>
</div>
<?= \Tpl::view( 'shop-category/subcategories-list', [
'categories' => \admin\factory\ShopCategory::subcategories( $category['id'] ),
'level' => $this -> level + 1,
'dlang' => $this -> dlang
] );?>
</li>
<? endforeach; endif;?>
</ol>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'pages-list';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Lista kategorii';
$grid -> default_buttons = false;
$grid -> buttons = [
[
'label' => 'Dodaj kategorię',
'url' => '/admin/shop_category/category_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
$grid -> external_code = $out;
echo $grid -> draw();
?>
<script type="text/javascript" src="/libraries/jquery-nested-sortable/jquery.mjs.nestedSortable.js"></script>
<script type="text/javascript">
$( document ).ready( function()
{
$( 'body' ).on( 'click', '.category-delete', function()
{
var category_id = $( this ).attr( 'category-id' );
$.prompt( "Na pewno chcesz usunąć wybraną kategorię?",
{
title: "Potwierdź?",
buttons: { "Tak": true, "Nie": false },
submit: function( e, v, m, f )
{
if ( v === true )
document.location.href = '/admin/shop_category/category_delete/id=' + category_id;
}
});
});
$( '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,
protectRoot: false,
stop: function() {
save_categories_order();
}
});
$( '.disclose' ).on( 'click', function()
{
$( this ).closest( 'li' ).toggleClass( 'sort-collapsed' ).toggleClass( 'sort-expanded' );
});
$( '.disclose' ).mousedown( function(e)
{
if ( e.which === 1 )
{
var category_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'id' );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_categories',
category_id: category_id
}
});
}
});
<?php
$array = unserialize( $_COOKIE[ 'cookie_categories' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '#<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
?>
});
function save_categories_order( )
{
categories = $( '#sortable' ).nestedSortable( 'toArray', { startDepthCount: 0 } );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data:
{
a: 'save_categories_order',
categories: categories
},
beforeSend: function()
{
$.prompt( 'Trwa zapisywanie...', { title: 'Proszę czekać' } );
},
success: function( data )
{
$( '.jqibox' ).remove();
response = jQuery.parseJSON( data );
if ( response.status === 'error' )
create_error( response.msg );
}
});
}
</script>

View File

@@ -0,0 +1,106 @@
<?
global $gdb;
ob_start();
?>
<div class="menu_sortable">
<ol class="sortable" id="sortable">
<? if ( is_array( $this -> categories ) ): foreach ( $this -> categories as $category ):?>
<li id="list_<?= $category['id'];?>" class="category_<?= $category['id'];?>" category="<?= $category['id'];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$category['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
<b><?= $category['languages'][$this -> dlang]['title'];?></b>
<div class="btn-group ml20 pull-right">
<a href="#" title="Wybierz kategorię" class="btn btn-sm btn-system button category-select" category-title="<?= $category['languages'][$this -> dlang]['title'];?>" category-id="<?= $category['id'];?>">
<i class="fa fa-check"></i> <span class="hidden-xs">wybierz</span>
</a>
</div>
</div>
<?= \Tpl::view( 'shop-category/subcategory-browse-list', [
'categories' => \admin\factory\ShopCategory::subcategories( $category['id'] ),
'level' => $this -> level + 1,
'dlang' => $this -> dlang
] );?>
</li>
<? endforeach; endif;?>
</ol>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'pages-list';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = false;
$grid -> title = 'Lista kategorii';
$grid -> default_buttons = false;
$grid -> external_code = $out;
echo $grid -> draw();
?>
<style type="text/css">
.mfp-container body.sb-top.sb-top-sm .navbar.navbar-fixed-top + #sidebar_left + #content_wrapper {
padding-top: 0;
}
.mfp-container #content {
padding: 27px 0 0;
}
.mfp-container #content > .row {
margin: 0;
}
.mfp-container #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">
$( document ).ready( function() {
$( '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,
protectRoot: false
});
$( '.disclose' ).on( 'click', function() {
$( this ).closest( 'li' ).toggleClass( 'sort-collapsed' ).toggleClass( 'sort-expanded' );
});
$( '.disclose' ).mousedown( function(e) {
if ( e.which === 1 ) {
var category_id = $( this ).parent( 'div' ).parent( 'li' ).attr( 'id' );
$.ajax({
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'cookie_categories',
category_id: category_id
}
});
}
});
<?php
$array = unserialize( $_COOKIE[ 'cookie_categories' ] );
if ( is_array( $array ) ): foreach ( $array as $key => $val ):
if ( $val ):
?>$( '#<?= $key;?>' ).children( 'div' ).children( 'span.disclose' ).click();<?
endif;
endforeach; endif;
?>
});
</script>

View File

@@ -0,0 +1,266 @@
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript">
$( function()
{
disable_menu();
$( '#settings-tabs' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'settings-tabs',
type: 'vertical'
});
$( '#languages-main' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'languages-main'
});
$( '#languages-seo' ).easyResponsiveTabs({
width: 'auto',
fit: true,
tabidentify: 'languages-seo'
});
$( '#page_type' ).trigger( 'change' );
});
function generate_seo_links( lang, title, category_id )
{
if ( title === '' )
return false;
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data: {
a: 'generate_seo_link',
title: title,
category_id: category_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 );
}
});
}
</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 id="languages-main">
<ul class="resp-tabs-list languages-main htabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li><? 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 class="resp-tabs-container languages-main">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div>
<?= \Html::input(
array(
'label' => 'Nazwa kategorii',
'name' => 'title[' . $lg['id'] . ']',
'id' => 'title_' . $lg['id'],
'value' => $this -> category[ 'languages' ][ $lg['id'] ]['title'],
'inline' => true
)
);?>
<?= \Html::textarea(
array(
'label' => 'Opis kategorii',
'name' => 'text[' . $lg['id'] . ']',
'id' => 'text_' . $lg['id'],
'value' => $this -> category['languages'][ $lg['id'] ]['text'],
'inline' => true
)
);?>
<?= \Html::textarea(
array(
'label' => 'Opis kategorii (rozwinięcie)',
'name' => 'text_hidden[' . $lg['id'] . ']',
'id' => 'text_hidden_' . $lg['id'],
'value' => $this -> category['languages'][ $lg['id'] ]['text_hidden'],
'inline' => true
)
);?>
<?= \Html::textarea( [
'label' => 'Dodatkowy tekst (nad produktami)',
'name' => 'additional_text[' . $lg['id'] . ']',
'id' => 'additional_text_' . $lg['id'],
'value' => $this -> category['languages'][ $lg['id'] ]['additional_text'],
'inline' => true
] );?>
<script type="text/javascript">
$( function() {
$( '#text_<?= $lg['id'];?>, #text_hidden_<?= $lg['id'];?>, #additional_text_<?= $lg['id'];?>' ).ckeditor( {
toolbar : 'MyToolbar',
height:'250'
});
});
</script>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
<div class="clear"></div>
</div>
</div>
<div style="padding: 15px;">
<?= \Html::input_switch(
array(
'label' => 'Aktywna',
'name' => 'status',
'checked' => $this -> category['status'] == 1 or !$this -> category['id'] ? true : false
)
);?>
<?= \Html::select(
[
'label' => 'Sortowanie produktów',
'name' => 'sort_type',
'id' => 'sort_type',
'values' => \admin\factory\ShopCategory::$_sort_types,
'value' => $this -> category['sort_type']
]
);?>
<?= \Html::input_switch(
array(
'label' => 'Wyświetlić podkategorie',
'name' => 'view_subcategories',
'checked' => $this -> category['view_subcategories'] == 1 ? true : false
)
);?>
</div>
<div>
<div id="languages-seo">
<ul class="resp-tabs-list languages-seo htabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li><? 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 class="resp-tabs-container languages-seo">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div>
<?= \Html::input_icon(
array(
'label' => 'Link SEO',
'name' => 'seo_link[' . $lg['id'] . ']',
'id' => 'seo_link_' . $lg['id'],
'value' => $this -> category['languages' ][ $lg['id'] ]['seo_link'],
'icon_content' => 'generuj',
'icon_js' => 'generate_seo_links( "' . $lg['id'] . '", $( "#title_' . $lg['id'] . '" ).val(), ' . (int)$this -> category['id'] . ' );'
)
);?>
<?= \Html::input(
array(
'label' => 'Tytuł kategorii (h1)',
'name' => 'category_title[' . $lg['id'] . ']',
'id' => 'category_title_' . $lg['id'],
'value' => $this -> category['languages' ][ $lg['id'] ]['category_title']
)
);?>
<?= \Html::input(
array(
'label' => 'Meta title',
'name' => 'meta_title[' . $lg['id'] . ']',
'id' => 'meta_title_' . $lg['id'],
'value' => $this -> category['languages'][ $lg['id'] ]['meta_title']
)
);?>
<?= \Html::textarea(
array(
'label' => 'Meta description',
'name' => 'meta_description[' . $lg['id'] . ']',
'id' => 'meta_description_' . $lg['id'],
'value' => $this -> category['languages'][ $lg['id'] ]['meta_description']
)
);?>
<?= \Html::textarea(
array(
'label' => 'Meta keywords',
'name' => 'meta_keywords[' . $lg['id'] . ']',
'id' => 'meta_keywords_' . $lg['id'],
'value' => $this -> category['languages'][ $lg['id'] ]['meta_keywords']
)
);?>
<?= \Html::select(
array(
'label' => 'Blokuj indeksację',
'name' => 'noindex[' . $lg['id'] . ']',
'id' => 'noindex_' . $lg['id'],
'values' => array(
0 => 'nie', 1 => 'tak'
),
'value' => $this -> category['languages'][ $lg['id'] ]['noindex'] == 1 ? 1 : 0
)
);?>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<div class="clear"></div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'category-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja kategorii';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> category['id']
],
[
'db' => 'parent_id',
'type' => 'hidden',
'value' => $this -> category['id'] ? $this -> category['parent_id'] : $this -> pid
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/shop_category/save/', 'back_url' => '/admin/shop_category/view_list/' ],
'cancel' => [ 'url' => '/admin/shop_category/view_list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>

View File

@@ -0,0 +1,89 @@
<?
global $gdb;
ob_start();
?>
<ol class="sortable" id="article-list">
<?
if ( is_array( $this -> products ) ) foreach ( $this -> products as $product )
{
?>
<li id="list_<?= $product['product_id'];?>">
<div class="content <? if ( !$product['status'] ) echo 'text-danger';?>"><span class="disclose"><span></span></span> <?= $product['name'];?></div>
</li>
<?
}
?>
</ol>
<?
$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 produktów';
$grid -> buttons = [
[
'label' => 'Wstecz',
'url' => '/admin/shop_category/view_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,
save_articles_order: true
});
});
function save_articles_order()
{
products = $( 'ol.sortable' ).nestedSortable( 'toArray', { startDepthCount: 0 } );
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/ajax.php',
data:
{
a: 'save_products_order',
category_id: <?= $this -> category_id;?>,
products: products
},
beforeSend: function()
{
$.prompt( 'Trwa zapisywanie...', { title: 'Proszę czekać' } );
},
success: function( data )
{
$( '.jqibox' ).remove();
response = jQuery.parseJSON( data );
if ( response.status === 'error' )
create_error( response.msg );
}
});
}
</script>

View File

@@ -0,0 +1,34 @@
<? if ( is_array( $this -> categories ) ):?>
<ol>
<? foreach ( $this -> categories as $category ):?>
<li id="list_<?= $category['id'];?>" class="list_<?= $category['id'];?>" category="<?= $category['id'];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$category['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
<b><?= $category['languages'][$this -> dlang]['title'];?></b>
<div class="btn-group ml20 pull-right">
<a href="/admin/shop_category/category_edit/id=<?= $category['id'];?>" title="Edytuj kategorię" class="btn btn-sm btn-system">
<i class="fa fa-file-text"></i> <span class="hidden-xs">Edytuj kategorię</span>
</a>
<a href="#" title="Usuń kategorię" class="btn btn-sm btn-danger category-delete" category-id="<?= $category['id'];?>">
<i class="fa fa-trash"></i> <span class="hidden-xs">Usuń kategorię</span>
</a>
<a href="/admin/shop_category/category_products/id=<?= $category['id'];?>" title="Lista produktów" class="btn btn-sm btn-info" category-id="<?= $category['id'];?>">
<i class="fa fa-bars"></i> <span class="hidden-xs">Lista produków</span>
</a>
<? if ( $this -> level < 2 ):?>
<a href="/admin/shop_category/category_edit/pid=<?= $category['id'];?>" title="Dodaj podkategorię" class="btn btn-sm btn-success">
<i class="fa fa-plus-circle"></i> <span class="hidden-xs">Dodaj podkategorię</span>
</a>
<? endif;?>
</div>
</div>
<?= \Tpl::view( 'shop-category/subcategories-list', [
'categories' => \admin\factory\ShopCategory::subcategories( $category['id'] ),
'level' => $this -> level + 1,
'dlang' => $this -> dlang
] );?>
</li>
<? endforeach;?>
</ol>
<? endif;?>

View File

@@ -0,0 +1,23 @@
<? if ( is_array( $this -> categories ) ):?>
<ol>
<? foreach ( $this -> categories as $category ):?>
<li id="list_<?= $category['id'];?>" class="list_<?= $category['id'];?>" category="<?= $category['id'];?>">
<div class="context_0 content content_menu">
<span class="disclose"><span></span></span>
<? if ( !$category['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
<b><?= $category['languages'][$this -> dlang]['title'];?></b>
<div class="btn-group ml20 pull-right">
<a href="#" title="Wybierz kategorię" class="btn btn-sm btn-system button category-select" category-title="<?= $category['languages'][$this -> dlang]['title'];?>" category-id="<?= $category['id'];?>">
<i class="fa fa-check"></i> <span class="hidden-xs">wybierz</span>
</a>
</div>
</div>
<?= \Tpl::view( 'shop-category/subcategory-browse-list', [
'categories' => \admin\factory\ShopCategory::subcategories( $category['id'] ),
'level' => $this -> level + 1,
'dlang' => $this -> dlang
] );?>
</li>
<? endforeach;?>
</ol>
<? endif;?>