list_zones.php
author rejo
Wed, 27 Jun 2007 20:45:51 +0000
changeset 29 e1c60f72d494
parent 26 5d63f1e71d6e
child 34 a2826b0ebcff
permissions -rw-r--r--
[feladat @ 76] Changed some of the functions that are used for the listing of (all) zones. Instead of getting all zones from the database, it now only requests exactlty what it needs. Considerable perfomance improvement.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     1
<?php
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     2
require_once("inc/i18n.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     3
require_once("inc/toolkit.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     4
include_once("inc/header.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     5
29
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
     6
$num_all_domains = zone_count(0);
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
     7
$doms = zone_count(0, LETTERSTART);
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     8
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     9
   <h2><? echo _('List zones'); ?></h2>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    10
<?
29
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    11
        echo "<div class=\"showmax\">";
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    12
        show_pages($doms,ROWAMOUNT);
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    13
        echo "</div>";
20
76e20b9d45e6 [feladat @ 67]
rejo
parents: 15
diff changeset
    14
29
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    15
if ($num_all_domains > ROWAMOUNT)
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    16
{
29
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    17
        echo "<div class=\"showmax\">";
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    18
        show_letters(LETTERSTART);
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    19
        echo "</div>";
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    20
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    21
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    22
   <table>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    23
    <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    24
     <th>&nbsp;</th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    25
     <th><? echo _('Name'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    26
     <th><? echo _('Type'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    27
     <th><? echo _('Records'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    28
     <th><? echo _('Owner'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    29
    </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    30
    <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    31
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    32
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    33
if ($num_all_domains < ROWAMOUNT) {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    34
   $doms = get_domains(0,"all",ROWSTART,ROWAMOUNT);
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    35
} else {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    36
   $doms = get_domains(0,LETTERSTART,ROWSTART,ROWAMOUNT);
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    37
   $num_show_domains = count($doms);
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    38
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    39
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    40
// If the user doesnt have any domains print a message saying so
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    41
if ($doms < 0)
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    42
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    43
	?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    44
    <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    45
     <td>&nbsp;</td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    46
     <td colspan="4"><? echo _('There are no zones.'); ?></td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    47
    </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    48
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    49
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    50
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    51
// If he has domains, dump them (duh)
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    52
else
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    53
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    54
	foreach ($doms as $c)
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    55
	{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    56
		?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    57
		
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    58
    <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    59
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    60
if (level(5))
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    61
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    62
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    63
     <td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    64
      <a href="edit.php?id=<? echo $c["id"] ?>"><img src="images/edit.gif" title="<? echo _('Edit zone') . " " . $c['name']; ?>" alt="[ <? echo _('Edit zone') . " " . $c['name']; ?> ]"></a>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    65
      <a href="delete_domain.php?id=<? echo $c["id"] ?>"><img src="images/delete.gif" title="<? print _('Delete zone') . " " . $c['name']; ?>" alt="[<? echo _('Delete zone') . " " . $c['name']; ?>]"></a>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    66
     </td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    67
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    68
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    69
else
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    70
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    71
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    72
     <td class="n">
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    73
      &nbsp;
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    74
     </td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    75
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    76
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    77
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    78
     <td class="y"><? echo $c["name"] ?></td>
26
5d63f1e71d6e [feladat @ 73]
rejo
parents: 20
diff changeset
    79
     <td class="y"><? echo strtolower(get_domain_type($c["id"])) ?></td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    80
     <td class="y"><? echo $c["numrec"] ?></td>
26
5d63f1e71d6e [feladat @ 73]
rejo
parents: 20
diff changeset
    81
     <td class="y"><? echo get_owners_from_domainid($c["id"]) ?></td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    82
    </tr><?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    83
		print "\n";
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    84
	}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    85
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    86
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    87
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    88
   </table>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    89
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    90
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    91
if ($num_all_domains < ROWAMOUNT) {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    92
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    93
   <p><? printf(_('This lists shows all %s zones(s) you have access to.'), $num_all_domains); ?></p>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    94
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    95
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    96
else
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    97
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    98
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    99
   <p><? printf(_('This lists shows %s out of %s zones you have access to.'), $num_show_domains, $num_all_domains); ?></p>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   100
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   101
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   102
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   103
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   104
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   105
<? // RZ TODO Check next, does it work? 
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   106
//  <small> echo _('You only administer some records of domains marked with an (*).'); </small>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   107
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   108
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   109
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   110
include_once("inc/footer.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   111
?>