42 include_once (
'Class.QueryDb.php');
43 include_once (
'Class.TableLayout.php');
44 include_once (
'Class.SubForm.php');
64 <form name="fulltext" method="post"
65 action="javascript:set_form_par(\'query\',\'fulltext\',self.document.fulltext.text.value,0);set_form_par(\'query\',\'start\',0,0);set_form_par(\'query\',\'all\',\'\',1);"
66 onreset="javascript:set_form_par(\'query\',\'fulltext\',\'\',0);set_form_par(\'query\',\'start\',0,0);set_form_par(\'query\',\'all\',\'\',1);">
67 <input name="text" type="text" value="%s" size="10">
76 $this->log =
new Log(
"",
"QueryGen",
"$class");
86 if ($this->action_name !=
$action->name) {
90 $this->action->Set($this->action_name,
$app);
93 $this->
Init(
"order_by", $this->query->basic_elem->order_by);
94 $this->
Init(
"desc",
"down");
95 $this->
Init(
"start", 0);
96 $this->
Init(
"slice", 10);
97 $this->
Init(
"fulltext",
"");
98 $this->
Init(
"freedata",
"");
99 $this->fulltextfields = $this->query->basic_elem->fulltextfields;
102 while ($i < $this->
slice) {
103 $this->
Init(
"criteria",
"", $i);
104 if (($this->criteria ==
"") || ($this->criteria[$i] ==
""))
break;
107 $this->
Init(
"operator",
"", $i);
108 $this->
Init(
"value",
"", $i);
109 $this->
Init(
"connector",
"", $i);
110 $this->
Init(
"level",
"", $i);
114 $this->baseurl =
$action->GetParam(
"CORE_BASEURL");
115 $this->action->lay->set(
"QUERY_FORM", $this->
GenMainForm(
"query", 0, 0, $this->baseurl .
"app=CORE&action=SETACTPAR&sole=Y"));
117 $this->action->parent->AddJsRef(
$action->GetParam(
"CORE_JSURL") .
"/query_paging.js");
119 $this->table =
new TableLayout($this->action->lay);
126 $this->table->lay->set(
"FULLTEXTFORM", sprintf($this->fulltextform, $text));
131 $this->form =
new SubForm(
$name, $height, $width, $mainurl, $suburl);
133 $this->form->SetParam(
"key",
"");
134 $this->form->SetParam(
"start", $this->
start);
135 $this->form->SetParam(
"slice", $this->
slice);
136 $this->form->SetParam(
"order_by", $this->
order_by);
137 $this->form->SetParam(
"desc", $this->desc);
138 $this->form->SetParam(
"fulltext", $this->fulltext);
139 $this->form->SetParam(
"sapp", $this->action->parent->name);
140 $this->form->SetParam(
"sact", $this->action->name);
141 $this->form->SetParam(
"freedata", $this->freedata);
144 while ($i < $this->
slice) {
145 if (!isset($this->criteria[$i]) || $this->criteria[$i] ==
"")
break;
148 $this->form->SetParam(
"criteria_$i", $this->criteria[$i]);
149 $this->form->SetParam(
"operator_$i", $this->
operator[$i]);
150 $this->form->SetParam(
"value_$i", $this->value[$i]);
151 $this->form->SetParam(
"connector_$i", $this->connector[$i]);
152 $this->form->SetParam(
"level_$i", $this->level[$i]);
155 return ($this->form->GetMainForm());
164 $this->table->array = $this->query->Query($this->
start, $this->
slice,
$type);
165 $this->table->nb_tot = $this->query->count();
166 if ($this->table->nb_tot == 0) {
167 $this->table->array = array();
170 $this->table->page_link =
"javascript:set_form_par('query','start','%s',1);";
171 $this->table->sort_link =
"javascript:set_form_par('query','order_by','%s',0);set_form_par('query','desc','%s',0);set_form_par('query','start','%s',0);set_form_par('query','all','',1);";
175 $this->table->prev = $this->action->GetIcon(
"prev.png",
"prev", 16);
176 $this->table->next = $this->action->GetIcon(
"next.png",
"next", 16);
177 $this->table->first = $this->action->GetIcon(
"first.png",
"first", 16);
178 $this->table->last = $this->action->GetIcon(
"last.png",
"last", 16);
179 $this->up = $this->action->GetIcon(
"up.png",
"up");
180 $this->down = $this->action->GetIcon(
"down.png",
"down");
183 $this->table->fields[] =
"CLASS";
184 reset($this->table->array);
185 while (list($k, $v) = each($this->table->array)) {
186 $this->table->array[$k][
"CLASS"] = ($k % 2) ?
"TABOdd" :
"";
189 reset($this->table->array);
190 if (($this->
order_by !=
"") && ($this->desc !=
"")) {
192 if (is_array($this->table->headsortfields)) {
193 reset($this->table->headsortfields);
194 while (list($k, $v) = each($this->table->headsortfields)) {
196 $this->table->headcontent[$k].= $this->$desc;
205 if (($this->fulltext !=
"") && (
sizeof($this->fulltextfields) > 0)) {
206 reset($this->fulltextfields);
208 while (list($k, $v) = each($this->fulltextfields)) {
209 $sql.=
" upper($v) like '%" . strtoupper($this->fulltext) .
"%' OR";
216 function Init($key, $defval, $ind =
"")
220 $this->$key =
GetHttpVars(
"$key", $this->action->ActRead($key, $defval));
221 $this->action->ActRegister(
"$key", $this->$key);
223 $this->$key[$ind] =
GetHttpVars(
"$key_$ind", $this->action->ActRead(
"$key_$ind", $defval));
224 $this->action->ActRegister(
"$key_$ind", $this->$key[$ind]);
230 $this->query->AddQuery($contraint);