function studentski_meni($fj) { global $userid, $sta, $registry; // Parametri potrebni za Moodle integraciju global $conf_moodle, $conf_moodle_url, $conf_moodle_db, $conf_moodle_prefix, $conf_moodle_reuse_connection, $conf_moodle_dbhost, $conf_moodle_dbuser, $conf_moodle_dbpass; global $conf_dbhost, $conf_dbuser, $conf_dbpass, $conf_dbdb; // Koji od interesantnih registry modula su aktivni $modul_uou = $modul_kolizija = $modul_prijava = $modul_prosjek = $modul_anketa = 0; foreach ($registry as $r) { if ($r[5] != 0) { continue; } // nevidljiv if ($r[0] == "student/ugovoroucenju") { $modul_uou = 1; } if ($r[0] == "student/kolizija") { $modul_kolizija = 1; } if ($r[0] == "student/prijava_ispita") { $modul_prijava = 1; } if ($r[0] == "student/prosjeci") { $modul_prosjek = 1; } if ($r[0] == "student/anketa") { $modul_anketa = 1; } } // Upit $q30 vraca predmete koje je student ikada slusao (arhiva=1) ili koje trenutno slusa (arhiva=0) $arhiva = intval($_REQUEST['sm_arhiva']); if ($arhiva == 1) { $sem_ispis = "Arhivirani predmeti"; $q30 = myquery("SELECT pk.id, p.naziv, pk.semestar, ag.naziv, p.id, ag.id, agp.tippredmeta\n\t\tFROM student_predmet as sp, ponudakursa as pk, predmet as p, akademska_godina as ag, akademska_godina_predmet as agp\n\t\tWHERE sp.student={$userid} AND sp.predmet=pk.id AND pk.predmet=p.id AND pk.akademska_godina=ag.id AND ag.id=agp.akademska_godina AND p.id=agp.predmet\n\t\tORDER BY ag.id, pk.semestar MOD 2 DESC, p.naziv"); } else { // Aktuelna akademska godina $q10 = myquery("select id,naziv from akademska_godina where aktuelna=1"); $ag = mysql_result($q10, 0, 0); // Studij koji student trenutno sluša $q20 = myquery("select studij,semestar from student_studij where student={$userid} and akademska_godina={$ag} order by semestar desc limit 1"); if (mysql_num_rows($q20) < 1) { $sem_ispis = "Niste upisani na studij!"; $q30 = myquery("SELECT * from student_studij where 1=0"); // dummy upit koji ne vraca ništa // Može li ovo bolje!? } else { $studij = mysql_result($q20, 0, 0); $semestar = mysql_result($q20, 0, 1); // Određujemo da li je aktuelni semestar parni ili neparni $semestar = $semestar % 2; if ($semestar == 1) { $sem_ispis = "Zimski semestar "; } else { $sem_ispis = "Ljetnji semestar "; } $sem_ispis .= mysql_result($q10, 0, 1) . ":"; $q30 = myquery("SELECT pk.id, p.naziv, pk.semestar, ag.naziv, p.id, ag.id, agp.tippredmeta\n\t\t\tFROM student_predmet as sp, ponudakursa as pk, predmet as p, akademska_godina as ag, akademska_godina_predmet as agp\n\t\t\tWHERE sp.student={$userid} AND sp.predmet=pk.id AND pk.predmet=p.id AND pk.akademska_godina={$ag} AND pk.semestar%2={$semestar} AND pk.akademska_godina=ag.id AND agp.akademska_godina={$ag} AND agp.predmet=p.id\n\t\t\tORDER BY p.naziv"); } } $ispis = '<table border="0" cellspacing="2" cellpadding="1">'; $oldsem = $oldag = 0; // Glavna petlja za generisanje ispisa while ($r30 = mysql_fetch_row($q30)) { $ponudakursa = $r30[0]; $predmet_naziv = $r30[1]; $predmet = $r30[4]; $pag = $r30[5]; $zimskiljetnji = $r30[2] % 2; $tippredmeta = $r30[6]; // Zaglavlje sa imenom akademske godine i semestrom if ($zimskiljetnji != $oldsem || $r30[3] != $oldag) { if ($r30[2] % 2 == 1) { $ispis .= "<tr><td colspan=\"2\"><br/><img src=\"images/fnord.gif\" width=\"1\" height=\"2\"><br/><b>Zimski semestar "; } else { $ispis .= "<tr><td colspan=\"2\"><br/><img src=\"images/fnord.gif\" width=\"1\" height=\"2\"><br/><b>Ljetnji semestar "; } $ispis .= $r30[3] . ":</b><br/><br/></td></tr>\n"; $oldsem = $zimskiljetnji; $oldag = $r30[3]; } // Ako je modul trenutno aktivan, boldiraj i prikaži meni if (intval($_REQUEST['predmet']) == $predmet && intval($_REQUEST['ag']) == $pag) { $ispis .= '<tr><td valign="top" style="padding-top:2px;"><img src="images/dole.png" align="bottom" border="0"></td>' . "\n<td>"; if ($tippredmeta == 1000) { $ispis .= "<a href=\"?sta=student/zavrsni&predmet={$predmet}&ag={$pag}&sm_arhiva={$arhiva}\">"; } else { if ($_REQUEST['sta'] != "student/predmet") { $ispis .= "<a href=\"?sta=student/predmet&predmet={$predmet}&ag={$pag}&sm_arhiva={$arhiva}\">"; } } $ispis .= "<b>{$predmet_naziv}</b>"; if ($_REQUEST['sta'] != "student/predmet") { $ispis .= "</a>"; } $ispis .= "<br/>\n"; // Studentski moduli aktivirani za ovaj predmet $q40 = myquery("select sm.gui_naziv, sm.modul, sm.novi_prozor from studentski_modul as sm, studentski_modul_predmet as smp where smp.predmet={$predmet} and smp.akademska_godina={$pag} and smp.aktivan=1 and smp.studentski_modul=sm.id order by sm.id"); while ($r40 = mysql_fetch_row($q40)) { $tip_forum = ""; if ($r40[0] == "Forum Komentari") { $tip_forum = "&tip=forum"; } if ($r40[1] == $_REQUEST['sta']) { $ispis .= " {$r40['0']}<br/>\n"; } else { if ($r40[2] == 1) { $ispis .= " <a href=\"?sta={$r40['1']}&predmet={$predmet}&ag={$pag}{$tip_forum}\" target=\"_blank\">{$r40['0']}</a><br/>\n"; } else { $ispis .= " <a href=\"?sta={$r40['1']}&predmet={$predmet}&ag={$pag}&sm_arhiva={$arhiva}\">{$r40['0']}</a><br/>\n"; } } } // Da li ima aktivna anketa i da li je istekao rok? if ($modul_anketa) { $q42 = myquery("select UNIX_TIMESTAMP(datum_zatvaranja) from anketa_anketa where aktivna=1"); if (mysql_num_rows($q42) != 0) { // da li uopce ima kreirana anketa ako ne , ne radi nista $rok = mysql_result($q42, 0, 0); if (time() < $rok) { $q42b = myquery("select id from anketa_anketa a where a.aktivna=1"); if (mysql_num_rows($q42b) > 0) { $ispis .= " <a href=\"?sta=student/anketa&predmet={$predmet}\">Anketa</a><br/>\n"; } } } } $ispis .= "</td></tr>\n"; } else { if ($tippredmeta == 1000) { $ispis .= '<tr><td valign="top" style="padding-top:2px;"><img src="images/lijevo.png" align="bottom" border="0"></td>' . "\n<td><a href=\"?sta=student/zavrsni&predmet={$predmet}&ag={$pag}&sm_arhiva={$arhiva}\">{$predmet_naziv}</a></td></tr>\n"; } else { $ispis .= '<tr><td valign="top" style="padding-top:2px;"><img src="images/lijevo.png" align="bottom" border="0"></td>' . "\n<td><a href=\"?sta=student/predmet&predmet={$predmet}&ag={$pag}&sm_arhiva={$arhiva}\">{$predmet_naziv}</a></td></tr>\n"; } } } $ispis .= "</table>\n"; ?> <table width="100%" border="0" cellspacing="4" cellpadding="0"> <tr><td valign="top"> <img src="images/fnord.gif" width="197" height="1"><br/><br/> <?php if ($sta != "student/intro") { ?> <a href="?sta=student/intro"><-- Nazad na početnu</a> <?php } else { ?> <?php } echo $ispis; ?> <br /> <?php if ($arhiva == 0) { ?> <a href="<?php echo genuri(); ?> &sm_arhiva=1">Prikaži arhivirane predmete</a> <?php } else { ?> <a href="<?php echo genuri(); ?> &sm_arhiva=0">Sakrij arhivirane predmete</a> <?php } ?> <br /><br /> <img src="images/plus.png" width="13" height="13" id="img-dokumenti" onclick="daj_stablo('dokumenti')"> <a href="#" onclick="daj_stablo('dokumenti'); return false;">Dokumenti</a><br /> <div id="dokumenti" style="display:none"> <a href="?sta=student/potvrda">Zahtjev za ovjereno uvjerenje</a> <i><font color="red">NOVO!</font></i><br /> <a href="?sta=izvjestaj/index&student=<?php echo $userid; ?> ">Uvjerenje o položenim predmetima</a><br /> <a href="?sta=izvjestaj/progress&student=<?php echo $userid; ?> &razdvoji_ispite=1">Pregled ostvarenog rezultata</a><br /> <?php if ($modul_uou) { ?> <a href="?sta=student/ugovoroucenju">Ugovor o učenju</a><br /> <?php } ?> <?php if ($modul_prijava) { ?> <a href="?sta=student/prijava_ispita">Prijava ispita</a><br /> <?php } ?> Promjena odsjeka <i><font color="red">USKORO!</font></i><br /> <?php if ($modul_kolizija) { ?> <a href="?sta=student/kolizija">Zahtjev za koliziju</a><br /> <?php } ?> <?php if ($modul_prosjek) { ?> <a href="?sta=student/prosjeci">Prosjeci po godinama</a><br /> <?php } ?> </div> <br /><br /> <?php // Prikaz poruka sa Moodle foruma if (isset($_REQUEST['predmet']) && isset($_REQUEST['ag']) && $conf_moodle) { // Varijabla komentariforum postaje ID predmeta koji je izabran $komentariforum = $_REQUEST['predmet']; $predmet = intval($_REQUEST['predmet']); $ag = intval($_REQUEST['ag']); $qsm = myquery("select aktivan from studentski_modul_predmet where predmet={$predmet} and akademska_godina={$ag}"); if (mysql_num_rows($qsm) > 0) { $aktivan_provjera = mysql_result($qsm, 0, 0); if ($aktivan_provjera == 1) { $q = myquery("select moodle_id from moodle_predmet_id where predmet={$predmet} and akademska_godina={$ag}"); // Uzimanje Moodle_ID ako je predmet povezan sa moodle if (mysql_num_rows($q) > 0) { $moodle_id = mysql_result($q, 0, 0); // Konekcija na bazu? if (!$conf_moodle_reuse_connection) { dbdisconnect(); dbconnect2($conf_moodle_dbhost, $conf_moodle_dbuser, $conf_moodle_dbpass, $conf_moodle_db); } // Citanje komentara iz Moodle Baze $query3 = "SELECT * FROM {$conf_moodle_db}.{$conf_moodle_prefix}" . "forum_discussions WHERE course={$moodle_id} order by timemodified desc LIMIT 0,4"; $rs3 = myquery($query3); ?> <table border="0" cellspacing="2" cellpadding="1"> <tr> <td colspan="2"> <br/><img src="images/16x16/komentar-plavi.png"> <b>Predmet komentari:</b><br/> </td> </tr> <tr> <td> <?php $provjerakomentara = 0; while ($numrows3 = mysql_fetch_array($rs3)) { $brojac = $brojac + 1; $idkom = $numrows3['id']; $kurs = $numrows3['course']; $vrijeme = $numrows3['timemodified']; $naziv = $numrows3['name']; $forum = $numrows3['forum']; $query4 = "SELECT * FROM {$conf_moodle_db}.{$conf_moodle_prefix}" . "forum WHERE id={$forum}"; $rs4 = myquery($query4); $numrows4 = mysql_fetch_array($rs4); $naziv_foruma = $numrows4['name']; //Ako postoji komentar ispisi ga if (!empty($naziv)) { $provjerakomentara++; print '<div style="padding:5px"><img src="images/16x16/komentar.png"/> <a target="_blank" href="' . $conf_moodle_url . 'mod/forum/discuss.php?d=' . $idkom . '">' . $naziv . '</a><br> [' . $naziv_foruma . ']<br></div>'; } } if ($provjerakomentara == 0) { print '<div style="padding:5px"><center>NEMA KOMENTARA!</a></center><br></div>'; } ?> </td> </tr> </table> <?php // Vraćamo Zamger konekciju if (!$conf_moodle_reuse_connection) { dbdisconnect(); dbconnect2($conf_dbhost, $conf_dbuser, $conf_dbpass, $conf_dbdb); } } } } } // Prikaz današnjeg datuma $dani = array("", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota", "Nedjelja"); $mjeseci = array("", "januar", "februar", "mart", "april", "maj", "juni", "juli", "avgust", "septembar", "oktobar", "novembar", "decembar"); print $dani[date("N", time())]; print ", " . date("j", time()) . ". " . $mjeseci[date("n", time())] . " " . date("Y", time()) . "."; ?> </td> <td width="1" bgcolor="#888888"><img src="images/fnord.gif" width="1" height="1"></td> <td width="5" bgcolor="#FFFFFF"><img src="images/fnord.gif" width="5" height="1"></td> <td width="100%" valign="top"> <?php eval($fj); ?> </td></tr> </table> <?php }
// v4.0.9.5 (2009/04/19) + Popravljen link na rezultate ispita // v4.0.9.6 (2009/04/29) + Prebacujem tabelu poruka (opseg 5) sa ponudekursa na predmet (neki studenti ce mozda dobiti dvije identicne poruke); jos uvijek koristena auth tabela za ime i prezime, sto spada u davnu historiju zamgera // v4.0.9.7 (2009/05/01) + Parametri modula student/predmet i student/zadaca su sada predmet i ag function z_substr($string, $start, $len) { do { $result = substr($string, $start, $len); $len++; } while (ord(substr($result, strlen($result) - 1, 1)) > 128); return $result; } $broj_poruka = 10; require "lib/libvedran.php"; require "lib/zamger.php"; require "lib/config.php"; dbconnect2($conf_dbhost, $conf_dbuser, $conf_dbpass, $conf_dbdb); // Parametri potrebni za Moodle integraciju global $conf_moodle, $conf_moodle_url, $conf_moodle_db, $conf_moodle_prefix, $conf_moodle_reuse_connection, $conf_moodle_dbhost, $conf_moodle_dbuser, $conf_moodle_dbpass; global $__lv_connection, $conf_use_mysql_utf8; // Pretvaramo rss id u userid $id = my_escape($_REQUEST['id']); $q1 = myquery("select auth from rss where id='{$id}'"); if (mysql_num_rows($q1) < 1) { print "Greska! Nepoznat RSS ID {$id}"; return 0; } $userid = mysql_result($q1, 0, 0); // Update timestamp $q2 = myquery("update rss set access=NOW() where id='{$id}'"); // Ime studenta $q5 = myquery("select ime,prezime from osoba where id={$userid}");
function dbconnect() { // Default database dbconnect2("localhost", "zamgerdemo", "zamgerdemo", "zamger"); }