Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
searchdocument.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Search document and return list of them
8  *
9  * @author Anakeen
10  * @version $Id: searchdocument.php,v 1.5 2007/09/07 15:26:49 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 
17 include_once ("FDL/Lib.Dir.php");
18 /**
19  * View list of documents from one folder
20  * @param Action &$action current action
21  * @internal string $famid Http var : family id where search document
22  * @global string $key Http var : filter key on the title
23  */
25 {
26  header('Content-type: text/xml; charset=utf-8');
27 
28  $mb = microtime();
29  $famid = GetHttpVars("famid");
30  $key = GetHttpVars("key");
31  $noids = explode('|', GetHttpVars("noids"));
32 
33  $action->lay->set("warning", "");
34  $action->lay->set("CODE", "OK");
35  $limit = 20;
36  if ($key != "") $filter[] = "title ~* '" . pg_escape_string($key) . "'";
37  $filter[] = "doctype!='T'";
38 
39  $lq = internalGetDocCollection($action->dbaccess, 0, 0, $limit, $filter, $action->user->id, "TABLE", $famid);
40  $doc = new_doc($action->dbaccess);
41 
42  foreach ($lq as $k => $v) {
43  if (!in_array($v["initid"], $noids)) {
44  $lq[$k]["title"] = $v["title"];
45  $lq[$k]["stitle"] = str_replace("'", "\\'", ($v["title"]));
46  $lq[$k]["icon"] = $doc->getIcon($v["icon"]);
47  } else {
48  unset($lq[$k]);
49  }
50  }
51 
52  $action->lay->eSetBlockData("DOCS", $lq);
53 
54  $action->lay->set("onecount", false);
55  if (count($lq) == 1) {
56  $action->lay->set("onecount", true);
57  reset($lq);
58  $q = current($lq);
59  $action->lay->set("firstinsert", sprintf(_("%s inserted") , $q["title"]));
60  }
61  $action->lay->set("count", count($lq));
62  $action->lay->set("delay", microtime_diff(microtime() , $mb));
63 }
global $action
searchdocument(Action &$action)
microtime_diff($a, $b)
Definition: Lib.Common.php:302
internalGetDocCollection($dbaccess, $dirid, $start="0", $slice="ALL", $sqlfilters=array(), $userid=1, $qtype="LIST", $fromid="", $distinct=false, $orderby="title", $latest=true, $trash="", &$debug=null, $folderRecursiveLevel=2, $join= '',\SearchDoc &$searchDoc=null)
Definition: Lib.Dir.php:428
← centre documentaire © anakeen