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

commits en pressenter.com.ar commits en pressenter.com.ar
Mie Ago 29 18:13:08 CEST 2007


Author: josx
Date: 2007-08-29 13:13:06 -0300 (Wed, 29 Aug 2007)
New Revision: 5023

Added:
   prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/autocompletarApeSuccess.php
   prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/autocompletarNomSuccess.php
Modified:
   prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/actions/actions.class.php
   prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/indexSuccess.php
Log:
Se agrego dos autocompletar con apellido y nombre en la busqueda de usuarios

Modified: prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/actions/actions.class.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/actions/actions.class.php	2007-08-29 14:40:02 UTC (rev 5022)
+++ prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/actions/actions.class.php	2007-08-29 16:13:06 UTC (rev 5023)
@@ -46,7 +46,8 @@
 
         // tomando los datos del formulario
         $division_id = $this->getRequestParameter('division_id');
-        $txt = $this->getRequestParameter('txt');
+        $txt_apellido = $this->getRequestParameter('txt_apellido');
+        $txt_nombre = $this->getRequestParameter('txt_nombre');
 
         // llenando el combo de division segun establecimiento
         $establecimiento_id = $this->getUser()->getAttribute('fk_establecimiento_id');
@@ -69,30 +70,22 @@
             }
             
         
-            if($txt) {
-                $cton1 = $criteria->getNewCriterion(AlumnoPeer::NOMBRE, "%$txt%", Criteria::LIKE);
-                $cton2 = $criteria->getNewCriterion(AlumnoPeer::APELLIDO, "%$txt%", Criteria::LIKE);
-                $cton1->addOr($cton2);
-                $criteria->add($cton1);
+            if($txt_apellido) {
+                $criteria->add(AlumnoPeer::APELLIDO, "$txt_apellido%", Criteria::LIKE);
             }
 
-//             $criteria->addAsColumn("alumno_id", AlumnoPeer::ID);
-//             $criteria->addAsColumn("alumno_nombre", AlumnoPeer::NOMBRE);
-//             $criteria->addAsColumn("alumno_apellido", AlumnoPeer::APELLIDO);
-//             $criteria->addAsColumn("division_id", DivisionPeer::ID);
-//             $criteria->addAsColumn("division_descripcion", DivisionPeer::DESCRIPCION);
+            if($txt_nombre) {
+                $criteria->add(AlumnoPeer::NOMBRE, "$txt_nombre%", Criteria::LIKE);
+            }
 
             $aAlumno = AlumnoPeer::doSelect($criteria);
-//             foreach($alumnos as $alumno) {
-//                 $aAlumno[] = (object) array( 'alumno_id' => $alumno[0],'alumno_nombre' => $alumno[1], 'alumno_apellido' => $alumno[2] );
-//             }
-    
         }
 
         // asignando variables para ser usadas en el template
         $this->optionsDivision = $optionsDivision;
         $this->division_id = $division_id;
-        $this->txt = $txt;
+        $this->txt_apellido = $txt_apellido;
+        $this->txt_nombre = $txt_nombre;
         $this->aAlumno = $aAlumno;
 
     }
@@ -333,6 +326,28 @@
         return $this->redirect("legajopedagogico?action=edit&aid=".$this->alumno_id."&id=".$this->legajopedagogico_id);
     }
 
+    public function executeAutocompletarApe() {
+        $txt_apellido = $this->getRequestParameter('txt_apellido');
+        $criteria = new Criteria();
+        $criteria->add(AlumnoPeer::APELLIDO, "$txt_apellido%", Criteria::LIKE);
+        $alumnos = AlumnoPeer::doSelect($criteria);
+        $this->forward404Unless($alumnos);
 
 
+        $this->aAlumno = $alumnos;
+    }
+
+
+    public function executeAutocompletarNom() {
+        $txt_nombre = $this->getRequestParameter('txt_nombre');
+        $criteria = new Criteria();
+        $criteria->add(AlumnoPeer::NOMBRE, "$txt_nombre%", Criteria::LIKE);
+        $alumnos = AlumnoPeer::doSelect($criteria);
+        $this->forward404Unless($alumnos);
+        $this->aAlumno = $alumnos;
+    }
+
+
 }
+
+?>
\ No newline at end of file

