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

Annotation of /StraniJezici.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations)
Wed Jun 19 18:55:45 2002 UTC (17 years, 1 month ago) by ravilov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +4 -3 lines
...

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

  ViewVC Help
Powered by ViewVC 1.1.26