/[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

Annotation of /TecajeviManagementa.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations)
Fri May 18 12:51:39 2001 UTC (18 years, 8 months ago) by dpavlin
Branch: MAIN
Changes since 1.3: +2 -0 lines
zadnje promjene, multi-lingual footers

1 dpavlin 1.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 dpavlin 1.3 if (!$DBH->errstr && $edit == $del) unset($edit);
30 dpavlin 1.1 }
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 dpavlin 1.3 $dt = DateCheck($dat_od);
37     if ($dt) $datum_od = ComposeDate($dt);
38     else $warning = 1;
39 dpavlin 1.1 } else $warning = 2;
40     }
41     if (!$warning) {
42     if ($dat_do) {
43 dpavlin 1.3 $dt = DateCheck($dat_do);
44     if ($dt) $datum_do = ComposeDate($dt);
45     else $warning = 3;
46 dpavlin 1.1 } 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 dpavlin 1.3 if ($p != $page && !$warning && !$DBH->errstr) {
62 dpavlin 1.1 DBClose();
63     Header("Location: $pages[$p]".Params($p,
64     ($p == 300) ? array("q" => 6) : array()));
65     exit;
66     }
67     }
68 dpavlin 1.3 if (($new || $update) && !$warning && !$DBH->errstr) {
69 dpavlin 1.1 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 dpavlin 1.3 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 dpavlin 1.1 $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 dpavlin 1.4 nepoznato($tec2);
106 dpavlin 1.1 $ust2 = "";
107     for ($j = 0; $j < count($ustanove); $j++) {
108     if ($ustanove[$j]["id"] == $ust) {
109     $ust2 = $ustanove[$j]["name"];
110     break;
111     }
112     }
113 dpavlin 1.4 nepoznato($ust2);
114 dpavlin 1.1 $mj = HTML_Escape(Win_ISO($mj));
115     $mj2 = ereg_replace("\r?\n", "<BR>", $mj);
116     nepoznato($mj2);
117     array_push($vars, array(
118     "id" => $id,
119     "link" => $PHP_SELF.Params($page, array("edit" => $id)),
120     "tecaj" => $tec2,
121     "ustanova" => $ust2,
122     "od_d" => $od["mday"], "od_m" => $od["mon"], "od_g" => $od["year"],
123     "do_d" => $do["mday"], "do_m" => $do["mon"], "do_g" => $do["year"],
124     "mjesto" => $mj2
125     ));
126     if ($edit && $edit == $id) {
127 dpavlin 1.3 if (!$warning) {
128     $tecaj = $tec;
129     $ustanova = $ust;
130     list($dat_od_d, $dat_od_m, $dat_od_g) =
131     array($od["mday"], $od["mon"], $od["year"]);
132     list($dat_do_d, $dat_do_m, $dat_do_g) =
133     array($do["mday"], $do["mon"], $do["year"]);
134     $mjesto = $mj;
135     }
136 dpavlin 1.1 $fnd = true;
137     }
138     }
139     if (!$fnd) unset($edit);
140     DBClose();
141 dpavlin 1.3 $tpl = new MySmarty($page, $edit ? array("edit" => $edit) : array());
142 dpavlin 1.1 $tpl->assign("vars", $vars);
143     $tpl->assign("edit", $edit);
144     $tpl->assign("tecajevi", $tecajevi);
145     $tpl->assign("ustanove", $ustanove);
146     $tpl->assign("tecaj", $tecaj);
147     $tpl->assign("ustanova", $ustanova);
148     $tpl->assign("mjesto", $mjesto);
149     if ($dat_od_d && $dat_od_m && $dat_od_g) {
150     $tpl->assign("dat_od_d", $dat_od_d);
151     $tpl->assign("dat_od_m", $dat_od_m);
152     $tpl->assign("dat_od_g", $dat_od_g);
153     } else $tpl->assign("dat_od", $dat_od);
154     if ($dat_do_d && $dat_do_m && $dat_do_g) {
155     $tpl->assign("dat_do_d", $dat_do_d);
156     $tpl->assign("dat_do_m", $dat_do_m);
157     $tpl->assign("dat_do_g", $dat_do_g);
158     } else $tpl->assign("dat_do", $dat_do);
159     $tpl->assign("warning", $warning);
160 dpavlin 1.3 $tpl->show();
161 dpavlin 1.1 ?>

  ViewVC Help
Powered by ViewVC 1.1.26