<?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($this->nativesession->isStatusPihak()!=TRUE){
	$modelClass->Validated->setup();
}

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

if($this->session->userdata('is_logged_in')){
	$new_message = $modelClass->Validated->get_new_message($userid);
	# activated this when you ready
	#$modelClass->Validated->is_logged_in();
}
$update = FALSE;
$url = FCPATH.'application/views/patch.php';
if(file_exists($url))
	include_once('patch.php');

if($update)
	unlink($url);
?>
<html>
<head>
	<meta name=viewport content="width=device-width, initial-scale=1">
	<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" />
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>resources/css/simplePagination.css">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>resources/css/jquery.ui.timepicker.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-2.js"></script>
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>resources/css/bootstrap.css">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>resources/css/AdminLTE.css">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>resources/css/font-awesome/css/font-awesome.css">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>resources/autocomplete/jquery.autocomplete.css">
	<script type="text/javascript" src="<?php echo base_url();?>resources/js/jquery.idTabs.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url();?>resources/autocomplete/jquery.autocomplete.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'});
		$('#loading').show();
	</script>
	<div class="wrapper">
		<div id="atas" style="overflow: hidden">		
			<div class="logo">
				<a href="<?php echo base_url();?>" target="_self">
				<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'>";
					$idpanitera = $this->session->userdata('panitera_id');
					$idhakim = $this->session->userdata('hakim_id');
					$idjurusita = $this->session->userdata('jurusita_id');
					
					if((!empty($idpanitera) OR !empty($idhakim) OR !empty($idjurusita))){
					echo "<a style='background:yellow;color:#000;' href='".base_url()."perkara_task_list/'>Perkara Yang Ditangani</a>";
					echo "|";
					}
					echo "<a href='".base_url('user_profile/'.base64_encode($this->encrypt->encode($this->session->userdata('userid'))))."'><font color='blue'>Edit Profile</font></a>";
					echo "|<a href='".base_url()."index.php/logout' style='color:#F9FC00'>Keluar</a>";
					echo "</div";
				}
			?>
			</div>
			<div class="version_shading">
				<label><?php echo str_replace('.','',$this->session->userdata('app_version'));?></label>
			</div>
		</div>
		<div class="clear"></div>
	</div>

	<?php
	if($this->session->userdata('is_logged_in')){
		// echo "Pake menu yang BAWAH YA<br>";
		// $this->load->view('Menu/menu_b');
		// echo "Pake menu yang BAWAH YA<br>";
		// echo "<br><br><br>";
		//$this->load->view('e_filing/cek_efiling');
		$this->load->view('efiling/cek_efiling');
		$this->load->view('delegasi/cek_delegasi');
		$this->load->view('Menu/menu');

	}else{
		echo '<div id="cssmenu" style="height:15px;">';
		echo "</div>";
	}
	?>
	
	<div class="wrapper">
<?php
if($new_message>0){
?>
	<script type="text/javascript">
		var new_msg = '<?php echo $new_message;?>';
		$("#menu_pesan").append('<font id="msg_new" style="color:red;"> ('+new_msg+')</font>');
	</script>
<?php
}else{
?>
	<script type="text/javascript">
		$("#msg_new").remove();
	</script>
<?php }
?>