2012-12-14 07:53:13 +00:00
< ? php
/**
* Implementation of Search result view
*
* @ category DMS
2013-02-14 11:10:53 +00:00
* @ package SeedDMS
2012-12-14 07:53:13 +00:00
* @ license GPL 2
* @ version @ version @
* @ author Uwe Steinmann < uwe @ steinmann . cx >
* @ 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
*/
2021-04-18 05:08:00 +00:00
//require_once("class.Bootstrap.php");
2012-12-14 07:53:13 +00:00
/**
* Class which outputs the html page for Search result view
*
* @ category DMS
2013-02-14 11:10:53 +00:00
* @ package SeedDMS
2012-12-14 07:53:13 +00:00
* @ author Markus Westphal , Malcolm Cowe , Uwe Steinmann < uwe @ steinmann . cx >
* @ copyright Copyright ( C ) 2002 - 2005 Markus Westphal ,
* 2006 - 2008 Malcolm Cowe , 2010 Matteo Lucarelli ,
* 2010 - 2012 Uwe Steinmann
* @ version Release : @ package_version @
*/
2021-04-18 05:08:00 +00:00
class SeedDMS_View_Search extends SeedDMS_Theme_Style {
2012-12-14 07:53:13 +00:00
2013-06-07 08:12:49 +00:00
/**
* 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 " ) { /* {{{ */
2013-01-25 09:39:37 +00:00
$querywords = preg_split ( " / / " , $this -> query );
2022-08-24 05:55:10 +00:00
2013-01-25 09:39:37 +00:00
foreach ( $querywords as $queryword )
$str = str_ireplace ( " ( $queryword ) " , " < " . $tag . " > \\ 1</ " . $tag . " > " , $str );
2022-08-24 05:55:10 +00:00
2013-01-25 09:39:37 +00:00
return $str ;
2013-06-07 08:12:49 +00:00
} /* }}} */
2013-01-25 09:39:37 +00:00
2015-12-14 08:53:42 +00:00
function js () { /* {{{ */
2016-11-08 10:10:09 +00:00
header ( 'Content-Type: application/javascript; charset=UTF-8' );
2019-07-11 15:18:03 +00:00
parent :: jsTranslations ( array ( 'cancel' , 'splash_move_document' , 'confirm_move_document' , 'move_document' , 'confirm_transfer_link_document' , 'transfer_content' , 'link_document' , 'splash_move_folder' , 'confirm_move_folder' , 'move_folder' ));
2015-12-14 08:53:42 +00:00
2022-08-18 11:49:27 +00:00
?>
$ ( document ) . ready ( function () {
$ ( '#export' ) . on ( 'click' , function ( e ) {
e . preventDefault ();
2022-08-24 05:57:14 +00:00
var url = " " ;
url = $ ( this ) . attr ( 'href' ) + '&includecontent=' + ( $ ( '#includecontent' ) . prop ( 'checked' ) ? '1' : '0' );
var inputs = $ ( 'input[name^=\"marks\"]' );
var values = {};
inputs . each ( function () {
if ( this . checked )
values [ this . name ] = 1 ;
});
url += '&' + $ . param ( values );
window . location . href = url ;
2022-08-18 11:49:27 +00:00
});
2022-08-24 05:57:14 +00:00
2022-09-14 16:08:34 +00:00
$ ( '#changecategory' ) . on ( 'click' , function ( e ) {
2022-08-18 16:40:51 +00:00
e . preventDefault ();
2022-08-24 05:57:14 +00:00
var url = " " ;
2022-09-14 16:08:34 +00:00
url = $ ( this ) . attr ( 'href' ) + '&changecategory=' + $ ( '#batchcategory' ) . val () + '&removecategory=' + ( $ ( '#removecategory' ) . prop ( 'checked' ) ? '1' : '0' );
2022-08-24 05:57:14 +00:00
var inputs = $ ( 'input[name^=\"marks\"]' );
var values = {};
inputs . each ( function () {
if ( this . checked )
values [ this . name ] = 1 ;
});
url += '&' + $ . param ( values );
window . location . href = url ;
2022-08-18 16:40:51 +00:00
});
2022-09-14 16:08:34 +00:00
2022-09-06 08:41:39 +00:00
< ? php if ( $this -> getParam ( 'theme' ) !== 'bootstrap4' ) : ?>
$ ( 'body' ) . on ( 'click' , 'a.change-owner-btn' , function ( ev ){
ev . preventDefault ();
ev . stopPropagation ();
confirmmsg = $ ( ev . currentTarget ) . attr ( 'confirmmsg' );
href = $ ( ev . currentTarget ) . attr ( 'href' );
bootbox . dialog ( confirmmsg , [{
" label " : " <i class='fa fa-user'></i> <?= getMLText( " batch_change_owner " ) ?> " ,
" class " : " btn-danger " ,
" callback " : function () {
var url = " " ;
url = href + '&newowner=' + ( $ ( '#newowner' ) . val ());
var inputs = $ ( 'input[name^=\"marks\"]' );
var values = {};
inputs . each ( function () {
if ( this . checked )
values [ this . name ] = 1 ;
});
url += '&' + $ . param ( values );
window . location . href = url ;
}
}, {
" label " : " <?= getMLText( " cancel " ) ?> " ,
" class " : " btn-cancel " ,
" callback " : function () {
}
}]);
});
< ? php else : ?>
$ ( 'body' ) . on ( 'click' , 'a.change-owner-btn' , function ( ev ){
ev . preventDefault ();
ev . stopPropagation ();
confirmmsg = $ ( ev . currentTarget ) . attr ( 'confirmmsg' );
href = $ ( ev . currentTarget ) . attr ( 'href' );
bootbox . confirm ({
" message " : confirmmsg ,
" buttons " : {
" confirm " : {
" label " : " <i class='fa fa-user'></i> <?= getMLText( " batch_change_owner " ) ?> " ,
" className " : " btn-danger " ,
},
" cancel " : {
" label " : " <?= getMLText( " cancel " ) ?> " ,
" className " : " btn-secondary " ,
}
},
" callback " : function ( result ) {
if ( result ) {
var url = " " ;
url = href + '&newowner=' + ( $ ( '#newowner' ) . val ());
var inputs = $ ( 'input[name^=\"marks\"]' );
var values = {};
inputs . each ( function () {
if ( this . checked )
values [ this . name ] = 1 ;
});
url += '&' + $ . param ( values );
window . location . href = url ;
}
}
});
});
< ? php endif ; ?>
2022-08-18 11:49:27 +00:00
});
< ? php
2020-08-28 09:54:52 +00:00
// $this->printFolderChooserJs("form1");
2015-12-14 08:53:42 +00:00
$this -> printDeleteFolderButtonJs ();
2022-08-24 05:57:14 +00:00
$this -> printMarkDocumentButtonJs ();
2015-12-14 08:53:42 +00:00
$this -> printDeleteDocumentButtonJs ();
2020-02-28 08:48:43 +00:00
/* Add js for catching click on document in one page mode */
$this -> printClickDocumentJs ();
$this -> printClickFolderJs ();
2021-05-06 20:22:37 +00:00
?>
$ ( document ) . ready ( function () {
$ ( 'body' ) . on ( 'submit' , '#form1' , function ( ev ){
});
});
< ? php
2015-12-14 08:53:42 +00:00
} /* }}} */
2022-08-24 05:57:14 +00:00
/**
* Print button with icon for marking a document
*
* @ param object $document document to be marked
* @ param boolean $return return html instead of printing it
* @ return string html content if $return is true , otherwise an empty string
*/
function printMarkDocumentButton ( $document , $return = false ){ /* {{{ */
$docid = $document -> getID ();
$content = '' ;
$content .= '<br /><span class="mark-btn document-unmarked" title="' . getMLText ( 'mark_document' ) . '" rel="D' . $docid . '"><i class="fa fa-square-o"></i></span><input type="checkbox" id="marks_D' . $docid . '" name="marks[D' . $docid . ']" value="1" style="display: none;">' ;
if ( $return )
return $content ;
else
echo $content ;
return '' ;
} /* }}} */
/**
* Print button with icon for marking a folder
*
* @ param object $folder folder to be marked
* @ param boolean $return return html instead of printing it
* @ return string html content if $return is true , otherwise an empty string
*/
function printMarkFolderButton ( $folder , $return = false ){ /* {{{ */
$folderid = $folder -> getID ();
$content = '' ;
$content .= '<br /><span class="mark-btn folder-unmarked" title="' . getMLText ( 'mark_folder' ) . '" rel="F' . $folderid . '"><i class="fa fa-square-o"></i></span><input type="checkbox" id="marks_F' . $folderid . '" name="marks[F' . $folderid . ']" value="1" style="display: none;">' ;
if ( $return )
return $content ;
else
echo $content ;
return '' ;
} /* }}} */
function printMarkDocumentButtonJs (){ /* {{{ */
$url = $this -> html_url ( 'Search' , array_merge ( $_GET , array ( 'action' => null )));
echo "
// ".$url."
$ ( document ) . ready ( function () {
$ ( 'body' ) . on ( 'click' , 'span.mark-btn' , function ( ev ){
ev . stopPropagation ();
id = $ ( ev . currentTarget ) . attr ( 'rel' );
$ ( '#marks_' + id ) . each ( function () { this . checked = ! this . checked ; });
$ ( this ) . parents ( 'tr' ) . toggleClass ( 'table-info' );
$ ( this ) . find ( 'i' ) . toggleClass ( 'fa-square-o fa-check-square-o' )
});
});
" ;
} /* }}} */
2022-08-18 11:49:27 +00:00
function export () { /* {{{ */
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
$entries = $this -> params [ 'searchhits' ];
$includecontent = $this -> params [ 'includecontent' ];
2022-08-24 05:57:14 +00:00
$marks = $this -> params [ 'marks' ];
2022-08-18 11:49:27 +00:00
include ( " ../inc/inc.ClassDownloadMgr.php " );
$downmgr = new SeedDMS_Download_Mgr ();
if ( $extraheader = $this -> callHook ( 'extraDownloadHeader' ))
$downmgr -> addHeader ( $extraheader );
foreach ( $entries as $entry ) {
if ( $entry -> isType ( 'document' )) {
2022-08-24 05:57:14 +00:00
if ( empty ( $marks ) || ! empty ( $marks [ 'D' . $entry -> getId ()])) {
$extracols = $this -> callHook ( 'extraDownloadColumns' , $entry );
$filename = $this -> callHook ( 'filenameDownloadItem' , $entry -> getLatestContent ());
if ( $includecontent && $rawcontent = $this -> callHook ( 'rawcontent' , $entry -> getLatestContent ())) {
$downmgr -> addItem ( $entry -> getLatestContent (), $extracols , $rawcontent , $filename );
} else
$downmgr -> addItem ( $entry -> getLatestContent (), $extracols , null , $filename );
}
2022-08-18 11:49:27 +00:00
}
}
$filename = tempnam ( sys_get_temp_dir (), '' );
if ( $includecontent ) {
$downmgr -> createArchive ( $filename );
header ( " Content-Transfer-Encoding: binary " );
header ( " Content-Length: " . filesize ( $filename ));
header ( " Content-Disposition: attachment; filename= \" export- " . date ( 'Y-m-d' ) . " .zip \" " );
header ( " Content-Type: application/zip " );
header ( " Cache-Control: must-revalidate " );
} else {
$downmgr -> createToc ( $filename );
header ( " Content-Transfer-Encoding: binary " );
header ( " Content-Length: " . filesize ( $filename ));
header ( " Content-Disposition: attachment; filename= \" export- " . date ( 'Y-m-d' ) . " .xlsx \" " );
header ( " Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet " );
header ( " Cache-Control: must-revalidate " );
}
readfile ( $filename );
unlink ( $filename );
} /* }}} */
2022-08-18 16:40:51 +00:00
function changeowner () { /* {{{ */
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
$entries = $this -> params [ 'searchhits' ];
$newowner = $this -> params [ 'newowner' ];
2022-08-24 05:57:14 +00:00
$marks = $this -> params [ 'marks' ];
2022-08-18 16:40:51 +00:00
2022-08-18 18:41:11 +00:00
if ( $newowner && $user -> isAdmin ()) {
$j = $i = 0 ;
2022-08-18 16:40:51 +00:00
foreach ( $entries as $entry ) {
2022-08-24 05:57:14 +00:00
$prefix = $entry -> isType ( 'document' ) ? 'D' : 'F' ;
if ( empty ( $marks ) || ! empty ( $marks [ $prefix . $entry -> getId ()])) {
2022-08-18 16:40:51 +00:00
if ( $entry -> getOwner () -> getId () != $newowner -> getId ()) {
$entry -> setOwner ( $newowner );
$j ++ ;
}
2022-08-24 05:57:14 +00:00
}
2022-08-18 16:40:51 +00:00
}
$this -> setParam ( 'batchmsg' , getMLText ( 'batch_new_owner_msg' , [ 'count' => $j ]));
} else {
}
return self :: show ();
} /* }}} */
2022-09-14 16:08:34 +00:00
function changecategory () { /* {{{ */
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
$entries = $this -> params [ 'searchhits' ];
$changecategory = $this -> params [ 'changecategory' ];
$removecategory = $this -> params [ 'removecategory' ];
$marks = $this -> params [ 'marks' ];
if ( $changecategory && $user -> isAdmin ()) {
$j = $i = 0 ;
foreach ( $entries as $entry ) {
if ( $entry -> isType ( 'document' )) {
if ( empty ( $marks ) || ! empty ( $marks [ 'D' . $entry -> getId ()])) {
if ( ! $removecategory ) {
if ( ! $entry -> hasCategory ( $changecategory )) {
$entry -> addCategories ([ $changecategory ]);
$j ++ ;
}
} else {
if ( $entry -> hasCategory ( $changecategory )) {
$entry -> removeCategories ([ $changecategory ]);
$j ++ ;
}
}
}
}
}
if ( $removecategory ) {
$this -> setParam ( 'batchmsg' , getMLText ( 'batch_remove_category_msg' , [ 'count' => $j , 'catname' => $changecategory -> getName ()]));
} else {
$this -> setParam ( 'batchmsg' , getMLText ( 'batch_add_category_msg' , [ 'count' => $j , 'catname' => $changecategory -> getName ()]));
}
} else {
}
return self :: show ();
} /* }}} */
2022-08-18 11:49:27 +00:00
function opensearchsuggestion () { /* {{{ */
2020-12-14 06:08:48 +00:00
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
$query = $this -> params [ 'query' ];
$entries = $this -> params [ 'searchhits' ];
$recs = array ();
$content = " <?xml version= \" 1.0 \" ?> \n " ;
$content .= " <SearchSuggestion version= \" 2.0 \" xmlns= \" http://opensearch.org/searchsuggest2 \" > \n " ;
$content .= " <Query xml:space= \" preserve \" > " . $query . " </Query> " ;
if ( $entries ) {
$content .= " <Section> \n " ;
foreach ( $entries as $entry ) {
$content .= " <Item> \n " ;
if ( $entry -> isType ( 'document' )) {
$content .= " <Text xml:space= \" preserve \" > " . $entry -> getName () . " </Text> \n " ;
$content .= " <Url xml:space= \" preserve \" >http: " . (( isset ( $_SERVER [ 'HTTPS' ]) && ( strcmp ( $_SERVER [ 'HTTPS' ], 'off' ) != 0 )) ? " s " : " " ) . " :// " . $_SERVER [ 'HTTP_HOST' ] . $settings -> _httpRoot . " out/out.ViewDocument.php?documentid= " . $entry -> getId () . " </Url> \n " ;
} elseif ( $entry -> isType ( 'folder' )) {
$content .= " <Text xml:space= \" preserve \" > " . $entry -> getName () . " </Text> \n " ;
$content .= " <Url xml:space= \" preserve \" >http: " . (( isset ( $_SERVER [ 'HTTPS' ]) && ( strcmp ( $_SERVER [ 'HTTPS' ], 'off' ) != 0 )) ? " s " : " " ) . " :// " . $_SERVER [ 'HTTP_HOST' ] . $settings -> _httpRoot . " out/out.ViewFolder.php?folderid= " . $entry -> getId () . " </Url> \n " ;
}
$content .= " </Item> \n " ;
}
$content .= " </Section> \n " ;
}
$content .= " </SearchSuggestion> " ;
header ( " Content-Disposition: attachment; filename= \" search.xml \" ; filename*=UTF-8''search.xml " );
header ( 'Content-Type: application/x-suggestions+xml' );
echo $content ;
} /* }}} */
2023-04-21 11:00:31 +00:00
function typeahead () { /* {{{ */
2020-11-30 14:41:33 +00:00
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
$query = $this -> params [ 'query' ];
$entries = $this -> params [ 'searchhits' ];
2023-01-09 14:31:30 +00:00
$terms = $this -> params [ 'terms' ];
2020-11-30 14:41:33 +00:00
$recs = array ();
2023-01-09 14:31:30 +00:00
$recs [] = array ( 'type' => 'S' , 'name' => $query , 'occurences' => '' );
if ( $terms ) {
foreach ( $terms as $term )
2023-04-21 14:52:07 +00:00
$recs [] = array ( 'type' => 'S' , 'name' => $term -> text , 'occurences' => $term -> _occurrence , 'column' => $term -> field );
2023-01-09 14:31:30 +00:00
}
2020-11-30 14:41:33 +00:00
if ( $entries ) {
foreach ( $entries as $entry ) {
if ( $entry -> isType ( 'document' )) {
2023-01-08 15:23:27 +00:00
$recs [] = array ( 'type' => 'D' , 'id' => $entry -> getId (), 'name' => htmlspecialchars ( $entry -> getName ()), 'path' => htmlspecialchars ( $entry -> getParent () -> getFolderPathPlain ( true , '/' )));
2020-11-30 14:41:33 +00:00
} elseif ( $entry -> isType ( 'folder' )) {
2023-01-08 15:23:27 +00:00
$recs [] = array ( 'type' => 'F' , 'id' => $entry -> getId (), 'name' => htmlspecialchars ( $entry -> getName ()), 'path' => htmlspecialchars ( $entry -> getParent () -> getFolderPathPlain ( true , '/' )));
2020-11-30 14:41:33 +00:00
}
}
}
header ( 'Content-Type: application/json' );
echo json_encode ( $recs );
} /* }}} */
2022-01-03 12:35:12 +00:00
public function folderListHeaderName () { /* {{{ */
$orderby = $this -> params [ 'orderby' ];
$fullsearch = $this -> params [ 'fullsearch' ];
parse_str ( $_SERVER [ 'QUERY_STRING' ], $tmp );
$tmp [ 'orderby' ] = ( $orderby == " n " || $orderby == " na " ) ? " nd " : " n " ;
$headcol = getMLText ( " name " );
if ( ! $fullsearch ) {
$headcol .= $orderby . " <a href= \" ../out/out.Search.php? " . http_build_query ( $tmp ) . " \" title= \" " . getMLText ( " sort_by_name " ) . " \" > " . ( $orderby == " n " || $orderby == " na " ? ' <i class="fa fa-sort-alpha-asc selected"></i>' : ( $orderby == " nd " ? ' <i class="fa fa-sort-alpha-desc selected"></i>' : ' <i class="fa fa-sort-alpha-asc"></i>' )) . " </a> " ;
$tmp [ 'orderby' ] = ( $orderby == " d " || $orderby == " da " ) ? " dd " : " d " ;
$headcol .= " <a href= \" ../out/out.Search.php? " . http_build_query ( $tmp ) . " \" title= \" " . getMLText ( " sort_by_date " ) . " \" > " . ( $orderby == " d " || $orderby == " da " ? ' <i class="fa fa-sort-amount-asc selected"></i>' : ( $orderby == " dd " ? ' <i class="fa fa-sort-amount-desc selected"></i>' : ' <i class="fa fa-sort-amount-asc"></i>' )) . " </a> " ;
}
2022-08-24 05:57:14 +00:00
return $headcol ;
2022-01-03 12:35:12 +00:00
} /* }}} */
2012-12-14 07:53:13 +00:00
function show () { /* {{{ */
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
2023-04-26 04:44:59 +00:00
$settings = $this -> params [ 'settings' ];
2023-04-23 17:03:51 +00:00
$request = $this -> params [ 'request' ];
2013-06-07 08:12:49 +00:00
$fullsearch = $this -> params [ 'fullsearch' ];
2023-04-23 17:03:51 +00:00
$facetsearch = $this -> params [ 'facetsearch' ];
2021-11-19 12:49:46 +00:00
$total = $this -> params [ 'total' ];
2013-06-14 17:06:38 +00:00
$totaldocs = $this -> params [ 'totaldocs' ];
$totalfolders = $this -> params [ 'totalfolders' ];
2013-06-07 08:12:49 +00:00
$attrdefs = $this -> params [ 'attrdefs' ];
$allCats = $this -> params [ 'allcategories' ];
$allUsers = $this -> params [ 'allusers' ];
$mode = $this -> params [ 'mode' ];
2015-06-08 07:15:33 +00:00
$resultmode = $this -> params [ 'resultmode' ];
2013-06-07 08:12:49 +00:00
$workflowmode = $this -> params [ 'workflowmode' ];
$enablefullsearch = $this -> params [ 'enablefullsearch' ];
2023-04-26 04:44:59 +00:00
$enablefacetsearch = ( $settings -> _fullSearchEngine != 'lucene' );
2015-03-13 09:59:44 +00:00
$enableclipboard = $this -> params [ 'enableclipboard' ];
2013-06-07 08:12:49 +00:00
$attributes = $this -> params [ 'attributes' ];
$categories = $this -> params [ 'categories' ];
2021-11-19 12:49:46 +00:00
$category = $this -> params [ 'category' ];
2020-09-14 07:34:39 +00:00
$mimetype = $this -> params [ 'mimetype' ];
2013-06-07 08:12:49 +00:00
$owner = $this -> params [ 'owner' ];
2013-06-07 11:06:15 +00:00
$startfolder = $this -> params [ 'startfolder' ];
2021-05-05 11:47:38 +00:00
$createstartdate = $this -> params [ 'createstartdate' ];
$createenddate = $this -> params [ 'createenddate' ];
2023-04-26 15:35:59 +00:00
$created = $this -> params [ 'created' ];
2013-06-07 08:12:49 +00:00
$expstartdate = $this -> params [ 'expstartdate' ];
2021-05-05 11:47:38 +00:00
$expenddate = $this -> params [ 'expenddate' ];
2021-03-15 15:08:51 +00:00
$statusstartdate = $this -> params [ 'statusstartdate' ];
2021-05-05 11:47:38 +00:00
$statusenddate = $this -> params [ 'statusenddate' ];
2013-06-07 08:12:49 +00:00
$creationdate = $this -> params [ 'creationdate' ];
$expirationdate = $this -> params [ 'expirationdate' ];
2021-03-15 15:08:51 +00:00
$statusdate = $this -> params [ 'statusdate' ];
2013-06-07 08:12:49 +00:00
$status = $this -> params [ 'status' ];
2021-11-19 12:49:46 +00:00
$record_type = $this -> params [ 'recordtype' ];
2013-01-25 09:39:37 +00:00
$this -> query = $this -> params [ 'query' ];
2019-06-26 16:03:36 +00:00
$orderby = $this -> params [ 'orderby' ];
2012-12-14 07:53:13 +00:00
$entries = $this -> params [ 'searchhits' ];
2020-09-14 07:34:39 +00:00
$facets = $this -> params [ 'facets' ];
2012-12-14 07:53:13 +00:00
$totalpages = $this -> params [ 'totalpages' ];
$pageNumber = $this -> params [ 'pagenumber' ];
$searchTime = $this -> params [ 'searchtime' ];
$urlparams = $this -> params [ 'urlparams' ];
$searchin = $this -> params [ 'searchin' ];
2013-01-25 07:36:43 +00:00
$cachedir = $this -> params [ 'cachedir' ];
2014-04-10 19:38:33 +00:00
$previewwidth = $this -> params [ 'previewWidthList' ];
2022-08-18 08:02:13 +00:00
$previewconverters = $this -> params [ 'previewConverters' ];
$conversionmgr = $this -> params [ 'conversionmgr' ];
2016-02-15 09:57:37 +00:00
$timeout = $this -> params [ 'timeout' ];
2019-01-18 12:07:39 +00:00
$xsendfile = $this -> params [ 'xsendfile' ];
2014-02-21 20:51:53 +00:00
2012-12-14 07:53:13 +00:00
$this -> htmlStartPage ( getMLText ( " search_results " ));
2013-06-07 13:26:47 +00:00
$this -> globalNavigation ();
2012-12-14 07:53:13 +00:00
$this -> contentStart ();
2021-05-06 19:15:31 +00:00
$this -> pageNavigation ( " " , " " );
2012-12-14 07:53:13 +00:00
2020-10-07 17:04:39 +00:00
$this -> rowStart ();
$this -> columnStart ( 4 );
2021-11-10 07:33:52 +00:00
//$this->contentHeading("<button class=\"btn btn-primary\" id=\"searchform-toggle\" data-toggle=\"collapse\" href=\"#searchform\"><i class=\"fa fa-exchange\"></i></button> ".getMLText('search'), true);
$this -> contentHeading ( getMLText ( 'search' ), true );
2021-05-06 20:22:37 +00:00
if ( $this -> query ) {
2022-08-24 05:57:14 +00:00
echo " <div id= \" searchform \" class= \" _collapse mb-sm-4 \" > " ;
2021-05-06 20:22:37 +00:00
}
2013-06-07 08:12:49 +00:00
?>
2021-05-05 11:47:38 +00:00
< ul class = " nav nav-pills " id = " searchtab " >
2022-06-22 14:45:37 +00:00
< li class = " nav-item <?php echo ( $fullsearch == false) ? 'active' : ''; ?> " >< a class = " nav-link <?php echo ( $fullsearch == false) ? 'active' : ''; ?> " data - target = " #database " data - toggle = " tab " role = " button " >< ? php printMLText ( 'databasesearch' ); ?> </a></li>
2013-06-07 08:12:49 +00:00
< ? php
if ( $enablefullsearch ) {
?>
2023-04-23 17:03:51 +00:00
< li class = " nav-item <?php echo ( $fullsearch == true && $facetsearch == false) ? 'active' : ''; ?> " >< a class = " nav-link <?php echo ( $fullsearch == true && $facetsearch == false) ? 'active' : ''; ?> " data - target = " #fulltext " data - toggle = " tab " role = " button " >< ? php printMLText ( 'fullsearch' ); ?> </a></li>
< ? php
}
if ( $enablefacetsearch ) {
?>
< li class = " nav-item <?php echo ( $facetsearch == true && $facetsearch == true) ? 'active' : ''; ?> " >< a class = " nav-link <?php echo ( $facetsearch == true && $facetsearch == true) ? 'active' : ''; ?> " data - target = " #facetfulltext " data - toggle = " tab " role = " button " >< ? php printMLText ( 'facetfullsearch' ); ?> </a></li>
2013-06-07 08:12:49 +00:00
< ? php
}
?>
</ ul >
< div class = " tab-content " >
< div class = " tab-pane <?php echo ( $fullsearch == false) ? 'active' : ''; ?> " id = " database " >
2022-08-19 08:06:27 +00:00
< form class = " form-horizontal mb-4 " action = " <?= $this->params ['settings']->_httpRoot ?>out/out.Search.php " name = " form1 " >
2020-12-14 09:46:05 +00:00
< input type = " hidden " name = " fullsearch " value = " 0 " />
2013-06-07 08:12:49 +00:00
< ? php
// Database search Form {{{
$this -> contentContainerStart ();
2014-11-13 06:55:29 +00:00
2021-05-05 11:47:38 +00:00
$this -> formField (
getMLText ( " search_query " ),
array (
'element' => 'input' ,
2022-02-22 12:16:43 +00:00
'type' => 'search' ,
2021-05-05 11:47:38 +00:00
'name' => 'query' ,
'value' => htmlspecialchars ( $this -> query )
)
);
$options = array ();
$options [] = array ( '1' , getMLText ( 'search_mode_and' ), $mode == 'AND' );
$options [] = array ( '0' , getMLText ( 'search_mode_or' ), $mode == 'OR' );
$this -> formField (
getMLText ( " search_mode " ),
array (
'element' => 'select' ,
'name' => 'mode' ,
'multiple' => false ,
'options' => $options
)
);
$options = array ();
$options [] = array ( '1' , getMLText ( 'keywords' ) . ' (' . getMLText ( 'documents_only' ) . ')' , in_array ( '1' , $searchin ));
$options [] = array ( '2' , getMLText ( 'name' ), in_array ( '2' , $searchin ));
$options [] = array ( '3' , getMLText ( 'comment' ), in_array ( '3' , $searchin ));
$options [] = array ( '4' , getMLText ( 'attributes' ), in_array ( '4' , $searchin ));
$options [] = array ( '5' , getMLText ( 'id' ), in_array ( '5' , $searchin ));
$this -> formField (
getMLText ( " search_in " ),
array (
'element' => 'select' ,
'name' => 'searchin[]' ,
'class' => 'chzn-select' ,
'multiple' => true ,
'options' => $options
)
);
$options = array ();
2021-11-08 11:25:34 +00:00
$options [] = array ( '' , getMLText ( 'orderby_unsorted' ));
$options [] = array ( 'dd' , getMLText ( 'orderby_date_desc' ), 'dd' == $orderby );
$options [] = array ( 'd' , getMLText ( 'orderby_date_asc' ), 'd' == $orderby );
$options [] = array ( 'nd' , getMLText ( 'orderby_name_desc' ), 'nd' == $orderby );
$options [] = array ( 'n' , getMLText ( 'orderby_name_asc' ), 'n' == $orderby );
$options [] = array ( 'id' , getMLText ( 'orderby_id_desc' ), 'id' == $orderby );
$options [] = array ( 'i' , getMLText ( 'orderby_id_asc' ), 'i' == $orderby );
$this -> formField (
getMLText ( " orderby " ),
array (
'element' => 'select' ,
'name' => 'orderby' ,
'class' => 'chzn-select' ,
'multiple' => false ,
'options' => $options
)
);
$options = array ();
2021-05-05 11:47:38 +00:00
foreach ( $allUsers as $currUser ) {
2021-06-14 15:20:16 +00:00
if ( $user -> isAdmin () || ( ! $currUser -> isGuest () && ( ! $currUser -> isHidden () || $currUser -> getID () == $user -> getID ())))
2021-05-05 11:47:38 +00:00
$options [] = array ( $currUser -> getID (), htmlspecialchars ( $currUser -> getLogin ()), in_array ( $currUser -> getID (), $owner ), array ( array ( 'data-subtitle' , htmlspecialchars ( $currUser -> getFullName ()))));
}
$this -> formField (
getMLText ( " owner " ),
array (
'element' => 'select' ,
'name' => 'owner[]' ,
'class' => 'chzn-select' ,
'multiple' => true ,
'options' => $options
)
);
$options = array ();
$options [] = array ( '1' , getMLText ( 'search_mode_documents' ), $resultmode == 1 );
$options [] = array ( '2' , getMLText ( 'search_mode_folders' ), $resultmode == 2 );
$options [] = array ( '3' , getMLText ( 'search_resultmode_both' ), $resultmode == 3 );
$this -> formField (
getMLText ( " search_resultmode " ),
array (
'element' => 'select' ,
'name' => 'resultmode' ,
'multiple' => false ,
'options' => $options
)
);
$this -> formField ( getMLText ( " under_folder " ), $this -> getFolderChooserHtml ( " form1 " , M_READ , - 1 , $startfolder ));
$this -> formField (
getMLText ( " creation_date " ) . " ( " . getMLText ( 'from' ) . " ) " ,
2023-04-26 15:35:59 +00:00
$this -> getDateChooser ( ! empty ( $createstartdate ) ? getReadableDate ( $createstartdate ) : null , " created[from] " , $this -> params [ 'session' ] -> getLanguage ())
2021-05-05 11:47:38 +00:00
);
$this -> formField (
getMLText ( " creation_date " ) . " ( " . getMLText ( 'to' ) . " ) " ,
2023-04-26 15:35:59 +00:00
$this -> getDateChooser ( ! empty ( $createenddate ) ? getReadableDate ( $createenddate ) : null , " created[to] " , $this -> params [ 'session' ] -> getLanguage ())
2021-05-05 11:47:38 +00:00
);
2022-08-18 06:38:09 +00:00
$this -> contentContainerEnd ();
2022-08-19 08:06:27 +00:00
// Seach options for documents and folders {{{
2022-08-18 06:38:09 +00:00
/* First check if any of the folder / document filters are set . If it is ,
* open the accordion .
*/
$openfilterdlg = false ;
2022-08-19 08:06:27 +00:00
$hasattrs = false ;
2022-08-18 06:38:09 +00:00
if ( $attrdefs ) {
foreach ( $attrdefs as $attrdef ) {
if ( $attrdef -> getObjType () == SeedDMS_Core_AttributeDefinition :: objtype_all ) {
/* Do not check dates because they always have 'from' and 'to' element
* even if it is empty . FIXME should be also checked .
*/
2022-08-19 08:06:27 +00:00
$hasattrs = true ;
2023-04-19 11:59:01 +00:00
if ( ! in_array ( $attrdef -> getType (), [ SeedDMS_Core_AttributeDefinition :: type_date , SeedDMS_Core_AttributeDefinition :: type_int , SeedDMS_Core_AttributeDefinition :: type_float ]))
2022-08-18 06:38:09 +00:00
if ( ! empty ( $attributes [ $attrdef -> getID ()]))
$openfilterdlg = true ;
}
}
}
2022-08-19 08:06:27 +00:00
if ( $hasattrs ) {
ob_start ();
if ( $attrdefs ) {
foreach ( $attrdefs as $attrdef ) {
if ( $attrdef -> getObjType () == SeedDMS_Core_AttributeDefinition :: objtype_all ) {
if ( $attrdef -> getType () == SeedDMS_Core_AttributeDefinition :: type_date ) {
$this -> formField ( htmlspecialchars ( $attrdef -> getName () . ' (' . getMLText ( 'from' ) . ')' ), $this -> getAttributeEditField ( $attrdef , ! empty ( $attributes [ $attrdef -> getID ()][ 'from' ]) ? getReadableDate ( makeTsFromDate ( $attributes [ $attrdef -> getID ()][ 'from' ])) : '' , 'attributes' , true , 'from' ));
$this -> formField ( htmlspecialchars ( $attrdef -> getName () . ' (' . getMLText ( 'to' ) . ')' ), $this -> getAttributeEditField ( $attrdef , ! empty ( $attributes [ $attrdef -> getID ()][ 'to' ]) ? getReadableDate ( makeTsFromDate ( $attributes [ $attrdef -> getID ()][ 'to' ])) : '' , 'attributes' , true , 'to' ));
2023-04-19 11:59:01 +00:00
} elseif ( in_array ( $attrdef -> getType (), [ SeedDMS_Core_AttributeDefinition :: type_int , SeedDMS_Core_AttributeDefinition :: type_float ]) && ! $attrdef -> getValueSet ()) {
$this -> formField ( htmlspecialchars ( $attrdef -> getName () . ' (' . getMLText ( 'from' ) . ')' ), $this -> getAttributeEditField ( $attrdef , ! empty ( $attributes [ $attrdef -> getID ()][ 'from' ]) ? $attributes [ $attrdef -> getID ()][ 'from' ] : '' , 'attributes' , true , 'from' ));
$this -> formField ( htmlspecialchars ( $attrdef -> getName () . ' (' . getMLText ( 'to' ) . ')' ), $this -> getAttributeEditField ( $attrdef , ! empty ( $attributes [ $attrdef -> getID ()][ 'to' ]) ? $attributes [ $attrdef -> getID ()][ 'to' ] : '' , 'attributes' , true , 'to' ));
2022-08-19 08:06:27 +00:00
} else
$this -> formField ( htmlspecialchars ( $attrdef -> getName ()), $this -> getAttributeEditField ( $attrdef , isset ( $attributes [ $attrdef -> getID ()]) ? $attributes [ $attrdef -> getID ()] : '' , 'attributes' , true ));
}
2014-11-13 06:55:29 +00:00
}
}
2022-08-19 08:06:27 +00:00
$content = ob_get_clean ();
$this -> printAccordion ( getMLText ( 'filter_for_documents_and_folders' ), $content , $openfilterdlg );
2014-11-13 06:55:29 +00:00
}
2022-08-19 08:06:27 +00:00
// }}}
2014-07-23 18:12:55 +00:00
2022-08-18 11:05:02 +00:00
// Seach options for documents {{{
2014-07-23 18:12:55 +00:00
/* First check if any of the folder filters are set . If it is ,
* open the accordion .
*/
$openfilterdlg = false ;
if ( $attrdefs ) {
foreach ( $attrdefs as $attrdef ) {
if ( $attrdef -> getObjType () == SeedDMS_Core_AttributeDefinition :: objtype_document || $attrdef -> getObjType () == SeedDMS_Core_AttributeDefinition :: objtype_documentcontent ) {
2022-08-18 06:38:09 +00:00
/* Do not check dates because they always have 'from' and 'to' element
* even if it is empty . FIXME should be also checked .
*/
2023-04-19 11:59:01 +00:00
if ( ! in_array ( $attrdef -> getType (), [ SeedDMS_Core_AttributeDefinition :: type_date , SeedDMS_Core_AttributeDefinition :: type_int , SeedDMS_Core_AttributeDefinition :: type_float ]))
2022-08-18 06:38:09 +00:00
if ( ! empty ( $attributes [ $attrdef -> getID ()]))
$openfilterdlg = true ;
2014-07-23 18:12:55 +00:00
}
2013-06-07 08:12:49 +00:00
}
}
2021-05-05 11:47:38 +00:00
if ( $categories )
2014-07-23 18:12:55 +00:00
$openfilterdlg = true ;
if ( $status )
$openfilterdlg = true ;
if ( $expirationdate )
$openfilterdlg = true ;
2021-03-15 15:08:51 +00:00
if ( $statusdate )
$openfilterdlg = true ;
2021-05-05 11:47:38 +00:00
/* Start of fields only applicable to documents */
ob_start ();
2013-06-07 08:12:49 +00:00
$tmpcatids = array ();
foreach ( $categories as $tmpcat )
$tmpcatids [] = $tmpcat -> getID ();
2021-05-05 11:47:38 +00:00
$options = array ();
$allcategories = $dms -> getDocumentCategories ();
2021-11-19 12:49:46 +00:00
foreach ( $allcategories as $acategory ) {
$options [] = array ( $acategory -> getID (), $acategory -> getName (), in_array ( $acategory -> getId (), $tmpcatids ));
2013-06-07 08:12:49 +00:00
}
2021-05-05 11:47:38 +00:00
$this -> formField (
getMLText ( " categories " ),
array (
'element' => 'select' ,
'class' => 'chzn-select' ,
'name' => 'category[]' ,
'multiple' => true ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_category' ), array ( 'data-no_results_text' , getMLText ( 'unknown_document_category' )))),
'options' => $options
)
);
$options = array ();
if ( $workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval' ) {
if ( $workflowmode == 'traditional' ) {
$options [] = array ( S_DRAFT_REV , getOverallStatusText ( S_DRAFT_REV ), in_array ( S_DRAFT_REV , $status ));
}
} elseif ( $workflowmode == 'advanced' ) {
$options [] = array ( S_IN_WORKFLOW , getOverallStatusText ( S_IN_WORKFLOW ), in_array ( S_IN_WORKFLOW , $status ));
}
$options [] = array ( S_DRAFT_APP , getOverallStatusText ( S_DRAFT_APP ), in_array ( S_DRAFT_APP , $status ));
$options [] = array ( S_RELEASED , getOverallStatusText ( S_RELEASED ), in_array ( S_RELEASED , $status ));
$options [] = array ( S_REJECTED , getOverallStatusText ( S_REJECTED ), in_array ( S_REJECTED , $status ));
$options [] = array ( S_EXPIRED , getOverallStatusText ( S_EXPIRED ), in_array ( S_EXPIRED , $status ));
$options [] = array ( S_OBSOLETE , getOverallStatusText ( S_OBSOLETE ), in_array ( S_OBSOLETE , $status ));
$this -> formField (
getMLText ( " status " ),
array (
'element' => 'select' ,
'class' => 'chzn-select' ,
'name' => 'status[]' ,
'multiple' => true ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_status' )), array ( 'data-no_results_text' , getMLText ( 'unknown_status' ))),
'options' => $options
)
);
$this -> formField (
getMLText ( " expires " ) . " ( " . getMLText ( 'from' ) . " ) " ,
$this -> getDateChooser ( $expstartdate , " expirationstart " , $this -> params [ 'session' ] -> getLanguage ())
);
$this -> formField (
getMLText ( " expires " ) . " ( " . getMLText ( 'to' ) . " ) " ,
$this -> getDateChooser ( $expenddate , " expirationend " , $this -> params [ 'session' ] -> getLanguage ())
);
$this -> formField (
getMLText ( " status_change " ) . " ( " . getMLText ( 'from' ) . " ) " ,
$this -> getDateChooser ( $statusstartdate , " statusdatestart " , $this -> params [ 'session' ] -> getLanguage ())
);
$this -> formField (
getMLText ( " status_change " ) . " ( " . getMLText ( 'to' ) . " ) " ,
$this -> getDateChooser ( $statusenddate , " statusdateend " , $this -> params [ 'session' ] -> getLanguage ())
);
2014-07-23 18:12:55 +00:00
if ( $attrdefs ) {
foreach ( $attrdefs as $attrdef ) {
if ( $attrdef -> getObjType () == SeedDMS_Core_AttributeDefinition :: objtype_document || $attrdef -> getObjType () == SeedDMS_Core_AttributeDefinition :: objtype_documentcontent ) {
2021-05-05 11:47:38 +00:00
if ( $attrdef -> getType () == SeedDMS_Core_AttributeDefinition :: type_date ) {
$this -> formField ( htmlspecialchars ( $attrdef -> getName () . ' (' . getMLText ( 'from' ) . ')' ), $this -> getAttributeEditField ( $attrdef , ! empty ( $attributes [ $attrdef -> getID ()][ 'from' ]) ? getReadableDate ( makeTsFromDate ( $attributes [ $attrdef -> getID ()][ 'from' ])) : '' , 'attributes' , true , 'from' ));
$this -> formField ( htmlspecialchars ( $attrdef -> getName () . ' (' . getMLText ( 'to' ) . ')' ), $this -> getAttributeEditField ( $attrdef , ! empty ( $attributes [ $attrdef -> getID ()][ 'to' ]) ? getReadableDate ( makeTsFromDate ( $attributes [ $attrdef -> getID ()][ 'to' ])) : '' , 'attributes' , true , 'to' ));
2023-04-19 11:59:01 +00:00
} elseif ( in_array ( $attrdef -> getType (), [ SeedDMS_Core_AttributeDefinition :: type_int , SeedDMS_Core_AttributeDefinition :: type_float ]) && ! $attrdef -> getValueSet ()) {
$this -> formField ( htmlspecialchars ( $attrdef -> getName () . ' (' . getMLText ( 'from' ) . ')' ), $this -> getAttributeEditField ( $attrdef , ! empty ( $attributes [ $attrdef -> getID ()][ 'from' ]) ? $attributes [ $attrdef -> getID ()][ 'from' ] : '' , 'attributes' , true , 'from' ));
$this -> formField ( htmlspecialchars ( $attrdef -> getName () . ' (' . getMLText ( 'to' ) . ')' ), $this -> getAttributeEditField ( $attrdef , ! empty ( $attributes [ $attrdef -> getID ()][ 'to' ]) ? $attributes [ $attrdef -> getID ()][ 'to' ] : '' , 'attributes' , true , 'to' ));
2021-05-05 11:47:38 +00:00
} else
2022-08-31 18:39:12 +00:00
$this -> formField ( htmlspecialchars ( $attrdef -> getName ()), $this -> getAttributeEditField ( $attrdef , isset ( $attributes [ $attrdef -> getID ()]) ? $attributes [ $attrdef -> getID ()] : '' , 'attributes' , true , '' , true ));
2014-07-23 18:12:55 +00:00
}
}
}
2022-08-18 11:05:02 +00:00
2021-05-05 11:47:38 +00:00
$content = ob_get_clean ();
2022-08-18 06:38:09 +00:00
$this -> printAccordion ( getMLText ( 'filter_for_documents' ), $content , $openfilterdlg );
2022-08-19 08:06:27 +00:00
// }}}
// Seach options for folders {{{
2014-07-23 18:12:55 +00:00
/* First check if any of the folder filters are set . If it is ,
* open the accordion .
*/
$openfilterdlg = false ;
2022-08-19 08:06:27 +00:00
$hasattrs = false ;
2014-07-23 18:12:55 +00:00
if ( $attrdefs ) {
foreach ( $attrdefs as $attrdef ) {
if ( $attrdef -> getObjType () == SeedDMS_Core_AttributeDefinition :: objtype_folder ) {
2022-08-19 08:06:27 +00:00
$hasattrs = true ;
2023-04-19 11:59:01 +00:00
if ( ! in_array ( $attrdef -> getType (), [ SeedDMS_Core_AttributeDefinition :: type_date , SeedDMS_Core_AttributeDefinition :: type_int , SeedDMS_Core_AttributeDefinition :: type_float ]))
2022-08-18 06:38:09 +00:00
if ( ! empty ( $attributes [ $attrdef -> getID ()]))
$openfilterdlg = true ;
2014-07-23 18:12:55 +00:00
}
}
}
2022-08-19 08:06:27 +00:00
if ( $hasattrs ) {
ob_start ();
if ( $attrdefs ) {
foreach ( $attrdefs as $attrdef ) {
if ( $attrdef -> getObjType () == SeedDMS_Core_AttributeDefinition :: objtype_folder ) {
if ( $attrdef -> getType () == SeedDMS_Core_AttributeDefinition :: type_date ) {
$this -> formField ( htmlspecialchars ( $attrdef -> getName () . ' (' . getMLText ( 'from' ) . ')' ), $this -> getAttributeEditField ( $attrdef , ! empty ( $attributes [ $attrdef -> getID ()][ 'from' ]) ? getReadableDate ( makeTsFromDate ( $attributes [ $attrdef -> getID ()][ 'from' ])) : '' , 'attributes' , true , 'from' ));
$this -> formField ( htmlspecialchars ( $attrdef -> getName () . ' (' . getMLText ( 'to' ) . ')' ), $this -> getAttributeEditField ( $attrdef , ! empty ( $attributes [ $attrdef -> getID ()][ 'to' ]) ? getReadableDate ( makeTsFromDate ( $attributes [ $attrdef -> getID ()][ 'to' ])) : '' , 'attributes' , true , 'to' ));
2023-04-19 11:59:01 +00:00
} elseif ( in_array ( $attrdef -> getType (), [ SeedDMS_Core_AttributeDefinition :: type_int , SeedDMS_Core_AttributeDefinition :: type_float ]) && ! $attrdef -> getValueSet ()) {
$this -> formField ( htmlspecialchars ( $attrdef -> getName () . ' (' . getMLText ( 'from' ) . ')' ), $this -> getAttributeEditField ( $attrdef , ! empty ( $attributes [ $attrdef -> getID ()][ 'from' ]) ? $attributes [ $attrdef -> getID ()][ 'from' ] : '' , 'attributes' , true , 'from' ));
$this -> formField ( htmlspecialchars ( $attrdef -> getName () . ' (' . getMLText ( 'to' ) . ')' ), $this -> getAttributeEditField ( $attrdef , ! empty ( $attributes [ $attrdef -> getID ()][ 'to' ]) ? $attributes [ $attrdef -> getID ()][ 'to' ] : '' , 'attributes' , true , 'to' ));
2022-08-19 08:06:27 +00:00
} else
2022-08-31 18:39:12 +00:00
$this -> formField ( htmlspecialchars ( $attrdef -> getName ()), $this -> getAttributeEditField ( $attrdef , isset ( $attributes [ $attrdef -> getID ()]) ? $attributes [ $attrdef -> getID ()] : '' , 'attributes' , true , '' , true ));
2022-08-19 08:06:27 +00:00
}
2014-07-23 18:12:55 +00:00
}
}
2022-08-19 08:06:27 +00:00
$content = ob_get_clean ();
2022-08-18 06:38:09 +00:00
$this -> printAccordion ( getMLText ( 'filter_for_folders' ), $content , $openfilterdlg );
2022-08-19 08:06:27 +00:00
}
2019-06-26 16:03:36 +00:00
// }}}
2021-12-03 09:49:27 +00:00
$this -> formSubmit ( " <i class= \" fa fa-search \" ></i> " . getMLText ( 'search' ));
2022-08-18 16:40:51 +00:00
?>
</ form >
2013-06-07 08:12:49 +00:00
</ div >
< ? php
2022-08-18 11:05:02 +00:00
// }}}
// Fulltext search Form {{{
2013-06-07 08:12:49 +00:00
if ( $enablefullsearch ) {
2023-04-23 17:03:51 +00:00
echo " <div class= \" tab-pane " . (( $fullsearch == true && $facetsearch == false ) ? 'active' : '' ) . " \" id= \" fulltext \" > \n " ;
2013-06-07 08:12:49 +00:00
?>
2021-12-03 09:49:27 +00:00
< form class = " form-horizontal " action = " <?= $this->params ['settings']->_httpRoot ?>out/out.Search.php " name = " form2 " style = " min-height: 330px; " >
2013-06-07 08:12:49 +00:00
< input type = " hidden " name = " fullsearch " value = " 1 " />
2013-06-14 14:08:50 +00:00
< ? php
2021-05-05 11:47:38 +00:00
$this -> contentContainerStart ();
$this -> formField (
getMLText ( " search_query " ),
array (
'element' => 'input' ,
2022-02-22 12:16:43 +00:00
'type' => 'search' ,
2021-05-05 11:47:38 +00:00
'name' => 'query' ,
'value' => htmlspecialchars ( $this -> query )
)
);
2023-04-23 17:03:51 +00:00
$this -> formField ( getMLText ( " under_folder " ), $this -> getFolderChooserHtml ( " form2 " , M_READ , - 1 , $startfolder , 'folderfullsearchid' ));
2023-04-21 15:55:56 +00:00
$this -> formField (
getMLText ( " creation_date " ) . " ( " . getMLText ( 'from' ) . " ) " ,
2023-04-26 15:35:59 +00:00
$this -> getDateChooser ( ! empty ( $created [ 'from' ]) ? getReadableDate ( $created [ 'from' ]) : null , " created[from] " , $this -> params [ 'session' ] -> getLanguage ())
2023-04-21 15:55:56 +00:00
);
$this -> formField (
getMLText ( " creation_date " ) . " ( " . getMLText ( 'to' ) . " ) " ,
2023-04-26 15:35:59 +00:00
$this -> getDateChooser ( ! empty ( $created [ 'to' ]) ? getReadableDate ( $created [ 'to' ]) : null , " created[to] " , $this -> params [ 'session' ] -> getLanguage ())
2023-04-21 15:55:56 +00:00
);
2021-05-05 11:47:38 +00:00
if ( ! isset ( $facets [ 'owner' ])) {
2021-11-19 12:49:46 +00:00
$options = array ();
foreach ( $allUsers as $currUser ) {
if ( $user -> isAdmin () || ( ! $currUser -> isGuest () && ( ! $currUser -> isHidden () || $currUser -> getID () == $user -> getID ())))
$options [] = array ( $currUser -> getID (), htmlspecialchars ( $currUser -> getLogin ()), in_array ( $currUser -> getID (), $owner ), array ( array ( 'data-subtitle' , htmlspecialchars ( $currUser -> getFullName ()))));
}
$this -> formField (
getMLText ( " owner " ),
array (
'element' => 'select' ,
'name' => 'owner[]' ,
'class' => 'chzn-select' ,
'multiple' => true ,
'options' => $options
)
);
2013-06-14 14:08:50 +00:00
}
2023-01-11 10:58:15 +00:00
if ( ! isset ( $facets [ 'record_type' ])) {
$options = array ();
$options [] = array ( 'document' , getMLText ( 'document' ), $record_type && in_array ( 'document' , $record_type ));
$options [] = array ( 'folder' , getMLText ( 'folder' ), $record_type && in_array ( 'folder' , $record_type ));
$this -> formField (
getMLText ( " record_type " ),
array (
'element' => 'select' ,
'class' => 'chzn-select' ,
'name' => 'record_type[]' ,
'multiple' => true ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_record_type' ))),
'options' => $options
)
);
}
2021-11-19 12:49:46 +00:00
if ( ! isset ( $facets [ 'category' ])) {
$tmpcatids = array ();
foreach ( $categories as $tmpcat )
$tmpcatids [] = $tmpcat -> getID ();
$options = array ();
$allcategories = $dms -> getDocumentCategories ();
foreach ( $allcategories as $acategory ) {
$options [] = array ( $acategory -> getID (), $acategory -> getName (), in_array ( $acategory -> getId (), $tmpcatids ));
}
$this -> formField (
getMLText ( " category_filter " ),
array (
'element' => 'select' ,
'class' => 'chzn-select' ,
'name' => 'category[]' ,
'multiple' => true ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_category' ), array ( 'data-no_results_text' , getMLText ( 'unknown_document_category' )))),
'options' => $options
)
);
2021-05-05 11:47:38 +00:00
}
2021-11-19 12:49:46 +00:00
if ( ! isset ( $facets [ 'status' ])) {
$options = array ();
if ( $workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval' ) {
if ( $workflowmode == 'traditional' ) {
$options [] = array ( S_DRAFT_REV , getOverallStatusText ( S_DRAFT_REV ), in_array ( S_DRAFT_REV , $status ));
}
} elseif ( $workflowmode == 'advanced' ) {
$options [] = array ( S_IN_WORKFLOW , getOverallStatusText ( S_IN_WORKFLOW ), in_array ( S_IN_WORKFLOW , $status ));
}
$options [] = array ( S_DRAFT_APP , getOverallStatusText ( S_DRAFT_APP ), in_array ( S_DRAFT_APP , $status ));
$options [] = array ( S_RELEASED , getOverallStatusText ( S_RELEASED ), in_array ( S_RELEASED , $status ));
$options [] = array ( S_REJECTED , getOverallStatusText ( S_REJECTED ), in_array ( S_REJECTED , $status ));
$options [] = array ( S_EXPIRED , getOverallStatusText ( S_EXPIRED ), in_array ( S_EXPIRED , $status ));
$options [] = array ( S_OBSOLETE , getOverallStatusText ( S_OBSOLETE ), in_array ( S_OBSOLETE , $status ));
$this -> formField (
getMLText ( " status " ),
array (
'element' => 'select' ,
'class' => 'chzn-select' ,
'name' => 'status[]' ,
'multiple' => true ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_status' )), array ( 'data-no_results_text' , getMLText ( 'unknown_status' ))),
'options' => $options
)
);
2021-05-05 11:47:38 +00:00
}
2021-11-19 12:49:46 +00:00
if ( $facets ) {
foreach ( $facets as $facetname => $values ) {
$multiple = true ;
$options = array ();
if ( $facetname == 'owner' ) {
foreach ( $values as $v => $c ) {
$uu = $dms -> getUserByLogin ( $v );
if ( $uu ) {
2023-04-23 17:03:51 +00:00
$option = array ( $uu -> getId (), $v );
2021-11-19 12:49:46 +00:00
if ( isset ( ${$facetname} ) && in_array ( $uu -> getId (), ${$facetname} ))
$option [] = true ;
2023-03-06 09:03:28 +00:00
else
$option [] = false ;
$option [] = array ( array ( 'data-subtitle' , $c . ' × ' ));
2021-11-19 12:49:46 +00:00
$options [] = $option ;
}
}
} elseif ( $facetname == 'category' ) {
foreach ( $values as $v => $c ) {
$cat = $dms -> getDocumentCategoryByName ( $v );
if ( $cat ) {
2023-04-23 17:03:51 +00:00
$option = array ( $cat -> getId (), $v );
2021-11-19 12:49:46 +00:00
if ( isset ( ${$facetname} ) && in_array ( $cat -> getId (), ${$facetname} ))
$option [] = true ;
2023-03-06 09:03:28 +00:00
else
$option [] = false ;
$option [] = array ( array ( 'data-subtitle' , $c . ' × ' ));
2021-11-19 12:49:46 +00:00
$options [] = $option ;
}
}
} elseif ( $facetname == 'status' ) {
foreach ( $values as $v => $c ) {
2023-03-06 09:03:28 +00:00
$option = array ( $v , getOverallStatusText ( $v ) /*.' ('.$c.')'*/ );
if ( isset ( ${$facetname} ) && in_array ( $v , ${$facetname} ))
$option [] = true ;
else
$option [] = false ;
$option [] = array ( array ( 'data-subtitle' , $c . ' × ' ));
$options [] = $option ;
2021-11-19 12:49:46 +00:00
}
2023-04-26 06:42:50 +00:00
} elseif ( substr ( $facetname , 0 , 5 ) == 'attr_' || $facetname == 'created' ) {
/* Do not even create a list of options, because it isn't used */
2021-11-19 12:49:46 +00:00
} else {
foreach ( $values as $v => $c ) {
2023-04-23 17:03:51 +00:00
$option = array ( $v , $v );
2021-11-19 12:49:46 +00:00
if ( isset ( ${$facetname} ) && in_array ( $v , ${$facetname} ))
$option [] = true ;
2023-03-06 09:03:28 +00:00
else
$option [] = false ;
$option [] = array ( array ( 'data-subtitle' , $c . ' × ' ));
2021-11-19 12:49:46 +00:00
$options [] = $option ;
}
}
2023-04-26 06:42:50 +00:00
if ( substr ( $facetname , 0 , 5 ) != 'attr_' && $facetname != 'created' ) {
2023-03-04 08:04:58 +00:00
$this -> formField (
getMLText ( $facetname ),
array (
'element' => 'select' ,
'id' => $facetname ,
'name' => $facetname . " [] " ,
'class' => 'chzn-select' ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_' . $facetname )), array ( 'data-allow-clear' , 'true' )),
'options' => $options ,
'multiple' => $multiple
)
);
}
2021-11-19 12:49:46 +00:00
}
2023-04-23 17:03:51 +00:00
foreach ( $facets as $facetname => $values ) {
if ( substr ( $facetname , 0 , 5 ) == 'attr_' ) {
/* If the facet is empty, don't show the input field */
if ( $values ) {
$tmp = explode ( '_' , $facetname );
if ( $attrdef = $dms -> getAttributeDefinition ( $tmp [ 1 ])) {
$dispname = $attrdef -> getName ();
switch ( $attrdef -> getType ()) {
case 556 : //SeedDMS_Core_AttributeDefinition::type_int:
$this -> formField (
$dispname . ' (' . getMLText ( 'from' ) . ')' ,
array (
'element' => 'input' ,
'type' => 'number' ,
'id' => $facetname ,
'name' => 'attributes[' . $facetname . '][from]' ,
'placeholder' => implode ( ' ' , array_keys ( $values )),
)
);
$this -> formField (
$dispname . ' (' . getMLText ( 'to' ) . ')' ,
array (
'element' => 'input' ,
'type' => 'number' ,
'id' => $facetname ,
'name' => 'attributes[' . $facetname . '][to]' ,
'placeholder' => implode ( ' ' , array_keys ( $values )),
)
);
break ;
default :
$options = [];
foreach ( $values as $v => $c ) {
2023-04-25 10:29:40 +00:00
switch ( $attrdef -> getType ()) {
case SeedDMS_Core_AttributeDefinition :: type_date :
$option = array ( $v , getReadableDate ( $v ));
break ;
default :
$option = array ( $v , $v );
}
2023-04-23 17:03:51 +00:00
if ( isset ( $attributes [ $facetname ]) && in_array ( $v , $attributes [ $facetname ]))
$option [] = true ;
else
$option [] = false ;
$option [] = array ( array ( 'data-subtitle' , $c . ' × ' ));
$options [] = $option ;
}
if ( $options ) {
$this -> formField (
$dispname ,
array (
'element' => 'select' ,
'id' => $facetname ,
'name' => 'attributes[' . $facetname . '][]' ,
'class' => 'chzn-select' ,
'attributes' => array ( array ( 'data-placeholder' , $dispname ), array ( 'data-allow-clear' , 'true' )),
'options' => $options ,
'multiple' => $multiple
)
);
}
}
}
}
}
}
2021-11-19 12:49:46 +00:00
}
$this -> contentContainerEnd ();
$this -> formSubmit ( " <i class= \" fa fa-search \" ></i> " . getMLText ( 'search' ));
2020-09-14 07:34:39 +00:00
?>
2013-06-07 08:12:49 +00:00
</ form >
2023-04-23 17:03:51 +00:00
< ? php
echo " </div> \n " ;
}
// }}}
// Fulltext search with facets Form {{{
if ( $enablefacetsearch ) {
echo " <div class= \" tab-pane " . (( $fullsearch == true && $facetsearch == true ) ? 'active' : '' ) . " \" id= \" facetfulltext \" > \n " ;
?>
2023-04-28 10:11:09 +00:00
< form class = " form-horizontal " action = " <?= $this->params ['settings']->_httpRoot ?>out/out.Search.php " name = " form2 " >
2023-04-23 17:03:51 +00:00
< input type = " hidden " name = " fullsearch " value = " 1 " />
< input type = " hidden " name = " facetsearch " value = " 1 " />
< ? php
$this -> contentContainerStart ();
$this -> formField (
getMLText ( " search_query " ),
array (
'element' => 'input' ,
'type' => 'search' ,
'name' => 'query' ,
'value' => htmlspecialchars ( $this -> query ),
2023-04-23 17:14:15 +00:00
'placeholder' => getMLText ( 'search_query_placeholder' ),
2023-04-23 17:03:51 +00:00
)
);
$this -> formField ( getMLText ( " under_folder " ), $this -> getFolderChooserHtml ( " form3 " , M_READ , - 1 , $startfolder , 'folderfullsearchid' ));
$this -> contentContainerEnd ();
2023-04-28 15:13:16 +00:00
$menuitems = [];
2023-04-23 17:03:51 +00:00
if ( $facets ) {
foreach ( $facets as $facetname => $values ) {
2023-04-28 15:13:16 +00:00
if ( $values ) {
2023-04-23 17:03:51 +00:00
if ( substr ( $facetname , 0 , 5 ) == 'attr_' ) {
$tmp = explode ( '_' , $facetname );
if ( $attrdef = $dms -> getAttributeDefinition ( $tmp [ 1 ])) {
$dispname = $attrdef -> getName ();
/* Create a link to remove the filter */
$allparams = $request -> query -> all ();
if ( isset ( $allparams [ 'attributes' ][ $facetname ])) {
2023-04-24 05:31:20 +00:00
if ( isset ( $allparams [ 'attributes' ][ $facetname ][ 'to' ]) && isset ( $allparams [ 'attributes' ][ $facetname ][ 'from' ])) {
$oldvalue = $allparams [ 'attributes' ][ $facetname ];
if ( ! empty ( $oldvalue [ 'from' ]) || ! empty ( $oldvalue [ 'to' ])) {
unset ( $allparams [ 'attributes' ][ $facetname ]);
$newrequest = Symfony\Component\HttpFoundation\Request :: create ( $request -> getBaseUrl (), 'GET' , $allparams );
$menuitems [] = array ( 'label' => '<i class="fa fa-remove"></i> ' . $dispname . ' = ' . $oldvalue [ 'from' ] . ' TO ' . $oldvalue [ 'to' ], 'link' => $newrequest -> getRequestUri (), 'attributes' => [[ 'title' , 'Click to remove' ]], '_badge' => 'x' );
echo '<input type="hidden" name="attributes[' . $facetname . '][from]" value="' . $oldvalue [ 'from' ] . '" />' ;
echo '<input type="hidden" name="attributes[' . $facetname . '][to]" value="' . $oldvalue [ 'to' ] . '" />' ;
}
} else {
2023-04-25 10:29:40 +00:00
if ( is_array ( $allparams [ 'attributes' ][ $facetname ])) {
switch ( $attrdef -> getType ()) {
case SeedDMS_Core_AttributeDefinition :: type_date :
array_walk ( $allparams [ 'attributes' ][ $facetname ], function ( & $v , $k ){ $v = getReadableDate ( $v );});
break ;
}
$oldvalue = $allparams [ 'attributes' ][ $facetname ];
2023-04-26 15:35:59 +00:00
} else {
$oldvalue = [ $allparams [ 'attributes' ][ $facetname ]];
2023-04-25 10:29:40 +00:00
}
2023-04-24 05:31:20 +00:00
unset ( $allparams [ 'attributes' ][ $facetname ]);
$newrequest = Symfony\Component\HttpFoundation\Request :: create ( $request -> getBaseUrl (), 'GET' , $allparams );
2023-04-26 15:35:59 +00:00
$menuitems [] = array ( 'label' => '<i class="fa fa-remove"></i> ' . $dispname . ' = ' . implode ( ', ' , $oldvalue ), 'link' => $newrequest -> getRequestUri (), 'attributes' => [[ 'title' , 'Click to remove' ]], '_badge' => 'x' );
foreach ( $oldvalue as $ov )
echo '<input type="hidden" name="attributes[' . $facetname . '][]" value="' . $ov . '" />' ;
2023-04-24 05:31:20 +00:00
}
2023-04-23 17:03:51 +00:00
}
}
} else {
/* Create a link to remove the filter */
$allparams = $request -> query -> all ();
if ( isset ( $allparams [ $facetname ])) {
2023-04-25 10:29:40 +00:00
switch ( $facetname ) {
2023-04-26 15:35:59 +00:00
case 'category' :
$oldvalue = is_array ( $allparams [ $facetname ]) ? $allparams [ $facetname ] : [ $allparams [ $facetname ]];
$oldtransval = [];
foreach ( $oldvalue as $v ) {
if ( is_numeric ( $v ))
$fu = $dms -> getDocumentCategory ( $v );
else
$fu = $dms -> getDocumentCategoryByName ( $v );
if ( $fu )
$oldtransval [] = $fu -> getName ();
}
break ;
case 'owner' :
$oldvalue = is_array ( $allparams [ $facetname ]) ? $allparams [ $facetname ] : [ $allparams [ $facetname ]];
$oldtransval = [];
foreach ( $oldvalue as $v ) {
if ( is_numeric ( $v ))
$fu = $dms -> getUser ( $v );
else
$fu = $dms -> getUserByLogin ( $v );
if ( $fu )
$oldtransval [] = $fu -> getLogin ();
}
break ;
2023-04-25 10:29:40 +00:00
case 'status' :
2023-04-26 15:35:59 +00:00
$oldvalue = is_array ( $allparams [ $facetname ]) ? $allparams [ $facetname ] : [ $allparams [ $facetname ]];
$oldtransval = $oldvalue ;
array_walk ( $oldtransval , function ( & $v , $k ){ $v = getOverallStatusText ( $v );});
2023-04-25 10:29:40 +00:00
break ;
2023-04-26 06:42:50 +00:00
case 'created' :
2023-04-26 15:35:59 +00:00
if ( ! empty ( $allparams [ $facetname ][ 'from' ]) || ! empty ( $allparams [ $facetname ][ 'to' ])) {
array_walk ( $allparams [ $facetname ], function ( & $v , $k ){ $v = getReadableDate ( $v );});
$oldvalue = $allparams [ $facetname ];
$oldtransval = $oldvalue ; //$oldvalue['from'].' TO '.$oldvalue['to'];
} else {
$oldvalue = null ;
}
2023-04-26 06:42:50 +00:00
break ;
2023-04-25 10:29:40 +00:00
default :
2023-04-26 15:35:59 +00:00
$oldvalue = is_array ( $allparams [ $facetname ]) ? $allparams [ $facetname ] : [ $allparams [ $facetname ]];
2023-04-25 10:29:40 +00:00
$oldtransval = $oldvalue ;
}
2023-04-26 15:35:59 +00:00
if ( $oldvalue ) {
unset ( $allparams [ $facetname ]);
$newrequest = Symfony\Component\HttpFoundation\Request :: create ( $request -> getBaseUrl (), 'GET' , $allparams );
$menuitems [] = array ( 'label' => '<i class="fa fa-remove"></i> ' . getMLText ( $facetname ) . ' = ' . implode ( ', ' , $oldtransval ), 'link' => $newrequest -> getRequestUri (), 'attributes' => [[ 'title' , 'Click to remove' ]], '_badge' => 'x' );
foreach ( $oldvalue as $ok => $ov )
echo '<input type="hidden" name="' . $facetname . '[' . $ok . ']" value="' . $ov . '" />' ;
}
2023-04-23 17:03:51 +00:00
}
}
2023-04-28 15:13:16 +00:00
}
2023-04-23 17:03:51 +00:00
}
2023-04-28 15:13:16 +00:00
}
/* Create remove links for query 'notset' . The don ' t have any facet
* values and will not show up in the lists created above .
* This currently just workѕ for attributes
*/
$allparams = $request -> query -> all ();
foreach ( $allparams [ 'attributes' ] as $an => $av ) {
if ( is_string ( $av ) && $av == '__notset__' ) {
$tmp = explode ( '_' , $an );
if ( $attrdef = $dms -> getAttributeDefinition ( $tmp [ 1 ])) {
$dispname = $attrdef -> getName ();
unset ( $allparams [ 'attributes' ][ $an ]);
$newrequest = Symfony\Component\HttpFoundation\Request :: create ( $request -> getBaseUrl (), 'GET' , $allparams );
$menuitems [] = array ( 'label' => '<i class="fa fa-remove"></i> ' . $dispname . ' is not set' , 'link' => $newrequest -> getRequestUri (), 'attributes' => [[ 'title' , 'Click to remove' ]], '_badge' => 'x' );
2023-04-29 13:09:20 +00:00
echo '<input type="hidden" name="attributes[' . $an . ']" value="__notset__" />' ;
2023-04-28 15:13:16 +00:00
}
2023-04-23 17:03:51 +00:00
}
2023-04-24 05:31:20 +00:00
}
2023-04-28 15:13:16 +00:00
if ( $menuitems ) {
self :: showNavigationListWithBadges ( $menuitems );
}
2023-04-24 05:31:20 +00:00
echo " <p></p> " ;
$this -> formSubmit ( " <i class= \" fa fa-search \" ></i> " . getMLText ( 'search' ));
echo " <p></p> " ;
if ( $facets ) {
$allparams = $request -> query -> all ();
if ( ! isset ( $allparams [ 'fullsearch' ]))
$allparams [ 'fullsearch' ] = 1 ;
if ( ! isset ( $allparams [ 'facetsearch' ]))
$allparams [ 'facetsearch' ] = 1 ;
$newrequest = Symfony\Component\HttpFoundation\Request :: create ( $request -> getBaseUrl (), 'GET' , $allparams );
2023-04-23 17:03:51 +00:00
foreach ( $facets as $facetname => $values ) {
if ( substr ( $facetname , 0 , 5 ) == 'attr_' ) {
$tmp = explode ( '_' , $facetname );
if ( $attrdef = $dms -> getAttributeDefinition ( $tmp [ 1 ])) {
$dispname = $attrdef -> getName ();
2023-04-24 05:31:20 +00:00
switch ( $attrdef -> getType ()) {
case SeedDMS_Core_AttributeDefinition :: type_int :
2023-04-24 14:58:48 +00:00
case SeedDMS_Core_AttributeDefinition :: type_float :
2023-04-24 05:31:20 +00:00
/* See below on an explaination for the if statement */
if ( $values && ( count ( $values ) > 1 || reset ( $values ) < $total )) {
if ( empty ( $allparams [ 'attributes' ][ $facetname ][ 'from' ]) && empty ( $allparams [ 'attributes' ][ $facetname ][ 'to' ])) {
$tt = array_keys ( $values );
2023-04-28 15:13:16 +00:00
$content = '' ;
2023-04-29 13:10:05 +00:00
$content .= '<p><a href="' . $newrequest -> getRequestUri () . '&attributes[' . $facetname . ']=__notset__">' . getMLText ( 'objects_without_attribute' ) . '</a></p>' ;
2023-04-28 15:13:16 +00:00
$content .= '<div class="input-group">' ;
2023-04-25 10:29:40 +00:00
$content .= '<span class="input-group-text" style="border-right: 0;"> from </span>' ;
2023-04-29 13:10:05 +00:00
$content .= '<input type="number" class="form-control" name="attributes[' . $facetname . '][from]" value="" placeholder="' . min ( $tt ) . '" />' ;
2023-04-24 05:31:20 +00:00
$content .= '<span class="input-group-text" style="border-left: 0; border-right: 0;"> to </span>' ;
2023-04-29 13:10:05 +00:00
$content .= '<input type="number" class="form-control" name="attributes[' . $facetname . '][to]" value="" placeholder="' . max ( $tt ) . '" />' ;
2023-04-24 14:58:48 +00:00
$content .= '<button class="btn btn-primary" type="submit">Set</button>' ;
2023-04-24 05:31:20 +00:00
$content .= '</div>' ;
$this -> printAccordion ( $dispname , $content );
}
}
break ;
2023-04-25 10:29:40 +00:00
case SeedDMS_Core_AttributeDefinition :: type_date :
if ( $values && ( count ( $values ) > 1 || reset ( $values ) < $total )) {
if ( empty ( $allparams [ 'attributes' ][ $facetname ][ 'from' ]) && empty ( $allparams [ 'attributes' ][ $facetname ][ 'to' ])) {
$tt = array_keys ( $values );
2023-04-29 13:10:28 +00:00
$content = '' ;
$content .= '<p><a href="' . $newrequest -> getRequestUri () . '&attributes[' . $facetname . ']=__notset__">' . getMLText ( 'objects_without_attribute' ) . '</a></p>' ;
$content .= '<div class="input-group">' ;
2023-04-25 10:29:40 +00:00
$content .= '<span class="input-group-text" style="border-right: 0;"> from </span>' ;
2023-04-28 09:21:59 +00:00
$content .= $this -> getDateChooser ( '' , " attributes[ " . $facetname . " ][from] " , $this -> params [ 'session' ] -> getLanguage (), '' , getReadableDate ( min ( $tt )), getReadableDate ( max ( $tt )), null , '' , true );
2023-04-25 10:29:40 +00:00
$content .= '<span class="input-group-text" style="border-left: 0; border-right: 0;"> to </span>' ;
2023-04-28 09:21:59 +00:00
$content .= $this -> getDateChooser ( '' , " attributes[ " . $facetname . " ][to] " , $this -> params [ 'session' ] -> getLanguage (), '' , getReadableDate ( min ( $tt )), getReadableDate ( max ( $tt )), null , '' , true );
2023-04-25 10:29:40 +00:00
$content .= '<button class="btn btn-primary" type="submit">Set</button>' ;
$content .= '</div>' ;
$this -> printAccordion ( $dispname , $content );
}
}
break ;
2023-04-24 05:31:20 +00:00
default :
/* See below on an explaination for the if statement */
if ( $values && ( count ( $values ) > 1 || reset ( $values ) < $total )) {
$menuitems = array ();
2023-04-29 13:10:05 +00:00
$menuitems [] = array ( 'label' => getMLText ( 'no_value_set' ), 'link' => $newrequest -> getRequestUri () . '&attributes[' . $facetname . ']=__notset__' );
2023-04-24 05:31:20 +00:00
arsort ( $values );
foreach ( $values as $v => $c ) {
2023-04-25 10:29:40 +00:00
switch ( $attrdef -> getType ()) {
case SeedDMS_Core_AttributeDefinition :: type_date :
$menuitems [] = array ( 'label' => getReadableDate ( $v ), 'link' => $newrequest -> getRequestUri () . '&attributes[' . $facetname . '][]=' . urlencode ( $v ), 'badge' => $c );
break ;
default :
$menuitems [] = array ( 'label' => htmlspecialchars ( $v ), 'link' => $newrequest -> getRequestUri () . '&attributes[' . $facetname . '][]=' . urlencode ( $v ), 'badge' => $c );
}
2023-04-24 05:31:20 +00:00
}
ob_start ();
self :: showNavigationListWithBadges ( $menuitems );
$content = ob_get_clean ();
$this -> printAccordion ( $dispname , $content );
2023-04-23 17:03:51 +00:00
}
}
}
2023-04-26 06:42:50 +00:00
} elseif ( $facetname == 'created' ) {
if ( empty ( $allparams [ $facetname ][ 'from' ]) && empty ( $allparams [ $facetname ][ 'to' ])) {
$tt = array_keys ( $values );
$content = '<div class="input-group">' ;
$content .= '<span class="input-group-text" style="border-right: 0;"> from </span>' ;
2023-04-28 09:21:59 +00:00
$content .= $this -> getDateChooser ( '' , $facetname . " [from] " , $this -> params [ 'session' ] -> getLanguage (), '' , '' /*getReadableDate(min($tt))*/ , getReadableDate ( time ()), null , '' , true );
2023-04-26 06:42:50 +00:00
$content .= '<span class="input-group-text" style="border-left: 0; border-right: 0;"> to </span>' ;
2023-04-28 09:21:59 +00:00
$content .= $this -> getDateChooser ( '' , $facetname . " [to] " , $this -> params [ 'session' ] -> getLanguage (), '' , '' /*getReadableDate(min($tt))*/ , getReadableDate ( time ()), null , '' , true );
2023-04-26 06:42:50 +00:00
$content .= '<button class="btn btn-primary" type="submit">Set</button>' ;
$content .= '</div>' ;
$this -> printAccordion ( getMLText ( 'creation_date' ), $content );
}
2023-04-23 17:03:51 +00:00
} else {
2023-04-24 05:31:20 +00:00
/* Further filter makes only sense if the facet has more than 1 value
* or in case of 1 value , if that value has a count < $total . That second
* case will reduce the result set on those objects which have the field
2023-04-23 17:03:51 +00:00
* actually set .
*/
if ( $values && ( count ( $values ) > 1 || reset ( $values ) < $total )) {
$menuitems = array ();
arsort ( $values );
2023-04-25 10:29:40 +00:00
switch ( $facetname ) {
case 'status' :
foreach ( $values as $v => $c ) {
$menuitems [] = array ( 'label' => getOverallStatusText ( $v ), 'link' => $newrequest -> getRequestUri () . '&' . $facetname . '[]=' . urlencode ( $v ), 'badge' => $c );
}
break ;
2023-04-26 15:35:59 +00:00
case 'owner' :
foreach ( $values as $v => $c ) {
if ( $fu = $dms -> getUserByLogin ( $v ))
$menuitems [] = array ( 'label' => $fu -> getLogin (), 'link' => $newrequest -> getRequestUri () . '&' . $facetname . '[]=' . $fu -> getId (), 'badge' => $c );
}
break ;
2023-04-25 10:29:40 +00:00
default :
foreach ( $values as $v => $c ) {
$menuitems [] = array ( 'label' => htmlspecialchars ( $v ), 'link' => $newrequest -> getRequestUri () . '&' . $facetname . '[]=' . urlencode ( $v ), 'badge' => $c );
}
2023-04-23 17:03:51 +00:00
}
ob_start ();
self :: showNavigationListWithBadges ( $menuitems );
$content = ob_get_clean ();
$this -> printAccordion ( getMLText ( $facetname ), $content );
}
}
}
}
// echo "<pre>";
// print_r($facets);
// echo "</pre>";
?>
</ form >
2013-06-07 08:12:49 +00:00
< ? php
echo " </div> \n " ;
}
2022-08-18 11:05:02 +00:00
// }}}
2013-06-07 08:12:49 +00:00
?>
</ div >
< ? php
2021-06-14 15:23:42 +00:00
if ( $this -> query ) {
echo " </div> \n " ;
}
2022-08-24 05:58:02 +00:00
/* Batch operations {{{ */
if ( $total )
$this -> contentHeading ( getMLText ( 'batch_operation' ));
if ( $totaldocs ) {
ob_start ();
$this -> formField (
getMLText ( " include_content " ),
array (
'element' => 'input' ,
'type' => 'checkbox' ,
'name' => 'includecontent' ,
'id' => 'includecontent' ,
'value' => 1 ,
)
);
//$this->formSubmit("<i class=\"fa fa-download\"></i> ".getMLText('export'));
print $this -> html_link ( 'Search' , array_merge ( $_GET , array ( 'action' => 'export' )), array ( 'class' => 'btn btn-primary' , 'id' => 'export' ), " <i class= \" fa fa-download \" ></i> " . getMLText ( " export " ), false , true ) . " \n " ;
$content = ob_get_clean ();
$this -> printAccordion ( getMLText ( 'export' ), $content );
}
if ( $user -> isAdmin () && $total ) {
ob_start ();
$users = $dms -> getAllUsers ();
$options = array ();
$options [] = array ( " -1 " , getMLText ( " choose_user " ));
foreach ( $users as $currUser ) {
$options [] = array ( $currUser -> getID (), htmlspecialchars ( $currUser -> getLogin () . ' - ' . $currUser -> getFullName ()), false , array ( array ( 'data-subtitle' , htmlspecialchars ( $currUser -> getEmail ()))));
}
$this -> formField (
null , //getMLText("selection"),
array (
'element' => 'select' ,
'id' => 'newowner' ,
'class' => 'chzn-select' ,
'options' => $options ,
'placeholder' => getMLText ( 'select_users' ),
2022-09-06 08:41:39 +00:00
'attributes' => array ( array ( 'style' , 'width: 100%;' ))
2022-08-24 05:58:02 +00:00
)
);
2022-09-06 08:41:39 +00:00
// print $this->html_link('Search', array_merge($_GET, array('action'=>'changeowner')), array('class'=>'btn btn-primary', 'id'=>'changeowner'), "<i class=\"fa fa-user\"></i> ".getMLText("batch_change_owner"), false, true)."\n";
print $this -> html_link ( 'Search' , array_merge ( $_GET , array ( 'action' => 'changeowner' )), array ( 'class' => 'btn btn-primary change-owner-btn mt-4' , 'confirmmsg' => htmlspecialchars ( getMLText ( " confirm_change_owner " , array ()), ENT_QUOTES )), " <i class= \" fa fa-user \" ></i> " . getMLText ( " batch_change_owner " ), false , true ) . " \n " ;
2022-08-24 05:58:02 +00:00
$content = ob_get_clean ();
$this -> printAccordion ( getMLText ( 'batch_change_owner' ), $content );
2022-09-14 16:08:34 +00:00
ob_start ();
$cats = $dms -> getDocumentCategories ();
2023-01-19 06:08:04 +00:00
if ( $cats ) {
$options = array ();
$options [] = array ( " -1 " , getMLText ( " choose_category " ));
foreach ( $cats as $currcat ) {
$options [] = array ( $currcat -> getID (), htmlspecialchars ( $currcat -> getName ()), false );
}
$this -> formField (
null ,
array (
'element' => 'select' ,
'id' => 'batchcategory' ,
'class' => 'chzn-select' ,
'options' => $options ,
'multiple' => false ,
'placeholder' => getMLText ( 'select_category' ),
'attributes' => array ( array ( 'style' , 'width: 100%;' ))
)
);
$this -> formField (
getMLText ( " batch_remove_category " ),
array (
'element' => 'input' ,
'type' => 'checkbox' ,
'id' => 'removecategory' ,
'value' => '1' ,
)
);
2022-09-14 16:08:34 +00:00
2023-01-19 06:08:04 +00:00
print $this -> html_link ( 'Search' , array_merge ( $_GET , array ( 'action' => 'changecategory' )), array ( 'class' => 'btn btn-primary change-category-btn mt-4' , 'id' => 'changecategory' ), " <i class= \" fa fa-user \" ></i> " . getMLText ( " batch_change_category " ), false , true ) . " \n " ;
2022-09-14 16:08:34 +00:00
2023-01-19 06:08:04 +00:00
$content = ob_get_clean ();
$this -> printAccordion ( getMLText ( 'batch_change_category' ), $content );
}
2022-08-24 05:58:02 +00:00
}
// }}}
?>
< ? php
2020-10-07 17:04:39 +00:00
$this -> columnEnd ();
$this -> columnStart ( 8 );
2022-08-18 16:40:51 +00:00
if ( $batchmsg = $this -> getParam ( 'batchmsg' )) {
$this -> contentHeading ( getMLText ( 'batch_operation_result' ));
echo $this -> infoMsg ( $batchmsg );
}
2021-05-06 19:15:31 +00:00
$this -> contentHeading ( getMLText ( 'search_results' ));
2015-08-19 18:15:45 +00:00
// Search Result {{{
2013-02-06 17:09:16 +00:00
$foldercount = $doccount = 0 ;
2012-12-14 07:53:13 +00:00
if ( $entries ) {
2015-08-19 18:15:45 +00:00
/*
2013-02-06 17:09:16 +00:00
foreach ( $entries as $entry ) {
2019-08-08 07:16:06 +00:00
if ( $entry -> isType ( 'document' )) {
2013-02-06 17:09:16 +00:00
$doccount ++ ;
2019-08-08 07:16:06 +00:00
} elseif ( $entry -> isType ( 'document' )) {
2013-02-06 17:09:16 +00:00
$foldercount ++ ;
}
}
2015-08-19 18:15:45 +00:00
*/
2021-11-19 12:49:46 +00:00
echo $this -> infoMsg ( getMLText ( " search_report " , array ( " count " => $total , " doccount " => $totaldocs , " foldercount " => $totalfolders , 'searchtime' => $searchTime )));
2022-09-13 18:03:56 +00:00
$this -> pageList (( int ) $pageNumber , $totalpages , " ../out/out.Search.php " , $urlparams );
2014-06-11 09:02:50 +00:00
// $this->contentContainerStart();
2012-12-14 07:53:13 +00:00
2020-12-01 17:24:55 +00:00
$txt = $this -> callHook ( 'searchListHeader' , $orderby , 'asc' );
2022-01-03 12:35:12 +00:00
if ( is_string ( $txt )) {
2017-03-02 19:00:56 +00:00
echo $txt ;
2022-01-03 12:35:12 +00:00
} elseif ( is_array ( $txt )) {
2021-05-05 11:47:38 +00:00
print " <table class= \" table table-condensed table-sm table-hover \" > " ;
2017-03-02 19:00:56 +00:00
print " <thead> \n <tr> \n " ;
2022-01-03 12:35:12 +00:00
foreach ( $txt as $headcol )
echo " <th> " . $headcol . " </th> \n " ;
print " </tr> \n </thead> \n " ;
} else {
echo $this -> folderListHeader ( null , 'search' );
2017-03-02 19:00:56 +00:00
}
2022-01-03 12:35:12 +00:00
print " <tbody> \n " ;
2012-12-14 07:53:13 +00:00
2019-01-18 12:07:39 +00:00
$previewer = new SeedDMS_Preview_Previewer ( $cachedir , $previewwidth , $timeout , $xsendfile );
2022-08-18 08:02:13 +00:00
if ( $conversionmgr )
$previewer -> setConversionMgr ( $conversionmgr );
else
$previewer -> setConverters ( $previewconverters );
2012-12-14 07:53:13 +00:00
foreach ( $entries as $entry ) {
2019-08-08 07:16:06 +00:00
if ( $entry -> isType ( 'document' )) {
2022-01-03 12:35:12 +00:00
$document = $entry ;
if ( $lc = $document -> getLatestContent ())
$previewer -> createPreview ( $lc );
2019-04-11 04:19:56 +00:00
2022-01-03 12:35:12 +00:00
$lcattributes = $lc ? $lc -> getAttributes () : null ;
$attrstr = '' ;
if ( $lcattributes ) {
$attrstr .= " <table class= \" table table-condensed table-sm \" > \n " ;
$attrstr .= " <tr><th> " . getMLText ( 'name' ) . " </th><th> " . getMLText ( 'attribute_value' ) . " </th></tr> " ;
foreach ( $lcattributes as $lcattribute ) {
$arr = $this -> callHook ( 'showDocumentContentAttribute' , $lc , $lcattribute );
if ( is_array ( $arr )) {
$attrstr .= " <tr> " ;
$attrstr .= " <td> " . $arr [ 0 ] . " :</td> " ;
$attrstr .= " <td> " . $arr [ 1 ] . " </td> " ;
$attrstr .= " </tr> " ;
} elseif ( is_string ( $arr )) {
$attrstr .= $arr ;
} else {
$attrdef = $lcattribute -> getAttributeDefinition ();
$attrstr .= " <tr><td> " . htmlspecialchars ( $attrdef -> getName ()) . " </td><td> " . htmlspecialchars ( implode ( ', ' , $lcattribute -> getValueAsArray ())) . " </td></tr> \n " ;
// TODO: better use printAttribute()
// $this->printAttribute($lcattribute);
2019-04-11 04:19:56 +00:00
}
}
2022-01-03 12:35:12 +00:00
$attrstr .= " </table> \n " ;
}
$docattributes = $document -> getAttributes ();
if ( $docattributes ) {
$attrstr .= " <table class= \" table table-condensed table-sm \" > \n " ;
$attrstr .= " <tr><th> " . getMLText ( 'name' ) . " </th><th> " . getMLText ( 'attribute_value' ) . " </th></tr> " ;
foreach ( $docattributes as $docattribute ) {
$arr = $this -> callHook ( 'showDocumentAttribute' , $document , $docattribute );
if ( is_array ( $arr )) {
$attrstr .= " <tr> " ;
$attrstr .= " <td> " . $arr [ 0 ] . " :</td> " ;
$attrstr .= " <td> " . $arr [ 1 ] . " </td> " ;
$attrstr .= " </tr> " ;
} elseif ( is_string ( $arr )) {
$attrstr .= $arr ;
} else {
$attrdef = $docattribute -> getAttributeDefinition ();
$attrstr .= " <tr><td> " . htmlspecialchars ( $attrdef -> getName ()) . " </td><td> " . htmlspecialchars ( implode ( ', ' , $docattribute -> getValueAsArray ())) . " </td></tr> \n " ;
2019-04-11 04:19:56 +00:00
}
}
2022-01-03 12:35:12 +00:00
$attrstr .= " </table> \n " ;
}
$extracontent = array ();
$extracontent [ 'below_title' ] = $this -> getListRowPath ( $document );
if ( $attrstr )
$extracontent [ 'bottom_title' ] = '<br />' . $this -> printPopupBox ( '<span class="btn btn-mini btn-sm btn-secondary">' . getMLText ( 'attributes' ) . '</span>' , $attrstr , true );
2022-08-24 05:57:14 +00:00
$extracontent [ 'end_action_list' ] = $this -> printMarkDocumentButton ( $document , true );
2022-01-03 12:35:12 +00:00
$txt = $this -> callHook ( 'documentListItem' , $entry , $previewer , false , 'search' , $extracontent );
if ( is_string ( $txt ))
echo $txt ;
else {
2019-04-11 04:19:56 +00:00
print $this -> documentListRow ( $document , $previewer , false , 0 , $extracontent );
2013-07-31 19:44:46 +00:00
}
2019-08-08 07:16:06 +00:00
} elseif ( $entry -> isType ( 'folder' )) {
2020-12-13 13:45:55 +00:00
$txt = $this -> callHook ( 'folderListItem' , $entry , false , 'search' );
if ( is_string ( $txt ))
echo $txt ;
else {
2012-12-14 07:53:13 +00:00
$folder = $entry ;
2019-04-11 04:19:56 +00:00
$attrstr = '' ;
$folderattributes = $folder -> getAttributes ();
if ( $folderattributes ) {
2021-05-05 11:47:38 +00:00
$attrstr .= " <table class= \" table table-condensed table-sm \" > \n " ;
2019-04-11 04:19:56 +00:00
$attrstr .= " <tr><th> " . getMLText ( 'name' ) . " </th><th> " . getMLText ( 'attribute_value' ) . " </th></tr> " ;
foreach ( $folderattributes as $folderattribute ) {
$attrdef = $folderattribute -> getAttributeDefinition ();
$attrstr .= " <tr><td> " . htmlspecialchars ( $attrdef -> getName ()) . " </td><td> " . htmlspecialchars ( implode ( ', ' , $folderattribute -> getValueAsArray ())) . " </td></tr> \n " ;
}
$attrstr .= " </table> " ;
}
$extracontent = array ();
2021-04-22 07:59:37 +00:00
$extracontent [ 'below_title' ] = $this -> getListRowPath ( $folder );
2019-04-11 04:19:56 +00:00
if ( $attrstr )
2021-05-05 11:47:38 +00:00
$extracontent [ 'bottom_title' ] = '<br />' . $this -> printPopupBox ( '<span class="btn btn-mini btn-sm btn-secondary">' . getMLText ( 'attributes' ) . '</span>' , $attrstr , true );
2022-08-24 05:57:14 +00:00
$extracontent [ 'end_action_list' ] = $this -> printMarkFolderButton ( $folder , true );
2020-03-05 08:12:25 +00:00
print $this -> folderListRow ( $folder , false , $extracontent );
2020-12-13 13:45:55 +00:00
}
2012-12-14 07:53:13 +00:00
}
}
print " </tbody></table> \n " ;
2014-06-11 09:02:50 +00:00
// $this->contentContainerEnd();
2022-09-13 18:03:56 +00:00
$this -> pageList (( int ) $pageNumber , $totalpages , " ../out/out.Search.php " , $_GET );
2012-12-14 07:53:13 +00:00
} else {
2015-08-19 18:15:45 +00:00
$numResults = $totaldocs + $totalfolders ;
2012-12-14 07:53:13 +00:00
if ( $numResults == 0 ) {
2021-05-05 11:47:38 +00:00
echo $this -> warningMsg ( getMLText ( " search_no_results " ));
2012-12-14 07:53:13 +00:00
}
}
2013-06-07 08:12:49 +00:00
// }}}
2020-10-07 17:04:39 +00:00
$this -> columnEnd ();
$this -> rowEnd ();
2016-03-15 07:30:53 +00:00
$this -> contentEnd ();
2012-12-14 07:53:13 +00:00
$this -> htmlEndPage ();
} /* }}} */
}
?>