<?php
	ob_start();
	session_start();
	
	//Included Files
	include("../class/admin.php");
	
	include("../class/dbConnection.php");
	$success = "";
	$failure = "";
	$recordSet;
	$message = "";
	$recordIndex = 0;
	$pageSize;
	$search = "";
	$status = "";

	$studentid ="";
	$stdrollno = "";
	$studentname = "";
	$mobileno = "";
	$classname = "";


	

	//Retrieving Session Variable
	if(isset($_SESSION["adminId"]))
	{
		$adminId = $_SESSION["adminId"];
		//echo $adminId;
	}
	else
	{
		header('Location:index.php?message=Unauthorized%20Access%20Prohobited');
	}
	
	//Retrieving Query String Variable
	if(isset($_REQUEST["message"]))
	{
		$message = $_REQUEST["message"];
	}
	
	if(isset($_REQUEST["year"]))
	{
		$search = $_REQUEST["year"];
	}
	
	//Retrieving Query String Variable
	if(isset($_REQUEST["success"]))
	{
		$success = $_REQUEST["success"];
	}
	
	if(isset($_REQUEST["failure"]))
	{
		$failure = $_REQUEST["failure"];
	}

	


	//Creating 'dbConnection' Object
	$dbObject = new dbConnection();
	$con = $dbObject->getConnection();
	//echo $con;
	if($con)
	{
		//MySQL Connection Established
		$dbResult = $dbObject->selectDatabase();
		if($dbResult)
		{
			//Creating 'instructor' Object 
			$adminObj = new admin();
			
			
						
				$recordSet1 = $adminObj->getAllAlerts1($search,$con);
				//$recordSet2 = $adminObj->getAllAlertsByCount($con);
				
			$totalRecords = mysql_num_rows($recordSet1);
			//echo $totalRecords;
			//Pagination Records
			
			
		}
		else
		{
			echo mysql_errno() . "<br/>" . mysql_error();
		}		
	}
	else
	{
		echo mysql_errno() . "<br/>" . mysql_error();
	}	
	?>
<!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">
<meta name="keywords"
	content="admin, dashboard, bootstrap, template, flat, modern, theme, responsive, fluid, retina, backend, html5, css, css3">
<meta name="description" content="">
<meta name="author" content="ThemeBucket">
<link rel="shortcut icon" href="#" type="image/png">

<title> Stock Reports</title>

<!--dynamic table-->
  <link href="js/advanced-datatable/css/demo_page.css" rel="stylesheet" />
  <link href="js/advanced-datatable/css/demo_table.css" rel="stylesheet" />
  <link rel="stylesheet" href="js/data-tables/DT_bootstrap.css" />

  <link href="css/style.css" rel="stylesheet">
  <link href="css/style-responsive.css" rel="stylesheet">




<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
  <script src="js/html5shiv.js"></script>
  <script src="js/respond.min.js"></script>
  <![endif]-->
   <script type = "text/javascript" src = "../js/paging.js"></script>
</head>

