function findUnites() { $t = new Unites(); $s = $t->select()->setIntegrityCheck(false)->from('unite')->join('participation', 'participation.unite = unite.id', array())->where('participation.activite = ?', $this->activite); return $t->fetchAll($s); }
function findUnitesParticipantesExplicites() { $t = new Unites(); $s = $t->select()->setIntegrityCheck(false)->distinct()->from('unite')->joinLeft('participation', 'participation.unite = unite.id', array())->joinLeft(array('mere' => 'unite'), 'mere.id = unite.parent', array())->joinLeft(array('part_mere' => 'participation'), 'part_mere.unite = mere.id AND ' . 'part_mere.activite = participation.activite', array())->where('participation.activite = ?', $this->id)->where('part_mere.id IS NULL'); return $t->fetchAll($s); }
function findUnites($actif = TRUE) { $t = new Unites(); $s = $t->select()->setIntegrityCheck(false)->distinct()->from('unite')->joinLeft(array('parent' => 'unite'), 'parent.id = unite.parent', array())->joinLeft(array('grandparent' => 'unite'), 'grandparent.id = parent.parent', array())->join('appartenance', 'appartenance.unite IN (unite.id, parent.id, grandparent.id)', array())->where('appartenance.individu = ?', $this->id); if ($actif === true) { $s->where('appartenance.fin IS NULL'); } else { if ($actif === false) { $s->where('appartenance.fin IS NOT NULL'); } } return $t->fetchAll($s); }
function findUnite() { $t = new Unites(); $s = $t->select()->setIntegrityCheck(false)->from('unite')->join('unite_document', 'unite_document.unite = unite.id', array())->where('unite_document.document = ?', $this->id); return $t->fetchOne($s); }
function findUnite() { $t = new Unites(); $s = $t->select()->setIntegrityCheck(false)->from('unite')->join('journal', 'journal.unite = unite.id', array())->where('journal.id = ?', $this->journal); return $t->fetchOne($s); }