Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
fdlsearches.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * function use for specialised searches
8  *
9  * @author Anakeen
10  * @version $Id: fdlsearches.php,v 1.3 2007/08/01 14:08:09 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 function mytagdoc_($start, $slice, $tag, $userid = 0)
17 {
18  include_once ("FDL/Class.DocUTag.php");
19  include_once ("FDL/Lib.Dir.php");
21  if ($userid == 0) $uid = getUserId();
22  else $uid = $userid;
23  $q = new QueryDb($dbaccess, "DocUTag");
24  $q->AddQuery("uid=$uid");
25  $q->AddQuery("tag='$tag'");
26  $q->order_by = "date desc";
27  $lq = $q->Query($start, $slice, "TABLE");
28  $lid = array();
29  if ($q->nb > 0) {
30  foreach ($lq as $k => $v) {
31  $lid[$v["initid"]] = $v["id"];
32  }
33  }
34  //print Doc::getTimeDate(0,true);
35  $ltdoc = getDocsFromIds($dbaccess, $lid);
36  // print "\nc=".count($ltdoc)."\n";
37  //print Doc::getTimeDate(0,true);
38  // print_r2($ltdoc);
39  return $ltdoc;
40 }
41 /**
42  * return document i have deleted
43  */
44 function mytagdoc($start = "0", $slice = "ALL", $tag, $userid = 0)
45 {
46  include_once ("FDL/Class.SearchDoc.php");
48  $s = new searchDoc($dbaccess);
49  $s->join("id = docutag(id)");
50  $s->slice = $slice;
51  $s->start = $start;
52  $s->addFilter("docutag.uid = %d", $userid);
53  $s->addFilter("docutag.tag = '%s'", $tag);
54 
55  return $s->search();
56 }
57 /**
58  * function use for specialised search
59  * return all document tagged TOVIEWDOC for current user
60  *
61  * @param int $start start cursor
62  * @param int $slice offset ("ALL" means no limit)
63  * @param int $userid user system identifier (NOT USE in this function)
64  */
65 function mytoviewdoc($start = "0", $slice = "ALL", $userid = 0)
66 {
67  return mytagdoc($start, $slice, "TOVIEW", $userid);
68 }
69 /**
70  * function use for specialised search
71  * return all document tagged VIEWED for current user
72  *
73  * @param int $start start cursor
74  * @param int $slice offset ("ALL" means no limit)
75  * @param int $userid user system identifier (NOT USE in this function)
76  */
77 function myvieweddoc($start = "0", $slice = "ALL", $userid = 0)
78 {
79  if ($slice == "ALL") $slice = 50;
80  return mytagdoc($start, $slice, "VIEWED", $userid);
81 }
82 /**
83  * function use for specialised search
84  * return all document tagged for current user
85  *
86  * @param int $start start cursor
87  * @param int $slice offset ("ALL" means no limit)
88  * @param int $userid user system identifier (NOT USE in this function)
89  */
90 function myaffecteddoc($start = "0", $slice = "ALL", $userid = 0)
91 {
92  return mytagdoc($start, $slice, "AFFECTED", $userid);
93 }
94 /**
95  * function use for specialised search
96  * return all referenced documents
97  *
98  * @param int $start start cursor
99  * @param int $slice offset ("ALL" means no limit)
100  * @param int $userid user system identifier (NOT USE in this function)
101  * @param int $docid document referenced
102  * @param int $famid family restriction (0 if no restriction)
103  */
104 function relateddoc($start = "0", $slice = "ALL", $userid = 0, $docid = 0, $famid = 0)
105 {
106 
108  if ($docid > 0) {
109  include_once ("FDL/Class.DocRel.php");
110  $lid = array();
112  $idocid = $doc->initid;
113  $rdoc = new DocRel($dbaccess, $idocid);
114  $rdoc->sinitid = $idocid;
115  $trel = $rdoc->getIRelations();
116 
117  foreach ($trel as $k => $v) {
118  $lid[$v["sinitid"]] = $v["sinitid"];
119  $tlay[$v["sinitid"] . '_F'] = array(
120  "iconsrc" => $doc->getIcon($v["sicon"]) ,
121  "initid" => $v["sinitid"],
122  "title" => $v["stitle"],
123  "aid" => $v["type"],
124  "alabel" => _($v["type"]) ,
125  "type" => _("Referenced from")
126  );
127  }
128  $ltdoc = getLatestDocsFromIds($dbaccess, $lid);
129  if ($famid != 0) {
130  if (!is_numeric($famid)) $famid = getFamIdFromName($dbaccess, $famid);
131  if ($famid > 0) {
132  $tfam = $doc->GetChildFam($famid);
133  $tfamids = array_keys($tfam);
134  $tfamids[] = $famid;
135 
136  foreach ($ltdoc as $k => $v) {
137  if (!in_array($v["fromid"], $tfamids)) unset($ltdoc[$k]);
138  }
139  }
140  }
141  }
142  return $ltdoc;
143 }
144 /**
145  * return document i have deleted
146  */
147 function mydeleteddoc($start = "0", $slice = "ALL", $userid = 0)
148 {
149  include_once ("FDL/Class.SearchDoc.php");
151  $s = new searchDoc($dbaccess);
152  $s->trash = 'only';
153  $s->join("id = dochisto(id)");
154  $s->addFilter("dochisto.uid = %d", $userid);
155  $s->addFilter("dochisto.code = 'DELETE'");
156  $s->distinct = true;
157 
158  return $s->search();
159 }
relateddoc($start="0", $slice="ALL", $userid=0, $docid=0, $famid=0)
getDocsFromIds($dbaccess, $ids, $userid=0)
Definition: Lib.Dir.php:1034
mydeleteddoc($start="0", $slice="ALL", $userid=0)
getLatestDocsFromIds($dbaccess, $ids, $userid=0)
Definition: Lib.Dir.php:1047
if($famId) $s
mytagdoc($start="0", $slice="ALL", $tag, $userid=0)
Definition: fdlsearches.php:44
$docid
Definition: cleanFamily.php:13
mytoviewdoc($start="0", $slice="ALL", $userid=0)
Definition: fdlsearches.php:65
getFamIdFromName($dbaccess, $name)
getDbAccess()
Definition: Lib.Common.php:368
new_Doc($dbaccess, $id= '', $latest=false)
myvieweddoc($start="0", $slice="ALL", $userid=0)
Definition: fdlsearches.php:77
myaffecteddoc($start="0", $slice="ALL", $userid=0)
Definition: fdlsearches.php:90
$dbaccess
Definition: checkVault.php:17
getUserId()
Definition: Lib.Common.php:608
mytagdoc_($start, $slice, $tag, $userid=0)
Definition: fdlsearches.php:16
← centre documentaire © anakeen