-
Notifications
You must be signed in to change notification settings - Fork 0
/
XML_returic_fakulteti.php
52 lines (33 loc) · 1.28 KB
/
XML_returic_fakulteti.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
<?php
include_once('Framework/glavniPHP.php');
if(!empty($_SESSION['korisnik']))
{
$fakultet = new fakultet();
$kolicinaStranica = 10;
if (isset($_GET['stranica']))
{
$_GET['stranica'] = $_GET['stranica'] - 1;
}
$prijavljeniKorisnik = $_SESSION['korisnik'];
$ukupno = sizeof(fakultet::preuzmiSveFakultete());
$offset = $_GET['stranica'] * $kolicinaStranica;
$stranice = ceil($ukupno / $kolicinaStranica);
$fakulteti = fakultet::preuzmiSveFakultete(""," LIMIT $kolicinaStranica OFFSET $offset");
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
$xml .= '<fakulteti>';
if(sizeof($fakulteti) >= 1)
{
foreach($fakulteti as $fakultet)
{
$xml .= '<fakultet idf="' . $fakultet->id_fakultet . '" nazivFakulteta="' . $fakultet->naziv . '" adresaFakulteta="' . $fakultet->adresa . '" tipPrijavljenog="'.$prijavljeniKorisnik->tip_korisnika.'" fakultetPrijavljenog="'.$prijavljeniKorisnik->fakultet.'"> </fakultet>';
}
}
$xml .= '<stranicenje brojStranica="' . $stranice . '"></stranicenje>';
$xml .= '</fakulteti>';
header("Content-Type: text/xml");
print $xml;
} else {
$smarty->assign("zabranjenPristup","Stranica ne sadrži nikakve podatke!");
$smarty->display("index.tpl");
}
?>