示例#1
0
 /**
  * deuelve el establecimento del usuario
  * @return array $establecimientos
  * @todo: tienen que ser varios!
  */
 public function getEstablecimientos()
 {
     $establecimientos = array();
     $e = EstablecimientoPeer::retrieveByPk($this->getAttribute('fk_establecimiento_id'));
     array_push($establecimientos, $e);
     return $establecimientos;
 }
示例#2
0
 public function executeMostrar()
 {
     // Inicializar variables
     $optionsConcepto = array();
     $optionsPeriodo = array();
     $optionsActividad = array();
     $alumno = "";
     $division = "";
     $alumno_id = "";
     $division_id = "";
     $notaAlumno = array();
     $conceptoAlumno = array();
     $aAsistencia = array();
     $alumno_id = $this->alumno_id;
     $division_id = $this->division_id;
     $establecimiento_id = $this->getUser()->getAttribute('fk_establecimiento_id');
     $no_cargar = 0;
     if ($alumno_id) {
         $alumno = AlumnoPeer::retrieveByPK($alumno_id);
         if (!$division_id) {
             $c = new Criteria();
             $c->add(RelAlumnoDivisionPeer::FK_ALUMNO_ID, $alumno_id);
             $ad = RelAlumnoDivisionPeer::doSelectOne($c);
             if ($ad) {
                 $division_id = $ad->getFkDivisionId();
             } else {
                 $no_cargar = 1;
             }
         }
         if ($no_cargar == 0) {
             $division = DivisionPeer::retrieveByPK($division_id);
             $optionsActividad = $division->getActividadesArray();
             $e = EstablecimientoPeer::retrieveByPk($establecimiento_id);
             $optionsConcepto = $e->getConceptosArray();
             $notaAlumno = $alumno->getNotas($this->getUser()->getAttribute('fk_ciclolectivo_id'));
             $conceptoAlumno = $alumno->getNotasConcepto();
             $c = CiclolectivoPeer::retrieveByPk($this->getUser()->getAttribute('fk_ciclolectivo_id'));
             $optionsPeriodo = $c->getPeriodosArray();
             $aAsistencia = $alumno->getAsistenciasPorCiclolectivo($this->getUser()->getAttribute('fk_ciclolectivo_id'));
         } else {
             $this->getUser()->setFlash('notice', 'Error: el alumno no esta en ninguna división');
         }
     } else {
         $this->getUser()->setFlash('notice', 'Error: no envio el alumno');
     }
     // variables al template
     $this->establecimiento = EstablecimientoPeer::retrieveByPk($establecimiento_id);
     $this->optionsPeriodo = $optionsPeriodo;
     $this->optionsActividad = $optionsActividad;
     $this->cantOptionsActividad = count($optionsActividad);
     $this->alumno = $alumno;
     $this->division = $division;
     $this->optionsConcepto = $optionsConcepto;
     $this->cantOptionsConcepto = count($optionsConcepto);
     $this->notaAlumno = $notaAlumno;
     $this->conceptoAlumno = $conceptoAlumno;
     $this->aAsistencia = $aAsistencia;
     $this->cantOptionsAsistencia = count($aAsistencia) > 0 ? count(current($aAsistencia)) : 0;
 }
示例#3
0
 public function getEstablecimiento(PropelPDO $con = null)
 {
     if ($this->aEstablecimiento === null && $this->fk_establecimiento_id !== null) {
         $c = new Criteria(EstablecimientoPeer::DATABASE_NAME);
         $c->add(EstablecimientoPeer::ID, $this->fk_establecimiento_id);
         $this->aEstablecimiento = EstablecimientoPeer::doSelectOne($c, $con);
     }
     return $this->aEstablecimiento;
 }
