/[hr-web]/RadSRacunalom.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 /RadSRacunalom.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: +1 -1 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 if (isparam("wb_A")) $p = 100;
11 include("inc/conn.php");
12 DBOpen();
13 $del = 0;
14 reset($HTTP_GET_VARS);
15 while ($var = key($HTTP_GET_VARS)) {
16 next($HTTP_GET_VARS);
17 if (!eregi('^del_([0-9]+)$', $var, $match)) continue;
18 $del = $match[1];
19 }
20 reset($HTTP_POST_VARS);
21 while ($var = key($HTTP_POST_VARS)) {
22 next($HTTP_POST_VARS);
23 if (!eregi('^del_([0-9]+)$', $var, $match)) continue;
24 $del = $match[1];
25 }
26 if ($del) {
27 DBQuery("DELETE FROM edukacije WHERE (sifra=$del) AND (sif_radnika='$sifra') AND (sif_qualification=4)");
28 if (!$DBH->errstr && $edit != $del) unset($edit);
29 }
30 $warning = 0;
31 if ($update || $p != $page) {
32 if ($tecaj) {
33 if (!$warning) {
34 if ($edit)
35 DBQuery("UPDATE edukacije SET sif_tecaja=$tecaj WHERE (sifra=$edit) AND (sif_radnika='$sifra') AND (sif_qualification=4)");
36 else {
37 $id = DBQuery("SELECT MAX(sifra) FROM edukacije");
38 $id = $id[0][0] + 1;
39 DBQuery("INSERT INTO edukacije (sifra,sif_radnika,sif_tecaja,sif_qualification) VALUES ($id,'$sifra',$tecaj,4)");
40 }
41 }
42 } else if ($edit)
43 DBQuery("DELETE FROM edukacije WHERE (sifra=$edit) AND (sif_radnika='$sifra') AND (sif_qualification=4)");
44 if ($p != $page && !$warning && !$DBH->errstr) {
45 DBClose();
46 Header("Location: $pages[$p]".Params($p));
47 exit;
48 }
49 }
50 if (($new || $update) && !$warning && !$DBH->errstr)
51 unset($edit, $tecaj);
52 include("inc/util.php");
53 $rows = DBQuery("SELECT sifra, naziv FROM tecajevi WHERE (sif_qualification=4) AND (naziv<>'') AND (language='$language')");
54 $tecajevi = array();
55 for ($i = 0; $i < count($rows); $i++) {
56 list($sif, $naz) = $rows[$i];
57 array_push($tecajevi, array("id" => $sif,
58 "name" => HTML_Escape(Win_ISO($naz))));
59 }
60 usort($tecajevi, "sort_name");
61 $rows = DBQuery("SELECT sifra,sif_tecaja FROM edukacije WHERE (sif_radnika='$sifra') AND (sif_qualification=4)");
62 $vars = array();
63 $fnd = false;
64 for ($i = 0; $i < count($rows); $i++) {
65 list($id, $ap) = $rows[$i];
66 $ap2 = "";
67 for ($j = 0; $j < count($tecajevi); $j++) {
68 if ($tecajevi[$j]["id"] == $ap) {
69 $ap2 = $tecajevi[$j]["name"];
70 break;
71 }
72 }
73 $ap2 = nl2br($ap2);
74 nepoznato($ap2);
75 array_push($vars, array(
76 "id" => $id,
77 "link" => $PHP_SELF.Params($page, array("edit" => $id)),
78 "naziv" => $ap2,
79 ));
80 if ($edit && $edit == $id) {
81 if (!$warning) $tecaj = $ap;
82 $fnd = true;
83 }
84 }
85 if (!$fnd) unset($edit);
86 DBClose();
87 $tpl = new MySmarty($page, $edit ? array("edit" => $edit) : array());
88 $tpl->assign("vars", $vars);
89 $tpl->assign("edit", $edit);
90 $tpl->assign("tecajevi", $tecajevi);
91 $tpl->assign("tecaj", $tecaj);
92 $tpl->assign("warning", $warning);
93 $tpl->show();
94 ?>

  ViewVC Help
Powered by ViewVC 1.1.26