Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/07/2006, 12:08
RJD
 
Fecha de Ingreso: enero-2006
Mensajes: 64
Antigüedad: 20 años, 8 meses
Puntos: 0
Hola!

Esta parte es la que en todo caso tendría que contener el error, ya que lo demás es para añadir el evento y eso no tiene problemas

Código PHP:
////////////////////////////////////////////////////////////////
// Start of actual code, no need to change ////////////////////
//
if($startwithmonday) {
    
$dayName = array($monday, $tuesday, $wednesday, $thursday, $friday, $saturday,$sunday);
} else {
    
$dayName = array($sunday, $monday, $tuesday, $wednesday, $thursday, $friday, $saturday);
}

$monthName = array($january, $february, $march, $april, $may, $june, $july, $august, $september, $october,
$november, $december);

if(isset(
$_GET['act'])){
    
$act = $_GET['act'];
} else {
    
$act = "";
}
if(isset(
$_GET['date'])){
    
$date = $_GET['date'];
} else {
    
$date = date("Y-m-d");
}



////////////////////////////////////////////////////////////////
// Function for creating the current month ////////////////////
//
function createMonth($date) {
    
    global 
$startwithmonday;
    
    
$date = split("\-", $date);
    
$year = $date[0];
    
$month = $date[1];
    
    
// Dates
    
    
$this_month_date = makeDate($year, $month, 1);
    
$last_month_date = makeDate($year, $month - 1, 1);
    
$next_month_date = makeDate($year, $month + 1, 1);
    
// Numbers
    
$this_month_first_day = trim(date("w", $this_month_date));
    
    
$this_month_days = trim(date("t", $this_month_date));
    
$last_month_days = trim(date("t", $last_month_date));
    
    
$this_month_number = trim(date("n", $this_month_date));
    
$last_month_number = trim(date("n", $last_month_date));
    
$next_month_number = trim(date("n", $next_month_date));
    
    
$this_month_year = trim(date("Y", $this_month_date));
    
$last_month_year = trim(date("Y", $last_month_date));
    
$next_month_year = trim(date("Y", $next_month_date));
    
    if(
$startwithmonday) {
        if(
$this_month_first_day == 0) {
            
$this_month_first_day = 7;
        }
    } else {
        
$this_month_first_day++;
    }
    
        
    
// Förra
    
for($I = 1; $I < $this_month_first_day; $I++) {
        
$temp = $last_month_days - $this_month_first_day + $I + 1;
        
$monthArray["$last_month_year-$last_month_number-$temp"] = array(0, "$last_month_year-$last_month_number-$temp");
    }
    
// Månad.
    
for($I = 1; $I <= $this_month_days; $I++) {
        
$monthArray["$this_month_year-$this_month_number-$I"] = array(1, "$this_month_year-$this_month_number-$I");
    }
    
// Nästa
    
for($I = 1; $I <= 43 - $this_month_days - $this_month_first_day; $I++) {
        
$monthArray["$next_month_year-$next_month_number-$I"] = array(0, "$next_month_year-$next_month_number-$I");
    }
return 
$monthArray;    
};

