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

Diff of /Nagrade.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dpavlin, Fri Apr 20 08:25:32 2001 UTC revision 1.2 by dpavlin, Wed Apr 25 13:18:46 2001 UTC
# Line 24  Line 24 
24                  $del = $match[1];                  $del = $match[1];
25          }          }
26          if ($del) {          if ($del) {
                 unset($edit);  
27                  DBQuery("DELETE FROM nagrade WHERE (id=$del) AND (sif_radnika='$sifra')");                  DBQuery("DELETE FROM nagrade WHERE (id=$del) AND (sif_radnika='$sifra')");
28                    if (!$DBH->errstr && $edit == $del) unset($edit);
29          }          }
30          if ($godina && $godina < 1900)          YearFix($godina);
                 if ($godina <= 40) $godina += 2000; else $godina += 1900;  
31          $warning = 0;          $warning = 0;
32          if ($update || $p != $page) {          if ($update || $p != $page) {
33                  if ($naziv || $ustanova || $urucitelj || $godina) {                  if ($naziv || $ustanova || $urucitelj || $godina) {
# Line 45  Line 44 
44                          }                          }
45                  } else if ($edit)                  } else if ($edit)
46                          DBQuery("DELETE FROM nagrade WHERE (id=$edit) AND (sif_radnika='$sifra')");                          DBQuery("DELETE FROM nagrade WHERE (id=$edit) AND (sif_radnika='$sifra')");
47                  if ($p != $page && !$warning) {                  if ($p != $page && !$warning && !$DBH->errstr) {
48                          DBClose();                          DBClose();
49                          Header("Location: $pages[$p]".Params($p));                          Header("Location: $pages[$p]".Params($p));
50                          exit;                          exit;
51                  }                  }
52          }          }
53          if (($new || $update) && !$warning)          if (($new || $update) && !$warning && !$DBH->errstr)
54                  unset($edit, $naziv, $ustanova, $urucitelj, $godina);                  unset($edit, $naziv, $ustanova, $urucitelj, $godina);
55            include("inc/util.php");
56          $rows = DBQuery("SELECT sifra,naziv,grad FROM ustanove WHERE (language='$language')");          $rows = DBQuery("SELECT sifra,naziv,grad FROM ustanove WHERE (language='$language')");
57          $ustanove = array();          $ustanove = array();
58          for ($i = 0; $i < count($rows); $i++) {          for ($i = 0; $i < count($rows); $i++) {
# Line 61  Line 61 
61                  array_push($ustanove, array("id" => $sif,                  array_push($ustanove, array("id" => $sif,
62                          "name" => HTML_Escape(Win_ISO($naz))));                          "name" => HTML_Escape(Win_ISO($naz))));
63          }          }
64          $rows = DBQuery("SELECT id,naziv,sif_ustanove,urucitelj,godina FROM nagrade WHERE (sif_radnika='$sifra')");          usort($ustanove, "sort_name");
65            $rows = DBQuery("SELECT id,naziv,sif_ustanove,urucitelj,godina FROM nagrade WHERE (sif_radnika='$sifra') ORDER BY godina");
66          $vars = array();          $vars = array();
67          $fnd = false;          $fnd = false;
68          for ($i = 0; $i < count($rows); $i++) {          for ($i = 0; $i < count($rows); $i++) {
# Line 91  Line 92 
92                          "godina" => $god2                          "godina" => $god2
93                  ));                  ));
94                  if ($edit && $edit == $id) {                  if ($edit && $edit == $id) {
95                          $naziv = $naz;                          if (!$warning && !$DBH->errstr) {
96                          $ustanova = $ust;                                  $naziv = $naz;
97                          $urucitelj = $ur;                                  $ustanova = $ust;
98                          $godina = $god;                                  $urucitelj = $ur;
99                                    $godina = $god;
100                            }
101                          $fnd = true;                          $fnd = true;
102                  }                  }
103          }          }
104          if (!$fnd) unset($edit);          if (!$fnd) unset($edit);
105          DBClose();          DBClose();
106          include("inc/Smarty.class.php");          $tpl = new MySmarty($page, $edit ? array("edit" => $edit) : array());
         $tpl = new Smarty;  
         $tpl->template_dir = "./tpl";  
         $tpl->compile_dir = "./tpc";  
         $tpl->assign("action", $PHP_SELF.Params($page,  
                 $edit ? array("edit" => $edit) : array()));  
         $tpl->assign("language", $language);  
         $tpl->assign("sifra", $sifra);  
107          $tpl->assign("vars", $vars);          $tpl->assign("vars", $vars);
108          $tpl->assign("edit", $edit);          $tpl->assign("edit", $edit);
109          $tpl->assign("ustanove", $ustanove);          $tpl->assign("ustanove", $ustanove);
110          $tpl->assign("naziv", $naziv);          $tpl->assign("naziv", $naziv);
111          $tpl->assign("ustanova", $ustanova);          $tpl->assign("ustanova", $ustanova);
112            $tpl->assign("urucitelj", $urucitelj);
113          $tpl->assign("godina", $godina);          $tpl->assign("godina", $godina);
114          $tpl->assign("warning", $warning);          $tpl->assign("warning", $warning);
115          $pg = basename($PHP_SELF);          $tpl->show("$pg-$language.tpl");
         $pg = eregi_replace("\.php$", "", $pg);  
         $tpl->display("$pg-$language.tpl");  
116  ?>  ?>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.26