| [ PHPXref.com ] | [ Generated: Sun Jul 20 20:44:35 2008 ] | [ Time Management 1.06 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 include ("connect.php"); 3 include ("functions.php"); 4 echo '<html><head><title>Calendar</title></head>'; 5 6 echo '<script type="text/javascript"> 7 var des; 8 function open_win(des) 9 { 10 window.open(des,"Event Description","toolbar=yes, location=yes, directories=no, status=no , menubar=yes , scrollbars=yes, resizable=no, copyhistory=yes, width=400 ,height=400") 11 } 12 </script> '; 13 14 $month = date("n/Y"); 15 16 if (isset($_GET['month'])) 17 { 18 @$month = clean($_GET['month']); 19 $month = preg_replace("#[^0-9/]#", "", $month); 20 } 21 //echo "month is $month<br>"; 22 23 if (empty($month)) 24 die("Please enter a month."); 25 26 $k = explode("/",$month); 27 28 $link = "SELECT * FROM calendar WHERE month='$month'"; 29 $res = mysql_query($link) or die(mysql_error()); 30 $info = mysql_fetch_assoc($res); 31 if (!mysql_num_rows($res)) die("There is no records for this month."); 32 33 $startday = $info['start_day']; 34 $days = $info['total_days'] + $startday; 35 36 $stuff = "SELECT * FROM events WHERE date LIKE '$k[0]%$k[1]'"; 37 $show = mysql_query($stuff) or die(mysql_error()); 38 $total = mysql_num_rows($show); 39 40 $x = $startday; 41 42 $spot = $startday; 43 44 while ($r = mysql_fetch_assoc($show)) 45 { 46 $date = $r['date']; 47 $time = $r['time']; 48 $name = $r['name']; 49 $des = $r['des']; 50 51 $date = explode("/",$date); 52 $date = $date[1]; 53 54 $all[$date] = $date . "-" . $time . "-" . $name . "-" . $des; 55 } 56 57 //print_r(array_values($all)); 58 //echo '<br><br><br>'; 59 //print_r(array_keys($all)); 60 //echo '<br><br><br>'; 61 //echo $all[1] . " " . $all[17]; 62 //die; 63 64 $prev = $k[0]; 65 $prev--; 66 $next = $k[0]; 67 $next++; 68 $l = $k[1]; 69 if ($prev == 0) 70 { 71 $prev = 12; 72 $l = $k[1] - 1; 73 } 74 $j = $k[1]; 75 if ($next == 13) 76 { 77 $next = 1; 78 $j = $k[1] + 1; 79 } 80 81 $h = $prev; 82 switch($h) 83 { 84 case '1': $now = 'February'; break; 85 case '2': $now = 'March'; break; 86 case '3': $now = 'April'; break; 87 case '4': $now = 'May'; break; 88 case '5': $now = 'June'; break; 89 case '6': $now = 'July'; break; 90 case '7': $now = 'August'; break; 91 case '8': $now = 'September'; break; 92 case '9': $now = 'October'; break; 93 case '10': $now = 'November'; break; 94 case '11': $now = 'December'; break; 95 case '12': $now = 'January'; break; 96 } 97 //echo "startday is $startday<br>"; 98 echo '<table width="100%"><tr><td colspan="6"><a href="addevent.php">Calendar Admin</a></td></tr><tr><td><center><a href="calendar.php?month=' . $prev . '/' . $l . '"><<</a> ' . $now . ' - ' . $k[1] . ' <a href="calendar.php?month=' . $next . '/' . $j . '">>></a></center></td></tr><tr><td><center>Total: ' . $total . '</td></tr></table>'; 99 echo '<table width="100%" border="0" bgcolor="DarkGray" border="1"> 100 <tr><td width="14%"><font color="blue">S</font></td><td width="14%"><font color="blue">M</font></td><td width="14%"><font color="blue">T</font></td><td width="14%"><font color="blue">W</font></td><td width="14%"><font color="blue">T</font></td><td width="14%"><font color="blue">F</font></td><td width="14%"><font color="blue">S</font></td></tr>'; 101 102 for ($x=1;$x<=$days;$x++) 103 { 104 echo '<tr>'; 105 $x--; 106 for ($y=1;$y<=7;$y++) 107 { 108 if ($x == 0) 109 $x = 1; 110 $x = $x - $startday+1; 111 112 if ($x<$startday-$startday+1 || $x >= $days-$startday+1) 113 echo '<td width="14%" bgcolor="WhiteSmoke"> <br /> <br /> </td>'; 114 115 elseif (empty($all[$x])) 116 echo '<td width="14%" bgcolor="WhiteSmoke"><font color="blue">' . ($x) . '<br /> <br /> </font></td>'; 117 118 else 119 { 120 $cur = explode("-",$all[$x]); 121 //echo '<td valign="top" width="14%" bgcolor="WhiteSmoke"><b><a href="javascript:void(open_win(' . "'date.php?date=$k[0]/$cur[0]/$k[1]'" . '))"><font color="blue">' . $cur[0] . '</font></a></b>' . "<font size='2'> $cur[1]<br />$cur[2]" . '<br /> </font></td>'; 122 echo '<td valign="top" width="14%" bgcolor="WhiteSmoke"><b><a href="date.php?date=' . $k[0] . '/' . $cur[0] . '/' . $k[1] . '" target=_blank><font color="blue">' . $cur[0] . '</font></a></b>' . "<font size='2'> $cur[1]<br />$cur[2]" . '<br /> </font></td>'; 123 } 124 $x = $x + $startday -1; 125 $x++; 126 } 127 echo '</tr>'; 128 } 129 echo '</table>'; 130 131 ?> 132
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |