Foros del Web » Programando para Internet » PHP »

Calendario raro????

Estas en el tema de Calendario raro???? en el foro de PHP en Foros del Web. Amigos en la institucion donde trabajo hay un calendario de eventos en que su codigo original era colocar dentro de ella los eventos que se ...
  #1 (permalink)  
Antiguo 01/11/2006, 12:18
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
Calendario raro????

Amigos en la institucion donde trabajo hay un calendario de eventos en que su codigo original era colocar dentro de ella los eventos que se tenia palnificado por semana o mes.

Pero el mismo fue modificado para que extrajiera los datos (eventos) desde una base de datos, eso funciona a mil maravilla PERO LE OCURRE ALGO RARO SIEMPRE EN LOS PRIMEROS DIAS DE CADA MES EL (EL CALENDARIO) MARCA LA FECHA INCORRECTA DESPUES de varios dias, SI MARCA LA FECHA QUE ES

Aqui le dejo la direccion para que la vea:
http://www.unerg.edu.ve

y el codigo de dicho calendario es este:
Código PHP:
<?php 
 
/*************************************** 
 * Script: NiceCalendar 1.0
 * Author: Andyy <mail_at_andyydev.com>
 * website: www.AndyyDev.com
 ***************************************/
 
class NiceCalendar {
  var 
$month,$year,$data,$tt;
   
     function 
NiceCalendar($data='',$tooltip=true,$month='',$year=''){
       
$this->month=($month!='')?$month:date('n');
       
$this->year=($year!='')?$year:date('Y');
       
$this->data=$data;
       
$this->tt=$tooltip;
     }
     
