<?php
    
    include("../include/header.php");
  $l_id = $_GET['id'];
    $sql1m = "select * from `blog` WHERE `blog`.`id` = '$l_id'";	
//echo $sql1m ." ". $l_id;
    $result1m = mysqli_query($conn, $sql1m);											
    if (mysqli_num_rows($result1m) > 0) {
        $i=1;
        while($row1m = mysqli_fetch_assoc($result1m)) {
            $det_det_id = $row1m['id'];
            $det_title = $row1m['title'];
            $det_blogs_details = $row1m['blogs_details'];
            $det_post_by = $row1m['post_by'];
            $det_picture = $row1m['picture'];
			$det_keyword = $row1m['keyword'];
			$det_metatag = $row1m['metatag'];
			$det_description = $row1m['description'];
            
        }
    }

?>

<style>
	#my_Library ul li:nth-child(3) {
		background-color: #eb6a4e;
	}

	#my_Library ul li:nth-child(3) a {
		color: #fff;
	}

	#my_Library ul li:nth-child(3) a:hover {
		background-color: #eb6a4e;
	}

	#srkproperty_details .course-detailsa img{
		width: 100% !important;
		max-height: 250px !important;
	}
</style>
<script>
	window.onload = function() {
		document.getElementById('my_Library').classList.add("active");
		document.getElementById('my_Library1').classList.add("in");
	};

</script>

<div class="small-header">
	<div class="hpanel">
		<div class="panel-body">
			<div id="hbreadcrumb" class="pull-right">
				<ol class="hbreadcrumb breadcrumb">
					<li><a href="<?php echo $admin_baseurl . 'dashboard.php';?>">Dashboard</a></li>
					<li class="active">
						<span>Blogs</span>
					</li>
				</ol>
			</div>
			<h2 class="font-light m-b-xs">
				Update vBlogs Details
			</h2>

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


<div class="content">
	<div class="hpanel">
		<div class="hpanel">
			<div class="panel-heading hbuilt">
				<div class="panel-tools">
					<a class="showhide"><i class="fa fa-chevron-up"></i></a>
					<a class="fullscreen"><i class="fa fa-expand"></i></a>
				</div>
				Update Blogs Details
			</div>
			<div class="panel-body">
				<form class="form-horizontal" action="execute-blogs-details.php" method="post" enctype="multipart/form-data">
					<div class="form-group">
						<div class="col-md-12">
							<label class="control-label">Blogs Title</label>
							<input type="text" name="blogs_title" class="form-control" placeholder="BLogs Title" value="<?php echo $det_title;?>" required>
						</div>
						<div class="col-md-12">
							<label class="control-label">Blogs Posted By</label>
							<input type="text" name="post_by" class="form-control" placeholder="BLogs Title" value="<?php echo $det_post_by;?>" required>
						</div>

						<div class="col-md-12">
							<label class="control-label">Details</label>
							<textarea required class="textarea form-control " id="ckeditor_library_course_details" name="ckeditor_library_course_details" placeholder="Enter text ..." rows="15" data-height="100">
							 <?php echo htmlspecialchars($det_blogs_details); ?></textarea>
						</div>
						<div class="col-md-6">
							<label class="control-label">Blogs Image</label>
							<input type="file" id="file" class="form-control" name="image_a" multiple="multiple" accept="image/*">
						</div>
						<div class="col-md-6">
							<img src="<?php echo $admin_baseurl . 'blogs/blogs-files/'. $det_picture;?>" style="width:100px;">
						</div>
						<div class="col-md-12"><br>
							<label>Seo Keywords</label>
							<input name="keyword" class="form-control" placeholder="eg.Seo Keywords..." value="<?php echo $det_keyword;?>">
						</div>
						<div class="col-md-12">
							<label>Meta Tag</label>
							<input name="metatag" class="form-control" placeholder="Meta Tag" value="<?php echo $det_metatag;?>">
						</div>
						<div class="col-md-12">
							<label>Meta Description</label>
							<input name="description" class="form-control" placeholder="Meta Description" value="<?php echo $det_description;?>">
						</div>


						<div class="col-md-12">
							<div class="form-group" style="padding:0 20px;">
								<br>
								<div class="text-right">
									<input type="hidden" name="blogs_id" value="<?php echo $det_det_id;?>">
									<input type="hidden" name="blogs_images" value="<?php echo $det_picture;?>">
									<button type="reset" class="btn btn-default">Cancel</button>
									<button type="submit" name="update_blogs_details" class="btn btn-primary">Submit</button>
								</div>
							</div>
						</div>
					</div>


				</form>
			</div>

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


