示例#1
0
function listeRaids(&$vueAgenda, $estAnimateur, $idUser)
{
    $arch = new Archiviste();
    $event = new Event();
    $inscritType = new EventInscrit();
    $inscrits;
    $nbDispo = 0;
    $nbValid = 0;
    $listeEvents = $arch->restituer($event);
    $eventsPertinents = array();
    $maintenant = time();
    foreach ($listeEvents as $event) {
        if (intval($event->get('date')) > $maintenant) {
            $inscritType->set('idEvent', $event->get('id'));
            $inscrits = $arch->restituer($inscritType);
            $event->set('monEtat', 'n');
            foreach ($inscrits as $inscrit) {
                if ($inscrit->get('etat') == 'v') {
                    $nbValid++;
                } else {
                    if ($inscrit->get('etat') == 'd') {
                        $nbDispo++;
                    }
                }
                if ($idUser == $inscrit->get('idUser')) {
                    $event->set('monEtat', $inscrit->get('etat'));
                }
            }
            $event->set('nbValid', $nbValid);
            $event->set('nbDispo', $nbDispo);
            $eventsPertinents[] = $event;
            $nbDispo = 0;
            $nbValid = 0;
        }
    }
    $eventsPertinents = $arch->trierNumCroissant($eventsPertinents, 'date');
    $vueAgenda->userPannel();
    if ($estAnimateur) {
        $vueAgenda->panneauCreerRaid();
    }
    $vueAgenda->listerRaid($eventsPertinents);
    $vueAgenda->panneauVoirRaidsAnciens();
}
示例#2
0
 public static function recupArticle($id)
 {
     $arch = new Archiviste(Commentaire::$dbSite);
     $article = new Archivable('Article');
     $article->set('id', $id);
     $articles = $arch->restituer($article);
     $retour = false;
     //si l'article est present dans la base de donnée
     if (count($articles) > 0) {
         $article = $articles[0];
         $commActif = $article->get('comment');
         $retour = array('statut' => 'ok');
         $retour['article'] = array('nom' => $article->get('nom'), 'code' => $article->get('code'), 'date' => $article->get('date'), 'idCateg' => $article->get('id_menu'), 'pageNews' => $article->get('pageNews'), 'commActif' => $commActif);
         $retour['coms'] = array();
         if ($commActif == "oui") {
             $commentaire = new Archivable('Commentaire');
             $commentaire->set('id_article', $id);
             $commentaires = $arch->restituer($commentaire);
             $commentaires = $arch->trierNumCroissant($commentaires, 'date');
             $nbCom = count($commentaires);
             for ($i = 0; $i < $nbCom; $i++) {
                 $retour['coms'][$i] = array('pseudo' => $commentaires[$i]->get('pseudo'), 'date' => $commentaires[$i]->get('date'), 'texte' => $commentaires[$i]->get('texte'));
             }
         }
     }
     return $retour;
 }
示例#3
0
function getComm()
{
    $retour = array('statut' => 'ok');
    $arch = new Archiviste('../../site/data/');
    $comm = new Archivable('Commentaire');
    $comms = $arch->restituer($comm);
    $comms = $arch->trierNumCroissant($comms, 'date');
    $nbComms = count($comms);
    $retour['commentaire'] = array();
    for ($i = 0; $i < $nbComms; $i++) {
        $retour['commentaire'][$i] = array('id' => $comms[$i]->get('id'), 'ip' => $comms[$i]->get('ip'), 'pseudo' => $comms[$i]->get('pseudo'), 'idArticle' => $comms[$i]->get('id_article'), 'titre' => $comms[$i]->get('titre'), 'date' => date('j\\/m\\/Y', $comms[$i]->get('date')), 'texte' => $comms[$i]->get('texte'));
    }
    $article = new Archivable('Article');
    $articles = $arch->restituer($article);
    $nbArticles = count($articles);
    for ($i = 0; $i < $nbArticles; $i++) {
        $retour['article'][$articles[$i]->get('id')]['nom'] = $articles[$i]->get('nom');
    }
    return $retour;
}