* @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ /** * Include parent class */ require_once("class.Bootstrap.php"); /** * Class which outputs the html page for Search result view * * @category DMS * @package LetoDMS * @author Markus Westphal, Malcolm Cowe, Uwe Steinmann * @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ 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", $str); return $str; } function show() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; $folder = $this->params['folder']; $this->query = $this->params['query']; $entries = $this->params['searchhits']; $totalpages = $this->params['totalpages']; $pageNumber = $this->params['pagenumber']; $searchTime = $this->params['searchtime']; $urlparams = $this->params['urlparams']; $searchin = $this->params['searchin']; $cachedir = $this->params['cachedir']; $this->htmlStartPage(getMLText("search_results")); $this->globalNavigation($folder); $this->contentStart(); $this->pageNavigation(getMLText("search_results"), ""); $foldercount = $doccount = 0; if($entries) { foreach ($entries as $entry) { if(get_class($entry) == 'LetoDMS_Core_Document') { $doccount++; } elseif(get_class($entry) == 'LetoDMS_Core_Folder') { $foldercount++; } } print "
".getMLText("search_report", array("doccount" => $doccount, "foldercount" => $foldercount, 'searchtime'=>$searchTime))."
"; $this->pageList($pageNumber, $totalpages, "../op/op.Search.php", $urlparams); $this->contentContainerStart(); print ""; print "\n\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; // print "\n"; //print "\n"; //print "\n"; print "\n\n\n"; $previewer = new LetoDMS_Preview_Previewer($cachedir, 40); foreach ($entries as $entry) { if(get_class($entry) == 'LetoDMS_Core_Document') { $document = $entry; $lc = $document->getLatestContent(); $previewer->createPreview($lc); if (in_array(3, $searchin)) $comment = $this->markQuery(htmlspecialchars($document->getComment())); else $comment = htmlspecialchars($document->getComment()); if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; print ""; //print ""; if (in_array(2, $searchin)) { $docName = $this->markQuery(htmlspecialchars($document->getName()), "i"); } else { $docName = htmlspecialchars($document->getName()); } print ""; print ""; $attributes = $lc->getAttributes(); print ""; $owner = $document->getOwner(); print ""; $display_status=$lc->getStatus(); print ""; print ""; // print ""; print "\n"; } elseif(get_class($entry) == 'LetoDMS_Core_Folder') { $folder = $entry; if (in_array(2, $searchin)) { $folderName = $this->markQuery(htmlspecialchars($folder->getName()), "i"); } else { $folderName = htmlspecialchars($folder->getName()); } print ""; print ""; print ""; $owner = $folder->getOwner(); print ""; print ""; print ""; if (in_array(3, $searchin)) $comment = $this->markQuery(htmlspecialchars($folder->getComment())); else $comment = htmlspecialchars($folder->getComment()); if (strlen($comment) > 50) $comment = substr($comment, 0, 47) . "..."; print ""; print "\n"; } } print "
".getMLText("name")."".getMLText("attributes")."".getMLText("owner")."".getMLText("status")."".getMLText("version")."".getMLText("comment")."".getMLText("reviewers")."".getMLText("approvers")."
getID()."\">"; if($previewer->hasPreview($lc)) { print "getID()."&version=".$lc->getVersion()."&width=40\" title=\"".htmlspecialchars($lc->getMimeType())."\">"; } else { print "getMimeIcon($lc->getFileType())."\" title=\"".htmlspecialchars($lc->getMimeType())."\">"; } print "getID()."\">/"; $folder = $document->getFolder(); $path = $folder->getPath(); for ($i = 1; $i < count($path); $i++) { print htmlspecialchars($path[$i]->getName())."/"; } print $docName; print ""; if($comment) { print "
".htmlspecialchars($comment).""; } print "
"; print "
    \n"; $attributes = $lc->getAttributes(); if($attributes) { foreach($attributes as $attribute) { $attrdef = $attribute->getAttributeDefinition(); print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars($attribute->getValue())."
  • \n"; } } print "
\n"; print "
".htmlspecialchars($owner->getFullName())."".getOverallStatusText($display_status["status"]). "".$lc->getVersion()."".$comment."
getID()."\">imgpath."folder.png\" width=\"24\" height=\"24\" border=0>getID()."\">"; $path = $folder->getPath(); print "/"; for ($i = 1; $i < count($path)-1; $i++) { print htmlspecialchars($path[$i]->getName())."/"; } print $folderName; print "".htmlspecialchars($owner->getFullName())."".$comment."
\n"; $this->contentContainerEnd(); $this->pageList($pageNumber, $totalpages, "../op/op.Search.php", $_GET); } else { $numResults = $doccount + $foldercount; if ($numResults == 0) { print "
".getMLText("search_no_results")."
"; } } $this->htmlEndPage(); } /* }}} */ } ?>