<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Popup_message extends CI_Controller {

	function index($page=NULL,$val=NULL){
		if($page=='audittrail'){
			$this->audittrail($val);
		}
	}
	function audittrail($val){
		$this->load->model('audittrail/audit_trail');
		$result = $this->audit_trail->get_detail_info($val);
		echo '<div class="centering" style="width:500px;margin-top: 5%;z-index:-100">';
		echo '<div style="border: 1px solid #ffffff;">';
		echo '<div class="detil" style="padding: 2px;background-color: white;">';
		if($result!=''){
			if($result->num_rows>0){
				echo '<table id="infoPerkara">';
					echo '<col width="30%" />';
					echo '<col width="55%" />';
					echo '<col width="15%" />';
					echo "<tbody>";
					echo "<tr>";
						echo "<td colspan='2'></td>";
						echo '<td id="tutup" align="center" style="padding:5px;" width="50" onclick="close_msg()"><a onclick="close_msg()">Tutup</a></td>';
					echo "</tr>";

				foreach ($result->result() as $row) {
					echo "<tr>";
						echo "<td id='first-child'>Timestamp</td>";
						echo "<td colspan='2'>".$row->datetime."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<td id='first-child'>Alamat IP</td>";
						echo "<td colspan='2'>".$row->ipaddress."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<td id='first-child'>Username</td>";
						echo "<td colspan='2'>".$row->username."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<td id='first-child'>Nama Table</td>";
						echo "<td colspan='2'>".$row->tablename."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<td id='first-child'>Action</td>";
						echo "<td colspan='2'>".$row->action."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<td id='first-child'>Title</td>";
						echo "<td colspan='2'>".$row->title."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<td id='first-child'>Keterangan</td>";
						echo "<td colspan='2'>".$row->description."</td>";
					echo "</tr>";
				}
				echo "</tbody>";
				echo '</table>';
			}
		}
		echo '</div>';
		echo '</div>';
		echo '</div>';
	}
}