/[health_html]/inc/search.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /inc/search.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by ravilov, Wed Aug 22 11:43:59 2001 UTC revision 1.3 by ravilov, Mon Aug 27 09:17:40 2001 UTC
# Line 1  Line 1 
1  <?php  <?php
2          $basic_logic = "OR";          $basic_logic = "AND";
3          function myCmp($a, $b) {          function myCmp($a, $b) {
4                  if ($a["caption"] == $b["caption"]) return 0;                  if ($a["caption"] == $b["caption"]) return 0;
5                  return ($a["caption"] < $b["caption"]) ? -1 : 1;                  return ($a["caption"] < $b["caption"]) ? -1 : 1;
6          }          }
7          function Search($fields, $q1_fields, $q2_fields) {          function Search($fields, $q1_fields, $q2_fields) {
8                    global $go;
9                  $tp = new Smarty();                  $tp = new Smarty();
10                  $qry_1 = "";                  $qry_1 = "";
11                  $qry_2 = "";                  $qry_2 = "";
# Line 20  Line 21 
21                                          ${"field_".$i}, ${"not_".$i},                                          ${"field_".$i}, ${"not_".$i},
22                                          ${"query_".$i}, ${"logic_".$i},                                          ${"query_".$i}, ${"logic_".$i},
23                                          ${"concat_".$i}, ${"case_".$i};                                          ${"concat_".$i}, ${"case_".$i};
24                                  if (${"delete_".$i}) { $i++; continue; }                                  if (${"delete_".$i}) { $go = false; $i++; continue; }
25                                  if (${"and_".$i}) ${"logic_".$i} = "AND";                                  if (${"and_".$i}) { $go = false; ${"logic_".$i} = "AND"; }
26                                  if (${"or_".$i}) ${"logic_".$i} = "OR";                                  if (${"or_".$i}) { $go = false; ${"logic_".$i} = "OR"; }
27                                  array_push($search, array(                                  array_push($search, array(
28                                          "field" => ${"field_".$i},                                          "field" => ${"field_".$i},
29                                          "not" => ${"not_".$i},                                          "not" => ${"not_".$i},
# Line 35  Line 36 
36                          }                          }
37                          global ${"and_".($i - 1)}, ${"or_".($i - 1)};                          global ${"and_".($i - 1)}, ${"or_".($i - 1)};
38                          if (count($search) == 0 || ${"and_".($i - 1)} || ${"or_".($i - 1)}) {                          if (count($search) == 0 || ${"and_".($i - 1)} || ${"or_".($i - 1)}) {
39                                    $go = false;
40                                  $log = "";                                  $log = "";
41                                  if (${"and_".($i - 1)}) $log = "AND";                                  if (${"and_".($i - 1)}) $log = "AND";
42                                  if (${"or_".($i - 1)}) $log = "OR";                                  if (${"or_".($i - 1)}) $log = "OR";
# Line 57  Line 59 
59                  }                  }
60                  if (!$stype) $stype = 0;                  if (!$stype) $stype = 0;
61                  $tp->assign("stype", $stype);                  $tp->assign("stype", $stype);
                 global $go;  
62                  if ($go) {                  if ($go) {
63                          if ($stype) {                          if ($stype) {
64                                  $qry = "";                                  $qry = "";
# Line 114  Line 115 
115                                          if ($is_q1) $q2[$k] = $qq;                                          if ($is_q1) $q2[$k] = $qq;
116                                          if ($is_q2) $q3[$k] = $qq;                                          if ($is_q2) $q3[$k] = $qq;
117                                  }                                  }
118                                    global $basic_logic;
119                                  $qry_1 = implode(" ".$basic_logic." ", $q2);                                  $qry_1 = implode(" ".$basic_logic." ", $q2);
120                                  $qry_2 = implode(" ".$basic_logic." ", $q3);                                  $qry_2 = implode(" ".$basic_logic." ", $q3);
121                          }                          }
# Line 130  Line 132 
132                  global $PHP_SELF, $section, $section_menu;                  global $PHP_SELF, $section, $section_menu;
133                  $tp->assign("section", $section);                  $tp->assign("section", $section);
134                  $tp->assign("section_menu", $section_menu);                  $tp->assign("section_menu", $section_menu);
135                  $tp->assign("FORM_ACTION", $PHP_SELF.HTMLSpecialChars("?section=$section&stype=$stype"));                  $tp->assign("FORM_ACTION", $PHP_SELF.HTMLSpecialChars("?section=$section&section_menu={$section_menu}&stype=$stype"));
136                  $form = $tp->fetch("search.tpl");                  $form = $tp->fetch("search.tpl");
137                  return array($form, $qry_1, $qry_2);                  return array($form, $qry_1, $qry_2);
138          }          }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.26