<? global $vis_language; 
if($smtpmail_details==-1){   
	include(VIS_PATH_TEMPLATE.'no_record_yet.php'); 
	echo '<script> $("#view_action").hide(); $("#vis_smtpmail_form .panel-footer").hide(); $("#vis_smtp_list").hide(); $(".fullFrame").removeClass("b-t").addClass("m-t-lg m-b-lg"); </script>';
 } else { ?>
<script> $("#view_action").show(); $("#vis_smtpmail_form .panel-footer").show(); $("#vis_smtp_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><? echo $vis_language['TXTHOSTNAME']; ?></th>
         <th class="txt_nowrap"><? echo $vis_language['TXTPORT']; ?></th>
         <th class="txt_nowrap"><? echo $vis_language['TXTDEPARTMENT']; ?></th>
         <th class="txt_nowrap"><? echo $vis_language['TXTSTATUS']; ?></th>
         <th></th>
      </tr>
   </thead>
   <tbody>
      <?
         for($i=0;$i<count($smtpmail_details);$i++) {
         $ssl_type = array( 0 => $vis_language['TXTNONE']
             			 , 1 => 'SSL'
             			 , 2 => 'TLS');
             if($smtpmail_details[$i]['is_enabled']==1){ $status = $vis_language['TXTENABLED'];$lbl='vh-green-bg';} else {$status = $vis_language['TXTDISABLED'];$lbl='label-default';}
             echo '<tr><td width="30"><label class="checkbox m-n i-checks"><input type="checkbox" name="vis_global_mass_chk_'.$i.'" id="vis_global_mass_chk_'.$i.'" value="'.$smtpmail_details[$i]['smtp_id'].'" /><i></i></label></td>';
             echo '<td><a href="#/setting/smtp_details/'.$smtpmail_details[$i]['smtp_host'].'/'.$smtpmail_details[$i]['smtp_id'].'">'.$smtpmail_details[$i]['smtp_host'].'</a></td>';
             echo '<td><a href="#/setting/smtp_details/'.$smtpmail_details[$i]['smtp_host'].'/'.$smtpmail_details[$i]['smtp_id'].'">'.$smtpmail_details[$i]['smtp_port'].'</a></td>'; ?>
             <td>
                <div class="<?php if(count($smtpmail_details[$i]['department'])>5) echo 'dept_access'; ?>"><a href="#/setting/smtp_details/<?= $smtpmail_details[$i]['smtp_host']; ?>/<?= $smtpmail_details[$i]['smtp_id']; ?>">
                    <?php if($smtpmail_details[$i]['department']!= -1) 
                    {
                       for($j=0;$j<count($smtpmail_details[$i]['department']);$j++) {
                            echo $smtpmail_details[$i]['department'][$j]['domain_name'];
                            if($smtpmail_details[$i]['department'][$j]['domain_name']!='') echo ' :: ';
                            echo $smtpmail_details[$i]['department'][$j]['department_name'].'<br />';
                       } 
                   }
                   else
                   {
                       echo $vis_language['TXTALLDEPARTMENTS'];
                   }
                    ?></a>
                </div>
             </td>
            <? echo '<td><span class="label '.$lbl.'">'.$status.'</span></td>'; ?>
      <td align="center"> <a class="text-muted" href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=setting&vis_operation=get_delete_smtp&vis_smtp_id=<? echo $smtpmail_details[$i]['smtp_id']; ?>&vis_static_area=vis_smtp_delete_form" title="<? echo $vis_language['TXTDELETE']; ?>"><i class="vh vh-delete-round"></a></td>
      <?
         echo '</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,													
   			{ "bSortable": false }
   		]
   	});
   });
</script>
