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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations)
Thu Sep 5 08:52:21 2002 UTC (16 years, 9 months ago) by ravilov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +42 -9 lines
bla

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 include("inc/conn.php");
11 DBOpen();
12 $del = 0;
13 reset($HTTP_GET_VARS);
14 while ($var = key($HTTP_GET_VARS)) {
15 next($HTTP_GET_VARS);
16 if (!eregi('^del_([0-9]+)$', $var, $match)) continue;
17 $del = $match[1];
18 }
19 reset($HTTP_POST_VARS);
20 while ($var = key($HTTP_POST_VARS)) {
21 next($HTTP_POST_VARS);
22 if (!eregi('^del_([0-9]+)$', $var, $match)) continue;
23 $del = $match[1];
24 }
25 if ($del) {
26 DBQuery("DELETE FROM edukacije WHERE (sifra=$del) AND (sif_radnika='$sifra') AND (sif_qualification=2)");
27 if (!$DBH->errstr && $edit == $del) unset($edit);
28 }
29 $warning = 0;
30 if ($update || $p != $page) {
31 if ($obr_ust || $studij || $st_spreme || $vr_spreme || $dat_od || $dat_do || $zvanje || $uispita || $pispita || $usemestara || $psemestara) {
32 if (!$warning) {
33 if ($dat_od) {
34 $dt = DateCheck($dat_od);
35 if ($dt) $datum_od = ComposeDate($dt);
36 else $warning = 1;
37 } else $warning = 2;
38 }
39 if (!$warning) {
40 if ($dat_do) {
41 $dt = DateCheck($dat_do);
42 if ($dt) $datum_do = ComposeDate($dt);
43 else $warning = 3;
44 } #else $warning = 4;
45 }
46 if (!$warning) {
47 if (!$st_spreme) $warning = 5;
48 }
49 if (!$warning) {
50 if (!$vr_spreme) $warning = 6;
51 }
52 if (!$warning) {
53 if ($uispita == "") $warning = 7;
54 }
55 if (!$warning) {
56 if ($pispita == "") $warning = 8;
57 }
58 if (!$warning) {
59 if ($usemestara == "") $warning = 9;
60 }
61 if (!$warning) {
62 if ($psemestara == "") $warning = 10;
63 }
64 if (!$warning) {
65 $studij = ISO_Win($studij);
66 $zvanje = ISO_Win($zvanje);
67 $sif = DBQuery("SELECT sif_str_spreme FROM strucne_spreme WHERE (language='$language') AND (stupanj='$st_spreme') AND (sif_vrsta_str_spreme=$vr_spreme)");
68 $sif = $sif[0][0];
69 if (!$sif) $sif = 0;
70 if ($edit) {
71 DBQuery("UPDATE edukacije SET sif_ustanove=$obr_ust,naziv='$studij',titula='$zvanje',sif_strucna_sprema=$sif,datum_upisa='$datum_od',datum_zavrsetka=".($datum_do?"'$datum_do'":"NULL").",ukupno_ispita=$uispita,polozenih_ispita=$pispita,ukupno_semestara=$usemestara,polozenih_semestara=$psemestara WHERE (sif_radnika='$sifra') AND (sifra=$edit) AND (sif_qualification=2)");
72 } else {
73 $id = DBQuery("SELECT MAX(sifra) FROM edukacije");
74 $id = $id[0][0] + 1;
75 DBQuery("INSERT INTO edukacije (sifra,sif_radnika,sif_ustanove,naziv,titula,sif_strucna_sprema,datum_upisa,datum_zavrsetka,ukupno_ispita,polozenih_ispita,ukupno_semestara,polozenih_semestara,sif_qualification) VALUES ($id,'$sifra',$obr_ust,'$studij','$zvanje',$sif,'$datum_od',".($datum_do?"'$datum_do'":"NULL").",$uispita,$pispita,$usemestara,$psemestara,2)");
76 }
77 }
78 } else if ($edit) DBQuery("DELETE FROM edukacije WHERE (sifra=$edit) AND (sif_radnika='$sifra') AND (sif_qualification=2)");
79 if ($p != $page && !$warning && !$DBH->errstr) {
80 DBClose();
81 Header("Location: $pages[$p]".Params($p));
82 exit;
83 }
84 }
85 if (($new || $update) && !$warning && !$DBH->errstr) {
86 unset($edit, $obr_ust, $studij, $zvanje, $st_spreme, $vr_spreme, $uispita, $pispita, $usemestara, $psemestara);
87 unset($dat_od, $dat_od_d, $dat_od_m, $dat_od_g);
88 unset($dat_do, $dat_do_d, $dat_do_m, $dat_do_g);
89 }
90 include("inc/util.php");
91 $rows = DBQuery("SELECT sifra, naziv, grad FROM ustanove WHERE language='$language' AND naziv||grad<>'' AND obrazovna");
92 $ustanove = array();
93 for ($i = 0; $i < count($rows); $i++) {
94 list($sif, $naz, $grad) = $rows[$i];
95 if ($grad) $naz = "$naz, $grad";
96 array_push($ustanove, array(
97 "id" => $sif,
98 "name" => HTML_Escape(Win_ISO($naz))
99 ));
100 }
101 usort($ustanove, "sort_name");
102 /* STARO!!!
103 $rows = DBQuery("SELECT DISTINCT stupanj FROM strucne_spreme WHERE (language='$language')");
104 $sss = array();
105 for ($i = 0; $i < count($rows); $i++) {
106 list($naz) = $rows[$i];
107 $naz = Win_ISO($naz);
108 array_push($sss, array(
109 "id" => $naz,
110 "name" => HTML_Escape(Win_ISO($naz))
111 ));
112 }
113 usort($sss, "sort_name");
114 */
115 $sss = array();
116 switch ($language) {
117 case "HR":
118 $sss = array(
119 array("id" => "VSS", "name" => "VSS"),
120 array("id" => "Dr", "name" => "Dr"),
121 array("id" => "Mr", "name" => "Mr"),
122 array("id" => "MBA", "name" => "MBA"),
123 array("id" => "Spec", "name" => "specijalizacija"),
124 array("id" => "Stud", "name" => "studijski boravak")
125 );
126 break;
127 case "EN":
128 $sss = array(
129 array("id" => "VSS", "name" => "VSS"),
130 array("id" => "Dr", "name" => "PhD"),
131 array("id" => "Mr", "name" => "Mr"),
132 array("id" => "MBA", "name" => "MBA"),
133 array("id" => "Spec", "name" => "specialization"),
134 array("id" => "Stud", "name" => "professional experience")
135 );
136 break;
137 default:
138 $sss = array();
139 break;
140 }
141 $rows = DBQuery("SELECT sifra,opis FROM vrsta_strucne_spreme WHERE (language='$language') AND (opis<>'')");
142 $vss = array();
143 for ($i = 0; $i < count($rows); $i++) {
144 list($sif, $naz) = $rows[$i];
145 array_push($vss, array(
146 "id" => $sif,
147 "name" => HTML_Escape(Win_ISO($naz))
148 ));
149 }
150 usort($vss, "sort_name");
151 $rows = DBQuery("SELECT edukacije.sifra,sif_ustanove,naziv,titula,stupanj,sif_vrsta_str_spreme,datum_upisa,datum_zavrsetka,ukupno_ispita,polozenih_ispita,ukupno_semestara,polozenih_semestara FROM edukacije,strucne_spreme WHERE (sif_radnika='$sifra') AND (sif_qualification=2) AND (strucne_spreme.sif_str_spreme=edukacije.sif_strucna_sprema) ORDER BY datum_upisa");
152 $vars = array();
153 $fnd = false;
154 for ($i = 0; $i < count($rows); $i++) {
155 list($id, $ust, $sm, $zv, $st, $vr, $od, $do, $ui, $pi, $us, $ps) = $rows[$i];
156 $od = ParseDate($od);
157 $do = ParseDate($do);
158 $ust2 = "";
159 for ($j = 0; $j < count($ustanove); $j++) {
160 if ($ustanove[$j]["id"] == $ust) {
161 $ust2 = $ustanove[$j]["name"];
162 break;
163 }
164 }
165 $vr2 = "";
166 for ($j = 0; $j < count($vss); $j++) {
167 if ($vss[$j]["id"] == $vr) {
168 $vr2 = $vss[$j]["name"];
169 break;
170 }
171 }
172 $sm = HTML_Escape(Win_ISO($sm));
173 $zv = HTML_Escape(Win_ISO($zv));
174 $st = HTML_Escape(Win_ISO($st));
175 $ust2 = nl2br($ust2);
176 $sm2 = nl2br($sm);
177 $zv2 = nl2br($zv);
178 $st2 = nl2br($st);
179 $vr2 = nl2br($vr2);
180 nepoznato($ust2);
181 nepoznato($sm2);
182 nepoznato($zv2);
183 nepoznato($st2);
184 nepoznato($vr2);
185 array_push($vars, array(
186 "id" => $id,
187 "link" => $PHP_SELF.Params($page, array("edit" => $id)),
188 "ustanova" => $ust2,
189 "studij" => $sm2,
190 "zvanje" => $zv2,
191 "sss" => $st2,
192 "vss" => $vr2,
193 "od_d" => $od["mday"], "od_m" => $od["mon"], "od_g" => $od["year"],
194 "do_d" => $do["mday"], "do_m" => $do["mon"], "do_g" => $do["year"],
195 "uispita" => $ui, "pispita" => $pi,
196 "usemestara" => $us, "psemestara" => $ps
197 ));
198 if ($edit && $edit == $id) {
199 if (!$warning) {
200 $obr_ust = $ust;
201 $studij = $sm;
202 $zvanje = $zv;
203 $st_spreme = $st;
204 $vr_spreme = $vr;
205 list($dat_od_d, $dat_od_m, $dat_od_g) =
206 array($od["mday"], $od["mon"], $od["year"]);
207 list($dat_do_d, $dat_do_m, $dat_do_g) =
208 array($do["mday"], $do["mon"], $do["year"]);
209 $uispita = $ui;
210 $pispita = $pi;
211 $usemestara = $us;
212 $psemestara = $ps;
213 }
214 $fnd = true;
215 }
216 }
217 if (!$fnd) unset($edit);
218 DBClose();
219 $tpl = new MySmarty($page, $edit ? array("edit" => $edit) : array());
220 $tpl->assign("vars", $vars);
221 $tpl->assign("edit", $edit);
222 $tpl->assign("ou", $ustanove);
223 $tpl->assign("sss", $sss);
224 $tpl->assign("vss", $vss);
225 $tpl->assign("obr_ust", $obr_ust);
226 $tpl->assign("studij", $studij);
227 $tpl->assign("zvanje", $zvanje);
228 $tpl->assign("st_spreme", $st_spreme);
229 $tpl->assign("vr_spreme", $vr_spreme);
230 $tpl->assign("uispita", $uispita);
231 $tpl->assign("pispita", $pispita);
232 $tpl->assign("usemestara", $usemestara);
233 $tpl->assign("psemestara", $psemestara);
234 if ($dat_od_d && $dat_od_m && $dat_od_g) {
235 $tpl->assign("dat_od_d", $dat_od_d);
236 $tpl->assign("dat_od_m", $dat_od_m);
237 $tpl->assign("dat_od_g", $dat_od_g);
238 } else $tpl->assign("dat_od", $dat_od);
239 if ($dat_do_d && $dat_do_m && $dat_do_g) {
240 $tpl->assign("dat_do_d", $dat_do_d);
241 $tpl->assign("dat_do_m", $dat_do_m);
242 $tpl->assign("dat_do_g", $dat_do_g);
243 } else $tpl->assign("dat_do", $dat_do);
244 $tpl->assign("warning", $warning);
245 $tpl->show();
246 ?>

  ViewVC Help
Powered by ViewVC 1.1.26