<?php
/*
 * Gasell: Copyright 2005 Linux-Nantes Association <contact@linux-nantes.fr.eu.org>
 *
 * You should have received a copy of the GNU Public
 * License along with this package; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Authors: Raude-Morvan Damien (DrazziB) <drazzib@drazzib.com>
 *
 * Histoire
 *  * 09/07/02005 DrazziB : Création de l'action
 */

/**
 * Recuperation de la liste des participations
 *
 * @param integer $args['activity'] : Si ce parametre est present, on recupere l'ensemble
 * des participations liees a l'activite qui possede ce code.
 *
 * @param integer $args['personne'] : Si ce parametre est present, on recupere l'ensemble
 * des participations liees a la personne qui possede ce code.
 *
 * @return array participation[]
 */

require_once GASELL_BASE . '/lib/Personne.php';
require_once GASELL_BASE . '/lib/Activite.php';
require_once GASELL_BASE . '/lib/Participation.php';

if (isset($args['activity']))
 {
	/* On recupere les participations pour l'activite dont le code = activity */
	$result = Participation::ListParticipationForActivity($args['activity']);
 }
else if (isset($args['personne']) || isset($args['adhesion']))
 {
	/* Si la valeur n'est pas defini => NULL */
	if (!isset($args['adhesion']))
	{
		$args['adhesion'] = NULL;
	}

	/* Si la valeur n'est pas defini => NULL */
	if (!isset($args['personne']))
	{
		$args['personne'] = NULL;
	}

	/* On recupere les participations pour la personne et ses adhesions */
	$result = Participation::ListParticipationForAdhesionAndPersonne($args['adhesion'], $args['personne']);
 }
else
 {
	/* On recupere toutes les participations */
	$result = Participation::ListParticipation();
 }

?>