<?php 
include('header.php'); 


?>
  
  

      
     <section id="main-content">
        <section class="wrapper">
		 
			  
              <div class="row">
                  <div class="col-lg-12">
                      <section class="panel">
                          <header class="panel-heading">
                              <b>MANAGE PAGES
                             </b>
						  </header>
                          <div class="panel-body">
                          
 <?php
if(isset($msg)){
	print "<font color=\"blue\">$msg</font>";
}
?>                         
          
          
         
                           
                          
                        <div class="form">
                        

                                  <form class="form-validate form-horizontal" method="POST" action="page.php" enctype="multipart/form-data">
                                  
<div class="form-group ">
                                          <label for="cname" class="control-label col-lg-2">Page name<span class="required">*</span></label>
                                          <div class="col-lg-5">
                                          <select name="page" class="form-control" onchange="form.submit()">
                                          		<option>select</option>
                                          		<?php
                                          		/*
                                          		$page_array = array("home","email","phone","contact-location","contact-person","who-we-are","brand-experience","our-vision","our-mission","about-us", "we-love-brand", "policy");
                                          		foreach($page_array as $value) {
												  if((isset($_POST['page']))&&($_POST['page']==$value)){
												  	print "<option selected=\"selected\">$value</option>";
												  }else{
												  	print "<option>$value</option>";
												  }
												}    
												*/
												
												$query  = "SELECT * FROM page_tbl ORDER BY page_name";	
												$result = mysqli_query($conn, $query) or die(mysqli_error($conn));	
												
												while($info = mysqli_fetch_array($result))
												{
												 		 
													$id=$info['id'];
													$text=$info['page_name'];
													
														if((isset($_POST['page']))&&($_POST['page']==$text)){
														  	print "<option selected=\"selected\">$text</option>";
														  }else{
														  	print "<option>$text</option>";
														  }
													
												}
				
												                                      		
												?>
                                                
                                          </select>
												
                                          </div>
                                      </div>
                                     <br/>
                                    
                                    </form>                        
                        
