aboutsummaryrefslogtreecommitdiff
path: root/admin/calendar/functions.php
diff options
context:
space:
mode:
authorjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2009-12-29 15:46:26 -0500
committerjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2009-12-29 15:46:26 -0500
commit4bc1e32a79c0928a079113c51f9cf9fcaf525a63 (patch)
tree00312c30100c6947859324c39d80b7fcafaf92f1 /admin/calendar/functions.php
parentad6ba256efd1a65fb1bb3951ae6b17b1593205b7 (diff)
downloadbayonetcms-4bc1e32a79c0928a079113c51f9cf9fcaf525a63.tar.gz
(OC) I cut down the calendar queries to just one which seems to work out a lot better.
git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@409 c5b2fb0a-d05d-0410-98c8-828840a80ff6
Diffstat (limited to 'admin/calendar/functions.php')
-rw-r--r--admin/calendar/functions.php26
1 files changed, 16 insertions, 10 deletions
diff --git a/admin/calendar/functions.php b/admin/calendar/functions.php
index 351e5d7..cffaab1 100644
--- a/admin/calendar/functions.php
+++ b/admin/calendar/functions.php
@@ -109,7 +109,7 @@
</td>
</tr>
<tr>
- <td><?php echo BBCode($event['text']); ?><br /><br /></td>
+ <td><?php echo bbcode_format($event['text']); ?><br /><br /></td>
</tr>
<tr>
@@ -368,6 +368,8 @@ $db->Query("UPDATE `bayonet_events` SET `title` = '$title', `text` = '$text', `c
echo '<td class="cal_notmonth">'.$days_before.'</td>'; //'.$days_before.'</td>';
$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){
@@ -382,14 +384,12 @@ $db->Query("UPDATE `bayonet_events` SET `title` = '$title', `text` = '$text', `c
//checks to see if the current day has events
$isEvent=false;
- /* $get_events = mysql_query("SELECT * FROM `mybb_events` WHERE `starttime` = $checkUnixTime ");
- while($echo_events = mysql_fetch_array($get_events)){
- $isEvent=true;
- } */
- global $db;
- $result = $db->Query("SELECT title,color FROM bayonet_events WHERE `date` = '$sqlDate' LIMIT 1");
- $events = $db->Fetch($result);
- $isEvent = empty($events) ? false : true;
+ foreach($events as $event){
+ if($event['date'] == $sqlDate){
+ $isEvent = true;
+ }
+
+ }
if($useCurDate)
echo "<a href=\"?op=calendar&list={$year}-{$monthNum}-{$day_num}\">";
@@ -436,5 +436,11 @@ $db->Query("UPDATE `bayonet_events` SET `title` = '$title', `text` = '$text', `c
<?php
}
-
+
+function GetEventsOnInterval($start,$end){
+ global $db;
+ $result = $db->Query("SELECT `event_id`, `title`, `color`, `date`, `time` FROM `bayonet_events` WHERE `date` BETWEEN '$start' AND '$end' ORDER BY `time` ASC");
+ $events = $db->Fetch($result);
+ return $events;
+}
?> \ No newline at end of file