From 2671c464a471550c141cab7650453463fde196ee Mon Sep 17 00:00:00 2001 From: osaajani Date: Mon, 6 Jan 2020 13:51:02 +0100 Subject: [PATCH] fix pagination --- controllers/internals/Scheduled.php | 21 --------------------- daemons/Phone.php | 9 ++++++--- daemons/Server.php | 2 ++ templates/event/list.php | 4 ++-- templates/received/list.php | 4 ++-- templates/sended/list.php | 2 +- templates/smsstop/list.php | 4 ++-- 7 files changed, 15 insertions(+), 31 deletions(-) diff --git a/controllers/internals/Scheduled.php b/controllers/internals/Scheduled.php index 121e133..f5cb6d2 100755 --- a/controllers/internals/Scheduled.php +++ b/controllers/internals/Scheduled.php @@ -377,27 +377,6 @@ namespace controllers\internals; } - /** - * Send a scheduled message - * @param int $id_scheduled : Id of the message to send - * @param string $text : Text of the message - * @param string $origin : Origin of the message - * @param string $destination : Destination of the message - * @param bool $flash : Is the message a flash sms - * return bool: false on error, true else - */ - public function send (int $id_scheduled, string $text, string $origin, string $destination, bool $flash) : bool - { - //TODO : Do the sending (càd, instanciate a phone adapter and send the message) - - $now = new \DateTime(); - $at = $now->format('Y-m-d H:i:s'); - $internal_sended = new \controllers\internals\Sended($this->bdd); - $this->delete($id_scheduled); - return $internal_sended->create($at, $text, $origin, $destination, $flash); - } - - /** * Return numbers for a scheduled message * @param int $id_scheduled : Scheduled id diff --git a/daemons/Phone.php b/daemons/Phone.php index 2dfc854..deb003a 100644 --- a/daemons/Phone.php +++ b/daemons/Phone.php @@ -66,10 +66,13 @@ class Phone extends AbstractDaemon //If message received, update last message time $this->last_message_at = microtime(true); - + + $now = new \DateTime(); + $at = $now->format('Y-m-d H:i:s'); + $bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8'); - $internal_scheduled = new \controllers\internals\Scheduled($bdd); - $internal_scheduled->send($message['id_scheduled'], $message['text'], $message['origin'], $message['destination'], $message['flash']); + $internal_sended = new \controllers\internals\Sended($bdd); + $internal_sended->create($at, $message['text'], $message['origin'], $message['destination'], $message['flash']); //Close bdd $bdd = null; diff --git a/daemons/Server.php b/daemons/Server.php index 76d933c..5cebdac 100644 --- a/daemons/Server.php +++ b/daemons/Server.php @@ -114,6 +114,8 @@ class Server extends AbstractDaemon ]; msg_send($queue, SEND_MSG, $msg); + + $internal_scheduled->delete($sms['id_scheduled']); } return $queues; diff --git a/templates/event/list.php b/templates/event/list.php index f2ff53f..cb4b41e 100755 --- a/templates/event/list.php +++ b/templates/event/list.php @@ -73,13 +73,13 @@ diff --git a/templates/received/list.php b/templates/received/list.php index d9a1d11..3b100d3 100755 --- a/templates/received/list.php +++ b/templates/received/list.php @@ -77,12 +77,12 @@ diff --git a/templates/sended/list.php b/templates/sended/list.php index f5f74dd..22d72b9 100755 --- a/templates/sended/list.php +++ b/templates/sended/list.php @@ -93,7 +93,7 @@ Page : s($page + 1); ?> -
  • Suivants
  • +
  • Suivants
  • diff --git a/templates/smsstop/list.php b/templates/smsstop/list.php index bdb98fe..7a32fcb 100755 --- a/templates/smsstop/list.php +++ b/templates/smsstop/list.php @@ -69,12 +69,12 @@