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
search.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
9
*
10
* @author Anakeen 2000
11
* @version $Id: search.php,v 1.29 2008/12/30 17:14:40 eric Exp $
12
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13
* @package FDL
14
* @subpackage GED
15
*/
16
/**
17
*/
18
19
include_once (
"FDL/Lib.Dir.php"
);
20
21
include_once (
"FDL/freedom_util.php"
);
22
23
include_once (
"FDL/modcard.php"
);
24
/**
25
* Search document
26
* @param Action &$action current action
27
* @global keyword Http var : word to search in any values
28
* @global famid Http var : restrict to this family identioficator
29
* @global viewone Http var : (Y|N) if Y direct view document detail if only one returned
30
* @global view Http var : display mode : icon|column|list
31
*/
32
function
search
(&
$action
)
33
{
34
// -----------------------------------
35
$docid
=
GetHttpVars
(
"id"
, 0);
36
$classid =
GetHttpVars
(
"classid"
, 0);
37
$keyword
=
GetHttpVars
(
"_se_key"
,
GetHttpVars
(
"keyword"
));
// keyword to search
38
$viewone
=
GetHttpVars
(
"viewone"
);
// direct view if only one Y|N
39
$target
=
GetHttpVars
(
"target"
);
// target window when click on document
40
$view =
GetHttpVars
(
"view"
);
// display mode : icon|column|list
41
$famid
=
GetHttpVars
(
"famid"
);
42
$generic = (
GetHttpVars
(
"ingeneric"
) ==
"yes"
);
43
$dbaccess
=
$action
->GetParam(
"FREEDOM_DB"
);
44
45
if
($classid == 0) {
46
if
(
$docid
> 0) {
47
$doc
=
new_Doc
(
$dbaccess
,
$docid
);
48
$classid =
$doc
->fromid;
49
}
else
{
50
$classid = 5;
51
// $action->exitError(_("kind of search is not defined"));
52
53
}
54
}
55
// new doc
56
$ndoc =
createTmpDoc
(
$dbaccess
, $classid);
57
if
(!$ndoc)
$action
->exitError(sprintf(_(
"no privilege to create this kind (%d) of document"
) , $classid));
58
59
if
(
$keyword
!=
""
) $ndoc->title = _(
"new search "
) .
$keyword
;
60
else
{
61
if
(!
$famid
)
$famid
=
GetHttpVars
(
"_se_famid"
);
62
if
(
$famid
> 0) {
63
$fam = $ndoc->getTitle(
$famid
);
64
$ndoc->title = sprintf(_(
"search %s"
) , $fam);
65
}
else
{
66
$ndoc->title = sprintf(_(
"search result"
));
67
}
68
}
69
$ndoc->setValue(
"se_key"
,
$keyword
);
70
$ndoc->setValue(
"se_latest"
,
"yes"
);
71
$ndoc->setValue(
"se_famid"
,
$famid
);
72
$err
= $ndoc->Add();
73
74
if
(
$err
!=
""
)
$action
->ExitError(
$err
);
75
$ndoc->SpecRefresh();
76
77
SetHttpVar
(
"id"
, $ndoc->id);
78
$err
=
modcard
(
$action
, $ndocid);
// ndocid change if new doc
79
$orderby = urlencode($ndoc->getValue(
"se_orderby"
));
80
81
if
($generic) {
82
redirect(
$action
,
"GENERIC"
,
"GENERIC_LIST&famid=$famid&catg=0&dirid="
. $ndoc->id,
$action
->GetParam(
"CORE_STANDURL"
));
83
}
else
{
84
redirect(
$action
,
GetHttpVars
(
"app"
) ,
"FREEDOM_VIEW&view=$view&target=$target&viewone=$viewone&dirid="
. $ndoc->id .
"&sqlorder=$orderby"
,
$action
->GetParam(
"CORE_STANDURL"
));
85
}
86
}
87
?>
← centre documentaire
© anakeen
- published under
CC License
-
Dynacase