-
Notifications
You must be signed in to change notification settings - Fork 0
/
prava.php
executable file
·229 lines (149 loc) · 7.25 KB
/
prava.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<html>
<head>
<meta charset="cp1250">
<script src="vendor/jquery.js"></script>
<script src="dist/js/uikit.min.js"></script>
<script src="js/jquery-2.1.1.js"></script>
<script src="js/jquery-ui-1.10.4.custom.js"></script>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css"
href="css/jquery-ui-1.10.4.custom.css" />
<link href="css/uikit.almost-flat.min.css" rel="stylesheet">
<script type="text/javascript" src="js/jquery-barcode.js"></script>
</head>
<body class="tm-background">
<nav class="tm-navbar uk-navbar uk-navbar-attached">
<div class="uk-container uk-container-center">
<a class="uk-navbar-brand uk-hidden-small" href="index.php"><img class="uk-margin uk-margin-remove" src="logoR.png" width="90" height="30" title="ROBOT" alt="ROBOT"></a>
<ul class="uk-navbar-nav uk-hidden-small">
<li class="uk-active"><a href="index.php">POÈETNA</a></li>
<li><a href="http://naserver">Sharepoint</a></li>
<li><a href="http://www.robot.hr">www.robot.hr</a></li>
</ul>
<a href="#tm-offcanvas" class="uk-navbar-toggle uk-visible-small" data-uk-offcanvas></a>
<div class="uk-navbar-brand uk-navbar-center uk-visible-small"><img src="logoR.png" width="90" height="30" title="Robot" alt="Robot"></div>
</div>
</nav>
<div class="tm-middle">
<div class="uk-container uk-container-center">
<div class="uk-grid" data-uk-grid-margin>
<div class="tm-sidebar uk-width-medium-1-5 uk-hidden-small">
<div class="uk-panel uk-panel-box-secondary">
<h3 class="uk-panel-title"></h3>
<ul class="uk-nav uk-nav-side" data-uk-nav>
<li class="uk-nav-header">info</li>
<li><a href="index.php">Stanje artikla na skladištima</a></li>
<li class="uk-nav-header">MAL. RAÈUNI</li>
<li><a href="po_artiklu2.php">Pretraga po artiklu</a></li>
<li><a href="racun_pu.php">Pretraga raèuna PU format</a></li>
<li><a href="racun_mp.php">Pretraga mal.raèuna </a></li>
<li class="uk-nav-header">POS BackOffice</li>
<li><a href="rekapitulacija_mal.php">Rekapitulacija Maloprodaje</a></li>
<li class="uk-nav-header">SUSTAV</li>
<li><a href="sustav_prava.php">Prava po djelatniku</a></li>
</ul>
</div>
</div>
<div class="tm-main uk-width-medium-4-5">
<article class="uk-article">
<img class="uk-align-medium-right" src="logoR.png" alt="">
<h1 class="uk-article-title">Prava po djelatnicima u SUstavu</h1>
<p class="uk-article-lead""></p>
<p class="uk-article-lead">.</p>
<?php
//set up mysql connection
$serverName = "192.168.50.13"; //serverName\instanceName
$connectionInfo = array("Database" => "SUSTAV", "UID" => "sa", "PWD" => "Robot2012");
$conn = sqlsrv_connect($serverName, $connectionInfo);
if ($conn) {
$radnik = sqlsrv_query($conn, "SELECT [Sifra_korisnika],[Naziv_korisnika] FROM [SUSTAV].[dbo].[KORISNIK]") ;
} else {
echo "Ne mogu se povezati na bazu.<br />";
die(print_r(sqlsrv_errors(), true));
}
?>
<form class="uk-form" method="post" action="prava.php">
<select name="radnik">
<option>Radnik</option>
<br>
<?php
//it fills the selectbox from mysql data
while ($row = sqlsrv_fetch_array($radnik)) {
//this the value that corrspond to the selected item of the user
echo ' <option value="' . $row['Sifra_korisnika'] . '"> ';
//this line will be visible to the user
echo $row['Naziv_korisnika'] . ' </option> ';
}
?>
</select>
<button class="uk-button uk-button-primary" name="submit" type="submit">Pokreni</button>
<?php
if (isset($_POST['submit'])) {
$djelatnik = $_POST['radnik'];
}
?>
</form>
<?php
?>
</article>
<hr class="uk-article-divider">
<div class="uk-panel uk-panel-box uk-panel-box-primary">
<?php
echo $djelatnik;
$pravo_po_korisniku = sqlsrv_query($conn, "select nazgr,tip,nivo,modul,nazprav, case when Vrijednost is null then 'N' else 'D' end
from (select mod=m.Sifra_modula, prav=p.Sifra_prava, grup=sifra_grupe, nazgr=Naziv_grupe, nivo=m.Nivo_modula,modul=m.Naziv_modula,
tip=sifra_tipa_baze, nazprav=p.naziv_prava
from prava p inner join modul m on (m.sifra_modula = p.sifra_modula ),
grupa) pr
left join prava_po_grupi pg on (pg.sifra_modula = pr.mod and pg.sifra_prava = pr.prav and pg.sifra_grupe = pr.grup)
join KORISNIK_U_GRUPI on (KORISNIK_U_GRUPI.Sifra_grupe = pr.grup)
join KORISNIK on (KORISNIK.Sifra_korisnika = KORISNIK_U_GRUPI.Sifra_korisnika)
where KORISNIK.Sifra_korisnika = '$djelatnik'
order by nivo,modul,nazprav") or die(sqlsrv_error());
$grupa= sqlsrv_query($conn, "SELECT dbo.KORISNIK_U_GRUPI.Sifra_grupe AS Sifra_gr, dbo.KORISNIK_U_GRUPI.Sifra_korisnika AS Korisnik, dbo.GRUPA.Naziv_grupe AS Naziv_gr
FROM dbo.KORISNIK_U_GRUPI INNER JOIN
dbo.GRUPA ON dbo.KORISNIK_U_GRUPI.Sifra_grupe = dbo.GRUPA.Sifra_grupe
WHERE (dbo.KORISNIK_U_GRUPI.Sifra_korisnika = '$djelatnik')") or die(sqlsrv_error());
//$modul = sqlsrv_query($conn,"
?>
<!--
//<input type="submit" class="uk-button" value="Print" onclick="printIframe(report);"/>
// <script>function printIframe(objFrame){ objFrame.focus(); objFrame.print(); bjFrame.save(); }</script>
// <iframe name="report" id="report" src=""></iframe> -->
</div>
<table class="uk-table uk-table-condensed uk-table-striped uk-table-hover">
<thead>
<tr>
<th>Djelatnik</th>
<th>Modul</th>
<th>Pravo</th>
</tr>
</thead>
<?php
while ($row = sqlsrv_fetch_array($pravo_po_korisniku, SQLSRV_FETCH_ASSOC)) {
echo "<tr>";
echo "<td>";
echo $row['nazgr'] ;
echo "</td>";
echo "<td>";
echo $row['tip'] ;
echo "</td>";
echo "<td>";
echo $row['modul'] ;
echo "</td>";
echo "<td>";
echo $row['nazprav'];
echo "</td>";
echo "<td>";
echo $row[''];
echo "</td>";
echo "</tr>";
}
sqlsrv_free_stmt($pravo_po_korisniku);
?>
</div>
</div>
</div>
</div>
</body>
<html>