fix pagination
This commit is contained in:
parent
ac64fe9d2d
commit
2671c464a4
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -114,6 +114,8 @@ class Server extends AbstractDaemon
|
|||
];
|
||||
|
||||
msg_send($queue, SEND_MSG, $msg);
|
||||
|
||||
$internal_scheduled->delete($sms['id_scheduled']);
|
||||
}
|
||||
|
||||
return $queues;
|
||||
|
|
|
@ -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">←</span> Précèdents</a></li>
|
||||
<li><a href="<?php echo \descartes\Router::url('Event', 'list', array('page' => $page - 1)); ?>"><span aria-hidden="true">←</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">→</span></a></li>
|
||||
<li><a href="<?php echo \descartes\Router::url('Event', 'list', array('page' => $page + 1)); ?>">Suivants <span aria-hidden="true">→</span></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -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">←</span> Précèdents</a></li>
|
||||
<li><a href="<?php echo \descartes\Router::url('Received', 'list', array('page' => $page - 1)); ?>"><span aria-hidden="true">←</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">→</span></a></li>
|
||||
<li><a href="<?php echo \descartes\Router::url('Received', 'list', array('page' => $page + 1)); ?>">Suivants <span aria-hidden="true">→</span></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -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">→</span></a></li>
|
||||
<li><a href="<?php echo \descartes\Router::url('Sended', 'list', array('page' => $page + 1)); ?>">Suivants <span aria-hidden="true">→</span></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -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">←</span> Précèdents</a></li>
|
||||
<li><a href="<?php echo \descartes\Router::url('SmsStop', 'list', array('page' => $page - 1)); ?>"><span aria-hidden="true">←</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">→</span></a></li>
|
||||
<li><a href="<?php echo \descartes\Router::url('SmsStop', 'list', array('page' => $page + 1)); ?>">Suivants <span aria-hidden="true">→</span></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue