/
home
/
neelkanthworld
/
public_html
/
amrendra_master
/
Upload File
HOME
<?php include("include/header1.php"); $_SESSION['page_menu']=array('website','certificate'); if(!empty($_POST['certificate'])) { $obj->certificates(); } if(!empty($_POST['mul_del'])) { foreach($_POST['mul_del'] as $code) { $id= $code; $photo_sql= "SELECT cand_photo FROM certificate WHERE cert_id='".$id."'"; $rs= mysqli_query($obj->mysqli,$photo_sql); $photo= mysqli_fetch_assoc($rs); if(is_file('upload/certificate/'.$photo['cand_photo'])) { unlink('upload/certificate/'.$photo['cand_photo']); } } $col= 'cert_id'; $table= 'certificate'; $page= 'certificate.php'; $img= "cand_photo"; $path= "upload/certificate/"; $obj->delete_multiple($col,$table,$page,$path); } if(!empty($_REQUEST['edit'])) { $val= $_REQUEST['edit']; $row= $obj->getRecord('certificate','cert_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> <h4><i class="icon fa fa-check"></i><?php echo $obj->errorMsg; ?></h4> </div> </div> </div> </section> <?php } ?> <section class="content-header"> <h1> Add New Certificate </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">Our Training Program Entry</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" id="certi_form" enctype="multipart/form-data" name="certi_form" autocomplete="off"> <div class="box-body"> <div class="col-sm-12 form-group"> <label for="exampleInputEmail1">Candidate Name</label> <input type="text" class="form-control" name="cand_name" id="cand_name" placeholder="Enter a Name..." value="<?= isset($row)? $row['cand_name'] : ''?>" onKeyup="liveCapital(this)" onKeydown="liveCapital(this')" > </div> <div class="col-sm-4 form-group"> <label for="exampleInputPassword1">Candidate Age</label> <input type="text" class="form-control" name="cand_age" id="cand_age" value="<?= isset($row)? $row['cand_age'] : ''?>" onkeyup="liveSearch(this,'[^0-9]')" onkeydown="liveSearch(this,'[^0-9]')" placeholder="Candidate Age" > </div> <div class="col-sm-4 form-group"> <label for="exampleInputPassword1">Candidate Phone</label> <input type="text" class="form-control" name="cand_phone" id="cand_phone" value="<?= isset($row)? $row['cand_phone'] : ''?>" maxlength="10" minlength="10" placeholder="Candidate Phone" onkeyup="liveSearch(this,'[^0-9]')" onkeydown="liveSearch(this,'[^0-9]')"> </div> <div class="col-sm-4 form-group"> <label for="exampleInputPassword1">Candidate Email</label> <input type="email" class="form-control" name="cand_email" id="cand_email" value="<?= isset($row)? $row['cand_email'] : ''?>" placeholder="Course Duration" > </div> <div class="col-sm-12 form-group"> <label for="exampleInputPassword1">Candidate Address</label> <input type="text" class="form-control" name="cand_add" id="cand_add" value="<?= isset($row)? $row['cand_add'] : ''?>" placeholder="Course Duration" onKeyup="liveCapital(this)" onKeydown="liveCapital(this')" > </div> <div class="col-sm-3 form-group"> <label for="exampleInputEmail1">Select Program</label> <select class="form-control wpcf7-email" name="pro_id" id="pro_id"> <?php $option ="<option value=''>--Select Program--</option>"; $rs= $obj->getTable('program','pro_id '); if(!empty($rs)){ foreach($rs as $val){ if($val['pro_id']== $row['pro_id']){ $option .="<option value='$val[pro_id]' selected>$val[program_title] ($val[pro_dura] $val[pro_dur_type])</option>"; } else{ $option .="<option value='$val[pro_id]' >$val[program_title]($val[pro_dura] $val[pro_dur_type])</option>"; } } echo $option; } ?> </select> </div> <div class="col-sm-3 form-group"> <label for="exampleInputPassword1">Training Period from</label> <input type="text" class="form-control" name="period_from" id="datepicker-example1" value="<?= isset($row)? $row['period_from'] : ''?>" placeholder="Course Duration" required> </div> <div class="col-sm-3 form-group"> <label for="exampleInputPassword1">Training Period to</label> <input type="text" class="form-control" name="period_to" id="datepicker-example2" value="<?= isset($row)? $row['period_to'] : ''?>" placeholder="Course Duration" required> </div> <div class="col-sm-3 form-group"> <label for="exampleInputPassword1">Date of Issue</label> <input type="text" class="form-control" name="issue" id="datepicker-example12" value="<?= isset($row)? $row['issue'] : ''?>" placeholder="Course Duration" required> </div> <div class="col-sm-12 form-group"> <label>Candidate Photo</label> <?php if(isset($row)){ echo '<input type="file" class="form-control" name="cand_photo">'; } else{ echo '<input type="file" required class="form-control" name="cand_photo">'; } ?> <?php if(isset($row)){ if(is_file('upload/certificate/'.$row['cand_photo'])){ echo "<br><br>"; echo "<img src='upload/certificate/$row[cand_photo]' height='80'>"; } } ?> </div> <input type="hidden" name="certificate" value="1"> <?php if(isset($row)== TRUE){ ?> <input type="hidden" name="cert_id" value="<?= $row['cert_id']?>" /> <input type="hidden" name="cand_photo" value="<?= $row['cand_photo']?>" /> <?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> </div> </div> </div> </section> <!-- /.content --> <section class="content-header"> <h1>Certificate 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> <div class="box-body"> <form id="vnews" action="certificate.php" method="post"> <table id="example1" class="table table-bordered table-striped table-responsive"> <thead> <tr> <th>#</th> <th>Sr. No.</th> <th>Photo</th> <th>Reg.Id</th> <th>Name</th> <th>Email</th> <th>Phone Number</th> <th>Program Name</th> <th>QR</th> <th>Date of Issue</th> <th>Action</th> </tr> </thead> <?php $i=1; $sql= "SELECT * FROM certificate"; $rs= mysqli_query($obj->mysqli,$sql); $num= mysqli_num_rows($rs); if($num>0){ while($cer_data =mysqli_fetch_assoc($rs)){ $menu_sql= "SELECT * FROM program WHERE pro_id='".$cer_data['pro_id']."'"; $menu_rs= mysqli_query($obj->mysqli,$menu_sql); if(mysqli_num_rows($menu_rs) == 1) { $menu_title_data= mysqli_fetch_assoc($menu_rs); $menu= $menu_title_data['program_title']; }else{ $menu= ''; } $qrcode= 'Candidate Name.:-'.$cer_data['cand_name'].', Program:-'.$menu.', Training Period:-'.date('d M Y',strtotime($cer_data['period_from'])).' to '.date('d M Y',strtotime($cer_data['period_to'])).' Date of Issue:-'.date('d M Y',strtotime($cer_data['issue'])).''; ?> <tr> <td scope="col"><input type="checkbox" name="mul_del[]" id="mul_del[]" value="<?= $cer_data['cert_id'] ?>" /></td> <td scope="col"><?= $i++ ?></td> <td scope="col"><img src="upload/certificate/<?= $cer_data['cand_photo'] ?>" width="60" height="60"/></td> <td scope="col"><?= $cer_data['reg_id'] ?></td> <td scope="col"><?= $cer_data['cand_name'] ?></td> <td scope="col"><?= $cer_data['cand_email']?></td> <td scope="col"><?= $cer_data['cand_phone']?></td> <td scope="col"><?= $menu ?></td> <td scope="col"><img src="https://qrcode.tec-it.com/API/QRCode?data=<?= $qrcode ?>&chs=160x160&chld=S|0" class="qr-code" height="80"></td> <td scope="col"><?= date('d M Y',strtotime($cer_data['issue'])) ?></td> <td class="center"> <a class="btn btn-info btn-xs" href="certificate.php?edit=<?= $cer_data['cert_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> </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 src="//cdn.ckeditor.com/4.5.9/full/ckeditor.js"></script> <script> CKEDITOR.replace('message_l'); $(function () { $("#example1").DataTable(); $('#example2').DataTable({ "paging": true, "lengthChange": false, "searching": false, "ordering": true, "info": true, "autoWidth": true }); }); </script> <script type="text/javascript" src="js/jquery-ui.js"></script> <script src="js/core.js"></script> <script src="js/zebra_datepicker.js"></script> <script type="text/javascript"> $(function() { $("#pickup").datepicker({ dateFormat: 'yy-mm-dd', minDate: 0, maxDate: '+12M' }); $("#arrival").datepicker({ dateFormat: 'yy-mm-dd', minDate: 0, maxDate: '+12M', showSplitDay: true, isTo1: true, minRangeDuration: 2, doneText: "Ready to book", clearText: "Oh no, I want to select another period" }); $("#single").datepicker({ dateFormat: 'yy-mm-dd' }); $("#pickup, #arrival, #single").click(function() { $(this).focus(); }); $("#return, #departure").bind("click focus", function() { $($(this).data("date-range-start")).click(); }); }); </script> <script src="js/jquery.validate.min.js"></script> <script> $(document).ready(function(){ $('#certi_form').validate({ rules: { cand_name: { required: true }, cand_age: { required: true }, cand_phone: { required: true }, cand_email: { required: true }, cand_add: { required: true }, }, messages: { cand_name: { required: "Please Enter name", }, cand_age: { required: "Please Enter Age", }, cand_phone: { required: "Please Enter Phone", }, cand_email: { required: "Please Enter Email", }, cand_add: { required: "Please Enter Address", }, }, 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: '', }); }); $('#serial_check').change(function(){ if(this.checked== true){ $("#serial_no").show(); } else{ $("#serial_no").hide(); } }); $('#smart_card').keyup(function () { $('#customer_account').val($(this).val()); }); </script> <script> function liveSearch(e,r) { var regex= new RegExp(r, "g"); e.value= e.value.replace(regex, '').toUpperCase(); } function liveCapital(e) { e.value= e.value.toUpperCase(); } </script> </body> </html>