<? global $vis_language;?>

    <section class="padder">
    <section class="m-t-sm">   
		
		<div id="vh-drive">
			  <div id="drive-view" class="drive-object ">
		<?if($ticket_attach_info!=-1)
{?>
      
                <div class="drive-head animated fadeInUp">
					<div class="drive-items">
                                 
                        </div>
                        <div class="drive-items">
                                Item
                        </div>
                        <div class="drive-items">
                                Name
                        </div>  
                        	<div class="drive-items">
                                 
                        </div>                      
                        <div class="drive-items">
                                Size
                        </div>
                         <div class="drive-items">
                                Type
                        </div>
                          
                       
                </div>
    <?        	
	for($i=0; $i<count($ticket_attach_info); $i++){ $flag=0;
?>
               <a data-modal-arguments="vis_module=selfhelp&vis_operation=ticket_attachments_details&vis_domain=<? echo $domainurl; ?>&vis_drive_name=<? echo urlencode($ticket_attach_info[$i]['file_name']); ?>&vis_drive_size=<? echo $ticket_attach_info[$i]['file_size']; ?>&vis_drive_type=<? echo $ticket_attach_info[$i]['file_type']; ?>&vis_drive_content=<? echo $ticket_attach_info[$i]['content']; ?>" data-toggle="ajaxModal" href="javascript:void(0);">
                        <div class="drive-info ">
                        
                                <div class="drive-item">
                                        <?  if($ticket_attach_info[$i]['file_type']=='text/plain') { ?>
      <i class="vh vh-file-text text-muted"></i>
      <?}
      else if($ticket_attach_info[$i]['file_type']=='image/jpeg') { ?>
        <img src="<?= VIS_PATH_FILES.$ticket_attach_info[$i]['content'];?>" alt="<?= VIS_PATH_FILES.$ticket_attach_info[$i]['content'];?>" />
      <?}
      else if($ticket_attach_info[$i]['file_type']=='application/vnd.ms-excel') { ?>
       <i class="vh vh-file-spreadsheet vh-file-spreadsheet-color"></i>
      <?}
      else if($ticket_attach_info[$i]['file_type']=='image/png') { ?>
        <img src="<?= VIS_PATH_FILES.$ticket_attach_info[$i]['content'];?>" alt="<?= VIS_PATH_FILES.$ticket_attach_info[$i]['content'];?>" />
       <?} 
       else if($ticket_attach_info[$i]['file_type']=='application/pdf') { ?>
      <i class="vh vh-file-pdf vh-file-pdf-color"></i>
       <?}
       else if($ticket_attach_info[$i]['file_type']=='application/vnd.openxmlformats-officedocument.wordprocessingml.document') { ?>
      <i class="vh vh-file-word vh-file-word-color"></i>
        <?}
        else if($ticket_attach_info[$i]['file_type']=='text/csv') { ?>
      <i class="vh vh-file-spreadsheet vh-file-spreadsheet-color"></i>
        <?} 
        else if($ticket_attach_info[$i]['file_type']=='message/rfc822') { ?>
      <i class="vh vh-file-text text-muted"></i>
        <?}
         else if(($ticket_attach_info[$i]['file_type']=='application/zip') || ($ticket_attach_info[$i]['file_type']=='application/octet-stream')) { ?>
      <i class="vh vh-file-zip vh-file-zip-color"></i>
        <?}
        else if($ticket_attach_info[$i]['file_type']=='application/vnd.openxmlformats-officedocument.presentationml.presentation') { ?>
      <i class="vh vh-file-presentation vh-file-presentation-color"></i>
        <?} else
        {?>
			<i class="vh vh-file vh-info"></i>
		<?}
        ?>
                                </div>
                                <div class="drive-item-name">
                                        <small>Name</small>
                                       <?= $ticket_attach_info[$i]['file_name']?>
                                </div>           
                                <div class="drive-item-owner"></div>                   
                                <div class="drive-item-size">
                                        <small>Size</small>
                                       <?= $ticket_attach_info[$i]['file_size']?>KiB
                                </div>
                                
                                <div class="drive-item-date">
                                        <small>Type</small>
                                        <?= $ticket_attach_info[$i]['file_type']?>
                                </div>
                        </div>
                </a>
                
             
<?}
if($ticket_attach_details[0]['count']>$view_info['page_count']){?>	
			<div id="load_more_activities" onclick="javascript:mydrive_list_load(<?= $page+1;?>);">
			<div style="text-align: center;">
				<span class="link vis-pointer"><?= $vis_language['TXTLOADMORE'];?></span>
			</div>
			</div><? 
	} 
	

		}
		else
		{
 include(VIS_PATH_TEMPLATE.'no_record_yet.php');
}?>	
		</div>
</div>	

  </section>
</section>
<script>
		$(document).ready(function(){

	if ( $('#view').hasClass( "btn btn-icon active" )==true )
		
		{
			$('.drive-object').addClass('grid-view list-view');
			
		}
		else
	$('.drive-object').addClass('grid-view');
	
		
	
});
	
$('#search_drive').keyup(function(e){
    if(e.keyCode == 13)
    {
        var search_string = $("#search_drive").val();
		if(search_string.length < 3)
				$("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['TXTGLOBALSEARCHERROR'];?>");
		else
        $.post("index.php?vis_module=selfhelp&vis_operation=view_ticket_attachments&vis_tmpst="+new Date().getTime(), { 'vis_action':'no_load','criteria': search_string }, function(data) {
            $("#search_drive").parent().addClass('open');
            $('#drive-view').show().html(data);
        });
    }
});
    function display_drive()
    {
		if($('#search_drive').val())
		{
			var drive = $('#search_drive').val();
			if(drive.length < 3)
				$("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['TXTGLOBALSEARCHERROR'];?>");
			else
				$('#drive-view').visExecution('load_operations', {'vis_module':'selfhelp', 'vis_operation':'view_ticket_attachments', 'vis_action':'no_load','criteria':drive});
		}
	}	
	
 function mydrive_list_load(page){
	 var drive = $('#search_drive').val();
	$.post("index.php?vis_module=selfhelp&vis_operation=view_ticket_attachments&vis_action=load&vis_tmpst="+new Date().getTime(),{'vis_page': page,'criteria':drive}, function(data) {
		$("#load_more_activities").last().remove();
		$("#drive-view").last().append(data);
		//$("#load_more_activities").before(data);
	});
}
</script>




