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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Wed Jun 19 18:32:42 2002 UTC (21 years, 10 months ago) by ravilov
Branch: MAIN
Changes since 1.3: +9 -8 lines
lotsa changes... :)

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 edukacije WHERE (sifra=$del) AND (sif_radnika='$sifra') AND (sif_qualification=3)");
27 if (!$DBH->errstr && $edit == $del) unset($edit);
28 }
29 $warning = 0;
30 if ($update || $p != $page) {
31 if ($naziv || $stupanj) {
32 if (!$warning) {
33 if (!$naziv) $warning = 1;
34 }
35 if (!$warning) {
36 if (!$stupanj) $warning = 2;
37 }
38 if (!$warning) {
39 if ($edit)
40 DBQuery("UPDATE edukacije SET sif_stranog_jezika=$naziv,stupanj_str_jezika=$stupanj WHERE (sif_radnika='$sifra') AND (sifra=$edit) AND (sif_qualification=3)");
41 else {
42 $id = DBQuery("SELECT MAX(sifra) FROM edukacije");
43 $id = $id[0][0] + 1;
44 DBQuery("INSERT INTO edukacije (sifra,sif_radnika,sif_qualification,sif_stranog_jezika,stupanj_str_jezika) VALUES ($id,'$sifra',3,$naziv,$stupanj)");
45 }
46 }
47 } else if ($edit)
48 DBQuery("DELETE FROM edukacije WHERE (sifra=$edit) AND (sif_radnika='$sifra') AND (sif_qualification=3)");
49 if ($p != $page && !$warning && !$DBH->errstr) {
50 DBClose();
51 Header("Location: $pages[$p]".Params($p));
52 exit;
53 }
54 }
55 if (($new || $update) && !$warning && !$DBH->errstr)
56 unset($edit, $naziv, $stupanj);
57 include("inc/util.php");
58 $rows = DBQuery("SELECT sifra,opis FROM strani_jezik WHERE (language='$language') AND (opis<>'')");
59 $jezici = array();
60 for ($i = 0; $i < count($rows); $i++) {
61 list($sif, $naz) = $rows[$i];
62 array_push($jezici, array("id" => $sif,
63 "name" => HTML_Escape(Win_ISO($naz))));
64 }
65 usort($jezici, "sort_name");
66 $rows = DBQuery("SELECT sifra,stupanj FROM stupanj_str_jezika WHERE (language='$language') AND (stupanj<>'')");
67 $stupnjevi = array();
68 for ($i = 0; $i < count($rows); $i++) {
69 list($sif, $naz) = $rows[$i];
70 array_push($stupnjevi, array("id" => $sif,
71 "name" => HTML_Escape(Win_ISO($naz))));
72 }
73 $rows = DBQuery("SELECT sifra,sif_stranog_jezika,stupanj_str_jezika FROM edukacije WHERE (sif_radnika='$sifra') AND (sif_qualification=3)");
74 DBClose();
75 $vars = array();
76 $fnd = false;
77 $efnd = false;
78 for ($i = 0; $i < count($rows); $i++) {
79 list($id, $jez, $stup) = $rows[$i];
80 # engleski
81 if ($jez == 1) $efnd = true;
82 $jez2 = "";
83 for ($j = 0; $j < count($jezici); $j++) {
84 if ($jezici[$j]["id"] == $jez) {
85 $jez2 = $jezici[$j]["name"];
86 break;
87 }
88 }
89 nepoznato($jez2);
90 $stup2 = "";
91 for ($j = 0; $j < count($stupnjevi); $j++) {
92 if ($stupnjevi[$j]["id"] == $stup) {
93 $stup2 = $stupnjevi[$j]["name"];
94 break;
95 }
96 }
97 nepoznato($stup2);
98 array_push($vars, array(
99 "id" => $id,
100 "link" => $PHP_SELF.Params($page, array("edit" => $id)),
101 "name" => $jez2,
102 "stupanj" => $stup2
103 ));
104 if ($edit && $edit == $id) {
105 if (!$warning && !$DBH->errstr) {
106 $naziv = $jez;
107 $stupanj = $stup;
108 }
109 if ($jez == 1) $efnd = false;
110 $fnd = true;
111 }
112 }
113 if (!$fnd) unset($edit);
114 $new = array();
115 for ($i = 0; $i < count($jezici); $i++) {
116 if ($efnd && $jezici[$i]["id"] == 1) continue;
117 if (!$efnd && $jezici[$i]["id"] != 1) continue;
118 array_push($new, $jezici[$i]);
119 }
120 $jezici = $new;
121 usort($vars, "sort_name");
122 $tpl = new MySmarty($page, $edit ? array("edit" => $edit) : array());
123 $tpl->assign("vars", $vars);
124 $tpl->assign("edit", $edit);
125 $tpl->assign("jezici", $jezici);
126 $tpl->assign("stupnjevi", $stupnjevi);
127 $tpl->assign("naziv", $naziv);
128 $tpl->assign("stupanj", $stupanj);
129 $tpl->assign("warning", $warning);
130 $tpl->show();
131 ?>

  ViewVC Help
Powered by ViewVC 1.1.26