/[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 by dpavlin, Tue Jul 4 08:45:32 2000 UTC revision 1.12.2.5 by dpavlin, Wed Aug 2 13:17:32 2000 UTC
# Line 14  Line 14 
14                          Odaberite Vaše ime i prezime:                          Odaberite Vaše ime i prezime:
15                          <select name="kontakt_osoba_id">';                          <select name="kontakt_osoba_id">';
16    
17                  $result = pg_Exec ($conn, "select id,ime,prezime from kontakt_osobe                  $sth = $dbh->prepare("select id,ime,prezime from kontakt_osobe
18                          where aktivna=true order by ime");                          where aktivna=true order by ime");
19                  for ($k = 0; $k < pg_numrows($result); $k++) {                  $sth->execute();
20                          $row=pg_fetch_array($result,$k);                  while ($row=$sth->fetchrow_hash()) {
21                          echo "<option value=\"$row[id]\"";                          echo "<option value=\"$row[id]\"";
22                          if ($row[id]==$kontakt_osoba_id) { echo " selected"; }                          if ($row[id]==$kontakt_osoba_id) { echo " selected"; }
23                          echo ">$row[ime] $row[prezime]</option>\n";                          echo ">$row[ime] $row[prezime]</option>\n";
# Line 26  Line 26 
26                          <input type=submit value="Posebno označi moje zahtjeve">                          <input type=submit value="Posebno označi moje zahtjeve">
27                          </form>';                          </form>';
28          } else {          } else {
29                  $result = pg_Exec ($conn, "select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id");                  $sth = $dbh->prepare("select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id");
30                  $row=pg_fetch_array($result,0);                  $sth->execute();
31                    $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 66  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    
71          echo '<br><small>Prikaži status zahtjeva za:          echo '<br><small>Prikaži status zahtjeva za:
72                  ',checkbox("shell",$shell),' shell                  ',checkbox("shell",$shell),' shell
73                  ',checkbox("podesavanje",$podesavanje),' podešavanje                  ',checkbox("podesavanje",$podesavanje),' podešavanje
# Line 76  Line 78 
78    
79          $on_page=50;          $on_page=50;
80    
81          $conn = pg_connect("dbname=informatika user=dpavlin");          $sql_polja="osobe.id as id,osobe.ime as ime,
82                    osobe.prezime as prezime,
83                  $sql_polja="osobe.id as id,osobe.ime as ime,                  org_jed.naziv||'<br><small>'||org_pod_jed.pod_naziv||'<small>' as orgjed,
84                          osobe.prezime as prezime,                  kontakt_osobe.ime||' '||kontakt_osobe.prezime as kontakt_osoba,
85                          org_jed.naziv||'<br><small>'||org_pod_jed.pod_naziv||'<small>' as orgjed,                  e_mail,kontakt_osoba_id
86                          kontakt_osobe.ime||' '||kontakt_osobe.prezime as kontakt_osoba,                  ";
87                          e_mail,kontakt_osoba_id          $sql_tablice="osobe,org_jed,kontakt_osobe,org_pod_jed";
88                          ";          $sql_where="org_jed.id=org_jed_id
89                  $sql_tablice="osobe,org_jed,kontakt_osobe";                  and org_pod_jed.pod_id=org_pod_jed_id
90                  $sql_where="org_jed.id=org_jed_id                  and kontakt_osoba_id=kontakt_osobe.id
91                          and org_pod_jed.pod_id=org_pod_jed_id                  ";
92                          and kontakt_osoba_id=kontakt_osobe.id          $sql_order="order by osobe.id";
                         ";  
                 $sql_order="order by id";  
93    
94          if (isset($sql_upit)) {          if (isset($sql_upit)) {
95                  switch($sql_upit) {                  switch($sql_upit) {
# Line 99  Line 99 
99                                  }                                  }
100                                  break;                                  break;
101                          case "order_ime":                          case "order_ime":
102                                  $sql_order="order by ime";                                  $sql_order="order by osobe.ime";
103                                  break;                                  break;
104                          case "order_prezime":                          case "order_prezime":
105                                  $sql_order="order by prezime";                                  $sql_order="order by osobe.prezime";
106                                  break;                                  break;
107                          case "novi_na_vrh":                          case "novi_na_vrh":
108                                  $sql_order="order by id desc";                                  $sql_order="order by osobe.id desc";
109                                  break;                                  break;
110                          case "umrezavanje":                          case "umrezavanje":
111                                  $sql_where.=" and umrezavanje is true";                                  $sql_where.=" and umrezavanje is true";
# Line 131  Line 131 
131    
132  #       echo "<pre>$sql</pre>";  #       echo "<pre>$sql</pre>";
133  #       echo "<pre>$sql_where</pre>";  #       echo "<pre>$sql_where</pre>";
134          $result = pg_Exec ($conn, "$sql");          $sth = $dbh->prepare("$sql");
135            $sth->execute();
136    
137          echo "<table border=1>          echo "<table border=1>
138                  <tr>                  <tr>
# Line 140  Line 141 
141                  <th>organizacijska jedinica</th>                  <th>organizacijska jedinica</th>
142                  <th>status zahtjeva</th>                  <th>status zahtjeva</th>
143                  <th>kontakt osoba</th>                  <th>kontakt osoba</th>
144                  <td><small>",pg_numrows($result),"</small></td>                  <td><small>",$sth->rows(),"</small></td>
145                  </tr>                  </tr>
146                  ";                  ";
147    
148          include("inc/print_bool2.inc");          include("inc/print_bool2.inc");
149    
150            $k=0;
151          for ($k = 0; $k < pg_numrows($result); $k++) {          while ($row=$sth->fetchrow_hash()) {
                 $row=pg_fetch_array($result,$k);  
152                  if ($k % 2 != 0) {                  if ($k % 2 != 0) {
153                          print "<tr>";                          print "<tr>";
154                  } else {                  } else {
155                          print '<tr bgcolor="#f0f0f0">';                          print '<tr bgcolor="#f0f0f0">';
156                  }                  }
157                    $k++;
158                  print "<td>";                  print "<td>";
159                  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) {
160                          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 163  Line 164 
164                  print "</td><td>$row[ime] $row[prezime]</td>                  print "</td><td>$row[ime] $row[prezime]</td>
165                          <td>$row[orgjed]</td><td>";                          <td>$row[orgjed]</td><td>";
166                                                    
167                  $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");                  $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");
168                  for ($l = 0; $l < pg_numrows($result1); $l++) {                  $sth1->execute();
169                          $row1=pg_fetch_array($result1,$l);                  while ($row1=$sth1->fetchrow_hash()) {
170                          print "<small>$row1[datum]</small> $row1[opis]<br>";                          print "<small>$row1[datum]</small> $row1[opis]<br>";
171                  }                  }
172                  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 200  Line 201 
201                  echo "&nbsp;&nbsp;";                  echo "&nbsp;&nbsp;";
202          }          }
203    
204          if (pg_numrows($result) >= $on_page) {          if ($sth->rows() >= $on_page) {
205                  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;";
206          } else {          } else {
207                  echo "&nbsp;&nbsp;";                  echo "&nbsp;&nbsp;";

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

  ViewVC Help
Powered by ViewVC 1.1.26