SVN Alba r4963 - in prosistem/alba/trunk/alba/apps/principal/modules/asistencia: actions templates
Author: hsanchez Date: 2007-08-15 14:01:51 -0300 (Wed, 15 Aug 2007) New Revision: 4963 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: Separando acciones de la asistencia, corrigiendo codigo, y cambiando en el template los formularios 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 2007-08-15 17:00:45 UTC (rev 4962) +++ prosistem/alba/trunk/alba/apps/principal/modules/asistencia/actions/actions.class.php 2007-08-15 17:01:51 UTC (rev 4963) @@ -38,7 +38,31 @@ * */ public function executeIndex() { + + if ($this->getUser()->getAttribute('fk_ciclolectivo_id') == 0) + return $this->redirect('ciclolectivo/sinciclolectivo?m=' . $this->getRequestParameter('module')); + $this->obtenerDatos(); + } + + + /** + * Executes Listado action + * + */ + public function executeListado(){ + + if ($this->getUser()->getAttribute('fk_ciclolectivo_id') == 0) + return $this->redirect('ciclolectivo/sinciclolectivo?m=' . $this->getRequestParameter('module')); + + $this->obtenerDatos(); + } + + /** + * Obtiene los necesarios para ver la asistencias de alumnos + * + **/ + protected function obtenerDatos() { Misc::use_helper('Misc'); //Iniciando Variables @@ -59,57 +83,54 @@ $nombre_completo_archivo = ""; $bool_gd = array_search("gd", get_loaded_extensions()); - if ($this->getUser()->getAttribute('fk_ciclolectivo_id') == 0) - return $this->redirect('ciclolectivo/sinciclolectivo?m=' . $this->getRequestParameter('module')); - - // tomando los datos del formulario y completando variable + // Tomando los datos del formulario y completando variable $ciclolectivo_id = $this->getUser()->getAttribute('fk_ciclolectivo_id'); $ciclolectivo = CiclolectivoPeer::retrieveByPK($ciclolectivo_id); $ciclolectivo_fecha_inicio = strtotime($ciclolectivo->getFechaInicio()); $ciclolectivo_fecha_fin = strtotime($ciclolectivo->getFechaFin()); - // asigno la fecha de inicio del ciclo lectivo por defecto + // Asigno la fecha de inicio del ciclo lectivo por defecto $aFechaActual = getdate($ciclolectivo_fecha_inicio); - $d = $aFechaActual['mday']; - $m = $aFechaActual['mon']; - $y = $aFechaActual['year']; - // tomo el año de la fecha de inicio y de fin del ciclo lectivo + // Tomo el año de la fecha de inicio y de fin del ciclo lectivo $anio_desde = date("Y",$ciclolectivo_fecha_inicio); $anio_hasta = date("Y",$ciclolectivo_fecha_fin); - if ($this->getRequestParameter('alumno_id')) { - $alumno_id = $this->getRequestParameter('alumno_id'); - $a = AlumnoPeer::retrieveByPK($alumno_id); - $cuenta_id = $a->getFkCuentaId(); - - //$a->getRelAlumnoDivisions() - } - - - if ($this->getRequestParameter('vistas')) { - $vista_id = $this->getRequestParameter('vistas'); - } - if ($this->getRequestParameter('dia')) { $d = $this->getRequestParameter('dia'); } - + else + $d = $aFechaActual['mday']; + if ($this->getRequestParameter('mes')) { $m = $this->getRequestParameter('mes'); } + else + $m = $aFechaActual['mon']; if ($this->getRequestParameter('ano')) { $y = $this->getRequestParameter('ano'); } + else + $y = $aFechaActual['year']; + + if ($this->getRequestParameter('alumno_id')) { + $alumno_id = $this->getRequestParameter('alumno_id'); + $a = AlumnoPeer::retrieveByPK($alumno_id); + $cuenta_id = $a->getFkCuentaId(); + } + + if ($this->getRequestParameter('vistas')) { + $vista_id = $this->getRequestParameter('vistas'); + } + $establecimiento_id = $this->getUser()->getAttribute('fk_establecimiento_id'); $criteria = new Criteria(); $criteria->add(AnioPeer::FK_ESTABLECIMIENTO_ID, $establecimiento_id); - if ($this->getRequestParameter('alumno_id')){ $criteria->add(RelAlumnoDivisionPeer::FK_ALUMNO_ID, $alumno_id); $criteria->addJoin(RelAlumnoDivisionPeer::FK_DIVISION_ID, DivisionPeer::ID ); @@ -124,7 +145,7 @@ $optionsDivision[$division->getId()] = $division->getAnio()->getDescripcion()." ".$division->getDescripcion(); if ($this->getRequestParameter('division_id')) { - $division_id = $this->getRequestParameter('division_id'); + $division_id = $this->getRequestParameter('division_id'); } else { if (count($optionsDivision) > 0){ $aTemp = array_keys($optionsDivision); @@ -141,7 +162,7 @@ $this->getRequest()->setError('Fecha', 'La fecha ingresada es erronea'); $flag_error = 1; } - + if($flag_error == 0) { // devuelve un intervalo de dias según vista y fecha seleccionada $aIntervalo = diasxintervalo($d, $m, $y, $vista_id); @@ -214,7 +235,6 @@ $aTipoasistencias = $this->getTiposasistencias(); $aPorcentajeAsistencia = array(); $flag = 0; - $tot = 0; // cantidad de fechas sin fines de semana $cantFechas = 0; @@ -288,28 +308,9 @@ $this->division_id = $division_id; $this->anio_desde = $anio_desde; $this->anio_hasta = $anio_hasta; - - //Verifico si muestro versión para imprimir - if ($this->getRequestParameter('vista')) - $this->setLayout($this->getRequestParameter('vista')); } - /** - * Accion para mostrar los datos cambiados en el form - */ - function executeMostrar() { - $vista_id = $this->getRequestParameter('vistas'); - $vista = $this->getRequestParameter('vista'); - $d = $this->getRequestParameter('dia'); - $m = $this->getRequestParameter('mes'); - $y = $this->getRequestParameter('ano'); - return $this->forward('asistencia','index',"vista_id=$vista_id&dia=$d&mes=$m&ano=$y"); - } - public function handleErrorMostrar(){ - $this->forward('asistencia', 'index'); - } - /** * Graba las asistencias */ Modified: prosistem/alba/trunk/alba/apps/principal/modules/asistencia/templates/indexSuccess.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/asistencia/templates/indexSuccess.php 2007-08-15 17:00:45 UTC (rev 4962) +++ prosistem/alba/trunk/alba/apps/principal/modules/asistencia/templates/indexSuccess.php 2007-08-15 17:01:51 UTC (rev 4963) @@ -46,7 +46,7 @@ </div> <?php endif ?> - <?php echo form_tag('asistencia/mostrar', 'id=sf_admin_edit_form name=sf_admin_edit_form multipart=true') ?> + <?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"> @@ -166,7 +166,7 @@ <?php echo submit_tag(__('Grabar'), array ('name' => 'Grabar','class' => 'sf_admin_action_save')) ?> </form> <?php - echo form_tag('asistencia/mostrar', 'id=sf_admin_edit_form name=sf_admin_edit_form multipart=true'); + echo form_tag('asistencia/listado', 'id=sf_admin_edit_form name=sf_admin_edit_form multipart=true'); echo input_hidden_tag('division_id', $division_id); echo input_hidden_tag('dia', "$d"); echo input_hidden_tag('mes', "$m"); @@ -175,7 +175,7 @@ echo input_hidden_tag('vista', "layout_sinmenu"); if($alumno_id >= 0) echo input_hidden_tag('alumno_id', $alumno_id); - echo submit_tag(__('Imprimir'), array ('name' => 'Imprimir','class' => 'sf_admin_action_print')); + echo submit_tag(__('Listar'), array ('name' => 'Imprimir','class' => 'sf_admin_action_print')); ?> </form> </li></ul>
participants (1)
-
commits@pressenter.com.ar