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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Wed Apr 25 13:18:46 2001 UTC (19 years, 1 month ago) by dpavlin
Branch: MAIN
Changes since 1.2: +22 -32 lines
promjene za finalnu verziju

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_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=6)");
29 if (!$DBH->errstr && $edit == $del) unset($edit);
30 }
31 $warning = 0;
32 if ($update || $p != $page) {
33 if ($tecaj || $ustanova || $dat_od || $dat_do || $mjesto) {
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 $licenca = ereg_replace("\r?\n", "\n", ISO_Win($licenca));
50 $zvanje = ereg_replace("\r?\n", "\n", ISO_Win($zvanje));
51 if ($edit)
52 DBQuery("UPDATE edukacije SET sif_tecaja=$tecaj,sif_ustanove=$ustanova,datum_upisa='$datum_od',datum_zavrsetka='$datum_do',grad_odrzavanja_tecaja='$mjesto' WHERE (sifra=$edit) AND (sif_radnika='$sifra') AND (sif_qualification=6)");
53 else {
54 $id = DBQuery("SELECT MAX(sifra) FROM edukacije WHERE (sif_qualification=6)");
55 $id = $id[0][0] + 1;
56 DBQuery("INSERT INTO edukacije (sifra,sif_radnika,sif_tecaja,sif_ustanove,datum_upisa,datum_zavrsetka,grad_odrzavanja_tecaja,sif_qualification) VALUES ($id,'$sifra',$tecaj,$ustanova,'$datum_od','$datum_do','$mjesto',6)");
57 }
58 }
59 } else if ($edit)
60 DBQuery("DELETE FROM edukacije WHERE (sifra=$edit) AND (sif_radnika='$sifra') AND (sif_qualification=6)");
61 if ($p != $page && !$warning && !$DBH->errstr) {
62 DBClose();
63 Header("Location: $pages[$p]".Params($p,
64 ($p == 300) ? array("q" => 6) : array()));
65 exit;
66 }
67 }
68 if (($new || $update) && !$warning && !$DBH->errstr) {
69 unset($edit, $tecaj, $ustanova, $mjesto);
70 unset($dat_od, $dat_od_d, $dat_od_m, $dat_od_g);
71 unset($dat_do, $dat_do_d, $dat_do_m, $dat_do_g);
72 }
73 include("inc/util.php");
74 $rows = DBQuery("SELECT sifra,naziv FROM tecajevi WHERE (language='$language') AND (sif_qualification=6)");
75 $tecajevi = array();
76 for ($i = 0; $i < count($rows); $i++) {
77 list($sif, $naz) = $rows[$i];
78 array_push($tecajevi, array("id" => $sif,
79 "name" => HTML_Escape(Win_ISO($naz))));
80 }
81 usort($tecajevi, "sort_name");
82 $rows = DBQuery("SELECT sifra,naziv,grad FROM ustanove WHERE (language='$language')");
83 $ustanove = array();
84 for ($i = 0; $i < count($rows); $i++) {
85 list($sif, $naz, $grad) = $rows[$i];
86 if ($grad) $naz = "$naz, $grad";
87 array_push($ustanove, array("id" => $sif,
88 "name" => HTML_Escape(Win_ISO($naz))));
89 }
90 usort($ustanove, "sort_name");
91 $rows = DBQuery("SELECT sifra,sif_tecaja,sif_ustanove,datum_upisa,datum_zavrsetka,grad_odrzavanja_tecaja FROM edukacije WHERE (sif_radnika='$sifra') AND (sif_qualification=6) ORDER BY datum_upisa");
92 $vars = array();
93 $fnd = false;
94 for ($i = 0; $i < count($rows); $i++) {
95 list($id, $tec, $ust, $od, $do, $mj) = $rows[$i];
96 $od = ParseDate($od);
97 $do = ParseDate($do);
98 $tec2 = "";
99 for ($j = 0; $j < count($tecajevi); $j++) {
100 if ($tecajevi[$j]["id"] == $tec) {
101 $tec2 = $tecajevi[$j]["name"];
102 break;
103 }
104 }
105 $ust2 = "";
106 for ($j = 0; $j < count($ustanove); $j++) {
107 if ($ustanove[$j]["id"] == $ust) {
108 $ust2 = $ustanove[$j]["name"];
109 break;
110 }
111 }
112 $mj = HTML_Escape(Win_ISO($mj));
113 $mj2 = ereg_replace("\r?\n", "<BR>", $mj);
114 nepoznato($mj2);
115 array_push($vars, array(
116 "id" => $id,
117 "link" => $PHP_SELF.Params($page, array("edit" => $id)),
118 "tecaj" => $tec2,
119 "ustanova" => $ust2,
120 "od_d" => $od["mday"], "od_m" => $od["mon"], "od_g" => $od["year"],
121 "do_d" => $do["mday"], "do_m" => $do["mon"], "do_g" => $do["year"],
122 "mjesto" => $mj2
123 ));
124 if ($edit && $edit == $id) {
125 if (!$warning) {
126 $tecaj = $tec;
127 $ustanova = $ust;
128 list($dat_od_d, $dat_od_m, $dat_od_g) =
129 array($od["mday"], $od["mon"], $od["year"]);
130 list($dat_do_d, $dat_do_m, $dat_do_g) =
131 array($do["mday"], $do["mon"], $do["year"]);
132 $mjesto = $mj;
133 }
134 $fnd = true;
135 }
136 }
137 if (!$fnd) unset($edit);
138 DBClose();
139 $tpl = new MySmarty($page, $edit ? array("edit" => $edit) : array());
140 $tpl->assign("vars", $vars);
141 $tpl->assign("edit", $edit);
142 $tpl->assign("tecajevi", $tecajevi);
143 $tpl->assign("ustanove", $ustanove);
144 $tpl->assign("tecaj", $tecaj);
145 $tpl->assign("ustanova", $ustanova);
146 $tpl->assign("mjesto", $mjesto);
147 if ($dat_od_d && $dat_od_m && $dat_od_g) {
148 $tpl->assign("dat_od_d", $dat_od_d);
149 $tpl->assign("dat_od_m", $dat_od_m);
150 $tpl->assign("dat_od_g", $dat_od_g);
151 } else $tpl->assign("dat_od", $dat_od);
152 if ($dat_do_d && $dat_do_m && $dat_do_g) {
153 $tpl->assign("dat_do_d", $dat_do_d);
154 $tpl->assign("dat_do_m", $dat_do_m);
155 $tpl->assign("dat_do_g", $dat_do_g);
156 } else $tpl->assign("dat_do", $dat_do);
157 $tpl->assign("warning", $warning);
158 $tpl->show();
159 ?>

  ViewVC Help
Powered by ViewVC 1.1.26