Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.SpecialSearch.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Special search
8  */
9 
10 namespace Dcp\Core;
12 {
13 
14  var $defaultedit = "FDL:EDITBODYCARD";
15  var $defaultview = "FDL:VIEWBODYCARD";
16  /**
17  * return sql query to search wanted document
18  */
19  function ComputeQuery($keyword = "", $famid = - 1, $latest = "yes", $sensitive = false, $dirid = - 1, $subfolder = true, $full = false)
20  {
21 
22  return true;
23  }
24 
25  function getDocList($start = 0, $slice = "ALL", $qtype = "TABLE", $userid = "")
26  {
27  $phpfile = $this->getRawValue("se_phpfile");
28  $phpfunc = $this->getRawValue("se_phpfunc");
29  $phparg = $this->getRawValue("se_phparg");
30  if (!include_once ("EXTERNALS/$phpfile")) {
31  global $action;
32  $action->AddWarningMsg(sprintf(_("php file %s needed for request not found") , "EXTERNALS/$phpfunc"));
33  return false;
34  }
35  if (!$userid) $userid = $this->getSystemUserId();
36  $arg = array(
37  $start,
38  $slice,
39  $userid
40  );
41  if ($phparg != "") {
42  $moreargs = explode(",", $phparg);
43  foreach ($moreargs as $k => $v) {
44  $v = trim($v);
45  if ($v) {
46  if (($v[0] == "%") && (substr($v, -1) == "%")) {
47  $aid = substr($v, 1, -1);
48  if ($aid == "THIS") $moreargs[$k] = & $this;
49  else {
50  $val = $this->getRawValue($aid);
51  if (!$val) $val = $this->getPropertyValue($aid);
52  $moreargs[$k] = $val;
53  }
54  }
55  }
56  }
57  $arg = array_merge($arg, $moreargs);
58  }
59  $res = call_user_func_array($phpfunc, $arg);
60 
61  return ($res);
62  }
63  /**
64  * return true if the search has parameters
65  */
66  function isParameterizable()
67  {
68  return false;
69  }
70  /**
71  * return true if the search need parameters
72  */
73  function needParameters()
74  {
75  return false;
76  }
77 
78  function isStaticSql()
79  {
80  return true;
81  }
82  /**
83  * return document includes in search folder
84  * @param bool $controlview if false all document are returned else only visible for current user document are return
85  * @param array $filter to add list sql filter for selected document
86  * @param int $famid family identifier to restrict search
87  * @return array array of document array
88  */
89 
90  public function getContent($controlview = true, array $filter = array() , $famid = "", $unusedType = "TABLE", $unusedTrash = "")
91  {
92  $uid = 0;
93  if ($controlview) $uid = 1;
94  return $this->getDocList(0, "ALL", $uid);
95  }
96  /**
97  * return number of item in this searches
98  * @return int -1 if errors
99  */
100  function count()
101  {
102  $t = $this->getContent();
103  if (is_array($t)) return count($t);
104  return -1;
105  }
106 }
global $action
getPropertyValue($prop)
Definition: Class.Doc.php:2114
$full
static getSystemUserId()
Definition: Class.Doc.php:8981
$sensitive
ComputeQuery($keyword="", $famid=-1, $latest="yes", $sensitive=false, $dirid=-1, $subfolder=true, $full=false)
getDocList($start=0, $slice="ALL", $qtype="TABLE", $userid="")
$keyword
getContent($controlview=true, array $filter=array(), $famid="", $unusedType="TABLE", $unusedTrash="")
getRawValue($idAttr, $def="")
Definition: Class.Doc.php:3117
$latest
← centre documentaire © anakeen