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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations)
Thu Sep 5 09:09:03 2002 UTC (16 years, 9 months ago) by ravilov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +12 -9 lines
a

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_T")) $p = 300;
11 if (isparam("wb_U")) $p = 200;
12 include("inc/conn.php");
13 DBOpen();
14 $del = 0;
15 reset($HTTP_GET_VARS);
16 while ($var = key($HTTP_GET_VARS)) {
17 next($HTTP_GET_VARS);
18 if (!eregi('^del_([0-9]+)$', $var, $match)) continue;
19 $del = $match[1];
20 }
21 reset($HTTP_POST_VARS);
22 while ($var = key($HTTP_POST_VARS)) {
23 next($HTTP_POST_VARS);
24 if (!eregi('^del_([0-9]+)$', $var, $match)) continue;
25 $del = $match[1];
26 }
27 if ($del) {
28 DBQuery("DELETE FROM edukacije WHERE (sifra=$del) AND (sif_radnika='$sifra') AND (sif_qualification=7)");
29 if (!$DBH->errstr && $edit == $del) unset($edit);
30 }
31 $warning = 0;
32 if ($update || $p != $page) {
33 if ($edukacija || $ustanova || $dat_od || $dat_do || $mjesto || $zvanje || $formalno) {
34 if (!$warning) {
35 if ($dat_od) {
36 $dt = DateCheck($dat_od);
37 if ($dt) $datum_od = ComposeDate($dt);
38 else $warning = 1;
39 } else $warning = 2;
40 }
41 if (!$warning) {
42 if ($dat_do) {
43 $dt = DateCheck($dat_do);
44 if ($dt) $datum_do = ComposeDate($dt);
45 else $warning = 3;
46 } else $warning = 4;
47 }
48 if (!$warning) {
49 if (!$edukacija) $warning = 5;
50 }
51 if (!$warning) {
52 if (!$ustanova) $warning = 6;
53 }
54 if (!$warning) {
55 $mjesto = ISO_Win($mjesto);
56 $zvanje = ISO_Win($zvanje);
57 if ($edit) DBQuery("UPDATE edukacije SET sif_ustanove=$edukacija,datum_upisa='$datum_od',datum_zavrsetka='$datum_do',sif_tecaja=$ustanova,grad_odrzavanja_tecaja='$mjesto',titula='$zvanje',zavrsio_ispitom='".($formalno?"true":"false")."' WHERE (sifra=$edit) AND (sif_radnika='$sifra') AND (sif_qualification=7)");
58 else {
59 $id = DBQuery("SELECT MAX(sifra) FROM edukacije");
60 $id = $id[0][0] + 1;
61 DBQuery("INSERT INTO edukacije (sifra,sif_radnika,sif_ustanove,datum_upisa,datum_zavrsetka,sif_tecaja,grad_odrzavanja_tecaja,titula,zavrsio_ispitom,sif_qualification) VALUES ($id,'$sifra',$ustanova,'$datum_od','$datum_do',$edukacija,'$mjesto','$zvanje','".($formalno?"true":"false")."',7)");
62 }
63 }
64 } else if ($edit)
65 DBQuery("DELETE FROM edukacije WHERE (sifra=$edit) AND (sif_radnika='$sifra') AND (sif_qualification=7)");
66 if ($p != $page && !$warning && !$DBH->errstr) {
67 DBClose();
68 Header("Location: $pages[$p]".Params($p,
69 ($p == 300) ? array("q" => 7) : array()));
70 exit;
71 }
72 }
73 if (($new || $update) && !$warning && !$DBH->errstr) {
74 unset($edit, $edukacija, $ustanova, $formalno, $mjesto, $zvanje);
75 unset($dat_od, $dat_od_d, $dat_od_m, $dat_od_g);
76 unset($dat_do, $dat_do_d, $dat_do_m, $dat_do_g);
77 unset($dat_pol, $dat_pol_d, $dat_pol_m, $dat_pol_g);
78 unset($dat_izd, $dat_izd_d, $dat_izd_m, $dat_izd_g);
79 unset($dat_ist, $dat_ist_d, $dat_ist_m, $dat_ist_g);
80 }
81 include("inc/util.php");
82 $rows = DBQuery("SELECT sifra, naziv FROM tecajevi WHERE language='$language' AND sif_qualification=7");
83 $edukacije = array();
84 for ($i = 0; $i < count($rows); $i++) {
85 list($sif, $naz) = $rows[$i];
86 array_push($edukacije, array(
87 "id" => $sif,
88 "name" => HTML_Escape(Win_ISO($naz))
89 ));
90 }
91 usort($edukacije, "sort_name");
92 $rows = DBQuery("SELECT sifra, naziv, grad FROM ustanove WHERE language='$language' AND NOT obrazovna");
93 $ustanove = array();
94 for ($i = 0; $i < count($rows); $i++) {
95 list($sif, $naz, $grad) = $rows[$i];
96 if ($grad) $naz = "$naz, $grad";
97 array_push($ustanove, array(
98 "id" => $sif,
99 "name" => HTML_Escape(Win_ISO($naz))
100 ));
101 }
102 usort($ustanove, "sort_name");
103 $rows = DBQuery("SELECT sifra, sif_tecaja, sif_ustanove, datum_upisa, datum_zavrsetka, grad_odrzavanja_tecaja, titula, zavrsio_ispitom FROM edukacije WHERE sif_radnika='$sifra' AND sif_qualification=7 ORDER BY datum_upisa");
104 $vars = array();
105 $fnd = false;
106 for ($i = 0; $i < count($rows); $i++) {
107 list($id, $edu, $ust, $od, $do, $mj, $tit, $form) = $rows[$i];
108 $od = ParseDate($od);
109 $do = ParseDate($do);
110 $edu2 = "";
111 for ($j = 0; $j < count($edukacije); $j++) {
112 if ($edukacije[$j]["id"] == $edu) {
113 $edu2 = $edukacije[$j]["name"];
114 break;
115 }
116 }
117 $ust2 = "";
118 for ($j = 0; $j < count($ustanove); $j++) {
119 if ($ustanove[$j]["id"] == $ust) {
120 $ust2 = $ustanove[$j]["name"];
121 break;
122 }
123 }
124 $mj = HTML_Escape(Win_ISO($mj));
125 $tit = HTML_Escape(Win_ISO($tit));
126 $edu2 = nl2br($edu2);
127 $ust2 = nl2br($ust2);
128 $mj2 = nl2br($mj);
129 $tit2 = nl2br($tit);
130 nepoznato($edu2);
131 nepoznato($ust2);
132 nepoznato($tit2);
133 array_push($vars, array(
134 "id" => $id,
135 "link" => $PHP_SELF.Params($page, array("edit" => $id)),
136 "edukacija" => $edu2,
137 "ustanova" => $ust2,
138 "mjesto" => $mj2,
139 "zvanje" => $tit2,
140 "formalno" => (strcasecmp("true", $form[0]) == 0 || strcasecmp("t", $form[0]) == 0) ? true : false,
141 "od_d" => $od["mday"], "od_m" => $od["mon"], "od_g" => $od["year"],
142 "do_d" => $do["mday"], "do_m" => $do["mon"], "do_g" => $do["year"],
143 ));
144 if ($edit && $edit == $id) {
145 if (!$warning) {
146 $edukacija = $edu;
147 $ustanova = $ust;
148 $mjesto = $mj;
149 $formalno = ($form[0] != "f" && $form[0] != "F");
150 $zvanje = $tit;
151 list($dat_od_d, $dat_od_m, $dat_od_g) =
152 array($od["mday"], $od["mon"], $od["year"]);
153 list($dat_do_d, $dat_do_m, $dat_do_g) =
154 array($do["mday"], $do["mon"], $do["year"]);
155 }
156 $fnd = true;
157 }
158 }
159 if (!$fnd) unset($edit);
160 DBClose();
161 $tpl = new MySmarty($page, $edit ? array("edit" => $edit) : array());
162 $tpl->assign("vars", $vars);
163 $tpl->assign("edit", $edit);
164 $tpl->assign("edukacije", $edukacije);
165 $tpl->assign("ustanove", $ustanove);
166 $tpl->assign("edukacija", $edukacija);
167 $tpl->assign("ustanova", $ustanova);
168 $tpl->assign("mjesto", $mjesto);
169 $tpl->assign("formalno", $formalno);
170 $tpl->assign("zvanje", $zvanje);
171 if ($dat_od_d && $dat_od_m && $dat_od_g) {
172 $tpl->assign("dat_od_d", $dat_od_d);
173 $tpl->assign("dat_od_m", $dat_od_m);
174 $tpl->assign("dat_od_g", $dat_od_g);
175 } else $tpl->assign("dat_od", $dat_od);
176 if ($dat_do_d && $dat_do_m && $dat_do_g) {
177 $tpl->assign("dat_do_d", $dat_do_d);
178 $tpl->assign("dat_do_m", $dat_do_m);
179 $tpl->assign("dat_do_g", $dat_do_g);
180 } else $tpl->assign("dat_do", $dat_do);
181 $tpl->assign("warning", $warning);
182 $tpl->show();
183 ?>

  ViewVC Help
Powered by ViewVC 1.1.26