<?php
if($this->session->userdata('is_logged_in')==FALSE){
	redirect('login');
}
?>
<hr class="thick-line" style="clear:both;">
<div id="left">
	<?php
	echo form_open(base_url().$page_url.'/search');
	$attributes = array('name' => 'search', 'id' => 'search-box', 'type' => 'text','size' => '50','placeholder'=>"  Ketik kata kunci  ");
	echo form_input($attributes);
	echo "<span>  </span>";
	$attributes = array('value' => 'Search', 'id' => 'search-btn1','class' => 'btn', 'type' => 'submit');
	echo form_submit($attributes);
	echo form_close('');
	?>
</div>
<div id="pages">
    <div id="selector"></div>
</div>
<div class="cssTable">
	<table id="tablePerkaraAll">
		<col  width="3%" />
        <col  width="25%" />
        <col  width="20%" />
        <col  width="20%" />
        <col  width="25%" />       
		<tbody>
			<tr>
				<td>No</td>
				<td onclick="sorting(1)">Nama Lengkap</td>
				<td onclick="sorting(2)">Username</td>
				<td onclick="sorting(3)">Host Address</td>
				<td>Waktu Login</td>				
			</tr>
			<?php
				if($users_list!=''){
					if($users_list->num_rows>0){
						if($page_active<1){
							$con = 1;
						}else{
							$con = $page_active+1;
						}						
						
						# set history URL REQUESTED, this will be used to back on previous page.
						# 
						$this->nativesession->set_flash_session('history', current_url());
		    			foreach ($users_list->result() as $row) {
		    				echo "<tr>";
			    				echo '<td>'.$con.'</td>';
			    				echo '<td>'.$row->fullname.'</td>';
			    				echo '<td>'.$row->username.'</td>';
			    				echo '<td>'.$row->host_address.'</td>';
			    				echo '<td>'.$row->tanggal_login.' '.$row->waktu_login.'</td>';		    				
		    				echo "</tr>";
		    				$con++;
		    			}
			    	}else{
		    			echo "<tr><td colspan='5' align='center'>Tidak ada User yang online</td></tr>";
		    		}
				}else{
		    		echo "<tr><td colspan='5' align='center'>Tidak ada User yang online</td></tr>";
		    	}
			?>
		</tbody>
	</table>
</div>
<div id="pages_bottom" style="width:100%;padding-left:5px;padding-top:5px;">
    <div id="selector_bottom"></div>
</div>

<?php
$url = base_url().$page_url.'/sort/';
$keyword = (!empty($keyword))?'/'.$keyword : '';
?>
<script type="text/javascript">
	function sorting(col){
		window.open('<?php echo $url;?>'+col+'/<?php echo $enc; ?><?php echo $keyword; ?>','_self')
	}
	<?php $enc = (!empty($enc)) ? "/".$enc : $enc;?>
	function searchDetilShow(){
		window.open('<?php echo base_url();?>search','_self')
	}

</script>
