some code cleanup and no output if there are no dumps

This commit is contained in:
Uwe Steinmann 2016-02-08 12:43:50 +01:00
parent 911c7895d9
commit 450ca9953e

View File

@ -80,9 +80,6 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
print "</form>\n"; print "</form>\n";
// list backup files // list backup files
$this->contentSubHeading(getMLText("backup_list"));
$print_header=true;
$handle = opendir($contentdir); $handle = opendir($contentdir);
$entries = array(); $entries = array();
@ -96,9 +93,8 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
sort($entries); sort($entries);
$entries = array_reverse($entries); $entries = array_reverse($entries);
foreach ($entries as $entry){ if($entries) {
$this->contentSubHeading(getMLText("backup_list"));
if ($print_header){
print "<table class=\"table-condensed\">\n"; print "<table class=\"table-condensed\">\n";
print "<thead>\n<tr>\n"; print "<thead>\n<tr>\n";
print "<th></th>\n"; print "<th></th>\n";
@ -107,8 +103,8 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
print "<th>".getMLText("file_size")."</th>\n"; print "<th>".getMLText("file_size")."</th>\n";
print "<th></th>\n"; print "<th></th>\n";
print "</tr>\n</thead>\n<tbody>\n"; print "</tr>\n</thead>\n<tbody>\n";
$print_header=false;
} foreach ($entries as $entry){
$folderid=substr($entry,strpos($entry,"_")+1); $folderid=substr($entry,strpos($entry,"_")+1);
$folder=$dms->getFolder((int)$folderid); $folder=$dms->getFolder((int)$folderid);
@ -124,9 +120,8 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
print "</td>\n"; print "</td>\n";
print "</tr>\n"; print "</tr>\n";
} }
print "</table>\n";
if ($print_header) printMLText("empty_notify_list"); }
else print "</table>\n";
$this->contentContainerEnd(); $this->contentContainerEnd();
@ -141,10 +136,6 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
print "</form>\n"; print "</form>\n";
// list backup files // list backup files
$this->contentSubHeading(getMLText("dump_list"));
$print_header=true;
$handle = opendir($contentdir); $handle = opendir($contentdir);
$entries = array(); $entries = array();
while ($e = readdir($handle)){ while ($e = readdir($handle)){
@ -157,9 +148,8 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
sort($entries); sort($entries);
$entries = array_reverse($entries); $entries = array_reverse($entries);
foreach ($entries as $entry){ if($entries) {
$this->contentSubHeading(getMLText("dump_list"));
if ($print_header){
print "<table class=\"table-condensed\">\n"; print "<table class=\"table-condensed\">\n";
print "<thead>\n<tr>\n"; print "<thead>\n<tr>\n";
print "<th></th>\n"; print "<th></th>\n";
@ -167,9 +157,8 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
print "<th>".getMLText("file_size")."</th>\n"; print "<th>".getMLText("file_size")."</th>\n";
print "<th></th>\n"; print "<th></th>\n";
print "</tr>\n</thead>\n<tbody>\n"; print "</tr>\n</thead>\n<tbody>\n";
$print_header=false;
}
foreach ($entries as $entry){
print "<tr>\n"; print "<tr>\n";
print "<td><a href=\"../op/op.Download.php?dumpname=".$entry."\">".$entry."</a></td>\n"; print "<td><a href=\"../op/op.Download.php?dumpname=".$entry."\">".$entry."</a></td>\n";
print "<td>".getLongReadableDate(filectime($contentdir.$entry))."</td>\n"; print "<td>".getLongReadableDate(filectime($contentdir.$entry))."</td>\n";
@ -179,9 +168,8 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
print "</td>\n"; print "</td>\n";
print "</tr>\n"; print "</tr>\n";
} }
print "</table>\n";
if ($print_header) printMLText("empty_notify_list"); }
else print "</table>\n";
$this->contentContainerEnd(); $this->contentContainerEnd();