Exemplo n.º 1
0
 public function initData()
 {
     $intitulePosts = explode(';', $this->getIntitulePost());
     //récupération des données de la base
     $missions = Doctrine::getTable('Mission')->getMissionsByIntitulepostes($intitulePosts);
     $candidats = Doctrine::getTable('TableauChasse')->getcandidatsByMissions($missions);
     $candidatParcours = Doctrine::getTable('Parcour')->getByCandidats($candidats);
     $candidatFormations = Doctrine::getTable('Formation')->getByCandidats($candidats);
     $candidats = Doctrine::getTable('Candidat')->getByIds($candidats);
     //nb de candidats
     $this->setNbCandidat(count($candidats));
     //parcours
     $totalrem = 0;
     $remmax = 0;
     $remmaxid = 0;
     $remmin = 999;
     $remminid = 0;
     $nb = 0;
     $secteurs = array();
     foreach ($candidatParcours as $candidatParcour) {
         //rem moyenne
         if ($candidatParcour['remuneration'] > 0) {
             $totalrem += $candidatParcour['remuneration'];
             $nb++;
         }
         //rem max
         if ($candidatParcour['remuneration'] > $remmax) {
             $remmax = $candidatParcour['remuneration'];
             $remmaxid = $candidatParcour['candidat_id'];
         }
         //rem min
         if ($candidatParcour['remuneration'] > 0 && $candidatParcour['remuneration'] < $remmin) {
             $remmin = $candidatParcour['remuneration'];
             $remminid = $candidatParcour['candidat_id'];
         }
         //secteur
         $secteur = explode(', ', $candidatParcour['secteur']);
         foreach ($secteur as $s) {
             if ($s != '') {
                 if (array_key_exists($s, $secteurs)) {
                     $secteurs[$s] = $secteurs[$s] + 1;
                 } else {
                     $secteurs[$s] = 1;
                 }
             }
         }
     }
     $secteur_google_chart_url = 'http://chart.apis.google.com/chart?';
     $secteur_google_chart_url_cht = 'cht=p';
     $secteur_google_chart_url_chs = 'chs=400x200';
     $secteur_google_chart_url_chd = 'chd=t:';
     $secteur_google_chart_url_chl = 'chl=';
     foreach ($secteurs as $s => $v) {
         $secteur_google_chart_url_chd .= $v . ',';
         $secteur_google_chart_url_chl .= $s . '|';
     }
     $secteur_google_chart_url .= $secteur_google_chart_url_cht . '&' . $secteur_google_chart_url_chs . '&' . substr($secteur_google_chart_url_chd, 0, -1) . '&' . substr($secteur_google_chart_url_chl, 0, -1);
     //formation
     //                $ecoles = array();
     $niveauFormations = array();
     foreach ($candidatFormations as $candidatFormation) {
         //                    if($candidatFormation['ecole'] != '') {
         //                        if(array_key_exists($candidatFormation['ecole'], $ecoles)) {
         //                            $ecoles[$candidatFormation['ecole']] = $ecoles[$candidatFormation['ecole']] + 1;
         //                        } else {
         //                            $ecoles[$candidatFormation['ecole']] = 1;
         //                        }
         //                    }
         if ($candidatFormation['niveauformation'] != '') {
             if (array_key_exists($candidatFormation['niveauformation'], $niveauFormations)) {
                 $niveauFormations[$candidatFormation['niveauformation']] = $niveauFormations[$candidatFormation['niveauformation']] + 1;
             } else {
                 $niveauFormations[$candidatFormation['niveauformation']] = 1;
             }
         }
     }
     $niveauformation_google_chart_url = 'http://chart.apis.google.com/chart?';
     $niveauformation_google_chart_url_cht = 'cht=p';
     $niveauformation_google_chart_url_chs = 'chs=400x200';
     $niveauformation_google_chart_url_chd = 'chd=t:';
     $niveauformation_google_chart_url_chl = 'chl=';
     //                foreach($ecoles as $n => $v) {
     foreach ($niveauFormations as $n => $v) {
         $niveauformation_google_chart_url_chd .= $v . ',';
         $niveauformation_google_chart_url_chl .= $n . '|';
     }
     $niveauformation_google_chart_url .= $niveauformation_google_chart_url_cht . '&' . $niveauformation_google_chart_url_chs . '&' . substr($niveauformation_google_chart_url_chd, 0, -1) . '&' . substr($niveauformation_google_chart_url_chl, 0, -1);
     //candidat
     $totalage = 0;
     $nbage = 0;
     $agemax = 0;
     $agemin = 999;
     foreach ($candidats as $candidat) {
         $age = UtilDate::age($candidat['datenaissance']);
         //age moyen
         if ($age != 'n/a') {
             $totalage += $age;
             $nbage++;
         }
         //age max
         if ($age != 'n/a' && $age > $agemax) {
             $agemax = $age;
         }
         //age min
         if ($age != 'n/a' && $age < $agemin) {
             $agemin = $age;
         }
     }
     //affectation des valeurs
     $this->setRemMoy(round($totalrem / $nb, 0));
     $this->setRemMax($remmax);
     $this->setRemMin($remmin);
     $this->setAgeMoy(round($totalage / $nbage, 0));
     $this->setAgeMax($agemax);
     $this->setAgeMin($agemin);
     $this->setIdCandMax($remmaxid);
     $this->setIdCandMin($remminid);
     $this->setSecteurPourcent($secteur_google_chart_url);
     $this->setFormationPourcent($niveauformation_google_chart_url);
     //return $candidatMax;
 }
?>
            </td>
        </tr>
        <tr>
            <td>Rémunération minimale:</td>
            <td></td>
            <td align="right"><?php 
echo $plaquetteMetier->getRemMin();
?>
 K€ / an</td>
        </tr>
        <tr>
            <td></td>
            <td>Age du candidat:</td>
            <td align="right"><?php 
echo UtilDate::age($candidatmin->getDateNaissance());
?>
 ans</td>
        </tr>
        <tr>
            <td></td>
            <td>Formation:</td>
            <td align="right">
                    <?php 
foreach ($candidatmin->getFormation() as $formation) {
    ?>
                    <em><?php 
    echo $formation->getNiveauFormation();
    ?>
</em> <?php 
    echo $formation->getEcole();
Exemplo n.º 3
0
 public function initData()
 {
     $candidats = Doctrine::getTable('TableauChasse')->getcandidatsByMissions($this->getMission()->getId());
     $this->setNbSociete(Doctrine::getTable('Parcour')->countSocieteByCandidats($candidats));
     $inoutbu = Doctrine::getTable('TableauChasse')->countInOutBu($this->getMission()->getId());
     $inoutbu_google_chart_url = 'http://chart.apis.google.com/chart?';
     $inoutbu_google_chart_url_cht = 'cht=p';
     $inoutbu_google_chart_url_chs = 'chs=400x200';
     $inoutbu_google_chart_url_chd = 'chd=t:';
     $inoutbu_google_chart_url_chl = 'chl=';
     foreach ($inoutbu as $s => $v) {
         $inoutbu_google_chart_url_chd .= $v . ',';
         $inoutbu_google_chart_url_chl .= $s . '|';
     }
     $inoutbu_google_chart_url .= $inoutbu_google_chart_url_cht . '&' . $inoutbu_google_chart_url_chs . '&' . substr($inoutbu_google_chart_url_chd, 0, -1) . '&' . substr($inoutbu_google_chart_url_chl, 0, -1);
     $candidatParcours = Doctrine::getTable('Parcour')->getByCandidats($candidats);
     $candidatFormations = Doctrine::getTable('Formation')->getByCandidats($candidats);
     $candidats = Doctrine::getTable('Candidat')->getByIds($candidats);
     //nb de candidats
     $this->setNbCandidat(count($candidats));
     //parcours
     $totalrem = 0;
     $remmax = 0;
     $remmaxid = 0;
     $remmin = 999;
     $remminid = 0;
     $nb = 0;
     $secteurs = array();
     foreach ($candidatParcours as $candidatParcour) {
         //rem moyenne
         if ($candidatParcour['remuneration'] > 0) {
             $totalrem += $candidatParcour['remuneration'];
             $nb++;
         }
         //rem max
         if ($candidatParcour['remuneration'] > $remmax) {
             $remmax = $candidatParcour['remuneration'];
             $remmaxid = $candidatParcour['candidat_id'];
         }
         //rem min
         if ($candidatParcour['remuneration'] > 0 && $candidatParcour['remuneration'] < $remmin) {
             $remmin = $candidatParcour['remuneration'];
             $remminid = $candidatParcour['candidat_id'];
         }
         //secteur
         $secteur = explode(', ', $candidatParcour['secteur']);
         foreach ($secteur as $s) {
             if ($s != '') {
                 if (array_key_exists($s, $secteurs)) {
                     $secteurs[$s] = $secteurs[$s] + 1;
                 } else {
                     $secteurs[$s] = 1;
                 }
             }
         }
     }
     $secteur_google_chart_url = 'http://chart.apis.google.com/chart?';
     $secteur_google_chart_url_cht = 'cht=p';
     $secteur_google_chart_url_chs = 'chs=400x200';
     $secteur_google_chart_url_chd = 'chd=t:';
     $secteur_google_chart_url_chl = 'chl=';
     foreach ($secteurs as $s => $v) {
         $secteur_google_chart_url_chd .= $v . ',';
         $secteur_google_chart_url_chl .= $s . '|';
     }
     $secteur_google_chart_url .= $secteur_google_chart_url_cht . '&' . $secteur_google_chart_url_chs . '&' . substr($secteur_google_chart_url_chd, 0, -1) . '&' . substr($secteur_google_chart_url_chl, 0, -1);
     //formation
     //                $ecoles = array();
     $niveauFormations = array();
     foreach ($candidatFormations as $candidatFormation) {
         //                    if($candidatFormation['ecole'] != '') {
         //                        if(array_key_exists($candidatFormation['ecole'], $ecoles)) {
         //                            $ecoles[$candidatFormation['ecole']] = $ecoles[$candidatFormation['ecole']] + 1;
         //                        } else {
         //                            $ecoles[$candidatFormation['ecole']] = 1;
         //                        }
         //                    }
         if ($candidatFormation['niveauformation'] != '') {
             if (array_key_exists($candidatFormation['niveauformation'], $niveauFormations)) {
                 $niveauFormations[$candidatFormation['niveauformation']] = $niveauFormations[$candidatFormation['niveauformation']] + 1;
             } else {
                 $niveauFormations[$candidatFormation['niveauformation']] = 1;
             }
         }
     }
     $niveauformation_google_chart_url = 'http://chart.apis.google.com/chart?';
     $niveauformation_google_chart_url_cht = 'cht=p';
     $niveauformation_google_chart_url_chs = 'chs=400x200';
     $niveauformation_google_chart_url_chd = 'chd=t:';
     $niveauformation_google_chart_url_chl = 'chl=';
     //                foreach($ecoles as $n => $v) {
     foreach ($niveauFormations as $n => $v) {
         $niveauformation_google_chart_url_chd .= $v . ',';
         $niveauformation_google_chart_url_chl .= $n . '|';
     }
     $niveauformation_google_chart_url .= $niveauformation_google_chart_url_cht . '&' . $niveauformation_google_chart_url_chs . '&' . substr($niveauformation_google_chart_url_chd, 0, -1) . '&' . substr($niveauformation_google_chart_url_chl, 0, -1);
     //candidat
     $ages = array('<30' => '0', '30-40' => '0', '40-50' => '0', '50-60' => '0', '>60' => '0');
     $sexe = array('homme' => '0', 'femme' => '0');
     foreach ($candidats as $candidat) {
         //age
         $age = UtilDate::age($candidat['datenaissance']);
         if ($age != 'n/a') {
             if ($age < 30) {
                 $ages['<30']++;
             } else {
                 if ($age >= 30 && $age < 40) {
                     $ages['30-40']++;
                 } else {
                     if ($age >= 40 && $age < 50) {
                         $ages['40-50']++;
                     } else {
                         if ($age >= 50 && $age < 60) {
                             $ages['50-60']++;
                         } else {
                             if ($age >= 60) {
                                 $ages['>60']++;
                             }
                         }
                     }
                 }
             }
         }
         //homme femme
         if ($candidat['civilite_id'] > 1) {
             $sexe['femme']++;
         } else {
             if ($candidat['civilite_id'] == 1) {
                 $sexe['homme']++;
             }
         }
     }
     //age chart
     $age_google_chart_url = 'http://chart.apis.google.com/chart?';
     $age_google_chart_url_cht = 'cht=bvs';
     $age_google_chart_url_chs = 'chs=400x200&chxt=x,y&chbh=a,10';
     $age_google_chart_url_chd = 'chd=t:';
     $age_google_chart_url_chl = 'chl=';
     foreach ($ages as $n => $v) {
         $age_google_chart_url_chd .= $v . ',';
         $age_google_chart_url_chl .= $n . '|';
     }
     $age_google_chart_url .= $age_google_chart_url_cht . '&' . $age_google_chart_url_chs . '&' . substr($age_google_chart_url_chd, 0, -1) . '&' . substr($age_google_chart_url_chl, 0, -1);
     //sexe chart
     $sexe_google_chart_url = 'http://chart.apis.google.com/chart?';
     $sexe_google_chart_url_cht = 'cht=p';
     $sexe_google_chart_url_chs = 'chs=400x200';
     $sexe_google_chart_url_chd = 'chd=t:';
     $sexe_google_chart_url_chl = 'chl=';
     foreach ($sexe as $n => $v) {
         $sexe_google_chart_url_chd .= $v . ',';
         $sexe_google_chart_url_chl .= $n . '|';
     }
     $sexe_google_chart_url .= $sexe_google_chart_url_cht . '&' . $sexe_google_chart_url_chs . '&' . substr($sexe_google_chart_url_chd, 0, -1) . '&' . substr($sexe_google_chart_url_chl, 0, -1);
     //affectation des valeurs
     $this->setRemMoy(round($totalrem / $nb, 0));
     $this->setRemMax($remmax);
     $this->setRemMin($remmin);
     $this->setAgeGraph($age_google_chart_url);
     $this->setIdCandMax($remmaxid);
     $this->setIdCandMin($remminid);
     $this->setFormationPourcent($niveauformation_google_chart_url);
     $this->setSexePourcent($sexe_google_chart_url);
     $this->setSecteurPourcent($secteur_google_chart_url);
     $this->setInoutbuPourcent($inoutbu_google_chart_url);
     //criteres libres
     $critereLibres = Doctrine::getTable('CritereLibre')->findBy('mission_id', $this->getMission()->getId());
     $nbcl = 0;
     foreach ($critereLibres as $critereLibre) {
         $cls[$critereLibre->getLibelle()] = Doctrine::getTable('CritereLibreCandidat')->countValid($critereLibre->getId());
         $nbcl += $cls[$critereLibre->getLibelle()];
     }
     $cl_google_chart_url = 'http://chart.apis.google.com/chart?';
     $cl_google_chart_url_cht = 'cht=bhs:nda';
     $cl_google_chart_url_chs = 'chs=500x250&chbh=a,5&chm=N*p0*,aa9999,0,-1,10&chds=0,1';
     $cl_google_chart_url_chd = 'chd=t:';
     $cl_google_chart_url_chl = 'chly=';
     foreach ($cls as $n => $v) {
         $cl_google_chart_url_chd .= $v / $nbcl . ',';
         $cl_google_chart_url_chl .= $n . '|';
     }
     $cl_google_chart_url .= $cl_google_chart_url_cht . '&' . $cl_google_chart_url_chs . '&' . substr($cl_google_chart_url_chd, 0, -1) . '&' . substr($cl_google_chart_url_chl, 0, -1);
     $this->setCritereSpe($cl_google_chart_url);
     //return $nbcl;
 }