<div class="content">



	<div class="hpanel">
		<div class="panel-heading hbuilt">
			<div class="panel-tools">
				<a class="showhide"><i class="fa fa-chevron-up"></i></a>
				<a class="fullscreen"><i class="fa fa-expand"></i></a>
			</div>
			View All Tutorials Library Course
		</div>
		<div class="panel-body">
			<div class="table-responsive">
				<table id="userPermission_dataTable" class="table table-striped table-bordered table-hover">
					<thead>
						<tr>
							<th>#</th>
							<th>Title</th>
							<th>Posted Date</th>
							<th>Picture</th>
							<th>Details</th>
							<th>Action</th>
						</tr>
					</thead>
					<tbody>

						<?php
        $srno = 0;
        $sqlAssign1 = "SELECT * FROM `blog` ORDER BY `blog`.`id` DESC";			
//                   echo $sqlAssign1;     
        $resultAssign1 = mysqli_query($conn, $sqlAssign1);											
        if (mysqli_num_rows($resultAssign1) > 0) {
            while($rows = mysqli_fetch_assoc($resultAssign1)) { 
                
                $id = $rows['id'];
                $title = $rows['title'];
                $date_add = $rows['date_add'];
				$post_by = $rows['post_by'];
                $blogs_details = $rows['blogs_details'];
                $picture = $rows['picture'];
                 $t_status = $rows['status'];
                
                
      
                
?>
						<tr>
							<th scope="row"><?php echo $srno += 1;?></th>

							<td><?php echo $title;?></td>

							<td>
								<p><b>Posted By : </b><?php echo $date_add;?></p>
								<br>
								<p><b>Posted By : </b><?php echo $post_by;?></p>
							</td>
							<td><img src="<?php echo $admin_baseurl . 'blogs/blogs-files/'. $picture;?>" style="width:100px;"></td>

							<td>
								<a type="button" course-details='<?php echo $blogs_details;?>' data-toggle="modal" data-target="#srkproperty_details" class="btn theme-btn show_property_details" style="cursor: pointer;">More Detail</a></td>


							<td>
								<div class="action_btns">

									<form method="post" action="update-blogs-details.php?id=<?php echo $id;?>">
										<button type="submit" class="actionbtn"><i class="fa fa-pencil-square-o text-success" aria-hidden="true"></i></button>
									</form>

									<form method="post" action="execute-blogs-details.php?id=<?php echo $id;?>">
										<button type="submit" name="Delete_blogs_details" class="actionbtn" onclick="return confirm('Do you want to delete this data?')"><i class="fa fa-trash text-danger" aria-hidden="true"></i></button>
									</form>


									<?php if($t_status == 'active'){?>
									<form method="post" action="execute-blogs-details.php?id=<?php echo $id;?>">
										<button type="submit" name="status_deactive_blogs" class="actionbtn"><i class="fa fa-toggle-on text-success" aria-hidden="true"></i></button>
									</form>
									<?php }else{?>
									<form method="post" action="execute-blogs-details.php?id=<?php echo $id;?>">
										<button type="submit" name="status_active_blogs" class="actionbtn"><i class="fa fa-toggle-off text-danger" aria-hidden="true"></i></button>
									</form>
									<?php }?>
								</div>
							</td>
						</tr>
						<?php }}?>

					</tbody>
				</table>
			</div>
		</div>

	</div>
</div>

<br>
<?php 
    include('../include/footer.php');
?>