<?php
if(isset($_POST['page'])){
	
	$page = mysqli_escape_string($conn, $_POST['page']);
	
	$query5  = "SELECT * FROM page_tbl WHERE  page_name ='$page'";	
	$result5 = mysqli_query($conn, $query5) or die(mysqli_error($conn));	
	
	$info5 = mysqli_fetch_array($result5);
	$p_id=$info5['id'];
	$text=$info5['text'];
	#$text=ereg_replace("<br />","", $text);
	$img=$info5['img']; 
	
		
		if($page == 'programme1_annual_reunion' || $page == 'programme2_webinar_series' || $page == 'programme3_ramadan' || $page == 'programme4_business_seminar'  || $page == 'programme5_housing' || $page == 'programme6_savings'  || $page == 'programme7_welfare'  || $page == 'programme8_scholarship'){
			print "<p align='center'><a href=\"more.php?art=$page\">Add/Change Images</a>";
			
						$query  = "SELECT * FROM post_more_picture WHERE art_id = '$page' ORDER BY id DESC";
						$result = mysqli_query($conn,$query) or die(mysqli_error($conn));

						$info = mysqli_fetch_array($result);
								 
							$id=$info['id'];
							$filename=$info['filename'];
							$detail=$info['detail'];
							
							if($filename != ""){
								print "<br/><img src=\"piks/$filename\" width='300'>";
							}
								
			print "</p>";				
		}
		
											
?>                        
                                  <form class="form-validate form-horizontal" method="POST" action="page_updated.php" enctype="multipart/form-data">

<!--                                  
                         <div class="form-group ">
                                          <label for="cname" class="control-label col-lg-2">Picture (Optional)</label>
                                          <div class="col-lg-5">
                                             
                                              <input class="form-control" name="userfile" type="file" id="userfile" />Max Size: 300kb,  Format: PNG, BMP, GIV, JPG or JPEG
                                              <br/>
<?php
if($img != ""){
	print "<img src=\"piks/$img\" width=\"200\">";
}
?>                                             
                  
                                          </div>
                                    </div>
                                    
-->                                                                                    
                                	                                                                           


                                      
                                      <div class="form-group ">
                                          <label for="curl" class="control-label col-lg-2">text <span class="required">*</span> </label>
                                          <div class="col-lg-10">
                                              <textarea class="form-control" name="message" rows="15" id="comment" required ><?php print $text; ?></textarea>
                                          </div>
                                      </div>
                                      
                                                                     
                                                                           
                                      <div class="form-group">
                                          <div class="col-lg-offset-2 col-lg-10">
                                          <input type="hidden" name="page_id" value="<?php print $p_id; ?>"  />                                          <input type="hidden" name="img_name" value="<?php print $img; ?>"  />
                                              <button class="btn btn-primary" type="submit">Update</button>
                                             
              <input type="hidden" name="action" value="do_upload" />
                                          </div>
                                      </div>
                                      
                                     
                                  </form>
<?php
}
?>                                  
                                  
                                  

                          </div>
                      </section>
                  </div>
              </div>
                  
              <!-- project team & activity end -->

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

    <!-- javascripts -->
    <script src="js/jquery.js"></script>
	<script src="js/jquery-ui-1.10.4.min.js"></script>
    <script src="js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.9.2.custom.min.js"></script>
    <!-- bootstrap -->
    <script src="js/bootstrap.min.js"></script>
    <!-- nice scroll -->
    <script src="js/jquery.scrollTo.min.js"></script>
    <script src="js/jquery.nicescroll.js" type="text/javascript"></script>
    <!-- charts scripts -->
    <script src="assets/jquery-knob/js/jquery.knob.js"></script>
    <script src="js/jquery.sparkline.js" type="text/javascript"></script>
    <script src="assets/jquery-easy-pie-chart/jquery.easy-pie-chart.js"></script>
    <script src="js/owl.carousel.js" ></script>
    <!-- jQuery full calendar -->
    <<script src="js/fullcalendar.min.js"></script> <!-- Full Google Calendar - Calendar -->
	<script src="assets/fullcalendar/fullcalendar/fullcalendar.js"></script>
    <!--script for this page only-->
    <script src="js/calendar-custom.js"></script>
	<script src="js/jquery.rateit.min.js"></script>
    <!-- custom select -->
    <script src="js/jquery.customSelect.min.js" ></script>
	<script src="assets/chart-master/Chart.js"></script>
   
    <!--custome script for all page-->
    <script src="js/scripts.js"></script>
    <!-- custom script for this page-->
    <script src="js/sparkline-chart.js"></script>
    <script src="js/easy-pie-chart.js"></script>
	<script src="js/jquery-jvectormap-1.2.2.min.js"></script>
	<script src="js/jquery-jvectormap-world-mill-en.js"></script>
	<script src="js/xcharts.min.js"></script>
	<script src="js/jquery.autosize.min.js"></script>
	<script src="js/jquery.placeholder.min.js"></script>
	<script src="js/gdp-data.js"></script>	
	<script src="js/morris.min.js"></script>
	<script src="js/sparklines.js"></script>	
	<script src="js/charts.js"></script>
	<script src="js/jquery.slimscroll.min.js"></script>
    
    <!-- custom chart script for this page only-->
    <script src="js/chartjs-custom.js"></script>
    
  <script>

      //knob
      $(function() {
        $(".knob").knob({
          'draw' : function () { 
            $(this.i).val(this.cv + '%')
          }
        })
      });

      //carousel
      $(document).ready(function() {
          $("#owl-slider").owlCarousel({
              navigation : true,
              slideSpeed : 300,
              paginationSpeed : 400,
              singleItem : true

          });
      });

      //custom select box

      $(function(){
          $('select.styled').customSelect();
      });
	  
	  /* ---------- Map ---------- */
	$(function(){
	  $('#map').vectorMap({
	    map: 'world_mill_en',
	    series: {
	      regions: [{
	        values: gdpData,
	        scale: ['#000', '#000'],
	        normalizeFunction: 'polynomial'
	      }]
	    },
		backgroundColor: '#eef3f7',
	    onLabelShow: function(e, el, code){
	      el.html(el.html()+' (GDP - '+gdpData[code]+')');
	    }
	  });
	});



  </script>

  </body>
</html>
