public static function getLlistesDisponibles($IDU, $idS) { $SELECT = array(); foreach (self::select($idS) as $K => $L) { $C = new Criteria(); $C->add(UsuarisllistesPeer::USUARIS_USUARISID, $IDU); $C->add(UsuarisllistesPeer::LLISTES_IDLLISTES, $K); if (UsuarisllistesPeer::doCount($C) == 0) { $SELECT[$K] = $L; } } return $SELECT; }
public function saveUsuaris() { $USUARIS = $this->getRequestParameter('USUARIS'); $IDL = $this->getRequestParameter('IDL'); $ERRORS = array(); if (isset($USUARIS)) { foreach ($USUARIS as $U) { $C = new Criteria(); $C->add(UsuarisllistesPeer::USUARIS_USUARISID, $U); $C->add(UsuarisllistesPeer::LLISTES_IDLLISTES, $IDL); $UL = UsuarisllistesPeer::doSelectOne($C); $UL->delete(); } } if ($this->getRequestParameter('DNI') != '') { $DNIs = explode(",", $this->getRequestParameter('DNI')); foreach ($DNIs as $D) { if ($this->ValidaDNI(trim($D), false)) { $C = new Criteria(); $C->add(UsuarisPeer::DNI, trim($D)); $U = UsuarisPeer::doSelectOne($C); $C = new Criteria(); $C->add(UsuarisllistesPeer::LLISTES_IDLLISTES, $IDL); $C->add(UsuarisllistesPeer::USUARIS_USUARISID, $U->getUsuariid()); $COUNT = UsuarisllistesPeer::doCount($C); if ($COUNT == 0) { $UL = new Usuarisllistes(); $UL->setLlistesIdllistes($IDL); $UL->setUsuarisUsuarisid($U->getUsuariid()); $UL->save(); } } else { $ERRORS[] = 'El DNI ' . $D . ' és incorrecte.'; } } } $RET['ERRORS'] = $ERRORS; return $RET; }
/** * Returns the number of related Usuarisllistes objects. * * @param Criteria $criteria * @param boolean $distinct * @param PropelPDO $con * @return int Count of related Usuarisllistes objects. * @throws PropelException */ public function countUsuarisllistess(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(LlistesPeer::DATABASE_NAME); } else { $criteria = clone $criteria; } if ($distinct) { $criteria->setDistinct(); } $count = null; if ($this->collUsuarisllistess === null) { if ($this->isNew()) { $count = 0; } else { $criteria->add(UsuarisllistesPeer::LLISTES_IDLLISTES, $this->idllistes); $count = UsuarisllistesPeer::doCount($criteria, false, $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 count of the collection. $criteria->add(UsuarisllistesPeer::LLISTES_IDLLISTES, $this->idllistes); if (!isset($this->lastUsuarisllistesCriteria) || !$this->lastUsuarisllistesCriteria->equals($criteria)) { $count = UsuarisllistesPeer::doCount($criteria, false, $con); } else { $count = count($this->collUsuarisllistess); } } else { $count = count($this->collUsuarisllistess); } } return $count; }