list contacts with extended infos

This commit is contained in:
Romain Guerrero 2016-02-05 22:26:50 +01:00
parent 0072a8b2f8
commit e3a2dc29df
2 changed files with 34 additions and 12 deletions

View File

@ -5,7 +5,7 @@
class contacts extends Controller
{
/**
* Cette fonction est appelée avant toute les autres :
* Cette fonction est appelée avant toute les autres :
* Elle vérifie que l'utilisateur est bien connecté
* @return void;
*/
@ -16,14 +16,18 @@
/**
* Cette fonction retourne tous les contacts, sous forme d'un tableau permettant l'administration de ces contacts
*/
*/
public function byDefault()
{
//Creation de l'object de base de données
global $db;
//Recupération des nombres des 4 panneaux d'accueil
$contacts = $db->getFromTableWhere('contacts');
$contacts = $db->getFromTableWhere('contacts', array(), '', false, false, false, array(array(
'table' => 'contacts_infos',
'type' => 'LEFT',
'on' => 'contacts_infos.id_contact = contacts.id'
)));
$this->render('contacts/default', array(
'contacts' => $contacts,
@ -52,7 +56,7 @@
//Create de l'object de base de données
global $db;
$db->deleteContactsIn($ids);
header('Location: ' . $this->generateUrl('contacts'));
return true;
@ -76,7 +80,7 @@
//On récupère les ids comme étant tous les arguments de la fonction
$ids = func_get_args();
$contacts = $db->getContactsIn($ids);
$this->render('contacts/edit', array(
'contacts' => $contacts,
@ -180,7 +184,7 @@
public function jsonGetContacts()
{
global $db;
echo json_encode($db->getFromTableWhere('contacts'));
}
}

View File

@ -39,8 +39,17 @@
<thead>
<tr>
<th>#</th>
<th>Nom</th>
<th>Numéro</th>
<?php if (RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS) { ?>
<th>Civilité</th>
<th>Prénom</th>
<th>Nom</th>
<th>Numéro</th>
<th>Date de naissance</th>
<th>Situation</th>
<?php } else { ?>
<th>Nom</th>
<th>Numéro</th>
<?php } ?>
<th style="width:5%;">Sélectionner</th>
</tr>
</thead>
@ -51,8 +60,17 @@
?>
<tr>
<td><?php secho($contact['id']); ?></td>
<td><?php secho($contact['name']); ?></td>
<td><?php secho($contact['number']); ?></td>
<?php if (RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS) { ?>
<td><?php secho($contact['civility']); ?></td>
<td><?php secho($contact['first_name']); ?></td>
<td><?php secho($contact['last_name'] ? $contact['last_name'] : $contact['name']); ?></td>
<td><?php secho($contact['number']); ?></td>
<td><?php secho($contact['birthday']); ?></td>
<td><?php secho($contact['love_situation']); ?></td>
<?php } else { ?>
<td><?php secho($contact['name']); ?></td>
<td><?php secho($contact['number']); ?></td>
<?php } ?>
<td><input type="checkbox" value="<?php secho($contact['id']); ?>"></td>
</tr>
<?php
@ -66,7 +84,7 @@
<a class="btn btn-success" href="<?php echo $this->generateUrl('contacts', 'add'); ?>"><span class="fa fa-plus"></span> Ajouter un contact</a>
</div>
<div class="text-right col-xs-6 no-padding">
<strong>Action groupée :</strong>
<strong>Action groupée :</strong>
<div class="btn-group action-dropdown" target="#table-contacts">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Action pour la sélection <span class="caret"></span></button>
<ul class="dropdown-menu pull-right" role="menu">