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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Tue Jul 23 13:08:57 2002 UTC (16 years, 10 months ago) by ravilov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +6 -6 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 izvan_plive WHERE (id=$del) AND (sif_radnika='$sifra')");
27 if (!$DBH->errstr && $edit == $del) unset($edit);
28 }
29 $warning = 0;
30 if ($update || $p != $page) {
31 if ($radno_mjesto || $zadaci || $dat_od || $dat_do) {
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 $tvrtka = ISO_Win($tvrtka);
48 $radno_mjesto = ISO_Win($radno_mjesto);
49 $zadaci = ISO_Win($zadaci);
50 if ($edit) DBQuery("UPDATE izvan_plive SET tvrtka='$tvrtka',radno_mjesto='$radno_mjesto',zadaci='$zadaci',datum_od='$datum_od',datum_do=".($datum_do?"'$datum_do'":"NULL")." WHERE (sif_radnika='$sifra') AND (id=$edit)");
51 else DBQuery("INSERT INTO izvan_plive (sif_radnika,tvrtka,radno_mjesto,zadaci,datum_od,datum_do) VALUES ('$sifra','$tvrtka','$radno_mjesto','$zadaci','$datum_od',".($datum_do?"'$datum_do'":"NULL").")");
52 }
53 } else if ($edit)
54 DBQuery("DELETE FROM izvan_plive WHERE (sif_radnika='$sifra') AND (id=$edit)");
55 if ($p != $page && !$warning && !$DBH->errstr) {
56 DBClose();
57 Header("Location: $pages[$p]".Params($p));
58 exit;
59 }
60 }
61 if (($new || $update) && !$warning && !$DBH->errstr) {
62 unset($edit, $tvrtka, $radno_mjesto, $zadaci);
63 unset($dat_od, $dat_od_d, $dat_od_m, $dat_od_g);
64 unset($dat_do, $dat_do_d, $dat_do_m, $dat_do_g);
65 }
66 $rows = DBQuery("SELECT id,tvrtka,radno_mjesto,zadaci,datum_od,datum_do FROM izvan_plive WHERE (sif_radnika='$sifra') ORDER BY datum_od");
67 DBClose();
68 $vars = array();
69 $fnd = false;
70 for ($i = 0; $i < count($rows); $i++) {
71 list($id, $tv, $rm, $zad, $od, $do) = $rows[$i];
72 $od = ParseDate($od);
73 $do = ParseDate($do);
74 $tv = HTML_Escape(Win_ISO($tv));
75 $rm = HTML_Escape(Win_ISO($rm));
76 $zad = HTML_Escape(Win_ISO($zad));
77 $tv2 = nl2br($tv);
78 $rm2 = nl2br($rm);
79 $zad2 = nl2br($zad);
80 nepoznato($tv2);
81 nepoznato($rm2);
82 nepoznato($zad2);
83 array_push($vars, array(
84 "id" => $id,
85 "link" => $PHP_SELF.Params($page, array("edit" => $id)),
86 "tvrtka" => $tv2,
87 "radno_mjesto" => $rm2,
88 "zadaci" => $zad2,
89 "od_d" => $od["mday"], "od_m" => $od["mon"], "od_g" => $od["year"],
90 "do_d" => $do["mday"], "do_m" => $do["mon"], "do_g" => $do["year"]
91 ));
92 if ($edit && $edit == $id) {
93 if (!$warning && !$DBH->errstr) {
94 $tvrtka = $tv;
95 $radno_mjesto = $rm;
96 $zadaci = $zad;
97 list($dat_od_d, $dat_od_m, $dat_od_g) =
98 array($od["mday"], $od["mon"], $od["year"]);
99 list($dat_do_d, $dat_do_m, $dat_do_g) =
100 array($do["mday"], $do["mon"], $do["year"]);
101 }
102 $fnd = true;
103 }
104 }
105 if (!$fnd) unset($edit);
106 $tpl = new MySmarty($page, $edit ? array("edit" => $edit) : array());
107 $tpl->assign("vars", $vars);
108 $tpl->assign("edit", $edit);
109 $tpl->assign("tvrtka", $tvrtka);
110 $tpl->assign("radno_mjesto", $radno_mjesto);
111 $tpl->assign("zadaci", $zadaci);
112 if ($dat_od_d && $dat_od_m && $dat_od_g) {
113 $tpl->assign("dat_od_d", $dat_od_d);
114 $tpl->assign("dat_od_m", $dat_od_m);
115 $tpl->assign("dat_od_g", $dat_od_g);
116 } else $tpl->assign("dat_od", $dat_od);
117 if ($dat_do_d && $dat_do_m && $dat_do_g) {
118 $tpl->assign("dat_do_d", $dat_do_d);
119 $tpl->assign("dat_do_m", $dat_do_m);
120 $tpl->assign("dat_do_g", $dat_do_g);
121 } else $tpl->assign("dat_do", $dat_do);
122 $tpl->assign("warning", $warning);
123 $tpl->show();
124 ?>

  ViewVC Help
Powered by ViewVC 1.1.26