/[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.3 by ravilov, Fri Oct 5 15:10:53 2001 UTC revision 1.4 by ravilov, Sat Oct 27 16:54:50 2001 UTC
# Line 1  Line 1 
1  <?php  <?php
         function my_cmp2($a, $b) { return MyCompare($a["title"], $b["title"]); }  
2          include("inc/conn.php");          include("inc/conn.php");
3          $sql = "SELECT MAX(level) FROM specijalizacije";          if ($section == "knjiznica") {
4          $sth = $dbh->prepare($sql);                  $menu4 = array(
5          if (!$sth) error("Cannot prepare query: \"$sql\"");                          array("name" => "Liječnički vjesnik", "secmenu" => "vjesnik"),
6          if (!$sth->execute()) error("Cannot execute query: \"$sql\"");                          array("name" => "Infektološki glasnik", "secmenu" => "inf_glasnik"),
7          $levels = array_shift($sth->fetchrow_array());                          array("name" => "MEDICUS", "secmenu" => "medicus"),
8          $sth->finish();                          array("name" => "MedInfo", "secmenu" => "medinfo"),
9          if (!$levels) $levels = 1;                          array("name" => "Vodič za hospitalne infekcije", "secmenu" => "vodic")
10          $menu3 = array();                  );
11          for ($i = 0; $i < $levels; $i++) {                  $tpl->assign("MENU4", $menu4);
12                  $sql = "SELECT spec_id, opis, level FROM specijalizacije WHERE (spec_id != 0) AND (NOT link) AND (level = ".($i + 1).")";          } else if ($spec) {
13                    $sql = "SELECT opis FROM specijalizacije WHERE (spec_id = $spec)";
14                  $sth = $dbh->prepare($sql);                  $sth = $dbh->prepare($sql);
15                  if (!$sth) error("Cannot prepare query: \"$sql\"");                  if (!$sth) error("Cannot prepare query: \"$sql\"");
16                  if (!$sth->execute()) error("Cannot execute query: \"$sql\"");                  if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
17                  $tmp = array();                  $row = $sth->fetchrow_array();
18                  while ($row = $sth->fetchrow_array()) {                  $sth->finish();
19                          list($id2, $txt) = $row;                  if ($row) $row = array_shift($row);
20                          array_push($tmp, array("id" => $id2, "title" => MyEscape($txt)));                  $tpl->assign("MENU4_title", $row);
21                  }                  $menu4 = array(
22                            array("name" => "HOME", "sec" => "home"),
23                            array("name" => "Arhiva vijesti i članaka", "sec" => "arhiva"),
24                            array("name" => "Kalendar događanja", "sec" => "kalendar"),
25                            array("name" => "Linkovi", "sec" => "linkovi")
26                    );
27                    $tpl->assign("MENU4", $menu4);
28            } else {
29                    function my_cmp2($a, $b) { return MyCompare($a["title"], $b["title"]); }
30                    $sql = "SELECT MAX(level) FROM specijalizacije";
31                    $sth = $dbh->prepare($sql);
32                    if (!$sth) error("Cannot prepare query: \"$sql\"");
33                    if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
34                    $levels = array_shift($sth->fetchrow_array());
35                  $sth->finish();                  $sth->finish();
36                  usort($tmp, "my_cmp2");                  if (!$levels) $levels = 1;
37                  array_push($menu3, $tmp);                  $menu3 = array();
38                    for ($i = 0; $i < $levels; $i++) {
39                            $sql = "SELECT spec_id, opis, level FROM specijalizacije WHERE (spec_id != 0) AND (NOT link) AND (level = ".($i + 1).")";
40                            $sth = $dbh->prepare($sql);
41                            if (!$sth) error("Cannot prepare query: \"$sql\"");
42                            if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
43                            $tmp = array();
44                            while ($row = $sth->fetchrow_array()) {
45                                    list($id2, $txt) = $row;
46                                    array_push($tmp, array("id" => $id2, "title" => MyEscape($txt)));
47                            }
48                            $sth->finish();
49                            usort($tmp, "my_cmp2");
50                            array_push($menu3, $tmp);
51                    }
52                    $MENU3_section = ($section == "home" || $section == "arhiva" || $section == "linkovi" || $section == "kalendar") ? $section : "home";
53                    $tpl->assign("MENU3_section", $MENU3_section);
54                    $tpl->assign("MENU3", $menu3);
55          }          }
         $MENU3_section = ($section == "home" || $section == "arhiva" || $section == "linkovi" || $section == "kalendar") ? $section : "home";  
         $tpl->assign("MENU3_section", $MENU3_section);  
         $tpl->assign("MENU3", $menu3);  
56  ?>  ?>

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

  ViewVC Help
Powered by ViewVC 1.1.26