<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Calendario con eventi]]></title><description><![CDATA[<p dir="auto">Carissimi, cercavo nel vostro o nostro forum l'aiuto per un piccolo calendario con eventi ma non sono riuscito a comunicare._Oggi ho trovato uno script un po' strano, quando vado a vedere gli eventi del mese di dicembre o gennaio mi va avanti di un mese rispetto a dove mi trovo, non sono esperto altrimenti non chiederei aiuto vorrei postare lo script nella speranza che qualcuno possa aiutarmi.</p>
<p dir="auto">P.S. se vi è qualche script di calendario con massimo due file ne sarei grato.<br />
Scusate per la lunghezza ma ho bisogno.</p>
<pre><code class="language-php">&lt;?php
  //Declare some variables
 //
 $calendar_script          = "calendar2.php"; //The location of this script
 $calendar_language        = "uk";       //The extension of the calendar language file.
 $content_background_color = "#EEEEEE";   //Background color of the column
 $content_font_color       = "#000000";   //The font color
 $content_font_size        = 10;          //Font-size in pixels
 $content_font_style       = "normal";    //Set to italic or normal
 $content_font_weight      = "normal";    //Set to bold or normal
 $today_background_color   = "white";   //Background color of the column
 $today_font_color         = "green";   //The font color
 $today_font_size          = 10;          //Font-size in pixels
 $today_font_style         = "normal";    //Set to italic or normal
 $today_font_weight        = "bold";      //Set to bold or normal
 $event_background_color   = "#DDDDDD";   //Background color of the column
 $event_background_color2  = "#EEEEEE";   //Background color of the 2nd column (event popup)
 $event_font_color         = "#000000";   //The font color
 $event_font_size          = 10;          //Font-size in pixels
 $event_font_style         = "normal";    //Set to italic or normal
 $event_font_weight        = "bold";      //Set to bold or normal
  $event_popup_width        = "250";       //Width  of the popup for the events
  $event_popup_height       = "350";       //Height of the popup for the events
 
 $head_background_color    = "#DDDDDD";   //Background color of the column
 $head_font_color          = "green";   //The font color
 $head_font_size           = 11;          //Font-size in pixels
 $head_font_style          = "normal";    //Set to italic or normal
 $head_font_weight         = "bold";      //Set to bold or normal
 
 // CSS OPTIONS FOR WEEK DAYS
 $days_head_background_color = "#DDDDDD";   //Background color of the column
 $days_head_font_color       = "gray";   //The font color
 $days_head_font_size        = 11;          //Font-size in pixels
 $days_head_font_style       = "normal";    //Set to italic or normal
 $days_head_font_weight      = "bold";      //Set to bold or normal
 
 $table_border             = 0;           //The border of the table
 $table_cellspacing        = 1;           //Cellspacing of the table
 $table_cellpadding        = 2;           //Cellpadding of the table
 $table_width              = '';          //Table width in pixels or %'s
 $table_height             = '';          //Table height in pixels or %'s
 
 $head_link_color          = "green";    //The color of the link for previous/next month
 
 $font_family = "Verdana";
 
 /* 17 June 2004 : Check readme.txt for MySQL code for the database table */
 $events_from_database     = false;        //Set to true if you want to retrieve events
 $database                 = "calenbiagio";  //Name of the database within the event_table
  $server                   = "localhost"; //Name of the server
  $username                 = "root";  //MySQL username
  $password                 = "";  //MySQL password
  $event_table              = "calendar_events"; //Name of the calendar_events
 //
 /////////////////////////////////////////////
 
 /////////////////////////////////////////////
 //Load the language into usable variables
 //
 //TRANSLATION (18 May 2004)
 //        : Fill in the names of the days/months in variables
 //e-man   : LOAD TRANSLATION FILE INTO VARIABLES (from darussol)(19 May 2004)
 //        : Put the days/months names from language file into a array 
 $language_file  = "calendar." . $calendar_language;     //Language file into variable
 $fd             = fopen( $language_file, "r" );             //Open the language file
 $fd             = fread( $fd, filesize( $language_file ) ); //Read the opened file
 $language_array = explode( "\n" , $fd );                    //Put file info into array 
 $dayname   = array_slice($language_array,0,7); //The names of the days
 $monthname = array_slice($language_array,7);   //The rest of the language file are the monthnames
 //
 /////////////////////////////////////////////

 /////////////////////////////////////////////
 //Use the date to build up the calendar. From the Query_string or the current date
 // 
 if( isset( $_GET['date'] ) )
  list($month,$year) = explode("-",$_GET['date']);
 else
 {
  $month = date("m");
  $year  = date("Y");
 }
 //
 /////////////////////////////////////////////
 $date_string = mktime(0,0,0,$month,1,$year); //The date string we need for some info... saves space ^_^
 $day_start = date("w",$date_string);  //The number of the 1st day of the week
 /////////////////////////////////////////////
 //Filter the current $_GET['date'] from the QUERY_STRING
 //
 $QUERY_STRING = ereg_replace("&amp;date=".$month."-".$year,"",$_SERVER['QUERY_STRING']);
 //
 /////////////////////////////////////////////
 
 /////////////////////////////////////////////
 //Calculate the previous/next month/year
 //
 if( $month &lt; 12 )
 {
  $next_month = $month+1;
  $next_date = $next_month."-".$year;
 }
 else
 {
  $next_year = $year+1;
  $next_date = "1-".$next_year;
  $next_month = 1;
 }
 if( $month &gt; 1 )
 {
  $previous_month = $month-1;
  $next_month    = $month+1;
  $previous_date = $previous_month."-".$year;
 }
 else
 {
  $previous_year = $year-1;
  $previous_date = "12-".$previous_year;
  $previous_month = 12;
 }
 //
 /////////////////////////////////////////////
 //  DEFINITION OF THETRANSLATED MONTH+YEAR TO BE USED IN THE TABLE AND INFO-TITLES (18 May 2004)
 // e-man   : USING THE VALUES OF THE PREVIOUS AND NEXT MONTH FOR THE TITLE DAY (19 May 2004);
 $table_caption_prev = $monthname[$previous_month-1] . " " . $year; // previous
 $table_caption      = $monthname[date("n",$date_string)-1] . " " . $year; // current
  if ($next_month == 13){
    $next_month = 1;
    $year++;
  }
 $table_caption_foll = $monthname[$next_month-1] . " " . $year;   // following
 
 /////////////////////////////////////////////
 //Print the calendar css code
 //
  echo "
  &lt;style type=\"text/css\"&gt;
   a.cal_head
   {
    color: " . $head_link_color . ";
   }
   a.cal_head:hover
   {
    text-decoration: none;
   }
   .cal_head
   {
    background-color: " . $head_background_color . ";
    color:            " . $head_font_color . ";
    font-family:      " . $font_family . ";
    font-size:        " . $head_font_size . ";
    font-weight:      " . $head_font_weight . ";
    font-style:       " . $head_font_style . ";
   }
   .cal_days /*darussol*/
   {
    background-color: " . $days_head_background_color . ";
    color:            " . $days_head_font_color . ";
    font-family:      " . $font_family . ";
    font-size:        " . $days_head_font_size . ";
    font-weight:      " . $days_head_font_weight . ";
    font-style:       " . $days_head_font_style . ";
   }
   .cal_content
   {
    background-color: " . $content_background_color . ";
    color:            " . $content_font_color . ";
    font-family:      " . $font_family . ";
    font-size:        " . $content_font_size . ";
    font-weight:      " . $content_font_weight . ";
    font-style:       " . $content_font_style . ";
   }
   .cal_today
   {
    background-color: " . $today_background_color . ";
    color:            " . $today_font_color . ";
    font-family:      " . $font_family . ";
    font-size:        " . $today_font_size . ";
    font-weight:      " . $today_font_weight . ";
    font-style:       " . $today_font_style . ";
   }
    .cal_event, a.cal_event /* e-man 17-06-04 */
   {
    background-color: " . $event_background_color . ";
    color:            " . $event_font_color . ";
    font-family:      " . $font_family . ";
    font-size:        " . $event_font_size . ";
    font-weight:      " . $event_font_weight . ";
    font-style:       " . $event_font_style . ";
   }
  &lt;/style&gt;
  ";
 //
 /////////////////////////////////////////////
 
 /////////////////////////////////////////////
 //show events in popup?
 //
 if (isset ($_GET['show_event'])){
    list ($year, $month, $day) = explode ("-", $_GET['event_date']);
    $query = "
      SELECT *
      FROM " . $event_table . "
      WHERE EventYear  = '" . $year . "'
      AND   EventMonth = '" . $month . "'
      AND   EventDay   = '" . $day . "'
      ORDER BY EventTime ASC
    ";
    /* connect to the database */
    $database_connection = mysql_connect ($server, $username, $password);
    mysql_select_db ($database, $database_connection);
    $result = mysql_query ($query) or die(mysql_error());
    /* initize the variabele color_alternated (boolean) */
    $color_alternated = false;
    /* header of the table */
    echo "&lt;table width=\"100%\" border=\"" . $table_border . "\" cellpadding=\"" . $table_cellpadding . "\" cellspacing=\"" . $table_cellspacing . "\"&gt;";
    $date_string = mktime(0,0,0,$month,$day,$year);
    $month = sprintf("%01d",$month);
    echo "&lt;tr&gt;&lt;td align=\"center\" class=\"cal_head\" colspan=\"2\"&gt;".$day." " . $monthname[$month] . " ".$year."&lt;/td&gt;&lt;/tr&gt;";
    /* loop through the results via a mysql_fetch_assoc () */
    while ($record = mysql_fetch_assoc ($result)){
      if ($color_alternated){
        $color_alternated = false;
        $background_color_row = $event_background_color;
      }
      else{
        $color_alternated = true;
        $background_color_row = $event_background_color2;
      }
      echo "&lt;tr class=\"cal_event\"&gt;
              &lt;td style=\"background-color:".$background_color_row."\" width=\"1\"&gt;" . $record['EventTime'] . "&lt;/td&gt;
              &lt;td style=\"background-color:".$background_color_row."\"&gt;" . nl2br($record['Event']) . "&lt;/td&gt;
            &lt;/tr&gt;";
    }
    /* close the table */
    echo "&lt;/table&gt;";
    /* bring an exit so the script will terminate*/
    exit;
 }
 //
 /////////////////////////////////////////////
 
 /////////////////////////////////////////////
 //Print the calendar table header
 //
 echo "
  &lt;script language=\"javascript\"&gt;
      function open_event(date_stamp){
        window.open(\"" . $calendar_script . "?show_event=true&amp;event_date=\" + date_stamp, \"calendar_popup\",\"height=" . $event_popup_height . ",width=".$event_popup_width."\");
      }
  &lt;/script&gt;
  &lt;table border=\"" . $table_border . "\" cellpadding=\"" . $table_cellpadding . "\" cellspacing=\"" . $table_cellspacing . "\" style=\"height:" . $table_height . "\" width=\"" . $table_width . "\"&gt;
   &lt;tr&gt;
    &lt;td align=\"center\" class=\"cal_head\"&gt;&lt;a class=\"cal_head\" href=\"" . $_SERVER['PHP_SELF'] . "?" . $QUERY_STRING . "&amp;amp;date=" .
                $previous_date . "\" title=\"" . $table_caption_prev . "\"&gt;&amp;laquo;&lt;/a&gt;&lt;/td&gt;
    &lt;td align=\"center\" class=\"cal_head\" colspan=\"5\"&gt;" . $table_caption . "&lt;/td&gt;
    &lt;td align=\"center\" class=\"cal_head\"&gt;&lt;a class=\"cal_head\" href=\"" . $_SERVER['PHP_SELF'] . "?" . $QUERY_STRING . "&amp;amp;date=" .
                $next_date . "\" title=\"" . $table_caption_foll . "\"&gt;&amp;raquo;&lt;/a&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td class=\"cal_days\"&gt;".$dayname[0]."&lt;/td&gt;
    &lt;td class=\"cal_days\"&gt;".$dayname[1]."&lt;/td&gt;
    &lt;td class=\"cal_days\"&gt;".$dayname[2]."&lt;/td&gt;
    &lt;td class=\"cal_days\"&gt;".$dayname[3]."&lt;/td&gt;
    &lt;td class=\"cal_days\"&gt;".$dayname[4]."&lt;/td&gt;
    &lt;td class=\"cal_days\"&gt;".$dayname[5]."&lt;/td&gt;
    &lt;td class=\"cal_days\"&gt;".$dayname[6]."&lt;/td&gt;
   &lt;/tr&gt;&lt;tr&gt;
   ";
 //
 /////////////////////////////////////////////
 
 /////////////////////////////////////////////
 //The empty columns before the 1st day of the week
 //
 for( $i = 0 ; $i &lt; $day_start; $i++ )
 {
  echo "&lt;td class=\"cal_content\"&gt;&amp;nbsp;&lt;/td&gt;";
 }
 //
 /////////////////////////////////////////////
 
 $current_position = $day_start; //The current (column) position of the current day from the loop
 
 $total_days_in_month = date("t",$date_string); //The total days in the month for the end of the loop
 /////////////////////////////////////////////
 //Retrieve events for the current month + year
 //e-man : added 07 June 04
  if ($events_from_database)
  {
    $database_connection = mysql_connect ($server, $username, $password);
    mysql_select_db ($database, $database_connection);
    $result = mysql_query("
      SELECT *
      FROM " . $event_table . "
      WHERE
        EventYear = '" . $year . "'
      AND
        EventMonth = '" . $month . "'
    ");
    while ($record = mysql_fetch_assoc($result)){
      $event[$record['EventDay']] = $record;
    }
  }
 //
 /////////////////////////////////////////////
 /////////////////////////////////////////////
 //Loop all the days from the month
 //
 for( $i = 1; $i &lt;= $total_days_in_month ; $i++)
 {
  $class = "cal_content";
  
  if( $i == date("j") &amp;&amp; $month == date("n") &amp;&amp; $year == date("Y") )
   $class = "cal_today";
  
  $current_position++;
    /* is there any event on this day? Yes, create a link. No clear the (previous) string */
  $link_start = "";
  $link_end   = "";

    /* if there is an event do */
  if( isset($event[$i]) )
    {
      $link_start = "&lt;a href=\"javascript:;\" class=\"cal_event\" onclick=\"javascript: open_event('".$year."-".$month."-".$i."');\"&gt;";
      $link_end   = "&lt;/a&gt;";
      $class      = "cal_event";
    }
    /* for the event filter */
    /* e-man : added 07 June 04 */
    $date_stamp = $year."-".$month."-".sprintf( "%02d",$i);
    
  echo "&lt;td align=\"center\" class=\"" . $class . "\"&gt;" . $link_start . $i . $link_end . "&lt;/td&gt;";
  if( $current_position == 7 )
  {
   echo "&lt;/tr&gt;&lt;tr&gt;\n";
   $current_position = 0;
  }
 }
 //
 /////////////////////////////////////////////
 
 $end_day = 7-$current_position; //There are 
 
 /////////////////////////////////////////////
 //Fill the last columns
 // 
 for( $i = 0 ; $i &lt; $end_day ; $i++ )
  echo "&lt;td class=\"cal_content\"&gt;&lt;/td&gt;\n";
 //
 /////////////////////////////////////////////
 
 echo "&lt;/tr&gt;&lt;/table&gt;";  // Close the table
?&gt;
</code></pre>
<p dir="auto">Questo script si trova nel WEB, è collegato ad un db e il file uk rappresenta un calendario dove ci sono i giorni e i mesi della settimana.<br />
Ci sarà qualcuno che potrà aiutarmi.<br />
Biagio</p>
]]></description><link>https://dev.connect.gt/topic/89452/calendario-con-eventi</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 18:46:45 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/89452.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 05 Dec 2008 18:21:27 GMT</pubDate><ttl>60</ttl></channel></rss>