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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (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.5: +5 -5 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 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 radovi WHERE (sif_str_skupa=$del) AND (sif_radnika='$sifra')");
27 DBQuery("DELETE FROM strucni_skupovi WHERE (rbr=$del) AND (sif_radnika='$sifra')");
28 if (!$DBH->errstr && $edit == $del) unset($edit);
29 }
30 $warning = 0;
31 if ($update || $p != $page) {
32 if ($skup || $mjesto || $dat_od || $dat_do || $rad) {
33 if (!$warning) {
34 if ($dat_od) {
35 $dt = DateCheck($dat_od);
36 if ($dt) $datum_od = ComposeDate($dt);
37 else $warning = 1;
38 } else $warning = 2;
39 }
40 if (!$warning) {
41 if ($dat_do) {
42 $dt = DateCheck($dat_do);
43 if ($dt) $datum_do = ComposeDate($dt);
44 else $warning = 3;
45 } else $warning = 4;
46 }
47 if (!$warning) {
48 $licenca = ISO_Win($licenca);
49 $zvanje = ISO_Win($zvanje);
50 if ($edit) {
51 DBQuery("UPDATE strucni_skupovi SET naziv='$skup',grad='$mjesto',datum_od='$datum_od',datum_do='$datum_do' WHERE (rbr=$edit) AND (sif_radnika='$sifra')");
52 DBQuery("UPDATE radovi SET naziv_rada_knjige='$rad' WHERE (sif_str_skupa=$edit) AND (sif_radnika='$sifra')");
53 } else {
54 $id = DBQuery("SELECT MAX(rbr) FROM strucni_skupovi WHERE (sif_radnika='$sifra')");
55 $id = $id[0][0] + 1;
56 DBQuery("INSERT INTO strucni_skupovi (rbr,sif_radnika,naziv,grad,datum_od,datum_do) VALUES ($id,'$sifra','$skup','$mjesto','$datum_od','$datum_do')");
57 $id2 = DBQuery("SELECT MAX(rbr) FROM radovi WHERE (sif_radnika='$sifra')");
58 $id2 = $id[0][0] + 1;
59 DBQuery("INSERT INTO radovi (rbr,sif_str_skupa,sif_radnika,naziv_rada_knjige) VALUES ($id2,$id,'$sifra','$rad')");
60 }
61 }
62 } else if ($edit) {
63 DBQuery("DELETE FROM radovi WHERE (sif_str_skupa=$edit) AND (sif_radnika='$sifra')");
64 DBQuery("DELETE FROM strucni_skupovi WHERE (rbr=$edit) AND (sif_radnika='$sifra')");
65 }
66 if ($p != $page && !$warning && !$DBH->errstr) {
67 DBClose();
68 Header("Location: $pages[$p]".Params($p));
69 exit;
70 }
71 }
72 if (($new || $update) && !$warning && !$DBH->errstr) {
73 unset($edit, $skup, $mjesto, $rad);
74 unset($dat_od, $dat_od_d, $dat_od_m, $dat_od_g);
75 unset($dat_do, $dat_do_d, $dat_do_m, $dat_do_g);
76 }
77 $rows = DBQuery("SELECT strucni_skupovi.rbr,naziv,grad,datum_od,datum_do,naziv_rada_knjige FROM strucni_skupovi,radovi WHERE (radovi.sif_str_skupa=strucni_skupovi.rbr) AND (strucni_skupovi.sif_radnika=radovi.sif_radnika) AND (radovi.sif_radnika='$sifra') ORDER BY datum_od");
78 $vars = array();
79 $fnd = false;
80 for ($i = 0; $i < count($rows); $i++) {
81 list($id, $naz, $mj, $od, $do, $rd) = $rows[$i];
82 $od = ParseDate($od);
83 $do = ParseDate($do);
84 $naz = HTML_Escape(Win_ISO($naz));
85 $mj = HTML_Escape(Win_ISO($mj));
86 $rd = HTML_Escape(Win_ISO($rd));
87 $naz2 = nl2br($naz);
88 $mj2 = nl2br($mj);
89 $rd2 = nl2br($rd);
90 nepoznato($naz2);
91 nepoznato($mj2);
92 nepoznato($rd2);
93 array_push($vars, array(
94 "id" => $id,
95 "link" => $PHP_SELF.Params($page, array("edit" => $id)),
96 "skup" => $naz2,
97 "mjesto" => $mj2,
98 "rad" => $rd2,
99 "od_d" => $od["mday"], "od_m" => $od["mon"], "od_g" => $od["year"],
100 "do_d" => $do["mday"], "do_m" => $do["mon"], "do_g" => $do["year"],
101 ));
102 if ($edit && $edit == $id) {
103 if (!$warning) {
104 $skup = $naz;
105 $mjesto = $mj;
106 $rad = $rd;
107 list($dat_od_d, $dat_od_m, $dat_od_g) =
108 array($od["mday"], $od["mon"], $od["year"]);
109 list($dat_do_d, $dat_do_m, $dat_do_g) =
110 array($do["mday"], $do["mon"], $do["year"]);
111 }
112 $fnd = true;
113 }
114 }
115 if (!$fnd) unset($edit);
116 DBClose();
117 $tpl = new MySmarty($page, $edit ? array("edit" => $edit) : array());
118 $tpl->assign("vars", $vars);
119 $tpl->assign("edit", $edit);
120 $tpl->assign("skup", $skup);
121 $tpl->assign("mjesto", $mjesto);
122 $tpl->assign("rad", $rad);
123 if ($dat_od_d && $dat_od_m && $dat_od_g) {
124 $tpl->assign("dat_od_d", $dat_od_d);
125 $tpl->assign("dat_od_m", $dat_od_m);
126 $tpl->assign("dat_od_g", $dat_od_g);
127 } else $tpl->assign("dat_od", $dat_od);
128 if ($dat_do_d && $dat_do_m && $dat_do_g) {
129 $tpl->assign("dat_do_d", $dat_do_d);
130 $tpl->assign("dat_do_m", $dat_do_m);
131 $tpl->assign("dat_do_g", $dat_do_g);
132 } else $tpl->assign("dat_do", $dat_do);
133 $tpl->assign("warning", $warning);
134 $tpl->show("$pg-$language.tpl");
135 ?>

  ViewVC Help
Powered by ViewVC 1.1.26