/
home
/
dityaelevator
/
public_html
/
elevator_master
/
Upload File
HOME
<?php include("include/header.php"); if(!empty($_POST['service'])){ $obj->service(); } if(!empty($_POST['mul_del'])){ foreach($_POST['mul_del'] as $code) { $id= $code; $photo_sql= "SELECT service_img FROM service WHERE service_id='".$id."'"; $rs= mysqli_query($obj->mysqli,$photo_sql); $photo= mysqli_fetch_assoc($rs); if(is_file('_saving/service/'.$photo['service_img'])){ unlink('_saving/service/'.$photo['service_img']); } } $col= 'service_id'; $table= 'service'; $page= 'service.php'; $img= "service_img"; $path= "_saving/service/"; $obj->delete_multiple($col,$table,$page,$path); } if(!empty($_REQUEST['edit'])){ $val= $_REQUEST['edit']; $row= $obj->getRecord('service','service_id',$val); } ?> <aside class="main-sidebar"> <section class="sidebar"> <?php include 'include/sidebar.php'; ?> <?php include 'include/admin-menu.php'; ?> </section> </aside> <div class="content-wrapper"> <?php if(!empty($_REQUEST['msg'])){ echo '<section class="content-header"> <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"> <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> <h4><i class="icon fa fa-check"></i> <?php echo $obj->errorMsg; ?></h4> </div> </div> </div> </section> <?php } ?> <section class="content-header"> <h1> Service 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><a href="#"> Website</a></li> <li class="active">Service</li> </ol> </div> </section> <section class="content"> <div class="row"> <div class="col-md-12"> <div class="box box-primary"> <form role="form" action="" method="post" enctype="multipart/form-data" name="news_form" id="news_form" data-toggle="validator"> <div class="box-body"> <!--<div class="col-sm-5 form-group"> <label for="exampleInputEmail1">Select Menu</label> <select class="form-control wpcf7-email" name="project_menu_id" id="project_menu_id" <?= (!isset($row))? 'required' : '' ?> onChange="servicesearch()"> <?php $option ="<option value=''>--Select Menu--</option>"; $rs= $obj->getTable('project_menu','project_menu_id '); if(!empty($rs)){ foreach($rs as $val){ if($val['project_menu_id']== $row['project_menu_id']){ $option .="<option value='$val[project_menu_id]' selected>$val[menu_name]</option>"; } else{ $option .="<option value='$val[project_menu_id]' >$val[menu_name]</option>"; } } echo $option; } ?> </select> </div>--> <div class="col-sm-12 form-group"> <label for="exampleInputEmail1">Title</label> <input type="text" class="form-control" name="service_title" id="service_title" placeholder="Enter a Title..." value="<?= isset($row)? $row['service_title'] : ''?>" autocomplete="off" onKeyUp="livesearch('service_title','[^A-Za-z-(){}., ]')" onKeyDown="livesearch('service_title','[^A-Za-z-(){}., ]')"> </div> <!--<div class="col-sm-12 form-group"> <label>Content</label> <textarea class="form-control" rows="3" name="project_content" id="project_content" placeholder="Enter a Content..." autocomplete="off" onkeyup="livesearch('project_content','[^A-Za-z0-9(){}.*, ]')" onkeydown="livesearch('project_content','[^A-Za-z0-9(){}.*, ]')"><?= isset($row)? $row['project_content'] : ''?></textarea> </div>--> <div class="col-sm-12 form-group"> <label>Description</label> <textarea class="form-control" rows="3" name="service_description" id="service_description" placeholder="Enter a Description..." autocomplete="off" onKeyUp="livesearch('service_description','[^A-Za-z0-9(){}.*, ]')" onKeyDown="livesearch('service_description','[^A-Za-z0-9(){}.*, ]')"><?= isset($row)? $row['service_description'] : ''?></textarea> </div> <div class="col-sm-12 form-group"> <label>Image (Size : 357X267px)</label> <?php if(isset($row)){ echo '<input type="file" class="form-control" name="service_img">'; } else{ echo '<input type="file" class="form-control" name="service_img">'; } ?> <?php if(isset($row)){ if(is_file('_saving/service/'.$row['service_img'])){ echo "<br><br>"; echo "<img src='_saving/service/$row[service_img]' height='80'>"; } } ?> </div> <?php if(isset($row)== TRUE){ ?> <input type="hidden" name="service_id" value="<?= $row['service_id']?>" /> <input type="hidden" name="service_img" value="<?= $row['service_img']?>" /> <?php } ?> <input type="hidden" name="service" value="1"> <button type="submit" name="submit" class="btn btn-primary"><?= isset($row)? 'Update' : 'Save'?></button> <button type="reset" name="reset" class="btn btn-danger">Reset</button> </div> </form> </div> </div> </div> </section> <section class="content-header"> <h1>Service View <small></small> </h1> </section> <section class="content"> <div class="row"> <div class="col-xs-12"> <div class="box"> <div class="box-header"> <h3 class="box-title"></h3> </div> <div class="box-body"> <form id="vnews" action="service.php" method="post"> <table id="example1" class="table table-bordered table-striped table-responsive"> <thead> <tr> <th>#</th> <th>Sr. No.</th> <!--<th>Menu</th>--> <th>Title</th> <!--<th>Content</th>--> <th>Description</th> <th>Image</th> <th>Date</th> <th>Action</th> </tr> </thead> <?php $res= $obj->getTable('service','service_id desc'); if($res){ $i=1; foreach($res as $service_data){ ?> <tbody> <tr> <td scope="col"><input type="checkbox" name="mul_del[]" id="mul_del[]" value="<?= $service_data['service_id'] ?>" /></td> <td scope="col"><?= $i++ ?></td> <!--<td scope="col"><?= $menu ?></td>--> <td scope="col"><?= $service_data['service_title'] ?></td> <!--<td scope="col"><?= $project_data['project_content'] ?></td>--> <td scope="col"><?= $service_data['service_description']?></td> <td scope="col"><img src="_saving/service/<?= $service_data['service_img'] ?>" width="60" height="60"/></td> <td scope="col"><?= date('d M Y',strtotime($service_data['sub_date'])) ?></td> <td class="center"> <a class="btn btn-info btn-xs" href="service.php?edit=<?= $service_data['service_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> Del</a> </td> </tr> </tbody> <?php } } ?> </table> </form> </div> </div> </div> </div> </section> </div><!-- /.content-wrapper --> <?php include 'include/footer.php'; ?> <div class="control-sidebar-bg"></div> <!-- ./wrapper --> <script src="plugins/jQuery/jQuery-2.1.4.min.js"></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 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 src="js/jquery.validate.min.js"></script> <script type="text/javascript" src="js/jquery-ui.min.js"></script> <script src="//cdn.ckeditor.com/4.5.9/full/ckeditor.js"></script> <script> CKEDITOR.replace('service_description'); $.widget.bridge('uibutton', $.ui.button); $(function () { $("#example1").DataTable(); }); $(document).ready(function(){ $('#news_form').validate({ rules: { service_title: { required: true }, service_description: { required: true }, service_img: { required: true }, }, messages: { service_title:{ required: "Please Enter Title", }, service_description: { required: "Please Enter Description", }, }, 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 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/core.js"></script> <script src="js/zebra_datepicker.js"></script> </body> </html>