<body class="sticky-header">

	<section>
		<!-- left side start-->
		<div class="left-side sticky-left-side">

			<!--logo and iconic logo start-->
			<?php include("include/add-logo.php"); ?>
			<!--logo and iconic logo end-->

			<div class="left-side-inner">

				<!-- visible to small devices only -->
				<div class="visible-xs hidden-sm hidden-md hidden-lg">
					<div class="media logged-user">
						
					</div>

					<h5 class="left-nav-title">Account Information</h5>
					<ul class="nav nav-pills nav-stacked custom-nav">
						<li><a href="EditProfile.php"><i class="fa fa-user"></i> <span>Profile</span></a></li>
						<li><a href="changePassword.php"><i class="fa fa-cog"></i> <span>Settings</span></a></li>
						<li><a href="SignOut.php"><i class="fa fa-sign-out"></i> <span>SignOut</span></a></li>
					</ul>
				</div>

				<?php
					include("include/sideNav.php");
				?>

			</div>
		</div>
		<!-- left side end-->

		<!-- main content start-->
		
		<div class="main-content">

			<!-- header section start-->
			<div class="header-section">

				<!--toggle button start-->
				<a class="toggle-btn"><i class="fa fa-bars"></i></a>
				<!--toggle button end-->

				<!--search start-->
				<!-- <form class="searchform" action="index.html" method="post">
					<input type="text" class="form-control" name="keyword"
						placeholder="Search here..." />
				</form> -->
				<!--search end-->

				<!--notification menu start -->
				<div class="menu-right">
					<ul class="notification-menu">
						
						
						
							
						<li><a href="#" class="btn btn-default dropdown-toggle"
							data-toggle="dropdown">  Admin <span
								class="caret"></span>
						</a>
							<ul class="dropdown-menu dropdown-menu-usermenu pull-right">
								<li><a href="EditProfile.php"><i class="fa fa-user"></i> Profile</a></li>
								<li><a href="changePassword.php"><i class="fa fa-cog"></i> Settings</a></li>
								<li><a href="SignOut.php" data-toggle="model" data-target="#mymodel"><i
										class="fa fa-sign-out"></i> Log Out</a></li>
							</ul>
						</li>

					</ul>
				</div>
				<!--notification menu end -->

			</div>
			<!-- header section end-->


			
			<div class="container">

				<div class="modal fade" id="mymodal" role="dialog">
					<form action="go" method="post" id="mymodel">
						<div class="modal-dialog">

							<!-- Modal content-->
							<div class="modal-content">
								<div class="modal-header">
									<button type="button" class="close" data-dismiss="modal">&times;</button>
									<h4 class="modal-title">Logout Confirmation</h4>
								</div>
								<div class="modal-body">
									<p>Are you sure want to Sign out!</p>
								</div>
								<div class="modal-footer">
									<button autofocus="autofocus" type="submit"
										class="btn btn-default ">Yes</button>
									<button type="button" class="btn btn-default"
										data-dismiss="modal">No</button>
								</div>
							</div>

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

			</div>


			<!-- logout popup ends-->

			

			 <!--body wrapper start-->
        <div class="wrapper">
            	<div class="row mt">
						<div class="col-lg-12">
							<?php
								if($success != "")
								{
									echo "<div class='alert alert-success alert-dismissable'>
								  <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
								  <strong>SUCCESS!&nbsp;&nbsp;&nbsp; </strong> $success</div>";
								}
								if($failure != "")
								{
									echo "<div class='alert alert-danger alert-dismissable'>
								  <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
								  <strong>Warning!&nbsp;&nbsp;&nbsp; </strong>$failure</div>";
								}
							?>
							
							<div class = "panel panel-primary">
							<div class="panel-heading" style="background-color:#AA1864;border-radius:8px;">View Filess</div>
								<div class = "panel-body">
									
									
											<div class = "row">
												<div class = "col-md-6">
													<div class="form-group">
														<a class="btn btn-primary" href="add_file.php">ADD Files</a>
														<span class="alert-danger"></span>
													</div>		
												</div>
												<div class = "col-md-6" >
													<form action="" class="form-inline adminex-form" method="get">
													<div class="form-group">
														<select name="year" id="year" class="form-control">
															<option value="2018">2018</option>
															<option value="2017">2017</option>
															<option value="2016">2016</option>
														</select>
														<input type="submit" class="form-control" name="submit" value="submit">
													</div>
													</form>	
												</div>													
											</div>		
														
											
												<div class="table-responsive">
													<div class="adv-table">
        											<table  class="display table table-bordered table-striped" id="dynamic-table">
													<?php
															//echo $totalRecords;
															//$totalRecords =0;
															if($totalRecords > 0)
															{
														?>
														<thead>
															<tr>
																<th><span style="color:green;"> Id</span></th>
																<th><span style="color:green;"> File Type</span></th>
																<th><span style="color:green;">File Name</span></th>
																<th><span style="color:green;">Posted Date</span></th>
																<th><span style="color:green;">Date</span></th>
																<!-- <th><span style="color:green;">Sub-Main Title</span></th>
																
																<th><span style="color:green;">Facebook</span></th> -->
																
																
																<!-- <th><span style="color:green;">Update</span></th>
																<th><span style="color:green;">Delete</span></th> -->
															</tr>									
														</thead>
														<tbody>
														
														<?php 
													
													while($row = mysql_fetch_array($recordSet1))
													{
														$id = $row["id"];
														$file_name = $row["file_name"];
														$cur_date = $row["cur_date"];
														$date = $row["date"];
														$extention = explode('.', $file_name);
														$ext = end($extention);
														echo "<tr>";
															
															echo "<td>$id</td>";
															$str = convert_uuencode($id);
															//echo $str."<br>";
															echo "<td>";
															if($ext == 'pdf'):
																echo "<img src='../icons/pdf.png' class='img-thumbnail' width='50px;' height='30px;'>";
															elseif($ext == 'doc' || $ext == 'docx'):
																echo "<img src='../icons/doc.png' class='img-thumbnail' width='50px;' height='30px;'>";
															elseif($ext == 'xls' || $ext == 'xlsx'):
																echo "<img src='../icons/xls.png' class='img-thumbnail' width='50px;' height='30px;'>";

															endif;
															echo "</td>";
															echo "<td><a href = '$file_name'>STOCK POSITION AS ON $cur_date</a></td>";
															
															echo "<td>$cur_date</td>";
															
															echo "<td>$date</td>";
															
															
																
															
																
																//echo "<td>$facebook</td>";
																
																
															
															
																//echo "<td><a href = 'editAlerts.php?add_alerts_id=".$add_alerts_id."' class ='btn btn-success'>EDIT</a></td>";
															
															//echo "<td><a href = 'deleteAlerts.php?add_alerts_id=".$str."' class ='btn btn-danger'>DELETE</a></td>";
														echo "</tr>";
													}
													?>
														</tbody>
														<tfoot>
        <tr>
            <th><span style="color:green;"> Alerts Id</span></th>
            <th><span style="color:green;"> File Type</span></th>
																<th><span style="color:green;">File Name</span></th>
																<th><span style="color:green;">Posted Date</span></th>
																<th><span style="color:green;">Date</span></th>
																<!-- <th><span style="color:green;">Sub-Main Title</span></th>
																
																<th><span style="color:green;">Facebook</span></th> -->
																
																
																<!-- <th><span style="color:green;">Update</span></th>
																<th><span style="color:green;">Delete</span></th> -->
        </tr>
        </tfoot>
														<?php
															}
														else
														{
															echo "<p class='text-center' style='font-weight:bold;'>No Records Found!</p>";
															
														}?>
													</table>
												</div>
											
										
										</div>
									</div>	
								</div>
							
						</div>
					</div>				
        </div>
        <!--body wrapper end-->



			<!--footer section start-->
			<!-- <footer> 2016 &copy; Avyayasolutions </footer> -->
			
			<!--footer section end-->

     
		</div>



		<!-- main content end-->
	</section>

	<!-- Placed js at the end of the document so the pages load faster -->
	<script src="js/jquery-1.10.2.min.js"></script>
	<script src="js/jquery-ui-1.9.2.custom.min.js"></script>
	<script src="js/jquery-migrate-1.2.1.min.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/modernizr.min.js"></script>
	<script src="js/jquery.nicescroll.js"></script>

	

	<!--dynamic table-->
<script type="text/javascript" language="javascript" src="js/advanced-datatable/js/jquery.dataTables.js"></script>
<script type="text/javascript" src="js/data-tables/DT_bootstrap.js"></script>
<!--dynamic table initialization -->
<script src="js/dynamic_table_init.js"></script>

<!--common scripts for all pages-->
<script src="js/scripts.js"></script>


</body>
</html>
