View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

and the code for it


<?PHP
header("Content-type: x-world/x-vrml");
echo "#VRML V2.0 utf8\n";

//'world'wide settings
echo "NavigationInfo {type \"EXAMINE\"}";
echo "Fog{color 1 1 1 visibilityRange 0}";

//define texture for boxnodes
echo "DEF tex ImageTexture{url \"\"}\n";

//transform for all
echo " Transform{children[";

//get date info
  $zeit = time(); // Aktuelle Zeit in Sekunden
  $datum = getdate($zeit);
  $mday = $datum[mday];
  $month = $datum[month];
  $dow = $datum[wday];
  $mon = $datum[mon];
  $year=$datum[year];


//calculate 30/31 days
$montmp =$mon;
if ($mon >7){$mon=$mon -7;}
if (bcmod($mon,2)==0){$maxday=30;} else {$maxday=31;}

//1. of month: day of week
//looks crazy but works, its like counting downwards on your seven fingers

$deb = bcmod($mday,7);   
$first=$dow;

for ($count=$deb;$count>1;$count--)
{
$first=$first-1;
if ($first==0) {$first=7;}
}   

//main loop   
for($x=0;$x<$maxday;$x++)
{

	//$xt-horizontal translation
	$xt=bcmod($x+$first-1,7);
	//$y-vertical translation
	$y=-1*bcdiv($x+$first-1,7,0);
	//counting $x from zero...
	$tag=$x+1;
	//make colors and size for today
	if ($tag==$mday)
		{ $color  = "1 0 0";
  		$rotation =" 0 0 0 0";
  		$scale=" 2 2 2";}  
 	else 
		{ $color = " 0.5 0.5 0.5 ";
  		$rotation=" 0 0 0 0";
  		$scale=" 1 1 1"; }

	//check if there is $tag.html, set color and url text
	if (file_exists($tag.".html"))
		{$numcolor=" 1 1 0";
		$linkurl="url ".$tag.".html";
		}
	else
		{$numcolor=" 0.9 0.9 0.9";
		$linkurl="url create.php?tag=".$tag;
		}

	//create the nodes
	$boxnode="Shape { appearance Appearance{texture USE tex material Material 	{transparency 0.5 diffuseColor ".$color." emissiveColor ".$color."} } geometry Box{size 0.5 0.5 0.5}}";

	$textnode="Billboard{children[Shape { appearance Appearance{material Material {diffuseColor ".$numcolor." emissiveColor ".$numcolor."} }geometry Text{fontStyle FontStyle{justify \"MIDDLE\" family \"SANS\" size 0.3} string \"".$tag."\"}}]}";
	
	//write 'em
	echo " Anchor{children[Transform {children[".$textnode.$boxnode."] translation ".$xt." ".$y."  0  rotation ".$rotation." scale ".$scale."}] ".$linkurl."}\n ";
}
//end of main loop

//make day/month/year textnode
echo " Transform {children Shape { appearance Appearance{material Material {transparency 0.2 diffuseColor 1 1 0 emissiveColor 1 1 0}} geometry Text{fontStyle FontStyle{ family \"SANS\" style \"BOLD\"} string \"".$mday."/".$montmp."/".$year."\"}} translation -1.5 0 1.5}";

//end global transform
echo "]translation 0 250 0}";

 ?>



Link to this Page