Location: PHPKode > projects > CMSmelborp > CMSmelborp/admin/log/list.php
<?php
/*******************************************************************************
License:
	Copyright 2005 Ryan Morehart
	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at
	
	http://www.apache.org/licenses/LICENSE-2.0
	
	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
	
Filename: /admin/log/list.php

Purpose: Displays the current items in the log.
	
Processed parameters: (TYPE - NAME - DESCRIPTION - DEFAULT)
	NONE
*******************************************************************************/

require_once '../includes/admin_standard.php';

// Check for requested action
///////////
// Delete log
if(isset($_POST['delete']))
{
	header('Location: delete.php');
}

include '../includes/header.php';
?>
<h1>Administrative log</h1>
<p>Below is the log of all actions done by site users. To make the log easier to read, dates which are the
same as the one last shown are not displayed.</p>
<table class="itemlist">
	<tr class="head">
		<!-- <td></td> -->
		<td>Date</td>
		<td>Time</td>
		<td>Action category</td>
		<td>Action type</td>
		<td>User name</td>
		<td>Extra information</td>
	</tr>
	<?php
	// Get log
	$log = getLog($connection);
	if($log !== false && !empty($log))
	{
		// Display each item of log
		// Do not display duplicate dates in a row
		$lastDate = 0;
		foreach($log as $logItem)
		{
			?>
			<tr>
				<!--
				<td>
					<input type="checkbox" name="log_entry[]" value="<?php echo $logItem['entry_id']; ?>" />
				</td>
				-->
				<td>
					<?php
						if(date('d-m-Y', $logItem['entry_date']) !== $lastDate)
						{
							$lastDate = date('d-m-Y', $logItem['entry_date']);
							echo $lastDate;
						}
					?>
				</td>
				<td><?php echo date('h:m:s A', $logItem['entry_date']); ?></td>
				<td><?php echo $logItem['entry_category']; ?></td>
				<td><?php echo $logItem['entry_type']; ?></td>
				<td><?php echo $logItem['user_name']; ?></td>
				<td><?php echo $logItem['extra_information']; ?></td>
			</tr>
			<?php
		}
	}
	else
	{
		echo "<tr><td colspan='7'><strong>No log items were available!</strong></td></tr>";
	}
	?>
</table>
<input type="submit" name="delete" value="Clear log" />
<?php
include '../includes/footer.php';
?>
Return current item: CMSmelborp