Added: prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/autocompletarApeSuccess.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/autocompletarApeSuccess.php	2007-08-29 14:40:02 UTC (rev 5022)
+++ prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/autocompletarApeSuccess.php	2007-08-29 16:13:06 UTC (rev 5023)
@@ -0,0 +1,5 @@
+<ul>
+<?php foreach ($aAlumno as $key => $value): ?>
+  <li id="<?php echo $key ?>"><?php echo $value->getApellido() ?></li>
+<?php endforeach; ?>
+</ul>
\ No newline at end of file


Property changes on: prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/autocompletarApeSuccess.php
___________________________________________________________________
Name: svn:keywords
   + "Id Author URL Date Rev"

Added: prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/autocompletarNomSuccess.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/autocompletarNomSuccess.php	2007-08-29 14:40:02 UTC (rev 5022)
+++ prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/autocompletarNomSuccess.php	2007-08-29 16:13:06 UTC (rev 5023)
@@ -0,0 +1,5 @@
+<ul>
+<?php foreach ($aAlumno as $key => $value): ?>
+  <li id="<?php echo $key ?>"><?php echo $value->getNombre() ?></li>
+<?php endforeach; ?>
+</ul>
\ No newline at end of file


Property changes on: prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/autocompletarNomSuccess.php
___________________________________________________________________
Name: svn:keywords
   + "Id Author URL Date Rev"

Modified: prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/indexSuccess.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/indexSuccess.php	2007-08-29 14:40:02 UTC (rev 5022)
+++ prosistem/alba/trunk/alba/apps/principal/modules/legajopedagogico/templates/indexSuccess.php	2007-08-29 16:13:06 UTC (rev 5023)
@@ -1,17 +1,35 @@
-<?php use_helper("I18N")?>
+<?php use_helper("I18N","Javascript")?>
 <div id="sf_admin_container">
-
+<h1>Buscar Alumnos</h1>
 <?php echo form_tag('legajopedagogico/index', 'id=sf_admin_edit_form name=sf_admin_edit_form multipart=true') ?>
 
 <?php //echo object_input_hidden_tag($calendario, 'getId') ?>
 
 <fieldset id="sf_fieldset_none" class="">
     <div class="form-row">
-        <?php echo label_for('Buscar', __('Buscar Alumnos:')) ?>
-        <?php echo input_tag('txt', '') ?>   
+        <?php echo label_for('Buscar', __('Por apellido:')) ?>
+ <?php
+echo input_auto_complete_tag('txt_apellido', '',
+'legajopedagogico/autocompletarApe',
+array('autocomplete' => 'off'),
+array('use_style' => true)
+)
+?>
     </div>
 
     <div class="form-row">
+        <?php echo label_for('Buscar', __('Por nombre:')) ?>
+ <?php
+echo input_auto_complete_tag('txt_nombre', '',
+'legajopedagogico/autocompletarNom',
+array('autocomplete' => 'off'),
+array('use_style' => true)
+)
+?>
+    </div>
+
+
+    <div class="form-row">
         <?php echo label_for('division', __('Division:')) ?>
         <?php echo select_tag('division_id', options_for_select($optionsDivision, $division_id)) ?>
     </div>
@@ -28,8 +46,8 @@
 
 
 <?php if (count($aAlumno) > 0) {
-    if ($txt) { ?>
-    Usted busco -<?php echo $txt?>-
+        if ($txt_apellido OR $txt_nombre) { ?>
+    Usted busco -<?php echo (($txt_apellido)?$txt_apellido:"")." ".(($txt_nombre)?$txt_nombre:"") ?>-
     <?php } ?>
 <h1>Alumnos</h1>
 <table cellspacing="0" class="sf_admin_list">
@@ -66,8 +84,8 @@
 </table>
 
 <?php } else {
-    if ($txt) { ?>
-        Su b&uacute;squeda por -<?php echo $txt?>- no ha encontrado alumnos.
+    if ($txt_apellido OR $txt_nombre) { ?>
+        Su b&uacute;squeda por -<?php echo (($txt_apellido)?$txt_apellido:"")." ".(($txt_nombre)?$txt_nombre:"") ?>- no ha encontrado alumnos.
     <?php } 
 } 
 ?>




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