Thread: Notepad Baby!
View Single Post
  #7   Spotlight this post!  
Unread 04-01-2004, 13:34
iamnafets iamnafets is offline
Meh?
AKA: Stefan Mai
None #0624 (CRyptonite Robotics)
 
Join Date: Dec 2003
Rookie Year: 2004
Location: Katy, Texas
Posts: 81
iamnafets is on a distinguished road
Re: Notepad Baby!

Thanks, I'll try out both of those editors. As for my code, I wrote 2 scripts, filewriter and filereader so all I have to do is say explode(";:;",Filreader(day)) and I've got the array with all the data. But that is quite small code for a calendar. Very nice. Mine looks like this:
Code:
<?php
if(###############)){
	$userteam=UserTeam($robotuser);
	$now=getdate();
	if(!$curmon){
		$curmon=$now["mon"];
	}
	if($curmon>7){
		$year=2003;
	}else{
		$year=2004;
	}
	$months=array("January","February","March","April","May","June","July","August","September","October","November","December");
	$weekdays=array("Monday"=>1,"Tuesday"=>2,"Wednesday"=>3,"Thursday"=>4,"Friday"=>5,"Saturday"=>6,"Sunday"=>7);
	$content.="<h1><center>Calendar</center></h1>";
	$teams=UserTeam($robotuser);
	$content.="<table width=600 border=0 frame=box rules=none cellpadding=0 cellspacing=0><tr><td valign=bottom><h2>";
	if($curmon==1){
		$content.="<a href=index.php?page=calendar&curmon=12><< </a>";
	}else{
		$content.="<a href=index.php?page=calendar&curmon=";
		$content.= $curmon-1;
		$content.= "><< </a>";
	}
	$content.=$months[$curmon-1]." $year";
	if($curmon==12){
		$content.="<a href=index.php?page=calendar&curmon=1> >></a>";
	}else{
		$content.="<a href=index.php?page=calendar&curmon=";
		$content.= $curmon+1;
		$content.= "> >></a>";
	}
	$content.="</h2></td><td nowrap valign=bottom align=right><table border=0 cellpadding=1 cellspacing=1><tr><td nowrap bgcolor=660000 width=50 align=center><font size=-5>Not Pertianing to You</td><td bgcolor=000066 width=50 nowrap align=center><font size=-4>Pertaining to You</td></tr></table></td></tr></table>";
	$contents=ReadDirectory("Data/Calendar/".$months[$curmon-1]."/");
	if($contents){
		foreach($contents as $key=>$file){
			$theday=explode(";:;",FileReader("Data/Calendar/".$months[$curmon-1]."/".$file));
			foreach($theday as $key=>$value){
				if($value)$calendar[$file][]=explode("+=-",$value);
			}
		}
	}
	//Get day of week for first day
	$then=getdate(mktime(0,0,0,$curmon,1,$year));
	$dowfirst=$weekdays[$then["weekday"]];
	$content.="<table width=600 border=0 cellpadding=1 cellspacing=1><tr>";
	foreach($weekdays as $key=>$value){
		$content.="<td width=85 bgcolor=006600><center>$key</center></td>";
	}
	$content.="</tr>";
	if($curmon==4 or $curmon==6 or $curmon==11){
		$maxdays=30;
	}else if($curmon==2){
		if($now["year"]%4==0){
			$maxdays=29;
		}else{
			$maxdays=28;
		}
	}else{
		$maxdays=31;
	}
	$currentwday=1;
	while($currentwday<$dowfirst){
		$content.="<td></td>";
		$currentwday++;
	}
	for($x=1;$x<=$maxdays;$x++){
		$content.="<td height=50 align=center valign=center bgcolor=";
		$escierto=false;
		if($calendar[$x]){
			foreach($calendar[$x] as $key=>$value){
				$hello=ParseTeam($calendar[$x][$key][4]);
				for($y=1;$y<=15;$y++){
					if($hello[$y]==1 && $userteam[$y]==1){
						$escierto=true;
					}
				}
			}
			if($escierto){
				$content.="000066";
			}else{
				$content.="660000";
			}
		}else{
			$content.="white";
		}
		//END COLOR CODING STUFF
		$content.="><font color=";
		if(!$calendar[$x]){
			$content.="black";
		}else{
			$content.="white";
		}
		$content.=">";
		if($calendar[$x]){
			$content.="<a href=\"index.php?page=calendar&curmon=$curmon&view=$x\">$x</a>";
		}else{
			$content.="$x";
		}
		$content.="</font></td>";
		if($currentwday>=7){
			$content.="</tr><tr>";
			$currentwday=0;
		}
		$currentwday++;
	}
	$content.="</tr></table><center>- <a href=index.php?page=addevent>Add an Event</a> - <br>";
	if($view){
		$allday=explode(";:;",FileReader("Data/Calendar/".$months[$curmon-1]."/$view"));
		foreach($allday as $key=>$value){
			$event=explode("+=-",$value);
			$content.="<table border=1 frame=box rules=none cellpadding=1 cellspacing=1><tr><td bgcolor=006600 width=150><font color=white>Subject:</td><td>$event[0]</td></tr><tr><td bgcolor=006600 width=150><font color=white>Time:</td><td width=150>$event[1]</td></tr><tr><td bgcolor=006600 width=150><font color=white>Location:</td><td width=450>$event[2]</td></tr><tr><td colspan=2>$event[3]</td></tr><tr><td colspan=2 align=center> - <a href=index.php?page=reschedule&day=$view&id=$key&month=";
$content.=$months[$curmon-1];
$content.=">Reschedule</a> -</td></tr></table>";
		}
	}
}else{
$content.="<h1><center>Restricted</center></h1>You are denied access to this page until you login.  Please use the navigation on the left to login.";
}
	
?>
And I've got 2 other files to manage reschedules and adding events . Man I've got no life.

EDIT: I checked out the Dev-PHP IDE, very nice I like it. All the standard functions, line numbers, and the right TABBING! I may be converted.

Last edited by iamnafets : 04-01-2004 at 13:39.