/[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.1 - (hide annotations)
Fri Apr 20 08:25:32 2001 UTC (19 years, 1 month ago) by dpavlin
Branch: MAIN
Branch point for: pliva
Initial revision

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     unset($edit);
29     DBQuery("DELETE FROM edukacije WHERE (sifra=$del) AND (sif_radnika='$sifra') AND (sif_qualification=6)");
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     list($d, $m, $y) = split("\s*\.+\s*", $dat_od);
37     if (!checkdate($m, $d, $y)) $warning = 1;
38     $datum_od = ComposeDate($dm, $m, $y);
39     } else $warning = 2;
40     }
41     if (!$warning) {
42     if ($dat_do) {
43     list($d, $m, $y) = split("\s*\.+\s*", $dat_do);
44     if (!checkdate($m, $d, $y)) $warning = 3;
45     $datum_do = ComposeDate($dm, $m, $y);
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) {
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) {
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     unset($dat_pol, $dat_pol_d, $dat_pol_m, $dat_pol_g);
73     unset($dat_izd, $dat_izd_d, $dat_izd_m, $dat_izd_g);
74     unset($dat_ist, $dat_ist_d, $dat_ist_m, $dat_ist_g);
75     }
76     include("inc/util.php");
77     $rows = DBQuery("SELECT sifra,naziv FROM tecajevi WHERE (language='$language') AND (sif_qualification=6)");
78     $tecajevi = array();
79     for ($i = 0; $i < count($rows); $i++) {
80     list($sif, $naz) = $rows[$i];
81     array_push($tecajevi, array("id" => $sif,
82     "name" => HTML_Escape(Win_ISO($naz))));
83     }
84     usort($tecajevi, "sort_name");
85     $rows = DBQuery("SELECT sifra,naziv,grad FROM ustanove WHERE (language='$language')");
86     $ustanove = array();
87     for ($i = 0; $i < count($rows); $i++) {
88     list($sif, $naz, $grad) = $rows[$i];
89     if ($grad) $naz = "$naz, $grad";
90     array_push($ustanove, array("id" => $sif,
91     "name" => HTML_Escape(Win_ISO($naz))));
92     }
93     usort($tecajevi, "sort_name");
94     $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)");
95     $vars = array();
96     $fnd = false;
97     for ($i = 0; $i < count($rows); $i++) {
98     list($id, $tec, $ust, $od, $do, $mj) = $rows[$i];
99     $od = ParseDate($od);
100     $do = ParseDate($do);
101     $tec2 = "";
102     for ($j = 0; $j < count($tecajevi); $j++) {
103     if ($tecajevi[$j]["id"] == $tec) {
104     $tec2 = $tecajevi[$j]["name"];
105     break;
106     }
107     }
108     $ust2 = "";
109     for ($j = 0; $j < count($ustanove); $j++) {
110     if ($ustanove[$j]["id"] == $ust) {
111     $ust2 = $ustanove[$j]["name"];
112     break;
113     }
114     }
115     $mj = HTML_Escape(Win_ISO($mj));
116     $mj2 = ereg_replace("\r?\n", "<BR>", $mj);
117     nepoznato($mj2);
118     array_push($vars, array(
119     "id" => $id,
120     "link" => $PHP_SELF.Params($page, array("edit" => $id)),
121     "tecaj" => $tec2,
122     "ustanova" => $ust2,
123     "od_d" => $od["mday"], "od_m" => $od["mon"], "od_g" => $od["year"],
124     "do_d" => $do["mday"], "do_m" => $do["mon"], "do_g" => $do["year"],
125     "mjesto" => $mj2
126     ));
127     if ($edit && $edit == $id) {
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     $fnd = true;
136     }
137     }
138     if (!$fnd) unset($edit);
139     DBClose();
140     include("inc/Smarty.class.php");
141     $tpl = new Smarty;
142     $tpl->template_dir = "./tpl";
143     $tpl->compile_dir = "./tpc";
144     $tpl->assign("action", $PHP_SELF.Params($page,
145     $edit ? array("edit" => $edit) : array()));
146     $tpl->assign("language", $language);
147     $tpl->assign("sifra", $sifra);
148     $tpl->assign("vars", $vars);
149     $tpl->assign("edit", $edit);
150     $tpl->assign("tecajevi", $tecajevi);
151     $tpl->assign("ustanove", $ustanove);
152     $tpl->assign("tecaj", $tecaj);
153     $tpl->assign("ustanova", $ustanova);
154     $tpl->assign("mjesto", $mjesto);
155     if ($dat_od_d && $dat_od_m && $dat_od_g) {
156     $tpl->assign("dat_od_d", $dat_od_d);
157     $tpl->assign("dat_od_m", $dat_od_m);
158     $tpl->assign("dat_od_g", $dat_od_g);
159     } else $tpl->assign("dat_od", $dat_od);
160     if ($dat_do_d && $dat_do_m && $dat_do_g) {
161     $tpl->assign("dat_do_d", $dat_do_d);
162     $tpl->assign("dat_do_m", $dat_do_m);
163     $tpl->assign("dat_do_g", $dat_do_g);
164     } else $tpl->assign("dat_do", $dat_do);
165     $tpl->assign("warning", $warning);
166     $pg = basename($PHP_SELF);
167     $pg = eregi_replace("\.php$", "", $pg);
168     $tpl->display("$pg-$language.tpl");
169     ?>

  ViewVC Help
Powered by ViewVC 1.1.26