<?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[problemi con calendario php]]></title><description><![CDATA[<p dir="auto">ho trovato uno script calendario in php con la possibilità anche di inserire eventi. ho un problema: il calendario presenta la domenica come primo giorno della settimana e il sabato l'ultimo. come bisogna modificare questo script per fare in modo che il primo giorno della settimana sia il lunedi e l'ultimo la domenica?</p>
<p dir="auto">script:</p>
<pre><code class="language-html">&lt;? 
require_once("includes/config.php");

if(!isset($installed))
{
	header("Location: install.php");
	exit;
}
else
{
	if(file_exists('install.php'))
	{
		header("Location: install.php");
		exit;
	}
}

$db_connection = mysql_connect ($DBHost, $DBUser, $DBPass) OR die (mysql_error());  
$db_select = mysql_select_db ($DBName) or die (mysql_error());
$db_table = $TBL_PR . "events";

function getmicrotime(){ 
    list($usec, $sec) = explode(" ",microtime()); 
    return ((float)$usec + (float)$sec); 
} 

$time_start = getmicrotime();

IF(!isset($_GET['year'])){
    $_GET['year'] = date("Y");
}
IF(!isset($_GET['month'])){
    $_GET['month'] = date("n")+1;
}

$month = addslashes($_GET['month'] - 1);
$year = addslashes($_GET['year']);

$query = "SELECT event_id,event_title,event_day,event_time FROM $db_table WHERE event_month='$month' AND event_year='$year' ORDER BY event_time";
$query_result = mysql_query ($query);
while ($info = mysql_fetch_array($query_result))
{
    $day = $info['event_day'];
    $event_id = $info['event_id'];
    $events[$day][] = $info['event_id'];
    $event_info[$event_id]['0'] = substr($info['event_title'], 0, 12);;
    $event_info[$event_id]['1'] = $info['event_time'];
}

$todays_date = date("j");
$todays_month = date("n");

$days_in_month = date ("t", mktime(0,0,0,$_GET['month'],0,$_GET['year']));
$first_day_of_month = date ("w", mktime(0,0,0,$_GET['month']-1,1,$_GET['year']));
$first_day_of_month = $first_day_of_month + 1;
$count_boxes = 0;
$days_so_far = 0;

IF($_GET['month'] == 13){
    $next_month = 2;
    $next_year = $_GET['year'] + 1;
} ELSE {
    $next_month = $_GET['month'] + 1;
    $next_year = $_GET['year'];
}

IF($_GET['month'] == 2){
    $prev_month = 13;
    $prev_year = $_GET['year'] - 1;
} ELSE {
    $prev_month = $_GET['month'] - 1;
    $prev_year = $_GET['year'];
}


?&gt;
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;PHPCalendar&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;link href="images/cal.css" rel="stylesheet" type="text/css"&gt;
&lt;script language="JavaScript" type="text/JavaScript"&gt;
&lt;!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//--&gt;
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div align="center"&gt;&lt;span class="currentdate"&gt;&lt;? echo date ("F Y", mktime(0,0,0,$_GET['month']-1,1,$_GET['year'])); ?&gt;&lt;/span&gt;&lt;br&gt;
&lt;/div&gt;
&lt;div align="center"&gt;&lt;br&gt;
  &lt;table width="700" border="0" cellspacing="0" cellpadding="0"&gt;
    &lt;tr&gt; 
      &lt;td&gt;&lt;div align="right"&gt;&lt;a href="&lt;? echo "index.php?month=$prev_month&amp;amp;year=$prev_year"; ?&gt;"&gt;&lt;img src="images-1.findicons.com/files/icons/1688/web_blog/48/arrow_left.png"&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;
      &lt;td width="200" style="border: 1px solid #F2F2F2"&gt;&lt;div align="center"&gt;
            
          &lt;select name="month" id="month" onChange="MM_jumpMenu('parent',this,0)"&gt;
            &lt;?
			for ($i = 1; $i &lt;= 12; $i++) {
				$link = $i+1;
				IF($_GET['month'] == $link){
					$selected = "selected";
				} ELSE {
					$selected = "";
				}
				echo "&lt;option value=\"index.php?month=$link&amp;amp;year=$_GET[year]\" $selected&gt;" . date ("F", mktime(0,0,0,$i,1,$_GET['year'])) . "&lt;/option&gt;\n";
			}
			?&gt;
          &lt;/select&gt;
          &lt;select name="year" id="year" onChange="MM_jumpMenu('parent',this,0)"&gt;
		  &lt;?
		  for ($i = 2009; $i &lt;= 2015; $i++) {
		  	IF($i == $_GET['year']){
				$selected = "selected";
			} ELSE {
				$selected = "";
			}
		  	echo "&lt;option value=\"index.php?month=$_GET[month]&amp;amp;year=$i\" $selected&gt;$i&lt;/option&gt;\n";
		  }
		  ?&gt;
          &lt;/select&gt;
        &lt;/div&gt;&lt;/td&gt;
      &lt;td&gt;&lt;div align="left"&gt;&lt;a href="&lt;? echo "index.php?month=$next_month&amp;amp;year=$next_year"; ?&gt;"&gt;&lt;img src="images-2.findicons.com/files/icons/1688/web_blog/48/arrow_right.png"&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;br&gt;
&lt;/div&gt;
&lt;table width="1050" border="0" align="center" cellpadding="0" cellspacing="0"&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;table border="0" width="100%" cellpadding="0" cellspacing="1" bgcolor="#DDDDDD"&gt;
        &lt;tr class="topdays"&gt; 
          &lt;td&gt;&lt;div align="center"&gt;Domenica&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;
          &lt;td&gt;&lt;div align="center"&gt;Lunedì&lt;/div&gt;&lt;/td&gt;
          &lt;td&gt;&lt;div align="center"&gt;Martedì&lt;/div&gt;&lt;/td&gt;
          &lt;td&gt;&lt;div align="center"&gt;Mercoledì&lt;/div&gt;&lt;/td&gt;
          &lt;td&gt;&lt;div align="center"&gt;Giovedì&lt;/div&gt;&lt;/td&gt;
          &lt;td&gt;&lt;div align="center"&gt;Venerdì&lt;/div&gt;&lt;/td&gt;
          &lt;td&gt;&lt;div align="center"&gt;Sabato&lt;/div&gt;&lt;/td&gt;
        &lt;/tr&gt;
		&lt;tr valign="top" bgcolor="#FFFFFF"&gt; 
		&lt;?
		for ($i = 1; $i &lt;= $first_day_of_month-1; $i++) {
			$days_so_far = $days_so_far + 1;
			$count_boxes = $count_boxes + 1;
			echo "&lt;td width=\"100\" height=\"100\" class=\"beforedayboxes\"&gt;&lt;/td&gt;\n";
		}
		for ($i = 1; $i &lt;= $days_in_month; $i++) {
   			$days_so_far = $days_so_far + 1;
    			$count_boxes = $count_boxes + 1;
			IF($_GET['month'] == $todays_month+1){
				IF($i == $todays_date){
					$class = "highlighteddayboxes";
				} ELSE {
					$class = "dayboxes";
				}
			} ELSE {
				IF($i == 1){
					$class = "highlighteddayboxes";
				} ELSE {
					$class = "dayboxes";
				}
			}
			echo "&lt;td width=\"100\" height=\"100\" class=\"$class\"&gt;\n";
			$link_month = $_GET['month'] - 1;
			echo "&lt;div align=\"right\"&gt;&lt;span class=\"toprightnumber\"&gt;\n&lt;a style=\"color: #222222\"  href=\"javascript:MM_openBrWindow('event_add.php?day=$i&amp;amp;month=$link_month&amp;amp;year=$_GET[year]','','width=500,height=300');\"&gt;$i&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;\n";
			IF(isset($events[$i])){
				echo "&lt;div align=\"center\"&gt;&lt;span class=\"eventinbox\"&gt;\n";
				while (list($key, $value) = each ($events[$i])) {
					echo "&lt;br&gt;&lt;table class=\"corner\"&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=\"javascript:MM_openBrWindow('event.php?id=$value','','width=500,height=200');\" style=\"color: #3D3D3D; font-size: 13px; text-decoration: none; text-shadow: 0px 1px 1px #FFF;\"&gt;" . $event_info[$value]['1'] . " - " . $event_info[$value]['0']  . "&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;\n&lt;br&gt;\n";
				}
				echo "&lt;/span&gt;&lt;/div&gt;\n";
			}
			echo "&lt;/td&gt;\n";
			IF(($count_boxes == 7) AND ($days_so_far != (($first_day_of_month-1) + $days_in_month))){
				$count_boxes = 0;
				echo "&lt;/TR&gt;&lt;TR valign=\"top\"&gt;\n";
			}
		}
		$extra_boxes = 7 - $count_boxes;
		for ($i = 1; $i &lt;= $extra_boxes; $i++) {
			echo "&lt;td width=\"100\" height=\"100\" class=\"afterdayboxes\"&gt;&lt;/td&gt;\n";
		}
		$time_end = getmicrotime();
		$time = round($time_end - $time_start, 3);
		?&gt;
        &lt;/tr&gt;
      &lt;/table&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
]]></description><link>https://dev.connect.gt/topic/163001/problemi-con-calendario-php</link><generator>RSS for Node</generator><lastBuildDate>Sat, 28 Nov 2026 22:09:44 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/163001.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 16 Dec 2011 16:58:38 GMT</pubDate><ttl>60</ttl></channel></rss>