mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-05-15 12:36:26 +02:00
Update all models to use StandardModel basis
This commit is contained in:
parent
0e22f3d02c
commit
155a048834
17 changed files with 580 additions and 1478 deletions
controllers/internals
Binary file not shown.
|
@ -1,140 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of RaspiSMS.
|
||||
*
|
||||
* (c) Pierre-Lin Bonnemaison <plebwebsas@gmail.com>
|
||||
*
|
||||
* This source file is subject to the GPL-3.0 license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
namespace controllers\internals;
|
||||
|
||||
/**
|
||||
* Classe des transfers.
|
||||
*/
|
||||
class Transfer extends \descartes\InternalController
|
||||
{
|
||||
private $model_transfer;
|
||||
private $internal_event;
|
||||
|
||||
public function __construct(\PDO $bdd)
|
||||
{
|
||||
$this->model_transfer = new \models\Transfer($bdd);
|
||||
$this->internal_event = new \controllers\internals\Event($bdd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of transfers as an array.
|
||||
*
|
||||
* @param mixed(int|bool) $nb_entry : Le nombre d'entrées à retourner par page
|
||||
* @param mixed(int|bool) $page : Le numéro de page en cours
|
||||
*
|
||||
* @return array : La liste des transfers
|
||||
*/
|
||||
public function list($nb_entry = null, $page = null)
|
||||
{
|
||||
return $this->model_transfer->list($nb_entry, $nb_entry * $page);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all transfers.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_all()
|
||||
{
|
||||
//Recupération des transfers
|
||||
return $this->model_transfer->get_all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get transfers not in progress.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_not_in_progress()
|
||||
{
|
||||
return $this->model_transfer->get_not_in_progress();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cette fonction retourne une liste des transfers sous forme d'un tableau.
|
||||
*
|
||||
* @param array int $ids : Les ids des entrées à retourner
|
||||
*
|
||||
* @return array : La liste des transfers
|
||||
*/
|
||||
public function gets($ids)
|
||||
{
|
||||
//Recupération des transfers
|
||||
return $this->model_transfer->gets($ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cette fonction permet de compter le nombre de scheduleds.
|
||||
*
|
||||
* @return int : Le nombre d'entrées dans la table
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return $this->model_transfer->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cette fonction va supprimer un transfer.
|
||||
*
|
||||
* @param array $id : L'id de la transfer à supprimer
|
||||
*
|
||||
* @return int : Le nombre de transfers supprimées;
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
return $this->model_transfer->delete($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function insert a new transfer.
|
||||
*
|
||||
* @param int $id_received : Id of the received message to transfer
|
||||
* @param bool $progress : If we must mark it as in progress
|
||||
*
|
||||
* @return int id of the new inserted transfer
|
||||
*/
|
||||
public function create($id_received, $progress = false)
|
||||
{
|
||||
$transfer = [
|
||||
'id_received' => $id_received,
|
||||
'progress' => $progress,
|
||||
];
|
||||
|
||||
$result = $this->model_transfer->insert($transfer);
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cette fonction met à jour un transfer.
|
||||
*
|
||||
* @param int $id
|
||||
* @param int $id_received
|
||||
* @param bool $progress
|
||||
*
|
||||
* @return int : le nombre de ligne modifiées
|
||||
*/
|
||||
public function update($id, $id_received, $progress)
|
||||
{
|
||||
$transfer = [
|
||||
'id_received' => $id_received,
|
||||
'progress' => $progress,
|
||||
];
|
||||
|
||||
return $this->model_transfer->update($id, $transfer);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue