Author: josx Date: 2007-11-07 12:11:39 -0300 (Wed, 07 Nov 2007) New Revision: 5283 Modified: prosistem/alba/trunk/alba/apps/principal/modules/informes/actions/actions.class.php prosistem/alba/trunk/alba/lib/model/Alumno.php prosistem/alba/trunk/alba/lib/model/Division.php prosistem/alba/trunk/alba/lib/model/Establecimiento.php prosistem/alba/trunk/alba/web/uploads/informes/certificado_de_estudios.odt prosistem/alba/trunk/alba/web/uploads/informes/certificado_de_terminacion_de_estudios_primarios.odt prosistem/alba/trunk/alba/web/uploads/informes/constancia_alumno_regular.odt prosistem/alba/trunk/alba/web/uploads/informes/solicitud_legajo.odt Log: Se han incorporado a los arrays de salida hacia los informes los datos que vienen de otras tablas (los foreign keys) Modified: prosistem/alba/trunk/alba/apps/principal/modules/informes/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/informes/actions/actions.class.php 2007-11-07 13:29:35 UTC (rev 5282) +++ prosistem/alba/trunk/alba/apps/principal/modules/informes/actions/actions.class.php 2007-11-07 15:11:39 UTC (rev 5283) @@ -338,8 +338,10 @@ case 'Alumnos': if($informe->getListado() == 1) { + $division_id = $this->getRequestParameter('division_id'); $d = DivisionPeer::retrieveByPK($division_id); + $aDato['division'] = $d->toArrayInforme(); // buscando alumnos $criteria = new Criteria(); @@ -350,44 +352,28 @@ $alumnos = AlumnoPeer::doSelect($criteria); foreach($alumnos as $alumno) { - $aDato['alumno'][] = $alumno->toArray(); + $aDato['alumno'][] = $alumno->toArrayInforme(); } - - $division = array( - 'Anio' => ($d->getAnio())?$d->getAnio()->getDescripcion():'' , - 'Descripcion' => $d->getDescripcion(), - 'Turno' => ($d->getTurno())?$d->getTurno()->getDescripcion():'', - 'Orientacion' => ($d->getOrientacion())?$d->getOrientacion()->getDescripcion():'' ); - $aDato['division'] = $division; - } else { + $alumno = AlumnoPeer::retrieveByPk($this->getRequestParameter('alumno_id')); - $aDato['alumno'] = $alumno->toArray(); + $aDato['alumno'] = $alumno->toArrayInforme(); - $aDato['tipoDocumento'] = array ( 'Nombre' => ($alumno->getTipoDocumento())?$alumno->getTipoDocumento()->getDescripcion():''); - $establecimiento = EstablecimientoPeer::retrieveByPk($establecimiento_id); - $aDato['establecimiento'] = $establecimiento->toArray(); + $aDato['establecimiento'] = $establecimiento->toArrayInforme(); - $aDato['distritoEscolar'] = array ( 'Nombre' => ($establecimiento->getDistritoescolar())?$establecimiento->getDistritoescolar()->getNombre():''); - $c = new Criteria(); $c->add(RelAlumnoDivisionPeer::FK_ALUMNO_ID, $alumno->getId()); $relAlumnoDivision = RelAlumnoDivisionPeer::doSelectOne($c); - $d = $relAlumnoDivision->getDivision(); - $division = array( - 'Anio' => ($d->getAnio())?$d->getAnio()->getDescripcion():'' , - 'Descripcion' => $d->getDescripcion(), - 'Turno' => ($d->getTurno())?$d->getTurno()->getDescripcion():'', - 'Orientacion' => ($d->getOrientacion())?$d->getOrientacion()->getDescripcion():'' ); + $aDato['division'] = $d->toArrayInforme(); - $aDato['division'] = $division; $aDato['informe'] = $informe->toArray(); $ciclolectivo_id = $this->getUser()->getAttribute('fk_ciclolectivo_id'); $ciclolectivo = CiclolectivoPeer::retrieveByPk($ciclolectivo_id); $aDato['ciclolectivo'] = $ciclolectivo->toArray(); + } if($informe->getVariables()) { @@ -494,7 +480,6 @@ // Saco del template todas las variables del tipo [sssss.rrrrr] y además // evitando las variables del tbs con ; //preg_match_all("/\[([^];]*\.[^];]*)\]/", $OOo->Source, $tplVars); - $matches = $result = array(); if (preg_match_all("~\[(\w+(?:\.\w+)*)\s*[\];]~", $OOo->Source, $matches)) { // Find tags foreach ($matches[1] as $tag) { // Process each Modified: prosistem/alba/trunk/alba/lib/model/Alumno.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Alumno.php 2007-11-07 13:29:35 UTC (rev 5282) +++ prosistem/alba/trunk/alba/lib/model/Alumno.php 2007-11-07 15:11:39 UTC (rev 5283) @@ -18,4 +18,38 @@ public function __toString() { return $this->getApellido() . " " . $this->getNombre() ; } + + public function toArrayInforme($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = AlumnoPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getNombre(), + $keys[2] => $this->getApellido(), + $keys[3] => $this->getFechaNacimiento(), + $keys[4] => $this->getDireccion(), + $keys[5] => $this->getCiudad(), + $keys[6] => $this->getCodigoPostal(), + 'Provincia' => ($this->getProvincia())?$this->getProvincia()->getNombreCorto():'' , + $keys[8] => $this->getTelefono(), + $keys[9] => $this->getLugarNacimiento(), + 'TipoDocumento' => ($this->getTipodocumento())?$this->getTipodocumento()->getNombre():'', + $keys[11] => $this->getNroDocumento(), + $keys[12] => $this->getSexo(), + $keys[13] => $this->getEmail(), + $keys[14] => $this->getDistanciaEscuela(), + $keys[15] => $this->getHermanosEscuela(), + $keys[16] => $this->getHijoMaestroEscuela(), + 'Establecimiento' => ($this->getEstablecimiento())?$this->getEstablecimiento()->getNombre():'', + 'Cuenta' => ($this->getCuenta())?$this->getCuenta()->getNombre():'', + $keys[19] => $this->getCertificadoMedico(), + $keys[20] => $this->getActivo(), + $keys[21] => $this->getFkConceptobajaId(), + 'Pais' => ($this->getPais())?$this->getPais()->getNombreLargo():'', + ); + return $result; + } + + + } // Alumno Modified: prosistem/alba/trunk/alba/lib/model/Division.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Division.php 2007-11-07 13:29:35 UTC (rev 5282) +++ prosistem/alba/trunk/alba/lib/model/Division.php 2007-11-07 15:11:39 UTC (rev 5283) @@ -18,5 +18,20 @@ public function __toString() { return $this->getAnio()->getDescripcion()." ".$this->getDescripcion().(($this->getOrientacion())?" ".$this->getOrientacion()->getNombre():""); } + + + public function toArrayInforme($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = DivisionPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + 'Año' => ($this->getAnio())?$this->getAnio()->getDescripcion():'' , + $keys[2] => $this->getDescripcion(), + 'Turno' => ($this->getTurno())?$this->getTurno()->getDescripcion():'' , + 'Orientacion' => ($this->getOrientacion())?$this->getOrientacion()->getDescripcion():'', + $keys[5] => $this->getOrden(), + ); + return $result; + } } // Division Modified: prosistem/alba/trunk/alba/lib/model/Establecimiento.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Establecimiento.php 2007-11-07 13:29:35 UTC (rev 5282) +++ prosistem/alba/trunk/alba/lib/model/Establecimiento.php 2007-11-07 15:11:39 UTC (rev 5283) @@ -20,4 +20,20 @@ return $this->getNombre(); } + + 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; + } + + } // Establecimiento Modified: prosistem/alba/trunk/alba/web/uploads/informes/certificado_de_estudios.odt =================================================================== (Binary files differ) Modified: prosistem/alba/trunk/alba/web/uploads/informes/certificado_de_terminacion_de_estudios_primarios.odt =================================================================== (Binary files differ) Modified: prosistem/alba/trunk/alba/web/uploads/informes/constancia_alumno_regular.odt =================================================================== (Binary files differ) Modified: prosistem/alba/trunk/alba/web/uploads/informes/solicitud_legajo.odt =================================================================== (Binary files differ)