<?php
    include('object.php');
?>
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->

<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
	<meta charset="utf-8">

	<link rel="dns-prefetch" href="http://fonts.googleapis.com" />
	<link rel="dns-prefetch" href="http://themes.googleusercontent.com" />
	
	<link rel="dns-prefetch" href="http://ajax.googleapis.com" />
	<link rel="dns-prefetch" href="http://cdnjs.cloudflare.com" />
	<link rel="dns-prefetch" href="http://agorbatchev.typepad.com" />
	
	<!-- Use the .htaccess and remove these lines to avoid edge case issues.
	   More info: h5bp.com/b/378 -->
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	
	<title>Profile - Student Portal</title>
	<meta name="description" content="Mango is a slick and responsive Admin Template build with modern techniques like HTML5 and CSS3 to be used for backend solutions of any size.">
	<meta name="author" content="Simon Stamm & Markus Siemens">

	<!-- Mobile viewport optimized: h5bp.com/viewport -->
	<meta name="viewport" content="width=device-width,initial-scale=1">
	<!-- iPhone: Don't render numbers as call links -->
	<meta name="format-detection" content="telephone=no">
	
	<link rel="shortcut icon" href="favicon.ico" />
	<!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->
	<!-- More ideas for your <head> here: h5bp.com/d/head-Tips -->
	
	
	
	
	
	
	
	<!-- The Styles -->
	<!-- ---------- -->
	
	<!-- Layout Styles -->
	<link rel="stylesheet" href="css/style.css">
	<link rel="stylesheet" href="css/grid.css">
	<link rel="stylesheet" href="css/layout.css">
	
	<!-- Icon Styles -->
	<link rel="stylesheet" href="css/icons.css">
	<link rel="stylesheet" href="css/fonts/font-awesome.css">
	<!--[if IE 8]><link rel="stylesheet" href="css/fonts/font-awesome-ie7.css"><![endif]-->
	
	<!-- External Styles -->
	<link rel="stylesheet" href="css/external/jquery-ui-1.8.21.custom.css">
	<link rel="stylesheet" href="css/external/jquery.chosen.css">
	<link rel="stylesheet" href="css/external/jquery.cleditor.css">
	<link rel="stylesheet" href="css/external/jquery.colorpicker.css">
	<link rel="stylesheet" href="css/external/jquery.elfinder.css">
	<link rel="stylesheet" href="css/external/jquery.fancybox.css">
	<link rel="stylesheet" href="css/external/jquery.jgrowl.css">
	<link rel="stylesheet" href="css/external/jquery.plupload.queue.css">
	<link rel="stylesheet" href="css/external/syntaxhighlighter/shCore.css" />
	<link rel="stylesheet" href="css/external/syntaxhighlighter/shThemeDefault.css" />
	
	<!-- Elements -->
	<link rel="stylesheet" href="css/elements.css">
	<link rel="stylesheet" href="css/forms.css">
	
	<!-- OPTIONAL: Print Stylesheet for Invoice -->
	<link rel="stylesheet" href="css/print-invoice.css">
	
	<!-- Typographics -->
	<link rel="stylesheet" href="css/typographics.css">
	
	<!-- Responsive Design -->
	<link rel="stylesheet" href="css/media-queries.css">
	
	<!-- Bad IE Styles -->
	<link rel="stylesheet" href="css/ie-fixes.css">
	
	
	
	
	
	
	
	<!-- The Scripts -->
	<!-- ----------- -->
	
	
	<!-- JavaScript at the top (will be cached by browser) -->
	
	<!-- Load Webfont loader -->
	<script type="text/javascript">
		window.WebFontConfig = {
			google: { families: [ 'PT Sans:400,700' ] },
			active: function(){ $(window).trigger('fontsloaded') }
		};
	</script>
	<script defer async src="https://ajax.googleapis.com/ajax/libs/webfont/1.0.28/webfont.js"></script>
	
	<!-- Essential polyfills -->
	<script src="js/mylibs/polyfills/modernizr-2.6.1.min.js"></script>
	<script src="js/mylibs/polyfills/respond.js"></script>
	<script src="js/mylibs/polyfills/matchmedia.js"></script>
	<!--[if lt IE 9]><script src="js/mylibs/polyfills/selectivizr.js"></script><![endif]-->
	<!--[if lt IE 10]><script src="js/mylibs/polyfills/excanvas.js"></script><![endif]-->
	<!--[if lt IE 10]><script src="js/mylibs/polyfills/classlist.js"></script><![endif]-->
	
	
	
	<!-- Grab frameworks from CDNs -->
		<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script>
	<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.2.js"><\/script>')</script>
	
		<!-- Do the same with jQuery UI -->
	<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.js"></script>
	<script>window.jQuery.ui || document.write('<script src="js/libs/jquery-ui-1.8.21.js"><\/script>')</script>
	
		<!-- Do the same with Lo-Dash.js -->
	<!--[if gt IE 8]><!-->
	<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.4.2/lodash.js"></script>
	<script>window._ || document.write('<script src="js/libs/lo-dash.js"><\/script>')</script>
	<!--<![endif]-->
	<!-- IE8 doesn't like lodash -->
	<!--[if lt IE 9]><script src="http://documentcloud.github.com/underscore/underscore.js"></script><![endif]-->
	
	
	
	<!-- scripts concatenated and minified via build script -->
	
	<!-- General Scripts -->
	<script src="js/mylibs/jquery.hashchange.js"></script>
	<script src="js/mylibs/jquery.idle-timer.js"></script>
	<script src="js/mylibs/jquery.plusplus.js"></script>
	<script src="js/mylibs/jquery.jgrowl.js"></script>
	<script src="js/mylibs/jquery.scrollTo.js"></script>
	<script src="js/mylibs/jquery.ui.touch-punch.js"></script>
	<script src="js/mylibs/jquery.ui.multiaccordion.js"></script>
	<script src="js/mylibs/number-functions.js"></script>
	
	<!-- Forms -->
	<script src="js/mylibs/forms/jquery.autosize.js"></script>
	<script src="js/mylibs/forms/jquery.checkbox.js"></script>
	<script src="js/mylibs/forms/jquery.chosen.js"></script>
	<script src="js/mylibs/forms/jquery.cleditor.js"></script>
	<script src="js/mylibs/forms/jquery.colorpicker.js"></script>
	<script src="js/mylibs/forms/jquery.ellipsis.js"></script>
	<script src="js/mylibs/forms/jquery.fileinput.js"></script>
	<script src="js/mylibs/forms/jquery.fullcalendar.js"></script>
	<script src="js/mylibs/forms/jquery.maskedinput.js"></script>
	<script src="js/mylibs/forms/jquery.mousewheel.js"></script>
	<script src="js/mylibs/forms/jquery.placeholder.js"></script>
	<script src="js/mylibs/forms/jquery.pwdmeter.js"></script>
	<script src="js/mylibs/forms/jquery.ui.datetimepicker.js"></script>
	<script src="js/mylibs/forms/jquery.ui.spinner.js"></script>
	<script src="js/mylibs/forms/jquery.validate.js"></script>
	<script src="js/mylibs/forms/uploader/plupload.js"></script>
	<script src="js/mylibs/forms/uploader/plupload.html5.js"></script>
	<script src="js/mylibs/forms/uploader/plupload.html4.js"></script>
	<script src="js/mylibs/forms/uploader/plupload.flash.js"></script>
	<script src="js/mylibs/forms/uploader/jquery.plupload.queue/jquery.plupload.queue.js"></script>
		
	<!-- Charts -->
	<script src="js/mylibs/charts/jquery.flot.js"></script>
	<script src="js/mylibs/charts/jquery.flot.orderBars.js"></script>
	<script src="js/mylibs/charts/jquery.flot.pie.js"></script>
	<script src="js/mylibs/charts/jquery.flot.resize.js"></script>
	
	<!-- Explorer -->
	<script src="js/mylibs/explorer/jquery.elfinder.js"></script>
	
	<!-- Fullstats -->
	<script src="js/mylibs/fullstats/jquery.css-transform.js"></script>
	<script src="js/mylibs/fullstats/jquery.animate-css-rotate-scale.js"></script>
	<script src="js/mylibs/fullstats/jquery.sparkline.js"></script>
	
	<!-- Syntax Highlighter -->
	<script src="js/mylibs/syntaxhighlighter/shCore.js"></script>
	<script src="js/mylibs/syntaxhighlighter/shAutoloader.js"></script>
	
	<!-- Dynamic Tables -->
	<script src="js/mylibs/dynamic-tables/jquery.dataTables.js"></script>
	<script src="js/mylibs/dynamic-tables/jquery.dataTables.tableTools.zeroClipboard.js"></script>
	<script src="js/mylibs/dynamic-tables/jquery.dataTables.tableTools.js"></script>
	
	<!-- Gallery -->
	<script src="js/mylibs/gallery/jquery.fancybox.js"></script>
	
	<!-- Tooltips -->
	<script src="js/mylibs/tooltips/jquery.tipsy.js"></script>
	
	<!-- Do not touch! -->
	<script src="js/mango.js"></script>
	<script src="js/plugins.js"></script>
	<script src="js/script.js"></script>
	
	<!-- Your custom JS goes here -->
	<script src="js/app.js"></script>
	
