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

commits en pressenter.com.ar commits en pressenter.com.ar
Lun Abr 27 23:02:39 CEST 2009


Author: josx
Date: 2009-04-27 18:02:39 -0300 (Mon, 27 Apr 2009)
New Revision: 6137

Modified:
   prosistem/alba/trunk/alba/apps/principal/modules/informes/actions/actions.class.php
   prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/variablesSuccess.php
Log:
Agregando soporte de combo para las variables para completar los informes

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	2009-04-27 21:00:48 UTC (rev 6136)
+++ prosistem/alba/trunk/alba/apps/principal/modules/informes/actions/actions.class.php	2009-04-27 21:02:39 UTC (rev 6137)
@@ -357,12 +357,27 @@
             $this->forward404Unless($alumno);
             $this->alumno = $alumno;
         }
-
-        $this->variables = explode(";",$informe->getVariables());
+        // El formato normal es ->   variable1;variable2;variableN
+        // Se puede agregar variables para select ->  variable:valor1,valor2,valorN
+        $variables = explode(";",$informe->getVariables());
+        foreach($variables as $variable) {
+            $pos = stripos($variable,":");
+            if($pos === false) {
+                $final_variables["$variable"] = $variable;
+            } else {
+                $str_op = substr($variable, $pos+1);
+                $idx_op = substr($variable, 0, $pos);
+                $aOp = explode(",",$str_op);
+                $final_variables["$idx_op"] = array_combine($aOp,$aOp);
+            }
+        }
+        $this->variables = $final_variables;
         $this->informe = $informe;
     }
 
 
+
+
     public function executeBusquedaListadoAlumnos() {
         $informe = InformePeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($informe);
@@ -440,9 +455,16 @@
         if($informe->getVariables()) {
             $aDato['variable'] = array();
             $variables = explode(";",$informe->getVariables());
+
             foreach($variables as $variable) {
+                $pos = stripos($variable,":");
+                if($pos === false) {
+                } else {
+                    $variable = substr($variable, 0, $pos);
+                }
                 $aDato['variable'] = array_merge( $aDato['variable'], array ( $variable => $this->getRequestParameter($variable)));
             }
+
         }
 
         // lleno finalmente de diferente forma si es un array (ciclo) o no (variable comun)

Modified: prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/variablesSuccess.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/variablesSuccess.php	2009-04-27 21:00:48 UTC (rev 6136)
+++ prosistem/alba/trunk/alba/apps/principal/modules/informes/templates/variablesSuccess.php	2009-04-27 21:02:39 UTC (rev 6137)
@@ -22,14 +22,15 @@
 <legend>Debe completar los siguiente datos</legend>
 
 <fieldset id="sf_fieldset_none" class="">
-
-
-
-        <?php 
-            foreach($variables as $variable) {
+<?php
+            foreach($variables as $idx => $variable) {
                 ?><div class="form-row"><?php
-                echo label_for($variable, __($variable.':'));
-                echo input_tag($variable);
+                echo label_for($idx, __($idx.':'));
+                if(!is_array($variable)) {
+                    echo input_tag($variable);
+                } else {
+                    echo select_tag($idx, options_for_select($variable));
+                }
                 ?></div><?php
             }
         ?>
@@ -58,4 +59,4 @@
 )) ?></li>
 </ul>
 </form>
-</div>
\ No newline at end of file
+</div>




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