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:
82
autoload/controls/class.BackendSites.php
Normal file
82
autoload/controls/class.BackendSites.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?
|
||||
namespace controls;
|
||||
class BackendSites
|
||||
{
|
||||
static public function topic_accept()
|
||||
{
|
||||
if ( \factory\BackendSites::topic_accept( \S::get( 'id' ) ) )
|
||||
{
|
||||
\S::alert( 'Temat został zaakceptowany' );
|
||||
header( 'Location: /backend_sites/topics/' );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
static public function topic_unaccept()
|
||||
{
|
||||
if ( \factory\BackendSites::topic_unaccept( \S::get( 'id' ) ) )
|
||||
{
|
||||
\S::alert( 'Temat został odrzucony' );
|
||||
header( 'Location: /backend_sites/topics/' );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
static public function topic_save()
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania klienta wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
$id = \factory\BackendSites::topic_save(
|
||||
(int)$values[ 'id' ], $values[ 'strona' ], $values[ 'kategoria' ], $values[ 'kategoria_id' ], $values[ 'temat' ], $values[ 'data_publikacji' ], $values[ 'opublikowany' ], $values[ 'zaakceptowany' ]
|
||||
);
|
||||
|
||||
if ( $id )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Projekt został zapisany.', 'id' => $id ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
static public function topic_edit()
|
||||
{
|
||||
return \Tpl::view( 'backend_sites/topic_edit', [
|
||||
'topic' => \factory\BackendSites::topic( (int)\S::get( 'id' ) )
|
||||
] );
|
||||
}
|
||||
|
||||
static public function topics()
|
||||
{
|
||||
return \Tpl::view( 'backend_sites/topics' );
|
||||
}
|
||||
|
||||
static public function collective_topics()
|
||||
{
|
||||
return \Tpl::view( 'backend_sites/collective_topics' );
|
||||
}
|
||||
|
||||
static public function collective_topic_edit()
|
||||
{
|
||||
return \Tpl::view( 'backend_sites/collective_topic_edit',[
|
||||
'collective_topic' => \factory\BackendSites::collective_topic( \S::get( 'id' ) ),
|
||||
] );
|
||||
}
|
||||
|
||||
static public function collective_topic_save()
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania klienta wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
$id = \factory\BackendSites::collective_topic_save(
|
||||
(int)$values[ 'id' ], $values[ 'strona' ], $values[ 'kategoria' ], $values[ 'kategoria_id' ], $values[ 'temat_ogolny' ], $values[ 'data_przetworzenia' ], $values[ 'przetworzony' ]
|
||||
);
|
||||
|
||||
if ( $id )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Projekt został zapisany.', 'id' => $id ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user