ver. 0.273 - ShopProducer refactor + cleanup 6 factory facades
- Domain\Producer\ProducerRepository (CRUD + frontend) - admin\Controllers\ShopProducerController (DI) - Nowe widoki: producers-list, producer-edit (table-list/form-edit) - shop\Producer -> fasada do ProducerRepository - Przepiecie ShopProduct factory na TransportRepository - Usuniete 6 pustych factory facades: Languages, Newsletter, Scontainers, ShopProducer, ShopTransport, Layouts - Usuniete legacy: controls\ShopProducer, stare szablony - Testy: 338 tests, 1063 assertions OK
This commit is contained in:
@@ -1,180 +0,0 @@
|
||||
<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>
|
||||
<?
|
||||
global $db;
|
||||
|
||||
$_SESSION['rfm_akey'] = bin2hex(random_bytes(16));
|
||||
$_SESSION['rfm_akey_expires'] = time() + 20*60;
|
||||
$_SESSION['can_use_rfm'] = true;
|
||||
$rfmAkeyJS = $_SESSION['rfm_akey'];
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<div id="settings-tabs">
|
||||
<ul class="resp-tabs-list settings-tabs">
|
||||
<li><i class="fa fa-file"></i>Ogólne</li>
|
||||
<li><i class="fa fa-file"></i>Opis</li>
|
||||
<li><i class="fa fa-globe"></i>SEO</li>
|
||||
</ul>
|
||||
<div class="resp-tabs-container settings-tabs">
|
||||
<div>
|
||||
<?= \Html::input( [
|
||||
'label' => 'Nazwa',
|
||||
'class' => 'require',
|
||||
'name' => 'name',
|
||||
'id' => 'name',
|
||||
'value' => $this -> producer['name']
|
||||
] );?>
|
||||
<?= \Html::input_switch( [
|
||||
'label' => 'Aktywny',
|
||||
'name' => 'status',
|
||||
'checked' => $this -> producer['status'] == 1 ? true : false
|
||||
] );?>
|
||||
<?= \Html::input_icon( [
|
||||
'label' => 'Logo',
|
||||
'name' => 'img',
|
||||
'id' => 'img',
|
||||
'value' => $this -> producer['img'],
|
||||
'icon_content' => 'przeglądaj',
|
||||
'icon_js' => "window.open ( '/libraries/filemanager-9.14.2/dialog.php?type=1&popup=1&field_id=img&akey=" . $rfmAkeyJS . "', 'mywindow', 'location=1,status=1,scrollbars=1, width=1100,height=700');"
|
||||
] );
|
||||
?>
|
||||
</div>
|
||||
<div>
|
||||
<div class="languages-main">
|
||||
<ul class="resp-tabs-list languages-main htabs">
|
||||
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
|
||||
<? if ( $lg[ 'status' ] ):?>
|
||||
<li><? if ( $lg[ 'id' ] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg[ 'name' ];?></li>
|
||||
<? endif;?>
|
||||
<? endforeach; endif;?>
|
||||
</ul>
|
||||
<div class="resp-tabs-container languages-main">
|
||||
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
|
||||
<?
|
||||
$languages = array ();
|
||||
|
||||
$languages[''] = '---- wersja językowa ----';
|
||||
if ( is_array( $this -> languages ) ) foreach ( $this -> languages as $lg_tmp )
|
||||
{
|
||||
if ( $lg_tmp[ 'id' ] != $lg[ 'id' ] )
|
||||
$languages[ $lg_tmp[ 'id' ] ] = $lg_tmp[ 'name' ];
|
||||
}
|
||||
?>
|
||||
<? if ( $lg[ 'status' ] ):?>
|
||||
<div>
|
||||
<?= \Html::textarea( [
|
||||
'label' => 'Opis',
|
||||
'name' => 'description[' . $lg['id'] . ']',
|
||||
'id' => 'description_' . $lg['id'],
|
||||
'value' => $this -> producer['languages'][$lg[ 'id']]['description'],
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?= \Html::textarea( [
|
||||
'label' => 'Dane producenta',
|
||||
'name' => 'data[' . $lg['id'] . ']',
|
||||
'id' => 'data_' . $lg['id'],
|
||||
'value' => $this -> producer['languages'][$lg[ 'id']]['data'],
|
||||
'inline' => true
|
||||
] );?>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$( '#data_<?= $lg[ 'id' ];?>').ckeditor({
|
||||
toolbar: 'MyToolbar',
|
||||
height: '250'
|
||||
});
|
||||
|
||||
$( '#description_<?= $lg[ 'id' ];?>').ckeditor({
|
||||
toolbar: 'MyToolbar',
|
||||
height: '250'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<? endif;?>
|
||||
<? endforeach; endif;?>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="languages-main">
|
||||
<ul class="resp-tabs-list languages-main htabs">
|
||||
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
|
||||
<? if ( $lg[ 'status' ] ):?>
|
||||
<li><? if ( $lg[ 'id' ] == \front\factory\Languages::default_language() ) echo '<i class="fa fa-star fa-lg text-system" title="Język domyślny"></i> ';?><?= $lg[ 'name' ];?></li>
|
||||
<? endif;?>
|
||||
<? endforeach; endif;?>
|
||||
</ul>
|
||||
<div class="resp-tabs-container languages-main">
|
||||
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
|
||||
<?
|
||||
$languages = array ();
|
||||
|
||||
$languages[''] = '---- wersja językowa ----';
|
||||
if ( is_array( $this -> languages ) ) foreach ( $this -> languages as $lg_tmp )
|
||||
{
|
||||
if ( $lg_tmp[ 'id' ] != $lg[ 'id' ] )
|
||||
$languages[ $lg_tmp[ 'id' ] ] = $lg_tmp[ 'name' ];
|
||||
}
|
||||
?>
|
||||
<? if ( $lg[ 'status' ] ):?>
|
||||
<div>
|
||||
<?= \Html::input( [
|
||||
'label' => 'Meta title',
|
||||
'name' => 'meta_title[' . $lg['id'] . ']',
|
||||
'id' => 'meta_title_' . $lg[ 'id' ],
|
||||
'value' => $this -> producer['languages'][$lg['id']]['meta_title']
|
||||
] );?>
|
||||
</div>
|
||||
<? endif;?>
|
||||
<? endforeach; endif;?>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
$out = ob_get_clean();
|
||||
|
||||
$grid = new \gridEdit;
|
||||
$grid -> id = 'producer-edit';
|
||||
$grid -> gdb_opt = $gdb;
|
||||
$grid -> include_plugins = true;
|
||||
$grid -> title = 'Edycja producenta';
|
||||
$grid -> fields = [
|
||||
[
|
||||
'db' => 'id',
|
||||
'type' => 'hidden',
|
||||
'value' => $this -> producer['id']
|
||||
]
|
||||
];
|
||||
$grid -> actions = [
|
||||
'save' => [ 'url' => '/admin/shop_producer/save/', 'back_url' => '/admin/shop_producer/list/' ],
|
||||
'cancel' => [ 'url' => '/admin/shop_producer/list/' ]
|
||||
];
|
||||
$grid -> external_code = $out;
|
||||
$grid -> persist_edit = true;
|
||||
$grid -> id_param = 'id';
|
||||
echo $grid -> draw();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$( function()
|
||||
{
|
||||
disable_menu();
|
||||
|
||||
$( '#settings-tabs' ).easyResponsiveTabs({
|
||||
width: 'auto',
|
||||
fit: true,
|
||||
tabidentify: 'settings-tabs',
|
||||
type: 'vertical'
|
||||
});
|
||||
|
||||
$('.languages-main').easyResponsiveTabs({
|
||||
width: 'auto',
|
||||
fit: true,
|
||||
tabidentify: 'languages-main'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -1,73 +0,0 @@
|
||||
<?php
|
||||
global $gdb;
|
||||
|
||||
$grid = new \grid( 'shop_producer' );
|
||||
$grid -> gdb_opt = $gdb;
|
||||
$grid -> sql = 'SELECT *'
|
||||
. 'FROM ( '
|
||||
. 'SELECT '
|
||||
. 'id, name, status, img '
|
||||
. 'FROM '
|
||||
. 'pp_shop_producer '
|
||||
. ') AS q1 '
|
||||
. 'WHERE '
|
||||
. '1=1 [where] '
|
||||
. 'ORDER BY '
|
||||
. '[order_p1] [order_p2]';
|
||||
$grid -> sql_count = 'SELECT '
|
||||
. 'COUNT(0) FROM ( '
|
||||
. 'SELECT '
|
||||
. 'id, name, status, img '
|
||||
. 'FROM '
|
||||
. 'pp_shop_producer '
|
||||
. ') AS q1 '
|
||||
. 'WHERE '
|
||||
. '1=1 [where] ';
|
||||
$grid -> debug = true;
|
||||
$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',
|
||||
'sort' => true,
|
||||
'php' => 'echo "<a href=\'/admin/shop_producer/edit/id=[id]\'>[name]</a>";'
|
||||
], [
|
||||
'name' => 'Logo',
|
||||
'db' => 'img'
|
||||
], [
|
||||
'name' => 'Aktywny',
|
||||
'db' => 'status',
|
||||
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
|
||||
'sort' => true
|
||||
], [
|
||||
'name' => 'Edytuj',
|
||||
'action' => [ 'type' => 'edit', 'url' => '/admin/shop_producer/edit/id=[id]' ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
|
||||
'td' => [ 'class' => 'g-center' ]
|
||||
], [
|
||||
'name' => 'Usuń',
|
||||
'action' => [ 'type' => 'delete', 'url' => '/admin/shop_producer/delete/id=[id]' ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
|
||||
'td' => [ 'class' => 'g-center' ]
|
||||
]
|
||||
];
|
||||
$grid -> buttons = [
|
||||
[
|
||||
'label' => 'Dodaj producenta',
|
||||
'url' => '/admin/shop_producer/edit/',
|
||||
'icon' => 'fa-plus-circle',
|
||||
'class' => 'btn-success'
|
||||
]
|
||||
];
|
||||
echo $grid -> draw();
|
||||
1
admin/templates/shop-producer/producer-edit.php
Normal file
1
admin/templates/shop-producer/producer-edit.php
Normal file
@@ -0,0 +1 @@
|
||||
<?= \Tpl::view('components/form-edit', ['form' => $this->form]); ?>
|
||||
1
admin/templates/shop-producer/producers-list.php
Normal file
1
admin/templates/shop-producer/producers-list.php
Normal file
@@ -0,0 +1 @@
|
||||
<?= \Tpl::view('components/table-list', ['list' => $this->viewModel]); ?>
|
||||
Reference in New Issue
Block a user