9 require_once
"FDL/Class.Doc.php";
31 "dynlabel" =>
"{left} include {right}", # _(
"{left} include {right}")
33 "file" =>
"filename or type include", #_(
"filename or type include")
34 "image" =>
"filename or type include",
35 "array" =>
"one value include", #_(
"one value include")
39 "file" =>
"{left} filename or type include {right}", #_(
"{left} filename or type include {right}")
40 "image" =>
"{left} filename or type include {right}",
41 "array" =>
"one value of {left} include {right}", #_(
"one value of {left} include {right}")
56 "label" =>
"title include",
61 "dynlabel" =>
"{left} title include {right}", # _(
"{left} last or first name include {right}")
63 "uid" =>
"last or first name include",
64 "docidtitle[]" =>
"one of the titles include"
65 ) , #_(
"title include") _(
"last or first name include") _(
"one of the titles include")
67 "uid" =>
"{left} last or first name include {right}",
68 "docidtitle[]" =>
"one of the titles {left} include {right}"
69 ) , #_(
"{left} title include {right}") _(
"one of the titles {left} include {right}")
78 "label" =>
"content file word",
83 "dynlabel" =>
"file {left} contain the word {right}", # _(
"file {left} contain the word {right}")
89 "label" =>
"content file expression",
94 "dynlabel" =>
"file {left} contain the expression {right}", # _(
"file {left} contain the expression {right}")
105 "dynlabel" =>
"{left} equal {right}", # _(
"{left} equal {right}")
107 "docid" =>
"identificator equal",
108 "account" =>
"identificator equal",
109 "uid" =>
"system identifiant equal"
110 ) , #_(
"identificator equal") _(
"system identifiant equal")
111 "sdynlabel" => array(
112 "docid" =>
"{left} identifier equal {right}",
113 "account" =>
"{left} identifier equal {right}",
114 "uid" =>
"{left} system identifier equal {right}"
115 ) , #_(
"{left} identifier equal {right}") _(
"{left} system identifier equal {right}")
133 "label" =>
"begin by",
138 "dynlabel" =>
"{left} begin by {right}", # _(
"{left} begin by {right}")
145 "label" =>
"not equal",
150 "dynlabel" =>
"{left} is not equal {right}", # _(
"{left} is not equal {right}")
151 "sdynlabel" => array(
152 "docid" =>
"{left} identifier not equal {right}",
153 "account" =>
"{left} identifier not equal {right}",
154 "uid" =>
"{left} system identifier not equal {right}"
155 ) , #_(
"{left} identifier not equal {right}") _(
"{left} system identifier not equal {right}")
157 "docid" =>
"identificator not equal",
158 "account" =>
"identificator not equal",
159 "uid" =>
"system identifier not equal"
160 ) , #_(
"identificator not equal") _(
"system identifier not equal")
178 "label" =>
"not include",
183 "dynlabel" =>
"{left} not include {right}", # _(
"{left} not include {right}")
185 "file" =>
"filename or type not include",
186 "fulltext" =>
"any value include", #_(
"any value include")
187 "image" =>
"filename or type not include", #_(
"filename or type not include")
188 "array" =>
"no value include", #_(
"no value include")
191 "sdynlabel" => array(
192 "file" =>
"{left} filename or type not include {right}",
193 "fulltext" =>
"any values include {right}", #_(
"any values include {right}")
194 "image" =>
"{left} filename or type not include {right}", #_(
"{left} filename or type not include {right}")
195 "array" =>
"{left} include no value of {right}"
196 ) , #_(
"{left} include no value of {right}")
214 "dynlabel" =>
"{left} greater than {right}", # _(
"{left} greater than {right}")
231 "dynlabel" =>
"{left} lesser than {right}", # _(
"{left} lesser than {right}")
243 "label" =>
"> or equal",
248 "dynlabel" =>
"{left} greater or equal to {right}", # _(
"{left} greater or equal to {right}")
260 "label" =>
"< or equal",
265 "dynlabel" =>
"{left} lesser or equal to {right}", # _(
"{left} lesser or equal to {right}")
277 "label" =>
"is empty",
281 "dynlabel" =>
"{left} is null"
282 ) , # _(
"{left} is null"),
283 "is not null" => array(
284 "label" =>
"is not empty",
288 "dynlabel" =>
"{left} is not empty"
289 ) , # _(
"{left} is not empty"),
291 "label" =>
"between", #_(
"between")
297 "dynlabel" =>
"{left} is between {min} and {max}", # _(
"{left} is between {min} and {max}")
309 "label" =>
"one value equal", #(
"one value equal")
314 "dynlabel" =>
"{left} one value equal {right}", # _(
"{left} one value equal {right}")
316 "docid[]" =>
"one id equal", # _(
"one id equal")
317 "account[]" =>
"one id equal"
319 "sdynlabel" => array(
320 "docid[]" =>
"{left} one id equal {right}", #_(
"{left} one id equal {right}")
321 "account[]" =>
"{left} one id equal {right}"
340 $op = $this->top[$operator];
341 if (!$op)
return _(
"unknow operator") .
" : $operator";
342 if ($attributeType) {
343 if (isset($op[
"slabel"]) && is_array($op[
"slabel"])) {
344 foreach ($op[
"slabel"] as
$type => $label) {
345 if (
$type == $attributeType)
return _($label);
349 if ($op[
"label"])
return _($op[
"label"]);
377 if (!empty($of->family)) {
378 if (preg_match(
'/([\w:]*)\s?(strict)?/', trim($of->family) , $reg)) {
379 if (!is_numeric($reg[1])) $reg[1] =
getFamIdFromName($this->dbaccess, $reg[1]);
380 if (isset($reg[2]) && ($reg[2] ==
"strict"))
$famid =
'-' . $reg[1];
389 $xfilter = simplexml_load_string(
$filter);
390 $famid = trim($xfilter->family);
395 if (!empty($of->sql)) $of->sql = trim($of->sql);
396 if (!empty($of->sql)) {
397 if ((!strstr($of->sql,
'--')) && (!strstr($of->sql,
';')) && (!stristr($of->sql,
'insert')) && (!stristr($of->sql,
'alter')) && (!stristr($of->sql,
'delete')) && (!stristr($of->sql,
'update'))) {
402 if ((!empty($of->criteria)) && (!is_array($of->criteria))) {
403 if ($of->criteria->operator) $of->criteria = array(
406 if ($of->criteria->or) $of->criteria = array(
409 if ($of->criteria->and) $of->criteria = array(
414 if ((!empty($of->criteria)) && is_array($of->criteria)) {
415 foreach ($of->criteria as
$c) {
417 if (!empty($c->operator)) {
418 $err.= $this->_1object2SqlFilter($c, $sqlone,
$famid);
420 } elseif ($c->or && is_array($c->or)) {
422 foreach ($c->or as $cor) {
423 if ($cor->operator)
$err.= $this->_1object2SqlFilter($cor, $sqlone,
$famid);
425 $oone =
new stdClass();
426 $oone->criteria = $cor;
431 if (
$err ==
"") $sqlor[] = $sqlone;
433 if (count($sqlor) > 0) {
434 $sql[] =
'(' . implode(
') or (', $sqlor) .
')';
436 } elseif ($c->and && is_array($c->and)) {
438 foreach ($c->and as $cor) {
439 if ($cor->operator)
$err.= $this->_1object2SqlFilter($cor, $sqlone,
$famid);
441 $oone =
new stdClass();
442 $oone->criteria = $cor;
446 if (
$err ==
"") $sqlor[] = $sqlone;
448 if (count($sqlor) > 0) {
449 $sql[] =
'(' . implode(
') and (', $sqlor) .
')';
454 if (count(
$sql) > 0) {
455 $fsql =
'(' . implode(
') and (',
$sql) .
')';
470 private function _1object2SqlFilter(
$c, &
$sql,
$famid =
"")
475 $top = $this->top[
$c->operator];
477 $toperand =
$top[
"operand"];
478 $first = $toperand[0];
479 $second = isset($toperand[1]) ? $toperand[1] : null;
480 $third = isset($toperand[2]) ? $toperand[2] : null;
483 $val1 = (isset(
$c->$second)) ?
$c->$second : null;
488 if (strtolower(substr($val1, 0, 5)) ==
"::get") {
490 $val1 = $this->ApplyMethod($val1);
499 if (strtolower(substr($val2, 0, 5)) ==
"::get") {
501 $val2 = $this->ApplyMethod($val2);
510 $sw->setValue(
"se_famid",
$famid);
511 $sql = $sw->getSqlCond($col,
$c->operator, $val1, $val2,
$err);
513 $err = sprintf(_(
"operator [%s] not allowed") ,
$c->operator);
516 $err = sprintf(_(
"no operator detected"));
546 $s->useCollection($this->initid);
547 $s->setObjectReturn();
548 $s->excludeConfidential();
549 $s->setOrder(
"fromid, title, id desc");
550 return $s->search()->getDocumentList();
getContent($controlview=true, array $filter=array(), $famid="", $qtype="TABLE", $trash="")
getOperatorLabel($operator, $attributeType)
getMultipleRawValues($idAttr, $def="", $index=-1)
getFamIdFromName($dbaccess, $name)
object2SqlFilter($of, &$famid, &$fsql)
createTmpDoc($dbaccess, $fromid, $defaultvalue=true)
if($file) if($subject==""&&$file) if($subject=="") $err
getRawValue($idAttr, $def="")
class use to search documents