<?php
date_default_timezone_set("Asia/Jakarta");
$this->benchmark->mark('code_start');
$namaPN = 'Not Configure';

$modelClass =& get_instance();
$modelClass->load->model('default/Validated');
$tmp = $this->session->userdata('namaPN');
$userid = $this->session->userdata('userid');
$new_message = 0;
if(empty($tmp)){
	$query = $modelClass->Validated->getSystemInfo();
	foreach ($query->result() as $row) {
		if($row->id == 62){
			if(!empty($row->value)){
				$namaPN = $row->value;
				$this->session->set_userdata('namaPN',$row->value);
			}
		}

		if($row->id == 83){
			if(!empty($row->value)){
				$this->session->set_userdata('jenis_pengadilan',$row->value);
			}else{
				$this->session->set_userdata('jenis_pengadilan',1);
			}
		}
	}
}else{
	$namaPN = $this->session->userdata('namaPN');
}

$app_version = $this->session->userdata('app_version');
if(version_compare($app_version,  "3.1.1",'<')){
	$status_update = TRUE;
}else{
	if($this->nativesession->isStatusPihak()!=TRUE){
		$modelClass->Validated->setup();
	}

	if($this->nativesession->isLangguage()!=TRUE){
		$modelClass->val->setup_language();
	}
}



if($this->session->userdata('is_logged_in')){
	$new_message = $modelClass->Validated->get_new_message($userid);
}
?>
<html>
<head>
	<link rel="shortcut icon" href="<?php echo base_url();?>resources/img/favicon.ico" type="image/png">
	<title>SIPP <?php echo $namaPN;?></title>
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>resources/css/style.css">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>resources/css/table.css">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>resources/css/date-css.css" />
	<script type="text/javascript" src="<?php echo base_url();?>resources/js/jquery-1.7.1.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url();?>resources/js/jquery-ui-1.8.18.custom.min.js"></script>
	<script src="<?php echo base_url();?>resources/js/Modernizr.js"></script>
	<script src="<?php echo base_url();?>resources/js/jquery-sipp.js"></script>
	<script type="text/javascript" src="<?php echo base_url();?>resources/js/jquery.idTabs.min.js"></script>
</head>
<div id="loading" class="popup_loading">
	<div style="margin: 0px auto;margin-left: 40%;margin-top: 15%;width:0;">
		<img src="<?php echo base_url();?>resources/img/loading_ma.gif">
	</div>
</div>
<body>
	<script type="text/javascript">
		$("body").css({overflow: 'hidden'});
	</script>
	<div id="wrapper">
		<div id="atas">		
			<div class="logo">
				<a href="<?php echo base_url();?>" target="_blank">
				<img src="<?php echo base_url();?>resources/img/logo.png"></a>
			</div>
			<div class="front">
				<font>Sistem Informasi Penelusuran Perkara<span><br><?php echo $namaPN;?></br></span></font>
			</div>
			<div class="h_right">
			<?php
				$status_update = FALSE;
				if(!$this->session->userdata('is_logged_in')){
					echo "<a href='".base_url()."login'><font size='4'>Login</font></a>";
				}else{
					$color = "yellow";
					if($this->session->userdata('idgroup')<=1){
						$color = "red";
						$app_version = $this->session->userdata('app_version');
						if(!empty($app_version)){
							if(version_compare($app_version,  "3.1.1",'<')){
								$status_update = TRUE;
							}
						}
					}elseif($this->session->userdata('idgroup')==2){
						$color = "blue";
					}
					echo "Selamat Datang <font color='".$color."'>".$this->session->userdata('fullname')."</font>";
					echo "<br> Anda Login Sebagai [<font color='".$color."'>".$this->session->userdata('status')."</font>]";
				}
				if($this->session->userdata('is_logged_in')){
					echo '<div class="clear"></div>';
					echo "<div style='float:right'>";
					echo "|<a href='".base_url()."index.php/logout'>Keluar</a>";
					echo "</div";
				}
			?>
			</div>
		</div>
		<div class="clear" ></div>
	</div>
	<div id="cssmenu" style="height: 10px;"></div>
	<div id="content">