<?php
if(count(get_included_files())==1) exit("Direct access not permitted.");
$mod = basename(__FILE__, '.php');
$page->tbCss($mod);
$page->tbJs($mod);

$namaheader="";
$logoheader="";
$namaheader2="";
$alamatheader="";
$telpheader="";
$emailheader="";
$faxheader="";
$waheader="";

if(isset($datasettingprofile['header'])) $namaheader=$datasettingprofile['header'];
if(isset($datasettingprofile['header2'])) $namaheader2=$datasettingprofile['header2'];
if(isset($datasettingprofile['alamat'])) $alamatheader=$datasettingprofile['alamat'];
if(isset($datasettingprofile['email'])) $emailheader=$datasettingprofile['email'];
if(isset($datasettingprofile['telp'])) $telpheader=$datasettingprofile['telp'];
if(isset($datasettingprofile['fax']) && $datasettingprofile['fax']!="") $faxheader=$datasettingprofile['fax'];
if(isset($datasettingprofile['hp']) && $datasettingprofile['hp']!="") $waheader=$datasettingprofile['hp'];

if(isset($datasettingprofile['idlogo']) && $datasettingprofile['idlogo']>0){
	$query="select * from tb_dokumen where id=?";
	$rsdatalogo=$db->loadAssoc($query,array($datasettingprofile['idlogo']));
	if(isset($rsdatalogo['id'])){
		$logoheader=NPAGE.$rsdatalogo['folder'].$rsdatalogo['nama_baru'];
	}
}
$query="select * from tb_konten_kategori where status=1 order by id asc";
$rskat=$db->getObj($query);
?>
<div class="mod_header">
	<div style="width: 100%;position: relative;"  align="center">
		<div class="box_mid_header" align="left">
			<div class="boxheaderlogo">
				<div class="header_logo">
					<img height="100%" src="<?php echo $logoheader;?>" />
				</div>
			</div>
			<div class="boxheaderttl">
				<div class="boxheaderttl_main"><?php echo $namaheader;?></div>
				<div class="boxheaderttl_sub"><?php echo $namaheader2;?></div>
			</div>
			<div style="clear: both;"></div>
			<div class="menu_icon" onclick="mheader.bukamenu()"></div>
		</div>
		
		<?php
		$query="select * from tb_menu where status=1 and idjenis=2 order by urutan asc";
		$datamenu=$db->getObj($query);
		
		?>
		<div class="box_menu_slide" id="box_menu_slide">
			<div>
				<ul>
				<?php
				foreach ($datamenu as $obj) {
					$tautanmenu="";
					if($obj->jenistautan=="halaman"){
						$tautanmenu="href=\"".NPAGE.$obj->tautan."\"";
					}else if($obj->jenistautan=="katkonten"){
						$tautanmenu="href=\"".NPAGE.'informasi?kategori='.$obj->tautan."\"";
					}else if($obj->jenistautan=="konten"){
						$tautanmenu="href=\"".NPAGE.'informasi?id='.$obj->tautan."\"";
					}else if($obj->jenistautan=="url"){
						$tautanmenu="href=\"".$obj->tautan."\"";
					}
					
					?>
					
					<li>
						<a <?php echo $tautanmenu;?>><span><?php echo $obj->menu;?></span></a>
					</li>
					<?php
					if($obj->jumlahsub>0){
						$query="select * from tb_menu_sub where idmenu=? and status=1 order by urutan asc";
						$datasubmenu=$db->getObj($query,array($obj->id));
						foreach ($datasubmenu as $obsub) {
							$tautansubtab="#";
							if($obsub->jenistautan=="halaman"){
								$tautansubtab=NPAGE.$obsub->tautan;
							}else if($obsub->jenistautan=="katkonten"){
								$tautansubtab=NPAGE."informasi?kategori=".$obsub->tautan;
							}else if($obsub->jenistautan=="konten"){
								$tautansubtab=NPAGE."informasi?id=".$obsub->tautan;
							}else if($obsub->jenistautan=="url"){
								$tautansubtab=$obsub->tautan;
							}
							?>
							<a href="<?php echo $tautansubtab;?>">
								<li class="tab_menu_sub" style="font-size: 14px;"><?php echo $obsub->sub_menu;?></li>
							</a>
							<?php
						}
					}
				}
				?>
					<li><a href="<?php echo NPAGE."login";?>"><span>Login</span></a></li>
					<li><span style="cursor: pointer;" onclick="mheader.tutupmenu()">Tutup</span></li>
				</ul>
			</div>
		</div>
	</div>
	<div class="box_menu_header" align="center">
		<div class="box_menu_header_mid">
			<div class="menu_header" align="left">
				<div onclick="mheader.klikmenu(this)" class="clmenuheader">
					<?php
					$menumember=NPAGE."login";
					$ttlmenumember="Login";
					if($statuslogin){
						$menumember=NPAGE."member";
						$ttlmenumember="Member";
					}
					?>
					<a href="<?php echo $menumember;?>"><span><?php echo $ttlmenumember;?></span></a>
					<div style="clear: both;"></div>
				</div>
				<?php
				$reversedmenu = array_reverse($datamenu);
				
				foreach ($reversedmenu as $obj) {
					$tautanmenu="";
					if($obj->jenistautan=="halaman" && $obj->tautan!="#"){
						$tautanmenu="href=\"".NPAGE.$obj->tautan."\"";
					}else if($obj->jenistautan=="katkonten"){
						$tautanmenu="href=\"".NPAGE.'informasi?kategori='.$obj->tautan."\"";
					}else if($obj->jenistautan=="konten"){
						$tautanmenu="href=\"".NPAGE.'informasi?id='.$obj->tautan."\"";
					}else if($obj->jenistautan=="url"){
						$tautanmenu="href=\"".$obj->tautan."\"";
					}
					?>
					<div onclick="mheader.klikmenu(this)" class="clmenuheader" onmouseleave="mheader.tutupsub(<?php echo $obj->id;?>,1,<?php echo $obj->jumlahsub;?>)" onmouseover="mheader.bukasub(<?php echo $obj->id;?>,1,<?php echo $obj->jumlahsub;?>)">
						<a <?php echo $tautanmenu;?>><span><?php echo $obj->menu;?></span></a>
						<?php
						if($obj->jumlahsub>0){
							?>
							<ul id="sub_<?php echo $obj->id;?>" class="boxmenusub">
							<?php
							$query="select * from tb_menu_sub where idmenu=? and status=1 order by urutan asc";
							$datasubmenu=$db->getObj($query,array($obj->id));
							foreach ($datasubmenu as $obsub) {
								$tautansub="#";
								if($obsub->jenistautan=="halaman"){
									$tautansub=NPAGE.$obsub->tautan;
								}else if($obsub->jenistautan=="katkonten"){
									$tautansub=NPAGE."informasi?kategori=".$obsub->tautan;
								}else if($obsub->jenistautan=="konten"){
									$tautansub=NPAGE."informasi?id=".$obsub->tautan;
								}else if($obsub->jenistautan=="url"){
									$tautansub=$obsub->tautan;
								}
								?>
								<div class="boxbarissub">
									<a href="<?php echo $tautansub;?>"><div><?php echo $obsub->sub_menu;?></div></a>
								</div>
								<?php
							}
							?>
							</ul>
							<?php
						}
						?>
						<div style="clear: both;"></div>
					</div>
					<?php
				}
				?>
			</div>
		</div>
	</div>
	
</div>
