<? 
if($ticket_attach_info!=-1)
{
	for($i=0; $i<count($ticket_attach_info); $i++){ 
	$flag=0;
$creation_date=$drive_info[$i]['creation_date']+ VIS_TIMEZONE;
$date=date(VIS_DATE_FORMAT,$creation_date);
$token=generate_random('num', 32);
?>
<? if(isset($operation['vis_check_popup']) && $operation['vis_check_popup']=='insert_ticket'){ ?>
 <a href="javascript:void(0);" class="list-drive-a">
<? }else{?>
              			   
			     <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 ">
                        <? if(isset($operation['vis_check_popup']) && $operation['vis_check_popup']=='insert_ticket'){ ?>
                        <div class="drive-checkbox">
                               <!-- <input id="drive-item-<? echo $ticket_attach_info[$i]['attachment_id']?>" name="drive-item[]" value="<a href=<? echo $domainurl."attachment/".$ticket_attach_info[$i]['content']?>><? echo $domainurl."attachment/".$ticket_attach_info[$i]['content']?></a>" type="checkbox" class="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="techimage" />
      <?}
      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="techimage" />
       <?} 
       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($remain == 1){?>	
	
			<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><? 
	} 
	

		}?>	
		</div>
</div>	

  </section>
</section>

<script>
<? if(isset($operation['vis_check_popup']) && $operation['vis_check_popup']=='insert_ticket'){ ?>
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);
	});
}
<? }else{?>
 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}, function(data) {
		$("#load_more_activities").last().remove();
		$("#drive-view").last().append(data);
		//$("#load_more_activities").before(data);
	});
}
<? }?>
</script>
