ver. 0.251 - migrate Dictionaries to Domain/Controller and remove legacy classes

This commit is contained in:
2026-02-10 00:04:32 +01:00
parent 3bab9f9e8a
commit fe4e98d9bd
17 changed files with 788 additions and 307 deletions

View File

@@ -95,7 +95,7 @@ $perPage = (int)($list->pagination['per_page'] ?? 15);
</form>
<div class="table-responsive">
<table class="table table-hover table-striped table-bordered mbn">
<table class="table table-hover table-striped table-bordered mbn table-list-table">
<thead>
<tr>
<?php foreach ($list->columns as $column): ?>
@@ -230,6 +230,12 @@ $perPage = (int)($list->pagination['per_page'] ?? 15);
</div>
<style type="text/css">
.table-list-table th:first-child,
.table-list-table td:first-child {
width: 70px;
white-space: nowrap;
}
.jconfirm.table-list-confirm-dialog .jconfirm-row {
min-height: 100vh;
display: flex;

View File

@@ -1,91 +1 @@
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
<?
global $db;
ob_start();
?>
<div id="settings-tabs">
<ul class="resp-tabs-list settings-tabs">
<li><i class="fa fa-file"></i>Treść</li>
</ul>
<div class="resp-tabs-container settings-tabs">
<div>
<div id="languages-main">
<ul class="resp-tabs-list languages-main htabs">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<li><?= $lg['name'];?></a></li>
<? endif;?>
<? endforeach; endif;?>
</ul>
<div class="resp-tabs-container languages-main">
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
<? if ( $lg['status'] ):?>
<div>
<?= \Html::input(
array(
'label' => 'Tekst',
'name' => 'text[' . $lg['id'] . ']',
'id' => 'text_' . $lg['id'],
'value' => $this -> unit['languages'][ $lg['id'] ]['text'],
'inline' => true
)
);?>
</div>
<? endif;?>
<? endforeach; endif;?>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'unit-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja jednostki miary';
$grid -> fields = [
[
'db' => 'id',
'type' => 'hidden',
'value' => $this -> unit['id']
]
];
$grid -> actions = [
'save' => [ 'url' => '/admin/dictionaries/unit_save/', 'back_url' => '/admin/dictionaries/view_list/' ],
'cancel' => [ 'url' => '/admin/dictionaries/view_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>
<script>CKEDITOR.dtd.$removeEmpty['span'] = false;</script>
<?= \Tpl::view('components/form-edit', ['form' => $this->form]); ?>

View File

@@ -1,67 +1,5 @@
<?php
global $gdb;
<?= \Tpl::view('components/table-list', ['list' => $this->viewModel]); ?>
$grid = new \grid( 'pp_dictionaries_units' );
$grid -> gdb_opt = $gdb;
$grid -> sql = 'SELECT *'
. 'FROM ( '
. 'SELECT '
. 'id,'
. '( SELECT text FROM pp_units_langs AS psl, pp_langs AS pl WHERE lang_id = pl.id AND unit_id = ps.id AND text != \'\' ORDER BY o ASC LIMIT 1 ) AS text '
. 'FROM '
. 'pp_units AS ps '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) FROM ( '
. 'SELECT '
. 'id,'
. '( SELECT text FROM pp_units_langs AS psl, pp_langs AS pl WHERE lang_id = pl.id AND unit_id = ps.id AND text != \'\' ORDER BY o ASC LIMIT 1 ) AS text '
. 'FROM '
. 'pp_units AS ps '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] ';
$grid -> debug = true;
$grid -> order = [ 'column' => 'id', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Tekst', 'db' => 'text', 'type' => 'text' ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Tekst',
'db' => 'text',
'php' => 'echo "<a href=\'/admin/dictionaries/unit_edit/id=[id]\'>[text]</a>";',
'sort' => true
],
[
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/dictionaries/unit_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
],
[
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/dictionaries/unit_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj jednostkę miary',
'url' => '/admin/dictionaries/unit_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]
];
echo $grid -> draw();
<?php if (!empty($this->viewModel->customScriptView)): ?>
<?= \Tpl::view($this->viewModel->customScriptView, ['list' => $this->viewModel]); ?>
<?php endif; ?>