</head>

<body>

<?php
      include('connect.php');
      
	  include('session.php');
	  
	  $pageid = 'academic_year';
	  
	  $time = time();
	  $year = date('Y',$time);

	  $y = isset($_POST['y'])? $_POST['y']:$year;
  ?>

	<!----------------------->
	<!-- Some dialogs etc. -->

	<!-- The loading box -->
	<div id="loading-overlay"></div>
	<div id="loading">
		<span>Loading...</span>
	</div>
	<!-- End of loading box -->
	<?php
		$acayear = isset($_POST['acayear']) ? $_POST['acayear']:'';
		$acaterm = isset($_POST['acaterm']) ? $_POST['acaterm']:'';
		$acasdate = isset($_POST['acasdate']) ? $_POST['acasdate']:'';
		$acaedate = isset($_POST['acaedate']) ? $_POST['acaedate']:'';
		$department = isset($_POST['department']) ? $_POST['department']:'';
		
		$deleteacayear = isset($_POST['deleteacayear']) ? $_POST['deleteacayear']:'';
	?>
	
	<!-- Add Academic Year Dialog -->
	<div style="display: none;" id="dialog_add_client" title="Add Academic Year">
		<form action="academicyear.php" method="POST" class="full validate">
			<div class="row">
				<label for="acayear">
					<strong>Academic Year</strong>
				</label>
				<div class="block">
					<div>
						<input type="text"  name="acayear" class="required" id="acayear" />
					</div>
				</div>
			</div>
			<div class="row">
				<label for="acaterm">
					<strong>Term</strong>
				</label>
					<div class="block">
						<select id="acaterm" name="acaterm">
						<option></option>
						<option>T1</option>
						<option>T2</option>
						<option>T3</option>
						</select>
					</div>
			</div>
			<div class="row">
				<label for="acasdate">
					<strong>Start Date</strong>
				</label>
				<div class="block">
					<div>
						<input type="date" name="acasdate" class="required" id="acasdate" />
					</div>
				</div>
			</div><div class="row">
				<label for="acaedate">
					<strong>End Date</strong>
				</label>
				<div class="block">
					<div>
						<input type="date" name="acaedate" class="required" id="acaedate" />
					</div>
				</div>
			</div><div class="row">
				<label for="department">
					<strong>Department</strong>
				</label>
				<div class="block">
					<select id="department" name="department" class="search required" class="block">
						<?php
							$query2 = "SELECT DISTINCT (department_name) FROM courses";
							$subject_set2 = mysqli_query($connection,$query2);
								//4. Use return data

							while($row2 = mysqli_fetch_array($subject_set2))
							{?>
								 <option <?php if($department == $row2['department_name']) echo 'selected="selected"'; ?> ><?php echo $row2['department_name']; ?></option>
							<?php
							}
						?>
					</select>
				</div>
			</div>
			
			<div class="row">
				<div class="block">
					<button class="block" name="save" class="submit">Save</button>
				</div>
			</div>
		</form>
	</div><!-- End if #dialog_add_client -->
	
	<script>
	$$.ready(function() {
		$( "#dialog_add_client" ).dialog({
			autoOpen: false,
			modal: true,
			width: 400,
			open: function(){ $(this).parent().css('overflow', 'visible'); $$.utils.forms.resize() }
		}).find('button.submit').click(function(){
			var $el = $(this).parents('.ui-dialog-content');
			if ($el.validate().form()) {
				$el.find('form')[0].reset();
				$el.dialog('close');
			}
		}).end().find('button.cancel').click(function(){
			var $el = $(this).parents('.ui-dialog-content');
			$el.find('form')[0].reset();
			$el.dialog('close');;
		});
		
		$( ".open-add-client-dialog" ).click(function() {
			$( "#dialog_add_client" ).dialog( "open" );
			return false;
		});
	});
	</script>
	<!--  End of Add Client Example Dialog -->
	
	<script>
	$$.ready(function() {
		$( "#dialog_message" ).dialog({
			autoOpen: false,
			width: 500,
			modal: true
		}).find('button').click(function(){
			$(this).parents('.ui-dialog-content').dialog('close');
		});
		
		$( ".open-message-dialog" ).click(function() {
			$( "#dialog_message" ).dialog( "open" );
			return false;
		});
	});
	</script>
	<!-- End of Message Dialog -->
	
	<!--------------------------------->
	<!-- Now, the page itself begins -->
	<!--------------------------------->
	
	<!-- The toolbar at the top -->
	<?php include('topmenu.php'); ?>
	<!-- End of #toolbar -->
	
	<!-- The header containing the logo -->
	<?php include('middlemenu.php'); ?>
	<!-- End of header -->
	
	<!-- The container of the sidebar and content box -->
	<div role="main" id="main" class="container_12 clearfix">
	
		<!-- The blue toolbar stripe -->
		<?php include('menu_profile.php'); ?>
		<!-- End of .toolbar-->
		
		<!-- The sidebar -->
		<aside>
			<div class="top">
			
				<!-- Navigation -->
				<?php include('nav.php'); ?>
				<!-- End of nav -->			
			</div><!-- End of .top -->
			
		</aside><!-- End of sidebar -->

		<!-- Here goes the content. -->
		<section id="content" class="container_12 clearfix" data-sort=true>
			<div class="grid_12 profile">
				
				<div class="details grid_6">
					<a class="open-add-client-dialog" href="javascript:void(0);"><i class="icon-plus"></i>  New Academic Year</a>
				</div><!-- End of .details -->
				
				<div class="details grid_6">
					<a class="open-profile-dialog" href="javascript:void(0);"><span class="icon icon-minus"></span>Delete Academic Year</a>
				</div><!-- End of .details -->
				
				<div class="clearfix"></div>
				<div class="divider"></div>
			
				<!-- Example Profile Dialog -->							
				<div style="display: none;" id="profile-dialog" title="Delete Academic Year">
				
					<form action="" class="full validate">
						<div class="row">
							<label for="d1_select">
								<strong>Academic Year</strong>
							</label>
							<div style="padding-bottom: 10px">
								<select name="deleteacayear" id=d1_select class="search required">
									<option value="once">Once</option>
									<option value="multi_month">Multi-month</option>
									<option value="forever">Forever</option>
								</select>
							</div>
						</div>
						<div class="row">
							<div class="right">
								<button class="submit">Submit</button>
							</div>
						</div>
					</form>
				</div><!-- End of #profile-dialog -->
				
			</div>
			
			<div class="grid_12">
				<div class="content">
					
						<table class="dynamic styled" data-filter-Bar="always" data-table-tools='{"display":false}'>
		                    <thead>
		                        <tr>
									<th>ID</th>
		                            <th>Year</th>
		                            <th>Term</th>
		                            <th>Begining</th>
		                            <th>Endining</th>
		                            <th>Department</th>
		                        </tr>
		                    </thead>
		                    
		                    <tbody>
		                        <?php

		                            $query2 = "SELECT * from academicyear";
		                                $subject_set2 = mysqli_query($connection,$query2); 
		                                    //4. Use return data

		                                while($row2 = mysqli_fetch_array($subject_set2)) 
		                                {
		                                    echo $output=
		                                        '<tr onclick="javascript:showRow(this);">
		                                        <td>'.$row2["AcaID"].'</td>
		                                        <td>'.$row2["AcaYear"].'</td>
		                                        <td>'.$row2["AcaTerm"].'</td>
		                                        <td>'.$row2["AcaStartDate"].'</td>
		                                        <td>'.$row2["AcaEndDate"].'</td>
		                                        <td>'.$row2["Department"].'</td>
		                                        </tr>';
		                                }
		                        ?>
									</tbody>
							</table>
					</div><!-- End of .content -->
			</div>
				
			<script>
				$$.ready(function() {				
				// Profile Dialog
				
				$( "#profile-dialog" ).dialog({
					autoOpen: false,
					modal: true,
					width: 400,
					open: function(){ $(this).parent().css('overflow', 'visible'); $$.utils.forms.resize() }
				}).find('button.submit').click(function(){
					var $el = $(this).parents('.ui-dialog-content');
					if ($el.validate().form()) {
						$el.dialog('close');
					}
				}).end().find('button.cancel').click(function(){
					var $el = $(this).parents('.ui-dialog-content');
					$el.find('form')[0].reset();
					$el.dialog('close');;
				});
				
				$( ".open-profile-dialog" ).click(function() {
					$( "#profile-dialog" ).dialog( "open" );
					return false;
				});
			});
			</script>
		</section><!-- End of #content -->
		
	</div><!-- End of #main -->
	
	<!-- The footer -->
	<footer class="container_12">
		<ul class="grid_6">
			<li><a href="#">About</a></li>
			<li><a href="#">Jobs</a></li>
			<li><a href="#">@StammTec.de</a></li>
		</ul>
		
		<span class="grid_6">
			Copyright &copy; 2012 YourCompany
		</span>
	</footer><!-- End of footer -->
	
	<!-- Spawn $$.loaded -->
	<script>
		$$.loaded();
	</script>
	
	<!-- Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6.
	   chromium.org/developers/how-tos/chrome-frame-getting-started -->
	<!--[if lt IE 7 ]>
	<script defer src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
	<script defer>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
	<![endif]-->

</body>
</html>