<?php
if(!isset($_SESSION))
{
session_start();
}
if(!isset($_SESSION['is_login'])){
	header("location: login.php");
?>
<script>
window.location="login.php";
</script>
<?php
}
?>
<style >
.btn-file {
    position: relative;
    overflow: hidden;
}
.btn-file input[type=file] {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 100%;
    min-height: 100%;
    font-size: 100px;
    text-align: right;
    filter: alpha(opacity=0);
    opacity: 0;
    outline: none;
    background: white;
    cursor: inherit;
    display: block;
}
</style>
				<!-- Cover area -->
				<div class="profile-cover">
					<?php if($_SESSION['cover_image']==null){  ?>
						<div class="profile-cover-img" style="background-image: url(image/profile/img_same_dimension_2.jpg)"></div>
						<?php }else{ ?>
						<div class="profile-cover-img" style="background-image: url(<?php echo $_SESSION['image_path'].$_SESSION['cover_image']; ?>)"></div>
					<?php } ?>


					<div class="media">
						<div class="media-left">

							<form  id="imageUploadFormPic"  enctype="multipart/form-data">
								<input type="hidden" id="type" name="type"  value="update_profile_image">
								<input type="hidden" id="access_token" name="access_token"  value="<?php echo $_SESSION['access_token']; ?>">
								<span class="btn btn-default btn-file" style="box-shadow: 0 0 3px rgba(0, 0, 0, 0); background-color: rgba(245, 245, 245, 0);"><a href="#" id="profileLink" class="profile-thumb">
								<?php if($_SESSION['profile_image']==null){  ?>
								<img src="image/profile/noimg.jpg" class="img-circle img-xl" alt="">
								<?php }else{ ?>
								<img src="<?php echo $_SESSION['image_path'].$_SESSION['profile_image']; ?>" class="img-circle img-xl" alt="">
								<?php } ?>

									<input type="file" id="profile_image" name="profile_image" class="bra">

								</a></span>

						  </form>
						</div>

						<div class="media-body">
				    		<h1><?php echo $_SESSION['full_name']; ?> <small class="display-block"><?php echo $_SESSION['username']; ?></small></h1>
						</div>

						<div class="media-right media-middle">
							<ul class="list-inline list-inline-condensed no-margin-bottom text-nowrap">
								<li>
								  <form  id="imageUploadForm"  enctype="multipart/form-data">
									<input type="hidden" id="type" name="type"  value="update_profile_cover_image">
									<input type="hidden" id="access_token" name="access_token"  value="<?php echo $_SESSION['access_token']; ?>">
									<span class="btn btn-default btn-file"><i class="icon-file-picture position-left"></i> <span class="multi_lang">صورة الغلاف</span>
										<input type="file" id="cover_image" name="cover_image" class="bra">
									</span>
								  </form>
								</li>
							</ul>
						</div>
					</div>
				</div>
				<!-- /cover area -->


				<!-- Toolbar -->
				<div class="navbar navbar-default navbar-xs navbar-component no-border-radius-top">
					<ul class="nav navbar-nav visible-xs-block">
						<li class="full-width text-center"><a data-toggle="collapse" data-target="#navbar-filter"><i class="icon-menu7"></i></a></li>
					</ul>

					<div class="navbar-collapse collapse" id="navbar-filter">
						<ul class="nav navbar-nav">
							<li class="active"><a href="#activity" data-toggle="tab"><i class="icon-menu7 position-left"></i> <span class="multi_lang">المعلومات الشخصية</span></a></li>
							<li><a href="#schedule" data-toggle="tab"><i class="icon-key position-left"></i> <span class="multi_lang">تغيير كلمة السر</span> </a></li>

						</ul>


					</div>
				</div>
				<!-- /toolbar -->


				<!-- User profile -->
			<div class="tabbable">
				<div class="tab-content">
					<div class="tab-pane fade active in" id="activity">
						<!-- Share your thoughts -->
						<div class="panel panel-flat">
							<div class="panel-heading">
								<h6 class="panel-title multi_lang">المعلومات الشخصية</h6>

							</div>
							<div class="row">
							<div class="col-md-2"></div>
								<!-- Advanced login -->
								<div class="col-md-8">
								<form id="profileform">

									<input type="hidden" id="type" name="type"  value="update_profile">
									<input type="hidden" id="access_token" name="access_token"  value="<?php echo $_SESSION['access_token']; ?>">

										<div class=" form-group has-feedback has-feedback-left form-group-material ">
											<label class="control-label multi_lang">اسم المستخدم</label>
											<input type="text" id="username" name="username" class="form-control multi_lang" placeholder="اسم المستخدم" value="<?php echo $_SESSION['username']; ?>" readonly>
											<div class="form-control-feedback">
												<i class="icon-user text-muted"></i>
											</div>
										</div>

										<div class=" form-group has-feedback has-feedback-left form-group-material">
											<label class="control-label multi_lang">الاسم الكامل</label>
											<input type="text" id="fname" name="fname" class="form-control multi_lang" placeholder="الاسم الكامل" value="<?php echo $_SESSION['full_name']; ?>">
											<div class="form-control-feedback">
												<i class="icon-vcard text-muted"></i>
											</div>
										</div>

										<div class="form-group has-feedback has-feedback-left form-group-material">
											<label class="control-label multi_lang">رقم الهاتف</label>
											<input type="text" id="phone" name="phone" class="form-control multi_lang" placeholder="رقم الهاتف" value="<?php echo $_SESSION['phone_number']; ?>">
											<div class="form-control-feedback">
												<i class="icon-phone2 text-muted"></i>
											</div>
										</div>

										<div class="form-group has-feedback has-feedback-left form-group-material">
											<label class="control-label multi_lang">الرريد الالكتروني</label>
											<input type="text" id="email" name="email" class="form-control multi_lang" placeholder="الرريد الالكتروني" value="<?php echo $_SESSION['email']; ?>">
											<div class="form-control-feedback">
												<i class="icon-mail5 text-muted"></i>
											</div>
										</div>

										<div class="form-group has-feedback has-feedback-left form-group-material">
											<label class="control-label multi_lang">اللغة المفضلة</label>
											<select class="form-control multi_lang"  name="language_id" id="language_id" data-width="100%" placeholder="اللغة المفضلة" required="required">
												
											</select>											
											<div class="form-control-feedback">
												<i class="icon-earth  text-muted"></i>
											</div>
										</div>



										<div class="form-group">
											<button type="submit" class="btn btn-primary btn-labeled btn-labeled-right" id="updateprofile"><span class="multi_lang">تحديث</span> <b><i class="icon-circle-right2"></i></b></button>
										</div>

								</form>
								<!-- /advanced login -->
								</div>
							</div>

						</div>
						<!-- /share your thoughts -->
					</div>

					<div class="tab-pane fade" id="schedule">
						<!-- Share your thoughts -->
						<div class="panel panel-flat">
							<div class="panel-heading">
								<h6 class="panel-title multi_lang">تغيير كلمة السر</h6>

							</div>
							<div class="row">
							<div class="col-md-2"></div>
								<!-- Advanced login -->
								<div class="col-md-8">
								<form id="profileformpass">

										<input type="hidden" id="type" name="type"  value="update_password">
										<input type="hidden" id="access_token" name="access_token"  value="<?php echo $_SESSION['access_token']; ?>">

										<div class="form-group has-feedback has-feedback-left form-group-material ">
											<label class="control-label multi_lang">كلمة السر</label>
											<input type="password" id="password" name="password" class="form-control multi_lang" placeholder="كلمة السر">
											<div class="form-control-feedback">
												<i class="icon-lock2 text-muted"></i>
											</div>
										</div>

										<div class="form-group has-feedback has-feedback-left form-group-material ">
											<label class="control-label multi_lang">اعادة كتابة كلمة السر</label>
											<input type="password" id="repassword" name="repassword" class="form-control multi_lang" placeholder="اعادة كتابة كلمة السر">
											<div class="form-control-feedback">
												<i class="icon-lock2 text-muted"></i>
											</div>
										</div>

										<div class="form-group">
											<button type="submit" class="btn btn-primary btn-labeled btn-labeled-right"><span class="multi_lang">تحديث كلمة السر</span> <b><i class="icon-circle-right2"></i></b></button>
										</div>

								</form>
								<!-- /advanced login -->
								</div>
							</div>

						</div>
						<!-- /share your thoughts -->
					</div>
				</div>
			</div>
				<!-- /user profile -->
<script type="text/javascript" src="controllers/profile.js?random=<?php echo uniqid(); ?>"></script>
<script >
	function set_Lang() {
		$("#language_id").val('<?php echo $_SESSION['language_id']; ?>');
	}
</script>