HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: /var/www/html/taxicamera/application/views/admin/log/log_list.php
<div class="main-content">
  <div class="content-wrapper">
    <div class="container-fluid">
      <!-- Basic form layout section start -->
      <section id="basic-form-layouts">
      	<div class="row">
      		<div class="col-md-12">
      			<div class="card">
      				<div class="card-header">
      					<div class="page-title-wrap">
      						<h4 class="card-title">Activity Log</h4>      						
      					</div>
      				</div>
      				<div class="card-body">
      					<div class="px-3">      						
                  <div id="report_list_div">
                    
                  <form class="form custom_form_style" action="<?=base_url('admin/log/index')?>" method="POST">
										<div class="form-body">
											<div class="user_permission_top">
												<div class="row">
													
													
													<div class="col-md-4">
														<div class="form-group">
															<label>From Date</label>
															<div class="input-group">
																<input type="text" id="from_date" name="from_date" class="form-control pickadate" placeholder="" value="<?=!empty(set_value('from_date'))?set_value('from_date'):date('d/m/Y',strtotime("-1 Months"))?>"/>
																<div class="input-group-append">
																	<span class="input-group-text">
																		<span class="fa fa-calendar-o"></span>
																	</span>
																</div>
															</div>
														</div>
													</div>
													<div class="col-md-4">
														<div class="form-group">
															<label>To Date</label>
															<div class="input-group">
																<input type="text" id="to_date" name="to_date" class="form-control pickadate" placeholder="" value="<?=!empty(set_value('to_date'))?set_value('to_date'):date('d/m/Y')?>"/>
																<div class="input-group-append">
																	<span class="input-group-text">
																		<span class="fa fa-calendar-o"></span>
																	</span>
																</div>
															</div>
														</div>
													</div>
													<div class="col-md-4">
														<div class="form-group">
															<label class="blank_lbl">&nbsp;</label>
															<button type="submit" class="btn btn-success" >
																<i class="fa fa-search" aria-hidden="true"></i> Search
															</button>
														</div>
													</div>
												
												</div>

											</div>


										</div>

										
									</form>
                  <div class="row">
                      
                      <div class="table-responsive custom_table_area export_table_area">
                        <table class="table table-striped table-bordered export_btn_dt c_table_style notification_table log_table">
                            <thead>
                                <tr>
                                  <th>SL No.</th>
                                  <th>Activity</th>
                                  <th>Description</th>
                                  <th>Activity Done By</th>
                                  <th>Role</th>
                                  <th>Activity Date</th>
                                  <th>Activity Time</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php if(!empty($log_list)): ?>
                            <?php   foreach($log_list as $key => $list): ?>
                                  <tr>
                                      <td><?php echo $key+1; ?></td>
                                      <td><a href="<?php echo base_url().$list['log_link']; ?>"><?php echo $list['log_title'];?></a></td>
                                      <td><?php echo $list['log_description'];?></td>
                                      <?php if($list['action_done_by'] == '0'){   
                                                $action_done_by_name  = 'Admin'; 
                                                $role                 = 'Admin'; 
                                            } else{ 
                                              if(!empty($action_done_by['middle_name'])){
                                                $middle_name 	= ' '.$action_done_by['middle_name'];
                                              }
                                              else{
                                                $middle_name 	= '';
                                              }
                                                
                                              $action_done_by_name  = $list['first_name'].$middle_name.' '.$list['last_name']; 
                                              $role                 = isset($list['role_name'])?$list['role_name']:''; 
                                            } ?>
                                      <td><?php echo $action_done_by_name ;?></td>
                                      <td><?php echo $role;?></td>                                  
                                      <td><?php echo date('d/m/Y',strtotime($list['log_dt']));?></td>
                                      <td><?php echo date('h:i:s A',strtotime($list['log_dt']));?></td>
                                  </tr>
                            <?php   endforeach; ?>
                            <?php else: ?>
                                    <tr>
                                        <td colspan="7">No data found</td>
                                    </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                      </div>
                    </div>
                  </div>
      					</div>                
      				</div>
      			</div>            
      		</div>
      	</div>
      </section>
      <!-- // Basic form layout section end -->      
    </div>
  </div>
</div>
<script>
$(document).ready(function() {
  populate_datepicker();
  var now = new Date();
  var date = now.getFullYear() + "-" + now.getMonth() + "-" + now.getDate();  
  $('.log_table').DataTable({
    pageLength: 100,
    dom: 'Bfrtip',
    buttons: [{
        extend: 'excel',        
        text: 'Download Excel',
        className: 'btn btn-outline-primary mr-1',
        filename: 'LOG_list_' + date,
        exportOptions: {
                columns: [0,1,2,3,4,5,6]
        }
      }
      //'copy', 'csv', 'excel', 'pdf', 'print'
    ]
  });
});

function populate_datepicker(){
		
		var from_$input = $('#from_date').pickadate({
				format: 'dd/mm/yyyy',
				autoclose: true
			}),
			from_picker = from_$input.pickadate('picker')

		var to_$input = $('#to_date').pickadate({
				format: 'dd/mm/yyyy',
				autoclose: true
			}),
			to_picker = to_$input.pickadate('picker')

		// Check if there’s a “from” or “to” date to start with.
		if (from_picker.get('value')) {
			to_picker.set('min', from_picker.get('select'))
		}
		if (to_picker.get('value')) {
			from_picker.set('max', to_picker.get('select'))
		}

		// When something is selected, update the “from” and “to” limits.
		from_picker.on('set', function(event) {

			if (event.select) {
				to_picker.set('min', from_picker.get('select'));
			} else if ('clear' in event) {
				to_picker.set('min', false);
			}
		})

		to_picker.on('set', function(event) {

			if (event.select) {
				from_picker.set('max', to_picker.get('select'));
			} else if ('clear' in event) {
				from_picker.set('max', false);
			}
		})

	}
</script>