Ejemplo n.º 1
0
 function findActivitesMarquantes($annee = null, $count = 4)
 {
     $t = new Activites();
     $select = $t->select()->setIntegrityCheck(false)->distinct()->from('activite')->join('participation', 'participation.activite = activite.id', array())->where('participation.unite = ?', $this->id)->join('photo', 'photo.activite = participation.activite', array('photos' => new Zend_Db_Expr('COUNT(photo.id) / 4')))->group('activite.id')->having('photos >= 1')->order('photos DESC')->order('activite.debut DESC')->limit($count);
     if ($annee) {
         $select->where("strftime('%Y', activite.debut, '-8 months') = ?", strval($annee));
     }
     return $t->fetchAll($select);
 }
Ejemplo n.º 2
0
 function getActivites($futures = TRUE, $count = null)
 {
     $db = $this->getTable()->getAdapter();
     // récupérer toutes les unités concernées.
     // récupérer les activités des ces unités.
     $select = $db->select()->from('activites')->distinct()->join('participe', $db->quoteInto('participe.activite = activites.id AND participe.unite IN (?)', new Zend_Db_Expr($db->select()->from('unites', 'id')->join('appartient', $db->quoteInto('appartient.unite = unites.id' . ' AND ' . 'appartient.individu = ?', $this->id), array())->__toString())), array())->order('debut');
     if (!is_null($futures)) {
         $select->where('debut ' . ($futures ? '>' : '<') . ' STRFTIME("%Y-%m-%d %H:%M", "NOW")');
     }
     if (!is_null($count)) {
         $select->limit($count);
     }
     $activites = new Activites();
     return $activites->fetchAll($select);
 }