10 require_once
"FDL/Class.Doc.php";
32 "dynlabel" =>
"{left} include {right}", # _(
"{left} include {right}")
34 "file" =>
"filename or type include", #_(
"filename or type include")
35 "image" =>
"filename or type include",
36 "array" =>
"one value include"
37 ) , #_(
"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}"
42 ) , #_(
"one value of {left} include {right}")
55 "label" =>
"title include",
60 "dynlabel" =>
"{left} title include {right}", # _(
"{left} last or first name include {right}")
62 "uid" =>
"last or first name include"
63 ) , #_(
"title include") _(
"last or first name include")
65 "uid" =>
"{left} last or first name include {right}"
66 ) , #_(
"{left} title include {right}")
73 "label" =>
"content file word",
78 "dynlabel" =>
"file {left} contain the word {right}", # _(
"file {left} contain the word {right}")
84 "label" =>
"content file expression",
89 "dynlabel" =>
"file {left} contain the expression {right}", # _(
"file {left} contain the expression {right}")
100 "dynlabel" =>
"{left} equal {right}", # _(
"{left} equal {right}")
102 "docid" =>
"identificator equal",
103 "uid" =>
"system identifiant equal"
104 ) , #_(
"identificator equal") _(
"system identifiant equal")
105 "sdynlabel" => array(
106 "docid" =>
"{left} identificator equal {right}",
107 "uid" =>
"{left} system identificator equal {right}"
108 ) , #_(
"{left} identificator equal {right}") _(
"{left} system identificator equal {right}")
125 "label" =>
"begin by",
130 "dynlabel" =>
"{left} begin by {right}", # _(
"{left} begin by {right}")
137 "label" =>
"not equal",
142 "dynlabel" =>
"{left} is not equal {right}", # _(
"{left} is not equal {right}")
143 "sdynlabel" => array(
144 "docid" =>
"{left} identificator not equal {right}",
145 "uid" =>
"{left} system identificator not equal {right}"
146 ) , #_(
"{left} identificator not equal {right}") _(
"{left} system identificator not equal {right}")
148 "docid" =>
"identificator not equal",
149 "uid" =>
"system identificator not equal"
150 ) , #_(
"identificator not equal") _(
"system identificator not equal")
167 "label" =>
"not include",
172 "dynlabel" =>
"{left} not include {right}", # _(
"{left} not include {right}")
174 "file" =>
"filename or type not include",
175 "fulltext" =>
"any value include", #_(
"any value include")
176 "image" =>
"filename or type not include", #_(
"filename or type not include")
177 "array" =>
"no value include"
178 ) , #_(
"no value include")
179 "sdynlabel" => array(
180 "file" =>
"{left} filename or type not include {right}",
181 "fulltext" =>
"any values include {right}", #_(
"any values include {right}")
182 "image" =>
"{left} filename or type not include {right}", #_(
"{left} filename or type not include {right}")
183 "array" =>
"{left} include no value of {right}"
184 ) , #_(
"{left} include no value of {right}")
202 "dynlabel" =>
"{left} greater than {right}", # _(
"{left} greater than {right}")
219 "dynlabel" =>
"{left} lesser than {right}", # _(
"{left} lesser than {right}")
231 "label" =>
"> or equal",
236 "dynlabel" =>
"{left} greater or equal to {right}", # _(
"{left} greater or equal to {right}")
248 "label" =>
"< or equal",
253 "dynlabel" =>
"{left} lesser or equal to {right}", # _(
"{left} lesser or equal to {right}")
265 "label" =>
"is empty",
269 "dynlabel" =>
"{left} is null"
270 ) , # _(
"{left} is null"),
271 "is not null" => array(
272 "label" =>
"is not empty",
276 "dynlabel" =>
"{left} is not empty"
277 ) , # _(
"{left} is not empty"),
279 "label" =>
"between", #_(
"between")
285 "dynlabel" =>
"{left} is between {min} and {max}", # _(
"{left} is between {min} and {max}")
297 "label" =>
"one word equal",
302 "dynlabel" =>
"{left} one value equal {right}", # _(
"{left} one value equal {right}")
318 $op = $this->top[$operator];
319 if (!$op)
return _(
"unknow operator") .
" : $operator";
320 if ($attributeType) {
321 if (is_array($op[
"slabel"])) {
327 if ($op[
"label"])
return _($op[
"label"]);
356 if (preg_match(
'/([\w:]*)\s?(strict)?/', trim($of->family) , $reg)) {
357 if (!is_numeric($reg[1])) $reg[1] =
getFamIdFromName($this->dbaccess, $reg[1]);
358 if ($reg[2] ==
"strict")
$famid =
'-' . $reg[1];
367 $xfilter = simplexml_load_string(
$filter);
368 $famid = trim($xfilter->family);
373 if ($of->sql) $of->sql = trim($of->sql);
375 if ((!strstr($of->sql,
'--')) && (!strstr($of->sql,
';')) && (!stristr($of->sql,
'insert')) && (!stristr($of->sql,
'alter')) && (!stristr($of->sql,
'delete')) && (!stristr($of->sql,
'update'))) {
380 if ($of->criteria && (!is_array($of->criteria))) {
381 if ($of->criteria->operator) $of->criteria = array(
384 if ($of->criteria->or) $of->criteria = array(
387 if ($of->criteria->and) $of->criteria = array(
391 if ($of->criteria && is_array($of->criteria)) {
392 foreach ($of->criteria as
$c) {
395 $err.= $this->_1object2SqlFilter($c, $sqlone,
$famid);
397 } elseif ($c->or && is_array($c->or)) {
399 foreach ($c->or as $cor) {
400 if ($cor->operator)
$err.= $this->_1object2SqlFilter($cor, $sqlone,
$famid);
402 $oone =
new stdClass();
403 $oone->criteria = $cor;
408 if (
$err ==
"") $sqlor[] = $sqlone;
410 if (count($sqlor) > 0) {
411 $sql[] =
'(' . implode(
') or (', $sqlor) .
')';
413 } elseif ($c->and && is_array($c->and)) {
415 foreach ($c->and as $cor) {
416 if ($cor->operator)
$err.= $this->_1object2SqlFilter($cor, $sqlone,
$famid);
418 $oone =
new stdClass();
419 $oone->criteria = $cor;
423 if (
$err ==
"") $sqlor[] = $sqlone;
425 if (count($sqlor) > 0) {
426 $sql[] =
'(' . implode(
') and (', $sqlor) .
')';
431 if (count(
$sql) > 0) {
432 $fsql =
'(' . implode(
') and (',
$sql) .
')';
447 private function _1object2SqlFilter(
$c, &
$sql,
$famid =
"")
452 $top = $this->top[
$c->operator];
454 $toperand =
$top[
"operand"];
455 $first = $toperand[0];
456 $second = $toperand[1];
457 $third = $toperand[2];
465 if (strtolower(substr($val1, 0, 5)) ==
"::get") {
467 $val1 = $this->ApplyMethod($val1);
476 if (strtolower(substr($val2, 0, 5)) ==
"::get") {
478 $val2 = $this->ApplyMethod($val2);
484 $sw->setValue(
"se_famid",
$famid);
485 $sql = $sw->getSqlCond($col,
$c->operator, $val1, $val2,
$err);
487 $err = sprintf(_(
"operator [%s] not allowed") ,
$c->operator);
490 $err = sprintf(_(
"no operator detected"));
520 $s->useCollection($this->initid);
521 $s->setObjectReturn();
522 $s->excludeConfidential();
523 return $s->search()->getDocumentList();