Add view classes for articles, banners, languages, menu, newsletter, containers, shop categories, clients, payment methods, products, and search

- Created Articles.php for rendering article views including full articles, miniature lists, and news sections.
- Added Banners.php for handling banner displays.
- Introduced Languages.php for rendering language options.
- Implemented Menu.php for dynamic menu rendering.
- Developed Newsletter.php for newsletter view rendering.
- Created Scontainers.php for rendering specific containers.
- Added ShopCategory.php for category descriptions and product listings.
- Introduced ShopClient.php for managing client-related views such as address editing and order history.
- Implemented ShopPaymentMethod.php for displaying payment methods in the basket.
- Created ShopProduct.php for generating product URLs.
- Added ShopSearch.php for rendering a simple search form.
- Added .htaccess file to enhance security by restricting access to sensitive files and directories.
This commit is contained in:
2026-02-21 23:00:15 +01:00
parent b51244c1d6
commit 3ecbe628dc
435 changed files with 44107 additions and 31270 deletions

View File

@@ -1,7 +1,7 @@
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
<?
\S::set_session( 'admin', true );
\Shared\Helpers\Helpers::set_session( 'admin', true );
global $db;
$_SESSION['rfm_akey'] = bin2hex(random_bytes(16));
@@ -19,7 +19,7 @@ ob_start();
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<?= \Html::input(
<?= \Shared\Html\Html::input(
array(
'label' => 'Nazwa',
'name' => 'name',
@@ -28,7 +28,7 @@ ob_start();
'class' => 'require'
) );
?>
<?= \Html::input_switch(
<?= \Shared\Html\Html::input_switch(
array(
'label' => 'Aktywny',
'name' => 'status',
@@ -46,7 +46,7 @@ ob_start();
)
);
?>
<?= \Html::input(
<?= \Shared\Html\Html::input(
array(
'label' => 'Data zakończenia',
'name' => 'date_end',
@@ -55,7 +55,7 @@ ob_start();
'class' => 'date'
) );
?>
<?= \Html::input_switch(
<?= \Shared\Html\Html::input_switch(
array(
'label' => 'Slajder / Strona główna',
'name' => 'home_page',
@@ -78,18 +78,18 @@ ob_start();
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div>
<?= \Html::input_icon(
<?= \Shared\Html\Html::input_icon(
array(
'label' => 'Obraz',
'name' => 'src[' . $lg['id'] . ']',
'id' => 'src_' . $lg['id'],
'value' => $this -> banner['languages'][ $lg['id'] ]['src'],
'icon_content' => 'przeglądaj',
'icon_js' => "window.open ( 'http://" . $_SERVER['SERVER_NAME'] . "/libraries/filemanager-9.14.2/dialog.php?type=1&popup=1&field_id=src_" . $lg['id'] . "&akey=" . $rfmAkeyJS . "', 'mywindow', 'location=1,status=1,scrollbars=1, width=1100,height=700');"
'icon_js' => "window.open ( '/libraries/filemanager-9.14.2/dialog.php?type=1&popup=1&field_id=src_" . $lg['id'] . "&akey=" . $rfmAkeyJS . "', 'mywindow', 'location=1,status=1,scrollbars=1, width=1100,height=700');"
)
);
?>
<?= \Html::input(
<?= \Shared\Html\Html::input(
array(
'label' => 'Url',
'name' => 'url[' . $lg['id'] . ']',
@@ -98,7 +98,7 @@ ob_start();
)
);
?>
<?= \Html::textarea(
<?= \Shared\Html\Html::textarea(
array(
'label' => 'Kod html',
'name' => 'html[' . $lg['id'] . ']',
@@ -107,7 +107,7 @@ ob_start();
)
);
?>
<?= \Html::textarea(
<?= \Shared\Html\Html::textarea(
array(
'label' => 'Treść',
'name' => 'text[' . $lg['id'] . ']',
@@ -136,26 +136,14 @@ ob_start();
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'banner-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja baneru';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> banner['id']
]
];
$grid -> external_code = $out;
$grid -> actions = [
'save' => [ 'url' => '/admin/banners/banner_save/', 'back_url' => '/admin/banners/view_list/' ],
'cancel' => [ 'url' => '/admin/banners/view_list/' ]
];
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
$gridId = 'banner-edit';
$gridTitle = 'Edycja baneru';
$gridSaveUrl = '/admin/banners/save/';
$gridBackUrl = '/admin/banners/list/';
$gridHidden = [['name' => 'id', 'value' => $this -> banner['id']]];
$gridContent = $out;
$gridPersist = true;
include __DIR__ . '/../components/grid-edit-replacement.php';
?>
<script type="text/javascript">
$(function ()
@@ -182,4 +170,4 @@ echo $grid -> draw();
});
</script>
<script>CKEDITOR.dtd.$removeEmpty['span'] = false;</script>
<script>CKEDITOR.dtd.$removeEmpty['span'] = false;</script>

View File

@@ -0,0 +1,100 @@
<style type="text/css">
.banner-thumb-wrap {
display: inline-block;
}
.banner-thumb-image {
width: 72px;
height: 42px;
object-fit: cover;
border-radius: 4px;
cursor: zoom-in;
}
.banner-thumb-popup {
position: fixed;
top: 0;
left: 0;
width: min(70vw, 760px);
max-height: 80vh;
padding: 6px;
border-radius: 6px;
background: #fff;
box-shadow: 0 14px 30px rgba(0, 0, 0, .35);
z-index: 3000;
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: opacity .1s ease;
}
.banner-thumb-popup.is-visible {
opacity: 1;
visibility: visible;
}
.banner-thumb-popup img {
display: block;
width: 100%;
max-height: calc(80vh - 12px);
object-fit: contain;
border-radius: 4px;
}
</style>
<script type="text/javascript">
(function($) {
if (!$) {
return;
}
$('.banner-thumb-popup').remove();
var $popup = $('<div class="banner-thumb-popup" aria-hidden="true"><img src="" alt=""></div>');
var $popupImage = $popup.find('img');
$('body').append($popup);
function positionPopup(event) {
var offset = 18;
var viewportWidth = $(window).width();
var viewportHeight = $(window).height();
var popupWidth = $popup.outerWidth();
var popupHeight = $popup.outerHeight();
var left = (event.clientX || 0) + offset;
var top = (event.clientY || 0) + offset;
if (left + popupWidth + 12 > viewportWidth) {
left = Math.max(12, (event.clientX || 0) - popupWidth - offset);
}
if (top + popupHeight + 12 > viewportHeight) {
top = Math.max(12, viewportHeight - popupHeight - 12);
}
$popup.css({ left: left + 'px', top: top + 'px' });
}
$(document).off('.bannerThumbPopup');
$(document).on('mouseenter.bannerThumbPopup', '.js-banner-thumb-preview', function(event) {
var src = $(this).data('previewSrc');
if (!src) {
return;
}
$popupImage.attr('src', String(src));
$popup.addClass('is-visible');
positionPopup(event);
});
$(document).on('mousemove.bannerThumbPopup', '.js-banner-thumb-preview', function(event) {
if ($popup.hasClass('is-visible')) {
positionPopup(event);
}
});
$(document).on('mouseleave.bannerThumbPopup', '.js-banner-thumb-preview', function() {
$popup.removeClass('is-visible');
$popupImage.attr('src', '');
});
})(window.jQuery);
</script>

View File

@@ -1,78 +1,5 @@
<?php
global $gdb;
<?= \Shared\Tpl\Tpl::view('components/table-list', ['list' => $this->viewModel]); ?>
$grid = new \grid( 'pp_banners' );
$grid -> gdb_opt = $gdb;
$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Nazwa', 'db' => 'name', 'type' => 'text' ],
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Nazwa',
'db' => 'name',
'php' => 'echo "<a href=\'/admin/banners/banner_edit/id=[id]\'>[name]</a>";',
'sort' => true
],
[
'name' => 'Aktywny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Strona główna',
'db' => 'home_page',
'replace' => [ 'array' => [ 0 => 'nie', 1 => '<span class="text-system">tak</span>' ] ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Slajder',
'db' => 'home_page',
'replace' => [ 'array' => [ 1 => 'nie', 0 => '<span class="text-system">tak</span>' ] ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Data rozpoczęcia',
'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
'td' => [ 'class' => 'g-center' ],
'php' => 'if ( "[date_start]" ) echo date( "Y-m-d", strtotime( "[date_start]" ) ); else echo "-";'
],
[
'name' => 'Data zakończenia',
'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
'td' => [ 'class' => 'g-center' ],
'php' => 'if ( "[date_end]" ) echo date( "Y-m-d", strtotime( "[date_end]" ) ); else echo "-";'
],
[
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/banners/banner_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/banners/banner_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj baner',
'url' => '/admin/banners/banner_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
echo $grid -> draw();
<?php if (!empty($this->viewModel->customScriptView)): ?>
<?= \Shared\Tpl\Tpl::view($this->viewModel->customScriptView, ['list' => $this->viewModel]); ?>
<?php endif; ?>