     function 
draw(){
        
$time=mktime(0,0,0,$this->month,1,$this->year);
       
//echo $time."<BR>";
       
$lastDaydate('t',$time);
         
// echo $lastDay."<BR>";
       
$firstDay=date('w',$time);
          
//echo $firstDay."<BR>";
       
$today=date('j');
          
//echo $today."<BR>";
       
$i=1;
       
$days=array('Dom','Lun','Mar','Mier','Jue','Vie','Sab');
       
       echo 
'<div id="calendar"><table cellpadding="2" cellspacing="1">';
       echo 
'<tr class="header">';
       foreach (
$days as $k=>$v) echo '<td class="day"><font size="-2">'.$v.'</font></td>';
       echo 
'</tr>';
       
       while(
$i<=$lastDay){
        echo 
'<tr>'
         for (
$j=0;$j<7;$j++){
           
$note=$this->data[$i.'-'.$this->month.'-'.$this->year];
           if(
is_array($this->data) && $note) {
             if (
$this->tt$day='<span style="margin-top:0px;" id="header=[] body=['.str_replace('“','\'',str_replace('”','\'',str_replace('"','\'',$note[1]))).'] delay=[20] fade=[on] cssbody=[toolbody]" onclick="location.href=\''.$note[0].'\'">'.$i.'</span>';
             else 
$day='<span><a href=\''.$note[0].'\'">'.$i.'</a></span>';
           
$class='note';
           }
           else {
$day=$i;$class='';}
          
           if(
$i.$this->month.$this->year==$today.date('nY')) {echo '<td class="row'.($j%2).' current '.$class.'">'.$day.'</td>';$i++;}
           elseif((
$i!=|| $firstDay==$j) && $i<=$lastDay) {echo '<td class="row'.($j%2).' '.$class.'">'.$day.'</td>';$i++;}
           else  echo 
'<td>&nbsp;</td>';
         }
        echo 
'</tr>';          
       }



       if (
$this->month==1) {$pmonth=12;$pyear=$this->year-1;}  else  {$pmonth=$this->month-1;$pyear=$this->year;}
       if (
$this->month==12) {$nmonth=1;$nyear=$this->year+1;}  else  {$nmonth=$this->month+1;$nyear=$this->year;}

        
setlocale(LC_ALL'spanish-modern' );//Linea para cambiar el mes en español
      // $loc = setlocale(LC_TIME, NULL);//Linea para cambiar el mes en español
       
$time2=strftime(" %B %Y"mktime(0,0,0,$this->month,1,$this->year));//Linea para cambiar el mes en español strftime("%A %e %B %Y", mktime(0, 0, 0, 12, 22, 1978));
        
        
/*        if($mes=$time=='enero 2006') $mes='Enero';
       if($mes=date('F',$time)=='February') $mes='Febrero';
       if($mes=date('F',$time)=='March') $mes='Marzo';
       if($mes=date('F',$time)=='April') $mes='Abril';
       if($mes=date('F',$time)=='May') $mes='Mayo';
       if($mes=date('F',$time)=='June') $mes='Junio';
       if($mes=date('F',$time)=='July') $mes='Julio';
       if($mes=date('F',$time)=='August') $mes='Agosto';
       if($mes=date('F',$time)=='September') $mes='Septiembre';
       if($mes=date('F',$time)=='October') $mes='Octubre';
       if($mes=date('F',$time)=='November') $mes='Noviembre';
       if($mes=date('F',$time)=='December') $mes='Diciembre';*/

       
$query_str=str_replace('&month='.$this->month.'&year='.$this->year,'',$_SERVER['QUERY_STRING']);
       
$query_str=str_replace('?month='.$this->month.'&year='.$this->year,'',$query_str);
       
$page=($_SERVER['QUERY_STRING'])?$_SERVER['PHP_SELF'].'?'.$query_str.'&':$_SERVER['PHP_SELF'].'?';

       echo 
'<tr><td><a href="'.$page.'month='.$pmonth.'&year='.$pyear.'#calendar">&laquo;</a></td><td colspan="5"><b>'$time2.'</b> <span class="y">'./*date('Y',$time).*/'</span></td><td><a href="'.$page.'month='.$nmonth.'&year='.$nyear.'#calendar">&raquo;</a></td></tr>';
       echo 
'</table></div>';
       
//echo $nmonth;
     
}
  } 
  
  
  
?> 

<!-- Begin include in <head>-->
<style>
/*Save this in NiceCalendar.css*/
/*General*/
#calendar td{background:#fff;text-align:center;}
#calendar table{background:#ccc}
#calendar .row0 {background:#F4F4F4;}
#calendar .row1 {background:#E9E9E9;}
#calendar .current {font-weight:bold;border:1px solid #000;font-size:10pt ;}
#calendar .day {width:30px;background:#ccc}   
#calendar .y {color:#999}   
/* ToolTip for notes */ 
.toolbody {background-color:#fff;padding:5px;border:1px solid #666;width:150px;}
/*Cells with notes*/ 
#calendar .note {background:#5580C0;}
#calendar .note span {background:#9AD5F1;display:block;margin:0;} 
#calendar .note a {text-decoration:none;}
</style>
<script src="NiceCalendar.js"></script>
<!-- End include in <head>-->
<? 

$conectar
=mysql_connect('localhost','root','') or die("No se puede establecer conexión con el servidor");
mysql_select_db('unerg4',$conectar);


$result=mysql_query("select * from eventos ",$conectar);

$var = array();
while(
$valor=mysql_fetch_array($result))  
 {  
//echo "<br>".$valor['fecha'];
$f=$valor['fecha'];
//echo "<br>".$valor['link'];
$l=$valor['link'];
//echo "<br>".$valor['cita'];
$c=$valor['cita'];
//echo "<br>********************";
$var[$f] = array("$l","$c");
     
}  
/*Aqui se colocas los eventos por cada dias y con enlace si quieres*/
/*$var=array(
  '1-7-2006'=>array('blog.php?id=01072006','A day to remember'),
  '12-7-2006'=>array('#','Don\'t need any link'),
  '26-7-2006'=>array('http://www.google.com','Debo revisar google'),  
  '30-7-2006'=>array('#','Debo ir a Clasesfgfdgfxgdfxgxcfgxcfbxcfghxdfghfggh dfghxdfgxdfgdfx !!'),
  '31-7-2006'=>array('#','Debo ir a Clasesfgfdgfxgdfxgxcfgxcfbxcfghxdfghfggh dfghxdfgxdfgdfx !!'),
  '11-6-2006'=>array('#','Also for previous Month !!')
  );*/

   
// $calendar = new NiceCalendar($remind,1,$_GET['month'],$_GET['year']); 
$calendar = new NiceCalendar($var,1,$_GET['month'],$_GET['year']); 
$calendar->draw();

?>
Quisiera que alguie me ayudara a resolver este problema, ya que este codogo se utiliza mucho en nuestra institucion
__________________
Miguel Padrón :cool:
  #2 (permalink)  
Antiguo 02/11/2006, 05:36
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
Ninguna idea por favor, vean hoy otra ves el calendario ya se arreglo, el problema es la primera fecha de cada mes, iluminame por favor

gracias
__________________
Miguel Padrón :cool:
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:17.