1<?php 2/** 3 * Display VLAN details 4 ***********************************************************************/ 5 6# verify that user is logged in 7$User->check_user_session(); 8 9# perm check 10$User->check_module_permissions ("vlan", 1, true, false); 11 12# to array 13$vlan = (array) $vlan; 14 15# not existing 16if(!$vlan) { $Result->show("danger", _('Invalid VLAN id'),true); } 17 18# get custom VLAN fields 19$cfields = $Tools->fetch_custom_fields ('vlans'); 20?> 21 22<!-- content print! --> 23<h4><?php print _('VLAN details'); ?></h4> 24<hr> 25 26<table class="ipaddress_subnet table-condensed table-full"> 27 <tr> 28 <th><?php print _('Number'); ?></th> 29 <td><?php print '<b>'. $vlan['number']; ?></td> 30 </tr> 31 <tr> 32 <th><?php print _('Name'); ?></th> 33 <td> 34 <?php print $vlan['name']; ?> 35 </td> 36 </tr> 37 <tr> 38 <th><?php print _('Domain'); ?></th> 39 <td> 40 <?php 41 // domain 42 $l2domain = $Tools->fetch_object("vlanDomains", "id", $vlan['domainId']); 43 if($l2domain!==false) { print $l2domain->name; } 44 ?> 45 </td> 46 </tr> 47 <tr> 48 <th><?php print _('Description'); ?></th> 49 <td><?php print $vlan['description']; ?></td> 50 </tr> 51 52 <?php 53 # print custom subnet fields if any 54 if(sizeof($cfields) > 0) { 55 // divider 56 print "<tr><td><hr></td><td></td></tr>"; 57 // fields 58 foreach($cfields as $key=>$field) { 59 $vlan[$key] = str_replace("\n", "<br>",$vlan[$key]); 60 // create links 61 $vlan[$key] = $Result->create_links($vlan[$key]); 62 print "<tr>"; 63 print " <th>$key</th>"; 64 print " <td style='vertical-align:top;align:left;'>$vlan[$key]</td>"; 65 print "</tr>"; 66 } 67 // divider 68 print "<tr><td><hr></td><td></td></tr>"; 69 } 70 71 # action button groups 72 print "<tr>"; 73 print "<td class='actions'>"; 74 $links = []; 75 if($User->get_module_permissions ("vlan")>1) { 76 $links[] = ["type"=>"header", "text"=>"Manage"]; 77 $links[] = ["type"=>"link", "text"=>"Edit VLAN", "href"=>"", "class"=>"open_popup", "dataparams"=>" data-script='app/admin/vlans/edit.php' data-action='edit' data-vlanid='$vlan[vlanId]'", "icon"=>"pencil"]; 78 } 79 if($User->get_module_permissions ("vlan")>2) { 80 $links[] = ["type"=>"link", "text"=>"Delete VLAN", "href"=>"", "class"=>"open_popup", "dataparams"=>" data-script='app/admin/vlans/edit.php' data-action='delete' data-vlanid='$vlan[vlanId]'", "icon"=>"times"]; 81 } 82 // print links 83 print $User->print_actions($User->user->compress_actions, $links); 84 print "</td>"; 85 print '</tr>'. "\n"; 86 print "</tr>"; 87 88 ?> 89 90</table> <!-- end subnet table --> 91<br>