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

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

  ViewVC Help
Powered by ViewVC 1.1.26