mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-21 08:56:27 +02:00
few coderules changes
This commit is contained in:
parent
80b6a3ed86
commit
117c18ddca
28 changed files with 1485 additions and 1666 deletions
|
@ -1,40 +1,41 @@
|
|||
<?php
|
||||
namespace controllers\internals;
|
||||
/**
|
||||
* Classe des commandes
|
||||
*/
|
||||
class Command extends \InternalController
|
||||
{
|
||||
|
||||
/**
|
||||
* Classe des commandes
|
||||
*/
|
||||
class Command extends \descartes\InternalController
|
||||
{
|
||||
private $model_command;
|
||||
|
||||
public function __construct (\PDO $bdd)
|
||||
public function __construct(\PDO $bdd)
|
||||
{
|
||||
$this->model_command = new \models\Command($bdd);
|
||||
$this->internal_event = new \controllers\internals\Event($bdd);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Return the list of commands 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 commandes
|
||||
*/
|
||||
public function list ($nb_entry = false, $page = false)
|
||||
{
|
||||
//Recupération des commandes
|
||||
*/
|
||||
public function list($nb_entry = false, $page = false)
|
||||
{
|
||||
//Recupération des commandes
|
||||
$model_command = new \models\Command($this->bdd);
|
||||
return $model_command->list($nb_entry, $nb_entry * $page);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Cette fonction retourne une liste des commandes sous forme d'un tableau
|
||||
* @param array int $ids : Les ids des entrées à retourner
|
||||
* @return array : La liste des commandes
|
||||
*/
|
||||
public function get_by_ids ($ids)
|
||||
{
|
||||
//Recupération des commandes
|
||||
*/
|
||||
public function get_by_ids($ids)
|
||||
{
|
||||
//Recupération des commandes
|
||||
$modelCommand = new \models\Command($this->bdd);
|
||||
return $modelCommand->get_by_ids($ids);
|
||||
}
|
||||
|
@ -43,29 +44,29 @@ namespace controllers\internals;
|
|||
* Cette fonction permet de compter le nombre de scheduleds
|
||||
* @return int : Le nombre d'entrées dans la table
|
||||
*/
|
||||
public function count ()
|
||||
public function count()
|
||||
{
|
||||
$modelCommand = new \models\Command($this->bdd);
|
||||
return $modelCommand->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cette fonction va supprimer une commande
|
||||
* @param array $id : L'id de la commande à supprimer
|
||||
* @return int : Le nombre de commandes supprimées;
|
||||
*/
|
||||
public function delete ($id)
|
||||
/**
|
||||
* Cette fonction va supprimer une commande
|
||||
* @param array $id : L'id de la commande à supprimer
|
||||
* @return int : Le nombre de commandes supprimées;
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
$modelCommand = new \models\Command($this->bdd);
|
||||
return $modelCommand->delete_by_id($id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Cette fonction insert une nouvelle commande
|
||||
* @param array $command : La commande à insérer
|
||||
* @return mixed bool|int : false si echec, sinon l'id de la nouvelle commande insérée
|
||||
*/
|
||||
public function create ($name, $script, $admin)
|
||||
*/
|
||||
public function create($name, $script, $admin)
|
||||
{
|
||||
$command = [
|
||||
'name' => $name,
|
||||
|
@ -76,21 +77,20 @@ namespace controllers\internals;
|
|||
$modelCommand = new \models\Command($this->bdd);
|
||||
$result = $modelCommand->insert($command);
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
if (!$result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$internalEvent = new \controllers\internals\Event($this->bdd);
|
||||
$internalEvent = new \controllers\internals\Event($this->bdd);
|
||||
$internalEvent->create('COMMAND_ADD', 'Ajout commande : ' . $name . ' => ' . $script);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Cette fonction met à jour un commande
|
||||
* @return int : le nombre de ligne modifiées
|
||||
*/
|
||||
public function update ($id, $name, $script, $admin)
|
||||
*/
|
||||
public function update($id, $name, $script, $admin)
|
||||
{
|
||||
$modelCommand = new \models\Command($this->bdd);
|
||||
|
||||
|
@ -104,4 +104,4 @@ namespace controllers\internals;
|
|||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue