public function executeEdit($request) { $this->feriado = $this->getFeriadoOrCreate(); $criteria = new Criteria(); $criteria->add(CiclolectivoPeer::FK_ESTABLECIMIENTO_ID, $this->getUser()->getAttribute('fk_establecimiento_id')); $cicloslectivos = CiclolectivoPeer::doSelect($criteria); $this->debugMessage(count($cicloslectivos)); $optionsCiclolectivo = array(); foreach ($cicloslectivos as $ciclolectivo) { $optionsCiclolectivo[$ciclolectivo->getId()] = $ciclolectivo->getDescripcion(); } asort($optionsCiclolectivo); $this->optionsCiclolectivo = $optionsCiclolectivo; if ($this->getRequest()->getMethod() == sfRequest::POST) { $this->feriado = $this->getFeriadoOrCreate(); $this->updateFeriadoFromRequest(); $this->saveFeriado($this->feriado); $this->getUser()->setFlash('notice', 'Your modifications have been saved'); if ($this->getRequestParameter('save_and_add')) { return $this->redirect('feriado/create'); } else { return $this->redirect('feriado/edit?id=' . $this->feriado->getId()); } } else { // add javascripts $this->getResponse()->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/prototype'); $this->getResponse()->addJavascript(sfConfig::get('sf_admin_web_dir') . '/js/collapse'); $this->labels = $this->getLabels(); } }
private function _pasajeAlumnosData() { $ciclolectivo_id = $this->getUser()->getAttribute('fk_ciclolectivo_id'); $ciclo_actual = CiclolectivoPeer::retrieveByPK($ciclolectivo_id); $this->optionsDivisiones = $ciclo_actual->getDivisionesArray(); $c = new Criteria(); $c->add(CiclolectivoPeer::FK_ESTABLECIMIENTO_ID, $this->getUser()->getAttribute('fk_establecimiento_id')); $c->add(CiclolectivoPeer::ID, $ciclolectivo_id, Criteria::NOT_EQUAL); $this->optionsCiclos = CiclolectivoPeer::doSelect($c); $this->labels = array('pasaje{fk_division_destino_id}' => 'División destino', 'pasaje{fk_alumno_id}' => 'Alumnos', 'pasaje{fk_division_id}' => 'División origen', 'pasaje{fk_ciclolectivo_id}' => 'Ciclo lectivo'); }
public function getCiclolectivos($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(EstablecimientoPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collCiclolectivos === null) { if ($this->isNew()) { $this->collCiclolectivos = array(); } else { $criteria->add(CiclolectivoPeer::FK_ESTABLECIMIENTO_ID, $this->id); CiclolectivoPeer::addSelectColumns($criteria); $this->collCiclolectivos = CiclolectivoPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(CiclolectivoPeer::FK_ESTABLECIMIENTO_ID, $this->id); CiclolectivoPeer::addSelectColumns($criteria); if (!isset($this->lastCiclolectivoCriteria) || !$this->lastCiclolectivoCriteria->equals($criteria)) { $this->collCiclolectivos = CiclolectivoPeer::doSelect($criteria, $con); } } } $this->lastCiclolectivoCriteria = $criteria; return $this->collCiclolectivos; }
public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(CiclolectivoPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(CiclolectivoPeer::DATABASE_NAME); $criteria->add(CiclolectivoPeer::ID, $pks, Criteria::IN); $objs = CiclolectivoPeer::doSelect($criteria, $con); } return $objs; }