<? 
	global $vis_language;
	if($macros_total['total']>0){
?>
<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><? echo $vis_language['TXTOWNER']; ?></th>
			<th><? echo $vis_language['TXTTITLE']; ?></th>				
			<th class="txt_nowrap"><? echo $vis_language['TXTDISPLAYORDER']; ?></th>
			<th class="txt_nowrap"><? echo $vis_language['TXTACCESS']; ?></th>
			<th class="txt_nowrap"><? echo $vis_language['TXTSTATUS']; ?></th>			
			<th></th>
		</tr>
	</thead>
	<tbody>		
  	
<?  if($macros_details!=-1) {
		for($i=0;$i<count($macros_details);$i++) { 
			if($macros_details[$i]['is_enabled'] == 1) {
				$status = $vis_language['TXTENABLED']; $lbl='vh-green-bg';
			} else {
				$status = $vis_language['TXTDISABLED']; $lbl='label-default';
			}
			//check for access
			if($macros_details[$i]['access'] == 0){
				$access = $vis_language['TXTPUBLIC'];
			} else {
				$access = $vis_language['TXTPRIVATE'];
			}	
	    if((VIS_STAFF_ID == $macros_details[$i]['staff_id']) || ($admin_access!=-1 && $admin_access[0]['level']==1)){ 
		   echo '<tr><td><label class="checkbox m-n i-checks"><input type="checkbox" name="vis_global_mass_chk_'.$i.'" id="vis_global_mass_chk_'.$i.'" value="'.$macros_details[$i]['macro_id'].'" /><i></i></label></td>';
			for($s=0;$s<count($staff_list);$s++){
				if($staff_list[$s]['staff_id']==$macros_details[$i]['staff_id'])
					echo '<td><a href="#/home/macro_details/'.rawurlencode(str_replace('/', ' ',$macros_details[$i]['macro_title'])).'/'.$macros_details[$i]['macro_id'].'">'.$staff_list[$s]['first_name'].' '.$staff_list[$s]['last_name'].'</a></td>';
			}
			
			echo '<td><a href="#/home/macro_details/'.rawurlencode(str_replace('/', ' ',$macros_details[$i]['macro_title'])).'/'.$macros_details[$i]['macro_id'].'">'.$macros_details[$i]['macro_title'].'</a></td>';
			echo '<td><a href="#/home/macro_details/'.rawurlencode(str_replace('/', ' ',$macros_details[$i]['macro_title'])).'/'.$macros_details[$i]['macro_id'].'">'.$macros_details[$i]['display_order'].'</a></td>';
			echo '<td><a href="#/home/macro_details/'.rawurlencode(str_replace('/', ' ',$macros_details[$i]['macro_title'])).'/'.$macros_details[$i]['macro_id'].'">'.$access.'</a></td>';
			echo '<td><a href="#/home/macro_details/'.rawurlencode(str_replace('/', ' ',$macros_details[$i]['macro_title'])).'/'.$macros_details[$i]['macro_id'].'"><span class="label '.$lbl.'">'.$status.'</span></a></td>';?>			
			<td align="center"><a class="text-muted" href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=home&vis_operation=get_macro_delete&vis_macro_id=<? echo $macros_details[$i]['macro_id']; ?>&vis_static_area=vis_view_delete_form" title="<? echo $vis_language['TXTDELETE']; ?>"><i class="vh vh-delete-round"></i></a></td>		  		
			</tr>
			 <?
		}else if(($admin_access==-1 && VIS_STAFF_ID != $macros_details[$i]['staff_id'] && $macros_details[$i]['access']!=1) || (VIS_STAFF_ID != $macros_details[$i]['staff_id'] && $admin_access[0]['level']==0 && $macros_details[$i]['access']!=1) || $admin_access[0]['level']==2){ 
		    echo '<tr><td><label class="checkbox m-n i-checks"><input type="checkbox" disabled="disabled" name="vis_global_mass_chk_'.$i.'" id="vis_global_mass_chk_'.$i.'" value="'.$macros_details[$i]['macro_id'].'" /><i></i></label></td>';
			for($s=0;$s<count($staff_list);$s++){
				if($staff_list[$s]['staff_id']==$macros_details[$i]['staff_id'])
					echo '<td>'.$staff_list[$s]['first_name'].' '.$staff_list[$s]['last_name'].'</td>';
			}
			
			echo '<td>'.$macros_details[$i]['macro_title'].'</td>';
			echo '<td>'.$macros_details[$i]['display_order'].'</td>';
			echo '<td>'.$access.'</td>';
			echo '<td><span class="label '.$lbl.'">'.$status.'</span></td>';?>			
			<td align="center"><i class="vh vh-delete-round"></i></td>		  		
			</tr>
			 <?
		} 
		/*else{
			echo '<tr><td><label class="checkbox m-n i-checks"><input type="checkbox" name="vis_global_mass_chk_'.$i.'" id="vis_global_mass_chk_'.$i.'" value="'.$macros_details[$i]['macro_id'].'" /><i></i></label></td>';
			for($s=0;$s<count($staff_list);$s++){
				if($staff_list[$s]['staff_id']==$macros_details[$i]['staff_id'])
					echo '<td><a href="#/home/macro_details/'.$macros_details[$i]['macro_title'].'/'.$macros_details[$i]['macro_id'].'">'.$staff_list[$s]['first_name'].' '.$staff_list[$s]['last_name'].'</a></td>';
			}
			
			echo '<td><a href="#/home/macro_details/'.$macros_details[$i]['macro_title'].'/'.$macros_details[$i]['macro_id'].'">'.$macros_details[$i]['macro_title'].'</a></td>';
			echo '<td><a href="#/home/macro_details/'.$macros_details[$i]['macro_title'].'/'.$macros_details[$i]['macro_id'].'">'.$macros_details[$i]['display_order'].'</a></td>';
			echo '<td><a href="#/home/macro_details/'.$macros_details[$i]['macro_title'].'/'.$macros_details[$i]['macro_id'].'">'.$access.'</a></td>';
			echo '<td><a href="#/home/macro_details/'.$macros_details[$i]['macro_title'].'/'.$macros_details[$i]['macro_id'].'"><span class="label '.$lbl.'">'.$status.'</span></a></td>';?>			
			<td align="center"><a class="text-muted" href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=home&vis_operation=get_macro_delete&vis_macro_id=<? echo $macros_details[$i]['macro_id']; ?>&vis_static_area=vis_view_delete_form" title="<? echo $vis_language['TXTDELETE']; ?>"><i class="vh vh-delete-round"></i></a></td>		  		
			</tr> <?
			
		}*/
		} 
	}?>  
	
	</tbody>
</table>
<script type="text/javascript">
$(".selectpicker").selectpicker();
$(document).ready(function() {	
$('[data-ride="datatables"]').dataTable({		
       "bPaginate" : false,	
		"sDom": 't', "bAutoWidth": false,
		"aoColumns": [
			{ "bSortable": false },
			null,
		  	null,
		  	null,
		  	null,	
			null,	
			{ "bSortable": false }
		]
	});
});
</script>
<?
}
else
{
	$operation['no_record']=1;
	include(VIS_PATH_TEMPLATE.'no_record_yet.php');
}
?>