fix pagination

This commit is contained in:
osaajani 2020-01-06 13:51:02 +01:00
parent ac64fe9d2d
commit 2671c464a4
7 changed files with 15 additions and 31 deletions

View File

@ -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

View File

@ -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;

View File

@ -114,6 +114,8 @@ class Server extends AbstractDaemon
];
msg_send($queue, SEND_MSG, $msg);
$internal_scheduled->delete($sms['id_scheduled']);
}
return $queues;

View File

@ -73,13 +73,13 @@
<?php } ?>
<ul class="pager">
<?php if ($page) { ?>
<li><a href="<?php echo \descartes\Router::url('events', 'showAll', array('page' => $page - 1)); ?>"><span aria-hidden="true">&larr;</span> Précèdents</a></li>
<li><a href="<?php echo \descartes\Router::url('Event', 'list', array('page' => $page - 1)); ?>"><span aria-hidden="true">&larr;</span> Précèdents</a></li>
<?php } ?>
Page : <?php $this->s($page + 1); ?>
<?php if ($limit == $nb_results) { ?>
<li><a href="<?php echo \descartes\Router::url('events', 'showAll', array('page' => $page + 1)); ?>">Suivants <span aria-hidden="true">&rarr;</span></a></li>
<li><a href="<?php echo \descartes\Router::url('Event', 'list', array('page' => $page + 1)); ?>">Suivants <span aria-hidden="true">&rarr;</span></a></li>
<?php } ?>
</ul>
</div>

View File

@ -77,12 +77,12 @@
<?php } ?>
<ul class="pager">
<?php if ($page) { ?>
<li><a href="<?php echo \descartes\Router::url('receiveds', 'showAll', array('page' => $page - 1)); ?>"><span aria-hidden="true">&larr;</span> Précèdents</a></li>
<li><a href="<?php echo \descartes\Router::url('Received', 'list', array('page' => $page - 1)); ?>"><span aria-hidden="true">&larr;</span> Précèdents</a></li>
<?php } ?>
<?php $this->s('Page : ' . ($page + 1)); ?>
<?php if ($limit == $nb_results) { ?>
<li><a href="<?php echo \descartes\Router::url('receiveds', 'showAll', array('page' => $page + 1)); ?>">Suivants <span aria-hidden="true">&rarr;</span></a></li>
<li><a href="<?php echo \descartes\Router::url('Received', 'list', array('page' => $page + 1)); ?>">Suivants <span aria-hidden="true">&rarr;</span></a></li>
<?php } ?>
</ul>
</div>

View File

@ -93,7 +93,7 @@
Page : <?php $this->s($page + 1); ?>
<?php if ($limit == $nb_results) { ?>
<li><a href="<?php echo \descartes\Router::url('sendeds', 'showAll', array('page' => $page + 1)); ?>">Suivants <span aria-hidden="true">&rarr;</span></a></li>
<li><a href="<?php echo \descartes\Router::url('Sended', 'list', array('page' => $page + 1)); ?>">Suivants <span aria-hidden="true">&rarr;</span></a></li>
<?php } ?>
</ul>
</div>

View File

@ -69,12 +69,12 @@
<?php } ?>
<ul class="pager">
<?php if ($page) { ?>
<li><a href="<?php echo \descartes\Router::url('smsstop', 'showAll', array('page' => $page - 1)); ?>"><span aria-hidden="true">&larr;</span> Précèdents</a></li>
<li><a href="<?php echo \descartes\Router::url('SmsStop', 'list', array('page' => $page - 1)); ?>"><span aria-hidden="true">&larr;</span> Précèdents</a></li>
<?php } ?>
<?php $this->s('Page : ' . ($page + 1)); ?>
<?php if ($limit == $nb_results) { ?>
<li><a href="<?php echo \descartes\Router::url('smsstop', 'showAll', array('page' => $page + 1)); ?>">Suivants <span aria-hidden="true">&rarr;</span></a></li>
<li><a href="<?php echo \descartes\Router::url('SmsStop', 'list', array('page' => $page + 1)); ?>">Suivants <span aria-hidden="true">&rarr;</span></a></li>
<?php } ?>
</ul>
</div>