1<h4><?php print _("L2 domains"); ?></h4> 2<hr> 3 4<?php 5# perm check 6$User->check_module_permissions ("vlan", 1, true, false); 7?> 8 9<!-- Manage link --> 10<?php if($User->get_module_permissions ("vlan")>2) { ?> 11<div class="btn-group" style="margin-bottom:10px;"> 12 <button class='btn btn-sm btn-default open_popup' data-script='app/admin/vlans/edit-domain.php' data-class='700' data-action='add'><i class='fa fa-plus'></i> <?php print _('Add L2 Domain'); ?></button> 13 <button class='btn btn-sm btn-default open_popup' data-script='app/admin/vlans/edit.php' data-class='500' data-action='add'><i class='fa fa-plus'></i> <?php print _('Add VLAN'); ?></button> 14</div> 15<?php } ?> 16 17 18<table class="table sorted nosearch nopagination table-striped table-top table-condensed table-auto-wide" data-cookie-id-table='tools_l2_all'> 19<!-- headers --> 20<thead> 21<tr> 22 <th><?php print _('Name'); ?></th> 23 <th><?php print _('Description'); ?></th> 24 <th><?php print _('Count'); ?></th> 25 <th><?php print _('Sections'); ?></th> 26 <th></th> 27 <th></th> 28</tr> 29</thead> 30 31<tbody> 32<!-- all domains --> 33<tr> 34 <td class='border-bottom'><strong><a href="<?php print create_link($_GET['page'], $_GET['section'], "all"); ?>"> <?php print _('All domains'); ?></a></strong></td> 35 <td class='border-bottom'><?php print _('List of all VLANs in all domains'); ?></td> 36 <td class='border-bottom'></td> 37 <td class='border-bottom'><span class='text-muted'><?php print _('All sections'); ?></span></td> 38 <td class='border-bottom'><a class='btn btn-xs btn-default' href='<?php print create_link($_GET['page'], $_GET['section'], "all"); ?>'>Show VLANs</a></td> 39 <?php if($User->get_module_permissions ("vlan")>1) { ?><td class='border-bottom'></td><?php } ?> 40</tr> 41 42<!-- content --> 43<?php 44foreach($vlan_domains as $domain) { 45 // Check user has read level permission to l2domain 46 if (!$User->check_l2domain_permissions($domain, 1, false)) continue; 47 48 // format sections 49 if($domain->id==1) { 50 $sections = "All sections"; 51 } 52 elseif(strlen(@$domain->permissions==0)) { 53 $sections = "None"; 54 } 55 else { 56 //explode 57 unset($sec); 58 $sections_tmp = explode(";", $domain->permissions); 59 foreach($sections_tmp as $t) { 60 //fetch section 61 $tmp_section = $Sections->fetch_section(null, $t); 62 $sec[] = " · ".$tmp_section->name; 63 } 64 //implode 65 $sections = implode("<br>", $sec); 66 } 67 68 // count 69 $cnt = $Tools->count_database_objects ("vlans", "domainId", $domain->id); 70 71 // print 72 print "<tr class='text-top'>"; 73 print " <td><a class='btn btn-xs btn-default' href='".create_link($_GET['page'], $_GET['section'], $domain->id)."'><i class='fa fa-cloud prefix'></i> $domain->name</a></strong></td>"; 74 print " <td>$domain->description</td>"; 75 print " <td>$cnt "._("VLANs")."</td>"; 76 print " <td><span class='text-muted'>$sections</span></td>"; 77 print " <td><a class='btn btn-xs btn-default' href='".create_link($_GET['page'], $_GET['section'], $domain->id)."'>Show VLANs</a></td>"; 78 79 // links 80 print "<td class='actions'>"; 81 $links = []; 82 if($User->get_module_permissions ("vlan")>0) { 83 $links[] = ["type"=>"header", "text"=>"Show"]; 84 $links[] = ["type"=>"link", "text"=>"Show domain VLANs", "href"=>create_link($_GET['page'], "vlan", $domain->id), "icon"=>"eye", "visible"=>"dropdown"]; 85 $links[] = ["type"=>"divider"]; 86 } 87 if($User->get_module_permissions ("vlan")>1) { 88 $links[] = ["type"=>"header", "text"=>"Manage"]; 89 $links[] = ["type"=>"link", "text"=>"Edit domain", "href"=>"", "class"=>"open_popup", "dataparams"=>" data-script='app/admin/vlans/edit-domain.php' data-class='700' data-action='edit' data-id='$domain->id'", "icon"=>"pencil"]; 90 } 91 if($User->get_module_permissions ("vlan")>2) { 92 $links[] = ["type"=>"link", "text"=>"Delete domain", "href"=>"", "class"=>"open_popup", "dataparams"=>"data-script='app/admin/vlans/edit-domain.php' data-class='700' data-action='delete' data-id='$domain->id'", "icon"=>"times"]; 93 $links[] = ["type"=>"divider"]; 94 } 95 // print links 96 print $User->print_actions($User->user->compress_actions, $links); 97 print "</td>"; 98 99 print "</tr>"; 100} 101?> 102</tbody> 103</table>