- output right number of documents and folders found

This commit is contained in:
steinm 2013-02-06 17:09:16 +00:00
parent d9829ab784
commit 1819516e2e

View File

@ -58,7 +58,15 @@ class LetoDMS_View_Search extends LetoDMS_Bootstrap_Style {
$this->contentStart(); $this->contentStart();
$this->pageNavigation(getMLText("search_results"), ""); $this->pageNavigation(getMLText("search_results"), "");
$foldercount = $doccount = 0;
if($entries) { if($entries) {
foreach ($entries as $entry) {
if(get_class($entry) == 'LetoDMS_Core_Document') {
$doccount++;
} elseif(get_class($entry) == 'LetoDMS_Core_Folder') {
$foldercount++;
}
}
print "<div class=\"alert\">".getMLText("search_report", array("doccount" => $doccount, "foldercount" => $foldercount, 'searchtime'=>$searchTime))."</div>"; print "<div class=\"alert\">".getMLText("search_report", array("doccount" => $doccount, "foldercount" => $foldercount, 'searchtime'=>$searchTime))."</div>";
$this->pageList($pageNumber, $totalpages, "../op/op.Search.php", $urlparams); $this->pageList($pageNumber, $totalpages, "../op/op.Search.php", $urlparams);
$this->contentContainerStart(); $this->contentContainerStart();
@ -77,70 +85,67 @@ class LetoDMS_View_Search extends LetoDMS_Bootstrap_Style {
print "</tr>\n</thead>\n<tbody>\n"; print "</tr>\n</thead>\n<tbody>\n";
$previewer = new LetoDMS_Preview_Previewer($cachedir, 40); $previewer = new LetoDMS_Preview_Previewer($cachedir, 40);
$foldercount = $doccount = 0;
foreach ($entries as $entry) { foreach ($entries as $entry) {
if(get_class($entry) == 'LetoDMS_Core_Document') { if(get_class($entry) == 'LetoDMS_Core_Document') {
$document = $entry; $document = $entry;
$doccount++; $lc = $document->getLatestContent();
$lc = $document->getLatestContent(); $previewer->createPreview($lc);
$previewer->createPreview($lc);
if (in_array(3, $searchin)) if (in_array(3, $searchin))
$comment = $this->markQuery(htmlspecialchars($document->getComment())); $comment = $this->markQuery(htmlspecialchars($document->getComment()));
else else
$comment = htmlspecialchars($document->getComment()); $comment = htmlspecialchars($document->getComment());
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
print "<tr>"; print "<tr>";
//print "<td><img src=\"../out/images/file.gif\" class=\"mimeicon\"></td>"; //print "<td><img src=\"../out/images/file.gif\" class=\"mimeicon\"></td>";
if (in_array(2, $searchin)) { if (in_array(2, $searchin)) {
$docName = $this->markQuery(htmlspecialchars($document->getName()), "i"); $docName = $this->markQuery(htmlspecialchars($document->getName()), "i");
} else { } else {
$docName = htmlspecialchars($document->getName()); $docName = htmlspecialchars($document->getName());
} }
print "<td><a class=\"standardText\" href=\"../out/out.ViewDocument.php?documentid=".$document->getID()."\">"; print "<td><a class=\"standardText\" href=\"../out/out.ViewDocument.php?documentid=".$document->getID()."\">";
if($previewer->hasPreview($lc)) { if($previewer->hasPreview($lc)) {
print "<img class=\"mimeicon\" width=\"40\"src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$lc->getVersion()."&width=40\" title=\"".htmlspecialchars($lc->getMimeType())."\">"; print "<img class=\"mimeicon\" width=\"40\"src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$lc->getVersion()."&width=40\" title=\"".htmlspecialchars($lc->getMimeType())."\">";
} else { } else {
print "<img class=\"mimeicon\" src=\"".$this->getMimeIcon($lc->getFileType())."\" title=\"".htmlspecialchars($lc->getMimeType())."\">"; print "<img class=\"mimeicon\" src=\"".$this->getMimeIcon($lc->getFileType())."\" title=\"".htmlspecialchars($lc->getMimeType())."\">";
} }
print "</a></td>"; print "</a></td>";
print "<td><a class=\"standardText\" href=\"../out/out.ViewDocument.php?documentid=".$document->getID()."\">/"; print "<td><a class=\"standardText\" href=\"../out/out.ViewDocument.php?documentid=".$document->getID()."\">/";
$folder = $document->getFolder(); $folder = $document->getFolder();
$path = $folder->getPath(); $path = $folder->getPath();
for ($i = 1; $i < count($path); $i++) { for ($i = 1; $i < count($path); $i++) {
print htmlspecialchars($path[$i]->getName())."/"; print htmlspecialchars($path[$i]->getName())."/";
} }
print $docName; print $docName;
print "</a>"; print "</a>";
if($comment) { if($comment) {
print "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>"; print "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>";
} }
print "</td>"; print "</td>";
$attributes = $lc->getAttributes(); $attributes = $lc->getAttributes();
print "<td>"; print "<td>";
print "<ul class=\"unstyled\">\n"; print "<ul class=\"unstyled\">\n";
$attributes = $lc->getAttributes(); $attributes = $lc->getAttributes();
if($attributes) { if($attributes) {
foreach($attributes as $attribute) { foreach($attributes as $attribute) {
$attrdef = $attribute->getAttributeDefinition(); $attrdef = $attribute->getAttributeDefinition();
print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars($attribute->getValue())."</li>\n"; print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars($attribute->getValue())."</li>\n";
}
} }
print "</ul>\n"; }
print "</td>"; print "</ul>\n";
print "</td>";
$owner = $document->getOwner(); $owner = $document->getOwner();
print "<td>".htmlspecialchars($owner->getFullName())."</td>"; print "<td>".htmlspecialchars($owner->getFullName())."</td>";
$display_status=$lc->getStatus(); $display_status=$lc->getStatus();
print "<td>".getOverallStatusText($display_status["status"]). "</td>"; print "<td>".getOverallStatusText($display_status["status"]). "</td>";
print "<td>".$lc->getVersion()."</td>"; print "<td>".$lc->getVersion()."</td>";
// print "<td>".$comment."</td>"; // print "<td>".$comment."</td>";
print "</tr>\n"; print "</tr>\n";
} elseif(get_class($entry) == 'LetoDMS_Core_Folder') { } elseif(get_class($entry) == 'LetoDMS_Core_Folder') {
$folder = $entry; $folder = $entry;
$foldercount++;
if (in_array(2, $searchin)) { if (in_array(2, $searchin)) {
$folderName = $this->markQuery(htmlspecialchars($folder->getName()), "i"); $folderName = $this->markQuery(htmlspecialchars($folder->getName()), "i");
} else { } else {