/[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.6 by dpavlin, Fri Jun 2 06:05:08 2000 UTC revision 1.16 by dpavlin, Fri Jan 25 14:47:46 2002 UTC
# Line 1  Line 1 
1  <?  <?
2    
3          include("inc/head.inc");          include("inc/head.inc");
4            include("inc/prava.inc");
5            include("inc/checkbox.inc");
6            include("inc/sap_org_jed.inc");
7    
8          if (! isset($from)) {          if (! isset($from)) {
9                  $from=0;                  $from=0;
10                    $podesavanje="on"; $umrezavanje="on";
11          }          }
12    
13          if (! isset($kontakt_osoba_id) || ! intval($kontakt_osoba_id)!=0) {          if (! isset($kontakt_osoba_id) || ! intval($kontakt_osoba_id)!=0) {
# Line 23  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                  $result = pg_Exec ($conn, "select ime,prezime,passwd 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                  $row=pg_fetch_array($result,0);                  $row=pg_fetch_array($result,0);
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];
34          }          }
35    
36          function option($value,$text,$current) {          function option($value,$text,$current) {
# Line 36  Line 41 
41                  echo ">$text</option>";                  echo ">$text</option>";
42          }          }
43    
         function checkbox($name,$current) {  
                 echo "<input type=\"checkbox\" name=\"$name\"";  
                 if (isset($current)) {  
                         echo " checked";  
                 }  
                 echo ">";  
         }  
44    
45          if (! isset($sql_upit)) { $sql_upit="novi_na_vrh"; }          if (! isset($sql_upit)) { $sql_upit="novi_na_vrh"; }
46    
# Line 59  Line 57 
57                  option("novi_na_vrh","noviji na početak popisa",$sql_upit);                  option("novi_na_vrh","noviji na početak popisa",$sql_upit);
58                  option("order_ime","sortirano po imenu",$sql_upit);                  option("order_ime","sortirano po imenu",$sql_upit);
59                  option("order_prezime","sortirano po prezimenu",$sql_upit);                  option("order_prezime","sortirano po prezimenu",$sql_upit);
60                    option("umrezavanje","potrebno umrežavanje",$sql_upit);
61    
62          echo '  </select>          echo '  </select>
63                  <small><i>za opcije označenje zvjezdicom (*) prvo morate                  <small><i>za opcije označenje zvjezdicom (*) prvo morate
# Line 78  Line 77 
77    
78          $on_page=50;          $on_page=50;
79    
         $conn = pg_connect("dbname=informatika user=dpavlin");  
   
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,
                         org_jed.naziv||'<br><small>'||org_pod_jed.pod_naziv||'<small>' as orgjed,  
82                          kontakt_osobe.ime||' '||kontakt_osobe.prezime as kontakt_osoba,                          kontakt_osobe.ime||' '||kontakt_osobe.prezime as kontakt_osoba,
83                          e_mail,kontakt_osoba_id                          e_mail,kontakt_osoba_id,sifra
84                          ";                          ";
85                  $sql_tablice="osobe,org_jed,kontakt_osobe";                  $sql_tablice="osobe,kontakt_osobe";
86                  $sql_where="org_jed.id=org_jed_id                  $sql_where="
87                          and org_pod_jed.pod_id=org_pod_jed_id                          kontakt_osoba_id=kontakt_osobe.id
88                          and kontakt_osoba_id=kontakt_osobe.id                          and osobe.aktivna=true
89                          ";                          ";
90                  $sql_order="order by id";                  $sql_order="order by id";
91    
# Line 109  Line 105 
105                          case "novi_na_vrh":                          case "novi_na_vrh":
106                                  $sql_order="order by id desc";                                  $sql_order="order by id desc";
107                                  break;                                  break;
108                            case "umrezavanje":
109                                    $sql_where.=" and umrezavanje is true";
110                                    break;
111                  }                  }
112          }          }
113    
# Line 123  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>";
# Line 139  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>",pg_numrows($result),"</small></td>
148                  </tr>                  </tr>
149                  ";                  ";
150    
151          include("inc/print_bool.inc");          include("inc/print_bool2.inc");
152    
153    
154          for ($k = 0; $k < pg_numrows($result); $k++) {          for ($k = 0; $k < pg_numrows($result); $k++) {
155                  $row=pg_fetch_array($result,$k);                  $row=pg_fetch_array($result,$k);
# Line 152  Line 159 
159                          print '<tr bgcolor="#f0f0f0">';                          print '<tr bgcolor="#f0f0f0">';
160                  }                  }
161                  print "<td>";                  print "<td>";
162                  if ($row[kontakt_osoba_id]==$kontakt_osoba_id) {                  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>";
164                  } else {                  } else {
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                  $result1 = pg_Exec ($conn, "select datum,opis from status,status_tip where status.status_tip_id=status_tip.id and osoba_id=$row[id]");                  $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                  for ($l = 0; $l < pg_numrows($result1); $l++) {                  for ($l = 0; $l < pg_numrows($result1); $l++) {
172                          $row1=pg_fetch_array($result1,$l);                          $row1=pg_fetch_array($result1,$l);
173                          print "<small>$row1[datum]</small> $row1[opis]<br>";                          print "<small>$row1[datum]</small> $row1[opis]<br>";

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

  ViewVC Help
Powered by ViewVC 1.1.26