mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
to keep
This commit is contained in:
parent
65dacb5302
commit
4c27d8ccf2
13 changed files with 121 additions and 137 deletions
|
@ -26,30 +26,37 @@ namespace controllers\internals;
|
|||
}
|
||||
|
||||
/**
|
||||
* Cette fonction retourne une liste des contactes sous forme d'un tableau.
|
||||
*
|
||||
* @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 contactes
|
||||
* List contacts for a user
|
||||
* @param int $id_user : user id
|
||||
* @param mixed(int|bool) $nb_entry : Number of entry to return
|
||||
* @param mixed(int|bool) $page : Pagination, will offset $nb_entry * $page results
|
||||
* @return array
|
||||
*/
|
||||
public function list($nb_entry = null, $page = null)
|
||||
public function list($id_user, $nb_entry = null, $page = null)
|
||||
{
|
||||
//Recupération des contactes
|
||||
return $this->model_contact->list($nb_entry, $nb_entry * $page);
|
||||
return $this->model_contact->list_for_user($id_user, $nb_entry, $nb_entry * $page);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a contact
|
||||
* @param $id : contact id
|
||||
* @return array
|
||||
*/
|
||||
public function get($id)
|
||||
{
|
||||
return $this->model_contact->get($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cette fonction retourne une liste des contactes sous forme d'un tableau.
|
||||
*
|
||||
* @param int $id_user : user id
|
||||
* @param array int $ids : Les ids des entrées à retourner
|
||||
*
|
||||
* @return array : La liste des contactes
|
||||
*/
|
||||
public function gets($ids)
|
||||
public function gets_for_user($id_user, $ids)
|
||||
{
|
||||
//Recupération des contactes
|
||||
return $this->model_contact->gets($ids);
|
||||
return $this->model_contact->gets_for_user($id_user, $ids);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,15 +123,16 @@ namespace controllers\internals;
|
|||
/**
|
||||
* Cette fonction insert une nouvelle contacte.
|
||||
*
|
||||
* @param array $contact : Un tableau représentant la contacte à insérer
|
||||
* @param int $id_user : user id
|
||||
* @param mixed $number
|
||||
* @param mixed $name
|
||||
*
|
||||
* @return mixed bool|int : false si echec, sinon l'id de la nouvelle contacte insérée
|
||||
*/
|
||||
public function create($number, $name)
|
||||
public function create($id_user, $number, $name)
|
||||
{
|
||||
$contact = [
|
||||
'id_user' => $id_user,
|
||||
'number' => $number,
|
||||
'name' => $name,
|
||||
];
|
||||
|
@ -135,7 +143,7 @@ namespace controllers\internals;
|
|||
return $result;
|
||||
}
|
||||
|
||||
$this->internal_event->create('CONTACT_ADD', 'Ajout contact : '.$name.' ('.\controllers\internals\Tool::phone_format($number).')');
|
||||
$this->internal_event->create($id_user, 'CONTACT_ADD', 'Ajout contact : '.$name.' ('.\controllers\internals\Tool::phone_format($number).')');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -144,14 +152,16 @@ namespace controllers\internals;
|
|||
* Cette fonction met à jour une série de contactes.
|
||||
*
|
||||
* @param mixed $id
|
||||
* @param int $id_user : user id
|
||||
* @param mixed $number
|
||||
* @param mixed $name
|
||||
*
|
||||
* @return int : le nombre de ligne modifiées
|
||||
*/
|
||||
public function update($id, $number, $name)
|
||||
public function update($id, $id_user, $number, $name)
|
||||
{
|
||||
$contact = [
|
||||
'id_user' => $id_user,
|
||||
'number' => $number,
|
||||
'name' => $name,
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue