Example #1
0
 public static function getPoblacionsCursosHospici($a_cursos)
 {
     $C = new Criteria();
     $C->add(self::ACTIU, true);
     $C->add(self::IDCURSOS, $a_cursos, CRITERIA::IN);
     $C->addJoin(CursosPeer::SITE_ID, SitesPeer::SITE_ID);
     $C->addJoin(PoblacionsPeer::IDPOBLACIO, SitesPeer::POBLE);
     $RET = array();
     $SOL = array();
     $RET[0] = array('NOM' => "Tots els pobles...", 'COUNT' => 0);
     foreach (PoblacionsPeer::doSelect($C) as $OP) {
         if (!isset($RET[$OP->getIdpoblacio()])) {
             $RET[$OP->getIdpoblacio()] = array('NOM' => $OP->getNom(), 'COUNT' => 0);
         }
         $RET[$OP->getIdpoblacio()]['COUNT'] += 1;
         $RET[0]['COUNT'] += 1;
     }
     foreach ($RET as $K => $V) {
         $SOL[$K] = $V['NOM'] . " ({$V['COUNT']})";
     }
     return $SOL;
 }
Example #2
0
 /**
  * FunciĆ³ qeu amb un llistat d'activitats, ens mostra quantes van a cada poble.
  * @param $A_ACTIVITATS (Llistat amb ID activitats)
  * @return SELECT AMB VALORS
  * */
 public static function getPoblacionsActivitatsHospici($A_ACTIVITATS)
 {
     $C = new Criteria();
     $C->add(self::ACTIVITATID, $A_ACTIVITATS, CRITERIA::IN);
     $C->addJoin(self::ACTIVITATID, HorarisPeer::ACTIVITATS_ACTIVITATID);
     $C->addJoin(HorarisPeer::HORARISID, HorarisespaisPeer::HORARIS_HORARISID);
     $C->addJoin(HorarisespaisPeer::ESPAIS_ESPAIID, EspaisPeer::ESPAIID);
     $C->addJoin(EspaisPeer::SITE_ID, SitesPeer::SITE_ID);
     $C->addJoin(SitesPeer::POBLE, PoblacionsPeer::IDPOBLACIO);
     $C->addGroupByColumn(self::ACTIVITATID);
     $C2 = new Criteria();
     $C2->add(self::ACTIVITATID, $A_ACTIVITATS, CRITERIA::IN);
     $C2->addJoin(self::ACTIVITATID, HorarisPeer::ACTIVITATS_ACTIVITATID);
     $C2->addJoin(HorarisPeer::HORARISID, HorarisespaisPeer::HORARIS_HORARISID);
     $C2->addJoin(HorarisespaisPeer::IDESPAIEXTERN, EspaisExternsPeer::IDESPAIEXTERN);
     $C2->addJoin(EspaisexternsPeer::POBLE, PoblacionsPeer::IDPOBLACIO);
     $C2->addGroupByColumn(self::ACTIVITATID);
     $RET = array();
     $SOL = array();
     $RET[0] = array('NOM' => "Tots els pobles...", 'COUNT' => 0);
     foreach (PoblacionsPeer::doSelect($C) as $OP) {
         if (!isset($RET[$OP->getIdpoblacio()])) {
             $RET[$OP->getIdpoblacio()] = array('NOM' => $OP->getNom(), 'COUNT' => 0);
         }
         $RET[$OP->getIdpoblacio()]['COUNT'] += 1;
         $RET[0]['COUNT'] += 1;
     }
     foreach (PoblacionsPeer::doSelect($C2) as $OP) {
         if (!isset($RET[$OP->getIdpoblacio()])) {
             $RET[$OP->getIdpoblacio()] = array('NOM' => $OP->getNom(), 'COUNT' => 0);
         }
         $RET[$OP->getIdpoblacio()]['COUNT'] += 1;
         $RET[0]['COUNT'] += 1;
     }
     foreach ($RET as $K => $V) {
         $SOL[$K] = $V['NOM'] . " ({$V['COUNT']})";
     }
     return $SOL;
 }
Example #3
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(PoblacionsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(PoblacionsPeer::DATABASE_NAME);
         $criteria->add(PoblacionsPeer::IDPOBLACIO, $pks, Criteria::IN);
         $objs = PoblacionsPeer::doSelect($criteria, $con);
     }
     return $objs;
 }