[Alba-desarrollo] SVN Alba r4822 - in prosistem/alba/trunk/alba:
apps/principal/modules/docenteHorario/actions
apps/principal/modules/docenteHorario/templates config
data/sql lib/model/map lib/model/om
commits en pressenter.com.ar
commits en pressenter.com.ar
Mie Jul 18 16:26:33 CEST 2007
Author: josx
Date: 2007-07-18 11:26:27 -0300 (Wed, 18 Jul 2007)
New Revision: 4822
Added:
prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/templates/editSuccess.php
Modified:
prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/actions/actions.class.php
prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/templates/listSuccess.php
prosistem/alba/trunk/alba/config/schema.xml
prosistem/alba/trunk/alba/data/sql/actualizacion_1.0rc_a_1.0rc2.sql
prosistem/alba/trunk/alba/lib/model/map/DocenteHorarioMapBuilder.php
prosistem/alba/trunk/alba/lib/model/om/BaseDocente.php
prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorario.php
prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorarioPeer.php
prosistem/alba/trunk/alba/lib/model/om/BaseEvento.php
prosistem/alba/trunk/alba/lib/model/om/BaseRepeticion.php
Log:
Se reemplazo en docenteHorarios como graba los datos del dia/horario tentativos que los docentes pueden dar clase. (migracion a tabla Eventos)
Modified: prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/actions/actions.class.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/actions/actions.class.php 2007-07-16 21:03:57 UTC (rev 4821)
+++ prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/actions/actions.class.php 2007-07-18 14:26:27 UTC (rev 4822)
@@ -35,8 +35,8 @@
{
public function preExecute ()
{
- $this->getResponse()->addStylesheet(sfConfig::get('sf_admin_web_dir').'/css/main', 'first');
- $this->vista = $this->getRequestParameter('vista');
+// $this->getResponse()->addStylesheet(sfConfig::get('sf_admin_web_dir').'/css/main', 'first');
+// $this->vista = $this->getRequestParameter('vista');
}
public function executeIndex ()
@@ -48,7 +48,6 @@
{
$optionsDocente = array();
- $aMuestraRepeticion = array();
$aHorario = array();
$c = new Criteria();
@@ -58,14 +57,6 @@
$optionsDocente[$docente->getId()] = $docente->getApellido().' '.$docente->getNombre();
}
- $aRepeticion = RepeticionPeer::doSelect(new Criteria());
-
- $aMuestraRepeticion = array();
- foreach($aRepeticion as $repeticion) {
- $aMuestraRepeticion[$repeticion->getId()] = $repeticion->getDescripcion();
- }
-
-
if(count($optionsDocente) > 0) {
$docente_id = ($this->getRequestParameter('idDocente')) ? $this->getRequestParameter('idDocente') : key($optionsDocente) ;
} else {
@@ -78,58 +69,128 @@
$this->aHorario = $aHorario;
$this->optionsDocente = $optionsDocente;
- $this->aRepeticion = $aMuestraRepeticion;
+
}
public function executeDeleteHorario () {
- $this->docenteHorario = DocenteHorarioPeer::retrieveByPk($this->getRequestParameter('id'));
+ $this->docenteHorario = DocenteHorarioPeer::retrieveByPk( array( $this->getRequestParameter('docente_id'), $this->getRequestParameter('evento_id')));
$this->forward404Unless($this->docenteHorario);
$idDocente = $this->docenteHorario->getFkDocenteId();
+ $link = 'docenteHorario/list?idDocente='.$idDocente;
$this->docenteHorario->delete();
- $link = 'docenteHorario/list?idDocente='.$idDocente;
+ try {
+ $this->docenteHorario->delete();
+ }
+ catch (PropelException $e) {
+ $this->getRequest()->setError('delete', 'Could not delete the selected Docente Horario. Make sure it does not have any associated items.');
+ return $this->redirect($link);
+ }
+
return $this->redirect($link);
}
+ protected function saveDocenteHorario($docenteHorario)
+ {
+ $docenteHorario->save();
- public function executeGrabarDocenteHorario() {
-
- $aHorario = $this->getRequestParameter('horario');
- if(is_array($aHorario)) {
- foreach($aHorario as $horario) {
-
- $horaInicio = $this->_add_zeros($horario['hora_inicio']['hour'],2).":".$this->_add_zeros($horario['hora_inicio']['minute'],2)." ".$horario['hora_inicio']['ampm'];
- $horaFin = $this->_add_zeros($horario['hora_fin']['hour'],2).":".$this->_add_zeros($horario['hora_fin']['minute'],2)." ".$horario['hora_fin']['ampm'];
-
- if($horaInicio != $horaFin) {
- if(isset($horario['id']) AND is_numeric($horario['id'])) {
- $this->horario = DocenteHorarioPeer::retrieveByPk($horario['id']);
- } else {
- $this->horario = new DocenteHorario();
- }
- $this->horario->setHoraInicio($horaInicio);
- $this->horario->setHoraFin($horaFin);
- $this->horario->setDia($horario['dia']);
- $this->horario->setFkDocenteId($this->getRequestParameter('idDocente'));
- $this->horario->setFkRepeticionId($horario['fk_repeticion_id']);
- $this->horario->save();
- }
- }
- }
-
- return $this->forward('docenteHorario','list','idDocente/'.$this->getRequestParameter('idDocente'));
+ }
+
+ protected function deleteDocenteHorario($docenteHorario)
+ {
+ $docenteHorario->delete();
+ }
+
+
+ protected function getDocenteHorarioOrCreate($id = 'idDocente', $id2 = 'idEvento')
+ {
+ if (!$this->getRequestParameter($id2)) {
+ $docenteHorario = new DocenteHorario();
+ } else {
+ $c = new Criteria();
+ $c->add(DocenteHorarioPeer::FK_DOCENTE_ID, $this->getRequestParameter($id));
+ $c->add(DocenteHorarioPeer::FK_EVENTO_ID, $this->getRequestParameter($id2));
+ $docenteHorario = DocenteHorarioPeer::doSelectOne($c);
+// Esta linea de aca abajo deberia funcionar pero da un error no se si es del propel o que
+// $docenteHorario = DocenteHorarioPeer::retrieveByPK(array($this->getRequestParameter($id2), $this->getRequestParameter($id)) );
+ $this->forward404Unless($docenteHorario);
}
-
- function _add_zeros($string, $strlen) {
- if ($strlen > strlen($string)) {
- for ($x = strlen($string); $x < $strlen; $x++) {
- $string = '0' . $string;
- }
- }
- return $string;
+ return $docenteHorario;
+ }
+
+
+ public function executeSave()
+ {
+ return $this->forward('docenteHorario', 'edit');
+ }
+
+
+ public function executeEdit()
+ {
+ $this->docente = DocentePeer::retrieveByPk($this->getRequestParameter('idDocente'));
+ $this->docenteHorario = $this->getDocenteHorarioOrCreate();
+
+ $evento_generico = new miEvento();
+ $this->evento = $evento_generico->getEventoOrCreate($this->docenteHorario->getFkEventoId());
+
+ if ($this->getRequest()->getMethod() == sfRequest::POST)
+ {
+ $this->evento = $evento_generico->updateEventoFromRequest($this->evento, $this->getRequestParameter('evento'), $this->getUser()->getCulture());
+ $this->evento->save();
+ $this->forward404Unless($this->evento);
+ $this->updateDocenteHorarioFromRequest($this->evento->getId());
+
+
+ $this->saveDocenteHorario($this->docenteHorario);
+ $this->setFlash('notice', 'Your modifications have been saved');
+
+ if ($this->getRequestParameter('save_and_add'))
+ {
+ return $this->redirect('docenteHorario/create');
+ }
+ else if ($this->getRequestParameter('save_and_list'))
+ {
+ return $this->redirect('docenteHorario/list');
+ }
+ else
+ {
+ return $this->redirect('docenteHorario/edit?idDocente='.$this->docenteHorario->getFkDocenteId().'&idEvento='.$this->docenteHorario->getFkEventoId());
+ }
}
+ else
+ {
+ $this->labels = $this->getLabels();
+ }
+ }
+
+ protected function updateDocenteHorarioFromRequest($fk_evento_id = '') {
+ $docenteHorario = $this->getRequestParameter('docente_horario');
+
+ if ($fk_evento_id) {
+ $this->docenteHorario->setFkEventoId($fk_evento_id);
+ } else {
+ $this->docenteHorario->setFkEventoId(null);
+ }
+
+// if (isset($docenteHorario['fk_evento_id'])) {
+// $this->docenteHorario->setFkEventoId($docenteHorario['fk_evento_id'] ? $docenteHorario['fk_evento_id'] : null);
+// }
+
+ if (isset($docenteHorario['fk_docente_id'])) {
+ $this->docenteHorario->setFkDocenteId($docenteHorario['fk_docente_id'] ? $docenteHorario['fk_docente_id'] : null);
+ }
+ }
+
+
+ protected function getLabels() {
+ return array(
+ 'docente_horario{fk_docente_id}' => 'Docente:',
+ 'docente_horario{fk_evento_id}' => 'Evento:',
+ );
+ }
+
}
?>
\ No newline at end of file
Added: prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/templates/editSuccess.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/templates/editSuccess.php 2007-07-16 21:03:57 UTC (rev 4821)
+++ prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/templates/editSuccess.php 2007-07-18 14:26:27 UTC (rev 4822)
@@ -0,0 +1,65 @@
+<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?>
+
+<?php use_stylesheet('/sf/sf_admin/css/main') ?>
+
+<div id="sf_admin_container">
+<h1><?php echo __('Editar Horarios Tentativos de %1%', array ('%1%' => $docente->getNombre()." ".$docente->getApellido() ) ) ?></h1>
+
+<div id="sf_admin_content">
+
+<?php if ($sf_request->hasErrors()): ?>
+<div class="form-errors">
+<h2><?php echo __('There are some errors that prevent the form to validate') ?></h2>
+<dl>
+<?php foreach ($sf_request->getErrorNames() as $name): ?>
+ <dt><?php echo __($labels[$name]) ?></dt>
+ <dd><?php echo $sf_request->getError($name) ?></dd>
+<?php endforeach; ?>
+</dl>
+</div>
+<?php elseif ($sf_flash->has('notice')): ?>
+<div class="save-ok">
+<h2><?php echo __($sf_flash->get('notice')) ?></h2>
+</div>
+<?php endif; ?>
+
+<?php echo form_tag('docenteHorario/edit', array(
+ 'id' => 'sf_admin_edit_form',
+ 'name' => 'sf_admin_edit_form',
+ 'multipart' => true,
+)) ?>
+
+<?php echo input_hidden_tag('docente_horario[fk_docente_id]', $docente->getId()) ?>
+
+<?php include_partial('evento/carga_evento', array('evento' => $evento )) ?>
+
+
+
+<ul class="sf_admin_actions">
+ <li><?php echo button_to(__('list'), 'docenteHorario/list?idDocente='.$docente->getId(), array (
+ 'class' => 'sf_admin_action_list',
+)) ?></li>
+ <li><?php echo submit_tag(__('save'), array (
+ 'name' => 'save',
+ 'class' => 'sf_admin_action_save',
+)) ?></li>
+ <li><?php echo submit_tag(__('save and add'), array (
+ 'name' => 'save_and_add',
+ 'class' => 'sf_admin_action_save_and_add',
+)) ?></li>
+</ul>
+
+</div>
+</form>
+
+<ul class="sf_admin_actions">
+ <li class="float-left"><?php if ($docenteHorario->getFkDocenteId()&&$docenteHorario->getFkEventoId()): ?>
+<?php echo button_to(__('delete'), 'docenteHorario/delete?docente_id='.$docenteHorario->getFkDocenteId()."&evento_id=".$docenteHorario->getFkEventoId(), array (
+ 'post' => true,
+ 'confirm' => __('Are you sure?'),
+ 'class' => 'sf_admin_action_delete',
+)) ?><?php endif; ?>
+</li>
+ </ul>
+
+</div>
\ No newline at end of file
Property changes on: prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/templates/editSuccess.php
___________________________________________________________________
Name: svn:keywords
+ "Id Author URL Date Rev"
Modified: prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/templates/listSuccess.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/templates/listSuccess.php 2007-07-16 21:03:57 UTC (rev 4821)
+++ prosistem/alba/trunk/alba/apps/principal/modules/docenteHorario/templates/listSuccess.php 2007-07-18 14:26:27 UTC (rev 4822)
@@ -17,49 +17,37 @@
<div id="sf_admin_header"></div>
<br>
<div id="sf_admin_container">
+
+<?php if(count($aHorario) > 0 ) {?>
<h2>Horarios Tentativos</h2>
<table cellspacing="0" class="sf_admin_list">
<thead>
<tr>
- <th id="sf_admin_list_th_dia">día</th>
- <th id="sf_admin_list_th_repeticion">Repetición</th>
- <th id="sf_admin_list_th_hora_inicio">Hora Inicio</th>
- <th id="sf_admin_list_th_hora_fin">Hora Fin</th>
- <th id="sf_admin_list_th_action">Acciones</th>
+ <th id="sf_admin_list_th_dia">Evento</th>
</tr>
</thead>
<tbody>
-<?php
- $i = 0;
- foreach($aHorario as $horario){
-?>
+
+<?php $i = 1; foreach ($aHorario as $docente_horario): $odd = fmod(++$i, 2) ?>
<tr class="sf_admin_row_0">
- <td><?php echo select_tag("horario[$i][dia]", options_for_select(diasDeLaSemana(), $horario->getDia() ) );?></td>
- <td><?php echo select_tag("horario[$i][fk_repeticion_id]", options_for_select($aRepeticion ,$horario->getFkRepeticionId() ) );?></td>
- <td><?php echo select_time_tag("horario[$i][hora_inicio]", $horario->getHoraInicio(), array('include_second' => false, '12hour_time' => true));?></td>
- <td><?php echo select_time_tag("horario[$i][hora_fin]", $horario->getHoraFin(), array('include_second' => false, '12hour_time' => true));?></td>
- <?php echo input_hidden_tag("horario[$i][id]", $horario->getId()); ?>
- <td>
- <ul class="sf_admin_td_actions">
- <li><?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/delete_icon.png', array('alt' => __('delete'), 'title' => __('delete'))), 'docenteHorario/deleteHorario?id='.$horario->getId()); ?>
- </ul>
- </td>
+ <td><?php echo ($docente_horario->getEvento())?$docente_horario->getEvento()->getInfoEnTexto():""; ?></td>
+
+
+<td>
+<ul class="sf_admin_td_actions">
+ <li><?php echo link_to(image_tag('/sf/sf_admin/images/edit_icon.png', array('alt' => __('edit'), 'title' => __('edit'))), 'docenteHorario/edit?idDocente='.$docente_horario->getFkDocenteId()."&idEvento=".$docente_horario->getFkEventoId()) ?></li>
+ <li><?php echo link_to(image_tag('/sf/sf_admin/images/delete_icon.png', array('alt' => __('delete'), 'title' => __('delete'))), 'docenteHorario/delete?idDocente='.$docente_horario->getFkDocenteId()."&idEvento=".$docente_horario->getFkEventoId(), array (
+ 'post' => true,
+ 'confirm' => __('Are you sure?'),
+)) ?></li>
+</ul>
+</td>
+
+
+
+
</tr>
- <?php $i++; }?>
- <tr class="sf_admin_row_0">
- <td><b>NUEVO</b></td>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- </tr>
- <tr class="sf_admin_row_0">
- <td><?php echo select_tag("horario[$i][dia]", options_for_select(diasDeLaSemana()));?></td>
- <td><?php echo select_tag("horario[$i][fk_repeticion_id]", options_for_select($aRepeticion) );?></td>
- <td><?php echo select_time_tag("horario[$i][hora_inicio]", array(), array('include_second' => false, '12hour_time' => true));?></td>
- <td><?php echo select_time_tag("horario[$i][hora_fin]", array(), array('include_second' => false, '12hour_time' => true));?></td>
- <td></td>
- </tr>
+<?php endforeach; ?>
</tbody>
<tfoot>
<tr>
@@ -68,10 +56,19 @@
</tr>
</tfoot>
</table>
- <div>
+<?php } else { ?>
+No hay horarios cargados
+<?php }?>
+<div>
<ul class="sf_admin_actions">
<li>
- <?php echo submit_tag('submit', 'class=sf_admin_action_save value=Grabar')?>
+<?php
+
+$id = ($sf_params->get('idDocente'))?$sf_params->get('idDocente'):1;
+echo button_to(__('create'), 'docenteHorario/edit?idDocente='.$id, array ( 'class' => 'sf_admin_action_create',))
+
+
+?>
<li>
<li>
<?php echo button_to('Listado de Docentes','docente/list', array ('class' => 'sf_admin_action_list'))?>
Modified: prosistem/alba/trunk/alba/config/schema.xml
===================================================================
--- prosistem/alba/trunk/alba/config/schema.xml 2007-07-16 21:03:57 UTC (rev 4821)
+++ prosistem/alba/trunk/alba/config/schema.xml 2007-07-18 14:26:27 UTC (rev 4822)
@@ -652,14 +652,10 @@
</foreign-key>
</table>
<table name="docente_horario" idMethod="native">
- <column name="id" type="integer" size="11" required="true" autoIncrement="true" primaryKey="true"/>
- <column name="fk_docente_id" type="integer" size="11" required="true" default="0"/>
- <column name="fk_repeticion_id" type="integer" size="11" required="true" default="0"/>
- <column name="hora_inicio" type="time" required="true"/>
- <column name="hora_fin" type="time" required="true"/>
- <column name="dia" type="integer" size="11" required="true" default="0"/>
- <foreign-key foreignTable="repeticion">
- <reference local="fk_repeticion_id" foreign="id"/>
+ <column name="fk_docente_id" type="integer" size="11" required="true" primaryKey="true"/>
+ <column name="fk_evento_id" type="integer" size="11" required="true" primaryKey="true"/>
+ <foreign-key foreignTable="evento">
+ <reference local="fk_evento_id" foreign="id"/>
</foreign-key>
<foreign-key foreignTable="docente">
<reference local="fk_docente_id" foreign="id"/>
Modified: prosistem/alba/trunk/alba/data/sql/actualizacion_1.0rc_a_1.0rc2.sql
===================================================================
--- prosistem/alba/trunk/alba/data/sql/actualizacion_1.0rc_a_1.0rc2.sql 2007-07-16 21:03:57 UTC (rev 4821)
+++ prosistem/alba/trunk/alba/data/sql/actualizacion_1.0rc_a_1.0rc2.sql 2007-07-18 14:26:27 UTC (rev 4822)
@@ -62,4 +62,11 @@
ALTER TABLE `rel_actividad_docente` DROP COLUMN id;
ALTER TABLE `rel_actividad_docente` ADD PRIMARY KEY ( `fk_actividad_id` , `fk_docente_id` ) ;
+ALTER TABLE `docente_horario` DROP `id` , DROP `fk_repeticion_id` , DROP `hora_inicio` , DROP `hora_fin` , DROP `dia` ;
+ALTER TABLE `docente_horario` ADD `fk_evento_id` INT NOT NULL ;
+ALTER TABLE `docente_horario` ADD PRIMARY KEY ( `fk_docente_id` , `fk_evento_id` );
+ALTER TABLE `docente_horario` ADD INDEX `fk_evento_FI_1` ( `fk_evento_id` );
+
+DROP TABLE `menu`;
+
SET FOREIGN_KEY_CHECKS = 1;
Modified: prosistem/alba/trunk/alba/lib/model/map/DocenteHorarioMapBuilder.php
===================================================================
--- prosistem/alba/trunk/alba/lib/model/map/DocenteHorarioMapBuilder.php 2007-07-16 21:03:57 UTC (rev 4821)
+++ prosistem/alba/trunk/alba/lib/model/map/DocenteHorarioMapBuilder.php 2007-07-18 14:26:27 UTC (rev 4822)
@@ -30,19 +30,11 @@
$tMap = $this->dbMap->addTable('docente_horario');
$tMap->setPhpName('DocenteHorario');
- $tMap->setUseIdGenerator(true);
+ $tMap->setUseIdGenerator(false);
- $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, 11);
+ $tMap->addForeignPrimaryKey('FK_DOCENTE_ID', 'FkDocenteId', 'int' , CreoleTypes::INTEGER, 'docente', 'ID', true, 11);
- $tMap->addForeignKey('FK_DOCENTE_ID', 'FkDocenteId', 'int', CreoleTypes::INTEGER, 'docente', 'ID', true, 11);
+ $tMap->addForeignPrimaryKey('FK_EVENTO_ID', 'FkEventoId', 'int' , CreoleTypes::INTEGER, 'evento', 'ID', true, 11);
- $tMap->addForeignKey('FK_REPETICION_ID', 'FkRepeticionId', 'int', CreoleTypes::INTEGER, 'repeticion', 'ID', true, 11);
-
- $tMap->addColumn('HORA_INICIO', 'HoraInicio', 'int', CreoleTypes::TIME, true, null);
-
- $tMap->addColumn('HORA_FIN', 'HoraFin', 'int', CreoleTypes::TIME, true, null);
-
- $tMap->addColumn('DIA', 'Dia', 'int', CreoleTypes::INTEGER, true, 11);
-
}
}
\ No newline at end of file
Modified: prosistem/alba/trunk/alba/lib/model/om/BaseDocente.php
===================================================================
--- prosistem/alba/trunk/alba/lib/model/om/BaseDocente.php 2007-07-16 21:03:57 UTC (rev 4821)
+++ prosistem/alba/trunk/alba/lib/model/om/BaseDocente.php 2007-07-18 14:26:27 UTC (rev 4822)
@@ -1635,7 +1635,7 @@
- public function getDocenteHorariosJoinRepeticion($criteria = null, $con = null)
+ public function getDocenteHorariosJoinEvento($criteria = null, $con = null)
{
include_once 'lib/model/om/BaseDocenteHorarioPeer.php';
if ($criteria === null) {
@@ -1653,14 +1653,14 @@
$criteria->add(DocenteHorarioPeer::FK_DOCENTE_ID, $this->getId());
- $this->collDocenteHorarios = DocenteHorarioPeer::doSelectJoinRepeticion($criteria, $con);
+ $this->collDocenteHorarios = DocenteHorarioPeer::doSelectJoinEvento($criteria, $con);
}
} else {
$criteria->add(DocenteHorarioPeer::FK_DOCENTE_ID, $this->getId());
if (!isset($this->lastDocenteHorarioCriteria) || !$this->lastDocenteHorarioCriteria->equals($criteria)) {
- $this->collDocenteHorarios = DocenteHorarioPeer::doSelectJoinRepeticion($criteria, $con);
+ $this->collDocenteHorarios = DocenteHorarioPeer::doSelectJoinEvento($criteria, $con);
}
}
$this->lastDocenteHorarioCriteria = $criteria;
Modified: prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorario.php
===================================================================
--- prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorario.php 2007-07-16 21:03:57 UTC (rev 4821)
+++ prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorario.php 2007-07-18 14:26:27 UTC (rev 4822)
@@ -9,32 +9,16 @@
- protected $id;
+ protected $fk_docente_id;
- protected $fk_docente_id = 0;
+ protected $fk_evento_id;
-
- protected $fk_repeticion_id = 0;
+ protected $aEvento;
-
- protected $hora_inicio;
-
-
-
- protected $hora_fin;
-
-
-
- protected $dia = 0;
-
-
- protected $aRepeticion;
-
-
protected $aDocente;
@@ -44,13 +28,6 @@
protected $alreadyInValidation = false;
- public function getId()
- {
-
- return $this->id;
- }
-
-
public function getFkDocenteId()
{
@@ -58,78 +35,13 @@
}
- public function getFkRepeticionId()
+ public function getFkEventoId()
{
- return $this->fk_repeticion_id;
+ return $this->fk_evento_id;
}
- public function getHoraInicio($format = 'H:i:s')
- {
-
- if ($this->hora_inicio === null || $this->hora_inicio === '') {
- return null;
- } elseif (!is_int($this->hora_inicio)) {
- $ts = strtotime($this->hora_inicio);
- if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [hora_inicio] as date/time value: " . var_export($this->hora_inicio, true));
- }
- } else {
- $ts = $this->hora_inicio;
- }
- if ($format === null) {
- return $ts;
- } elseif (strpos($format, '%') !== false) {
- return strftime($format, $ts);
- } else {
- return date($format, $ts);
- }
- }
-
-
- public function getHoraFin($format = 'H:i:s')
- {
-
- if ($this->hora_fin === null || $this->hora_fin === '') {
- return null;
- } elseif (!is_int($this->hora_fin)) {
- $ts = strtotime($this->hora_fin);
- if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [hora_fin] as date/time value: " . var_export($this->hora_fin, true));
- }
- } else {
- $ts = $this->hora_fin;
- }
- if ($format === null) {
- return $ts;
- } elseif (strpos($format, '%') !== false) {
- return strftime($format, $ts);
- } else {
- return date($format, $ts);
- }
- }
-
-
- public function getDia()
- {
-
- return $this->dia;
- }
-
-
- public function setId($v)
- {
-
- if ($v !== null && !is_int($v) && is_numeric($v)) {
- $v = (int) $v;
- }
-
- if ($this->id !== $v) {
- $this->id = $v;
- $this->modifiedColumns[] = DocenteHorarioPeer::ID;
- }
-
- }
-
public function setFkDocenteId($v)
{
@@ -137,7 +49,7 @@
$v = (int) $v;
}
- if ($this->fk_docente_id !== $v || $v === 0) {
+ if ($this->fk_docente_id !== $v) {
$this->fk_docente_id = $v;
$this->modifiedColumns[] = DocenteHorarioPeer::FK_DOCENTE_ID;
}
@@ -148,93 +60,37 @@
}
- public function setFkRepeticionId($v)
+ public function setFkEventoId($v)
{
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
- if ($this->fk_repeticion_id !== $v || $v === 0) {
- $this->fk_repeticion_id = $v;
- $this->modifiedColumns[] = DocenteHorarioPeer::FK_REPETICION_ID;
+ if ($this->fk_evento_id !== $v) {
+ $this->fk_evento_id = $v;
+ $this->modifiedColumns[] = DocenteHorarioPeer::FK_EVENTO_ID;
}
- if ($this->aRepeticion !== null && $this->aRepeticion->getId() !== $v) {
- $this->aRepeticion = null;
+ if ($this->aEvento !== null && $this->aEvento->getId() !== $v) {
+ $this->aEvento = null;
}
}
- public function setHoraInicio($v)
- {
-
- if ($v !== null && !is_int($v)) {
- $ts = strtotime($v);
- if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [hora_inicio] from input: " . var_export($v, true));
- }
- } else {
- $ts = $v;
- }
- if ($this->hora_inicio !== $ts) {
- $this->hora_inicio = $ts;
- $this->modifiedColumns[] = DocenteHorarioPeer::HORA_INICIO;
- }
-
- }
-
- public function setHoraFin($v)
- {
-
- if ($v !== null && !is_int($v)) {
- $ts = strtotime($v);
- if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [hora_fin] from input: " . var_export($v, true));
- }
- } else {
- $ts = $v;
- }
- if ($this->hora_fin !== $ts) {
- $this->hora_fin = $ts;
- $this->modifiedColumns[] = DocenteHorarioPeer::HORA_FIN;
- }
-
- }
-
- public function setDia($v)
- {
-
- if ($v !== null && !is_int($v) && is_numeric($v)) {
- $v = (int) $v;
- }
-
- if ($this->dia !== $v || $v === 0) {
- $this->dia = $v;
- $this->modifiedColumns[] = DocenteHorarioPeer::DIA;
- }
-
- }
-
public function hydrate(ResultSet $rs, $startcol = 1)
{
try {
- $this->id = $rs->getInt($startcol + 0);
+ $this->fk_docente_id = $rs->getInt($startcol + 0);
- $this->fk_docente_id = $rs->getInt($startcol + 1);
+ $this->fk_evento_id = $rs->getInt($startcol + 1);
- $this->fk_repeticion_id = $rs->getInt($startcol + 2);
-
- $this->hora_inicio = $rs->getTime($startcol + 3, null);
-
- $this->hora_fin = $rs->getTime($startcol + 4, null);
-
- $this->dia = $rs->getInt($startcol + 5);
-
$this->resetModified();
$this->setNew(false);
- return $startcol + 6;
+ return $startcol + 2;
} catch (Exception $e) {
throw new PropelException("Error populating DocenteHorario object", $e);
}
@@ -292,11 +148,11 @@
- if ($this->aRepeticion !== null) {
- if ($this->aRepeticion->isModified()) {
- $affectedRows += $this->aRepeticion->save($con);
+ if ($this->aEvento !== null) {
+ if ($this->aEvento->isModified()) {
+ $affectedRows += $this->aEvento->save($con);
}
- $this->setRepeticion($this->aRepeticion);
+ $this->setEvento($this->aEvento);
}
if ($this->aDocente !== null) {
@@ -311,7 +167,6 @@
if ($this->isNew()) {
$pk = DocenteHorarioPeer::doInsert($this, $con);
$affectedRows += 1;
- $this->setId($pk);
$this->setNew(false);
} else {
$affectedRows += DocenteHorarioPeer::doUpdate($this, $con);
@@ -355,9 +210,9 @@
- if ($this->aRepeticion !== null) {
- if (!$this->aRepeticion->validate($columns)) {
- $failureMap = array_merge($failureMap, $this->aRepeticion->getValidationFailures());
+ if ($this->aEvento !== null) {
+ if (!$this->aEvento->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aEvento->getValidationFailures());
}
}
@@ -392,23 +247,11 @@
{
switch($pos) {
case 0:
- return $this->getId();
+ return $this->getFkDocenteId();
break;
case 1:
- return $this->getFkDocenteId();
+ return $this->getFkEventoId();
break;
- case 2:
- return $this->getFkRepeticionId();
- break;
- case 3:
- return $this->getHoraInicio();
- break;
- case 4:
- return $this->getHoraFin();
- break;
- case 5:
- return $this->getDia();
- break;
default:
return null;
break;
@@ -419,12 +262,8 @@
{
$keys = DocenteHorarioPeer::getFieldNames($keyType);
$result = array(
- $keys[0] => $this->getId(),
- $keys[1] => $this->getFkDocenteId(),
- $keys[2] => $this->getFkRepeticionId(),
- $keys[3] => $this->getHoraInicio(),
- $keys[4] => $this->getHoraFin(),
- $keys[5] => $this->getDia(),
+ $keys[0] => $this->getFkDocenteId(),
+ $keys[1] => $this->getFkEventoId(),
);
return $result;
}
@@ -441,23 +280,11 @@
{
switch($pos) {
case 0:
- $this->setId($value);
+ $this->setFkDocenteId($value);
break;
case 1:
- $this->setFkDocenteId($value);
+ $this->setFkEventoId($value);
break;
- case 2:
- $this->setFkRepeticionId($value);
- break;
- case 3:
- $this->setHoraInicio($value);
- break;
- case 4:
- $this->setHoraFin($value);
- break;
- case 5:
- $this->setDia($value);
- break;
} }
@@ -465,12 +292,8 @@
{
$keys = DocenteHorarioPeer::getFieldNames($keyType);
- if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
- if (array_key_exists($keys[1], $arr)) $this->setFkDocenteId($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setFkRepeticionId($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setHoraInicio($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setHoraFin($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setDia($arr[$keys[5]]);
+ if (array_key_exists($keys[0], $arr)) $this->setFkDocenteId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setFkEventoId($arr[$keys[1]]);
}
@@ -478,12 +301,8 @@
{
$criteria = new Criteria(DocenteHorarioPeer::DATABASE_NAME);
- if ($this->isColumnModified(DocenteHorarioPeer::ID)) $criteria->add(DocenteHorarioPeer::ID, $this->id);
if ($this->isColumnModified(DocenteHorarioPeer::FK_DOCENTE_ID)) $criteria->add(DocenteHorarioPeer::FK_DOCENTE_ID, $this->fk_docente_id);
- if ($this->isColumnModified(DocenteHorarioPeer::FK_REPETICION_ID)) $criteria->add(DocenteHorarioPeer::FK_REPETICION_ID, $this->fk_repeticion_id);
- if ($this->isColumnModified(DocenteHorarioPeer::HORA_INICIO)) $criteria->add(DocenteHorarioPeer::HORA_INICIO, $this->hora_inicio);
- if ($this->isColumnModified(DocenteHorarioPeer::HORA_FIN)) $criteria->add(DocenteHorarioPeer::HORA_FIN, $this->hora_fin);
- if ($this->isColumnModified(DocenteHorarioPeer::DIA)) $criteria->add(DocenteHorarioPeer::DIA, $this->dia);
+ if ($this->isColumnModified(DocenteHorarioPeer::FK_EVENTO_ID)) $criteria->add(DocenteHorarioPeer::FK_EVENTO_ID, $this->fk_evento_id);
return $criteria;
}
@@ -493,7 +312,8 @@
{
$criteria = new Criteria(DocenteHorarioPeer::DATABASE_NAME);
- $criteria->add(DocenteHorarioPeer::ID, $this->id);
+ $criteria->add(DocenteHorarioPeer::FK_DOCENTE_ID, $this->fk_docente_id);
+ $criteria->add(DocenteHorarioPeer::FK_EVENTO_ID, $this->fk_evento_id);
return $criteria;
}
@@ -501,33 +321,34 @@
public function getPrimaryKey()
{
- return $this->getId();
+ $pks = array();
+
+ $pks[0] = $this->getFkDocenteId();
+
+ $pks[1] = $this->getFkEventoId();
+
+ return $pks;
}
- public function setPrimaryKey($key)
+ public function setPrimaryKey($keys)
{
- $this->setId($key);
+
+ $this->setFkDocenteId($keys[0]);
+
+ $this->setFkEventoId($keys[1]);
+
}
public function copyInto($copyObj, $deepCopy = false)
{
- $copyObj->setFkDocenteId($this->fk_docente_id);
- $copyObj->setFkRepeticionId($this->fk_repeticion_id);
-
- $copyObj->setHoraInicio($this->hora_inicio);
-
- $copyObj->setHoraFin($this->hora_fin);
-
- $copyObj->setDia($this->dia);
-
-
$copyObj->setNew(true);
- $copyObj->setId(NULL);
+ $copyObj->setFkDocenteId(NULL);
+ $copyObj->setFkEventoId(NULL);
}
@@ -549,33 +370,33 @@
}
- public function setRepeticion($v)
+ public function setEvento($v)
{
if ($v === null) {
- $this->setFkRepeticionId('0');
+ $this->setFkEventoId(NULL);
} else {
- $this->setFkRepeticionId($v->getId());
+ $this->setFkEventoId($v->getId());
}
- $this->aRepeticion = $v;
+ $this->aEvento = $v;
}
- public function getRepeticion($con = null)
+ public function getEvento($con = null)
{
- include_once 'lib/model/om/BaseRepeticionPeer.php';
+ include_once 'lib/model/om/BaseEventoPeer.php';
- if ($this->aRepeticion === null && ($this->fk_repeticion_id !== null)) {
+ if ($this->aEvento === null && ($this->fk_evento_id !== null)) {
- $this->aRepeticion = RepeticionPeer::retrieveByPK($this->fk_repeticion_id, $con);
+ $this->aEvento = EventoPeer::retrieveByPK($this->fk_evento_id, $con);
}
- return $this->aRepeticion;
+ return $this->aEvento;
}
@@ -584,7 +405,7 @@
if ($v === null) {
- $this->setFkDocenteId('0');
+ $this->setFkDocenteId(NULL);
} else {
$this->setFkDocenteId($v->getId());
}
Modified: prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorarioPeer.php
===================================================================
--- prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorarioPeer.php 2007-07-16 21:03:57 UTC (rev 4821)
+++ prosistem/alba/trunk/alba/lib/model/om/BaseDocenteHorarioPeer.php 2007-07-18 14:26:27 UTC (rev 4822)
@@ -13,48 +13,36 @@
const CLASS_DEFAULT = 'lib.model.DocenteHorario';
- const NUM_COLUMNS = 6;
+ const NUM_COLUMNS = 2;
const NUM_LAZY_LOAD_COLUMNS = 0;
- const ID = 'docente_horario.ID';
-
-
const FK_DOCENTE_ID = 'docente_horario.FK_DOCENTE_ID';
- const FK_REPETICION_ID = 'docente_horario.FK_REPETICION_ID';
+ const FK_EVENTO_ID = 'docente_horario.FK_EVENTO_ID';
- const HORA_INICIO = 'docente_horario.HORA_INICIO';
-
-
- const HORA_FIN = 'docente_horario.HORA_FIN';
-
-
- const DIA = 'docente_horario.DIA';
-
-
private static $phpNameMap = null;
private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('Id', 'FkDocenteId', 'FkRepeticionId', 'HoraInicio', 'HoraFin', 'Dia', ),
- BasePeer::TYPE_COLNAME => array (DocenteHorarioPeer::ID, DocenteHorarioPeer::FK_DOCENTE_ID, DocenteHorarioPeer::FK_REPETICION_ID, DocenteHorarioPeer::HORA_INICIO, DocenteHorarioPeer::HORA_FIN, DocenteHorarioPeer::DIA, ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'fk_docente_id', 'fk_repeticion_id', 'hora_inicio', 'hora_fin', 'dia', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ BasePeer::TYPE_PHPNAME => array ('FkDocenteId', 'FkEventoId', ),
+ BasePeer::TYPE_COLNAME => array (DocenteHorarioPeer::FK_DOCENTE_ID, DocenteHorarioPeer::FK_EVENTO_ID, ),
+ BasePeer::TYPE_FIELDNAME => array ('fk_docente_id', 'fk_evento_id', ),
+ BasePeer::TYPE_NUM => array (0, 1, )
);
private static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FkDocenteId' => 1, 'FkRepeticionId' => 2, 'HoraInicio' => 3, 'HoraFin' => 4, 'Dia' => 5, ),
- BasePeer::TYPE_COLNAME => array (DocenteHorarioPeer::ID => 0, DocenteHorarioPeer::FK_DOCENTE_ID => 1, DocenteHorarioPeer::FK_REPETICION_ID => 2, DocenteHorarioPeer::HORA_INICIO => 3, DocenteHorarioPeer::HORA_FIN => 4, DocenteHorarioPeer::DIA => 5, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'fk_docente_id' => 1, 'fk_repeticion_id' => 2, 'hora_inicio' => 3, 'hora_fin' => 4, 'dia' => 5, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ BasePeer::TYPE_PHPNAME => array ('FkDocenteId' => 0, 'FkEventoId' => 1, ),
+ BasePeer::TYPE_COLNAME => array (DocenteHorarioPeer::FK_DOCENTE_ID => 0, DocenteHorarioPeer::FK_EVENTO_ID => 1, ),
+ BasePeer::TYPE_FIELDNAME => array ('fk_docente_id' => 0, 'fk_evento_id' => 1, ),
+ BasePeer::TYPE_NUM => array (0, 1, )
);
@@ -108,22 +96,14 @@
public static function addSelectColumns(Criteria $criteria)
{
- $criteria->addSelectColumn(DocenteHorarioPeer::ID);
-
$criteria->addSelectColumn(DocenteHorarioPeer::FK_DOCENTE_ID);
- $criteria->addSelectColumn(DocenteHorarioPeer::FK_REPETICION_ID);
+ $criteria->addSelectColumn(DocenteHorarioPeer::FK_EVENTO_ID);
- $criteria->addSelectColumn(DocenteHorarioPeer::HORA_INICIO);
-
- $criteria->addSelectColumn(DocenteHorarioPeer::HORA_FIN);
-
- $criteria->addSelectColumn(DocenteHorarioPeer::DIA);
-
}
- const COUNT = 'COUNT(docente_horario.ID)';
- const COUNT_DISTINCT = 'COUNT(DISTINCT docente_horario.ID)';
+ const COUNT = 'COUNT(docente_horario.FK_DOCENTE_ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT docente_horario.FK_DOCENTE_ID)';
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
@@ -199,7 +179,7 @@
}
- public static function doCountJoinRepeticion(Criteria $criteria, $distinct = false, $con = null)
+ public static function doCountJoinEvento(Criteria $criteria, $distinct = false, $con = null)
{
$criteria = clone $criteria;
@@ -215,7 +195,7 @@
$criteria->addSelectColumn($column);
}
- $criteria->addJoin(DocenteHorarioPeer::FK_REPETICION_ID, RepeticionPeer::ID);
+ $criteria->addJoin(DocenteHorarioPeer::FK_EVENTO_ID, EventoPeer::ID);
$rs = DocenteHorarioPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
@@ -255,7 +235,7 @@
- public static function doSelectJoinRepeticion(Criteria $c, $con = null)
+ public static function doSelectJoinEvento(Criteria $c, $con = null)
{
$c = clone $c;
@@ -265,9 +245,9 @@
DocenteHorarioPeer::addSelectColumns($c);
$startcol = (DocenteHorarioPeer::NUM_COLUMNS - DocenteHorarioPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
- RepeticionPeer::addSelectColumns($c);
+ EventoPeer::addSelectColumns($c);
- $c->addJoin(DocenteHorarioPeer::FK_REPETICION_ID, RepeticionPeer::ID);
+ $c->addJoin(DocenteHorarioPeer::FK_EVENTO_ID, EventoPeer::ID);
$rs = BasePeer::doSelect($c, $con);
$results = array();
@@ -279,7 +259,7 @@
$obj1 = new $cls();
$obj1->hydrate($rs);
- $omClass = RepeticionPeer::getOMClass();
+ $omClass = EventoPeer::getOMClass();
$cls = Propel::import($omClass);
$obj2 = new $cls();
@@ -287,7 +267,7 @@
$newObject = true;
foreach($results as $temp_obj1) {
- $temp_obj2 = $temp_obj1->getRepeticion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $temp_obj2 = $temp_obj1->getEvento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
$newObject = false;
$temp_obj2->addDocenteHorario($obj1); break;
}
@@ -365,7 +345,7 @@
$criteria->addSelectColumn($column);
}
- $criteria->addJoin(DocenteHorarioPeer::FK_REPETICION_ID, RepeticionPeer::ID);
+ $criteria->addJoin(DocenteHorarioPeer::FK_EVENTO_ID, EventoPeer::ID);
$criteria->addJoin(DocenteHorarioPeer::FK_DOCENTE_ID, DocentePeer::ID);
@@ -390,13 +370,13 @@
DocenteHorarioPeer::addSelectColumns($c);
$startcol2 = (DocenteHorarioPeer::NUM_COLUMNS - DocenteHorarioPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
- RepeticionPeer::addSelectColumns($c);
- $startcol3 = $startcol2 + RepeticionPeer::NUM_COLUMNS;
+ EventoPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + EventoPeer::NUM_COLUMNS;
DocentePeer::addSelectColumns($c);
$startcol4 = $startcol3 + DocentePeer::NUM_COLUMNS;
- $c->addJoin(DocenteHorarioPeer::FK_REPETICION_ID, RepeticionPeer::ID);
+ $c->addJoin(DocenteHorarioPeer::FK_EVENTO_ID, EventoPeer::ID);
$c->addJoin(DocenteHorarioPeer::FK_DOCENTE_ID, DocentePeer::ID);
@@ -414,7 +394,7 @@
- $omClass = RepeticionPeer::getOMClass();
+ $omClass = EventoPeer::getOMClass();
$cls = Propel::import($omClass);
@@ -424,7 +404,7 @@
$newObject = true;
for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
$temp_obj1 = $results[$j];
- $temp_obj2 = $temp_obj1->getRepeticion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $temp_obj2 = $temp_obj1->getEvento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
$newObject = false;
$temp_obj2->addDocenteHorario($obj1); break;
}
@@ -465,7 +445,7 @@
- public static function doCountJoinAllExceptRepeticion(Criteria $criteria, $distinct = false, $con = null)
+ public static function doCountJoinAllExceptEvento(Criteria $criteria, $distinct = false, $con = null)
{
$criteria = clone $criteria;
@@ -509,7 +489,7 @@
$criteria->addSelectColumn($column);
}
- $criteria->addJoin(DocenteHorarioPeer::FK_REPETICION_ID, RepeticionPeer::ID);
+ $criteria->addJoin(DocenteHorarioPeer::FK_EVENTO_ID, EventoPeer::ID);
$rs = DocenteHorarioPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
@@ -521,7 +501,7 @@
- public static function doSelectJoinAllExceptRepeticion(Criteria $c, $con = null)
+ public static function doSelectJoinAllExceptEvento(Criteria $c, $con = null)
{
$c = clone $c;
@@ -589,10 +569,10 @@
DocenteHorarioPeer::addSelectColumns($c);
$startcol2 = (DocenteHorarioPeer::NUM_COLUMNS - DocenteHorarioPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
- RepeticionPeer::addSelectColumns($c);
- $startcol3 = $startcol2 + RepeticionPeer::NUM_COLUMNS;
+ EventoPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + EventoPeer::NUM_COLUMNS;
- $c->addJoin(DocenteHorarioPeer::FK_REPETICION_ID, RepeticionPeer::ID);
+ $c->addJoin(DocenteHorarioPeer::FK_EVENTO_ID, EventoPeer::ID);
$rs = BasePeer::doSelect($c, $con);
@@ -606,7 +586,7 @@
$obj1 = new $cls();
$obj1->hydrate($rs);
- $omClass = RepeticionPeer::getOMClass();
+ $omClass = EventoPeer::getOMClass();
$cls = Propel::import($omClass);
@@ -616,7 +596,7 @@
$newObject = true;
for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
$temp_obj1 = $results[$j];
- $temp_obj2 = $temp_obj1->getRepeticion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $temp_obj2 = $temp_obj1->getEvento(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
$newObject = false;
$temp_obj2->addDocenteHorario($obj1);
break;
@@ -656,7 +636,6 @@
$criteria = clone $values; } else {
$criteria = $values->buildCriteria(); }
- $criteria->remove(DocenteHorarioPeer::ID);
$criteria->setDbName(self::DATABASE_NAME);
@@ -683,9 +662,12 @@
if ($values instanceof Criteria) {
$criteria = clone $values;
- $comparison = $criteria->getComparison(DocenteHorarioPeer::ID);
- $selectCriteria->add(DocenteHorarioPeer::ID, $criteria->remove(DocenteHorarioPeer::ID), $comparison);
+ $comparison = $criteria->getComparison(DocenteHorarioPeer::FK_DOCENTE_ID);
+ $selectCriteria->add(DocenteHorarioPeer::FK_DOCENTE_ID, $criteria->remove(DocenteHorarioPeer::FK_DOCENTE_ID), $comparison);
+ $comparison = $criteria->getComparison(DocenteHorarioPeer::FK_EVENTO_ID);
+ $selectCriteria->add(DocenteHorarioPeer::FK_EVENTO_ID, $criteria->remove(DocenteHorarioPeer::FK_EVENTO_ID), $comparison);
+
} else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
$criteria->setDbName(self::DATABASE_NAME);
@@ -723,7 +705,20 @@
$criteria = $values->buildPkeyCriteria();
} else {
$criteria = new Criteria(self::DATABASE_NAME);
- $criteria->add(DocenteHorarioPeer::ID, (array) $values, Criteria::IN);
+ if(count($values) == count($values, COUNT_RECURSIVE))
+ {
+ $values = array($values);
+ }
+ $vals = array();
+ foreach($values as $value)
+ {
+
+ $vals[0][] = $value[0];
+ $vals[1][] = $value[1];
+ }
+
+ $criteria->add(DocenteHorarioPeer::FK_DOCENTE_ID, $vals[0], Criteria::IN);
+ $criteria->add(DocenteHorarioPeer::FK_EVENTO_ID, $vals[1], Criteria::IN);
}
$criteria->setDbName(self::DATABASE_NAME);
@@ -777,40 +772,17 @@
}
- public static function retrieveByPK($pk, $con = null)
- {
+ public static function retrieveByPK( $fk_docente_id, $fk_evento_id, $con = null) {
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
-
- $criteria = new Criteria(DocenteHorarioPeer::DATABASE_NAME);
-
- $criteria->add(DocenteHorarioPeer::ID, $pk);
-
-
+ $criteria = new Criteria();
+ $criteria->add(DocenteHorarioPeer::FK_DOCENTE_ID, $fk_docente_id);
+ $criteria->add(DocenteHorarioPeer::FK_EVENTO_ID, $fk_evento_id);
$v = DocenteHorarioPeer::doSelect($criteria, $con);
- return !empty($v) > 0 ? $v[0] : null;
+ return !empty($v) ? $v[0] : null;
}
-
-
- public static function retrieveByPKs($pks, $con = null)
- {
- if ($con === null) {
- $con = Propel::getConnection(self::DATABASE_NAME);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria();
- $criteria->add(DocenteHorarioPeer::ID, $pks, Criteria::IN);
- $objs = DocenteHorarioPeer::doSelect($criteria, $con);
- }
- return $objs;
- }
-
}
if (Propel::isInit()) {
try {
Modified: prosistem/alba/trunk/alba/lib/model/om/BaseEvento.php
===================================================================
--- prosistem/alba/trunk/alba/lib/model/om/BaseEvento.php 2007-07-16 21:03:57 UTC (rev 4821)
+++ prosistem/alba/trunk/alba/lib/model/om/BaseEvento.php 2007-07-18 14:26:27 UTC (rev 4822)
@@ -54,6 +54,12 @@
protected $lastRelDivisionActividadDocenteCriteria = null;
+ protected $collDocenteHorarios;
+
+
+ protected $lastDocenteHorarioCriteria = null;
+
+
protected $alreadyInSave = false;
@@ -410,6 +416,14 @@
}
}
+ if ($this->collDocenteHorarios !== null) {
+ foreach($this->collDocenteHorarios as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
return $affectedRows;
@@ -459,7 +473,15 @@
}
}
+ if ($this->collDocenteHorarios !== null) {
+ foreach($this->collDocenteHorarios as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
$this->alreadyInValidation = false;
}
@@ -662,6 +684,10 @@
$copyObj->addRelDivisionActividadDocente($relObj->copy($deepCopy));
}
+ foreach($this->getDocenteHorarios() as $relObj) {
+ $copyObj->addDocenteHorario($relObj->copy($deepCopy));
+ }
+
}
$copyObj->setNew(true);
@@ -897,4 +923,109 @@
return $this->collRelDivisionActividadDocentes;
}
+
+ public function initDocenteHorarios()
+ {
+ if ($this->collDocenteHorarios === null) {
+ $this->collDocenteHorarios = array();
+ }
+ }
+
+
+ public function getDocenteHorarios($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseDocenteHorarioPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collDocenteHorarios === null) {
+ if ($this->isNew()) {
+ $this->collDocenteHorarios = array();
+ } else {
+
+ $criteria->add(DocenteHorarioPeer::FK_EVENTO_ID, $this->getId());
+
+ DocenteHorarioPeer::addSelectColumns($criteria);
+ $this->collDocenteHorarios = DocenteHorarioPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(DocenteHorarioPeer::FK_EVENTO_ID, $this->getId());
+
+ DocenteHorarioPeer::addSelectColumns($criteria);
+ if (!isset($this->lastDocenteHorarioCriteria) || !$this->lastDocenteHorarioCriteria->equals($criteria)) {
+ $this->collDocenteHorarios = DocenteHorarioPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastDocenteHorarioCriteria = $criteria;
+ return $this->collDocenteHorarios;
+ }
+
+
+ public function countDocenteHorarios($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseDocenteHorarioPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(DocenteHorarioPeer::FK_EVENTO_ID, $this->getId());
+
+ return DocenteHorarioPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addDocenteHorario(DocenteHorario $l)
+ {
+ $this->collDocenteHorarios[] = $l;
+ $l->setEvento($this);
+ }
+
+
+
+ public function getDocenteHorariosJoinDocente($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseDocenteHorarioPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collDocenteHorarios === null) {
+ if ($this->isNew()) {
+ $this->collDocenteHorarios = array();
+ } else {
+
+ $criteria->add(DocenteHorarioPeer::FK_EVENTO_ID, $this->getId());
+
+ $this->collDocenteHorarios = DocenteHorarioPeer::doSelectJoinDocente($criteria, $con);
+ }
+ } else {
+
+ $criteria->add(DocenteHorarioPeer::FK_EVENTO_ID, $this->getId());
+
+ if (!isset($this->lastDocenteHorarioCriteria) || !$this->lastDocenteHorarioCriteria->equals($criteria)) {
+ $this->collDocenteHorarios = DocenteHorarioPeer::doSelectJoinDocente($criteria, $con);
+ }
+ }
+ $this->lastDocenteHorarioCriteria = $criteria;
+
+ return $this->collDocenteHorarios;
+ }
+
}
\ No newline at end of file
Modified: prosistem/alba/trunk/alba/lib/model/om/BaseRepeticion.php
===================================================================
--- prosistem/alba/trunk/alba/lib/model/om/BaseRepeticion.php 2007-07-16 21:03:57 UTC (rev 4821)
+++ prosistem/alba/trunk/alba/lib/model/om/BaseRepeticion.php 2007-07-18 14:26:27 UTC (rev 4822)
@@ -26,12 +26,6 @@
protected $lastRelDivisionActividadDocenteCriteria = null;
- protected $collDocenteHorarios;
-
-
- protected $lastDocenteHorarioCriteria = null;
-
-
protected $alreadyInSave = false;
@@ -191,14 +185,6 @@
}
}
- if ($this->collDocenteHorarios !== null) {
- foreach($this->collDocenteHorarios as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
$this->alreadyInSave = false;
}
return $affectedRows;
@@ -248,15 +234,7 @@
}
}
- if ($this->collDocenteHorarios !== null) {
- foreach($this->collDocenteHorarios as $referrerFK) {
- if (!$referrerFK->validate($columns)) {
- $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
- }
- }
- }
-
$this->alreadyInValidation = false;
}
@@ -382,10 +360,6 @@
$copyObj->addRelDivisionActividadDocente($relObj->copy($deepCopy));
}
- foreach($this->getDocenteHorarios() as $relObj) {
- $copyObj->addDocenteHorario($relObj->copy($deepCopy));
- }
-
}
$copyObj->setNew(true);
@@ -621,109 +595,4 @@
return $this->collRelDivisionActividadDocentes;
}
-
- public function initDocenteHorarios()
- {
- if ($this->collDocenteHorarios === null) {
- $this->collDocenteHorarios = array();
- }
- }
-
-
- public function getDocenteHorarios($criteria = null, $con = null)
- {
- include_once 'lib/model/om/BaseDocenteHorarioPeer.php';
- if ($criteria === null) {
- $criteria = new Criteria();
- }
- elseif ($criteria instanceof Criteria)
- {
- $criteria = clone $criteria;
- }
-
- if ($this->collDocenteHorarios === null) {
- if ($this->isNew()) {
- $this->collDocenteHorarios = array();
- } else {
-
- $criteria->add(DocenteHorarioPeer::FK_REPETICION_ID, $this->getId());
-
- DocenteHorarioPeer::addSelectColumns($criteria);
- $this->collDocenteHorarios = DocenteHorarioPeer::doSelect($criteria, $con);
- }
- } else {
- if (!$this->isNew()) {
-
-
- $criteria->add(DocenteHorarioPeer::FK_REPETICION_ID, $this->getId());
-
- DocenteHorarioPeer::addSelectColumns($criteria);
- if (!isset($this->lastDocenteHorarioCriteria) || !$this->lastDocenteHorarioCriteria->equals($criteria)) {
- $this->collDocenteHorarios = DocenteHorarioPeer::doSelect($criteria, $con);
- }
- }
- }
- $this->lastDocenteHorarioCriteria = $criteria;
- return $this->collDocenteHorarios;
- }
-
-
- public function countDocenteHorarios($criteria = null, $distinct = false, $con = null)
- {
- include_once 'lib/model/om/BaseDocenteHorarioPeer.php';
- if ($criteria === null) {
- $criteria = new Criteria();
- }
- elseif ($criteria instanceof Criteria)
- {
- $criteria = clone $criteria;
- }
-
- $criteria->add(DocenteHorarioPeer::FK_REPETICION_ID, $this->getId());
-
- return DocenteHorarioPeer::doCount($criteria, $distinct, $con);
- }
-
-
- public function addDocenteHorario(DocenteHorario $l)
- {
- $this->collDocenteHorarios[] = $l;
- $l->setRepeticion($this);
- }
-
-
-
- public function getDocenteHorariosJoinDocente($criteria = null, $con = null)
- {
- include_once 'lib/model/om/BaseDocenteHorarioPeer.php';
- if ($criteria === null) {
- $criteria = new Criteria();
- }
- elseif ($criteria instanceof Criteria)
- {
- $criteria = clone $criteria;
- }
-
- if ($this->collDocenteHorarios === null) {
- if ($this->isNew()) {
- $this->collDocenteHorarios = array();
- } else {
-
- $criteria->add(DocenteHorarioPeer::FK_REPETICION_ID, $this->getId());
-
- $this->collDocenteHorarios = DocenteHorarioPeer::doSelectJoinDocente($criteria, $con);
- }
- } else {
-
- $criteria->add(DocenteHorarioPeer::FK_REPETICION_ID, $this->getId());
-
- if (!isset($this->lastDocenteHorarioCriteria) || !$this->lastDocenteHorarioCriteria->equals($criteria)) {
- $this->collDocenteHorarios = DocenteHorarioPeer::doSelectJoinDocente($criteria, $con);
- }
- }
- $this->lastDocenteHorarioCriteria = $criteria;
-
- return $this->collDocenteHorarios;
- }
-
}
\ No newline at end of file
Más información sobre la lista de distribución Alba-desarrollo