Platform
3.1
PHP API documentation
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
searchdocument.php
Go to the documentation of this file.
1
<?php
2
/*
3
* @author Anakeen
4
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5
* @package FDL
6
*/
7
/**
8
* Search document and return list of them
9
*
10
* @author Anakeen 2006
11
* @version $Id: searchdocument.php,v 1.5 2007/09/07 15:26:49 eric Exp $
12
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13
* @package FDL
14
* @subpackage
15
*/
16
/**
17
*/
18
19
include_once (
"FDL/Lib.Dir.php"
);
20
/**
21
* View list of documents from one folder
22
* @param Action &$action current action
23
* @global famid Http var : family id where search document
24
* @global key Http var : filter key on the title
25
*/
26
function
searchdocument
(&
$action
)
27
{
28
header(
'Content-type: text/xml; charset=utf-8'
);
29
$action
->lay->setEncoding(
"utf-8"
);
30
31
$mb = microtime();
32
$famid
=
GetHttpVars
(
"famid"
);
33
$key =
GetHttpVars
(
"key"
);
34
$noids = explode(
'|'
,
GetHttpVars
(
"noids"
));
35
$dbaccess
=
$action
->GetParam(
"FREEDOM_DB"
);
36
37
$action
->lay->set(
"warning"
,
""
);
38
$action
->lay->set(
"CODE"
,
"OK"
);
39
$limit = 20;
40
if
($key !=
""
)
$filter
[] =
"title ~* '"
. pg_escape_string($key) .
"'"
;
41
$filter
[] =
"doctype!='T'"
;
42
43
$lq =
getChildDoc
(
$dbaccess
, 0, 0, $limit,
$filter
,
$action
->user->id,
"TABLE"
,
$famid
);
44
$doc
= new_doc(
$dbaccess
);
45
46
foreach
($lq as $k => $v) {
47
if
(!in_array($v[
"initid"
], $noids)) {
48
$lq[$k][
"title"
] = ($v[
"title"
]);
49
$lq[$k][
"stitle"
] = str_replace(
"'"
,
"\\'"
, ($v[
"title"
]));
50
$lq[$k][
"icon"
] =
$doc
->getIcon($v[
"icon"
]);
51
}
else
{
52
unset($lq[$k]);
53
}
54
}
55
56
$action
->lay->setBlockData(
"DOCS"
, $lq);
57
58
$action
->lay->set(
"onecount"
,
false
);
59
if
(count($lq) == 1) {
60
$action
->lay->set(
"onecount"
,
true
);
61
reset($lq);
62
$q
= current($lq);
63
$action
->lay->set(
"firstinsert"
, sprintf(_(
"%s inserted"
) ,
$q
[
"title"
]));
64
}
65
$action
->lay->set(
"count"
, count($lq));
66
$action
->lay->set(
"delay"
,
microtime_diff
(microtime() , $mb));
67
}
68
?>
← centre documentaire
© anakeen
- published under
CC License
-
Dynacase