/**
  * Gets an array of Activitats objects which contain a foreign key that references this object.
  *
  * If this collection has already been initialized with an identical Criteria, it returns the collection.
  * Otherwise if this Tipusactivitat has previously been saved, it will retrieve
  * related Activitatss from storage. If this Tipusactivitat is new, it will return
  * an empty collection or the current collection, the criteria is ignored on a new object.
  *
  * @param      PropelPDO $con
  * @param      Criteria $criteria
  * @return     array Activitats[]
  * @throws     PropelException
  */
 public function getActivitatss($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(TipusactivitatPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collActivitatss === null) {
         if ($this->isNew()) {
             $this->collActivitatss = array();
         } else {
             $criteria->add(ActivitatsPeer::TIPUSACTIVITAT_IDTIPUSACTIVITAT, $this->idtipusactivitat);
             ActivitatsPeer::addSelectColumns($criteria);
             $this->collActivitatss = ActivitatsPeer::doSelect($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return the collection.
             $criteria->add(ActivitatsPeer::TIPUSACTIVITAT_IDTIPUSACTIVITAT, $this->idtipusactivitat);
             ActivitatsPeer::addSelectColumns($criteria);
             if (!isset($this->lastActivitatsCriteria) || !$this->lastActivitatsCriteria->equals($criteria)) {
                 $this->collActivitatss = ActivitatsPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastActivitatsCriteria = $criteria;
     return $this->collActivitatss;
 }
Exemple #2
0
 /**
  * ActivitatsPeer::getLlistatWord()
  *
  * Fa el select per a un formulari de llistat d'activitats i posterior impressió de word
  *  
  * @param mixed $IAF
  * @param mixed $IDS
  * @return
  */
 public static function getLlistatWord(InformeActivitatsForm $IAF, $IDS)
 {
     $C = new Criteria();
     $C = ActivitatsPeer::getCriteriaActiu($C, $IDS);
     $C = HorarisPeer::getCriteriaActiu($C, $IDS);
     $C->addJoin(ActivitatsPeer::ACTIVITATID, HorarisPeer::ACTIVITATS_ACTIVITATID);
     if ($IAF->getValue('idCicle') > 0) {
         $C->add(ActivitatsPeer::CICLES_CICLEID, $IAF->getValue('idCicle'));
     }
     $C1 = $C->getNewCriterion(HorarisPeer::DIA, $IAF->getValue('DataInici'), CRITERIA::GREATER_EQUAL);
     $C2 = $C->getNewCriterion(HorarisPeer::DIA, $IAF->getValue('DataFi'), CRITERIA::LESS_EQUAL);
     if (!is_null($IAF->getValue('DataInici'))) {
         $C->addAnd($C1);
     }
     if (!is_null($IAF->getValue('DataFi'))) {
         $C->addAnd($C2);
     }
     $C->add(ActivitatsPeer::TMIG, "", CRITERIA::NOT_EQUAL);
     $C->addAscendingOrderByColumn(HorarisPeer::DIA);
     $C->addGroupByColumn(ActivitatsPeer::ACTIVITATID);
     return ActivitatsPeer::doSelect($C);
 }
 /**
  * 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(ActivitatsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(ActivitatsPeer::DATABASE_NAME);
         $criteria->add(ActivitatsPeer::ACTIVITATID, $pks, Criteria::IN);
         $objs = ActivitatsPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Exemple #4
0
 public static function getActivitatsCicleList($idC, $idS, $publicaweb = false)
 {
     $C = new Criteria();
     $C = ActivitatsPeer::getCriteriaActiu($C, $idS);
     $C->add(ActivitatsPeer::CICLES_CICLEID, $idC);
     if ($publicaweb) {
         $C->add(ActivitatsPeer::PUBLICAWEB, true);
     }
     $C->addGroupByColumn(ActivitatsPeer::ACTIVITATID);
     return ActivitatsPeer::doSelect($C);
 }
 /**
    * ActivitatsPeer::getActivitatsHospici()
    * 
    * Ens mostra un pager amb les activitats seleccionades
    * 
    * @param mixed $idText
    * @param mixed $idSite
    * @param mixed $idPoble
    * @param mixed $idCategoria
    * @param mixed $idData
    * @param mixed $aDates
    * @param integer $p
    * @return     $aRET = array( 
                 'ON' =>  array( 0 => array( 'QUANTS'=>0 , 'ELEMENT' => 'Escull una població...' ) ), 
                 'QUI' => array( 0 => array( 'QUANTS'=>0 , 'ELEMENT' => 'Escull una entitat...' ) ) , 
                 'QUE' => array( 0 => array( 'QUANTS'=>0 , 'ELEMENT' => 'Escull una categoria...' ) ) , 
                 'A' =>   array( Activitats or Activitatsexternes ) 
                 );
 */
 public static function getActivitatsCercaHospici($CER)
 {
     $idText = $CER['TEXT'];
     $idPoble = $CER['POBLE'];
     $idCategoria = $CER['CATEGORIA'];
     $idSite = $CER['SITE'];
     $datai = myUser::revDate($CER['DATAI']);
     $dataf = myUser::revDate($CER['DATAF']);
     $p = $CER['P'];
     $idText = addslashes($idText);
     //***************************************
     // CONSULTEM LES ACTIVITATS INTERNES
     //***************************************
     $C = new Criteria();
     $C1 = $C->getNewCriterion(ActivitatsPeer::TMIG, "%{$idText}%", Criteria::LIKE);
     $C2 = $C->getNewCriterion(ActivitatsPeer::DMIG, "%{$idText}%", Criteria::LIKE);
     $C1->addOr($C2);
     $C->add($C1);
     $C1 = $C->getNewCriterion(HorarisPeer::DIA, $datai, Criteria::GREATER_EQUAL);
     $C2 = $C->getNewCriterion(HorarisPeer::DIA, $dataf, Criteria::LESS_EQUAL);
     $C1->addAnd($C2);
     $C->add($C1);
     if ($idPoble > 0) {
         $C->add(PoblacionsPeer::IDPOBLACIO, $idPoble);
     }
     if (!empty($idCategoria) && $idCategoria != '0') {
         $C->add(ActivitatsPeer::TIPUSACTIVITAT_IDTIPUSACTIVITAT, $idCategoria);
     }
     if (!empty($idSite) && $idSite != '0') {
         $C->add(SitesPeer::SITE_ID, $idSite);
     }
     $C->addJoin(ActivitatsPeer::ACTIVITATID, HorarisPeer::ACTIVITATS_ACTIVITATID);
     $C->addJoin(HorarisPeer::HORARISID, HorarisespaisPeer::HORARIS_HORARISID);
     $C->addJoin(HorarisespaisPeer::ESPAIS_ESPAIID, EspaisPeer::ESPAIID);
     $C->addJoin(ActivitatsPeer::SITE_ID, SitesPeer::SITE_ID);
     $C->addJoin(PoblacionsPeer::IDPOBLACIO, SitesPeer::POBLE);
     $C->add(ActivitatsPeer::ACTIU, true);
     $C->add(HorarisPeer::ACTIU, true);
     $C->add(HorarisespaisPeer::ACTIU, true);
     $C->add(EspaisPeer::ACTIU, true);
     $C->add(SitesPeer::ACTIU, true);
     $C->add(ActivitatsPeer::PUBLICAWEB, true);
     $C->addGroupByColumn(ActivitatsPeer::ACTIVITATID);
     $C->addAscendingOrderByColumn(HorarisPeer::DIA);
     $C->addAscendingOrderByColumn(ActivitatsPeer::TIPUSACTIVITAT_IDTIPUSACTIVITAT);
     //***************************************
     // CONSULTEM LES ACTIVITATS EXTERNES
     //***************************************
     $CE = new Criteria();
     $C1 = $CE->getNewCriterion(ActivitatsExternesPeer::TITOL, "%{$idText}%", Criteria::LIKE);
     $C2 = $CE->getNewCriterion(ActivitatsExternesPeer::DESCRIPCIO, "%{$idText}%", Criteria::LIKE);
     $C1->addOr($C2);
     $CE->add($C1);
     $C1 = $CE->getNewCriterion(ActivitatsExternesPeer::DATAINICIAL, $datai, Criteria::GREATER_EQUAL);
     $C2 = $CE->getNewCriterion(ActivitatsExternesPeer::DATAINICIAL, $dataf, Criteria::LESS_EQUAL);
     $C1->addAnd($C2);
     $CE->add($C1);
     if ($idPoble > 0) {
         $CE->add(ActivitatsExternesPeer::POBLACIO, $idPoble);
     }
     if (!empty($idCategoria) && $idCategoria != '0') {
         $CE->add(ActivitatsExternesPeer::CATEGORIA, $idCategoria);
     }
     if (!empty($idSite) && $idSite != '0') {
         $CE->add(ActivitatsExternesPeer::ENTITAT, $idSite);
     }
     $CE->addGroupByColumn(ActivitatsExternesPeer::IDACTIVITAT);
     $CE->addAscendingOrderByColumn(ActivitatsExternesPeer::DATAINICIAL);
     $CE->addAscendingOrderByColumn(ActivitatsExternesPeer::CATEGORIA);
     //***************************************
     // CARREGUEM ELS ARRAYS
     //***************************************
     $aRET = array('ON' => array('ELEMENT' => array(0 => 'Escull una població...'), 'QUANTS' => array(0 => 0)), 'QUI' => array('ELEMENT' => array(0 => 'Escull una entitat...'), 'QUANTS' => array(0 => 0)), 'QUE' => array('ELEMENT' => array(0 => 'Escull una categoria...'), 'QUANTS' => array(0 => 0)), 'A' => array());
     foreach (ActivitatsPeer::doSelect($C) as $OA) {
         $OTA = TipusactivitatPeer::retrieveByPK($OA->getTipusactivitatIdtipusactivitat());
         if ($OTA instanceof Tipusactivitat) {
             if (!isset($aRET['QUE']['QUANTS'][$OTA->getIdTipusactivitat()])) {
                 $aRET['QUE']['QUANTS'][$OTA->getIdTipusactivitat()] = 0;
             }
             $aRET['QUE']['QUANTS'][$OTA->getIdTipusactivitat()]++;
             $aRET['QUE']['ELEMENT'][$OTA->getIdTipusactivitat()] = $OTA->getNom() . ' (' . $aRET['QUE']['QUANTS'][$OTA->getIdTipusactivitat()] . ')';
         }
         $OS = SitesPeer::retrieveByPK($OA->getSiteId());
         if ($OS instanceof Sites) {
             if (!isset($aRET['QUI']['QUANTS'][$OS->getSiteid()])) {
                 $aRET['QUI']['QUANTS'][$OS->getSiteid()] = 0;
             }
             $aRET['QUI']['QUANTS'][$OS->getSiteid()]++;
             $aRET['QUI']['ELEMENT'][$OS->getSiteid()] = $OS->getNom() . ' (' . $aRET['QUI']['QUANTS'][$OS->getSiteid()] . ')';
         }
         $OP = PoblacionsPeer::retrieveByPK($OS->getPoble());
         if ($OP instanceof Poblacions) {
             if (!isset($aRET['ON']['QUANTS'][$OP->getIdpoblacio()])) {
                 $aRET['ON']['QUANTS'][$OP->getIdpoblacio()] = 0;
             }
             $aRET['ON']['QUANTS'][$OP->getIdpoblacio()]++;
             $aRET['ON']['ELEMENT'][$OP->getIdpoblacio()] = $OP->getNom() . ' (' . $aRET['ON']['QUANTS'][$OP->getIdpoblacio()] . ')';
         }
         $aRET['A'][$OA->getActivitatid()] = $OA;
     }
     foreach (ActivitatsExternesPeer::doSelect($CE) as $OAE) {
         if (!isset($aRET['QUE']['QUANTS'][$OAE->getCategoria()])) {
             $aRET['QUE']['QUANTS'][$OAE->getCategoria()] = 0;
         }
         $aRET['QUE']['QUANTS'][$OAE->getCategoria()]++;
         $aRET['QUE']['ELEMENT'][$OAE->getCategoria()] = $OAE->getCategoriaNom() . ' (' . $aRET['QUE']['QUANTS'][$OAE->getCategoria()] . ')';
         $OS = SitesPeer::retrieveByPK($OAE->getEntitat());
         if ($OS instanceof Sites && is_int($OAE->getEntitat())) {
             if (!isset($aRET['QUI']['QUANTS'][$OS->getSiteid()])) {
                 $aRET['QUI']['QUANTS'][$OS->getSiteid()] = 0;
             }
             $aRET['QUI']['QUANTS'][$OS->getSiteid()]++;
             $aRET['QUI']['ELEMENT'][$OS->getSiteid()] = $OS->getNom() . ' (' . $aRET['QUI']['QUANTS'][$OS->getSiteid()] . ')';
         } else {
             if (!isset($aRET['QUI']['QUANTS'][$OAE->getEntitat()])) {
                 $aRET['QUI']['QUANTS'][$OAE->getEntitat()] = 0;
             }
             $aRET['QUI']['QUANTS'][$OAE->getEntitat()]++;
             $aRET['QUI']['ELEMENT'][$OAE->getEntitat()] = $OAE->getEntitat() . ' (' . $aRET['QUI']['QUANTS'][$OAE->getEntitat()] . ')';
         }
         $OP = PoblacionsPeer::retrieveByPK($OAE->getPoblacio());
         if ($OP instanceof Poblacions) {
             if (!isset($aRET['ON']['QUANTS'][$OP->getIdpoblacio()])) {
                 $aRET['ON']['QUANTS'][$OP->getIdpoblacio()] = 0;
             }
             $aRET['ON']['QUANTS'][$OP->getIdpoblacio()]++;
             $aRET['ON']['ELEMENT'][$OP->getIdpoblacio()] = $OP->getNom() . ' (' . $aRET['ON']['QUANTS'][$OP->getIdpoblacio()] . ')';
         } else {
             if (!isset($aRET['ON']['QUANTS'][$OAE->getgetPoblacio()])) {
                 $aRET['ON']['QUANTS'][$OAE->getgetPoblacio()] = 0;
             }
             $aRET['ON']['QUANTS'][$OAE->getgetPoblacio()]++;
             $aRET['ON']['ELEMENT'][$OAE->getgetPoblacio()] = $OAE->getgetPoblacio() . ' (' . $aRET['ON']['QUANTS'][$OAE->getgetPoblacio()] . ')';
         }
         $aRET['A']['E' . $OAE->getIdactivitat()] = $OAE;
     }
     $aRET['ON']['ELEMENT'][0] = 'Escull una població (' . sizeof($aRET['A']) . ')...';
     $aRET['QUI']['ELEMENT'][0] = 'Escull una entitat (' . sizeof($aRET['A']) . ')...';
     $aRET['QUE']['ELEMENT'][0] = 'Escull una categoria (' . sizeof($aRET['A']) . ')...';
     return $aRET;
 }