<?php
$baseUrl = Yii::app()->theme->baseUrl;
$url = Yii::app()->baseUrl . "/";
$cs = Yii::app()->getClientScript();
?>

<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="description" content="<?php echo Setting::model()->description(); ?>">
	<meta name="author" content="<?php echo Setting::model()->name(); ?>">
	<title><?php echo $this->pageTitle; ?> - <?php echo Setting::model()->name(); ?></title>
	<!-- Favicons-->
	<link rel="shortcut icon" href="<?php echo $url; ?>/image/setting/<?php echo Setting::model()->favicon(); ?>" type="image/x-icon">

	<link rel="stylesheet" type="text/css" href="<?php echo $baseUrl; ?>/admin/assets/lib/perfect-scrollbar/css/perfect-scrollbar.min.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo $baseUrl; ?>/admin/assets/lib/material-design-icons/css/material-design-iconic-font.min.css" />
	<!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="<?php echo $baseUrl; ?>/admin/assets/lib/datetimepicker/css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $baseUrl; ?>/admin/assets/lib/daterangepicker/css/daterangepicker.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $baseUrl; ?>/admin/assets/lib/select2/css/select2.min.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $baseUrl; ?>/admin/assets/lib/bootstrap-slider/css/bootstrap-slider.css" />
<link rel="stylesheet" href="<?php echo $baseUrl; ?>/admin/assets/css/style.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="<?php echo $baseUrl; ?>/admin/assets/lib/jquery.gritter/css/jquery.gritter.css" />
</head>

<body>
	<div class="be-wrapper">
		<nav class="navbar navbar-default navbar-fixed-top be-top-header">
			<div class="container-fluid" style="background-image: linear-gradient(to left, transparent, rgba(0, 0, 0, 0.5)); background-color: #434bdf;">
				<div class="navbar-header" style="background-color: #FFF;">
					<!-- <a href="#" class="text-white be-toggle-left-sidebar"><span class="icon mdi mdi-menu"></span></a> -->
					<a href="<?php echo YII::app()->baseUrl; ?>/main/paper/admin" class="navbar-brand"></a>
				</div>
				<div class="be-right-navbar">

					<ul class="nav navbar-nav navbar-right be-user-nav">
						<!-- <li><a href="#" class="be-toggle-left-sidebar"><span class="icon mdi mdi-dns"></span></a></li> -->

						<li class="dropdown"><a href="#" data-toggle="dropdown" role="button" aria-expanded="false" class="dropdown-toggle"><img src="<?php echo $url; ?>image/favicon/avatar.png" alt="Avatar"><span class="user-name"><?php echo YII::app()->user->name; ?></span></a>
							<ul role="menu" class="dropdown-menu">
								<li>
									<div class="user-info">
										<div class="user-name"><?php echo Users::model()->showFullname(YII::app()->user->id); ?></div>
										<div class="user-position online"><?php echo Users::model()->level(YII::app()->user->record->level); ?></div>
									</div>
								</li>

								<li><a href="<?php echo $url; ?>profile"><span class="icon mdi mdi-face"></span> Edit Profil</a></li>
								<li><a href="<?php echo $url; ?>password"><span class="icon mdi mdi-lock"></span> Ganti Password</a></li>
								<!-- <li><a href="<?php echo $url; ?>image/<?php echo YII::app()->user->id; ?>"><span class="icon mdi mdi-image"></span> Image</a></li>  -->
								<?php if (YII::app()->user->record->level == 1) : ?>
									<li><a href="<?php echo $url; ?>setting/site"><span class="icon mdi mdi-settings"></span> Konfigurasi</a></li>
								<?php endif; ?>
								<li><a href="<?php echo $url; ?>site/logout"><span class="icon mdi mdi-power"></span> Logout</a></li>
							</ul>
						</li>
					</ul>
					<!-- <div class="page-title"><span><?php echo YII::app()->name; ?></span></div> -->

					<?php if (YII::app()->user->record->level == 1) : ?>
						<ul class="nav navbar-nav navbar-right be-icons-nav">
							<li class="dropdown"><a href="#" data-toggle="dropdown" role="button" aria-expanded="false" class="dropdown-toggle"><span class="icon mdi mdi-notifications"></span><span class="indicator"></span></a>
								<ul class="dropdown-menu be-notifications">
									<li>
										<div class="title">Pemberitahuan Baru <span class="badge"><?php echo Activities::getNotificationsCount(0); ?></span></div>

										<div class="list">
											<div class="be-scroller">
												<div class="content">
													<ul>

														<?php foreach (Activities::getNotifications(0) as $key => $value) { ?>
															<li class="notification notification-unread" title="Belum Dilihat">
																<a href="<?php echo YII::app()->baseUrl; ?>/site/notification/id/<?php echo $value['id_activities']; ?>">
																	<div class="image"><img src="http://sinerjiteknoindo.com/pnbp/image/avatar/male.png" alt="Avatar"></div>
																	<div class="notification-info">
																		<div class="text"><span class="user-name"> <?php echo $value['name']; ?></span> <?php echo $value['description']; ?></div><span class="date format-date"><?php echo $value['created_date']; ?></span>
																	</div>
																</a>
															</li>
														<?php } ?>
														<?php foreach (Activities::getNotifications(1) as $key => $value) { ?>
															<li class="notification notification-read" title="Belum Dilihat">
																<a href="<?php echo YII::app()->baseUrl; ?>/site/notification/id/<?php echo $value['id_activities']; ?>">
																	<div class="image"><img src="http://sinerjiteknoindo.com/pnbp/image/avatar/male.png" alt="Avatar"></div>
																	<div class="notification-info">
																		<div class="text"><span class="user-name"> <?php echo $value['name']; ?></span> <?php echo $value['description']; ?></div><span class="date format-date"><?php echo $value['created_date']; ?></span>
																	</div>
																</a>
															</li>
														<?php } ?>


													</ul>
												</div>
											</div>
										</div>
										<div class="footer"> <a href="<?php echo YII::app()->baseUrl; ?>/site/seenotification">Lihat Semua Notifikasi</a></div>
									</li>
								</ul>
							</li>
						</ul>
					<?php endif; ?>

				</div>
			</div>
		</nav>