/[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.5 by ravilov, Mon Sep 3 15:52:16 2001 UTC revision 1.8 by ravilov, Fri Oct 5 15:10:53 2001 UTC
# Line 1  Line 1 
1  <?php  <?php
2          $basic_logic = "AND";          $basic_logic = "AND";
         function MySort($a, $b) {  
                 return MyCompare($a["caption"], $b["caption"]);  
         }  
3          function Search($fields, $q1_fields, $q2_fields, $def_field = "") {          function Search($fields, $q1_fields, $q2_fields, $def_field = "") {
4                  global $go;                  global $go;
5                  $tp = new Smarty();                  $tp = new Smarty();
# Line 26  Line 23 
23                                  array_push($search, array(                                  array_push($search, array(
24                                          "field" => ${"field_".$i},                                          "field" => ${"field_".$i},
25                                          "not" => ${"not_".$i},                                          "not" => ${"not_".$i},
26                                          "query" => MyEscape(${"query_".$i}),                                          "query" => MyEscape(${"query_".$i}, true),
27                                          "logic" => ${"logic_".$i},                                          "logic" => ${"logic_".$i},
28                                          "concat" => ${"concat_".$i},                                          "concat" => ${"concat_".$i},
29                                          "case" => ${"case_".$i}                                          "case" => ${"case_".$i}
# Line 54  Line 51 
51                  } else {                  } else {
52                          global $field, $query;                          global $field, $query;
53                          $tp->assign("field", $field?$field:$def_field);                          $tp->assign("field", $field?$field:$def_field);
54                          $tp->assign("query", MyEscape($query));                          $tp->assign("query", MyEscape($query, true));
55                  }                  }
56                  if (!$stype) $stype = 0;                  if (!$stype) $stype = 0;
57                  $tp->assign("stype", $stype);                  $tp->assign("stype", $stype);
# Line 120  Line 117 
117                  $flds = array();                  $flds = array();
118                  while (list($k, $v) = each($fields)) {                  while (list($k, $v) = each($fields)) {
119                          array_push($flds, array(                          array_push($flds, array(
120                                  "name" => MyEscape($k),                                  "name" => MyEscape($k, true),
121                                  "caption" => MyEscape($v["caption"])                                  "caption" => MyEscape($v["caption"])
122                          ));                          ));
123                  }                  }
                 usort($flds, "MySort");  
124                  $tp->assign("fields", $flds);                  $tp->assign("fields", $flds);
125                  global $PHP_SELF, $section, $section_menu;                  global $section, $section_menu;
126                  $tp->assign("section", $section);                  $tp->assign("section", $section);
127                  $tp->assign("section_menu", $section_menu);                  $tp->assign("section_menu", $section_menu);
128                  $tp->assign("FORM_ACTION", $PHP_SELF.HTMLSpecialChars("?section=$section&section_menu={$section_menu}&stype=$stype"));                  $tp->assign("FORM_ACTION", HTMLSpecialChars("?section=$section&section_menu={$section_menu}&stype=$stype"));
129                  $form = $tp->fetch("search.tpl");                  $form = $tp->fetch("search.tpl");
130                  global $onload;                  if ($form) {
131                  $onload .= "document.forms[0].elements[".($stype?2:1)."].focus();";                          global $onload;
132                            $onload .= "document.forms[1].elements[".($stype?2:1)."].focus();";
133                    }
134                  return array($form, $qry_1, $qry_2);                  return array($form, $qry_1, $qry_2);
135          }          }
136  ?>  ?>

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.26