- added searching for attributes

This commit is contained in:
steinm 2012-10-09 09:59:25 +00:00
parent b726a20ed9
commit 5f9032979c
2 changed files with 41 additions and 5 deletions

View File

@ -92,6 +92,7 @@ if (isset($_GET['searchin']) && is_array($_GET["searchin"])) {
case 1: // keywords
case 2: // name
case 3: // comment
case 4: // attributes
$searchin[$si] = $si;
break;
}
@ -100,7 +101,7 @@ if (isset($_GET['searchin']) && is_array($_GET["searchin"])) {
}
// if none is checkd search all
if (count($searchin)==0) $searchin=array( 0, 1, 2, 3);
if (count($searchin)==0) $searchin=array( 0, 1, 2, 3, 4);
// Check to see if the search has been restricted to a particular sub-tree in
// the folder hierarchy.
@ -184,6 +185,11 @@ if(isset($_GET['categoryids']) && $_GET['categoryids']) {
}
}
if (isset($_GET["attributes"]))
$attributes = $_GET["attributes"];
else
$attributes = array();
//
// Get the page number to display. If the result set contains more than
// 25 entries, it is displayed across multiple pages.
@ -206,7 +212,7 @@ if (isset($_GET["pg"])) {
// ---------------- Start searching -----------------------------------------
$startTime = getTime();
$resArr = $dms->search($query, $limit, ($pageNumber-1)*$limit, $mode, $searchin, $startFolder, $owner, $status, $startdate, $stopdate, array(), array(), $categories);
$resArr = $dms->search($query, $limit, ($pageNumber-1)*$limit, $mode, $searchin, $startFolder, $owner, $status, $startdate, $stopdate, array(), array(), $categories, $attributes);
$searchTime = getTime() - $startTime;
$searchTime = round($searchTime, 2);
@ -234,6 +240,7 @@ print "<table class=\"folderView\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("attributes")."</th>\n";
print "<th>".getMLText("owner")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
@ -265,7 +272,20 @@ foreach ($entries as $entry) {
}
print $docName;
print "</a></td>";
$attributes = $lc->getAttributes();
print "<td>";
print "<ul class=\"documentDetail\">\n";
$attributes = $lc->getAttributes();
if($attributes) {
foreach($attributes as $attribute) {
$attrdef = $attribute->getAttributeDefinition();
print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars($attribute->getValue())."</li>\n";
}
}
print "</ul>\n";
print "</td>";
$owner = $document->getOwner();
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
$display_status=$lc->getStatus();
@ -289,11 +309,13 @@ foreach ($entries as $entry) {
print "<td><a class=\"standardText\" href=\"../out/out.ViewFolder.php?folderid=".$folder->getID()."\"><img src=\"../out/images/folder_closed.gif\" width=18 height=18 border=0></a></td>";
print "<td><a class=\"standardText\" href=\"../out/out.ViewFolder.php?folderid=".$folder->getID()."\">";
$path = $folder->getPath();
for ($i = 1; $i < count($path); $i++) {
print "/".htmlspecialchars($path[$i]->getName());
print "/";
for ($i = 1; $i < count($path)-1; $i++) {
print htmlspecialchars($path[$i]->getName())."/";
}
print $folderName;
print "</a></td>";
print "<td></td>";
$owner = $folder->getOwner();
print "<td>".htmlspecialchars($owner->getFullName())."</td>";

View File

@ -103,9 +103,23 @@ function chooseKeywords(target) {
<li class="first"><input type="Checkbox" id="keywords" name="searchin[]" value="1"><label for="keywords"><?php printMLText("keywords");?></label> (<?php printMLText('documents_only'); ?>)</li>
<li><input type="Checkbox" name="searchin[]" id="searchName" value="2"><label for="searchName"><?php printMLText("name");?></label></li>
<li><input type="Checkbox" name="searchin[]" id="comment" value="3"><label for="comment"><?php printMLText("comment");?></label></li>
<li><input type="Checkbox" name="searchin[]" id="attributes" value="4"><label for="attributes"><?php printMLText("attributes");?></label></li>
</ul>
</td>
</tr>
<?php
$attrdefs = $dms->getAllAttributeDefinitions(array(LetoDMS_Core_AttributeDefinition::objtype_document, LetoDMS_Core_AttributeDefinition::objtype_documentcontent/*, LetoDMS_Core_AttributeDefinition::objtype_all*/));
if($attrdefs) {
foreach($attrdefs as $attrdef) {
?>
<tr>
<td><?php echo $attrdef->getName(); ?></td>
<td><?php UI::printAttributeEditField($attrdef, '') ?></td>
</tr>
<?php
}
}
?>
<tr>
<td><?php printMLText("category");?>:<br />(<?php printMLText('documents_only'); ?>)</td>
<td>