Add backend site management for collective topics and topics
- Introduced new backend site management features including the ability to accept, unaccept, save, edit, and display topics and collective topics. - Added new views for editing and listing collective topics and topics. - Implemented necessary backend logic in the `BackendSites` and `factory\BackendSites` classes to handle CRUD operations for topics and collective topics. - Updated the layout to include links for accessing the new backend features based on user permissions.
This commit is contained in:
70
templates/backend_sites/collective_topic_edit.php
Normal file
70
templates/backend_sites/collective_topic_edit.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?
|
||||
global $db;
|
||||
ob_start();
|
||||
?>
|
||||
<?= \Html::input( [
|
||||
'label' => 'Strona',
|
||||
'name' => 'strona',
|
||||
'id' => 'strona',
|
||||
'value' => $this -> collective_topic['strona'],
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?= \Html::input( [
|
||||
'label' => 'Kategoria',
|
||||
'name' => 'kategoria',
|
||||
'id' => 'kategoria',
|
||||
'value' => $this -> collective_topic['kategoria'],
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?= \Html::input( [
|
||||
'label' => 'Kategoria ID',
|
||||
'name' => 'kategoria_id',
|
||||
'id' => 'kategoria_id',
|
||||
'value' => $this -> collective_topic['kategoria_id'],
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?= \Html::input( [
|
||||
'label' => 'Temat',
|
||||
'name' => 'temat_ogolny',
|
||||
'id' => 'temat_ogolny',
|
||||
'value' => $this -> collective_topic['temat_ogolny'],
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?= \Html::input( [
|
||||
'label' => 'Data przetworzenia',
|
||||
'name' => 'data_przetworzenia',
|
||||
'id' => 'data_przetworzenia',
|
||||
'value' => $this -> collective_topic['data_przetworzenia'],
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?= \Html::input_switch( [
|
||||
'label' => 'Przetworzony',
|
||||
'name' => 'przetworzony',
|
||||
'id' => 'przetworzony',
|
||||
'checked' => $this -> collective_topic['przetworzony'] == 1 ? true : false,
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?
|
||||
$out = ob_get_clean();
|
||||
|
||||
$grid = new \gridEdit;
|
||||
$grid -> id = 'client-edit';
|
||||
$grid -> gdb_opt = $gdb;
|
||||
$grid -> include_plugins = true;
|
||||
$grid -> title = 'Edycja <strong>tematu zbiorowego</strong>';
|
||||
$grid -> fields = [
|
||||
[
|
||||
'db' => 'id',
|
||||
'type' => 'hidden',
|
||||
'value' => $this -> collective_topic['id']
|
||||
]
|
||||
];
|
||||
$grid -> external_code = $out;
|
||||
$grid -> actions = [
|
||||
'save' => [ 'url' => '/backend_sites/collective_topic_save/', 'back_url' => '/backend_sites/collective_topics/' ],
|
||||
'cancel' => [ 'url' => '/backend_sites/collective_topics/' ]
|
||||
];
|
||||
$grid -> persist_edit = true;
|
||||
$grid -> id_param = 'id';
|
||||
echo $grid -> draw();
|
||||
?>
|
||||
58
templates/backend_sites/collective_topics.php
Normal file
58
templates/backend_sites/collective_topics.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php global $gdb;?>
|
||||
<div class="block-header">
|
||||
<h2>Lista <strong>tematów ogólnych </strong></h2>
|
||||
</div>
|
||||
<?php
|
||||
$grid = new \grid( 'zaplecze_tematy_zbiorcze' );
|
||||
$grid -> debug = true;
|
||||
$grid -> gdb_opt = $gdb;
|
||||
$grid -> order = [ 'column' => 'przetworzony', 'type' => 'ASC' ];
|
||||
$grid -> columns_view = [
|
||||
[
|
||||
'name' => 'Lp.',
|
||||
'th' => [ 'class' => 'g-lp', 'style' => 'width: 75px' ],
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'autoincrement' => true
|
||||
], [
|
||||
'name' => 'Strona',
|
||||
'db' => 'strona'
|
||||
], [
|
||||
'name' => 'Kategoria',
|
||||
'db' => 'kategoria',
|
||||
], [
|
||||
'name' => 'Kategoria ID',
|
||||
'db' => 'kategoria_id',
|
||||
], [
|
||||
'name' => 'Temat',
|
||||
'db' => 'temat_ogolny',
|
||||
], [
|
||||
'name' => 'Data przetworzenia',
|
||||
'db' => 'data_przetworzenia',
|
||||
], [
|
||||
'name' => 'Przetworzony',
|
||||
'db' => 'przetworzony',
|
||||
'php' => 'echo ( (int)[przetworzony] == 1 ) ? "tak" : "nie";',
|
||||
], [
|
||||
'name' => 'Edytuj',
|
||||
'action' => [ 'type' => 'edit', 'url' => '/backend_sites/collective_topic_edit/id=[id]' ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
|
||||
'td' => [ 'class' => 'g-center' ]
|
||||
], [
|
||||
'name' => 'Usuń',
|
||||
'action' => [ 'type' => 'delete', 'url' => '/backend_sites/collective_topic_delete/id=[id]' ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
|
||||
'td' => [ 'class' => 'g-center' ]
|
||||
]
|
||||
];
|
||||
$grid -> buttons = [
|
||||
[
|
||||
'label' => 'Dodaj temat ogólny',
|
||||
'url' => '/backend_sites/collective_topic_edit/',
|
||||
'icon' => 'fa-plus-circle',
|
||||
'class' => 'btn-success'
|
||||
]
|
||||
];
|
||||
$grid -> hide_columns = false;
|
||||
$grid -> limit = 25;
|
||||
echo $grid -> draw();
|
||||
?>
|
||||
84
templates/backend_sites/topic_edit.php
Normal file
84
templates/backend_sites/topic_edit.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?
|
||||
global $db;
|
||||
ob_start();
|
||||
?>
|
||||
<?= \Html::input( [
|
||||
'label' => 'Strona',
|
||||
'name' => 'strona',
|
||||
'id' => 'strona',
|
||||
'value' => $this -> topic['strona'],
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?= \Html::input( [
|
||||
'label' => 'Kategoria',
|
||||
'name' => 'kategoria',
|
||||
'id' => 'kategoria',
|
||||
'value' => $this -> topic['kategoria'],
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?= \Html::input( [
|
||||
'label' => 'Kategoria ID',
|
||||
'name' => 'kategoria_id',
|
||||
'id' => 'kategoria_id',
|
||||
'value' => $this -> topic['kategoria_id'],
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?= \Html::input( [
|
||||
'label' => 'Link',
|
||||
'name' => 'link',
|
||||
'id' => 'link',
|
||||
'value' => $this -> topic['link'],
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?= \Html::input( [
|
||||
'label' => 'Temat',
|
||||
'name' => 'temat',
|
||||
'id' => 'temat',
|
||||
'value' => $this -> topic['temat'],
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?= \Html::input( [
|
||||
'label' => 'Data publikacji',
|
||||
'name' => 'data_publikacji',
|
||||
'id' => 'data_publikacji',
|
||||
'value' => $this -> topic['data_publikacji'],
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?= \Html::input_switch( [
|
||||
'label' => 'Opublikowany',
|
||||
'name' => 'opublikowany',
|
||||
'id' => 'opublikowany',
|
||||
'checked' => $this -> topic['opublikowany'] == 1 ? true : false,
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?= \Html::input_switch( [
|
||||
'label' => 'Zaakceptowany',
|
||||
'name' => 'zaakceptowany',
|
||||
'id' => 'zaakceptowany',
|
||||
'checked' => $this -> topic['zaakceptowany'] == 1 ? true : false,
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?
|
||||
$out = ob_get_clean();
|
||||
|
||||
$grid = new \gridEdit;
|
||||
$grid -> id = 'client-edit';
|
||||
$grid -> gdb_opt = $gdb;
|
||||
$grid -> include_plugins = true;
|
||||
$grid -> title = 'Edycja <strong>tematu zbiorowego</strong>';
|
||||
$grid -> fields = [
|
||||
[
|
||||
'db' => 'id',
|
||||
'type' => 'hidden',
|
||||
'value' => $this -> topic['id']
|
||||
]
|
||||
];
|
||||
$grid -> external_code = $out;
|
||||
$grid -> actions = [
|
||||
'save' => [ 'url' => '/backend_sites/topic_save/', 'back_url' => '/backend_sites/topics/' ],
|
||||
'cancel' => [ 'url' => '/backend_sites/topics/' ]
|
||||
];
|
||||
$grid -> persist_edit = true;
|
||||
$grid -> id_param = 'id';
|
||||
echo $grid -> draw();
|
||||
?>
|
||||
72
templates/backend_sites/topics.php
Normal file
72
templates/backend_sites/topics.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php global $gdb;?>
|
||||
<div class="block-header">
|
||||
<h2>Lista <strong>tematów</strong></h2>
|
||||
</div>
|
||||
<?php
|
||||
$grid = new \grid( 'zaplecze_tematy' );
|
||||
$grid -> debug = true;
|
||||
$grid -> gdb_opt = $gdb;
|
||||
$grid -> order = [ 'column' => 'data_publikacji', 'type' => 'DESC' ];
|
||||
$grid -> search = [
|
||||
[ 'name' => 'zaakceptowany', 'db' => 'zaakceptowany', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ],
|
||||
];
|
||||
$grid -> columns_view = [
|
||||
[
|
||||
'name' => 'Lp.',
|
||||
'th' => [ 'class' => 'g-lp', 'style' => 'width: 75px' ],
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'autoincrement' => true
|
||||
], [
|
||||
'name' => 'Strona',
|
||||
'db' => 'strona'
|
||||
], [
|
||||
'name' => 'Kategoria',
|
||||
'db' => 'kategoria',
|
||||
], [
|
||||
'name' => 'Kategoria ID',
|
||||
'db' => 'kategoria_id',
|
||||
], [
|
||||
'name' => 'Link',
|
||||
'db' => 'link',
|
||||
], [
|
||||
'name' => 'Temat',
|
||||
'db' => 'temat',
|
||||
], [
|
||||
'name' => 'Data publikacji',
|
||||
'db' => 'data_publikacji',
|
||||
], [
|
||||
'name' => 'Opublikowany',
|
||||
'db' => 'opublikowany',
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
|
||||
'php' => 'echo ( (int)[opublikowany] == 1 ) ? "tak" : "<span class=\"text-danger\">nie</span>";',
|
||||
], [
|
||||
'name' => 'Zaakceptowany',
|
||||
'db' => 'zaakceptowany',
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
|
||||
'php' => 'echo ( (int)[zaakceptowany] == 1 ) ? "<a href=\"/backend_sites/topic_unaccept/id=[id]\">tak</a>" : "<a href=\"/backend_sites/topic_accept/id=[id]\" class=\"text-danger\">nie</a>";',
|
||||
], [
|
||||
'name' => 'Edytuj',
|
||||
'action' => [ 'type' => 'edit', 'url' => '/backend_sites/topic_edit/id=[id]' ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
|
||||
'td' => [ 'class' => 'g-center' ]
|
||||
], [
|
||||
'name' => 'Usuń',
|
||||
'action' => [ 'type' => 'delete', 'url' => '/backend_sites/topic_delete/id=[id]' ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
|
||||
'td' => [ 'class' => 'g-center' ]
|
||||
]
|
||||
];
|
||||
$grid -> buttons = [
|
||||
[
|
||||
'label' => 'Dodaj temat ogólny',
|
||||
'url' => '/backend_sites/topic_edit/',
|
||||
'icon' => 'fa-plus-circle',
|
||||
'class' => 'btn-success'
|
||||
]
|
||||
];
|
||||
$grid -> hide_columns = false;
|
||||
$grid -> limit = 10;
|
||||
echo $grid -> draw();
|
||||
?>
|
||||
Reference in New Issue
Block a user