示例#4
0
 /**
  * @param array $aVariable
  * @returns array
  */
 private function llenarVariables($aVariable)
 {
     $aDato = array();
     foreach ($aVariable as $idx => $result) {
         //Recorrer las variables
         switch ($idx) {
             // me fijo que variables debo enviar al template de resultado
             case 'cuenta':
                 if (array_key_exists('loop', $result) and $result['loop'] == 1) {
                     $criteria = new Criteria();
                     $cuentas = CuentaPeer::doSelect($criteria);
                     foreach ($cuentas as $cuenta) {
                         $aDato['cuenta'][] = $cuenta->toArray();
                     }
                 } else {
                     if ($this->getRequestParameter('cuenta_id')) {
                         $cuenta = CuentaPeer::retrieveByPk($this->getRequestParameter('cuenta_id'));
                         $aDato['cuenta'] = $cuenta->toArray();
                     }
                 }
                 break;
             case 'responsable':
                 if (array_key_exists('loop', $result) and $result['loop'] == 1) {
                     $criteria = new Criteria();
                     if ($this->getRequestParameter('fk_cuenta_id')) {
                         $criteria->add(ResponsablePeer::FK_CUENTA_ID, $this->getRequestParameter('fk_cuenta_id'));
                     }
                     $responsables = ResponsablePeer::doSelect($criteria);
                     foreach ($responsables as $responsable) {
                         $aDato['responsable'][] = $responsable->toArray();
                     }
                 } else {
                     if ($this->getRequestParameter('responsable_id')) {
                         $responsable = ResponsablePeer::retrieveByPk($this->getRequestParameter('responsable_id'));
                         $aDato['responsable'] = $responsable->toArray();
                     }
                 }
                 break;
             case 'alumno':
                 //dependiendo si es una variables de cilcos
                 if (array_key_exists('loop', $result) and $result['loop'] == 1) {
                     $criteria = new Criteria();
                     if ($this->getRequestParameter('division_id')) {
                         $criteria->add(DivisionPeer::ID, $this->getRequestParameter('division_id'));
                     }
                     if ($this->getRequestParameter('fk_cuenta_id')) {
                         $criteria->add(AlumnoPeer::FK_CUENTA_ID, $this->getRequestParameter('fk_cuenta_id'));
                     }
                     $criteria->addJoin(RelAlumnoDivisionPeer::FK_ALUMNO_ID, AlumnoPeer::ID);
                     $criteria->addJoin(RelAlumnoDivisionPeer::FK_DIVISION_ID, DivisionPeer::ID);
                     $criteria->addAscendingOrderByColumn(AlumnoPeer::APELLIDO);
                     $alumnos = AlumnoPeer::doSelect($criteria);
                     foreach ($alumnos as $alumno) {
                         $aDato['alumno'][] = $alumno->toArrayInforme();
                     }
                 } else {
                     if ($this->getRequestParameter('alumno_id')) {
                         $alumno = AlumnoPeer::retrieveByPk($this->getRequestParameter('alumno_id'));
                         $aDato['alumno'] = $alumno->toArrayInforme();
                     }
                 }
                 break;
             case 'division':
                 if ($this->getRequestParameter('division_id')) {
                     $d = DivisionPeer::retrieveByPK($this->getRequestParameter('division_id'));
                 } else {
                     $c = new Criteria();
                     $c->add(RelAlumnoDivisionPeer::FK_ALUMNO_ID, $this->getRequestParameter('alumno_id'));
                     $relAlumnoDivision = RelAlumnoDivisionPeer::doSelectOne($c);
                     $d = $relAlumnoDivision->getDivision();
                 }
                 $aDato['division'] = $d->toArrayInforme();
                 break;
             case 'establecimiento':
                 if ($this->getUser()->getAttribute('fk_establecimiento_id')) {
                     $establecimiento = EstablecimientoPeer::retrieveByPk($this->getUser()->getAttribute('fk_establecimiento_id'));
                     $aDato['establecimiento'] = $establecimiento->toArrayInforme();
                 }
                 break;
             case 'ciclolectivo':
                 if ($this->getUser()->getAttribute('fk_ciclolectivo_id')) {
                     $ciclolectivo_id = $this->getUser()->getAttribute('fk_ciclolectivo_id');
                     $ciclolectivo = CiclolectivoPeer::retrieveByPk($ciclolectivo_id);
                     $aDato['ciclolectivo'] = $ciclolectivo->toArray();
                 }
                 break;
             case 'locacion':
                 if (array_key_exists('loop', $result) and $result['loop'] == 1 and $this->getUser()->getAttribute('fk_establecimiento_id')) {
                     $c = new Criteria();
                     $c->add(RelEstablecimientoLocacionPeer::FK_ESTABLECIMIENTO_ID, $this->getUser()->getAttribute('fk_establecimiento_id'));
                     $c->addJoin(RelEstablecimientoLocacionPeer::FK_LOCACION_ID, LocacionPeer::ID);
                     $locaciones = LocacionPeer::doSelect($c);
                     foreach ($locaciones as $locacion) {
                         $aDato['locacion'][] = $locacion->toArray();
                     }
                 } else {
                     if ($this->getRequestParameter('locacion_id')) {
                         $c = new Criteria();
                         $c->add(LocacionPeer::ID, $this->getRequestParameter('locacion_id'));
                         $locacion = LocacionPeer::doSelect($c);
                         $aDato['locacion'] = $locacion->toArray();
                     }
                 }
                 break;
             case 'espacio':
                 if (array_key_exists('loop', $result) and $result['loop'] == 1 and $this->getUser()->getAttribute('fk_establecimiento_id')) {
                     $c = new Criteria();
                     $c->add(RelEstablecimientoLocacionPeer::FK_ESTABLECIMIENTO_ID, $this->getUser()->getAttribute('fk_establecimiento_id'));
                     $c->addJoin(RelEstablecimientoLocacionPeer::FK_LOCACION_ID, LocacionPeer::ID);
                     if ($this->getRequestParameter('locacion_id')) {
                         $c->add(LocacionPeer::ID, $this->getRequestParameter('locacion_id'));
                     }
                     $c->addJoin(EspacioPeer::FK_LOCACION_ID, LocacionPeer::ID);
                     $espacios = EspacioPeer::doSelect($c);
                     foreach ($espacios as $espacio) {
                         $aDato['espacio'][] = $espacio->toArray();
                     }
                 } else {
                     if ($this->getRequestParameter('espacio_id')) {
                         $c = new Criteria();
                         $c->add(EspacioPeer::ID, $this->getRequestParameter('espacio_id'));
                         $espacio = EspacioPeer::doSelect($c);
                         $aDato['espacio'] = $espacio->toArray();
                     }
                 }
                 break;
             case 'organizacion':
                 if ($this->getUser()->getAttribute('fk_establecimiento_id')) {
                     $c = new Criteria();
                     $c->add(EstablecimientoPeer::ID, $this->getUser()->getAttribute('fk_establecimiento_id'));
                     $c->addJoin(EstablecimientoPeer::FK_ORGANIZACION_ID, OrganizacionPeer::ID);
                     $organizacion = OrganizacionPeer::doSelectOne($c);
                     $aDato['organizacion'] = $organizacion->toArray();
                 }
                 break;
             case 'usuario':
                 if ($this->getUser()->getAttribute('id')) {
                     $usuario = UsuarioPeer::retrieveByPk($this->getUser()->getAttribute('id'));
                     $aUsuario = $usuario->toArray();
                     //por seguridad: para no mostrar otros datos del usuario como clave, preguntas, etc
                     $aDato['usuario'] = array('Usuario' => $aUsuario['Usuario'], 'Email' => $aUsuario['Email']);
                 }
                 break;
             case 'docente':
                 if (array_key_exists('loop', $result) and $result['loop'] == 1) {
                     $c = new Criteria();
                     $docentes = DocentePeer::doSelect($c);
                     foreach ($docentes as $docente) {
                         $aDato['docente'][] = $docente->toArray();
                     }
                 } else {
                     if ($this->getRequestParameter('docente_id')) {
                         $docente = DocentePeer::retrieveByPK($this->getRequestParameter('docente_id'));
                         $aDato['docente'] = $docente->toArray();
                     }
                 }
                 break;
             case 'boletin':
                 break;
             default:
         }
     }
     return $aDato;
 }
 public static function doSelectJoinAllExceptDocente(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     RelDocenteEstablecimientoPeer::addSelectColumns($c);
     $startcol2 = RelDocenteEstablecimientoPeer::NUM_COLUMNS - RelDocenteEstablecimientoPeer::NUM_LAZY_LOAD_COLUMNS;
     EstablecimientoPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (EstablecimientoPeer::NUM_COLUMNS - EstablecimientoPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(RelDocenteEstablecimientoPeer::FK_ESTABLECIMIENTO_ID), array(EstablecimientoPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = RelDocenteEstablecimientoPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = RelDocenteEstablecimientoPeer::getInstanceFromPool($key1))) {
         } else {
             $omClass = RelDocenteEstablecimientoPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             RelDocenteEstablecimientoPeer::addInstanceToPool($obj1, $key1);
         }
         $key2 = EstablecimientoPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = EstablecimientoPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = EstablecimientoPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 EstablecimientoPeer::addInstanceToPool($obj2, $key2);
             }
             $obj2->addRelDocenteEstablecimiento($obj1);
         }
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
示例#6
0
 public function getEstablecimientosJoinProvincia($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     if ($criteria === null) {
         $criteria = new Criteria(OrganizacionPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collEstablecimientos === null) {
         if ($this->isNew()) {
             $this->collEstablecimientos = array();
         } else {
             $criteria->add(EstablecimientoPeer::FK_ORGANIZACION_ID, $this->id);
             $this->collEstablecimientos = EstablecimientoPeer::doSelectJoinProvincia($criteria, $con, $join_behavior);
         }
     } else {
         $criteria->add(EstablecimientoPeer::FK_ORGANIZACION_ID, $this->id);
         if (!isset($this->lastEstablecimientoCriteria) || !$this->lastEstablecimientoCriteria->equals($criteria)) {
             $this->collEstablecimientos = EstablecimientoPeer::doSelectJoinProvincia($criteria, $con, $join_behavior);
         }
     }
     $this->lastEstablecimientoCriteria = $criteria;
     return $this->collEstablecimientos;
 }
示例#7
0
 public static function doSelectJoinAllExceptEstadosalumnos(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     AlumnoPeer::addSelectColumns($c);
     $startcol2 = AlumnoPeer::NUM_COLUMNS - AlumnoPeer::NUM_LAZY_LOAD_COLUMNS;
     ProvinciaPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (ProvinciaPeer::NUM_COLUMNS - ProvinciaPeer::NUM_LAZY_LOAD_COLUMNS);
     TipodocumentoPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + (TipodocumentoPeer::NUM_COLUMNS - TipodocumentoPeer::NUM_LAZY_LOAD_COLUMNS);
     EstablecimientoPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + (EstablecimientoPeer::NUM_COLUMNS - EstablecimientoPeer::NUM_LAZY_LOAD_COLUMNS);
     CuentaPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + (CuentaPeer::NUM_COLUMNS - CuentaPeer::NUM_LAZY_LOAD_COLUMNS);
     ConceptobajaPeer::addSelectColumns($c);
     $startcol7 = $startcol6 + (ConceptobajaPeer::NUM_COLUMNS - ConceptobajaPeer::NUM_LAZY_LOAD_COLUMNS);
     PaisPeer::addSelectColumns($c);
     $startcol8 = $startcol7 + (PaisPeer::NUM_COLUMNS - PaisPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(AlumnoPeer::FK_PROVINCIA_ID), array(ProvinciaPeer::ID), $join_behavior);
     $c->addJoin(array(AlumnoPeer::FK_TIPODOCUMENTO_ID), array(TipodocumentoPeer::ID), $join_behavior);
     $c->addJoin(array(AlumnoPeer::FK_ESTABLECIMIENTO_ID), array(EstablecimientoPeer::ID), $join_behavior);
     $c->addJoin(array(AlumnoPeer::FK_CUENTA_ID), array(CuentaPeer::ID), $join_behavior);
     $c->addJoin(array(AlumnoPeer::FK_CONCEPTOBAJA_ID), array(ConceptobajaPeer::ID), $join_behavior);
     $c->addJoin(array(AlumnoPeer::FK_PAIS_ID), array(PaisPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = AlumnoPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = AlumnoPeer::getInstanceFromPool($key1))) {
         } else {
             $omClass = AlumnoPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             AlumnoPeer::addInstanceToPool($obj1, $key1);
         }
         $key2 = ProvinciaPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = ProvinciaPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = ProvinciaPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 ProvinciaPeer::addInstanceToPool($obj2, $key2);
             }
             $obj2->addAlumno($obj1);
         }
         $key3 = TipodocumentoPeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = TipodocumentoPeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $omClass = TipodocumentoPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 TipodocumentoPeer::addInstanceToPool($obj3, $key3);
             }
             $obj3->addAlumno($obj1);
         }
         $key4 = EstablecimientoPeer::getPrimaryKeyHashFromRow($row, $startcol4);
         if ($key4 !== null) {
             $obj4 = EstablecimientoPeer::getInstanceFromPool($key4);
             if (!$obj4) {
                 $omClass = EstablecimientoPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj4 = new $cls();
                 $obj4->hydrate($row, $startcol4);
                 EstablecimientoPeer::addInstanceToPool($obj4, $key4);
             }
             $obj4->addAlumno($obj1);
         }
         $key5 = CuentaPeer::getPrimaryKeyHashFromRow($row, $startcol5);
         if ($key5 !== null) {
             $obj5 = CuentaPeer::getInstanceFromPool($key5);
             if (!$obj5) {
                 $omClass = CuentaPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj5 = new $cls();
                 $obj5->hydrate($row, $startcol5);
                 CuentaPeer::addInstanceToPool($obj5, $key5);
             }
             $obj5->addAlumno($obj1);
         }
         $key6 = ConceptobajaPeer::getPrimaryKeyHashFromRow($row, $startcol6);
         if ($key6 !== null) {
             $obj6 = ConceptobajaPeer::getInstanceFromPool($key6);
             if (!$obj6) {
                 $omClass = ConceptobajaPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj6 = new $cls();
                 $obj6->hydrate($row, $startcol6);
                 ConceptobajaPeer::addInstanceToPool($obj6, $key6);
             }
             $obj6->addAlumno($obj1);
         }
         $key7 = PaisPeer::getPrimaryKeyHashFromRow($row, $startcol7);
         if ($key7 !== null) {
             $obj7 = PaisPeer::getInstanceFromPool($key7);
             if (!$obj7) {
                 $omClass = PaisPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj7 = new $cls();
                 $obj7->hydrate($row, $startcol7);
                 PaisPeer::addInstanceToPool($obj7, $key7);
             }
             $obj7->addAlumno($obj1);
         }
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(EstablecimientoPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(EstablecimientoPeer::DATABASE_NAME);
         $criteria->add(EstablecimientoPeer::ID, $pks, Criteria::IN);
         $objs = EstablecimientoPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
示例#9
0
 /**
  * Cambiamos de establecimiento y pasamos al ciclo actual activo del mismo
  */
 public function executeActual()
 {
     $id = $this->getRequestParameter('establecimiento');
     $c = new Criteria();
     $c->add(EstablecimientoPeer::ID, $id);
     $establecimiento = EstablecimientoPeer::doSelectOne($c);
     if ($establecimiento) {
         $this->getUser()->setAttribute('fk_establecimiento_id', $id);
         $this->getUser()->setAttribute('establecimiento_nombre', $establecimiento->getNombre());
         //  $this->getUser()->setFlash('notice', 'Se ha cambiado de establecimiento');
         $c = new Criteria();
         $c->add(CiclolectivoPeer::FK_ESTABLECIMIENTO_ID, $id);
         $c->addDescendingOrderByColumn(CiclolectivoPeer::ACTUAL);
         $cicloactual = CiclolectivoPeer::doSelectOne($c);
         if ($cicloactual) {
             $this->getUser()->setAttribute('fk_ciclolectivo_id', $cicloactual->getId());
             $this->getUser()->setAttribute('ciclolectivo_descripcion', $cicloactual->getDescripcion());
             return $this->redirect($this->getRequestParameter('referer', '@homepage'));
         } else {
             $this->getUser()->setAttribute('fk_ciclolectivo_id', 0);
             $this->getUser()->setAttribute('ciclolectivo_descripcion', 'No Seleccionado');
             return $this->redirect($this->getRequestParameter('referer', '@homepage'));
         }
     }
 }
示例#10
0
 public function executeEdit($request)
 {
     $this->alumno = $this->getAlumnoOrCreate();
     //Datos de la cuenta
     $datosCuenta = "";
     if ($this->getRequestParameter("fk_cuenta_id")) {
         $datosCuenta = CuentaPeer::retrieveByPk($this->getRequestParameter("fk_cuenta_id"));
     }
     if ($this->alumno->getFkCuentaId()) {
         $datosCuenta = CuentaPeer::retrieveByPk($this->alumno->getFkCuentaId());
     }
     $this->datosCuenta = $datosCuenta;
     //Prefijo y número de legajo
     $establecimiento_id = $this->getUser()->getAttribute('fk_establecimiento_id');
     $estable = EstablecimientoPeer::retrieveByPk($establecimiento_id);
     $this->prefijo = $this->alumno->getLegajoPrefijo();
     $this->nrolegajo = $this->alumno->getLegajoNumero();
     if ($this->prefijo == "") {
         $this->prefijo = $estable->getLegajoPrefijo();
     }
     if ($this->nrolegajo == "") {
         $this->nrolegajo = $estable->getLegajoSiguiente();
     }
     //Fecha de nacimiento
     $today = getdate();
     $fecha_nac = $this->alumno->getFechaNacimiento("Y");
     if ($fecha_nac != "") {
         $this->edad = $today['year'] - $fecha_nac;
     } else {
         $this->edad = "";
     }
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         $this->alumno = $this->getAlumnoOrCreate();
         $this->updateAlumnoFromRequest();
         //Obteniendo fecha segun cultura
         $fecha_nacimiento = $this->getRequestParameter('alumno[fecha_nacimiento]');
         if ($fecha_nacimiento) {
             $user_culture = $this->getUser()->getCulture();
             list($d, $m, $y) = $this->getContext()->getI18N()->getDateForCulture($fecha_nacimiento, $user_culture);
             $this->alumno->setFechaNacimiento("{$y}-{$m}-{$d}");
         }
         $this->saveAlumno($this->alumno);
         //Actualizo el nro siguiente.
         $nrosiguiente = $this->alumno->getLegajoNumero() + 1;
         $estable->setLegajoSiguiente($nrosiguiente);
         $estable->Save();
         $this->getUser()->setFlash('notice', 'Your modifications have been saved');
         if ($this->getRequestParameter('save_and_add')) {
             return $this->redirect('alumno/create?fk_cuenta_id=' . $this->alumno->getFkCuentaId());
         } else {
             return $this->redirect('alumno/edit?id=' . $this->alumno->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');
         if ($this->getRequestParameter('fk_cuenta_id')) {
             $this->alumno->setFkCuentaId($this->getRequestParameter('fk_cuenta_id'));
         }
     }
 }
示例#11
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = EstablecimientoPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setNombre($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setDescripcion($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setCuit($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setLegajoprefijo($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setLegajosiguiente($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setFkDistritoescolarId($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setFkOrganizacionId($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setFkNiveltipoId($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setDireccion($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setCiudad($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setCodigoPostal($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setTelefono($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setFkProvinciaId($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setRector($arr[$keys[14]]);
     }
 }
示例#12
0
 public function toArrayInforme($keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = EstablecimientoPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getNombre(), $keys[2] => $this->getDescripcion(), 'DistritoEscolar' => $this->getDistritoescolar() ? $this->getDistritoescolar()->getNombre() : '', 'Organizacion' => $this->getOrganizacion() ? $this->getOrganizacion()->getNombre() : '', 'NivelTipo' => $this->getNiveltipo() ? $this->getNiveltipo()->getNombre() : '');
     return $result;
 }
示例#13
0
 public function executeListConcepto()
 {
     // inicializando variables
     $optionsConcepto = array();
     $optionsDivision = array();
     $optionsCarrera = array();
     $aAlumno = array();
     $division_id = "";
     $concepto_id = "";
     $periodo_id = "";
     $carrera_id = "";
     $aPeriodo = array();
     $aPosiblesNotas = array();
     $optionsPeriodo = array();
     $aNotaAlumno = array();
     $aNotaAlumnoObs = array();
     $sizeNota = 0;
     $establecimiento_id = $this->getUser()->getAttribute('fk_establecimiento_id');
     // tomando los datos del formulario
     $division_id = $this->getRequestParameter('division_id');
     $periodo_id = $this->getRequestParameter('periodo_id');
     $concepto_id = $this->getRequestParameter('concepto_id');
     $carrera_id = $this->getRequestParameter('carrera_id');
     // llenando el combo de division segun establecimiento
     $optionsDivision = $this->getDivisiones($establecimiento_id, $carrera_id);
     $optionsCarrera = $this->getCarreras($establecimiento_id);
     $optionsConcepto[] = "";
     $e = EstablecimientoPeer::retrieveByPk($establecimiento_id);
     $optionsConcepto = array_merge($optionsConcepto, $e->getConceptosArray());
     $aAlumno = $this->getAlumnos($division_id);
     $criteria = new Criteria();
     $criteria->add(PeriodoPeer::FK_CICLOLECTIVO_ID, $this->getUser()->getAttribute('fk_ciclolectivo_id'));
     $criteria->add(PeriodoPeer::CALCULAR, false);
     $aPeriodo = PeriodoPeer::doSelect($criteria);
     $optionsPeriodo[] = "Todos";
     foreach ($aPeriodo as $periodo) {
         $optionsPeriodo[$periodo->getId()] = $periodo->getDescripcion();
     }
     if ($periodo_id) {
         $aPeriodo = array();
         $aPeriodo[] = PeriodoPeer::retrieveByPK($periodo_id);
     }
     if (count($aAlumno) > 0) {
         // esto puede ser mejorado con solo una query bastante facilmente
         foreach ($aAlumno as $alumno) {
             foreach ($aPeriodo as $periodo) {
                 $criteria = new Criteria();
                 $criteria->add(BoletinConceptualPeer::FK_ALUMNO_ID, $alumno->getId());
                 $criteria->add(BoletinConceptualPeer::FK_PERIODO_ID, $periodo->getId());
                 $criteria->add(BoletinConceptualPeer::FK_CONCEPTO_ID, $concepto_id);
                 $aBoletinConceptual = BoletinConceptualPeer::doSelect($criteria);
                 $aNotaAlumno[$alumno->getId()][$periodo->getId()] = "";
                 $aNotaAlumnoObs[$alumno->getId()][$periodo->getId()] = "";
                 foreach ($aBoletinConceptual as $boletinConceptual) {
                     //if(method_exists($legajopedagogico->getResumen(),'getContents')) {
                     if ($boletinConceptual->getFkEscalanotaId()) {
                         $aNotaAlumno[$alumno->getId()][$periodo->getId()] = $boletinConceptual->getEscalanota()->getNombre();
                     }
                     if ($boletinConceptual->getObservacion()) {
                         if ($boletinConceptual->getObservacion() != null) {
                             $aNotaAlumnoObs[$alumno->getId()][$periodo->getId()] = $boletinConceptual->getObservacion();
                         }
                     }
                 }
             }
         }
     }
     $criteria = new Criteria();
     $criteria->add(EscalanotaPeer::FK_ESTABLECIMIENTO_ID, $establecimiento_id);
     $aPosiblesNotas = EscalanotaPeer::doSelect($criteria);
     foreach ($aPosiblesNotas as $p) {
         $actual = strlen($p->getNombre());
         if ($actual > $sizeNota) {
             $sizeNota = $actual;
         }
     }
     // llenar variables a mostrar en el template
     $this->optionsDivision = $optionsDivision;
     $this->optionsConcepto = $optionsConcepto;
     $this->aAlumno = $aAlumno;
     $this->division_id = $division_id;
     $this->concepto_id = $concepto_id;
     $this->periodo_id = $periodo_id;
     $this->carrera_id = $carrera_id;
     $this->optionsCarrera = $optionsCarrera;
     $this->aPeriodo = $aPeriodo;
     $this->aPosiblesNotas = $aPosiblesNotas;
     $this->optionsPeriodo = $optionsPeriodo;
     $this->aNotaAlumno = $aNotaAlumno;
     $this->aNotaAlumnoObs = $aNotaAlumnoObs;
     $this->sizeNota = $sizeNota;
 }