* @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 SeedDMS * @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 SeedDMS_View_Search extends SeedDMS_Bootstrap_Style { /** * Mark search query sting in a given string * * @param string $str mark this text * @param string $tag wrap the marked text with this html tag * @return string marked text */ 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']; $fullsearch = $this->params['fullsearch']; $totaldocs = $this->params['totaldocs']; $totalfolders = $this->params['totalfolders']; $attrdefs = $this->params['attrdefs']; $allCats = $this->params['allcategories']; $allUsers = $this->params['allusers']; $mode = $this->params['mode']; $resultmode = $this->params['resultmode']; $workflowmode = $this->params['workflowmode']; $enablefullsearch = $this->params['enablefullsearch']; $enableclipboard = $this->params['enableclipboard']; $attributes = $this->params['attributes']; $categories = $this->params['categories']; $owner = $this->params['owner']; $startfolder = $this->params['startfolder']; $startdate = $this->params['startdate']; $stopdate = $this->params['stopdate']; $expstartdate = $this->params['expstartdate']; $expstopdate = $this->params['expstopdate']; $creationdate = $this->params['creationdate']; $expirationdate = $this->params['expirationdate']; $status = $this->params['status']; $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']; $previewwidth = $this->params['previewWidthList']; $this->htmlStartPage(getMLText("search_results")); $this->globalNavigation(); $this->contentStart(); $this->pageNavigation(getMLText("search_results"), ""); echo "
\n"; echo "
\n"; ?>
contentContainerStart(); ?> getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) { ?>
:
:
:
:
: printFolderChooser("form1", M_READ, -1, $startfolder);?>
:
">   ">
getName()); ?>: printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '') ?>
contentContainerEnd(); // }}} /* First check if any of the folder filters are set. If it is, * open the accordion. */ $openfilterdlg = false; if($attrdefs) { foreach($attrdefs as $attrdef) { $attricon = ''; if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent) { if(!empty($attributes[$attrdef->getID()])) $openfilterdlg = true; } } } if($categories) $openfilterdlg = true; if($status) $openfilterdlg = true; if($expirationdate) $openfilterdlg = true; ?>
" style="_height: 0px;">
getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent) { ?>
:
:
:
">   ">
getName()); ?>: printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '') ?>
getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder) { if(!empty($attributes[$attrdef->getID()])) $openfilterdlg = true; } } } ?>
" style="_height: 0px;">
getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder) { ?>
getName()); ?>: printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '') ?>
\n"; $this->contentContainerStart(); ?>
:
:
:
contentContainerEnd(); echo "
\n"; } ?>
\n"; echo "
\n"; // Database search Result {{{ $foldercount = $doccount = 0; if($entries) { foreach ($entries as $entry) { if(get_class($entry) == 'SeedDMS_Core_Document') { $doccount++; } elseif(get_class($entry) == 'SeedDMS_Core_Folder') { $foldercount++; } } print "
".getMLText("search_report", array("doccount" => $totaldocs, "foldercount" => $totalfolders, '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\n\n"; $previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth); foreach ($entries as $entry) { if(get_class($entry) == 'SeedDMS_Core_Document') { $document = $entry; $owner = $document->getOwner(); $lc = $document->getLatestContent(); $version = $lc->getVersion(); $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 "getID()."\">"; //print ""; if (in_array(2, $searchin)) { $docName = $this->markQuery(htmlspecialchars($document->getName()), "i"); } else { $docName = htmlspecialchars($document->getName()); } print ""; print ""; print ""; $display_status=$lc->getStatus(); print ""; print ""; print "\n"; } elseif(get_class($entry) == 'SeedDMS_Core_Folder') { $folder = $entry; $owner = $folder->getOwner(); if (in_array(2, $searchin)) { $folderName = $this->markQuery(htmlspecialchars($folder->getName()), "i"); } else { $folderName = htmlspecialchars($folder->getName()); } print "getID()."\" rel=\"folder_".$folder->getID()."\" class=\"folder\" ondragover=\"allowDrop(event)\" ondrop=\"onDrop(event)\">"; print ""; print ""; print ""; print ""; print ""; print "\n"; } } print "
".getMLText("name")."".getMLText("attributes")."".getMLText("status")."".getMLText("action")."
getID()."\">"; if($previewer->hasPreview($lc)) { print "getID()."&version=".$lc->getVersion()."&width=".$previewwidth."\" 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 ""; print "
".getMLText('owner').": ".htmlspecialchars($owner->getFullName()).", ".getMLText('creation_date').": ".date('Y-m-d', $document->getDate()).", ".getMLText('version')." ".$version." - ".date('Y-m-d', $lc->getDate()).""; if($comment) { print "
".htmlspecialchars($comment).""; } print "
"; print "
    \n"; $lcattributes = $lc->getAttributes(); if($lcattributes) { foreach($lcattributes as $lcattribute) { $attrdef = $lcattribute->getAttributeDefinition(); print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $lcattribute->getValueAsArray()))."
  • \n"; } } print "
\n"; print "
    \n"; $docttributes = $document->getAttributes(); if($docttributes) { foreach($docttributes as $docttribute) { $attrdef = $docttribute->getAttributeDefinition(); print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $docttribute->getValueAsArray()))."
  • \n"; } } print "
\n"; print "
".getOverallStatusText($display_status["status"]). ""; print "
"; if($document->getAccessMode($user) >= M_ALL) { $this->printDeleteDocumentButton($document, 'splash_rm_document'); } else { ?> getAccessMode($user) >= M_READWRITE) { ?> getID(); ?>" msg="" _href="../op/op.AddToClipboard.php?documentid=getID(); ?>&type=document&id=getID(); ?>&refferer=params['refferer']); ?>" title=""> "; print "
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 ""; print "
".getMLText('owner').": ".htmlspecialchars($owner->getFullName()).", ".getMLText('creation_date').": ".date('Y-m-d', $folder->getDate()).""; 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) . "..."; if($comment) { print "
".htmlspecialchars($comment).""; } print "
"; print "
    \n"; $folderattributes = $folder->getAttributes(); if($folderattributes) { foreach($folderattributes as $folderattribute) { $attrdef = $folderattribute->getAttributeDefinition(); print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $folderattribute->getValueAsArray()))."
  • \n"; } } print "
"; print "
"; if($folder->getAccessMode($user) >= M_ALL) { $this->printDeleteFolderButton($folder, 'splash_rm_folder'); } else { ?> getAccessMode($user) >= M_READWRITE) { ?> getID(); ?>" msg="" _href="../op/op.AddToClipboard.php?folderid=getID(); ?>&type=folder&id=getID(); ?>&refferer=params['refferer']); ?>" title=""> "; print "
\n"; // $this->contentContainerEnd(); $this->pageList($pageNumber, $totalpages, "../op/op.Search.php", $_GET); } else { $numResults = $doccount + $foldercount; if ($numResults == 0) { print "
".getMLText("search_no_results")."
"; } } // }}} echo "
"; echo "
"; $this->htmlEndPage(); } /* }}} */ } ?>