/
home
/
cicjhs
/
public_html
/
cicjhs_master
/
Upload File
HOME
<?php include("include/header1.php"); $_SESSION['page_menu']=array('website','gallery'); if(!empty($_POST['gal'])) { $obj->gallery(); } if(!empty($_POST['mul_del'])) { foreach($_POST['mul_del'] as $code) { $id= $code; $photo_sql= "SELECT gal_image FROM gallery WHERE gal_id='".$id."'"; $rs= mysqli_query($obj->mysqli,$photo_sql); $photo= mysqli_fetch_assoc($rs); if(is_file('upload/gallery/'.$photo['gal_image'])) { unlink('upload/gallery/'.$photo['gal_image']); } } $col= 'gal_id'; $table= 'gallery'; $page= 'gallery.php'; $img= "gal_image"; $path= "upload/gallery/"; $obj->delete_multiple($col,$table,$page,$path); } if(!empty($_REQUEST['edit'])) { $val= $_REQUEST['edit']; $row= $obj->getRecord('gallery','gal_id',$val); } ?> <!-- Left side column. contains the logo and sidebar --> <aside class="main-sidebar"> <!-- sidebar: style can be found in sidebar.less --> <section class="sidebar"> <!-- Sidebar user panel --> <!-- /.search form --> <!-- sidebar menu: : style can be found in sidebar.less --> <?php include ('include/sidebar.php'); ?> <?php include 'include/admin-menu.php'; ?> </section> <!-- /.sidebar --> </aside> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <?php if(!empty($_REQUEST['msg'])){ echo '<section class="content-header" id="error"> <div class="row"> <div class="col-md-12"> <div class="alert alert-success alert-dismissable" > <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <span><i class="icon fa fa-check"></i>'.$_REQUEST['msg'].'</span> </div> </div> </div> </section>'; } ?> <?php if(!empty($obj->errorMsg)){ ?> <section class="content-header" id="error"> <div class="row"> <div class="col-md-12"> <div class="alert alert-success alert-dismissable" > <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <span><i class="icon fa fa-check"></i><?php echo $obj->errorMsg; ?></span> </div> </div> </div> </section> <?php } ?> <section class="content-header"> <h1> Gallery Entry </h1> <div class="col-lg-12"> <ol class="breadcrumb"> <li><a href="admin-dashboard.php"><i class="fa fa-dashboard"></i> Dashboard</a></li> <li class="active"><a href="enquiry.php">Enquiry </a></li> <li class="active"> Gallery</li> </ol> </div> </section> <section class="content"> <div class="row"> <!-- left column --> <div class="col-md-12"> <div class="box box-primary"> <!-- form start --> <form role="form" action="" method="post" enctype="multipart/form-data" name="gallery_form" id="gallery_form" data-toggle="validator"> <div class="box-body"> <div class="col-sm-4 form-group"> <label for="exampleInputEmail1">Gallery Type</label> <select class="form-control" name="gal_type"> <?php if ($row['gal_type']) { echo "<option value='$row[gal_type]' selected>$row[gal_type]</option>"; } ?> <option>-- Select Type --</option> <option value="Event Gallery">Event Gallery</option> <option value="Media Gallery">Media Gallery</option> </select> </div> <div class="col-sm-8 form-group"> <label for="exampleInputEmail1">Gallery Title</label> <input type="text" class="form-control" name="gal_title" id="gal_title" placeholder="Enter a Title..." value="<?= isset($row)? $row['gal_title'] : ''?>" autocomplete="off" onKeyup="liveCapital(this)" onKeydown="liveCapital(this)"> </div> <div class="col-sm-12 form-group"> <label for="firstname">Gallery Image * <b class="text-danger">(Size: 245X215 px Max 300KB) And <?= isset($row)? 'Single' : 'Multiple'?> Image Upload </b></label> <?php if(isset($row)) { echo '<input type="file" class="form-control" accept="image/*" name="gal_image[]" id="gal_image" >'; }else{ echo '<input type="file" multiple class="form-control" accept="image/*" name="gal_image[]" required id="gal_image">'; } ?> <?php if(isset($row)) { if(is_file('upload/gallery/'.$row['gal_image'])) { echo "<br><br>"; echo "<img src='upload/gallery/$row[gal_image]' height='80'>"; } } ?> </div> <input type="hidden" name="gal" value="1"> <?php if(isset($row)== TRUE){ ?> <input type="hidden" name="gal_id" value="<?= $row['gal_id']?>" /> <input type="hidden" name="gal_image" value="<?= $row['gal_image']?>" /> <?php } ?> <button type="submit" name="submit" class="btn btn-primary"><?= isset($row)? 'Update' : 'Save'?></button> <button type="reset" name="reset" class="btn btn-primary">Reset</button> </div> </form> <!-- /.box-body --> </div> <!-- /.box --> </div> <!-- right column --> </div> <!-- /.row --> </section> <!-- /.content --> <section class="content-header"> <h1>Gallery View <small></small> </h1> </section> <!-- Main content --> <section class="content"> <div class="row"> <div class="col-xs-12"> <div class="box"> <div class="box-header"> <h3 class="box-title"></h3> </div> <!-- /.box-header --> <div class="box-body"> <form id="vnews" action="gallery.php" method="post"> <div class="table-responsive"> <table id="example1" class="table table-bordered table-striped"> <thead> <tr> <th>#</th> <th>Sr. No.</th> <th>Type</th> <th>Title</th> <th>Image</th> <th>Date</th> <th>Action</th> </tr> </thead> <?php $i=1; $sql= "SELECT * FROM gallery"; $rs= mysqli_query($obj->mysqli,$sql); $num= mysqli_num_rows($rs); if($num>0){ while($gal_data =mysqli_fetch_assoc($rs)){ ?> <tr> <td scope="col"><input type="checkbox" name="mul_del[]" id="mul_del[]" value="<?= $gal_data['gal_id'] ?>" /></td> <td scope="col"><?= $i++ ?></td> <td scope="col"><?= $gal_data['gal_type'] ?></td> <td scope="col"><?= $gal_data['gal_title'] ?></td> <td scope="col"><img src="upload/gallery/<?= $gal_data['gal_image'] ?>" width="60" height="60" class="img-thumbnail" /></td> <td scope="col"><?= date('d M Y',strtotime($gal_data['gal_date'])) ?></td> <td class="center"> <a class="btn btn-info btn-xs" href="gallery.php?edit=<?= $gal_data['gal_id']?>"> <i class="glyphicon glyphicon-edit icon-white"></i> Edit </a> <a class="btn btn-danger btn-xs" href="javascript:muldelete()"> <i class="glyphicon glyphicon-trash icon-white"></i> Delete </a> </td> </tr> <?php } } ?> </table> </div> </form> </div> <!-- /.box-body --> </div> <!-- /.box --> </div> <!-- /.col --> </div> <!-- /.row --> </section> <!-- /.content --> </div> <!-- /.content-wrapper --> <?php include 'include/footer.php'; ?> <div class="control-sidebar-bg"></div> </div> <!-- ./wrapper --> <script src="plugins/jQuery/jQuery-2.1.4.min.js"></script> <script type="text/javascript"> function muldelete() { element_lenght= vnews.elements.length; for(i=0;i<element_lenght;i++) { if(vnews.elements[i].name=="mul_del[]") { if(vnews.elements[i].checked==true) { if(confirm("Are you sure delete record(s)?")) { this.vnews.submit(); break; } } } } } </script> <script src="js/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.mousewheel.min.js"></script> <script type="text/javascript" src="js/jquery.dateselect.js"></script> <script src="js/jquery-ui.min.js"></script> <script> $.widget.bridge('uibutton', $.ui.button); </script> <script src="bootstrap/js/bootstrap.min.js"></script> <script src="plugins/datatables/jquery.dataTables.min.js"></script> <script src="plugins/datatables/dataTables.bootstrap.min.js"></script> <script src="dist/js/app.min.js"></script> <script> $(function () { $("#example1").DataTable(); $('#example2').DataTable({ "paging": true, "lengthChange": false, "searching": false, "ordering": true, "info": true, "autoWidth": true }); }); </script> <script src="js/jquery.validate.min.js"></script> <script src="js/jquery-validate-additional-methods.js"></script> <script> $(document).ready(function(){ $.validator.addMethod('filesize', function(value, element, param) { // param = size (in bytes) // element = element to validate (<input>) // value = value of the element (file name) return this.optional(element) || (element.files[0].size <= param) }); $('#gallery_form').validate({ rules: { gal_type: { required: true }, gal_title: { required: true }, }, messages: { gal_type: { required: "Please Enter Gallery Type", }, gal_title: { required: "Please Enter Title", }, }, highlight: function(element){ $(element).closest('.form-group').addClass('has-error').removeClass('has-success'); //$(element).next('span').addClass('fa fa-times-circle').removeClass('fa fa-check-circle'); }, unhighlight: function(element){ $(element).closest('.form-group').addClass('has-success').removeClass('has-error'); //$(element).next('span').addClass('fa fa-check-circle').removeClass('fa fa-times-circle'); }, errorElement: 'span', errorClass: 'help-block', //errorPlacement: '', }); }); function livesearch(e,r) { var textfield= document.getElementById(e); var regx= new RegExp(r, 'g'); textfield.value= textfield.value.replace(regx,''); } function liveCapital(e) { e.value= e.value.toUpperCase(); } </script> </body> </html>