<? global $vis_language;?>

    <section class="padder">
    <section class="m-t-sm">   
		
		<div id="vh-drive">
			  <div id="drive-modal-view" class="drive-object grid-view">
		
      
                <div class="drive-head animated fadeInUp">
                        <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 class="drive-items">
                                
                        </div>
                       
                </div>
            	<?if($ticket_attach_info!=-1)
{
	for($i=0; $i<count($ticket_attach_info); $i++){ $flag=0;$token=generate_random('num', 32);
		/*$filename2=explode('/',$ticket_attach_info[$i]['content']);
	$count=count($filename2);
	
$filename=$filename2[$count-1];*/

?>
              <a href="javascript:void(0);" class="list-drive-a">
                        <div class="drive-info ">
                        <div class="drive-checkbox">
							
                                <input id="drive-item-<? echo $ticket_attach_info[$i]['attachment_id']?>" name="drive-item[]" value="<? echo $domainurl."index.php?/selfhelp/drive/".$token."/".$ticket_attach_info[$i]['file_name']."/".$ticket_attach_info[$i]['attachment_id']?>" type="checkbox" class="checkbox">
                                <i></i>
                            </div>
                                <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>
 $('.list-drive-a').click(function() {
   //$('.rtpcls').removeClass('btn-primary');
//alert('hi');
			
var checkbox = $(this).find("input[type='checkbox']");
var parentdiv=$(this).find(".drive-info");

if((checkbox.is(":checked") && parentdiv.hasClass('active')) || (checkbox.is(":checked")==false && parentdiv.hasClass('active')))
			{
$(this).find(".drive-info").removeClass('active');
			checkbox.prop('checked', false);
			}else{
				checkbox.prop('checked', true);
$(this).find(".drive-info").addClass('active');
			}
  });
		
		$(document).ready(function () {
        if ($('#view').hasClass("btn btn-icon active") == true) {
            $('.drive-object').addClass('grid-view list-view');
        }
        else $('.drive-object').addClass('grid-view');
    });
	

    	
 function mydrive_list_load(page){
	 $(this).hide();
	 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,'vis_check_popup':'insert_ticket'}, function(data) {
		$("#load_more_activities").last().remove();
		$("#drive-modal-view").last().append(data);
		//$("#load_more_activities").before(data);
	});
}
</script>




