Location: PHPKode > projects > SiteX > calendar_day.php
<?PHP
ob_start();
session_start();

include("includes/globals.php.inc");
include("includes/functions.php");
include("lang/English.php");
if(strtolower($sxSetup['Language']) != 'english') include("lang/".$sxSetup['Language'].".php");
include("themes/$THEME_FOLDER/config.php.inc");

protectComponentPage(8);

$sxTitleAddendum = getComponentName("8");

include("themes/$THEME_FOLDER/header.php");
?>
  <div class="bodyWrapper">
	<h1><?PHP echo getComponentName("8"); ?></h1>
	<?PHP echoMessage($message); ?>
	<?PHP if((userAdmin()) OR ((userEditor()) AND ($sxSetup['EditorRightsEventsAdd'])))
	echo '<div class="journalAdd"><a href="admin/event_add.php">' .$sxLang['EventButtonAddEventNew'] . '</a></div>'; 
	?>
	<table border="0" cellpadding="5" cellspacing="2" width="<?PHP echo $sxThemeConfig['ContentWidth']-20; ?>" align="center">
	  <tr>
		<td align="left" width="<?PHP echo $sxThemeConfig['ContentWidth']/4; ?>"><a href="<?PHP echo $PHP_SELF."?sxTimestamp=".($sxTimestamp-(60*60*24)); ?>">< <?PHP echo $sxLang['Prev'].' '.ucfirst($sxLang['DateDay']); ?></a></td>
		<td align="center" width="<?PHP echo $sxThemeConfig['ContentWidth']/2; ?>"><strong><?PHP echo fetchDate($sxTimestamp, 4, 0); ?></strong></td>
		<td align="right" width="<?PHP echo $sxThemeConfig['ContentWidth']/4; ?>"><a href="<?PHP echo $PHP_SELF."?sxTimestamp=".($sxTimestamp+(60*60*24)); ?>"><?PHP echo $sxLang['Next'].' '.ucfirst($sxLang['DateDay']); ?> ></a></td>
	  </tr>
	  <tr>
		<td colspan="3">
		<?PHP
		
		$sxDayStart = mktime(0,0,0,date("m", $sxTimestamp),date("d", $sxTimestamp),date("y", $sxTimestamp));
		$sxDayEnd = mktime(23,59,59,date("m", $sxTimestamp),date("d", $sxTimestamp),date("y", $sxTimestamp));
		
		$sxFirst = true;
		
		$query = "SELECT * FROM $DB_Events 
				  WHERE ((start_timestamp >= '$sxDayStart' AND end_timestamp <= '$sxDayEnd') OR 
						(start_timestamp <= '$sxDayEnd' AND end_timestamp >= '$sxDayEnd') OR 
						(end_timestamp >= '$sxDayStart' AND end_timestamp <= '$sxDayEnd')) AND
						active='1'
				  ORDER BY start_timestamp ASC";
		$result = mysql_query($query, $Link) or queryError("71", mysql_error());			
		
		if(!mysql_num_rows($result))
		{
			echo '<p>&nbsp;</p><p>' . $sxLang['NoEventsToday'] . '</p>';
			
			if(userAdmin())
				echo '<a href="admin/event_add.php?sxThisTimestamp=' . $sxDayStart . '">' . $sxLang['EventButtonAddEvent'] . '</a></div>'."\n";
		}
		else
		{
			while($ROW = mysql_fetch_object($result))
			{
				if(eventAccess($ROW->id))
				{
					if(!$sxFirst)
						echo '<hr noshade="noshade" size="1" />'."\n";
					else
						$sxFirst = false;
					
					echo '<a name="' . $ROW->id . '"></a><div class="eventDate">'."\n";
					
					if($ROW->allday)
						echo $sxLang['EventItemAllDay'];
					elseif(($sxDayStart > $ROW->start_timestamp)OR($sxDayEnd < $ROW->end_timestamp))
						echo getFormattedEventDate($ROW->allday, $ROW->start_timestamp, $ROW->end_timestamp, 0);
					else
						echo date("g:ia", $ROW->start_timestamp) . ' - ' . date("g:ia", $ROW->end_timestamp);
					
					echo '</div>'."\n";
					echo '<div class="eventNameLong">' . stripslashes($ROW->longname) . '</div>'."\n";
					echo '<div class="postedBy">' . $sxLang['PostedBy'] . ': <a href="admin/profile_view.php?user=' . getUsername($ROW->userid) . '">' . getUserFullName($ROW->userid) . '</a></div>'."\n";
					echo '<div class="eventDescription">' . stripslashes($ROW->description) . '</div>'."\n";
						
					if(userAdmin())
					{
						echo '<div class="eventAdminLinks"><a href="admin/event_edit.php?eventid=' . $ROW->id . '">' . $sxLang['EventButtonEditEvent'] . '</a>';
						echo '                 &nbsp;&nbsp;<a href="admin/event_add.php?sxThisTimestamp=' . $sxDayStart . '">' . $sxLang['EventButtonAddEvent'] . '</a></div>'."\n";
					}	

				}
			}
		}
		?>
		</td>
	  </tr>
	</table>
  </div>
<?PHP
include("themes/$THEME_FOLDER/footer.php");
ob_end_flush();
?>
Return current item: SiteX