mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-14 13:42:04 +00:00
- added method markQuery() which was previosly globally defined in op.Search.php
This commit is contained in:
parent
2db6c2b290
commit
ffe54b8662
|
@ -31,10 +31,20 @@ require_once("class.Bootstrap.php");
|
||||||
*/
|
*/
|
||||||
class LetoDMS_View_Search extends LetoDMS_Bootstrap_Style {
|
class LetoDMS_View_Search extends LetoDMS_Bootstrap_Style {
|
||||||
|
|
||||||
|
function markQuery($str, $tag = "b") {
|
||||||
|
$querywords = preg_split("/ /", $this->query);
|
||||||
|
|
||||||
|
foreach ($querywords as $queryword)
|
||||||
|
$str = str_ireplace("($queryword)", "<" . $tag . ">\\1</" . $tag . ">", $str);
|
||||||
|
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
function show() { /* {{{ */
|
function show() { /* {{{ */
|
||||||
$dms = $this->params['dms'];
|
$dms = $this->params['dms'];
|
||||||
$user = $this->params['user'];
|
$user = $this->params['user'];
|
||||||
$folder = $this->params['folder'];
|
$folder = $this->params['folder'];
|
||||||
|
$this->query = $this->params['query'];
|
||||||
$entries = $this->params['searchhits'];
|
$entries = $this->params['searchhits'];
|
||||||
$totalpages = $this->params['totalpages'];
|
$totalpages = $this->params['totalpages'];
|
||||||
$pageNumber = $this->params['pagenumber'];
|
$pageNumber = $this->params['pagenumber'];
|
||||||
|
@ -76,14 +86,14 @@ class LetoDMS_View_Search extends LetoDMS_Bootstrap_Style {
|
||||||
$previewer->createPreview($lc);
|
$previewer->createPreview($lc);
|
||||||
|
|
||||||
if (in_array(3, $searchin))
|
if (in_array(3, $searchin))
|
||||||
$comment = 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 = markQuery(htmlspecialchars($document->getName()), "i");
|
$docName = $this->markQuery(htmlspecialchars($document->getName()), "i");
|
||||||
} else {
|
} else {
|
||||||
$docName = htmlspecialchars($document->getName());
|
$docName = htmlspecialchars($document->getName());
|
||||||
}
|
}
|
||||||
|
@ -132,7 +142,7 @@ class LetoDMS_View_Search extends LetoDMS_Bootstrap_Style {
|
||||||
$folder = $entry;
|
$folder = $entry;
|
||||||
$foldercount++;
|
$foldercount++;
|
||||||
if (in_array(2, $searchin)) {
|
if (in_array(2, $searchin)) {
|
||||||
$folderName = markQuery(htmlspecialchars($folder->getName()), "i");
|
$folderName = $this->markQuery(htmlspecialchars($folder->getName()), "i");
|
||||||
} else {
|
} else {
|
||||||
$folderName = htmlspecialchars($folder->getName());
|
$folderName = htmlspecialchars($folder->getName());
|
||||||
}
|
}
|
||||||
|
@ -151,7 +161,7 @@ class LetoDMS_View_Search extends LetoDMS_Bootstrap_Style {
|
||||||
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
|
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
|
||||||
print "<td></td>";
|
print "<td></td>";
|
||||||
print "<td></td>";
|
print "<td></td>";
|
||||||
if (in_array(3, $searchin)) $comment = markQuery(htmlspecialchars($folder->getComment()));
|
if (in_array(3, $searchin)) $comment = $this->markQuery(htmlspecialchars($folder->getComment()));
|
||||||
else $comment = htmlspecialchars($folder->getComment());
|
else $comment = htmlspecialchars($folder->getComment());
|
||||||
if (strlen($comment) > 50) $comment = substr($comment, 0, 47) . "...";
|
if (strlen($comment) > 50) $comment = substr($comment, 0, 47) . "...";
|
||||||
print "<td>".$comment."</td>";
|
print "<td>".$comment."</td>";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user