Amigos tengo una clase que me imprime una tabla con un calendario de evento el cual me funciona bien pero tengo 2 problemas el mes lo imprime en
ingles y la forma de introducir los datos es a tarves de un array dentro del codigo
Lo que que quiero primero es cambiar el mes de
ingles a español
el codigo es este:
Código PHP:
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);
$lastDay= date('t',$time);
$firstDay=date('w',$time);
$today=date('j');
$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">'.$v.'</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!=1 || $firstDay==$j) && $i<=$lastDay) {echo '<td class="row'.($j%2).' '.$class.'">'.$day.'</td>';$i++;}
else echo '<td> </td>';
}
echo '</tr>';
}
/*if($mes=date('F',$time)=='January') $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';*/
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;}
$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">«</a></td><td colspan="5"><b>'.date('F',$time).'</b> <span class="y">'.date('Y',$time).'</span></td><td><a href="'.$page.'month='.$nmonth.'&year='.$nyear.'#calendar">»</a></td></tr>';
echo '</table></div>';
echo $nmonth;
}
}
?>
Lo que esta comentado era una prueba para cambiarlo el cual funciona a media es decir cuando coloque hasta julio y corro el codiho funciona pero si lo coloco completo hasta diciembre no aparece nada de nada en ningun mes solo el año
El comando que imprime el mes en ingles es.
date(F,$tme), como lo puedo cambiar para que imprima en español
ayuda plissssss
Ayude es este y sugerencia para hacerlo mas dinamico desde una base de datos donde se encuentra los eventos y pasarlo al arreglo del codigo ARRAY