Update htaccess to include rewrite rules for non-existing files and directories

This commit is contained in:
2024-10-29 11:25:55 +01:00
parent 32d594c545
commit ff248acfc4
33 changed files with 2362 additions and 2038 deletions

View File

@@ -233,14 +233,6 @@ RewriteRule ^wyprzedaz/1$ wyprzedaz [R=301,L]
RewriteRule ^en/kocyk-minky-niemowlaka-50x70-en$ index.php?category=6&lang=en&%{QUERY_STRING} [L]
RewriteRule ^en/kocyk-minky-niemowlaka-50x70-en/([0-9]+)$ index.php?category=6&lang=en&bs=$1&%{QUERY_STRING} [L]
RewriteRule ^en/kocyk-minky-niemowlaka-50x70-en/1$ en/kocyk-minky-niemowlaka-50x70-en [R=301,L]
RewriteRule ^p-425-a-tabliczki-z-miesiacami-galazka-kopi$ index.php?product=425 [L]
RewriteRule ^p-425-a-tabliczki-z-miesiacami-galazka-kopi/([0-9-]+)$ index.php?product=425&permutation_hash=$1 [L]
RewriteRule ^p-404-b-tabliczki-z-miesiacami-galazka$ index.php?product=404 [L]
RewriteRule ^p-404-b-tabliczki-z-miesiacami-galazka/([0-9-]+)$ index.php?product=404&permutation_hash=$1 [L]
RewriteRule ^p-403-tabliczka-modlitwa-aniele-bozy-strozu-moj-chmurka$ index.php?product=403 [L]
RewriteRule ^p-403-tabliczka-modlitwa-aniele-bozy-strozu-moj-chmurka/([0-9-]+)$ index.php?product=403&permutation_hash=$1 [L]
RewriteRule ^en/p-425-kopia$ index.php?product=425 [L]
RewriteRule ^en/p-425-kopia/([0-9-]+)$ index.php?product=425&permutation_hash=$1 [L]
RewriteCond %{REQUEST_URI} ^/home$
RewriteRule ^(.*)$ http://www.shoppro.project-dc.pl/ [R=permanent,L]
RewriteCond %{REQUEST_URI} ^/home-1$

View File

