.
*/
/**
* Note to anyone feeling the need to edit this file...
* You MUST declare $db as global inside your functions in order access MySQL from here.
*/
/**
* SelectDate($date)
* Function for outputing an html form for selecting a month day and year
* @param date - formatted date string yyyy-mm-dd (optional)
*/
function SelectDate($date = NULL){
//function for adding to the db in sql 'datetime' format
//$date = date("Y-m-d h:i:s", mktime(8, 30, 0, 10, 26, 2009));
//$date = "2009-11-2";
//echo $date."
";
//function for parsing our date format into an array
//echo "
"; $date_arr = date_parse($date); //returns an associative array $array['year'] //print_r($date_arr); //echo ""; //echo $date_arr['year']." ".$date_arr['month']." ".$date_arr['day']."
Events for: |
![]() |
"; $date_arr = date_parse($date); //returns an associative array $array['year'] print_r($date_arr); echo ""; echo $date_arr['year']; */ global $db; if(isset($_POST['processed'])){ $title = addslashes($_POST['title']); $text = addslashes($_POST['text']); $year = addslashes($_POST['year']); $month = addslashes($_POST['month']); $day = addslashes($_POST['day']); $time = addslashes($_POST['time']); $color = addslashes($_POST['color']); $date = date("Y-m-d", mktime(0, 0, 0, $month, $day, $year)); $db->Query("UPDATE `bayonet_events` SET `title` = '$title', `text` = '$text', `color` = '$color', `date` = '$date', `time` = '$time' WHERE `event_id` ='$event_id' LIMIT 1"); } $result = $db->Query("SELECT * FROM `bayonet_events` WHERE `event_id` = $event_id LIMIT 1"); $event = $db->FetchRow($result); ?>
<< >> | |||||||||||||||||||||||||||||||||||||||||||||||||
Sun | Mon | Tue | Wed | Thu | Fri | Sat | |||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
'.$days_before.' | '; //'.$days_before.''; $day_count++; } $events = GetEventsOnInterval("{$year}-{$monthNum}-01","{$year}-{$monthNum}-{$days_in_month}"); //loop printing each day of the CURRENT month ONLY while($day_num <= $days_in_month){ if($day_count==1 || $day_count==7){ echo ''; //weekends }else{ echo ' | '; //weekdays
}
$sqlDate = date("Y-m-d", mktime(0, 0, 0, $monthNum, $day_num, $year));
//checks to see if the current day has events
$isEvent=false;
foreach($events as $event){
if($event['date'] == $sqlDate){
$isEvent = true;
}
}
if($useCurDate)
echo "";
else
echo "";
if($day_num == $today && $isEvent==true){
echo ' '.$day_num.' ';
}else if($day_num == $today && $isEvent==false){
echo ''.$day_num.' ';
}else if($day_num != $today && $isEvent==true){
echo '';
echo $day_num;
echo ' ';
}else{
echo $day_num;
}
echo "";
echo ' | ';
$day_num++;
$day_count++;
if($day_count > 7){
echo '|||||||||||||||||||||||||||||||||||||||||||||||
'.$days_after.' | '; //'.$days_after.''; $days_after++; $day_count++; } ?>