/[hr-web]/Nagrade.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

Contents of /Nagrade.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Tue Jul 23 13:08:57 2002 UTC (16 years, 11 months ago) by ravilov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +4 -4 lines
mali ispravci

1 <?php
2 include("inc/global.php");
3 if (!Auth()) exit;
4 $page = CalcPage($PHP_SELF);
5 $p = $page;
6 if (isparam("wb_p")) $p--;
7 if (isparam("wb_OK")) $p++;
8 if (isparam("wb_h")) $p = $PG_HOME;
9 if (isparam("wb_o")) $p = $PG_OVERVIEW;
10 if (isparam("wb_U")) $p = 200;
11 include("inc/conn.php");
12 DBOpen();
13 $del = 0;
14 reset($HTTP_GET_VARS);
15 while ($var = key($HTTP_GET_VARS)) {
16 next($HTTP_GET_VARS);
17 if (!eregi('^del_([0-9]+)$', $var, $match)) continue;
18 $del = $match[1];
19 }
20 reset($HTTP_POST_VARS);
21 while ($var = key($HTTP_POST_VARS)) {
22 next($HTTP_POST_VARS);
23 if (!eregi('^del_([0-9]+)$', $var, $match)) continue;
24 $del = $match[1];
25 }
26 if ($del) {
27 DBQuery("DELETE FROM nagrade WHERE (id=$del) AND (sif_radnika='$sifra')");
28 if (!$DBH->errstr && $edit == $del) unset($edit);
29 }
30 YearFix($godina);
31 $warning = 0;
32 if ($update || $p != $page) {
33 if ($naziv || $ustanova || $urucitelj || $godina) {
34 if (!$warning) {
35 $naziv = ISO_Win($naziv);
36 $urucitelj = ISO_Win($urucitelj);
37 if ($edit) DBQuery("UPDATE nagrade SET naziv='$naziv',sif_ustanove=$ustanova,urucitelj='$urucitelj',godina='$godina' WHERE (id=$edit) AND (sif_radnika='$sifra')");
38 else DBQuery("INSERT INTO nagrade (sif_radnika,naziv,sif_ustanove,urucitelj,godina) VALUES ('$sifra','$naziv',$ustanova,'$urucitelj','$godina')");
39 }
40 } else if ($edit)
41 DBQuery("DELETE FROM nagrade WHERE (id=$edit) AND (sif_radnika='$sifra')");
42 if ($p != $page && !$warning && !$DBH->errstr) {
43 DBClose();
44 Header("Location: $pages[$p]".Params($p));
45 exit;
46 }
47 }
48 if (($new || $update) && !$warning && !$DBH->errstr)
49 unset($edit, $naziv, $ustanova, $urucitelj, $godina);
50 include("inc/util.php");
51 $rows = DBQuery("SELECT sifra,naziv,grad FROM ustanove WHERE (language='$language') AND (NOT obrazovna)");
52 $ustanove = array();
53 for ($i = 0; $i < count($rows); $i++) {
54 list($sif, $naz, $grad) = $rows[$i];
55 if ($grad) $naz = "$naz, $grad";
56 array_push($ustanove, array("id" => $sif,
57 "name" => HTML_Escape(Win_ISO($naz))));
58 }
59 usort($ustanove, "sort_name");
60 $rows = DBQuery("SELECT id,naziv,sif_ustanove,urucitelj,godina FROM nagrade WHERE (sif_radnika='$sifra') ORDER BY godina");
61 $vars = array();
62 $fnd = false;
63 for ($i = 0; $i < count($rows); $i++) {
64 list($id, $naz, $ust, $ur, $god) = $rows[$i];
65 $naz = HTML_Escape(Win_ISO($naz));
66 $ur = HTML_Escape(Win_ISO($ur));
67 $ust2 = "";
68 for ($j = 0; $j < count($ustanove); $j++) {
69 if ($ustanove[$j]["id"] == $ust) {
70 $ust2 = $ustanove[$j]["name"];
71 break;
72 }
73 }
74 nepoznato($ust2);
75 $god2 = $god;
76 if (!$god2) $god2 = "-";
77 $naz2 = nl2br($naz);
78 $ur2 = nl2br($ur);
79 nepoznato($naz2);
80 nepoznato($ur2);
81 array_push($vars, array(
82 "id" => $id,
83 "link" => $PHP_SELF.Params($page, array("edit" => $id)),
84 "naziv" => $naz2,
85 "ustanova" => $ust2,
86 "urucitelj" => $ur2,
87 "godina" => $god2
88 ));
89 if ($edit && $edit == $id) {
90 if (!$warning && !$DBH->errstr) {
91 $naziv = $naz;
92 $ustanova = $ust;
93 $urucitelj = $ur;
94 $godina = $god;
95 }
96 $fnd = true;
97 }
98 }
99 if (!$fnd) unset($edit);
100 DBClose();
101 $tpl = new MySmarty($page, $edit ? array("edit" => $edit) : array());
102 $tpl->assign("vars", $vars);
103 $tpl->assign("edit", $edit);
104 $tpl->assign("ustanove", $ustanove);
105 $tpl->assign("naziv", $naziv);
106 $tpl->assign("ustanova", $ustanova);
107 $tpl->assign("urucitelj", $urucitelj);
108 $tpl->assign("godina", $godina);
109 $tpl->assign("warning", $warning);
110 $tpl->show("$pg-$language.tpl");
111 ?>

  ViewVC Help
Powered by ViewVC 1.1.26