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:
84
autoload/factory/class.BackendSites.php
Normal file
84
autoload/factory/class.BackendSites.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?
|
||||
namespace factory;
|
||||
class BackendSites
|
||||
{
|
||||
static public function topic_unaccept( $id )
|
||||
{
|
||||
global $mdb;
|
||||
return $mdb -> update( 'zaplecze_tematy', [ 'zaakceptowany' => 0 ], [ 'id' => $id ] );
|
||||
}
|
||||
|
||||
static public function topic_accept( $id)
|
||||
{
|
||||
global $mdb;
|
||||
return $mdb -> update( 'zaplecze_tematy', [ 'zaakceptowany' => 1 ], [ 'id' => $id ] );
|
||||
}
|
||||
|
||||
static public function topic_save( $id, $strona, $kategoria, $kategoria_id, $temat, $data_publikacji, $opublikowany, $zaakceptowany )
|
||||
{
|
||||
global $mdb;
|
||||
if ( !$id )
|
||||
{
|
||||
return $mdb -> insert( 'zaplecze_tematy', [
|
||||
'strona' => $strona,
|
||||
'kategoria' => $kategoria,
|
||||
'kategoria_id' => $kategoria_id,
|
||||
'temat' => $temat,
|
||||
'data_publikacji' => $data_publikacji,
|
||||
'opublikowany' => $opublikowany == 'on' ? 1 : 0,
|
||||
'zaakceptowany' => $zaakceptowany == 'on' ? 1 : 0,
|
||||
] );
|
||||
}
|
||||
else
|
||||
{
|
||||
return $mdb -> update( 'zaplecze_tematy', [
|
||||
'strona' => $strona,
|
||||
'kategoria' => $kategoria,
|
||||
'kategoria_id' => $kategoria_id,
|
||||
'temat' => $temat,
|
||||
'data_publikacji' => $data_publikacji,
|
||||
'opublikowany' => $opublikowany == 'on' ? 1 : 0,
|
||||
'zaakceptowany' => $zaakceptowany == 'on' ? 1 : 0,
|
||||
], [ 'id' => $id ] );
|
||||
}
|
||||
}
|
||||
|
||||
static public function topic( $id = 0 )
|
||||
{
|
||||
global $mdb;
|
||||
return $mdb -> get( 'zaplecze_tematy', '*', [ 'id' => $id ] );
|
||||
}
|
||||
|
||||
static public function collective_topic( $id = 0 )
|
||||
{
|
||||
global $mdb;
|
||||
return $mdb -> get( 'zaplecze_tematy_zbiorcze', '*', [ 'id' => $id ] );
|
||||
}
|
||||
|
||||
static public function collective_topic_save( $id, $strona, $kategoria, $kategoria_id, $temat_ogolny, $data_przetworzenia, $przetworzony )
|
||||
{
|
||||
global $mdb;
|
||||
if ( !$id )
|
||||
{
|
||||
return $mdb -> insert( 'zaplecze_tematy_zbiorcze', [
|
||||
'strona' => $strona,
|
||||
'kategoria' => $kategoria,
|
||||
'kategoria_id' => $kategoria_id,
|
||||
'temat_ogolny' => $temat_ogolny,
|
||||
'data_przetworzenia' => $data_przetworzenia,
|
||||
'przetworzony' => $przetworzony == 'on' ? 1 : 0,
|
||||
] );
|
||||
}
|
||||
else
|
||||
{
|
||||
return $mdb -> update( 'zaplecze_tematy_zbiorcze', [
|
||||
'strona' => $strona,
|
||||
'kategoria' => $kategoria,
|
||||
'kategoria_id' => $kategoria_id,
|
||||
'temat_ogolny' => $temat_ogolny,
|
||||
'data_przetworzenia' => $data_przetworzenia,
|
||||
'przetworzony' => $przetworzony == 'on' ? 1 : 0,
|
||||
], [ 'id' => $id ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user