<?php
error_reporting(0);
ob_start();
session_start();
include_once("../dbconnect.php");
?>
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
     <style type="text/css">

      /* Sticky footer styles
      -------------------------------------------------- */

     

    </style>
<?php include_once("title.php"); ?>

    <!-- Bootstrap Core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/main.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="css/logo-nav.css" rel="stylesheet">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>
     <div id="wrap">
    <!-- Navigation -->
       <?php include_once("header.php"); ?>

    <!-- Page Content -->
    <div class="container">
        <div class="row">
            <div class="col-lg-12">

                 
                <br> <br> <br><br>
                <h1 style="text-align: center;"><?php if($_GET['mec_g_id']==1){ ?>Daily And Weekly Specials<?php } ?>
            </h1>
<?php
if($_GET['action']=="addnew")
{
?>
                <div class="row">
        <div class="col-lg-12">
        <form class="form-horizontal" action="ginsert.php?action=add" method="post" enctype="multipart/form-data">
<fieldset>

<!-- Form Name -->
<legend>Add New</legend>

<!-- File Button --> 

<div class="form-group">
  <label class="col-md-6 control-label" style="float: left" for="Image">Image :</label>
  <div class="col-md-6"><input id="Image" name="mec_image" class="input-file" type="file">
</div><br>
  <!--  <div class="clearfix"></div>
    <?php if($_GET['mec_g_id']==1){ ?>
  <label class="col-md-6 control-label" style="float: left" for="Image">Name :</label>
  <div class="col-md-6"><input id="Image" name="mec_name" class="input-file" type="text"></div>
<?php } ?>
    <br>
    <div class="clearfix"></div>-->

  
 <!-- <div class="form-group">
  <label class="col-md-4 control-label" for="textarea">Description</label>
  <div class="col-md-8"> 
  <script src="//cdn.ckeditor.com/4.5.8/full/ckeditor.js"></script>                    
    <textarea class="form-control" id="textarea" name="mec_description"></textarea>
    <script>
            CKEDITOR.replace( 'mec_description' );
        </script>
  </div>
</div>
  <br>
  <br>-->
  <div class="clearfix"></div>
  <input type="submit" style="margin-left: auto; margin-right: auto; display: block;" class="btn btn-primary btn-lrg" value="Submit"/>
</div>
</fieldset>
<input type="hidden" name="mec_g_id" value="<?php echo $_GET['mec_g_id']; ?>">
</form>
        </div>
    </div>
<?php } ?>
<?php
if($_GET['action']=="update")
{
?>
  <?php
					$update=mysql_query("select * from mec_gallery where mec_p_id=".$_GET['mec_p_id']);
				$update1=mysql_fetch_array($update);
					?>
                <div class="row">
        <div class="col-lg-12">
        <form class="form-horizontal" action="ginsert.php?action=edit" method="post" enctype="multipart/form-data">
<fieldset>

<!-- Form Name -->
<legend>Edit <?php echo $update1['mec_name']; ?></legend>

<!-- File Button --> 
<div class="form-group">
  <label class="col-md-6 control-label" style="float: left" for="Image">Image :</label>
  <div class="col-md-6"><input id="Image" name="mec_image" class="input-file" type="file"><img src="../products/gallery/<?php echo $update1['mec_p_id'];?>.jpg" style="width:50px; height:50px;">
</div><!--<br> <br>
    <div class="clearfix"></div>
    <?php if($_GET['mec_g_id']==1){ ?>
  <label class="col-md-6 control-label" style="float: left" for="Image">Name :</label>
  <div class="col-md-6"><input id="Image" name="mec_name" value="<?php echo $update1['mec_name']; ?>" class="input-file" type="text"></div>
<?php } ?>
    <br>-->
     <br>
    <div class="clearfix"></div>
<!--<div class="form-group">
  <label class="col-md-4 control-label" for="textarea">Description</label>
  <div class="col-md-8"> 
  <script src="//cdn.ckeditor.com/4.5.8/full/ckeditor.js"></script>                    
    <textarea class="form-control" id="textarea" name="mec_description"><?php echo stripslashes($update1['mec_description']); ?></textarea>
    <script>
            CKEDITOR.replace( 'mec_description' );
        </script>
  </div>
</div>
  <br>
  <br>-->
  <div class="form-group">
   <div class="col-md-4"> </div>
      <div class="col-md-4">
  <input type="submit" style="margin-left: auto; margin-right: auto; display: inline;" class="btn btn-primary btn-lrg" value="Submit"/>
  <a href="gallery.php?mec_g_id=<?php echo $_GET['mec_g_id'] ?>"><input type="button" style="margin-left: auto; margin-right: auto; display:inline;" class="btn btn-primary btn-lrg" value="Cancel"/></a></div>
     <div class="col-md-4"> </div>
  </div>
</div>
<input type="hidden" name="mec_g_id" value="<?php echo $_GET['mec_g_id']; ?>">
<input type="hidden" name="mec_p_id" value="<?php echo $_GET['mec_p_id']; ?>">

</fieldset>
</form>
        </div>
    </div>
<?php } ?>
                <div class="row">
            <div class="col-lg-12">

              <a href="gallery.php?action=addnew&mec_g_id=<?php echo $_GET['mec_g_id']; ?>"><button style="float: right" class="btn btn-primary btn-lg"><span class="glyphicon glyphicon-plus-sign"></span> Add New </button></a>

                <table class="table table-striped table-condensed">
                  <thead><tr><th>S No.</th><th style="text-align: center;"><?php if($_GET['mec_g_id']==3){ ?>Page Name <?php } else { ?>Name<?php } ?></th><th>Action</th><?php if($_GET['mec_g_id']==12){ ?><th>Set Order</th><?php } ?></tr></thead>
                    
                    <tbody>
                    <?php
					$farooq=mysql_query("select * from mec_gallery where mec_g_id=".$_GET['mec_g_id']." order by mec_setorder ASC");$i=1;
					while($pasha=mysql_fetch_array($farooq))
					{
					?>
                    <tr>
                        <td style="vertical-align: middle;"><?php echo $i; ?></td>
                        <td style="text-align: center"><?php if($_GET['mec_g_id']!=3 and $_GET['mec_g_id']!=4){ ?><img src="../products/gallery/<?php echo $pasha['mec_p_id'];?>.jpg" style="width:100px; height:100px;"><?php } else { ?><strong><?php echo $pasha['mec_name'];?></strong><?php } ?></td>
                        <td style="vertical-align: middle;"><a href="gallery.php?action=update&mec_g_id=<?php echo $_GET['mec_g_id']; ?>&mec_p_id=<?php echo $pasha['mec_p_id'];?>"><button class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-edit"></span> Edit</button> </a> <a href="ginsert.php?action=delete&mec_g_id=<?php echo $_GET['mec_g_id']; ?>&mec_p_id=<?php echo $pasha['mec_p_id']; ?>"><button class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-trash"></span> Delete</button></a> 
                        <!--<?php if($pasha['mec_status']==1){ ?>
                        <a href="ginsert.php?action=status&mec_g_id=<?php echo $_GET['mec_g_id']; ?>&mec_p_id=<?php echo $pasha['mec_p_id']; ?>&mec_status=0">
                        <button class="btn btn-success btn-sm active"><span class="glyphicon glyphicon-ok"></span> Active</button></a>
                        <?php } ?>
                        <?php if($pasha['mec_status']==0){ ?>
                         <a href="ginsert.php?action=status&mec_g_id=<?php echo $_GET['mec_g_id']; ?>&mec_p_id=<?php echo $pasha['mec_p_id']; ?>&mec_status=1">
                         <button class="btn btn-danger btn-sm disabled"><span class="glyphicon glyphicon-remove"></span> Disable</button>
                         </a>
                          <?php } ?>-->
                         
                         </td>
                        <?php if($_GET['mec_g_id']==12){ ?> <td style="vertical-align: middle;"><form action="setorder.php?mec_g_id=<?php echo $_GET['mec_g_id']; ?>&mec_p_id=<?php echo $pasha['mec_p_id']; ?>" method="post"><input type="text" style="width:80px; height:40px;" name="setorder" value="<?php echo $pasha['mec_setorder']; ?>"><input type="submit" value="Submit"></form><?php } ?></td>
                    </tr>
                    <?php $i++; } ?>
                        
                   <!-- <tr>
                        <td>cell is row 1, column 0</td><td>cell is row 1, column 1</td><td>cell is row 1, column 2</td>
                    </tr>
                        
                    <tr>
                        <td>cell is row 2, column 0</td><td>cell is row 2, column 1</td><td><button class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-edit"></span> Edit</button> <button class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-trash"></span> Delete</button> <button class="btn btn-success btn-sm active"><span class="glyphicon glyphicon-ok"></span> Active</button> <button class="btn btn-default btn-sm disabled"><span class="glyphicon glyphicon-remove"></span> Disable</button></td>
                    </tr>-->
                    </tbody>
                </table>
                </div></div>
                <br>

                
               
    </div>

        </div>

  

            </div>
            
         <div id="push"></div>
    </div>

     <?php include_once("footer.php"); ?>
   

    
    <!-- /.container -->

    <!-- jQuery -->
    <script src="js/jquery.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="js/bootstrap.min.js"></script>


</body>

</html>
