/[informatika.old]/html/lista.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 /html/lista.php

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

revision 1.12.2.5 by dpavlin, Wed Aug 2 13:17:32 2000 UTC revision 1.16 by dpavlin, Fri Jan 25 14:47:46 2002 UTC
# Line 3  Line 3 
3          include("inc/head.inc");          include("inc/head.inc");
4          include("inc/prava.inc");          include("inc/prava.inc");
5          include("inc/checkbox.inc");          include("inc/checkbox.inc");
6            include("inc/sap_org_jed.inc");
7    
8          if (! isset($from)) {          if (! isset($from)) {
9                  $from=0;                  $from=0;
# Line 14  Line 15 
15                          Odaberite Vaše ime i prezime:                          Odaberite Vaše ime i prezime:
16                          <select name="kontakt_osoba_id">';                          <select name="kontakt_osoba_id">';
17    
18                  $sth = $dbh->prepare("select id,ime,prezime from kontakt_osobe                  $result = pg_Exec ($conn, "select id,ime,prezime from kontakt_osobe
19                          where aktivna=true order by ime");                          where aktivna=true order by ime");
20                  $sth->execute();                  for ($k = 0; $k < pg_numrows($result); $k++) {
21                  while ($row=$sth->fetchrow_hash()) {                          $row=pg_fetch_array($result,$k);
22                          echo "<option value=\"$row[id]\"";                          echo "<option value=\"$row[id]\"";
23                          if ($row[id]==$kontakt_osoba_id) { echo " selected"; }                          if ($row[id]==$kontakt_osoba_id) { echo " selected"; }
24                          echo ">$row[ime] $row[prezime]</option>\n";                          echo ">$row[ime] $row[prezime]</option>\n";
# Line 26  Line 27 
27                          <input type=submit value="Posebno označi moje zahtjeve">                          <input type=submit value="Posebno označi moje zahtjeve">
28                          </form>';                          </form>';
29          } else {          } else {
30                  $sth = $dbh->prepare("select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id");                  $result = pg_Exec ($conn, "select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id");
31                  $sth->execute();                  $row=pg_fetch_array($result,0);
                 $row=$sth->fetchrow_hash();  
32                  print "<small>Trenutno ste prijavljeni kao $row[ime] $row[prezime], ako je to krivo odaberite <a href=\"$PHP_SELF?what=relogin\">ovaj link</a>.</small>";                  print "<small>Trenutno ste prijavljeni kao $row[ime] $row[prezime], ako je to krivo odaberite <a href=\"$PHP_SELF?what=relogin\">ovaj link</a>.</small>";
33                  $prava=$row[prava];                  $prava=$row[prava];
34          }          }
# Line 67  Line 67 
67          if (isset($kontakt_osoba_id)) {          if (isset($kontakt_osoba_id)) {
68                  echo '<input type=hidden name=kontakt_osoba_id value='.$kontakt_osoba_id.'>';                  echo '<input type=hidden name=kontakt_osoba_id value='.$kontakt_osoba_id.'>';
69          }          }
   
70          echo '<br><small>Prikaži status zahtjeva za:          echo '<br><small>Prikaži status zahtjeva za:
71                  ',checkbox("shell",$shell),' shell                  ',checkbox("shell",$shell),' shell
72                  ',checkbox("podesavanje",$podesavanje),' podešavanje                  ',checkbox("podesavanje",$podesavanje),' podešavanje
# Line 78  Line 77 
77    
78          $on_page=50;          $on_page=50;
79    
80          $sql_polja="osobe.id as id,osobe.ime as ime,                  $sql_polja="osobe.id as id,osobe.ime as ime,
81                  osobe.prezime as prezime,                          osobe.prezime as prezime,
82                  org_jed.naziv||'<br><small>'||org_pod_jed.pod_naziv||'<small>' as orgjed,                          kontakt_osobe.ime||' '||kontakt_osobe.prezime as kontakt_osoba,
83                  kontakt_osobe.ime||' '||kontakt_osobe.prezime as kontakt_osoba,                          e_mail,kontakt_osoba_id,sifra
84                  e_mail,kontakt_osoba_id                          ";
85                  ";                  $sql_tablice="osobe,kontakt_osobe";
86          $sql_tablice="osobe,org_jed,kontakt_osobe,org_pod_jed";                  $sql_where="
87          $sql_where="org_jed.id=org_jed_id                          kontakt_osoba_id=kontakt_osobe.id
88                  and org_pod_jed.pod_id=org_pod_jed_id                          and osobe.aktivna=true
89                  and kontakt_osoba_id=kontakt_osobe.id                          ";
90                  ";                  $sql_order="order by id";
         $sql_order="order by osobe.id";  
91    
92          if (isset($sql_upit)) {          if (isset($sql_upit)) {
93                  switch($sql_upit) {                  switch($sql_upit) {
# Line 99  Line 97 
97                                  }                                  }
98                                  break;                                  break;
99                          case "order_ime":                          case "order_ime":
100                                  $sql_order="order by osobe.ime";                                  $sql_order="order by ime";
101                                  break;                                  break;
102                          case "order_prezime":                          case "order_prezime":
103                                  $sql_order="order by osobe.prezime";                                  $sql_order="order by prezime";
104                                  break;                                  break;
105                          case "novi_na_vrh":                          case "novi_na_vrh":
106                                  $sql_order="order by osobe.id desc";                                  $sql_order="order by id desc";
107                                  break;                                  break;
108                          case "umrezavanje":                          case "umrezavanje":
109                                  $sql_where.=" and umrezavanje is true";                                  $sql_where.=" and umrezavanje is true";
# Line 124  Line 122 
122          }          }
123    
124          if (isset($imepr) && $imepr != "") {          if (isset($imepr) && $imepr != "") {
125                  $sql_where.=" and ( upper(toczs(osobe.ime)) like upper(toczs('$imepr')) or upper(toczs(osobe.prezime)) like upper(toczs('$imepr')) )";                  $sql_where.=
126                      "and (upper(toczs(osobe.prezime)) like upper(toczs('$imepr'))
127                      or upper(toczs(osobe.ime)) like upper(toczs('$imepr')))";
128          }          }
129    
130          $sql="select $sql_polja from $sql_tablice where $sql_where $sql_order limit $on_page,$from";          $sql="select $sql_polja
131                  from $sql_tablice
132                  where $sql_where
133                  $sql_order
134                  limit $on_page,$from";
135    
136  #       echo "<pre>$sql</pre>";  #       echo "<pre>$sql</pre>";
137  #       echo "<pre>$sql_where</pre>";  #       echo "<pre>$sql_where</pre>";
138          $sth = $dbh->prepare("$sql");          $result = pg_Exec ($conn, "$sql");
         $sth->execute();  
139    
140          echo "<table border=1>          echo "<table border=1>
141                  <tr>                  <tr>
# Line 141  Line 144 
144                  <th>organizacijska jedinica</th>                  <th>organizacijska jedinica</th>
145                  <th>status zahtjeva</th>                  <th>status zahtjeva</th>
146                  <th>kontakt osoba</th>                  <th>kontakt osoba</th>
147                  <td><small>",$sth->rows(),"</small></td>                  <td><small>",pg_numrows($result),"</small></td>
148                  </tr>                  </tr>
149                  ";                  ";
150    
151          include("inc/print_bool2.inc");          include("inc/print_bool2.inc");
152    
153          $k=0;  
154          while ($row=$sth->fetchrow_hash()) {          for ($k = 0; $k < pg_numrows($result); $k++) {
155                    $row=pg_fetch_array($result,$k);
156                  if ($k % 2 != 0) {                  if ($k % 2 != 0) {
157                          print "<tr>";                          print "<tr>";
158                  } else {                  } else {
159                          print '<tr bgcolor="#f0f0f0">';                          print '<tr bgcolor="#f0f0f0">';
160                  }                  }
                 $k++;  
161                  print "<td>";                  print "<td>";
162                  if ($row[kontakt_osoba_id]==$kontakt_osoba_id || isset($prava) && $prava==$pr_admin) {                  if ($row[kontakt_osoba_id]==$kontakt_osoba_id || isset($prava) && $prava==$pr_admin) {
163                          print "<a href=\"osoba.php?what=select-osoba&id=$row[id]\">$row[id]</a>";                          print "<a href=\"osoba.php?what=select-osoba&id=$row[id]\">$row[id]</a>";
# Line 162  Line 165 
165                          print "$row[id]";                          print "$row[id]";
166                  }                  }
167                  print "</td><td>$row[ime] $row[prezime]</td>                  print "</td><td>$row[ime] $row[prezime]</td>
168                          <td>$row[orgjed]</td><td>";                          <td><small>".sap_org_jed($row[sifra])."</small></td><td>";
169                                                    
170                  $sth1 = $dbh->prepare("select datum,opis from status,status_tip where status.status_tip_id=status_tip.id and osoba_id=$row[id] order by datum");                  $result1 = pg_Exec ($conn, "select datum,opis from status,status_tip where status.status_tip_id=status_tip.id and osoba_id=$row[id] order by datum");
171                  $sth1->execute();                  for ($l = 0; $l < pg_numrows($result1); $l++) {
172                  while ($row1=$sth1->fetchrow_hash()) {                          $row1=pg_fetch_array($result1,$l);
173                          print "<small>$row1[datum]</small> $row1[opis]<br>";                          print "<small>$row1[datum]</small> $row1[opis]<br>";
174                  }                  }
175                  print "</td><td><a href=\"mailto:$row[e_mail]\">$row[kontakt_osoba]</a><small>";                  print "</td><td><a href=\"mailto:$row[e_mail]\">$row[kontakt_osoba]</a><small>";
# Line 201  Line 204 
204                  echo "&nbsp;&nbsp;";                  echo "&nbsp;&nbsp;";
205          }          }
206    
207          if ($sth->rows() >= $on_page) {          if (pg_numrows($result) >= $on_page) {
208                  echo "<a href=$PHP_SELF?from=".($from+$on_page)."&sql_upit=$sql_upit>+</a>&nbsp;";                  echo "<a href=$PHP_SELF?from=".($from+$on_page)."&sql_upit=$sql_upit>+</a>&nbsp;";
209          } else {          } else {
210                  echo "&nbsp;&nbsp;";                  echo "&nbsp;&nbsp;";

Legend:
Removed from v.1.12.2.5  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.26