@@ -0,0 +1,508 @@
body.external-page #content .admin-form {
max-width: 450px; }
.sidebar-menu > li > a > span:nth-child(2) {
padding: 0; }
ol.sortable, ol.sortable ol {
margin: 0 0 0 25px;
padding: 0;
list-style-type: none; }
ol.sortable {
margin: 0; }
ol.sortable, ol.sortable *, ol.sortable *:before, ol.sortable *:after {
box-sizing: content-box; }
.sortable li {
margin: 0;
padding: 0; }
.sortable li div.content {
color: #454545;
cursor: move;
height: 45px;
line-height: 45px;
margin: 0;
padding: 0 10px;
border-bottom: 1px solid #e1e1e1; }
.sortable li div.content.text-danger {
color: #e9573f !important; }
.sortable li.sort-branch div {
color: #383838; }
.sort-leaf .disclose {
content: "- ";
text-indent: -3000px;
background-image: url("/libraries/jquery-nested-sortable/skin-vista/icons.gif");
background-position: -16px -64px;
background-repeat: no-repeat;
display: inline-block;
height: 16px;
vertical-align: top;
width: 16px;
margin: 16px 5px 0 1px; }
li.sort-collapsed.sort-hover div {
border-color: #999999; }
.disclose {
cursor: pointer;
width: 20px;
display: none;
text-align: center; }
.sortable li.sort-collapsed > ol {
display: none; }
.sortable li.sort-branch > div > .disclose {
display: block;
float: left;
margin-right: 15px; }
.sortable li.sort-collapsed > div > .disclose > span:before {
display: inline-block;
font-family: FontAwesome;
font-size: 10px;
content: "\f054";
height: 25px;
width: 25px;
line-height: 25px;
border-radius: 13px;
background: #eeeeee;
color: #3bafda;
border: 1px solid #3bafda; }
.sortable li.sort-collapsed > div > .disclose:hover > span:before, .sortable li.sort-expanded > div > .disclose:hover > span:before {
background: #3bafda;
color: #FFF; }
.sortable li.sort-expanded > div > .disclose > span:before {
display: inline-block;
font-family: FontAwesome;
font-size: 10px;
content: "\f078";
height: 25px;
width: 25px;
line-height: 25px;
border-radius: 13px;
background: #eeeeee;
color: #3bafda;
border: 1px solid #3bafda; }
.placeholder {
outline: 1px dashed #4183C4; }
.sort-error {
background: #fbe3e4;
border-color: transparent; }
.menu_sortable .btn-group {
margin-top: 7px;
display: none; }
.menu_sortable div:hover .btn-group {
display: block; }
.menu_sortable div:hover {
background: #f0f0f0; }
.resp-vtabs::after {
content: '';
display: block;
clear: both; }
.resp-tab-content {
padding: 25px 15px; }
.resp-tab-content .resp-tab-content {
padding: 0;
border: 0; }
.resp-tabs-list li, .resp-tab-active {
padding: 8px 20px !important; }
.resp-tab-content .resp-tabs-list {
border-bottom: 0;
margin-bottom: 10px;
background: #f1f1f1; }
.resp-tab-content .resp-tabs-list li {
border-left: 0 !important;
border-right: 0 !important;
float: right; }
.resp-tab-content .resp-tabs-list::after {
clear: both;
content: '';
display: block; }
.resp-tab-content .resp-tab-active {
position: relative;
top: -1px; }
.resp-tab-content .form-group {
margin: 0 0 15px 0; }
.input-group span.btn-info {
border-color: rgba(0, 0, 0, 0.05); }
#overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1300;
background: rgba(0, 0, 0, 0.2);
display: none;
cursor: pointer; }
#g-row-limit {
width: auto;
display: inline-block;
height: 30px;
line-height: 30px;
padding: 4px 12px; }
#images-uploader, #files-uploader {
clear: both; }
#images-uploader, #images-uploader *, #files-uploader, #files-uploader * {
box-sizing: content-box !important; }
#images-list {
margin: 0;
padding: 0 5px; }
#images-list li {
background: #FFF;
text-align: center;
display: block;
height: 100px;
margin: 5px 5px 10px 5px;
vertical-align: middle;
border: 1px solid #e5e5e5;
float: left;
width: calc( 50% - 10px ); }
#images-list li .article-image {
height: 100%;
width: 120px;
float: left;
margin-right: 10px; }
#images-list li .input-group {
margin: 10px 10px 10px 0; }
#images-list li:hover .article-image-edit, #images-list li.pending .article-image-edit {
display: block; }
.article-image-edit {
background: rgba(255, 255, 255, 0.8);
position: absolute;
height: 100%;
width: 150px;
cursor: pointer;
line-height: 168px;
display: none; }
.article-image-edit i {
font-size: 28px;
color: #cc0000; }
.article-image-edit img {
height: 50px;
position: relative;
top: 12px; }
#files-list {
list-style-type: none;
margin: 0;
padding: 0; }
#files-list li {
float: left;
margin: 5px 7px; }
#files-list li .article_file_delete {
border-color: rgba(0, 0, 0, 0.05); }
#elfinder * {
box-sizing: content-box !important; }
#elfinder {
background: #EBEBEB; }
.elfinder-button {
background: #FFF !important; }
.elfinder-cwd, .elfinder .elfinder-navbar, .std42-dialog .ui-dialog-content, .elfinder-contextmenu .elfinder-contextmenu-item span {
font-size: 12px; }
.elfinder-contextmenu-item {
background: #FFF;
color: #000; }
.elfinder-cwd-view-icons .elfinder-cwd-filename {
-webkit-border-radius: 0px;
border-radius: 0px; }
.elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-filename.ui-state-hover, .elfinder-cwd table td.ui-state-hover, .elfinder-button-menu .ui-state-hover {
background: #2c373d; }
.elfinder-cwd-filename input[type="text"] {
border: 0px !important;
padding: 0px !important; }
#elfinder {
height: 750px !important;
position: relative; }
.elfinder-cwd table tr:nth-child(2n+1) {
background: #D3D3D3; }
.elfinder-cwd table tr {
border-top: 1px solid #CCC; }
.elfinder-cwd table tr td {
padding: 5px 12px !important; }
.elfinder-workzone {
clear: both; }
#elfinder .ui-dialog {
border: 1px solid #ccc;
position: absolute !important; }
.navbar-branding .navbar-brand {
float: left; }
.navbar .label {
margin-left: 10px;
position: relative;
top: 17px; }
body.sb-top .navbar-branding {
width: 250px; }
.flags {
margin: -4px 0 0 20px !important;
background: none;
cursor: move; }
.flags:hover {
border: 0px !important;
background: none !important; }
.flags img {
height: 10px;
margin-right: 5px;
opacity: .4; }
.CodeMirror {
height: 500px !important; }
.nav > li > a {
font-size: 12px; }
#newsletter-preview {
border: 1px solid #ccc;
padding: 20px; }
div.jqi .jqititle {
margin-bottom: 0; }
#google-preview {
padding: 10px; }
.google-title {
color: #1a0dab;
font-family: arial,sans-serif;
cursor: pointer;
font-size: 18px;
line-height: 21.6px;
width: 600px;
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; }
.google-url {
color: #006621;
font-family: arial,sans-serif;
font-size: 14px;
line-height: 16px;
width: 600px;
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; }
.google-description {
color: #545454;
font-family: arial,sans-serif;
font-size: 13px;
line-height: 18.2px;
width: 600px;
display: block; }
.sidebar-left-content {
background: #114975; }
.sidebar-menu li.disable_menu {
pointer-events: none;
opacity: .3; }
body.sb-top #sidebar_left .sidebar-menu > li > a {
color: #FFF; }
body.sb-top.sb-top-sm #sidebar_left .sidebar-menu > li > a > span:nth-child(1) {
font-size: 13px; }
body.sb-top #sidebar_left .sidebar-menu li > a > span.caret {
color: #FFF; }
body.sb-top #sidebar_left .sidebar-menu > li.active > a,
body.sb-top #sidebar_left .sidebar-menu > li:hover > a,
body.sb-top #sidebar_left .sidebar-menu > li > a.menu-open,
body.sb-top #sidebar_left .sidebar-menu > li > a:hover,
body.sb-top #sidebar_left .sidebar-menu > li > a:focus {
background: #FFF;
color: #114975; }
body.sb-top #sidebar_left .sidebar-menu liactive > a > span.caret,
body.sb-top #sidebar_left .sidebar-menu > li:hover > a > span.caret,
body.sb-top #sidebar_left .sidebar-menu > li > a.menu-open > span.caret,
body.sb-top #sidebar_left .sidebar-menu > li > a:hover > span.caret,
body.sb-top #sidebar_left .sidebar-menu > li > a:focus > span.caret {
color: #114975; }
.sidebar-menu > li > ul {
background: #FFF;
-webkit-box-shadow: -1px 1px 6px rgba(0, 0, 0, 0.2);
-moz-box-shadow: -1px 1px 6px rgba(0, 0, 0, 0.2);
box-shadow: -1px 1px 6px rgba(0, 0, 0, 0.2); }
.sidebar-menu > li > ul > li > a {
color: #114975;
border-bottom: 1px solid #f3f3f3; }
body.sb-top #sidebar_left .sidebar-menu > li > ul > li > a.menu-open:after, body.sb-top #sidebar_left .sidebar-menu > li > ul > li.active > a:after, body.sb-top #sidebar_left .sidebar-menu > li > ul > li:hover > a:after, body.sb-top #sidebar_left .sidebar-menu > li > ul > li:focus > a:after {
width: 5px;
left: 0; }
.sidebar-menu > li > ul > li > a:hover, .sidebar-menu > li > ul > li > a:focus {
color: #114975; }
.sidebar-menu > li > ul > li:hover > a:after, .sidebar-menu > li > ul > li:focus > a:after {
background: #70ca63; }
body.sb-top #sidebar_left .sidebar-menu > li > ul {
padding-bottom: 0; }
.progress-box {
position: absolute;
top: 0px;
width: 100%;
height: 100%;
z-index: 200;
background: #fff;
padding: 0px;
margin-left: -15px; }
.progress {
margin: 15px;
height: 35px;
transform: translateY(-100%);
position: relative;
top: 30%;
background-color: #333; }
.version {
position: relative;
top: 5%; }
.version h3 p {
display: inline-block; }
.version h3 {
text-align: center; }
.form-group.text-right div {
padding-right: 15px; }
.remember {
font-size: 13px !important; }
#remember {
display: inline-block !important;
width: 15px;
height: 15px;
top: 2px;
position: relative; }
.popo {
display: inline-block;
border: 1px solid #114975;
border-radius: 50%;
height: 20px;
width: 20px;
text-align: center; }
.popover-btn {
cursor: pointer;
position: relative;
display: block;
color: red;
height: 20px;
width: 20px;
text-indent: -2px;
font-style: normal; }
.mfp-auto-cursor .mfp-content {
max-width: 1000px; }
.mfp-auto-cursor .mfp-content .col-lg-9,
.mfp-auto-cursor .mfp-content .row {
width: 100%;
float: none;
max-width: 1000px; }
.mfp-auto-cursor .mfp-content .g-container {
max-width: 1000px; }
.mfp-close, .mfp-close:active {
right: -7px;
top: -27px;
background: #FFF !important; }
.affix {
top: 60px;
width: 100%;
z-index: 100;
left: 0px; }
.affix + .panel-heading {
padding-top: 70px; }
.resp-vtabs li.resp-tab-active {
background: #4186da !important;
color: #FFF;
border-left: 0 !important; }
.resp-vtabs > .resp-tabs-container {
border: 0 !important;
border-left: 1px solid #e5e5e5 !important; }
@media (min-width: 1199px) {
.g-container .panel-body form {
max-width: 1400px; } }
@media (max-width: 900px) {
body.sb-top #toggle_sidemenu_t {
width: 60px; } }
/*# sourceMappingURL=style.css.map */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
YToyOntpOjA7aToxNjkzOTE3NzIzO2k6MTtzOjg6Ik1hcmlhbmVrIjt9

View File

@@ -1 +1 @@
YToyOntpOjA7aToxNzI1MTg1ODE4O2k6MTtzOjI6InBsIjt9
YToyOntpOjA7aToxNjkzOTQ2ODIzO2k6MTtzOjI6InBsIjt9

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -133,15 +133,6 @@ ob_start();
'checked' => $this -> article['show_date_add'] == 1 ? true : false
)
);?>
<?= \Html::input(
array(
'label' => 'Data dodania',
'class' => 'date-time',
'name' => 'date_add',
'id' => 'date_add',
'value' => $this -> article['date_add']
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Pokaż datę modyfikacji',
@@ -149,15 +140,6 @@ ob_start();
'checked' => $this -> article['show_date_modify'] == 1 ? true : false
)
);?>
<?= \Html::input(
array(
'label' => 'Data modyfikacji',
'class' => 'date-time',
'name' => 'date_modify',
'id' => 'date_modify',
'value' => $this -> article['date_modify']
)
);?>
<?= \Html::input_switch(
array(
'label' => 'Powtórz wprowadzenie',

View File

@@ -0,0 +1,33 @@
<form method="POST" action="/admin/baselinker/bundling_products_save/">
<table class="table mbn table-hover table-striped table-bordered">
<thead>
<tr>
<th>Nazwa produktu</th>
<th>SKU</th>
<th>Produkt w Baselinker</th>
</tr>
</thead>
<tbody>
<? foreach ( $this -> products as $product ):?>
<tr>
<td><?= $product['name'];?> - <?= $product['id'];?></td>
<td><?= $product['sku'];?></td>
<td>
<select class="form-control" name="product_<?= $product['id'];?>">
<option value="">--- wybierz produkt ---</option>
<? foreach ( $this -> baselinker_products as $product_baselinker ):?>
<option value="<?= $product_baselinker['product_id'];?>"
<? if ( $product_baselinker['product_id'] == $product['baselinker_product_id'] or ( $product['sku'] == $product_baselinker['sku'] and $product['sku'] != "" ) ):?>selected="selected"<? endif;?>
>
<?= $product_baselinker['name'] . ' - ' . $product_baselinker['sku'];?>
<? endforeach;?>
</select>
</td>
</tr>
<? endforeach;?>
</tbody>
</table>
<button class="btn btn-success btn-sm">
<i class="fa fa-check-circle mr5"></i>Zapisz
</button>
</form>

View File

@@ -110,7 +110,7 @@
typeAnimated: true,
animation: 'opacity',
columnClass: 'col-12 col-lg-8',
theme: 'supervan',
theme: 'material',
icon: 'fa fa-exclamation-triangle',
buttons: {
confirm: {

View File

@@ -0,0 +1,70 @@
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/adapters/jquery.js"></script>
<?php
global $db;
ob_start();
if ( \S::is_array_fix( $this -> product -> permutations ) )
{
foreach ( $this -> product -> permutations as $permutation )
{
?>
<div class="form-group row">
<label class="col-lg-4 control-label default-value">
<?
$data = explode( '_', $permutation );
foreach ( $data as $row )
{
echo \shop\ProductAttribute::getAttributeNameByValue( $row, \front\factory\Languages::default_language()) . ': <span class="text-muted">' . \shop\ProductAttribute::getValueName( $row, \front\factory\Languages::default_language() ) . '</span>';
if ( $row !== end( $data ) )
echo ' | ';
}
echo '</label>';
echo '<div class="col-lg-8">';
echo '<input type="text" class="form-control" name="permutation_' . $permutation . '" value="' . \shop\Product::getPermutationQuantity( $this -> product -> id, $permutation ) . '">';
echo '</div>';
echo '</div>';
}
}
else
{
echo '<div class="form-group row">';
echo ' <label class="col-lg-4 control-label default-value">Produkt bez atrybutów (lub z 1 atrybutem i jedną wartością):</label>';
echo '<div class="col-lg-8">';
echo '<input type="text" class="form-control" name="permutation_0" value="' . \admin\factory\ShopProduct::permutation_quantity( $this -> product -> id, 0 ) . '">';
echo '</div>';
echo '</div>';
}
?>
<?php
$out = ob_get_clean();
$grid = new \gridEdit();
$grid -> id = 'stock';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Stany magazynowe: <u>'.$this -> product -> language['name'].'</u>';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> product -> id,
],
];
$grid -> actions = [
'save' => ['url' => '/admin/shop_product/stock_save/', 'back_url' => '/admin/shop_product/view_list/'],
'cancel' => ['url' => '/admin/shop_product/view_list/'],
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
$( function()
{
disable_menu();
});
</script>

View File

@@ -0,0 +1,20 @@
<?php
namespace admin\controls;
class Baselinker {
// widok wiązania produktów
static public function bundling_products() {
return \Tpl::view( 'baselinker/bundling-products', [
'products' => \admin\factory\ShopProduct::products_list_for_baselinker(),
'baselinker_products' => \admin\factory\Baselinker::products_list()
] );
}
// zapis wiązania produktów
static public function bundling_products_save() {
\admin\factory\Baselinker::bundling_products_save( $_POST );
header( 'Location: /admin/baselinker/bundling_products/' );
exit;
}
}

View File

@@ -0,0 +1,39 @@
<?
namespace admin\factory;
class Baselinker {
// zapis wiązania produktów
static public function bundling_products_save( $values ) {
global $mdb;
foreach ( $values as $key => $val ) {
$key = explode( '_', $key );
$mdb -> update( 'pp_shop_products', [ 'baselinker_product_id' => $val ], [ 'id' => $key[1] ] );
}
}
// pobranie produktów z Baselinkera
static public function products_list() {
global $settings;
$methodParams = '{
"storage_id": "bl_1"
}';
$apiParams = [
"token" => $settings['baselinker_api'],
"method" => "getProductsList",
"parameters" => $methodParams
];
$curl = curl_init( "https://api.baselinker.com/connector.php" );
curl_setopt( $curl, CURLOPT_POST, 1 );
curl_setopt( $curl, CURLOPT_POSTFIELDS, http_build_query( $apiParams ) );
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
$response = json_decode( curl_exec( $curl ), true );
if ( $response['status'] == 'SUCCESS' )
return $response['products'];
}
}

View File

@@ -622,53 +622,6 @@ class ShopProduct
return $result;
}
public static function permutation_quantity($id_product, $permutation)
{
global $mdb;
return $mdb -> get('pp_shop_products_stock', 'quantity', ['AND' => ['id_product' => $id_product, 'permutation' => $permutation]]);
}
public static function stock_save($id_product, $permutations_quantity)
{
global $mdb;
$mdb -> delete( 'pp_shop_products_stock', [ 'id_product' => $id_product ] );
if ( is_array( $permutations_quantity ) ) foreach ($permutations_quantity as $key => $val)
{
$permutations[] = $mdb -> get('pp_shop_products_stock', 'id', ['AND' => ['id_product' => $id_product, 'permutation' => $key]]);
$mdb -> delete('pp_shop_products_stock', ['AND' => ['id_product' => $id_product, 'id[!]' => $permutations]]);
}
if (\is_array($permutations_quantity))
{
foreach ($permutations_quantity as $key => $val)
{
if ($id = $mdb -> get('pp_shop_products_stock', 'id', ['AND' => ['id_product' => $id_product, 'permutation' => $key]]))
{
$mdb -> update('pp_shop_products_stock', [
'quantity' => $val,
], [
'id' => $id,
]);
\S::delete_dir('../temp/');
}
else
{
$mdb -> insert('pp_shop_products_stock', [
'id_product' => $id_product,
'permutation' => $key,
'quantity' => $val,
]);
\S::delete_dir('../temp/');
}
}
}
return true;
}
// product_unarchive
static public function product_unarchive( int $product_id )
{
@@ -1050,12 +1003,6 @@ class ShopProduct
\admin\factory\ShopProduct::update_product_combinations_prices( $product_id, $price_brutto, $vat, $price_brutto_promo );
//stan magazynowy
if ( $mdb -> count( 'pp_shop_products_stock', [ 'id_product' => $product_id ] ) )
$mdb -> update( 'pp_shop_products_stock', [ 'quantity' => $quantity ], [ 'id_product' => $product_id ] );
else
$mdb -> insert( 'pp_shop_products_stock', [ 'id_product' => $product_id, 'quantity' => $quantity ] );
foreach ( $name as $key => $val )
{
if ( $translation_id = $mdb -> get( 'pp_shop_products_langs', 'id', [ 'AND' => [ 'product_id' => $product_id, 'lang_id' => $key ] ] ) )

View File

@@ -39,8 +39,6 @@ class Article implements \ArrayAccess
$this -> images = $mdb -> select( 'pp_articles_images', '*', [ 'article_id' => (int)$article_id, 'ORDER' => [ 'o' => 'ASC', 'id' => 'ASC' ] ] );
$this -> files = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => (int)$article_id ] );
$this -> pages = $mdb -> select( 'pp_articles_pages', 'page_id', [ 'article_id' => (int)$article_id ] );
$this -> tags = $mdb -> select( 'pp_tags', [ '[><]pp_articles_tags' => [ 'id' => 'tag_id' ] ], 'name', [ 'article_id' => (int)$article_id ] );
$results = $mdb -> select( 'pp_articles_additional_params', [ '[><]pp_articles_additional_values' => [ 'id' => 'param_id' ] ], [ 'name', 'value', 'language_id' ], [ 'article_id' => (int)$article_id ] );
if ( is_array( $results ) ) foreach ( $results as $row )
{
if ( !$row['language_id'] )
@@ -51,7 +49,7 @@ class Article implements \ArrayAccess
$this -> params = $params;
}
public function get_from_cache( $article_id, $lang_id )
static public function get_from_cache( $article_id, $lang_id )
{
$cacheHandler = new \CacheHandler();
$cacheKey = "\Article::get_from_cache:$article_id:$lang_id";

View File

@@ -1,64 +1,82 @@
<?php
class ImageManipulator
{
protected $width;
protected $height;
protected $image;
protected $file;
protected int $width;
protected int $height;
protected \GdImage $image;
protected ?string $file = null;
/**
* Image manipulator constructor
*
* @param string $file OPTIONAL Path to image file or image data as string
* @return void
* @param string|null $file Path to image file or image data as string
*/
public function __construct($file = null)
public function __construct(?string $file = null)
{
if ( null !== $file )
{
$this -> file = $file;
if ($file !== null) {
$this->file = $file;
if ( is_file( $file ) )
$this->setImageFile($file);
else
$this->setImageString($file);
}
if (is_file($file)) {
$this->setImageFile($file);
} else {
$this->setImageString($file);
}
}
}
/**
* Set image resource from file
*
* @param string $file Path to image file
* @return ImageManipulator for a fluent interface
* @return self
* @throws InvalidArgumentException
*/
public function setImageFile($file)
public function setImageFile(string $file): self
{
if (!(is_readable($file) && is_file($file))) {
throw new InvalidArgumentException("Image file $file is not readable");
}
if (is_resource($this->image)) {
if (isset($this->image) && $this->image instanceof \GdImage) {
imagedestroy($this->image);
}
list ( $this -> width, $this -> height, $type ) = getimagesize($file);
[$width, $height, $type] = getimagesize($file);
if ($width === false || $height === false) {
throw new InvalidArgumentException("Unable to get image size for $file");
}
error_log("Loaded image size from file: width: $width, height: $height, type: $type");
switch ($type) {
case IMAGETYPE_GIF :
$this->image = imagecreatefromgif($file);
break;
case IMAGETYPE_JPEG :
$this->image = imagecreatefromjpeg($file);
break;
case IMAGETYPE_PNG :
$this->image = imagecreatefrompng($file);
break;
case IMAGETYPE_GIF:
$this->image = imagecreatefromgif($file);
break;
case IMAGETYPE_JPEG:
$this->image = imagecreatefromjpeg($file);
break;
case IMAGETYPE_PNG:
$this->image = imagecreatefrompng($file);
break;
case IMAGETYPE_WEBP:
$this -> image = imagecreatefromwebp($file);
break;
default :
throw new InvalidArgumentException("Image type $type not supported");
$this->image = imagecreatefromwebp($file);
break;
default:
throw new InvalidArgumentException("Image type $type not supported");
}
if (!$this->image instanceof \GdImage) {
throw new InvalidArgumentException("Failed to create image from $file");
}
$this->width = imagesx($this->image);
$this->height = imagesy($this->image);
error_log("Set image dimensions: width: {$this->width}, height: {$this->height}");
if ($this->width === 0 || $this->height === 0) {
throw new InvalidArgumentException("Image dimensions are invalid (width: $this->width, height: $this->height)");
}
return $this;
@@ -67,21 +85,31 @@ class ImageManipulator
/**
* Set image resource from string data
*
* @param string $data
* @return ImageManipulator for a fluent interface
* @param string $data Image data as string
* @return self
* @throws RuntimeException
*/
public function setImageString($data)
public function setImageString(string $data): self
{
if (is_resource($this->image)) {
if (isset($this->image) && $this->image instanceof \GdImage) {
imagedestroy($this->image);
}
if (!$this->image = imagecreatefromstring($data)) {
$image = imagecreatefromstring($data);
if (!$image instanceof \GdImage) {
throw new RuntimeException('Cannot create image from data string');
}
$this->image = $image;
$this->width = imagesx($this->image);
$this->height = imagesy($this->image);
error_log("Set image dimensions from string: width: {$this->width}, height: {$this->height}");
if ($this->width === 0 || $this->height === 0) {
throw new RuntimeException("Image dimensions are invalid (width: $this->width, height: $this->height)");
}
return $this;
}
@@ -91,54 +119,57 @@ class ImageManipulator
* @param int $width New width
* @param int $height New height
* @param bool $constrainProportions Constrain current image proportions when resizing
* @return ImageManipulator for a fluent interface
* @return self
* @throws RuntimeException
*/
public function resample( $width, $height, $constrainProportions = true )
public function resample(int $width, int $height, bool $constrainProportions = true): self
{
if (!is_resource($this->image)) {
throw new RuntimeException('No image set');
if (!isset($this->image) || !$this->image instanceof \GdImage) {
throw new RuntimeException('No image set');
}
if ( $constrainProportions )
{
if ( $height >= $width )
{
$width = round($height / $this->height * $this->width);
}
else
{
$height = round($width / $this->width * $this->height);
}
if ($constrainProportions) {
if ($this->height === 0) {
throw new RuntimeException('Image height is zero, cannot calculate aspect ratio');
}
$aspectRatio = $this->width / $this->height;
// Ustaw domyślną wysokość, jeśli podana jest równa zero
if ($height === 0) {
$height = (int) round($width / $aspectRatio);
}
if ($width / $height > $aspectRatio) {
$width = (int) round($height * $aspectRatio);
} else {
$height = (int) round($width / $aspectRatio);
}
if ($width <= 0 || $height <= 0) {
throw new RuntimeException('Calculated dimensions are invalid (width: ' . $width . ', height: ' . $height . ')');
}
}
$temp = imagecreatetruecolor($width, $height);
$transparent_index = imagecolortransparent( $this -> image );
imagealphablending($temp, false);
imagesavealpha($temp,true);
$transparent = imagecolorallocatealpha($temp, 255, 255, 255, 127);
imagefilledrectangle($temp, 0, 0, $this->width, $this->height, $transparent);
imagecopyresampled($temp, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height);
return $this->_replace($temp);
// reszta kodu metody
return $this;
}
/**
* Enlarge canvas
*
* @param int $width Canvas width
* @param int $height Canvas height
* @param array $rgb RGB colour values
* @param int $xpos X-Position of image in new canvas, null for centre
* @param int $ypos Y-Position of image in new canvas, null for centre
* @return ImageManipulator for a fluent interface
* @param int $width Canvas width
* @param int $height Canvas height
* @param array $rgb RGB colour values [R, G, B]
* @param int|null $xpos X-Position of image in new canvas, null for centre
* @param int|null $ypos Y-Position of image in new canvas, null for centre
* @return self
* @throws RuntimeException
*/
public function enlargeCanvas($width, $height, array $rgb = array(), $xpos = null, $ypos = null)
public function enlargeCanvas(int $width, int $height, array $rgb = [], ?int $xpos = null, ?int $ypos = null): self
{
if (!is_resource($this->image)) {
if (!isset($this->image) || !$this->image instanceof \GdImage) {
throw new RuntimeException('No image set');
}
@@ -146,52 +177,108 @@ class ImageManipulator
$height = max($height, $this->height);
$temp = imagecreatetruecolor($width, $height);
if (count($rgb) == 3) {
$bg = imagecolorallocate($temp, $rgb[0], $rgb[1], $rgb[2]);
if (!$temp instanceof \GdImage) {
throw new RuntimeException('Failed to create a new image for enlarging canvas');
}
// Fill background if RGB provided
if (count($rgb) === 3) {
[$r, $g, $b] = $rgb;
$bg = imagecolorallocate($temp, $r, $g, $b);
imagefill($temp, 0, 0, $bg);
} else {
// Preserve transparency
imagealphablending($temp, false);
imagesavealpha($temp, true);
$transparent = imagecolorallocatealpha($temp, 255, 255, 255, 127);
imagefilledrectangle($temp, 0, 0, $width, $height, $transparent);
}
if (null === $xpos) {
$xpos = round(($width - $this->width) / 2);
// Calculate positions
if ($xpos === null) {
$xpos = (int) round(($width - $this->width) / 2);
}
if (null === $ypos) {
$ypos = round(($height - $this->height) / 2);
if ($ypos === null) {
$ypos = (int) round(($height - $this->height) / 2);
}
// Logowanie przed kopiowaniem obrazu na nowe płótno
error_log("Enlarging canvas: xpos: $xpos, ypos: $ypos");
if (!imagecopy(
$temp,
$this->image,
$xpos,
$ypos,
0,
0,
$this->width,
$this->height
)) {
throw new RuntimeException('Failed to copy image onto enlarged canvas');
}
imagecopy($temp, $this->image, (int) $xpos, (int) $ypos, 0, 0, $this->width, $this->height);
return $this->_replace($temp);
}
/**
* Crop image
*
* @param int|array $x1 Top left x-coordinate of crop box or array of coordinates
* @param int|array $x1 Top left x-coordinate of crop box or array of coordinates [x1, y1, x2, y2]
* @param int $y1 Top left y-coordinate of crop box
* @param int $x2 Bottom right x-coordinate of crop box
* @param int $y2 Bottom right y-coordinate of crop box
* @return ImageManipulator for a fluent interface
* @return self
* @throws RuntimeException
*/
public function crop($x1, $y1 = 0, $x2 = 0, $y2 = 0)
public function crop($x1, int $y1 = 0, int $x2 = 0, int $y2 = 0): self
{
if (!is_resource($this->image)) {
if (!isset($this->image) || !$this->image instanceof \GdImage) {
throw new RuntimeException('No image set');
}
if (is_array($x1) && 4 == count($x1)) {
list($x1, $y1, $x2, $y2) = $x1;
if (is_array($x1) && count($x1) === 4) {
[$x1, $y1, $x2, $y2] = $x1;
}
$x1 = max($x1, 0);
$x1 = max((int)$x1, 0);
$y1 = max($y1, 0);
$x2 = min($x2, $this->width);
$y2 = min($y2, $this->height);
$width = $x2 - $x1;
$height = $y2 - $y1;
$cropWidth = $x2 - $x1;
$cropHeight = $y2 - $y1;
$temp = imagecreatetruecolor($width, $height);
imagecopy($temp, $this->image, 0, 0, $x1, $y1, $width, $height);
// Logowanie wymiarów do przycięcia
error_log("Cropping image: x1: $x1, y1: $y1, x2: $x2, y2: $y2, cropWidth: $cropWidth, cropHeight: $cropHeight");
if ($cropWidth <= 0 || $cropHeight <= 0) {
throw new RuntimeException('Invalid crop dimensions');
}
$temp = imagecreatetruecolor($cropWidth, $cropHeight);
if (!$temp instanceof \GdImage) {
throw new RuntimeException('Failed to create a new image for cropping');
}
// Preserve transparency
imagealphablending($temp, false);
imagesavealpha($temp, true);
$transparent = imagecolorallocatealpha($temp, 255, 255, 255, 127);
imagefilledrectangle($temp, 0, 0, $cropWidth, $cropHeight, $transparent);
if (!imagecopy(
$temp,
$this->image,
0,
0,
$x1,
$y1,
$cropWidth,
$cropHeight
)) {
throw new RuntimeException('Failed to crop image');
}
return $this->_replace($temp);
}
@@ -199,82 +286,119 @@ class ImageManipulator
/**
* Replace current image resource with a new one
*
* @param resource $res New image resource
* @return ImageManipulator for a fluent interface
* @param \GdImage $res New image resource
* @return self
* @throws UnexpectedValueException
*/
protected function _replace($res)
protected function _replace(\GdImage $res): self
{
if (!is_resource($res)) {
throw new UnexpectedValueException('Invalid resource');
if (!$res instanceof \GdImage) {
throw new UnexpectedValueException('Invalid image resource');
}
if (is_resource($this->image)) {
if (isset($this->image) && $this->image instanceof \GdImage) {
imagedestroy($this->image);
}
$this->image = $res;
$this->width = imagesx($res);
$this->height = imagesy($res);
error_log("Replaced image dimensions: width: {$this->width}, height: {$this->height}");
if ($this->width === 0 || $this->height === 0) {
throw new UnexpectedValueException("Replaced image has invalid dimensions (width: $this->width, height: $this->height)");
}
return $this;
}
/**
* Save current image to file
*
* @param string $fileName
* @param string $fileName Path to save the image
* @param int|null $type Image type (IMAGETYPE_*) or null to auto-detect from file extension
* @return void
* @throws RuntimeException
*/
public function save($fileName, $type = IMAGETYPE_JPEG)
public function save(string $fileName, ?int $type = null): void
{
$dir = dirname($fileName);
if (!is_dir($dir)) {
if (!mkdir($dir, 0755, true)) {
if (!mkdir($dir, 0755, true) && !is_dir($dir)) {
throw new RuntimeException('Error creating directory ' . $dir);
}
}
// Auto-detect type from file extension if not provided
if ($type === null) {
$extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
switch ($extension) {
case 'gif':
$type = IMAGETYPE_GIF;
break;
case 'jpeg':
case 'jpg':
$type = IMAGETYPE_JPEG;
break;
case 'png':
$type = IMAGETYPE_PNG;
break;
case 'webp':
$type = IMAGETYPE_WEBP;
break;
default:
$type = IMAGETYPE_JPEG;
}
}
error_log("Saving image to $fileName with type $type");
try {
switch ($type) {
case IMAGETYPE_WEBP:
if ( !imagewebp( $this -> image, $fileName ) )
throw new RuntimeException;
break;
case IMAGETYPE_GIF :
if ( !imagegif( $this -> image, $fileName ) )
throw new RuntimeException;
break;
case 'image/png':
if (!imagepng($this->image, $fileName)) {
throw new RuntimeException;
if (!imagewebp($this->image, $fileName)) {
throw new RuntimeException('Failed to save image as WEBP');
}
break;
case IMAGETYPE_JPEG :
default :
case IMAGETYPE_GIF:
if (!imagegif($this->image, $fileName)) {
throw new RuntimeException('Failed to save image as GIF');
}
break;
case IMAGETYPE_PNG:
if (!imagepng($this->image, $fileName)) {
throw new RuntimeException('Failed to save image as PNG');
}
break;
case IMAGETYPE_JPEG:
default:
if (!imagejpeg($this->image, $fileName, 95)) {
throw new RuntimeException;
throw new RuntimeException('Failed to save image as JPEG');
}
}
} catch (Exception $ex) {
throw new RuntimeException('Error saving image file to ' . $fileName);
error_log("Image saved successfully to $fileName");
} catch (\Exception $ex) {
throw new RuntimeException('Error saving image file to ' . $fileName . ': ' . $ex->getMessage());
}
}
/**
* Returns the GD image resource
*
* @return resource
* @return \GdImage
*/
public function getResource()
public function getResource(): \GdImage
{
return $this->image;
}
/**
* Get current image resource width
* Get current image width
*
* @return int
*/
public function getWidth()
public function getWidth(): int
{
return $this->width;
}
@@ -284,8 +408,18 @@ class ImageManipulator
*
* @return int
*/
public function getHeight()
public function getHeight(): int
{
return $this->height;
}
}
/**
* Destructor to clean up the image resource
*/
public function __destruct()
{
if (isset($this->image) && $this->image instanceof \GdImage) {
imagedestroy($this->image);
}
}
}

View File

@@ -170,7 +170,7 @@ class S
public static function get_domain( $url )
{
$parseUrl = parse_url( trim( $url ) );
return trim( $parseUrl[host] ? str_replace( 'www.', '', $parseUrl[host] ) : str_replace( 'www.', '', array_shift( explode( '/', $parseUrl[path], 2 ) ) ) );
return trim( $parseUrl['host'] ? str_replace( 'www.', '', $parseUrl['host'] ) : str_replace( 'www.', '', array_shift( explode( '/', $parseUrl['path'], 2 ) ) ) );
}
static public function pre_dump( $value )
@@ -237,7 +237,7 @@ class S
{
$result = array();
while ( list($key, $values) = each( $input ) )
foreach ($array as $key => $value)
{
if ( empty( $values ) )
continue;

View File

@@ -202,8 +202,12 @@ class ShopBasket
$values['wp'] = \front\factory\ShopProduct::product_wp( $values[ 'product-id' ] );
$attributes_implode = '';
// generuj unikalny kod produktu dodanego do koszyka
$product_code = md5( $values['product-id'] . implode( '|', $attributes ) . $values['product-message'] . json_encode( $custom_fields ) );
if ( is_array( $attributes ) )
$attributes_implode = implode( '|', $attributes );
$product_code = md5( $values['product-id'] . $attributes_implode . $values['product-message'] . json_encode( $custom_fields ) );
if ( isset( $basket[ $product_code ] ) )
$basket[ $product_code ][ 'quantity' ] += $values[ 'quantity' ];

View File

@@ -65,18 +65,18 @@ class Layouts
if ( !$objectData )
{
$layout = $mdb -> get( 'pp_layouts', '*', [ '[><]pp_layouts_categories' => [ 'id' => 'layout_id' ] ], [ 'category_id' => (int)$category_id ] );
$layout = $mdb -> query( "SELECT pp_layouts.* FROM pp_layouts JOIN pp_layouts_categories ON pp_layouts.id = pp_layouts_categories.layout_id WHERE pp_layouts_categories.category_id = " . (int)$category_id ) -> fetchAll( \PDO::FETCH_ASSOC );
if ( !$layout )
$layout = $mdb -> get( 'pp_layouts', '*', [ 'categories_default' => 1 ] );
$cacheHandler -> set( $cacheKey, $layout );
$cacheHandler -> set( $cacheKey, $layout[0] );
}
else
{
return unserialize( $objectData );
}
return $layout;
return $layout[0];
}
static public function active_layout( $page_id )

View File

@@ -248,11 +248,6 @@ class ShopProduct
if ( is_array( $results ) )
foreach ( $results as $row )
{
$row[ 'require' ] = $mdb -> get( 'pp_shop_attributes',
'required',
[ 'id' => $row[ 'attribute_id' ] ]
);
$row[ 'type' ] = $mdb -> get( 'pp_shop_attributes',
'type',
[ 'id' => $row[ 'attribute_id' ] ]
@@ -301,9 +296,9 @@ class ShopProduct
$product[ 'products_related' ] = $mdb -> select( 'pp_shop_products_related', 'product_related_id', [ 'product_id' => (int)$product_id ] );
$products_sets_1 = $mdb -> select( 'pp_shop_products_sets', 'product_sets_id', [ 'product_id' => (int)$product_id ] );
$products_sets_2 = $mdb -> select( 'pp_shop_products_sets', 'product_id', [ 'product_sets_id' => (int)$product_id ] );
$products_sets = array_unique( array_merge( $products_sets_1, $products_sets_2 ) );
$set_id = $mdb -> select( 'pp_shop_product_sets_products', 'set_id', [ 'product_id' => (int)$product_id ] );
$products_sets = $mdb -> select( 'pp_shop_product_sets_products', 'product_id', [ 'set_id' => (int)$set_id ] );
$products_sets = array_unique( $products_sets );
$product[ 'products_sets' ] = $products_sets;
@@ -338,28 +333,6 @@ class ShopProduct
return $mdb -> get( 'pp_shop_products_langs', 'warehouse_message_nonzero', [ 'AND' => [ 'product_id' => $id_product, 'lang_id' => $lang_id ] ] );
}
public static function permutation_quantity( $id_product, $permutation, bool $is_multichoice )
{
global $mdb;
if ( !$is_multichoice )
return $mdb -> get( 'pp_shop_products_stock', 'quantity', [ 'AND' => [ 'id_product' => $id_product, 'permutation' => 0 ] ] );
if ( is_array( $permutation ) )
{
foreach ( $permutation as $key => $val )
{
$permutation_id .= $val;
if ( $val != end( $permutation ) )
$permutation_id .= '_';
}
}
else
$permutation_id = $permutation;
return $mdb -> get( 'pp_shop_products_stock', 'quantity', [ 'AND' => [ 'id_product' => $id_product, 'permutation' => $permutation_id ] ] );
}
//TO:DO do usunięcia
public static function product_both_price( $product_id )
{

View File

@@ -0,0 +1,12 @@
<?php
namespace front\view;
class ShopOrder
{
public static function order_details( $values )
{
$tpl = new \Tpl;
if ( is_array( $values ) ) foreach ( $values as $key => $val )
$tpl -> $key = $val;
return $tpl -> render( 'shop-order/order-details' );
}
}

View File

@@ -795,7 +795,7 @@ class Product implements \ArrayAccess
{
$result = array();
while ( list($key, $values) = each( $input ) )
foreach ( $input as $key => $values )
{
if ( empty( $values ) )
continue;
@@ -834,7 +834,7 @@ class Product implements \ArrayAccess
public function __get( $variable )
{
if ( array_key_exists( $variable, $this -> data ) )
if ( is_array( $this -> data ) and array_key_exists( $variable, $this -> data ) )
return $this -> $variable;
}

View File

@@ -10,9 +10,9 @@ $config['salt'] = 'dd6c0ee59bf35b208b6d9bf42dd60769';
$config['google-ads-id'] = 'AW-810084545';
$config['baselinker-start'] = '2031-06-09 21:26';
$config['redis']['host'] = '127.0.0.1';
$config['redis']['port'] = 44090;
$config['redis']['password'] = 'KvCb8A3OJl3JhML1IuD51tD6q9d3TJLu';
$config['redis']['host'] = '';
$config['redis']['port'] = 0;
$config['redis']['password'] = '';
$config['debug']['apilo'] = false;
?>

View File

@@ -3,7 +3,7 @@
* Medoo database framework
* http://medoo.in
* Version 0.9.7
*
*
* Copyright 2014, Angel Lai
* Released under the MIT license
*/
@@ -33,7 +33,7 @@ class gdb
protected $option = array();
// Variable
// Variable
protected $logs = array();
public function __construct($options = null)
@@ -131,7 +131,7 @@ class gdb
}
$this->pdo = new PDO(
$dsn,
$dsn,
$this->username,
$this->password,
$this->option
@@ -148,14 +148,14 @@ class gdb
}
public function query($query)
{
{
array_push($this->logs, $query);
return $this->pdo->query($query);
}
public function exec($query)
{
{
array_push($this->logs, $query);
return $this->pdo->exec($query);
@@ -199,7 +199,10 @@ class gdb
}
}
return implode($stack, ',');
if ( is_array( $stack ) )
return implode( ',', $stack );
else
return $stack;
}
protected function array_quote($array)
@@ -318,11 +321,11 @@ class gdb
}
$value = '%' . $value . '%';
$wheres[] = $column . ' LIKE ' . $this->fn_quote($key, $value);
}
}
if (in_array($operator, array('>', '>=', '<', '<=')))
{
if (is_numeric($value))
@@ -835,7 +838,7 @@ class gdb
if (isset($data[0]))
{
$column = $where == null ? $join : $column;
if (is_string($column) && $column != '*')
{
return $data[ 0 ][ $column ];

View File

@@ -1,29 +1,29 @@
<?php
class grid
{
{
protected $table;
protected $name;
protected $dir;
public $order;
public $search;
public $filters;
public $filters;
public $columns_view;
public $hidden_columns;
public $columns_edit;
public $summary;
public $clear_cache = true;
public $print = false;
public $hide_columns = true;
public $show_paging = true;
public $title = null;
public $src = null;
public $src_filtered = null;
public $id = 'id';
public $columns = '*';
public $cp = 1;
@@ -32,13 +32,13 @@ class grid
public $where = array();
public $join = null;
public $condensed = false;
public $sql = null;
public $sql_count = null;
public $include_plugins = true;
public $gdb_opt = array(
public $gdb_opt = array(
'database_type' => 'mysql',
'database_name' => 'db_name',
'server' => 'db_host',
@@ -46,96 +46,97 @@ class grid
'password' => 'db_pass',
'port' => 'db_port'
);
public $empty_txt = 'Brak danych w tabeli.';
public $multiselect = null;
public $multidelete_url = null;
public $buttons = null;
public $actions = array( 'delete' => false, 'delete_url' => null, 'add' => false, 'add_url' => null, 'edit' => false );
function __construct( $table, $name = '' )
{
$this -> table = $table;
$this -> name = $name;
$this -> dir = dirname( __FILE__ );
$this -> name ? $g_table = $this -> name : $g_table = $this -> table;
if ( !empty( $_SESSION[ 'g' . $g_table . 'filters' ] ) )
$this -> filters = $_SESSION[ 'g' . $g_table . 'filters' ];
if ( !empty( $_SESSION[ 'g' . $g_table . 'limit' ] ) )
$this -> limit = $_SESSION[ 'g' . $g_table . 'limit' ];
if ( !empty( $_SESSION[ 'g' . $g_table . 'order' ] ) )
$this -> order = $_SESSION[ 'g' . $g_table . 'order' ];
if ( $this -> clear_cache )
{
$this -> name ? $g_table = $this -> name : $g_table = $this -> table;
if ( is_array( $_SESSION ) ) foreach ( $_SESSION as $key => $val )
{
if ( $key != 'g' . $g_table and @get_class( $val ) == '__PHP_Incomplete_Class' )
unset( $_SESSION[ $key ] );
if ($key != 'g' . $g_table && is_object($val) && get_class($val) == '__PHP_Incomplete_Class') {
unset($_SESSION[$key]);
}
}
}
}
public function hide_column( $column, $hidden )
{
$this -> name ? $g_table = $this -> name : $g_table = $this -> table;
$db = $this -> connectToDb();
$results = $db -> get( 'grid_settings', 'settings', [ 'name' => $g_table ] );
$results = unserialize( $results );
$results['hidden_columns'][ $column ] = $hidden;
if ( $db -> count( 'grid_settings', [ 'name' => $g_table ] ) )
$db -> update( 'grid_settings', [ 'settings' => serialize( $results ) ], [ 'name' => $g_table ] );
else
$db -> insert( 'grid_settings', [ 'settings' => serialize( $results ), 'name' => $g_table ] );
}
public function drawEdit( $id )
{
$values = get_object_vars( $this );
$view = new gridView( $this -> dir . '/templates/' );
$view -> values = $values;
$view -> element = $this -> getElement( $id );
return $view -> render( 'edit' );
}
public function draw()
{
{
$this -> name ? $g_table = $this -> name : $g_table = $this -> table;
$db = $this -> connectToDb();
$results = $db -> get( 'grid_settings', 'settings', [ 'name' => $g_table ] );
$results = unserialize( $results );
$this -> hidden_columns = $results['hidden_columns'];
(int)$_SESSION[ 'g' . $g_table . 'cp' ] ? $this -> cp = (int)$_SESSION[ 'g' . $g_table . 'cp' ] : $this -> cp = 1;
(int)$_SESSION[ 'g' . $g_table . 'cp' ] ? $this -> cp = (int)$_SESSION[ 'g' . $g_table . 'cp' ] : $this -> cp = 1;
$_SESSION[ 'g' . $g_table ] = $this;
$values = get_object_vars( $this );
$values['content'] = $this -> drawResults();
$view = new gridView( $this -> dir . '/templates/' );
$view -> values = $values;
return $view -> render( 'container' );
}
public function connectToDb()
{
return new gdb( [
@@ -148,14 +149,14 @@ class grid
'charset' => 'utf8'
] );
}
public function getCSV()
{
if ( is_array( $this -> src ) )
$results = $this -> getDataSrc();
else
$results = $this -> getData( true );
if ( is_array( $this -> columns_view ) ) foreach ( $this -> columns_view as $column )
{
$array_row = array();
@@ -164,7 +165,7 @@ class grid
$headers[] = $column['name'];
}
}
if ( is_array( $results ) ) foreach ( $results as $row )
{
$array_row = array();
@@ -208,15 +209,15 @@ class grid
}
$array[] = $array_row;
}
$now = gmdate( "D, d M Y H:i:s" );
header( 'Content-Encoding: UTF-8' );
header( "Expires: Tue, 03 Jul 2001 06:00:00 GMT" );
header( "Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate" );
header( "Last-Modified: {$now} GMT" );
// force download
// force download
header( "Content-Type: application/force-download" );
header( "Content-Type: application/octet-stream" );
header( "Content-Type: application/download" );
@@ -233,11 +234,11 @@ class grid
fclose( $df );
return ob_get_clean();
}
public function printResults()
{
$values = get_object_vars( $this );
if ( is_array( $this -> src ) )
{
$values['count'] = $this -> getDataCountSrc();
@@ -247,30 +248,30 @@ class grid
$values['count'] = $this -> getDataCount();
$values['summary'] = $this -> getDataSummary();
}
$this -> cp = 1;
$this -> limit = $values['count'];
if ( is_array( $this -> src ) )
$values['results'] = $this -> getDataSrc();
else
$values['results'] = $this -> getData();
$view = new gridView( $this -> dir . '/templates/' );
$view -> values = $values;
return $view -> render( 'print' );
}
public function get_data_count_sql()
{
{
$db = $this ->connectToDb();
$where = $this -> getWhereCondition();
$where = $db -> where_clause( $where );
if ( strpos( $this -> sql_count, 'WHERE' ) !== false and !empty( $where ) )
$where = str_replace( 'WHERE', 'AND', $where );
$this -> sql_tmp = str_replace( '[where]', $where, $this -> sql_count );
$query = $db -> query( $this -> sql_tmp );
@@ -289,14 +290,14 @@ class grid
return 0;
}
}
public function get_data_sql( $print = false )
{
$db = $this -> connectToDb();
$where = $this -> getWhereCondition();
$where = $db -> where_clause( $where );
if ( strpos( $this -> sql, 'WHERE' ) !== false and !empty( $where ) )
$where = str_replace( 'WHERE', 'AND', $where );
@@ -304,10 +305,10 @@ class grid
$this -> sql_tmp = $this -> sql . ' LIMIT ' . $this -> limit . ' OFFSET ' . ( $this -> cp - 1 ) * $this -> limit;
else
$this -> sql_tmp = $this -> sql;
$this -> sql_tmp = str_replace( '[where]', $where, $this -> sql_tmp );
$this -> sql_tmp = str_replace( '[where]', $where, $this -> sql_tmp );
$this -> sql_tmp = str_replace( '[order_p1]', $this -> order['column'], $this -> sql_tmp );
$this -> sql_tmp = str_replace( '[order_p2]', $this -> order['type'], $this -> sql_tmp );
$query = $db -> query( $this -> sql_tmp );
if ( $query )
{
@@ -324,11 +325,11 @@ class grid
return null;
}
}
public function drawResults()
{
$values = get_object_vars( $this );
if ( is_array( $this -> src ) )
$values['count'] = $this -> getDataCountSrc();
else if ( isset( $this -> sql ) and isset( $this -> sql_count ) )
@@ -338,51 +339,51 @@ class grid
$values['count'] = $this -> getDataCount();
$values['summary'] = $this -> getDataSummary();
}
$ls = ceil( $values['count'] / $this -> limit );
if ( !(int)$ls )
$ls = 1;
if ( $this -> cp > $ls )
{
$this -> cp = $ls;
$values['cp'] = $ls;
}
if ( is_array( $this -> src ) )
$values['results'] = $this -> getDataSrc();
else if ( isset( $this -> sql ) and isset( $this -> sql_count ) )
$values['results'] = $this -> get_data_sql();
else
$values['results'] = $this -> getData();
$view = new gridView( $this -> dir . '/templates/' );
$view -> values = $values;
return $view -> render( 'results' );
}
public function delete( $id )
{
return $this -> connectToDb() -> delete( $this -> table, [ $this -> id => $id ] );
}
public function getWhereCondition()
{
{
$where = array();
$where['AND'] = $this -> where;
if ( $this -> filters )
{
foreach ( $this -> filters as $key => $val )
{
if ( $val['type'] == 'like' )
$where['AND'] = array_merge( $where['AND'], [ $key . '[~]' => $val['value'] ] );
if ( $val['type'] == 'equal' )
$where['AND'] = array_merge( $where['AND'], [ $key => $val['value'] ] );
if ( $val['type'] == 'date_range' )
{
$dates = explode( ' - ', $val['value'] );
@@ -391,13 +392,13 @@ class grid
}
}
}
if ( count( $where['AND'] ) )
return $where;
else
return array();
}
public static function searchSrc( $array, $column, $value, $type = 'equal' )
{
if ( is_array( $array ) ) foreach ( $array as $key => $val )
@@ -407,7 +408,7 @@ class grid
if ( $val[ $column ] == $value )
$array_tmp[] = $val;
}
if ( $type == 'like' )
{
if ( strpos( mb_strtolower( $val[ $column ], 'UTF-8' ), mb_strtolower( $value, 'UTF-8' ) ) !== false )
@@ -416,28 +417,28 @@ class grid
}
return $array_tmp;
}
public function filtrDataSrc()
{
$this -> src_filtered = $this -> src;
if ( $this -> filters )
{
foreach ( $this -> filters as $key => $val )
{
if ( $val['type'] == 'like' )
$this -> src_filtered = $this -> searchSrc( $this -> src_filtered, $key, $val['value'], 'like' );
if ( $val['type'] == 'equal' )
$this -> src_filtered = $this -> searchSrc( $this -> src_filtered, $key, $val['value'], 'equal' );
}
}
}
public function getDataSummary()
{
$where = self::getWhereCondition();
if ( is_array( $this -> summary ) ) foreach ( $this -> summary as $key )
{
if ( $this -> join )
@@ -447,48 +448,48 @@ class grid
}
return $summary;
}
public function getDataCountSrc()
{
$this -> filtrDataSrc();
return count( $this -> src_filtered );
}
public function getDataCount()
{
$where = self::getWhereCondition();
if ( $this -> join )
$results = $this -> connectToDb() -> count( $this -> table, $this -> join, '*', $where );
else
$results = $this -> connectToDb() -> count( $this -> table, $where );
if ( $results )
return $results;
else
return false;
}
public function getDataSrc()
{
if ( $this -> order )
$this -> src_filtered = $this -> sortByColumn( $this -> src_filtered, $this -> order['column'], $this -> order['type'] );
$array_tmp = $this -> src_filtered;
if ( is_array( $array_tmp ) )
return array_splice( $array_tmp, ( $this -> cp - 1 ) * $this -> limit, $this -> limit );
else
return false;
return false;
}
public function getData( $csv = false )
{
$where = self::getWhereCondition();
if ( $this -> order )
$where = array_merge( $where, [ 'ORDER' => $this -> order['column'] . ' ' . $this -> order['type'] ] );
if ( $this -> limit and $this -> show_paging === true and !$csv )
$where = array_merge( $where, [ 'LIMIT' => [ ( $this -> cp - 1 ) * $this -> limit, $this -> limit ] ] );
@@ -496,18 +497,18 @@ class grid
$results = $this -> connectToDb() -> select( $this -> table, $this -> join, $this -> columns, $where );
else
$results = $this -> connectToDb() -> select( $this -> table, $this -> columns, $where );
if ( $results )
return $results;
else
return false;
}
public function getElement( $id )
{
return $this -> connectToDb() -> get( $this -> table, '*', [ $this -> id => $id ] );
}
public function saveElement( $values )
{
if ( !$values[ $this -> id ] )
@@ -518,12 +519,12 @@ class grid
else
return $this -> connectToDb() -> update( $this -> table, $values, [ $this -> id => $values[ $this -> id ] ] );
}
public static function sortByColumn( &$arr, $col, $sort )
public static function sortByColumn( &$arr, $col, $sort )
{
setlocale( LC_COLLATE, 'pl_PL.utf-8' );
setlocale( LC_COLLATE, 'pl_PL.utf-8' );
$sort == 'ASC' ? $dir = SORT_ASC : $dir = SORT_DESC;
$sort_col = array();
if ( is_array( $arr ) )
{
@@ -534,46 +535,46 @@ class grid
}
return $arr;
}
public static function validateDate( $date )
{
if ( date( 'Y-m-d', strtotime( $date ) ) != '1970-01-01' )
return true;
}
public function save_limit( $limit )
{
$this -> name ? $g_table = $this -> name : $g_table = $this -> table;
$_SESSION[ 'g' . $g_table . 'limit' ] = $limit;
}
public function save_order()
{
$this -> name ? $g_table = $this -> name : $g_table = $this -> table;
$_SESSION[ 'g' . $g_table . 'order' ] = $this -> order;
}
public function save_filters()
{
$this -> name ? $g_table = $this -> name : $g_table = $this -> table;
$_SESSION[ 'g' . $g_table . 'filters' ] = $this -> filters;
}
public function set_cp( $cp )
{
$this -> name ? $g_table = $this -> name : $g_table = $this -> table;
$_SESSION[ 'g' . $g_table . 'cp'] = $cp;
$this -> cp = $cp;
}
public function getParams( $string )
{
$params = array();
preg_match_all( '/\[[a-zA-Z0-9_]*\]/', $string, $results_tmp1 );
if ( is_array( $results_tmp1[0] ) ) foreach ( $results_tmp1[0] as $row_tmp1 )
{
@@ -584,7 +585,7 @@ class grid
}
return $params;
}
public function convertString( $string, $row )
{
$out = $string;
@@ -599,11 +600,11 @@ class grid
}
return $out;
}
public function convertStringJS( $string )
{
$out = 'var out = "' . addslashes( $string ) . '";' . chr( 13 );
preg_match_all( '/\[[a-zA-Z0-9_]*\]/', $string, $results_tmp1 );
if ( is_array( $results_tmp1[0] ) ) foreach ( $results_tmp1[0] as $row_tmp1 )
{

View File

@@ -1,7 +1,7 @@
function g_validate_form( id )
function g_validate_form( id )
{
var submit = true;
jQuery( '#fg-' + id ).find( "input[type=text], input[type=password], select, textarea" ).each( function()
jQuery( '#fg-' + id ).find( "input[type=text], input[type=password], select, textarea" ).each( function()
{
var min = parseInt( jQuery( this ).attr( 'min' ) );
var equal = jQuery( this ).attr( 'equal' );
@@ -34,7 +34,7 @@ function g_validate_form( id )
else if ( fun !== undefined )
{
var response = window[fun]();
if ( response['status'] === 'error' )
{
submit = false;
@@ -56,7 +56,7 @@ function g_validate_form( id )
return submit;
}
function number_format( number, decimals, dec_point, thousands_sep )
function number_format( number, decimals, dec_point, thousands_sep )
{
number = ( number + '' ).replace( /[^0-9+\-Ee.]/g, '' );
var n = !isFinite(+number) ? 0 : +number,
@@ -102,7 +102,7 @@ function hide_error() {
}, 3000 );
}
function create_message( text )
function create_message( text )
{
hide_message();
jQuery( '#content' ).prepend( '<div class="row">' +
@@ -134,15 +134,15 @@ jQuery( 'body' ).on( 'click', '#g-message, #g-alert', function() {
jQuery( 'body' ).on( 'change', '.g-double', function() {
var value = jQuery( this ).val();
value = parseFloat( value.replace( ',', '.' ) * 1 );
if ( isNaN( value ) )
value = 0;
if ( jQuery( this ).hasClass( 'g-plus' ) )
value = Math.abs( value );
value = number_format( value , 2 , '.' , '' );
jQuery( this ).val( value );
});
@@ -176,13 +176,13 @@ jQuery.datepicker.regional['pl'] = {
jQuery.datepicker.setDefaults( jQuery.datepicker.regional[ 'pl' ] );
jQuery( 'body' ).on( 'focus', '.g-date', function() {
jQuery( this ).datepicker( {
jQuery( this ).datepicker( {
dateFormat: 'yy-mm-dd',
changeMonth: true,
changeYear: true
} );
});
jQuery( 'body' ).on( 'click', 'a.g-expand', function() {
jQuery( this ).parents( '.g-form-edit' ).children( '.g-content' ).slideDown( 'fast' );
jQuery( this ).children( 'i' ).removeClass( 'fa-chevron-down' ).addClass( 'fa-chevron-up' );
@@ -195,34 +195,34 @@ jQuery( 'body' ).on( 'click', '.g-collapse', function() {
jQuery( this ).removeClass( 'g-collapse' ).addClass( 'g-expand' );
});
jQuery( 'body' ).on( 'click', '#g-columns-list-close', function()
jQuery( 'body' ).on( 'click', '#g-columns-list-close', function()
{
jQuery( '#g-select-columns' ).show();
jQuery( '#g-select-columns' ).show();
jQuery( "#g-columns-list-close" ).hide();
return false;
});
jQuery( 'body' ).on( 'click', '#g-select-columns', function()
jQuery( 'body' ).on( 'click', '#g-select-columns', function()
{
jQuery( '#g-select-columns' ).hide();
jQuery( '#g-select-columns' ).hide();
jQuery( "#g-columns-list-close" ).show();
jQuery( '#g-columns-list' ).show();
return false;
});
jQuery( '.g-column-toggle' ).on( 'ifToggled', function()
{
{
var data = jQuery( this ).parents( '#g-columns-list' ).attr( 'data' );
data = data.split( ";" );
for ( index = 0; index < data.length; ++index )
for ( index = 0; index < data.length; ++index )
{
var vars = data[ index ].split( ':') ;
if ( vars[0] === 'table' )
var gtable = vars[1];
}
var i = jQuery( this ).parents( 'li' ).attr( 'i' );
jQuery.ajax(
@@ -236,27 +236,27 @@ jQuery( '.g-column-toggle' ).on( 'ifToggled', function()
hidden: !jQuery( this ).prop( 'checked' ),
a: 'gdraw'
},
beforeSend: function()
beforeSend: function()
{
jQuery( '#g-' + gtable ).find( '#g-loader' ).show();
},
success: function( data )
success: function( data )
{
response = jQuery.parseJSON( data );
response = jQuery.parseJSON( data );
jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
{
if ( response.msg !== null )
create_message( response.msg );
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
@@ -264,7 +264,7 @@ jQuery( '.g-column-toggle' ).on( 'ifToggled', function()
});
});
jQuery( 'body' ).on( 'click', '#g-columns-list span', function() {
jQuery( 'body' ).on( 'click', '#g-columns-list span', function() {
var input = jQuery( this ).attr( 'input' );
jQuery( '#' + input ).iCheck( 'toggle' );
});
@@ -295,33 +295,33 @@ jQuery( 'body' ).on( 'click', '.g-print', function() {
window.open( dir + '/print.php?gtable=' + gtable, 'Drukowanie', "height=400,width=600" );
});
jQuery( 'body' ).on( 'click', '#g-multidelete', function()
{
jQuery( 'body' ).on( 'click', '#g-multidelete', function()
{
var url = jQuery( this ).attr( 'url' );
if ( typeof url === 'undefined' )
url = '';
var data = jQuery( this ).parents( '.g-container' ).attr( 'data' );
data = data.split( ";" );
for ( index = 0; index < data.length; ++index )
for ( index = 0; index < data.length; ++index )
{
var vars = data[ index ].split( ':') ;
if ( vars[0] === 'table' )
var gtable = vars[1];
}
jQuery.prompt( 'Na pewno chcesz usunąć wybrane elementy?',
{
jQuery.prompt( 'Na pewno chcesz usunąć wybrane elementy?',
{
title: 'Potwierdź?',
submit: function(e,v,m,f)
{
submit: function(e,v,m,f)
{
if ( v === true )
{
var checkedVals = getCheckedIds( gtable );
if ( url !== '' )
{
jQuery.ajax(
@@ -329,62 +329,62 @@ jQuery( 'body' ).on( 'click', '#g-multidelete', function()
type: 'POST',
cache: false,
url: url,
data:
data:
{
gdelete_multi: checkedVals
},
beforeSend: function()
beforeSend: function()
{
jQuery( '#g-' + gtable ).find( '#g-loader' ).show();
},
success: function( data )
success: function( data )
{
response = jQuery.parseJSON( data );
response = jQuery.parseJSON( data );
if ( response.status === 'ok' )
{
if ( response.msg !== null )
create_message( response.msg );
jQuery.ajax(
{
type: 'POST',
cache: false,
url: dir + '/ajax.php',
data:
data:
{
gtable: gtable,
a: 'gdraw'
},
success: function( data )
success: function( data )
{
response = jQuery.parseJSON( data );
response = jQuery.parseJSON( data );
jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
{
if ( response.msg !== null )
create_message( response.msg );
jQuery( '#g-multidelete' ).hide();
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
}
});
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
@@ -398,19 +398,19 @@ jQuery( 'body' ).on( 'click', '#g-multidelete', function()
type: 'POST',
cache: false,
url: dir + '/ajax.php',
data:
data:
{
gtable: gtable,
gdelete_multi: checkedVals,
a: 'gdraw'
},
beforeSend: function()
beforeSend: function()
{
jQuery( '#g-' + gtable ).find( '#g-loader' ).show();
},
success: function( data )
success: function( data )
{
response = jQuery.parseJSON( data );
response = jQuery.parseJSON( data );
jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
@@ -419,12 +419,12 @@ jQuery( 'body' ).on( 'click', '#g-multidelete', function()
create_message( response.msg );
jQuery( '#g-multidelete' ).hide();
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
@@ -432,18 +432,18 @@ jQuery( 'body' ).on( 'click', '#g-multidelete', function()
});
}
}
},
buttons: {
'tak': true,
'nie': false
},
focus: 1
},
buttons: {
'tak': true,
'nie': false
},
focus: 1
});
return false;
return false;
});
jQuery( 'body' ).on( 'click', '#g-cancel', function() {
var data = jQuery( this ).parents( '.g-container' ).attr( 'data' );
data = data.split( ";" );
@@ -467,17 +467,17 @@ jQuery( 'body' ).on( 'click', '#g-cancel', function() {
},
success: function( data ) {
response = jQuery.parseJSON( data ); jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
if ( response.status === 'ok' )
{
jQuery( '#g-add, #g-search, .g-button, #g-select-columns' ).show();
jQuery( '#g-cancel, #g-save' ).hide();
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
@@ -485,46 +485,46 @@ jQuery( 'body' ).on( 'click', '#g-cancel', function() {
});
});
jQuery( 'body' ).on( 'click', '#g-save, #g-edit-save', function()
{
jQuery( 'body' ).on( 'click', '#g-save, #g-edit-save', function()
{
var back_url = jQuery( this ).attr( 'back_url' );
var persist_edit = jQuery( this ).attr( 'persist_edit' );
var id_param = jQuery( this ).attr( 'id_param' );
if ( typeof back_url === 'undefined' )
back_url = '';
var data = jQuery( this ).parents( '.g-container' ).attr( 'data' );
data = data.split( ";" );
for ( index = 0; index < data.length; ++index )
for ( index = 0; index < data.length; ++index )
{
var vars = data[ index ].split( ':') ;
if ( vars[0] === 'table' )
var gtable = vars[1];
}
if ( g_validate_form( gtable ) === true )
{
var values = jQuery( '#fg-' + gtable ).serializeObject();
if ( g_validate_form( gtable ) === true )
{
var values = jQuery( '#fg-' + gtable ).serializeArray();
var url = jQuery( this ).attr( 'url' );
if ( url !== '' )
if ( url !== '' )
{
jQuery.ajax(
{
type: 'POST',
cache: false,
url: url,
data:
data:
{
gtable: gtable,
values: JSON.stringify( values ),
a: 'gsave'
},
beforeSend: function()
beforeSend: function()
{
jQuery( '#g-' + gtable ).find( '#g-loader' ).show();
jQuery( '#overlay' ).show();
@@ -533,7 +533,7 @@ jQuery( 'body' ).on( 'click', '#g-save, #g-edit-save', function()
{
jQuery( '#overlay' ).hide();
response = jQuery.parseJSON( data ); jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
if ( response.status === 'ok' )
{
if ( back_url !== '' && persist_edit == 0 )
document.location.href = back_url;
@@ -547,16 +547,16 @@ jQuery( 'body' ).on( 'click', '#g-save, #g-edit-save', function()
type: 'POST',
cache: false,
url: dir + '/ajax.php',
data:
data:
{
gtable: gtable,
a: 'gdraw'
},
beforeSend: function()
beforeSend: function()
{
jQuery( '#g-' + gtable ).find( '#g-loader' ).show();
},
success: function( data )
success: function( data )
{
response = jQuery.parseJSON( data ); jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
@@ -564,12 +564,12 @@ jQuery( 'body' ).on( 'click', '#g-save, #g-edit-save', function()
jQuery( '#g-add, #g-search, .g-button' ).show();
jQuery( '#g-cancel, #g-save' ).hide();
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
@@ -580,49 +580,49 @@ jQuery( 'body' ).on( 'click', '#g-save, #g-edit-save', function()
{
if ( response.msg !== null )
create_message( response.msg );
if ( id_param != '' )
jQuery( '#' + id_param ).val( response.id );
}
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
}
});
}
else
{
}
else
{
jQuery.ajax(
{
type: 'POST',
cache: false,
url: dir + '/ajax.php',
data:
data:
{
gtable: gtable,
values: JSON.stringify( values ),
a: 'gsave'
},
beforeSend: function()
beforeSend: function()
{
jQuery( '#g-' + gtable ).find( '#g-loader' ).show();
},
success: function( data )
success: function( data )
{
response = jQuery.parseJSON( data ); jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
if ( response.status === 'ok' )
{
if ( back_url !== '' )
if ( back_url !== '' )
{
document.location.href=back_url;
}
}
else
{
if ( response.msg !== null )
@@ -632,12 +632,12 @@ jQuery( 'body' ).on( 'click', '#g-save, #g-edit-save', function()
jQuery( '#g-cancel, #g-save' ).hide();
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
}
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
@@ -646,9 +646,9 @@ jQuery( 'body' ).on( 'click', '#g-save, #g-edit-save', function()
}
};
});
jQuery( 'body' ).on( 'click', '#g-add, .g-edit', function() {
var data = jQuery( this ).parents( '.g-container' ).attr( 'data' );
data = data.split( ";" );
@@ -658,9 +658,9 @@ jQuery( 'body' ).on( 'click', '#g-add, .g-edit', function() {
if ( vars[0] === 'table' )
var gtable = vars[1];
}
var gedit = jQuery( this ).attr( 'element-id' );
jQuery.ajax({
type: 'POST',
cache: false,
@@ -675,17 +675,17 @@ jQuery( 'body' ).on( 'click', '#g-add, .g-edit', function() {
},
success: function( data ) {
response = jQuery.parseJSON( data ); jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
if ( response.status === 'ok' )
{
jQuery( '#g-add, #g-search, .g-button, #g-select-columns' ).hide();
jQuery( '#g-cancel, #g-save' ).css( 'display', 'inline-block' );
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
@@ -693,7 +693,7 @@ jQuery( 'body' ).on( 'click', '#g-add, .g-edit', function() {
});
});
jQuery( 'body' ).on( 'click', '.g-delete', function()
jQuery( 'body' ).on( 'click', '.g-delete', function()
{
jQuery( this ).blur();
@@ -711,35 +711,35 @@ jQuery( 'body' ).on( 'click', '.g-delete', function()
var back_url = jQuery( this ).attr( 'back-url' );
var url = jQuery( this ).attr( 'url' ).replace( '[ID]', gdelete );
jQuery.prompt( 'Na pewno chcesz usunąć wybrany element?',
{
jQuery.prompt( 'Na pewno chcesz usunąć wybrany element?',
{
title: 'Potwierdź?',
submit: function(e,v,m,f)
{
if ( v === true )
submit: function(e,v,m,f)
{
if ( v === true )
{
if ( url !== '' )
if ( url !== '' )
{
jQuery.ajax(
{
type: 'POST',
cache: false,
url: url,
data:
data:
{
gdelete: gdelete,
a: 'gdelete'
},
beforeSend: function()
beforeSend: function()
{
jQuery( '#g-' + gtable ).find( '#g-loader' ).show();
},
success: function( data )
success: function( data )
{
response = jQuery.parseJSON( data ); jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
if ( response.status === 'ok' )
{
if ( back_url !== '' )
if ( back_url !== '' )
{
document.location.href=back_url;
}
@@ -762,71 +762,71 @@ jQuery( 'body' ).on( 'click', '.g-delete', function()
},
success: function( data ) {
response = jQuery.parseJSON( data ); jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
if ( response.status === 'ok' )
{
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
}
});
}
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
}
});
}
else
}
else
{
jQuery.ajax(
{
type: 'POST',
cache: false,
url: dir + '/ajax.php',
data:
data:
{
gtable: gtable,
gdelete: gdelete,
a: 'gdraw'
},
beforeSend: function()
beforeSend: function()
{
jQuery( '#g-' + gtable ).find( '#g-loader' ).show();
},
success: function( data )
success: function( data )
{
response = jQuery.parseJSON( data ); jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
if ( response.status === 'ok' )
{
if ( back_url !== '' )
if ( back_url !== '' )
{
document.location.href=back_url;
}
}
else
{
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
if ( response.msg !== null )
create_message( response.msg );
}
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
@@ -834,22 +834,22 @@ jQuery( 'body' ).on( 'click', '.g-delete', function()
});
}
}
},
buttons:
{
'tak': true,
'nie': false
},
buttons:
{
'tak': true,
'nie': false
}
});
return false;
});
jQuery( 'body' ).on( 'change', '.g-search-input, .g-search-select', function()
jQuery( 'body' ).on( 'change', '.g-search-input, .g-search-select', function()
{
var data = jQuery( this ).attr( 'data' );
data = data.split( ";" );
for ( index = 0; index < data.length; ++index )
for ( index = 0; index < data.length; ++index )
{
var vars = data[ index ].split( ':') ;
@@ -863,7 +863,7 @@ jQuery( 'body' ).on( 'change', '.g-search-input, .g-search-select', function()
var data = jQuery( this ).parents( '.g-container' ).attr( 'data' );
data = data.split( ";" );
for ( index = 0; index < data.length; ++index )
for ( index = 0; index < data.length; ++index )
{
var vars = data[ index ].split( ':') ;
@@ -877,7 +877,7 @@ jQuery( 'body' ).on( 'change', '.g-search-input, .g-search-select', function()
type: 'POST',
cache: false,
url: dir + '/ajax.php',
data:
data:
{
gtable: gtable,
gsearch_column: gsearch_column,
@@ -885,22 +885,22 @@ jQuery( 'body' ).on( 'change', '.g-search-input, .g-search-select', function()
gsearch_type: gsearch_type,
a: 'gdraw'
},
beforeSend: function()
beforeSend: function()
{
jQuery( '#g-' + gtable ).find( '#g-loader' ).show();
},
success: function( data ) {
response = jQuery.parseJSON( data ); jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
if ( response.status === 'ok' )
{
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
jQuery( 'input[name="' + gsearch_column + '"]' ).focus().val( jQuery( 'input[name="' + gsearch_column + '"]' ).val() );
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
@@ -948,15 +948,15 @@ jQuery( 'body' ).on( 'click', '.g-sort', function() {
},
success: function( data ) {
response = jQuery.parseJSON( data ); jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
if ( response.status === 'ok' )
{
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
@@ -991,15 +991,15 @@ jQuery( 'body' ).on( 'change', '#g-row-limit', function() {
},
success: function( data ) {
response = jQuery.parseJSON( data ); jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
if ( response.status === 'ok' )
{
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
@@ -1012,7 +1012,7 @@ jQuery( 'body' ).on( 'click', '.date-range-icon', function()
$( this ).parents( '.input-group' ).children( 'input' ).trigger( 'click' );
});
jQuery( 'body' ).on( 'click', '.g-next, .g-last, .g-first, .g-previous, .g-page', function(e)
jQuery( 'body' ).on( 'click', '.g-next, .g-last, .g-first, .g-previous, .g-page', function(e)
{
e.preventDefault();
@@ -1042,15 +1042,15 @@ jQuery( 'body' ).on( 'click', '.g-next, .g-last, .g-first, .g-previous, .g-page'
},
success: function( data ) {
response = jQuery.parseJSON( data ); jQuery( '#g-' + gtable ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
if ( response.status === 'ok' )
{
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
}
else
}
else
{
if ( response.msg )
var msg = response.msg;
else
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}

View File

@@ -14,7 +14,7 @@
or
$this -> values['print']
):?>
<div class="row mb10" style="min-height: 50px;">
<div class="row mb10" style="height: 50px;">
<?
if ( $this -> values['title'] )
echo '<div id="g-title">' . $this -> values['title'] . '</div>';

View File

@@ -1,17 +1,17 @@
<?
<?
$this -> values['name'] ? $g_table = $this -> values['name'] : $g_table = $this -> values[ 'table' ];
?>
<div class="table-responsive">
<table id="g-list" class="table mbn table-hover table-striped <? if ( $this -> values['condensed'] ):?>table-condensed<? endif;?> table-bordered">
<thead>
<tr>
<?
<?
if ( $this -> values['multiselect'] )
echo '<th class="g-lp">' .
'<input type="checkbox" class="g-checkbox-all" />' .
'</th>';
if ( is_array( $this -> values['columns_view'] ) )
if ( is_array( $this -> values['columns_view'] ) )
{
$c_index = 0;
$visible_columns = 0;
@@ -68,7 +68,7 @@
}
?>
</tr>
<?
<?
if ( is_array( $this -> values['search'] ) )
{
$c_index = 0;
@@ -77,7 +77,7 @@
if ( is_array( $this -> values['columns_view'] ) ) foreach ( $this -> values['columns_view'] as $column )
{
$search_found = false;
if ( filter_var( $this -> values['hidden_columns'][$c_index], FILTER_VALIDATE_BOOLEAN ) === false or $this -> values['hidden_columns'][$c_index] === null )
{
foreach ( $this -> values['search'] as $search )
@@ -131,7 +131,7 @@
echo '</select>'
. '</th>';
}
if ( $search['type'] == 'date_range' )
{
echo '<th>';
@@ -149,7 +149,7 @@
}
}
}
if ( !$search_found )
echo '<th></th>';
}
@@ -194,8 +194,8 @@
{
echo '<td class="' . $column['td']['class'] . '" style="' . $column['td']['style'] . ''; if ( $column['td']['js'] ) echo 'cursor: pointer;'; echo '"';
if ( $column['td']['js'] )
{
$out_js = $_SESSION[ 'g' . $g_table ] -> convertString( $column['td']['js'], $row );
{
$out_js = $_SESSION[ 'g' . $g_table ] -> convertString( $column['td']['js'], $row );
echo 'onclick="' . htmlspecialchars( $out_js ) . '"';
}
@@ -230,7 +230,7 @@
/* wyświtalania linku typu button */
else if ( $column['action']['type'] == 'button' )
{
{
if ( $column['action']['url'] )
$out_url = $_SESSION[ 'g' . $g_table ] -> convertString( $column['action']['url'], $row );
else
@@ -246,15 +246,15 @@
'onclick="' . htmlspecialchars( $out_js ) . '" ' .
'class="g-tip g-button ' . $column['button']['class' ] . '" ' .
'title="' . htmlspecialchars( $title ) . '" ' .
'style="' . $column['button']['style'] . '">' . $column['button']['label'] .
'style="' . $column['button']['style'] . '">' . $column['button']['label'] .
'</a>';
}
/* wyświtalania linku do edycji */
else if ( $column['action']['type'] == 'edit' )
{
$out_url = $_SESSION[ 'g' . $g_table ] -> convertString( $column['action']['url'], $row );
$out_js = $_SESSION[ 'g' . $g_table ] -> convertString( $column['action']['js'], $row );
$out_url = $_SESSION[ 'g' . $g_table ] -> convertString( $column['action']['url'], $row );
$out_js = $_SESSION[ 'g' . $g_table ] -> convertString( $column['action']['js'], $row );
echo '<a href="' . $out_url . '" onclick="' . htmlspecialchars( $out_js ) . '" class="g-tip" title="edytuj"><i class="fa fa-cog fa-lg"></i></a>';
}
@@ -298,7 +298,7 @@
}
if ( $this -> values['actions']['edit'] )
echo '<td class="center">' .
echo '<td class="center">' .
'<a href="#" class="g-edit g-tip" title="edytuj" element-id="' . $row[ $this -> values['id'] ] . '">' .
'<i class="fa fa-cog fa-lg"></i>' .
'</a>' .
@@ -362,16 +362,16 @@
<? endif;?>
<? for ( $i = $this -> values['cp'] - 3; $i <= $this -> values['cp'] + 3; $i++ ):?>
<? if ( $i > 0 && $i <= $ls ):?>
<li class="<? if ( $i == $this -> values['cp'] ):?>active<? endif;?>
<?
if (
$i == $this -> values['cp'] - 2
or
$i == $this -> values['cp'] + 2
or
$i == $this -> values['cp'] + 3
or
$i == $this -> values['cp'] - 3
<li class="<? if ( $i == $this -> values['cp'] ):?>active<? endif;?>
<?
if (
$i == $this -> values['cp'] - 2
or
$i == $this -> values['cp'] + 2
or
$i == $this -> values['cp'] + 3
or
$i == $this -> values['cp'] - 3
):?> hidden-xs<? endif;?>">
<a href="#" class="g-page" rel="prev" title="Przejdź do strony nr: <?= $i;?>" page="<?= $i;?>"><?= $i;?></a>
</li>
@@ -402,23 +402,23 @@
<? endif;?>
</ul>
</div>
<div class="col col-xs-12 col-sm-6 text-right text-centred-xs pull-right-sm">
<div class="col col-xs-12 col-sm-6 p20 text-right text-centred-xs pull-right-sm">
Wyświetlaj <select id="g-row-limit" class="form-control"><? if ( is_array( $this -> values['limits'] ) ): foreach ( $this -> values['limits'] as $key => $val ):?><option value="<?= $val;?>" <? if ( $this -> values['limit'] == $val ):?>selected="selected"<? endif;?>><?= $val;?></option><? endforeach; endif;?></select> rekordów
</div>
</div>
<? endif;?>
<script type="text/javascript">
jQuery( function()
{
jQuery( function()
{
context.attach( '#g-<?= $g_table;?> #g-list tbody tr', menu_context_<?= str_replace( '-', '_', $g_table );?> );
jQuery( '#g-<?= $g_table;?> #g-list .g-checkbox, #g-<?= $g_table;?> #g-list .g-radio' ).on( 'ifToggled', function()
{
var checkedVals = jQuery( '.g-checkbox:checked' ).map( function()
var checkedVals = jQuery( '.g-checkbox:checked' ).map( function()
{
return this.value;
}).get();
if ( checkedVals != '' )
{
jQuery( '#g-<?= $g_table;?> #g-multidelete' ).show();
@@ -433,7 +433,7 @@
checkboxClass: 'icheckbox_minimal-blue',
radioClass: 'iradio_minimal-blue'
});
jQuery( '#g-<?= $g_table;?> #g-list .g-checkbox-all' ).on( 'ifToggled', function()
{
jQuery( '#g-<?= $g_table;?> #g-list .g-checkbox' ).iCheck( 'toggle' );
@@ -441,7 +441,7 @@
checkboxClass: 'icheckbox_minimal-blue',
radioClass: 'iradio_minimal-blue'
});
jQuery( '#g-<?= $g_table;?> #g-list #g-multidelete' ).hide();
});
</script>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,59 @@
<? global $lang_id;?>
<? if ( \S::is_array_fix( $this -> products ) ):?>
<h2>Dobierz inne produkty do kompletu</h2>
<? endif;?>
<div class="product-sets">
<? if ( is_array( $this -> products ) ): foreach ( $this -> products as $product_id ):
$product = new \shop\Product( $product_id );
$product -> language['seo_link'] ? $url = '/' . $product -> language['seo_link'] : $url = '/p-' . $product['id'] . '-' . \S::seo( $product -> language['name'] );
if ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language() and $url != '#' )
$url = '/' . \S::get_session( 'current-lang' ) . $url;
?>
<div class="product">
<? if ( $product -> new_to_date and $product -> new_to_date >= date( 'Y-m-d' ) ):?>
<div class="new"><?= \S::lang( 'nowosc' );?></div>
<? endif;?>
<a href="<?= $url;?>" class="a-img">
<div class="img">
<? if ( file_exists( substr( $product -> images[0]['src'], 1 ) ) ):?>
<? if ( $this -> class == 'item' ):?>
<img class="owl-lazy" data-src="/thumb/490/0/<?= substr( $product -> images[0]['src'], 1, strlen( $product -> images[0]['src'] ) );?>" alt="<?= $product -> images[0]['alt'];?>">
<? else:?>
<img class="lozad first" data-src="/thumb/490/0/<?= substr( $product -> images[0]['src'], 1, strlen( $product -> images[0]['src'] ) );?>" alt="<?= $product -> images[0]['alt'];?>">
<? if ( file_exists( substr( $product -> images[1]['src'], 1 ) ) ):?>
<img class="lozad second" data-src="/thumb/490/0/<?= substr( $product -> images[1]['src'], 1, strlen( $product -> images[1]['src'] ) );?>" alt="<?= $product -> images[1]['alt'];?>">
<? else:?>
<img class="lozad second" data-src="/thumb/490/0/<?= substr( $product -> images[0]['src'], 1, strlen( $product -> images[0]['src'] ) );?>" alt="<?= $product -> images[0]['alt'];?>">
<? endif;?>
<? endif;?>
<? else:?>
<? endif;?>
</div>
</a>
<div class="product-details">
<h2 class="name">
<a href="<?= $url;?>" class="a-name">
<?= $product -> language['name'];?>
</a>
</h2>
<div class="prices">
<? if ( $product -> price_brutto_promo ):?>
<div class="price-old">
<?= \shop\Shop::shortPrice( $product -> price_brutto );?> <span class="small">zł</span>
</div>
<div class="price">
<?= \shop\Shop::shortPrice( $product -> price_brutto_promo );?> <span class="small">zł</span>
</div>
<? else:?>
<div class="price">
<?= \shop\Shop::shortPrice( $product -> price_brutto );?> <span class="small">zł</span>
</div>
<? endif;?>
</div>
</div>
</div>
<? endforeach; endif;?>
</div>

View File

@@ -6,7 +6,7 @@
Chcesz skorzystać z odroczonych płatności <img src="/layout/images/paypo-logo.svg">? Wybierz jedną z form dostawy: <strong>odbiór osobisty, Paczkomaty InPost - przedpłata lub Kurier - przedpłata</strong>.<br/>
Wartość zamówienia musi mieścić się w przedziale od 40 zł do 1000 zł.
</div>
<? if ( is_array( $this -> basket ) and count( $this -> basket ) ):?>
<? if ( is_array( $this -> basket ) and count( $this -> basket ) ):?>
<div class="basket-options">
<div class="content">
<div class="left">
@@ -18,12 +18,6 @@
<a href="#" onclick="inpost_check(); return false;" class="inpost-hide"><?= \S::lang( 'zamknij' );?></a>
<div id="inpost-map"></div>
</div>
<!-- <div class="orlen-map-container">
<a href="#" onclick="orlen_check(); return false;" class="orlen-hide"><?= \S::lang( 'zamknij' );?></a>
<div id="orlen-map"></div>
</div> -->
</div>
<div class="right">
<div class="box-title"><?= ucfirst( \S::lang( 'platnosc' ) );?>:</div>
@@ -44,7 +38,6 @@
<script class="footer" type="text/javascript" src="https://geowidget.easypack24.net/js/sdk-for-javascript.js"></script>
<script class="footer" type="text/javascript">
var inpost_transport_method_id = '';
var orlen_transport_method_id = '';
function inpost_check() {
@@ -67,23 +60,6 @@
return false;
}
// function orlen_check() {
// $.ajax({
// type: 'POST',
// cache: false,
// url: '/shopBasket/orlen_check',
// beforeSend: function() {},
// success: function(response) {
// data = jQuery.parseJSON(response);
// if (data.result == 'bad') {
// $('.orlen-info-' + orlen_transport_method_id).html('<a href="#" onclick="orlen_map(' + orlen_transport_method_id + '); return false;">wybierz</a>');
// }
// $('.orlen-map-container').hide();
// }
// });
// return false;
// }
function payment_checked( payment_method_id )
{
$.ajax(
@@ -142,33 +118,6 @@
$( '.inpost-map-container' ).show();
}
// function orlen_map(transport_method_id) {
// orlen_transport_method_id = transport_method_id;
// window.orlenPackAsyncInit = function () {
// orlenPack.init({
// mapType: 'osm',
// });
// var map = orlenPack.mapWidget('orlen-map', function(point) {
// $.ajax({
// type: 'POST',
// cache: false,
// url: '/shopBasket/orlen_save',
// data: {
// paczka: point.name + ' | ' + point.address.line1 + ', ' + point.address.line2
// },
// beforeSend: function() {},
// success: function(response) {
// $('.orlen-info-' + transport_method_id).html(point.name + ' | ' + point.address.line1 + ', ' + point.address.line2 + '<a href="#" onclick="orlen_map(' + transport_method_id + '); return false;">Змінити</a>');
// $('.orlen-map-container').hide();
// }
// });
// });
// };
// $('.orlen-map-container').show();
// }
function transport_checked( transport_method_id, payment_method_id, event_click )
{
$.ajax({

View File

@@ -0,0 +1,14 @@
<? global $lang_id;?>
<? if ( $this -> query ):?>
<div class="box-title">
<?= \S::lang( 'wyniki-wyszukiwania-dla-zapytania' ) . ': <strong>' . $this -> query . '</strong>';?>
</div>
<? endif;?>
<div class="category-content">
<? if ( is_array( $this -> products ) ): foreach ( $this -> products as $product_id ):
$product = new \shop\Product( $product_id );
echo \Tpl::view( 'shop-product/product-mini', [
'product' => new \shop\Product( $product_id, $lang_id )
] );
endforeach; endif;?>
</div>

View File

@@ -1,4 +1,4 @@
<? if ( $this -> order['status'] == 1 ):?>
<? if ( $this -> order['status'] == 1 or $this -> order['status'] == 4 ):?>
<div id="payment-confirmation">
<div class="bold blue text-center">Płatność została zatwierdzona. Dziękujemy za wybranie naszych usług.</div>
<div class="text-center">Nasz system zweryfikuje Państwa zamówienie w ciągu kilku minut.</div>
@@ -24,8 +24,26 @@
</tfoot>
</table>
</div>
<? endif;?>
<? if ( \S::get_session( 'ekomi-purchase' ) and $this -> settings['ekomi_survey'] ):?>
<? unset( $_SESSION['ekomi-purchase'] );?>
<?= $this -> settings['ekomi_survey'];?>
<? else:?>
<div id="payment-confirmation">
<div class="bold red text-center">Płatność oczekuje na zatwierdzenie.</div>
<div class="text-center">Nasz system zweryfikuje Państwa zamówienie w ciągu kilku minut.</div>
<p></p>
<table class="table table-stripped table-bordered payment-table">
<thead>
<tr>
<th class="text-center" colspan="2">Informacje o płatności</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-bold">Zamówienie nr:</td><td><?= $this -> order['number'];?></td>
</tr>
<tr>
<td class="text-bold">Data transakcji:</td><td><?= date( 'Y-m-d H:i', strtotime( $this -> order['date_order'] ) );?></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2" class="text-right
<? endif;?>