Hola les estoy escribiendo porque tengo un problema.
Miren yo tengo el siguiente problema:
Tengo varios registros de un listado ejemplo:
[URL=http://www.imaxenes.com/imagen/dibujo11dg42gv.jpg.html][IMG]http://www.imaxenes.com/mini/dibujo11dg42gv.jpg[/IMG][/URL]
En donde le doy click a los casilleros checkbox y después aprieto el botón que dice "PROGRAMAR" ES TE ME ENVIA A OTRA PANTALLA en donde me aparece los registros que tenían marcado el casillero checkbox.
[URL=http://www.imaxenes.com/imagen/dibujo21rv66n3.jpg.html][IMG]http://www.imaxenes.com/mini/dibujo21rv66n3.jpg[/IMG][/URL]
este es el codigo de la consulta de como llego a esta pantalla
Código:
function f_aviso_Publish( $cid, $option ) {
global $database, $my;
$query = " SELECT id_trabajador AS value, nombre_trabajador AS text "
. "\n FROM #__intranet_trabajador "
. "\n order by nombre_trabajador asc "
;
$database->setQuery( $query );
$select_id_trabajador = $database->loadObjectList();
$select_id_trabajador = array_merge( array (
mosHTML::makeOption( '0', 'Seleccione Trabajador' )
), $select_id_trabajador
);
$lists['id_trabajador'] = mosHTML::selectList( $select_id_trabajador, 'id_trabajador', 'class="inputbox" size="1" ', 'value', 'text' , $row->id_trabajador );
if (!in_array( 0, $cid )) {
// Content Items query
mosArrayToInts( $cid );
$cids = 'id_aviso=' . implode( ' OR id_aviso=', $cid );
$query = "SELECT *"
. "\n FROM #__intranet_aviso as aviso"
. "\n LEFT JOIN #__intranet_prioridad as prioridad on aviso.id_prioridad=prioridad.id_prioridad "
. "\n LEFT JOIN #__intranet_tipo_falla as tipo_falla on aviso.id_tipo_falla=tipo_falla.id_tipo_falla "
. "\n LEFT JOIN #__intranet_tipo_trabajo as tipo_trabajo on aviso.id_tipo_trabajo=tipo_trabajo.id_tipo_trabajo "
. "\n LEFT JOIN #__intranet_unidad as unidad on aviso.id_unidad=unidad.id_unidad "
. "\n WHERE ( $cids )"
. "\n ORDER BY id_aviso"
;
$database->setQuery( $query );
$items = $database->loadObjectList();
$id_aviso = $cid;
}
require_once( $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php' );
$pageNav = new mosPageNav( $total, $limitstart, $limit );
HTML_aviso::showProgramar( $option, $id_aviso, $items, $pageNav, $lists );
}
Hasta ahí voy bien mi problema viene ahora.
1º problema yo tengo dos campos que dicen fecha de inicio y fecha de término esto están echo en javascrit con la función showcalendar. Mi problema es que solo cambia el primer casillero. si yo cambio la fecha del registro 2 se me cambia la del uno en resumen está trabajando con el registro 1 nada más que uno y al guardar solo me guarda la fecha del registro 1 y el registro 2 me lo guarda sin fecha.
Este es el código como llamo a la función:
Código:
<td><input class="text_area" type="text" name="fecha_inicio_ot" readonly="true" id="fecha_inicio_ot" size="10" maxlength="19" value="<?php echo $_POST['fecha_inicio_ot']; ?>" onclick="return showCalendar('fecha_inicio_ot', 'dd-mm-y');" /></td>
<td><input class="text_area" type="text" name="fecha_termino_ot" readonly="true" id="fecha_termino_ot" size="10" maxlength="19" value="<?php echo $_POST['fecha_termino_ot']; ?>" onclick="return showCalendar('fecha_termino_ot', 'dd-mm-y');" /></td>
Este es el código del formulario completo:
Código:
function showProgramar( $option, $cid, $items, $pageNav, $lists ) {
mosCommonHTML::loadCalendar();
mosCommonHTML::loadOverlib();
?>
<form action="index2.php" method="post" name="adminForm">
<table class="adminheading">
<tr>
<th>Programar Orden de Trabajo:</th>
</tr>
</table>
<table class="adminlist" border="1" width="500">
<tr>
<th width="2%" height="37"># </th>
<th width="2%">Nº de aviso </th>
<th width="2%" nowrap="nowrap"><span class="title">Prioridad</span></th>
<th width="2%" nowrap="nowrap"><span class="title">Creado por</span></th>
<th class="title">Tipo Falla</th>
<th class="title">Tipo Trabajo</th>
<th class="title">Unidad</th>
<th class="title">Descripción</th>
<th class="title">Fecha Ingreso O.T. </th>
<th class="title">Fecha Inicio O.T. </th>
<th class="title">Fecha Término O.T. </th>
<th class="title">Asignación O.T. </th>
<th class="title">Observación O.T. </th>
</tr><?php
$k = 0;
//$nullDate = $database->getNullDate();
for ($i=0, $n=count( $items ); $i < $n; $i++) {
$row = &$items[$i];
mosMakeHtmlSafe($row);
?>
<td><?php echo $pageNav->rowNumber( $i ); ?></td>
<td align="center"><?php echo $row->id_aviso; ?>
<input type="hidden" name="id_aviso[]" value="<?php echo $row->id_aviso;?>" /></td>
<td><?php echo $row->nombre_prioridad;?>
<input type="hidden" name="id_prioridad[]" value="<?php echo $row->id_prioridad;?>" /></td>
<td><?php echo $row->creado_por; ?>
<input type="hidden" name="creado_por[]" value="<?php echo $row->creado_por;?>" /></td>
<td><?php echo $row->nombre_tipo_falla;?>
<input type="hidden" name="id_tipo_falla[]" value="<?php echo $row->id_tipo_falla;?>" /></td>
<td><?php echo $row->nombre_tipo_trabajo;?>
<input type="hidden" name="id_tipo_trabajo[]" value="<?php echo $row->id_tipo_trabajo;?>" /></td>
<td><?php echo $row->nombre_unidad;?>
<input type="hidden" name="id_unidad[]" value="<?php echo $row->id_unidad;?>" /></td>
<td><?php echo $row->descripcion; ?>
<input type="hidden" name="descripcion[]" value="<?php echo $row->descripcion;?>" /></td>
<td><? $fecha=substr($row->fecha,0 ,10 );
$dia = substr($fecha,8 ,9 );
$mes = substr($fecha,5 ,2 );
$ano = substr($fecha,0 ,4 );
echo $fecha_estado = $dia.'-'.$mes.'-'.$ano;
?>
<input type="hidden" name="fecha[]" value="<?php echo $row->fecha;?>" /></td>
<td><input class="text_area" type="text" name="fecha_inicio_ot" readonly="true" id="fecha_inicio_ot" size="10" maxlength="19" value="<?php echo $_POST['fecha_inicio_ot']; ?>" onclick="return showCalendar('fecha_inicio_ot', 'dd-mm-y');" /></td>
<td><input class="text_area" type="text" name="fecha_termino_ot" readonly="true" id="fecha_termino_ot" size="10" maxlength="19" value="<?php echo $_POST['fecha_termino_ot']; ?>" onclick="return showCalendar('fecha_termino_ot', 'dd-mm-y');" /></td>
<td><?php echo $lists['id_trabajador'];?></td>
<td><input type="text" size="20" maxsize="100" name="observacion_ot[]" id="observacion_ot[]" value=""/></td>
<td><div id="container_aviso_programar2"></div></td>
</tr>
<?php
$k = 1 - $k;
}
?>
</table>
<?php echo $pageNav->getListFooter(); ?>
<form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<input type="hidden" name="id_aviso" value="<?php echo $row->id_aviso; ?>" />
<input type="hidden" name="id_trabajador" value="" />
<input type="hidden" name="option" value="<?php echo $option;?>" />
<input type="hidden" name="task" value="aviso_listado" />
<input type="hidden" name="boxchecked" value="1" />
<input type="hidden" name="mosmsg" value="" />
<input type="hidden" name="nohtml" value="1" />
<input type="hidden" name="hidemodules" value="1" />
<input type="hidden" name="showbuttons" value="1" />
<input type="hidden" name="update" value="" />
<?php
foreach ($cid as $id_aviso) {
echo "\n<input type=\"hidden\" name=\"cid[]\" value=\"$id_aviso\" />";
}
?>
</form>
Este es el código java script del calendario:
Código:
function showCalendar(id) {
var el = document.getElementById(id);
if (calendar != null) {
// we already have one created, so just update it.
calendar.hide(); // hide the existing calendar
calendar.parseDate(el.value); // set it to a new date
} else {
// first-time call, create the calendar
var cal = new Calendar(true, null, selected, closeHandler);
calendar = cal; // remember the calendar in the global
cal.setRange(1900, 2070); // min/max year allowed
calendar.create(); // create a popup calendar
calendar.parseDate(el.value); // set it to a new date
}
calendar.sel = el; // inform it about the input field in use
calendar.showAtElement(el); // show the calendar next to the input field
// catch mousedown on the document
Calendar.addEvent(document, "mousedown", checkCalendar);
return false;
}
Espero que me puedan ayudar me urge esto y la verdad no se me ocurre que puede ser
Como nota yo estoy programando dentro de joomla y esta función del calendario la traía joomla.
yo creo que me puede faltar algun for en donde tengo que capturar cuantos campos fechas tiene la consulta o algo por el estilo y la verdad yo no me manejo mucho en javascript.
de antemano gracias. espero que me puedan dar una mano