Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Method.SpecialSearch.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  * Detailled search
9  *
10  * @author Anakeen 2000
11  * @version $Id: Method.SpecialSearch.php,v 1.3 2007/08/01 14:07:12 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  * @begin-method-ignore
20  * this part will be deleted when construct document class until end-method-ignore
21  */
22 class _SSEARCH extends DocSearch
23 {
24  /*
25  * @end-method-ignore
26  */
27 
28  var $defaultedit = "FDL:EDITBODYCARD";
29  var $defaultview = "FDL:VIEWBODYCARD";
30  /**
31  * return sql query to search wanted document
32  */
33  function ComputeQuery($keyword = "", $famid = - 1, $latest = "yes", $sensitive = false, $dirid = - 1, $subfolder = true)
34  {
35 
36  return true;
37  }
38 
39  function getDocList($start = 0, $slice = "ALL", $qtype = "TABLE", $userid = "")
40  {
41  $phpfile = $this->getValue("se_phpfile");
42  $phpfunc = $this->getValue("se_phpfunc");
43  $phparg = $this->getValue("se_phparg");
44  if (!include_once ("EXTERNALS/$phpfile")) {
45  global $action;
46  $action->AddWarningMsg(sprintf(_("php file %s needed for request not found") , "EXTERNALS/$phpfunc"));
47  return false;
48  }
49  if (!$userid) $userid = $this->getSystemUserId();
50  $arg = array(
51  $start,
52  $slice,
53  $userid
54  );
55  if ($phparg != "") {
56  $moreargs = explode(",", $phparg);
57  foreach ($moreargs as $k => $v) {
58  $v = trim($v);
59  if ($v) {
60  if (($v[0] == "%") && (substr($v, -1) == "%")) {
61  $aid = substr($v, 1, -1);
62  if ($aid == "THIS") $moreargs[$k] = & $this;
63  else {
64  $val = $this->getValue($aid);
65  if (!$val) $val = $this->getProperty($aid);
66  $moreargs[$k] = $val;
67  }
68  }
69  }
70  }
71  $arg = array_merge($arg, $moreargs);
72  }
73  $res = call_user_func_array($phpfunc, $arg);
74 
75  return ($res);
76  }
77  /**
78  * return true if the search has parameters
79  */
80  function isParameterizable()
81  {
82  return false;
83  }
84  /**
85  * return true if the search need parameters
86  */
87  function needParameters()
88  {
89  return false;
90  }
91 
92  function isStaticSql()
93  {
94  return true;
95  }
96  /**
97  * return document includes in search folder
98  * @param bool $controlview if false all document are returned else only visible for current user document are return
99  * @param array $filter to add list sql filter for selected document
100  * @param int $famid family identificator to restrict search
101  * @return array array of document array
102  */
103  function getContent($controlview = true, $filter = array() , $famid = "")
104  {
105  if ($controlview) $uid = 1;
106  return $this->getDocList(0, "ALL", $uid);
107  }
108  /**
109  * return number of item in this searches
110  * @return int -1 if errors
111  */
112  function count()
113  {
114  $t = $this->getContent();
115  if (is_array($t)) return count($t);
116  return -1;
117  }
118  /**
119  * @begin-method-ignore
120  * this part will be deleted when construct document class until end-method-ignore
121  */
122 }
123 /*
124  * @end-method-ignore
125 */
126 ?>
← centre documentaire © anakeen - published under CC License - Dynacase