예제 #1
0
    public function getOrgaStats(\AssoMaker\BaseBundle\Entity\Orga $orga)
    {
        $stats = array('orga' => array("0" => 0, "1" => 0, "2" => 0), 'equipe' => array("0" => 0, "1" => 0, "2" => 0));
        $orgaStats = $this->getEntityManager()->createQuery('SELECT t.statut,COUNT(t) as nb FROM AssoMakerPHPMBundle:Tache t LEFT JOIN t.groupeTache g JOIN g.equipe e JOIN t.responsable r 
				WHERE r.id = :oid 
				GROUP BY t.statut')->setParameter('oid', $orga->getId())->getResult();
        foreach ($orgaStats as $row) {
            if ($row['statut'] == 0) {
                $stats['orga'][0] = $row['nb'];
            }
            if ($row['statut'] == 1) {
                $stats['orga'][1] = $row['nb'];
            }
            if ($row['statut'] >= 2) {
                $stats['orga'][2] += $row['nb'];
            }
        }
        $equipeStats = $this->getEntityManager()->createQuery('SELECT t.statut,COUNT(t) as nb FROM AssoMakerPHPMBundle:Tache t LEFT JOIN t.groupeTache g JOIN g.equipe e JOIN t.responsable r
				WHERE e.id = :eid
				GROUP BY t.statut')->setParameter('eid', $orga->getEquipe()->getId())->getResult();
        foreach ($equipeStats as $row) {
            if ($row['statut'] == 0) {
                $stats['equipe'][0] = $row['nb'];
            }
            if ($row['statut'] == 1) {
                $stats['equipe'][1] = $row['nb'];
            }
            if ($row['statut'] >= 2) {
                $stats['equipe'][2] += $row['nb'];
            }
        }
        return $stats;
    }
예제 #2
0
 public function addCommentaire(Orga $auteur, $texte, $type = 0)
 {
     $this->commentaires[] = array('auteur' => $auteur->__toString(), 'type' => $type, 'texte' => $texte, 'date' => new \DateTime());
 }
예제 #3
0
 public function load(ObjectManager $manager)
 {
     echo "Starting to load PHPLanningmaker Entities FIXTURES\n";
     //Confiances
     $softConfiance = new Confiance();
     $softConfiance->setNom('Soft');
     $softConfiance->setValeur(100);
     $softConfiance->setCouleur('blue');
     $softConfiance->setCode(mt_rand());
     $softConfiance->setPrivileges(0);
     $manager->persist($softConfiance);
     $confianceConfiance = new Confiance();
     $confianceConfiance->setNom('Confiance');
     $confianceConfiance->setValeur(500);
     $confianceConfiance->setCouleur('green');
     $confianceConfiance->setCode(mt_rand());
     $confianceConfiance->setPrivileges(0);
     $manager->persist($confianceConfiance);
     $hardConfiance = new Confiance();
     $hardConfiance->setNom('Hard');
     $hardConfiance->setValeur(1000);
     $hardConfiance->setCouleur('orange');
     $hardConfiance->setCode(mt_rand());
     $hardConfiance->setPrivileges(1);
     $manager->persist($hardConfiance);
     $hardEquipe = new Equipe();
     $hardEquipe->setConfiance($hardConfiance);
     $hardEquipe->setCouleur($hardConfiance->getCouleur());
     $hardEquipe->setNom($hardConfiance->getNom());
     $admin = new Orga();
     $admin->setNom("Admin");
     $admin->setPrenom("Admin");
     $admin->setAnneeEtudes(0);
     $admin->setDateDeNaissance(new \DateTime());
     $admin->setDepartement("Admin");
     $admin->setTelephone("0699999999");
     $admin->setEmail('*****@*****.**');
     $admin->setEquipe($hardEquipe);
     $admin->setStatut($hardEquipe);
     $admin->setPrivileges(2);
     $hardEquipe->setResponsable($admin);
     $manager->persist($hardEquipe);
     $manager->persist($admin);
     $manager->flush();
 }