<?php require_once('add_edit_teachers.php'); $sl =1; $tr_data = isset($tr_data) ? $tr_data : array(); $msg = isset($msg)?$msg:''; $msg_type = isset($msg_type)?$msg_type:''; $this->session->UnsetFlashData(); ?> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Teachers & Officers </h1> </section> <section class="content"> <div class="row"> <?php //GPrint($rtype_data);?> <div class="col-xs-12"> <div class="box"> <div class="box-header"> <h3 class="box-title">Teachers & Officers</h3> <button class="btn btn-primary btn-xs pull-right" type="button" data-teacher_id="N" data-edit= "N" data-toggle="modal" data-target="#add_edit_teacher" > <i class="fa fa-plus"></i> Add Teachers & Officers </button> </div><!-- /.box-header --> <div class="box-body"><div class="table-responsive"> <table id="example" class="table table-bordered table-hover"> <thead> <tr> <th>sl#</th> <th>Info</th> <th>Description</th> <th>Position</th> <th>Image</th> <th>CV</th> <th>Status</th> <th>Action</th> </tr> </thead> <tbody> <?php foreach ($tr_data as $t){ $image_link=base_url()."img/teachers/user.png"; $cv_link=''; $cv_found='N'; $status = ''; $type = ''; if($t->status == 'A'){ $status = "<span class='badge bg-green'>Active</span>"; }else{ $status = "<span class='badge bg-red'>Inactive</span>"; } if($t->type == 'T'){ $type = "<span class='badge bg-green'>Teacher</span>"; }else{ $type = "<span class='badge bg-red'>Admin</span>"; } $folder_name = base_url().'img/teachers/'; $down_link = $folder_name . $t->teacher_id .'.jpg'; $down_file_name = $t->teacher_id.'.jpg'; $physical_link = BASEPATH."../img/teachers/$down_file_name"; $folder_name_cv = base_url().'files/cv/'; $down_link_cv = $folder_name_cv . $t->teacher_id .'.pdf'; $down_file_name_cv = $t->teacher_id.'.pdf'; $physical_link_cv = BASEPATH."../files/cv/$down_file_name_cv"; if(file_exists($physical_link)){ //$image_link=base_url()."img/teachers/".$t->teacher_id.".jpg"; $image_link=base_url()."img/teachers/".$t->teacher_id.".jpg?v=".filemtime(BASEPATH."../img/teachers/".$t->teacher_id.".jpg"); } if(file_exists($physical_link_cv)){ $cv_found='Y'; $cv_link=base_url()."files/cv/".$t->teacher_id.".pdf"; } ?> <tr> <td><?php echo $sl; ?></td> <td> <?php echo $t->name; ?></br> <?php echo $t->designation; ?></br> Department: <?php echo $t->dept_name; ?></br> Mobile# <?php echo $t->mobile_no; ?></br> Email: <?php echo $t->email; ?></br> Role: <?php echo $type; ?> </td> <td><?php echo $t->short_bio; ?></td> <td><?php echo $t->rank; ?></td> <td> <img width="100" src="<?php echo $image_link;?>"> <form id="contactForm" action="<?php echo base_url()."admin/add_teacher_file"?>" class="contact-form" method="post" role="form" enctype="multipart/form-data"> <div class="form-group" id="file_upload_div" style="display: block;"> <label for="file_upload_img">Add Image<br>Image size: 190X200 px</label> <input type="file" id="file_upload" name="file_upload"> <input type="hidden" name="type" id="type" value="img"> <input type="hidden" name="teacher_id" id="teacher_id" value="<?php echo $t->teacher_id; ?>"> </div> <div class="" style="margin-top:5px;"> <button type="submit" name="submit" id="submit" class="btn btn-xs btn-info" id="confirm">Submit</button> </div> </form> </td> <td> <?php if($cv_found == 'Y'){ ?> <a target='_blank' href="<?php echo $cv_link; ?>" download><i class="fa fa-download"></i> Download</a> <?php } ?> <form id="contactForm" action="<?php echo base_url()."admin/add_teacher_file"?>" class="contact-form" method="post" role="form" enctype="multipart/form-data"> <div class="form-group" id="file_upload_div" style="display: block;"> <label for="file_upload_cv">Add CV</label> <input type="file" id="file_upload" name="file_upload"> <input type="hidden" name="type" id="type" value="cv"> <input type="hidden" name="teacher_id" id="teacher_id" value="<?php echo $t->teacher_id; ?>"> </div> <div class="" style="margin-top:5px;"> <button type="submit" name="submit" id="submit" class="btn btn-xs btn-info" id="confirm">Submit</button> </div> </form> </td> <td><?php echo $status;?></td> <td nowrap> <button class="btn-xs btn-success" type="button" data-teacher_id="<?php echo $t->teacher_id; ?>" data-edit= "Y" data-toggle="modal" data-target="#add_edit_teacher" > <i class="fa fa-edit"></i> Edit </button> </td> </tr> <?php $sl++;}?> </tbody> </table></div> </div><!-- /.box-body --> </div><!-- /.box --> </div><!-- /.col --> </div><!-- /.row --> </section><!-- /.content --> </div> <script src="<?php echo base_url();?>lib/bootstrap/js/jquery.dataTables.min.js"></script> <script src="<?php echo base_url();?>lib/bootstrap/js/dataTables.bootstrap.min.js"></script> <script> $(document).ready(function() { $('#example').dataTable({ /* Disable initial sort */ "aaSorting": [] }); var toast_msg = '<?php echo $msg;?>'; var msg_type = '<?php echo $msg_type;?>'; if(toast_msg !== null && toast_msg !== '') { var shortCutFunction = msg_type; toastr.options = { positionClass: 'toast-bottom-right' }; var $toast = toastr[shortCutFunction](toast_msg); } } ); </script>