/[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

Annotation of /Nagrade.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (vendor branch)
Fri Apr 20 08:25:32 2001 UTC (23 years ago) by dpavlin
Branch: pliva
CVS Tags: r0
Changes since 1.1: +0 -0 lines
initial import

1 dpavlin 1.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 = 0;
9     if (isparam("wb_o")) $p = 15;
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     unset($edit);
28     DBQuery("DELETE FROM nagrade WHERE (id=$del) AND (sif_radnika='$sifra')");
29     }
30     if ($godina && $godina < 1900)
31     if ($godina <= 40) $godina += 2000; else $godina += 1900;
32     $warning = 0;
33     if ($update || $p != $page) {
34     if ($naziv || $ustanova || $urucitelj || $godina) {
35     if (!$warning) {
36     $naziv = ereg_replace("\r?\n", "\n", ISO_Win($naziv));
37     $urucitelj = ereg_replace("\r?\n", "\n", ISO_Win($urucitelj));
38     if ($edit)
39     DBQuery("UPDATE nagrade SET naziv='$naziv',sif_ustanove=$ustanova,urucitelj='$urucitelj',godina='$godina' WHERE (id=$edit) AND (sif_radnika='$sifra')");
40     else {
41     $id = DBQuery("SELECT MAX(id) FROM nagrade");
42     $id = $id[0][0] + 1;
43     DBQuery("INSERT INTO nagrade (id,sif_radnika,naziv,sif_ustanove,urucitelj,godina) VALUES ($id,'$sifra','$naziv',$ustanova,'$urucitelj','$godina')");
44     }
45     }
46     } else if ($edit)
47     DBQuery("DELETE FROM nagrade WHERE (id=$edit) AND (sif_radnika='$sifra')");
48     if ($p != $page && !$warning) {
49     DBClose();
50     Header("Location: $pages[$p]".Params($p));
51     exit;
52     }
53     }
54     if (($new || $update) && !$warning)
55     unset($edit, $naziv, $ustanova, $urucitelj, $godina);
56     $rows = DBQuery("SELECT sifra,naziv,grad FROM ustanove WHERE (language='$language')");
57     $ustanove = array();
58     for ($i = 0; $i < count($rows); $i++) {
59     list($sif, $naz, $grad) = $rows[$i];
60     if ($grad) $naz = "$naz, $grad";
61     array_push($ustanove, array("id" => $sif,
62     "name" => HTML_Escape(Win_ISO($naz))));
63     }
64     $rows = DBQuery("SELECT id,naziv,sif_ustanove,urucitelj,godina FROM nagrade WHERE (sif_radnika='$sifra')");
65     $vars = array();
66     $fnd = false;
67     for ($i = 0; $i < count($rows); $i++) {
68     list($id, $naz, $ust, $ur, $god) = $rows[$i];
69     $naz = HTML_Escape(Win_ISO($naz));
70     $ur = HTML_Escape(Win_ISO($ur));
71     $ust2 = "";
72     for ($j = 0; $j < count($ustanove); $j++) {
73     if ($ustanove[$j]["id"] == $ust) {
74     $ust2 = $ustanove[$j]["name"];
75     break;
76     }
77     }
78     nepoznato($ust2);
79     $god2 = $god;
80     if (!$god2) $god2 = "-";
81     $naz2 = ereg_replace("\r?\n", "<BR>", $naz);
82     $ur2 = ereg_replace("\r?\n", "<BR>", $ur);
83     nepoznato($naz2);
84     nepoznato($ur2);
85     array_push($vars, array(
86     "id" => $id,
87     "link" => $PHP_SELF.Params($page, array("edit" => $id)),
88     "naziv" => $naz2,
89     "ustanova" => $ust2,
90     "urucitelj" => $ur2,
91     "godina" => $god2
92     ));
93     if ($edit && $edit == $id) {
94     $naziv = $naz;
95     $ustanova = $ust;
96     $urucitelj = $ur;
97     $godina = $god;
98     $fnd = true;
99     }
100     }
101     if (!$fnd) unset($edit);
102     DBClose();
103     include("inc/Smarty.class.php");
104     $tpl = new Smarty;
105     $tpl->template_dir = "./tpl";
106     $tpl->compile_dir = "./tpc";
107     $tpl->assign("action", $PHP_SELF.Params($page,
108     $edit ? array("edit" => $edit) : array()));
109     $tpl->assign("language", $language);
110     $tpl->assign("sifra", $sifra);
111     $tpl->assign("vars", $vars);
112     $tpl->assign("edit", $edit);
113     $tpl->assign("ustanove", $ustanove);
114     $tpl->assign("naziv", $naziv);
115     $tpl->assign("ustanova", $ustanova);
116     $tpl->assign("godina", $godina);
117     $tpl->assign("warning", $warning);
118     $pg = basename($PHP_SELF);
119     $pg = eregi_replace("\.php$", "", $pg);
120     $tpl->display("$pg-$language.tpl");
121     ?>

  ViewVC Help
Powered by ViewVC 1.1.26