[Alba-desarrollo] SVN Alba r6247 - in prosistem/alba/trunk/alba:
apps/principal/modules/ciclolectivo/actions
apps/principal/modules/ciclolectivo/templates
apps/principal/modules/ciclolectivo/validate
apps/principal/templates lib/model
commits en pressenter.com.ar
commits en pressenter.com.ar
Mar Jul 28 17:34:34 CEST 2009
Author: josx
Date: 2009-07-28 12:34:34 -0300 (Tue, 28 Jul 2009)
New Revision: 6247
Added:
prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/cambiarCicloAjaxSuccess.php
prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/listarAlumnosSuccess.php
prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/pasajeAlumnosFormSuccess.php
prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/pasajeAlumnosSuccess.php
prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/validate/pasajeAlumnos.yml
Modified:
prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/actions/actions.class.php
prosistem/alba/trunk/alba/apps/principal/templates/menu.php
prosistem/alba/trunk/alba/lib/model/Ciclolectivo.php
Log:
Incorporando el pasaje de a?\195?\177o para los alumnos
Modified: prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/actions/actions.class.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/actions/actions.class.php 2009-07-28 05:04:31 UTC (rev 6246)
+++ prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/actions/actions.class.php 2009-07-28 15:34:34 UTC (rev 6247)
@@ -373,6 +373,70 @@
$this->ciclolectivo->setActual(isset($ciclolectivo['actual']) ? $ciclolectivo['actual'] : 0);
}
+
+
+ public function executePasajeAlumnosForm() {
+ $ciclolectivo_id = $this->getUser()->getAttribute('fk_ciclolectivo_id');
+ $ciclo_actual = CiclolectivoPeer::retrieveByPK($ciclolectivo_id);
+ $this->optionsDivisiones = $ciclo_actual->getDivisionesArray();
+
+ $c = new Criteria ();
+ $c->add(CiclolectivoPeer::FK_ESTABLECIMIENTO_ID,$this->getUser()->getAttribute('fk_establecimiento_id'));
+ $c->add(CiclolectivoPeer::ID, $ciclolectivo_id, Criteria::NOT_EQUAL);
+ $this->optionsCiclos = CiclolectivoPeer::doSelect($c);
+ }
+
+ public function executeCambiarCicloAjax() {
+ $id = $this->getRequestParameter('ciclolectivo_id');
+ if(!$id) {
+ return $this->renderText("");
+ }
+ $ciclo = CiclolectivoPeer::retrieveByPK($id);
+ $this->optionsDivisiones = $ciclo->getDivisionesArray();
+ }
+
+ public function executeListarAlumnos() {
+ $id = $this->getRequestParameter('division_id');
+ if(!$id) {
+ return $this->renderText("");
+ }
+ $c = new Criteria();
+ $c->add(RelAlumnoDivisionPeer::FK_DIVISION_ID, $id);
+ if($this->getRequestParameter('division_no_id')) {
+ $not_in_query = " alumno.id NOT IN ( SELECT fk_alumno_id FROM rel_alumno_division WHERE fk_alumno_id = alumno.id AND fk_division_id = ". $this->getRequestParameter("division_no_id").")";
+ $c->add(AlumnoPeer::ID, $not_in_query, Criteria::CUSTOM);
+ }
+ $c->addJoin(AlumnoPeer::ID, RelAlumnoDivisionPeer::FK_ALUMNO_ID);
+ $this->alumnos = AlumnoPeer::doSelect($c);
+ }
+
+ public function executePasajeAlumnos() {
+ $pasaje = $this->getRequestParameter('pasaje');
+ $ciclolectivo_actual_id = $this->getUser()->getAttribute('fk_ciclolectivo_id');
+ $con = Propel::getConnection();
+ try {
+ $con->beginTransaction();
+ foreach($pasaje['fk_alumno_id'] as $aid) {
+ $a = new RelAlumnoDivision();
+ $a->setFkDivisionId($pasaje['fk_division_destino_id']);
+ $a->setFkAlumnoId($aid);
+ $a->save();
+ }
+ $con->commit();
+ $this->getUser()->setFlash('notice','Se ha hecho el pasaje de alumnos correctamente.');
+ }
+ catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ public function handleErrorPasajeAlumnos() {
+// $pasaje = $this->getResquestParameter('pasaje');
+ $this->forward('ciclolectivo','pasajeAlumnosForm');
+ }
+
+
+
}
-
?>
Added: prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/cambiarCicloAjaxSuccess.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/cambiarCicloAjaxSuccess.php (rev 0)
+++ prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/cambiarCicloAjaxSuccess.php 2009-07-28 15:34:34 UTC (rev 6247)
@@ -0,0 +1,16 @@
+<?php
+ use_helper("Object","Javascript");
+?>
+<div id="divisiones_destino">
+<?php echo label_for('pasaje[fk_division_destino_id]', __('Division destino:'), 'class="required" ') ?>
+<?php echo select_tag('pasaje[fk_division_destino_id]', options_for_select($optionsDivisiones)); ?>
+
+<?php echo observe_field('pasaje_fk_division_destino_id', array(
+ 'update' => 'alumnos',
+ 'url' => 'ciclolectivo/listarAlumnos',
+ 'with' => "'division_id=' + $('pasaje_fk_division_id').value +'&division_no_id=' + value",
+ 'script' => "true" ));
+?>
+
+
+</div>
Added: prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/listarAlumnosSuccess.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/listarAlumnosSuccess.php (rev 0)
+++ prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/listarAlumnosSuccess.php 2009-07-28 15:34:34 UTC (rev 6247)
@@ -0,0 +1,17 @@
+<?php
+ use_helper("Object");
+?>
+<div id="alumnos">
+<?php echo label_for('pasaje[fk_alumno_id]', __('Alumnos a pasar:'), 'class="required" ') ?>
+
+<table cellpadding="0" cellspacing="0" width="50%" >
+<?php
+foreach($alumnos as $a) {
+ echo "<tr>";
+ echo "<td style='padding:0px' >".$a."</td>";
+ echo "<td style='padding:0px' >".checkbox_tag("pasaje[fk_alumno_id][]",$a->getId())."</td>";
+ echo "</tr>";
+}
+?>
+</table>
+</div>
Added: prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/pasajeAlumnosFormSuccess.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/pasajeAlumnosFormSuccess.php (rev 0)
+++ prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/pasajeAlumnosFormSuccess.php 2009-07-28 15:34:34 UTC (rev 6247)
@@ -0,0 +1,61 @@
+<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date','Form', 'Javascript') ?>
+<div id="sf_admin_container">
+<h1><?php echo __('Pasaje de alumnos de un ciclo lectivo a otro', array()) ?></h1>
+
+
+<?php echo form_tag('ciclolectivo/pasajeAlumnos', 'id=sf_admin_edit_form name=sf_admin_edit_form multipart=true') ?>
+<fieldset id="sf_fieldset_informacion_general" class="">
+
+<div class="form-row">
+<?php echo label_for('pasaje[fk_division_id]', __('Division actual:'), 'class="required" ') ?>
+
+<div class="content<?php if ($sf_request->hasError('pasaje{fk_division_id}')): ?> form-error<?php endif; ?>">
+ <?php if ($sf_request->hasError('pasaje{fk_division_id}')): ?>
+ <?php echo form_error('pasaje{fk_division_id}', array('class' => 'form-error-msg')) ?>
+ <?php endif; ?>
+
+<?php echo select_tag('pasaje[fk_division_id]', options_for_select($optionsDivisiones)); ?>
+<?php echo observe_field('pasaje_fk_division_id', array(
+ 'update' => 'alumnos',
+ 'url' => 'ciclolectivo/listarAlumnos',
+ 'with' => "'division_id=' + value",
+ 'script' => "true" ));
+?>
+</div>
+</div>
+
+<div class="form-row">
+ <div id="alumnos">
+ </div>
+</div>
+
+<div class="form-row">
+<?php echo label_for('pasaje[fk_ciclolectivo_id]', __('Ciclo Lectivo destino:'), 'class="required" ') ?>
+
+<div class="content<?php if ($sf_request->hasError('pasaje{fk_ciclolectivo_id}')): ?> form-error<?php endif; ?>">
+ <?php if ($sf_request->hasError('pasaje{fk_ciclolectivo_id}')): ?>
+ <?php echo form_error('pasaje{fk_ciclolectivo_id}', array('class' => 'form-error-msg')) ?>
+ <?php endif; ?>
+
+
+<?php echo select_tag('pasaje[fk_ciclolectivo_id]',objects_for_select($optionsCiclos,'getId','getDescripcion', 0,'include_blank=true'))?>
+<?php echo observe_field('pasaje_fk_ciclolectivo_id', array(
+ 'update' => 'divisiones_destino',
+ 'url' => 'ciclolectivo/cambiarCicloAjax',
+ 'with' => "'ciclolectivo_id=' + value",
+ 'script' => "true" ));
+?>
+</div>
+</div>
+
+<div class="form-row">
+ <div id="divisiones_destino">
+ </div>
+</div>
+</div>
+ <ul class="sf_admin_actions">
+ <li><?php echo submit_tag(__('Buscar'), array ( 'class' => 'sf_admin_action_save',)) ?></li>
+ </ul>
+</form>
+
+</div>
Added: prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/pasajeAlumnosSuccess.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/pasajeAlumnosSuccess.php (rev 0)
+++ prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/templates/pasajeAlumnosSuccess.php 2009-07-28 15:34:34 UTC (rev 6247)
@@ -0,0 +1,5 @@
+<?php if ($sf_user->hasFlash('notice')):?>
+ <div class="save-ok">
+ <h2><?php echo $sf_user->getFlash('notice')?></h2>
+ </div>
+<?php endif;?>
Added: prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/validate/pasajeAlumnos.yml
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/validate/pasajeAlumnos.yml (rev 0)
+++ prosistem/alba/trunk/alba/apps/principal/modules/ciclolectivo/validate/pasajeAlumnos.yml 2009-07-28 15:34:34 UTC (rev 6247)
@@ -0,0 +1,26 @@
+methods:
+ post:
+ - "pasaje{fk_division_id}"
+ - "pasaje{fk_division_destino_id}"
+ - "pasaje{fk_ciclolectivo_id}"
+ - "pasaje{fk_alumno_id}"
+
+fillin:
+ enabled: on
+
+names:
+ pasaje{fk_division_id}:
+ required: Yes
+ required_msg: La división de origen es obligatoria
+
+ pasaje{fk_division_destino_id}:
+ required: Yes
+ required_msg: La división de destino es obligatoria
+
+ pasaje{fk_ciclolectivo_id}:
+ required: Yes
+ required_msg: El Ciclo Léctivo destino es obligatorio
+
+ pasaje{fk_alumno_id}:
+ required: Yes
+ required_msg: Los Alumnos son obligatorios
Modified: prosistem/alba/trunk/alba/apps/principal/templates/menu.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/templates/menu.php 2009-07-28 05:04:31 UTC (rev 6246)
+++ prosistem/alba/trunk/alba/apps/principal/templates/menu.php 2009-07-28 15:34:34 UTC (rev 6247)
@@ -87,6 +87,7 @@
<li><span></span><?php echo link_to("Notas","boletin/list")?></li>
</ul>
</li>
+ <li><span></span><?php echo link_to("Pasar de año","ciclolectivo/pasajeAlumnosForm")?></li>
</ul>
</li>
<li><span></span><a href="#">Docentes</a>
Modified: prosistem/alba/trunk/alba/lib/model/Ciclolectivo.php
===================================================================
--- prosistem/alba/trunk/alba/lib/model/Ciclolectivo.php 2009-07-28 05:04:31 UTC (rev 6246)
+++ prosistem/alba/trunk/alba/lib/model/Ciclolectivo.php 2009-07-28 15:34:34 UTC (rev 6247)
@@ -31,4 +31,22 @@
return $optionsPeriodo;
}
+ public function getDivisionesArray() {
+ $c = new Criteria();
+ #$c->add(AnioPeer::FK_ESTABLECIMIENTO_ID, $sf_user->getAttribute('fk_establecimiento_id'));
+ $c->add(TurnoPeer::FK_CICLOLECTIVO_ID, $this->getId());
+ $c->addJoin(AnioPeer::ID,DivisionPeer::FK_ANIO_ID);
+ $c->addJoin(TurnoPeer::ID,DivisionPeer::FK_TURNO_ID);
+ $divisiones = DivisionPeer::doSelect($c);
+ $optionsDivisiones = array();
+ $optionsDivisiones[""] = "";
+ foreach ($divisiones as $division) {
+ $optionsDivisiones[$division->getId()] = $division->__toString();
+ }
+ return $optionsDivisiones;
+ }
+
+
+
+
} // Ciclolectivo
Más información sobre la lista de distribución Alba-desarrollo