function executeBusqueda() { $aAlumnoId = array(); $criteria = new Criteria(); if ($this->getRequestParameter('filtro_nombre_alumnos')) { $txt_nombre = $this->getRequestParameter('filtro_nombre_alumnos'); $cton1 = $criteria->getNewCriterion(AlumnoPeer::APELLIDO, "{$txt_nombre}%", Criteria::LIKE); } if ($this->getRequestParameter('filtro_alumnos')) { switch ($this->getRequestParameter('filtro_alumnos')) { case 0: break; case 1: $c = new Criteria(); $c->add(AnioPeer::FK_ESTABLECIMIENTO_ID, $this->getUser()->getAttribute('fk_establecimiento_id')); $c->addJoin(RelAlumnoDivisionPeer::FK_DIVISION_ID, DivisionPeer::ID); $c->addJoin(AnioPeer::ID, DivisionPeer::FK_ANIO_ID); $relAlumnoDivision = RelAlumnoDivisionPeer::doSelect($c); foreach ($relAlumnoDivision as $r) { $aAlumnoId[] = $r->getFkAlumnoId(); } $criteria->add(AlumnoPeer::ID, $r->getFkAlumnoId(), Criteria::NOT_IN); $cton2 = $criteria->getNewCriterion(AlumnoPeer::ID, $aAlumnoId, Criteria::NOT_IN); if ($this->getRequestParameter('filtro_nombre_alumnos')) { $cton1->addAnd($cton2); } else { $criteria->add($cton2); } break; default: } } if ($this->getRequestParameter('filtro_nombre_alumnos')) { $criteria->add($cton1); } $alumnos = AlumnoPeer::doSelect($criteria); $this->optionsAlumno = $alumnos; }
public function getRelAlumnoDivisions($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(AlumnoPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collRelAlumnoDivisions === null) { if ($this->isNew()) { $this->collRelAlumnoDivisions = array(); } else { $criteria->add(RelAlumnoDivisionPeer::FK_ALUMNO_ID, $this->id); RelAlumnoDivisionPeer::addSelectColumns($criteria); $this->collRelAlumnoDivisions = RelAlumnoDivisionPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(RelAlumnoDivisionPeer::FK_ALUMNO_ID, $this->id); RelAlumnoDivisionPeer::addSelectColumns($criteria); if (!isset($this->lastRelAlumnoDivisionCriteria) || !$this->lastRelAlumnoDivisionCriteria->equals($criteria)) { $this->collRelAlumnoDivisions = RelAlumnoDivisionPeer::doSelect($criteria, $con); } } } $this->lastRelAlumnoDivisionCriteria = $criteria; return $this->collRelAlumnoDivisions; }
public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(RelAlumnoDivisionPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(RelAlumnoDivisionPeer::DATABASE_NAME); $criteria->add(RelAlumnoDivisionPeer::ID, $pks, Criteria::IN); $objs = RelAlumnoDivisionPeer::doSelect($criteria, $con); } return $objs; }