Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

jean_br

calendário - iniciar em domingo

Recommended Posts

olá pessoal

 

 

peguei esse calendário aqui mesmo no fórum, porém gostaria que o calendário iniciasse no domigno e não na segunda.

 

detalhe: em determinada linha do código existe a possibildiade de você trocar os noems dos dias (SEG-TER, etc), porém os dias continuam a aparecer como anteriormente. ou seja, altera-se o "nome" dos dias porém o dia não

 

<html><head><title>WF-calendario</title><style type="text/css">td {font-size:11px;font-family:verdana}a {	font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 9px;	color: #666666;}a:link {	text-decoration: none;}a:visited {	text-decoration: none;	color: #666666;}a:hover {	text-decoration: none;	color: #666666;}a:active {	text-decoration: none;	color: #666666;}</style>		<script>			function compromisso()			{				window.open('cadastra_evento.php','janela01','status=no,scrollbars=yes,menubar=no,resizable=no,width=778,height=200left=0,top=0');			}		</script>	</head>	<body onSelectStart="return false"><?$show_month = 1;if (isset($show_month)) {  if ($show_month==">") {	if($month==12) {	  $month=1;	  $year++;	} else {	  $month++;	}  }  if ($show_month=="<") {	if($month==1) {	  $month=12;	  $year--;	} else {	  $month--;	}  }}if (isset($day)) {  if ($day<="9"&ereg("(^[1-9]{1})",$day)) {	$day="0".$day;  }}if (isset($month)) {  if ($month<="9"&ereg("(^[1-9]{1})",$month)) {	$month="0".$month;  }}if (!isset($year)) {  $year=date("Y",mktime());  $year = isset($_GET["ano"]) ? $_GET['ano'] : $year;}if (!isset($month)) {  $month=date("m",mktime());  $month = isset($_GET["mes"]) ? $_GET['mes'] : $month;  if ($month == 0){	 $month = 12;	 $year--;  }  if ($month == 13){	  $month = 1;	  $year++;  }}if (!isset($day)) {  $day=date("d",mktime());}$thisday="$year-$month-$day";$day_name=array("Seg,Ter,Qua,Qui,---,Sab,<font color=\"#FF0000\">Dom</font>");$cp = "By";$month_abbr=array("& amp;quot;,Janeiro,Fevereiro,Março,Abril,Maio,Junho,Julio,Agosto,Setembro,Outubro,Novembro,Dezembro");$y=date("Y");switch ($month) {  case 1: $month_name = Janeiro; break;  case 2: $month_name = Fevereiro; break;  case 3: $month_name = Março; break;  case 4: $month_name = Abril; break;  case 5: $month_name = Maio; break;  case 6: $month_name = Junho; break;  case 7: $month_name = Julho; break;  case 8: $month_name = Agosto; break;  case 9: $month_name = Setembro;break;  case 10: $month_name = Outubro; break;  case 11: $month_name = Novembro;break;  case 12: $month_name = Dezembro;break;}$cp .= " W";?><table border="0" width="176" align="center" style="border-width:1px"><tr><td style="border-width:1px"><table width="175" border="0" cellspacing="1" cellpadding="0" align="center" ><tr bgcolor="#f5f5f5"><td colspan="7" align="center"><font size="2" face="verdana"><a href="<? echo$_SERVER["PHP_SELF"]."?mes=".($month-1)."&ano=".($year); ?>"> << </a><b><? echo"$month_name $year"; ?></b> <a href="<? echo	  $_SERVER["PHP_SELF"]."?mes=".($month+1)."&ano=".($year); ?>"> >> </a><br><br></font></td></tr><tr align="center"><?$cp .= "ender";for ($i=0;$i<7;$i++) { ?>  <td width="25" align="center" bgColor="ffffff"><? echo "$day_name[$i]";  ?></td>  <? } ?>  </tr>  <tr align="center">  <?  $cp .= " F";  if (date("w",mktime(0,0,0,$month,1,$year))==0) {	$start=7;  } else {	$start=date ("w",mktime(0,0,0,$month,1,$year));  }  for($a=($start-2);$a>=0;$a--)  {	$d=date("t",mktime(0,0,0,$month,0,$year))-$a;	?>	<td bgcolor="#ffffff" align="center"><font	color="#ffffff"><?=$d?></font></td>	<? }	for($d=1;$d<=date("t",mktime(0,0,0,($month+1),0,$year));$d++)	{	  if($month==date("m")&$year==date("Y")&$d==date("d")) {		$bg="bgcolor=\"#C7BE8B\"";//dia atual	  } else {		$bg="bgcolor=\"#ECE9D8\"";//outros dias	  }	  ?>	  <?	  $evento = "$d";	  $month_name = str_replace('ç','c',$month_name);	  $evento.= "$month_name$year.php";	  ?>	  <?	  if (file_exists("eventos/$evento"))	  {		?>		<td bgcolor="#999999" align="center" onClick= java script:window.open('<? echo "eventos/$evento" ?>','','scrollbars=yes,width=800,height=350,top=0,left=0');history.go(9) style="cursor:hand"><?=$d?></a></td>		<?	  }	  else	  {		?>		<td <?=$bg?> align="center"><font color=#333333><a href="teste.php?dta=<?=$d?>/<?=$month?>/<?=$year?>"><?=$d //cor dos dias		?></a></td>		<?	  } ?>	  <?	  if(date("w",mktime(0,0,0,$month,$d,$year))==0&date("t",mktime(0,0,0,($month+1),0,$year))>$d)	  {		?>		</tr>		<tr align="center">		<? }}		$cp .= "ernandes";		$da=$d+1;		if(date("w",mktime(0,0,0,$month+1,1,$year))<>1)		{		  $d=1;		  while(date("w",mktime(0,0,0,($month+1),$d,$year))<>1)		  {			?>			<td bgcolor="#ffffff" align="center" title="<? echo $cp; ?>" ><font			color="#ffffff"><?=$d?></font></td>			<?			$d++;		  }		}		?>		</tr>		</table>		</table>		</body>		</html>

desde já agradeço pela ajuda http://forum.imasters.com.br/public/style_emoticons/default/thumbsup.gif

Compartilhar este post


Link para o post
Compartilhar em outros sites

Basta colocar Domingo no início deste array:

 

$day_name=array("Seg,Ter,Qua,Qui,---,Sab,<font color=\"#FF0000\">Dom</font>");

Se você usar setlocale(), não precisará ficar escrevendo os nomes dos dias e meses.

Veja:

http://forum.imasters.com.br/index.php?sho...p;hl=calendario

 

Abraços,

Beraldo

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.