// End of createMonth function
////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////
// Function for adding events to month ////////////////////////
//
function appendEvent($date, $monthArray) {
    
    global 
$path, $act;
    
    
$date = split("\-", $date);
    
$year = $date[0];
    
$month = $date[1];

    
$date = makeDate($year, $month, 1);
    
$date = date("Y-m", $date);

    
    
    if(
$act == "event") {
        
$fp = @fopen("$date.txt", "r");
    } else {
        
$fp = @fopen("$path$date.txt", "r");
    }
    
    if(
$fp) {
        while (!
feof($fp))  { 
            
$line = fgets($fp);
            if(
$line != "") {
                
$data = split("\#", $line);
                
$date = split("\|", $data[0]);
                
$monthArray["$date[0]"][0] = 2;
                
$monthArray["$date[0]"][1] = "$date[0]";
                
$monthArray["$date[0]"][2][] = array("$date[1]", "$data[1]");
            }
        }
    }
    return 
$monthArray;
};
// End of appendEvent function
////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////
// Function for adding the current day ////////////////////////
//
function addToday($date, $monthArray) {
    
$date = split("\-", $date);
    
$year = $date[0];
    
$month = $date[1];
    
$this_year = date("Y");
    
$this_month = date("n");
    
    if(
$year == $this_year && $month == $this_month) {
        
$monthArray[date("Y-n-j")][0] +=2;
    }
    return 
$monthArray;
};
// End of appendEvent function
////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////
// Function for displaying the current month //////////////////
//
function displayMonth($date, $monthArray) {
    
    global 
$path, $weekBGColor, $weeknumber, $width, $monthName, $dayName, $monthBGColor, $monthTextColor, $daysBGColor;

    
$date = split("\-", $date);
    
$year = $date[0];
    
$month = $date[1];
    
    
$this_month = mktime(0, 0, 0, $month, 1,  $year);
    
$last_month = mktime(0, 0, 0, $month - 1, 1,  $year);
    
$next_month = mktime(0, 0, 0, $month + 1, 1,  $year);



    
////////////////////////////////////////////////////////
    // Javascript for popup window. ///////////////////////
    //
    
echo "<script type=\"text/javascript\">
    <!--
    
    function event(location){
    
    win=window.open(\"\",\"\",\"height=300,width=500, scrollbars=0, resizable=0, location=0, menubar=0, toolbar=0, status=0\")
    //win.moveTo(0,0)
    //win.resizeTo(heigh,width)
    win.location=location
    }
    //-->
    </script>\n\n"
;
    
//
    ////////////////////////////////////////////////////////


echo "<TABLE class=\"table\" cellspacing=\"0\" cellpadding=\"0\" width=\"$width\">\n<TR>\n";
echo 
"<TD class=\"td\" color=\"$monthTextColor\" bgcolor=\"$monthBGColor\" onMouseOver=\"this.className='sel'\" onMouseOut=\"this.className='td'\" >\n<A class=\"A\" HREF=\"?date=";
echo 
date("Y-m-j", $last_month);
echo 
"\">&laquo;</A>\n</TD>\n<TD class=\"td\" color=\"$monthTextColor\"  bgcolor=\"$monthBGColor\">\n";
echo 
$monthName[$month-1];
echo 
date(" Y", $this_month);
echo 
"\n</TD>\n<TD class=\"td\" color=\"$monthTextColor\"  bgcolor=\"$monthBGColor\" onMouseOver=\"this.className='sel'\" onMouseOut=\"this.className='td'\" >\n<A class=\"A\" HREF=\"?date=";
echo 
date("Y-m-j", $next_month);
echo 
"\">&raquo;</A>\n</TD>\n</TR>\n<TR>\n";
    
echo 
"<TD class=\"td\" colspan=\"3\">\n    <TABLE class=\"table\" width=\"100%\">\n<TR>\n";

foreach (
$dayName as $key) {
    echo 
"<TD class=\"td\"  bgcolor=\"$daysBGColor\">$key</TD>\n";
}
if(
$weeknumber) {
    echo 
"<TD class=\"td\"  bgcolor=\"$daysBGColor\">v.</TD>\n";
}

echo 
"</TR>\n\n<TR>\n";


    
////////////////////////////////////////////////////////
    // Prints the days. ///////////////////////////////////
    //
    
$day = 0;
    
    if(
$weeknumber) {
        
$week = date("W", $this_month);
    }
        
    
    foreach (
$monthArray as $key) {
        
$date = split("\-", $key[1]);
    
        if(
$key[0] == 0) {
                echo 
"<TD class=\"empty\">$date[2]</TD>\n";
        } else if(
$key[0] == 1) {
            echo 
"<TD onMouseOver=\"this.className='sel'\" onMouseOut=\"this.className='event'\" class=\"event\">$date[2]</TD>\n";
        } else if(
$key[0] == 2) {
            echo 
"<TD onMouseOver=\"this.className='sel'\" onMouseOut=\"this.className='event'\" class=\"event\"><A class=\"A\" HREF=\"javascript:event('$path?act=event&date=" . $key[1] . "')\">$date[2]</A></TD>\n";
        } else if (
$key[0] == 3) {
            echo 
"<TD onMouseOver=\"this.className='sel'\" onMouseOut=\"this.className='today'\" class=\"today\">$date[2]</TD>\n";
        } else if (
$key[0] == 4) {
            echo 
"<TD onMouseOver=\"this.className='sel'\" onMouseOut=\"this.className='today'\" class=\"today\"><A class=\"A\" HREF=\"javascript:event('$path?act=event&date=" . $key[1] . "')\"><B>$date[2]</B></A></TD>\n";
        }
    
$day++;
    if(
$day >= 7) {
        if(
$weeknumber) {
            echo 
"<TD bgcolor=\"$weekBGColor\" class=\"event\">$week</TD>\n";
            if(
$week >= 53) {
                
$week = 0;
            }
            
$week++;
        }
        echo 
"</TR>\n<TR>\n";
        
$day = 0;
    }
    
//
    ////////////////////////////////////////////////////////
}
echo 
"</TR>\n</TABLE>\n</TD></TR></TABLE>\n";



};

// End of displayMonth function
////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////
// Function for diplay of an event. ///////////////////////////
//
function displayEvent($date, $monthArray) {
    
    global 
$event1, $event2 , $monthName;
    
    
$date = split("\-", $date);
    
$year = $date[0];
    
$month = $date[1];
    
$day = $date[2];
    
$event = $monthArray["$year-$month-$day"][2];

echo 
"<style type=\"text/css\">
<!--
.Estilo1 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
}
-->
</style>\n\n"
;
    echo 
"<TABLE>\n";
    echo 
"<TR>\n<TD bgcolor=\"$event2\"colspan=\"2\">\n";
    echo 
$day . " " . $monthName[$month-1] . ", " . $year;
    echo 
"\n</TD>\n</TR>\n\n";
    foreach (
$event as $key) {
        echo 
"<TR>\n";
        echo 
"<TD bgcolor=\"$event1\" width=\"100%\" height=\"50px\" valign=\"top\">\n";
        echo 
$key[1];
        echo 
"\n</TD>\n</TR>\n\n";
    
    
$temp = $event1;
    
$event1 = $event2;
    
$event2 = $temp;
    }
    echo 
"<TR>\n<TD bgcolor=\"#999999\"colspan=\"2\">\n";
    echo 
"<div align=\"center\"><a href=\"javascript:window.close();\"><b>Cerrar</b></a></div>"; 
    echo 
"\n</TD>\n</TR>\n\n";
    echo 
"</TABLE>\n";
};
// End of displayEvent function
//////////////////////////////////////////////////////////////// 
He quitado la parte de Css para que no ocupe tanto espacio.
A ver si me puedes ayudar porfavor

Muchas gracias
Saludos Cordiales