[Alba-desarrollo] SVN Alba r5774 - in prosistem/alba/trunk/alba/apps/principal/modules/asistencia: actions templates

commits en pressenter.com.ar commits en pressenter.com.ar
Mar Jul 29 17:20:16 CEST 2008


Author: josx
Date: 2008-07-29 12:20:16 -0300 (Tue, 29 Jul 2008)
New Revision: 5774

Modified:
   prosistem/alba/trunk/alba/apps/principal/modules/asistencia/actions/actions.class.php
   prosistem/alba/trunk/alba/apps/principal/modules/asistencia/templates/indexSuccess.php
Log:
Agregnado filtro de carrera en Asistencias

Modified: prosistem/alba/trunk/alba/apps/principal/modules/asistencia/actions/actions.class.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/asistencia/actions/actions.class.php	2008-07-29 14:29:48 UTC (rev 5773)
+++ prosistem/alba/trunk/alba/apps/principal/modules/asistencia/actions/actions.class.php	2008-07-29 15:20:16 UTC (rev 5774)
@@ -70,11 +70,13 @@
         $cuenta_id = -1;
         $vista_id = 1;         // default para vista DIARIO
         $division_id =0;
+        $carrera_id = 0;
         $datos = array();
         $idxAlumno= array(); 
         $aFeriado = array();
         $aIntervalo = array();               
         $optionsDivision = array();
+        $optionsCarrera = array();
         $aTemp = array();
         $aFechaTemp = array();
         $aTipoasistencias = array();
@@ -122,6 +124,10 @@
             $cuenta_id = $a->getFkCuentaId();
         }
 
+        if($this->getRequestParameter('carrera_id')) {
+            $carrera_id = $this->getRequestParameter('carrera_id');
+        }
+ 
         if ($this->getRequestParameter('vistas')) {
             $vista_id  = $this->getRequestParameter('vistas');              
         }
@@ -131,11 +137,16 @@
         $criteria = new Criteria();
         $criteria->add(AnioPeer::FK_ESTABLECIMIENTO_ID, $establecimiento_id);
         
-        if ($this->getRequestParameter('alumno_id')){
+        if ($this->getRequestParameter('alumno_id')) {
             $criteria->add(RelAlumnoDivisionPeer::FK_ALUMNO_ID, $alumno_id);
             $criteria->addJoin(RelAlumnoDivisionPeer::FK_DIVISION_ID, DivisionPeer::ID );
         }
 
+        if($this->getRequestParameter('carrera_id')) {
+            $criteria->add(AnioPeer::FK_CARRERA_ID, $carrera_id);
+        }
+
+
         $criteria->addAscendingOrderByColumn(AnioPeer::DESCRIPCION);
         $criteria->addAscendingOrderByColumn(DivisionPeer::ORDEN);     
         $criteria->addAscendingOrderByColumn(DivisionPeer::DESCRIPCION);
@@ -157,6 +168,14 @@
             }
         }
 
+        $cCarrera = new Criteria();
+        $cCarrera->add(CarreraPeer::FK_ESTABLECIMIENTO_ID, $establecimiento_id);
+        $carreras = CarreraPeer::doSelect($cCarrera);
+        foreach($carreras as $carrera) {
+            $optionsCarrera[$carrera->getId()] = $carrera->getDescripcion();
+        }
+
+
         if(!checkdate($m,$d,$y)) {
             // Ver si se puede hacer desde el validate
             $this->getRequest()->setError('Fecha', 'La fecha ingresada es erronea');
@@ -312,7 +331,8 @@
         $this->aTipoasistencias = $aTipoasistencias;
         $this->aAlumnos = $idxAlumno;
         $this->aDatos = $datos;
-        $this->optionsDivision = $optionsDivision;    
+        $this->optionsDivision = $optionsDivision;
+        $this->optionsCarrera = $optionsCarrera;
         $this->aVistas = repeticiones();
         $this->aMeses = Meses();
         $this->aIntervalo = $aIntervalo;
@@ -322,6 +342,7 @@
         $this->cuenta_id = $cuenta_id;
         $this->vista_id = $vista_id;
         $this->division_id = $division_id;
+        $this->carrera_id = $carrera_id;
         $this->anio_desde = $anio_desde;
         $this->anio_hasta = $anio_hasta;
   }

Modified: prosistem/alba/trunk/alba/apps/principal/modules/asistencia/templates/indexSuccess.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/asistencia/templates/indexSuccess.php	2008-07-29 14:29:48 UTC (rev 5773)
+++ prosistem/alba/trunk/alba/apps/principal/modules/asistencia/templates/indexSuccess.php	2008-07-29 15:20:16 UTC (rev 5774)
@@ -33,6 +33,15 @@
 <?php use_helper('DateForm');
       use_helper("I18N");
 ?>
+<script>
+    function linkTo() {
+        var objd = document.getElementById('carrera_id');
+        var url  = "<?php echo url_for('asistencia/', false);?>/index/carrera_id/"+objd.options[objd.selectedIndex].value;
+        location.href = url;
+    }
+</script>
+
+
 <div id="sf_admin_container">
 <h1>Asistencias</h1>
     <?php if ($sf_request->hasErrors()): ?>
@@ -48,13 +57,16 @@
 
     <?php echo form_tag('asistencia/index', 'id=sf_admin_edit_form name=sf_admin_edit_form multipart=true') ?>
     <fieldset id="sf_fieldset_none" class="">
+
     <div class="form-row">
         <table cellspacing="1">
             <tr>
                 <td>
+                    <?php echo label_for('carrera_id', __('Carrera:'), 'class="required" '); ?>
                     <?php echo label_for('division_id', __('A&ntilde;o/Divisi&oacute;n:'), 'class="required" '); ?>
                 </td>
                 <td>
+                    <?php echo select_tag('carrera_id', options_for_select($optionsCarrera, $carrera_id, 'include_custom=--Todas--'),array('onChange' => 'javascript:linkTo()')); ?>
                     <?php echo select_tag('division_id', options_for_select($optionsDivision, $division_id)); ?>
                 </td>
                 <td style='padding-left:50px'>
@@ -74,14 +86,15 @@
                     <?php echo select_tag('vistas', options_for_select($aVistas, $vista_id)); ?>
                 </td>
             </tr>
+
         <table>      
         <ul class="sf_admin_actions">
             <li>
             <?php echo submit_tag(__('Mostrar'), array ('name' => 'Mostrar','class' => 'sf_admin_action_save')) ?>
             </li>
         </ul>
-      </div>      
-     </fieldset>
+      </div>
+      </fieldset>
         <?php if($alumno_id >= 0) {?>
             <?php echo input_hidden_tag('alumno_id', $alumno_id) ?>
         <?php }?>    




Más información sobre la lista de distribución Alba-desarrollo