feat: Implement topic deletion functionality in BackendSites and update task query conditions

This commit is contained in:
2025-05-10 23:33:38 +02:00
parent 74cd615233
commit 3c1bc9af66
5 changed files with 29 additions and 7 deletions

View File

@@ -458,8 +458,8 @@
},
"task_edit.php": {
"type": "-",
"size": 9233,
"lmtime": 1746650179260,
"size": 9314,
"lmtime": 1746733898990,
"modified": false
},
"task_popup.php": {

View File

@@ -11,7 +11,7 @@ class Cron
. 'FROM '
. 'tasks AS t '
. 'WHERE '
. 'recursively = 1 AND deleted = 0 AND ( status = 1 OR status = 2 OR status = 3 ) AND date_end IS NOT NULL AND date_end < \'' . date( 'Y-m-d', strtotime( '+366 days', time() ) ) . '\' '
. 'recursively = 1 AND deleted = 0 AND status = 2 AND date_end IS NOT NULL AND date_end < \'' . date( 'Y-m-d', strtotime( '+60 days', time() ) ) . '\' '
. 'HAVING quantity = 0 ORDER BY date_end ASC' ) -> fetchAll( \PDO::FETCH_ASSOC );
if ( is_array( $results ) and count( $results ) )
{
@@ -87,10 +87,7 @@ class Cron
$days_reminder = explode( ',', $row['reminders_interval'] );
$max_days_reminder = max( $days_reminder );
if ( $row['status'] != 2 )
$status = $row['status'];
else
$status = 0;
$status = 0;
$task_users = $mdb -> select( 'task_user', 'user_id', ['task_id' => $row['id']] );

View File

@@ -2,6 +2,22 @@
namespace controls;
class BackendSites
{
static public function topic_delete()
{
if ( \factory\BackendSites::topic_delete( \S::get( 'id' ) ) )
{
\S::alert( 'Temat został usunięty' );
header( 'Location: /backend_sites/topics/' );
exit;
}
else
{
\S::alert( 'Nie można usunąć tematu' );
header( 'Location: /backend_sites/topics/' );
exit;
}
}
static public function topic_accept()
{
if ( \factory\BackendSites::topic_accept( \S::get( 'id' ) ) )

View File

@@ -2,6 +2,13 @@
namespace factory;
class BackendSites
{
// topic_delete
static public function topic_delete( $id )
{
global $mdb;
return $mdb -> delete( 'zaplecze_tematy', [ 'id' => $id ] );
}
static public function topic_unaccept( $id )
{
global $mdb;

View File

@@ -401,6 +401,8 @@
var users = jQuery( 'input[name="users"]:checked' ).map(function() {
return this.value;
}).get();
// close popup
$( '.task_popup' ).empty().hide();
reload_tasks( projects, users );
}
}