<? global $vis_language; 
if($activitylog_details==-1){   
	include(VIS_PATH_TEMPLATE.'no_record_yet.php'); 
	echo '<script> $("#view_action").hide(); $("#vis_activitylog_form .panel-footer").hide(); $("#vis_activitylog_list").hide(); $(".fullFrame").removeClass("b-t").addClass("m-t-lg m-b-lg"); </script>';
 } else { ?>
<script> $("#view_action").show(); $("#vis_activitylog_form .panel-footer").show(); $("#vis_activitylog_list").show(); </script>
 <table class="table table-hover b-t b-light m-b-none" data-ride="datatables">
               <thead class="table_head">		   
                  <tr>
                     <th>
                        <div class="btn-group">
                           <label class="checkbox m-n m-r-sm i-checks"  style="float: left;"><input type="checkbox"><i></i></label>		
                        </div>
                     </th>
                     <th class="txt_nowrap"><? echo $vis_language['TXTCONTENT']; ?></th>
                     <th class="txt_nowrap"><? echo $vis_language['TXTNAME']; ?></th>
                     <th class="txt_nowrap"><? echo $vis_language['TXTUSERNAME']; ?></th>
                     <th class="txt_nowrap"><? echo $vis_language['TXTUSERTYPE']; ?></th>
                     <th class="txt_nowrap"><? echo $vis_language['TXTMODULE']; ?></th>
					 <th class="txt_nowrap"><? echo $vis_language['TXTDATE']; ?></th>
					 <th class="txt_nowrap"><? echo $vis_language['TXTIPADDRESS']; ?></th>
                  </tr>
               </thead>		   
               <tbody>
                  <?
                      if($activitylog_details!=-1) for($i=0;$i<count($activitylog_details);$i++) {
						 if($activitylog_details[$i]['is_client']==0){
							 include_once(VIS_PATH_CLASS.VIS_CLASS_PREFIX.'staff.php');
								$database=new class_database();
								$staff=new class_staff($database);
							 $filter ='staff_id='.$activitylog_details[$i]['user_id'].'  and (department_access!="-1" OR (department_access IS NULL) or department_access=-1) ';
							$staff_details = $staff->get_list_staff($filter, VIS_STAFF_ID, VIS_LOCATION_AREA);
 
						 } else {
							 
						 $staff_details = $client_object->get_client('client_id='.$activitylog_details[$i]['user_id'], '','', '', '', VIS_LOCATION_AREA);	
						 $staff_details=$staff_details[1];
						 }	
                         echo '<tr><td width="30" id="checkbox_data"><label class="checkbox m-n i-checks"><input type="checkbox" name="vis_global_mass_chk_'.$i.'" id="vis_global_mass_chk_'.$i.'" value="'.$activitylog_details[$i]['activity_id'].'" /><i></i></label></td>';
						 echo '<td>'.htmlentities($activitylog_details[$i]['content']).'</td>';
                         echo '<td>'.$staff_details[0]['first_name'].' '.$staff_details[0]['last_name'].'</td>';
                         echo '<td>'.$staff_details[0]['user_name'].'</td>';
                         $usertype = ($activitylog_details[$i]['is_client']==0)?'Staff':'Client';
                         echo '<td>'.$usertype.'</td>';
                         $module_name = $activitylog_details[$i]['module_id']; 
						 $module_title = ($module_name==0) ? 'Setting': (($module_name==1) ? 'Client': (($module_name==2) ? 'Self Help': (($module_name==3) ? 'Blab': (($module_name==4) ? 'Login': (($module_name==5) ? 'CMDB':(($module_name==6) ? 'Relationship':(($module_name==7) ? 'ITIL':(($module_name==8) ? 'Schedule ticket':(($module_name==9) ? 'Forum':(($module_name==10) ? 'Task':(($module_name==11) ? 'Billing':(($module_name==12) ? 'Report':(($module_name==13) ? 'Staff':'')))))))))))));
						 echo '<td>'.$module_title.'</td>';
                         echo '<td class="txt_nowrap">'.format_datetime($activitylog_details[$i]['activity_date']).'</td>';
                         echo '<td class="txt_nowrap">'.$activitylog_details[$i]['ip'].'</td></tr>';
                     } ?>
               </tbody>
            </table><? } ?>
<script type="text/javascript">
	$(".selectpicker").selectpicker();
   $(document).ready(function() {	
   $('[data-ride="datatables"]').dataTable({
   	 "bPaginate" : false,				
          "paginate": false,
   		"sDom": 't', "bAutoWidth": false,
   		"aoColumns": [
   			{ "bSortable": false },
   		  	null,
   		  	null,
   		  	null,
   		  	null,
   		  	null,
   		  	null,
   		  	null  
   		]
   	});
   });
</script>
