/[health_html]/inc/menuMED.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/menuMED.php

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

revision 1.1 by ravilov, Wed Sep 19 12:23:57 2001 UTC revision 1.2 by ravilov, Tue Sep 25 15:38:04 2001 UTC
# Line 1  Line 1 
1  <?php  <?php
2          function my_cmp2($a, $b) { return MyCompare($a["title"], $b["title"]); }          function my_cmp2($a, $b) { return MyCompare($a["title"], $b["title"]); }
3          include_once("inc/conn.php");          include("inc/conn.php");
4          $sql = "SELECT spec_id, opis FROM specijalizacije";          $sql = "SELECT MAX(level) FROM specijalizacije";
5          $sth = $dbh->prepare($sql);          $sth = $dbh->prepare($sql);
6          if (!$sth) error("Cannot prepare query: \"$sql\"");          if (!$sth) error("Cannot prepare query: \"$sql\"");
7          if (!$sth->execute()) error("Cannot execute query: \"$sql\"");          if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
8            $levels = array_shift($sth->fetchrow_array());
9            $sth->finish();
10            if (!$levels) $levels = 1;
11          $menu3 = array();          $menu3 = array();
12          while ($row = $sth->fetchrow_array()) {          for ($i = 0; $i < $levels; $i++) {
13                  list($id2, $txt) = $row;                  $sql = "SELECT spec_id, opis, level FROM specijalizacije WHERE (spec_id != 0) AND (NOT link) AND (level = ".($i + 1).")";
14                  array_push($menu3, array("id" => $id2, "title" => MyEscape($txt)));                  $sth = $dbh->prepare($sql);
15                    if (!$sth) error("Cannot prepare query: \"$sql\"");
16                    if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
17                    $tmp = array();
18                    while ($row = $sth->fetchrow_array()) {
19                            list($id2, $txt) = $row;
20                            array_push($tmp, array("id" => $id2, "title" => MyEscape($txt)));
21                    }
22                    $sth->finish();
23                    usort($tmp, "my_cmp2");
24                    array_push($menu3, $tmp);
25          }          }
         $sth->finish();  
         usort($menu3, "my_cmp2");  
26          $tpl->assign("MENU3", $menu3);          $tpl->assign("MENU3", $menu3);
         $menu = array();  
27  ?>  ?>

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

  ViewVC Help
Powered by ViewVC 1.1.26