list_zones.php
changeset 82 c255196bc447
parent 76 0748816801b2
child 108 b1015b3055af
equal deleted inserted replaced
81:c72d6d51f3d3 82:c255196bc447
    20  */
    20  */
    21 
    21 
    22 require_once("inc/toolkit.inc.php");
    22 require_once("inc/toolkit.inc.php");
    23 include_once("inc/header.inc.php");
    23 include_once("inc/header.inc.php");
    24 
    24 
    25 $num_all_domains = zone_count(0);
    25 if (verify_permission(zone_content_view_others)) { $perm_view = "all" ; } 
    26 $doms = zone_count(0, LETTERSTART);
    26 elseif (verify_permission(zone_content_view_own)) { $perm_view = "own" ; }
    27 ?>
    27 else { $perm_view = "none" ;}
    28    <h2><?php echo _('List all zones'); ?></h2>
       
    29 <?php
       
    30         echo "<div class=\"showmax\">";
       
    31         show_pages($doms,ROWAMOUNT);
       
    32         echo "</div>";
       
    33 
    28 
    34 if ($num_all_domains > ROWAMOUNT)
    29 if (verify_permission(zone_content_edit_others)) { $perm_edit = "all" ; } 
    35 {
    30 elseif (verify_permission(zone_content_edit_own)) { $perm_edit = "own" ;} 
    36         echo "<div class=\"showmax\">";
    31 else { $perm_edit = "none" ; }
    37         show_letters(LETTERSTART);
       
    38         echo "</div>";
       
    39 }
       
    40 ?>
       
    41    <table>
       
    42     <tr>
       
    43      <th>&nbsp;</th>
       
    44      <th><?php echo _('Name'); ?></th>
       
    45      <th><?php echo _('Type'); ?></th>
       
    46      <th><?php echo _('Records'); ?></th>
       
    47      <th><?php echo _('Owner'); ?></th>
       
    48     </tr>
       
    49     <tr>
       
    50 
    32 
    51 <?php
    33 $count_zones_all = zone_count_ng("all");
    52 if ($num_all_domains < ROWAMOUNT) {
    34 $count_zones_all_letterstart = zone_count_ng($perm_view,LETTERSTART); 
    53    $doms = get_domains(0,"all",ROWSTART,ROWAMOUNT);
    35 $count_zones_view = zone_count_ng($perm_view);
       
    36 $count_zones_edit = zone_count_ng($perm_edit);
       
    37 
       
    38 echo "    <h2>" . _('List zones') . "</h2>\n";
       
    39 
       
    40 if ($perm_view == "none") { 
       
    41 	echo "     <p>" . _("You do not have the permission to see any zones.") . "</p>\n";
    54 } else {
    42 } else {
    55    $doms = get_domains(0,LETTERSTART,ROWSTART,ROWAMOUNT);
    43 	echo "     <div class=\"showmax\">\n";
    56    $num_show_domains = ($doms == -1) ? 0 : count($doms);
    44 	show_pages($count_zones_all_letterstart,ROWAMOUNT);
       
    45 	echo "     </div>\n";
       
    46 
       
    47 	if ($count_zones_view > ROWAMOUNT) {
       
    48 		echo "<div class=\"showmax\">";
       
    49 		show_letters(LETTERSTART);
       
    50 		echo "</div>";
       
    51 	}
       
    52 	echo "     <table>\n";
       
    53 	echo "      <tr>\n";
       
    54 	echo "       <th>&nbsp;</th>\n";
       
    55 	echo "       <th>" . _('Name') . "</th>\n";
       
    56 	echo "       <th>" . _('Type') . "</th>\n";
       
    57 	echo "       <th>" . _('Records') . "</th>\n";
       
    58 	echo "       <th>" . _('Owner') . "</th>\n";
       
    59 	echo "      </tr>\n";
       
    60 	echo "      <tr>\n";
       
    61 
       
    62 	if ($count_zones_view < ROWAMOUNT) {
       
    63 		$zones = get_zones($perm_view,$_SESSION['userid'],"all",ROWSTART,ROWAMOUNT);
       
    64 	} else {
       
    65 		$zones = get_zones($perm_view,$_SESSION['userid'],LETTERSTART,ROWSTART,ROWAMOUNT);
       
    66 		$count_zones_shown = ($zones == -1) ? 0 : count($zones);
       
    67 	}
       
    68 	foreach ($zones as $zone)
       
    69 	{
       
    70 		$zone_owners = get_fullnames_owners_from_domainid($zone["id"]);
       
    71 
       
    72 		echo "         <tr>\n";
       
    73 		echo "          <td>\n";
       
    74 		echo "           <a href=\"edit.php?id=" . $zone['id'] . "\"><img src=\"images/edit.gif\" title=\"" . _('View zone') . " " . $zone['name'] . "\" alt=\"[ " . _('View zone') . " " . $zone['name'] . " ]\"></a>\n";
       
    75 		if ( $perm_edit != "all" || $perm_edit != "none") {
       
    76 			$user_is_zone_owner = verify_user_is_owner_zoneid($zone["id"]);
       
    77 		}
       
    78 		if ( $perm_edit == "all" || ( $perm_edit == "own" && $user_is_zone_owner == "1") ) {
       
    79       			echo "           <a href=\"delete_domain.php?id=" . $zone["id"] . "\"><img src=\"images/delete.gif\" title=\"" . _('Delete zone') . " " . $zone['name'] . "\" alt=\"[ ". _('Delete zone') . " " . $zone['name'] . " ]\"></a>\n";
       
    80 		}
       
    81 		echo "          </td>\n";
       
    82 		echo "          <td class=\"y\">" . $zone["name"] . "</td>\n";
       
    83 		echo "          <td class=\"y\">" . strtolower($zone["type"]) . "</td>\n";
       
    84 		echo "          <td class=\"y\">" . $zone["count_records"] . "</td>\n";
       
    85 		echo "          <td class=\"y\">" . $zone_owners . "</td>\n";
       
    86 	}
       
    87 	echo "           </tr>\n";
       
    88 	echo "          </table>\n";
       
    89 
    57 }
    90 }
    58 
    91 
    59 // If the user doesnt have any domains print a message saying so
       
    60 if ($doms < 0)
       
    61 {
       
    62 	?>
       
    63     <tr>
       
    64      <td>&nbsp;</td>
       
    65      <td colspan="4"><?php echo _('There are no zones.'); ?></td>
       
    66     </tr>
       
    67 <?php
       
    68 }
       
    69 
       
    70 // If he has domains, dump them (duh)
       
    71 else
       
    72 {
       
    73 	foreach ($doms as $c)
       
    74 	{
       
    75 		?>
       
    76 		
       
    77     <tr>
       
    78      <td>
       
    79       <a href="edit.php?id=<?php echo $c["id"] ?>"><img src="images/edit.gif" title="<?php echo _('Edit zone') . " " . $c['name']; ?>" alt="[ <?php echo _('Edit zone') . " " . $c['name']; ?> ]"></a>
       
    80 <?php
       
    81 		if (level(5))
       
    82 		{
       
    83 ?>
       
    84       <a href="delete_domain.php?id=<?php echo $c["id"] ?>"><img src="images/delete.gif" title="<?php print _('Delete zone') . " " . $c['name']; ?>" alt="[<?php echo _('Delete zone') . " " . $c['name']; ?>]"></a>
       
    85 <?php
       
    86 		}
       
    87 ?>
       
    88      </td>
       
    89      <td class="y"><?php echo $c["name"] ?></td>
       
    90      <td class="y"><?php echo strtolower(get_domain_type($c["id"])) ?></td>
       
    91      <td class="y"><?php echo $c["numrec"] ?></td>
       
    92 
       
    93 <?php
       
    94 		$zone_owners = get_owners_from_domainid($c["id"]);
       
    95 		if ($zone_owners == "")
       
    96 		{
       
    97 			echo "<td class=\"n\"></td>";
       
    98 		}
       
    99 		else
       
   100 		{
       
   101 			print "<td class=\"y\">".$zone_owners."</td>";
       
   102 		}
       
   103 		print "</tr>\n";
       
   104 	}
       
   105 }
       
   106 
       
   107 ?>
       
   108    </table>
       
   109 
       
   110 <?php
       
   111 if ($num_all_domains < ROWAMOUNT) {
       
   112 ?>
       
   113    <p><?php printf(_('This lists shows all %s zones(s) you have access to.'), $num_all_domains); ?></p>
       
   114 <?php
       
   115 }
       
   116 else
       
   117 {
       
   118 ?>
       
   119    <p><?php printf(_('This lists shows %s out of %s zones you have access to.'), $num_show_domains, $num_all_domains); ?></p>
       
   120 <?php
       
   121 }
       
   122 ?>
       
   123 
       
   124 
       
   125 <?php // RZ TODO Check next, does it work? 
       
   126 //  <small> echo _('You only administer some records of domains marked with an (*).'); </small>
       
   127 ?>
       
   128 
       
   129 <?php
       
   130 include_once("inc/footer.inc.php");
    92 include_once("inc/footer.inc.php");
   131 ?>
    93 ?>