' . "\n";
} else {
$sqlG = sisplet_query("SELECT spr_id FROM srv_glasovanje WHERE ank_id='" . get('anketa') . "'");
$rowG = mysqli_fetch_array($sqlG);
$sql = sisplet_query("SELECT id FROM srv_grupa WHERE ank_id='" . get('anketa') . "' AND vrstni_red<'$vrstni_red' ORDER BY vrstni_red DESC LIMIT 1");
if (mysqli_num_rows($sql) > 0) {
$row = mysqli_fetch_array($sql);
$prev_grupa = $row['id'];
$sql = sisplet_query("SELECT id FROM srv_spremenljivka WHERE gru_id='$prev_grupa' AND stat>'0' ORDER BY vrstni_red ASC");
while ($row = mysqli_fetch_array($sql)) {
echo '
' . "\n";
}
}
}
} //navadna statistika
else {
$sql = sisplet_query("SELECT id FROM srv_grupa WHERE ank_id='" . get('anketa') . "' AND vrstni_red<'$vrstni_red' ORDER BY vrstni_red DESC LIMIT 1");
if (mysqli_num_rows($sql) > 0) {
$row = mysqli_fetch_array($sql);
$prev_grupa = $row['id'];
$sql = sisplet_query("SELECT id FROM srv_spremenljivka WHERE gru_id='$prev_grupa' AND stat='1' ORDER BY vrstni_red ASC");
while ($row = mysqli_fetch_array($sql)) {
echo '
' . "\n";
self::displayStat($row['id']);
echo '
' . "\n";
}
}
}
}
/**
* @desc prikaze statistike za odgovor
*/
public static function displayStat($spremenljivka, $spol = 0)
{
global $lang;
$row = Model::select_from_srv_spremenljivka($spremenljivka);
$text = $lang['results'];
echo '
' . $text . ': ' . $row['naslov'] . '
' . "\n";
$sql = sisplet_query("SELECT COUNT(*) AS count FROM srv_vrednost v, srv_data_vrednost" . get('db_table') . " d WHERE v.spr_id='$spremenljivka' AND v.id=d.vre_id");
$row = mysqli_fetch_array($sql);
$total = $row['count'];
$sql = sisplet_query("SELECT id, naslov FROM srv_vrednost WHERE spr_id='$spremenljivka' ORDER BY vrstni_red");
while ($row = mysqli_fetch_array($sql)) {
$sql1 = sisplet_query("SELECT COUNT(*) AS count FROM srv_data_vrednost" . get('db_table') . " WHERE vre_id='$row[id]'");
$row1 = mysqli_fetch_array($sql1);
if ($total > 0)
$procent = round($row1['count'] / $total, 3) * 100;
else
$procent = 0;
echo '
' . $row['naslov'] . ': ' . $procent . '%
' . "\n";
}
}
/**
* @desc prikaze statistiko za glasovanje
*/
public function displayStatGlasovanje($spremenljivka, $spol = 0)
{
global $lang;
global $site_url;
global $global_user_id;
$row = Model::select_from_srv_spremenljivka($spremenljivka);
//preverimo ce gre za glasovanje
$sql2 = sisplet_query("SELECT * FROM srv_glasovanje WHERE spr_id='$spremenljivka'");
$row2 = mysqli_fetch_array($sql2);
$sqla = sisplet_query("SELECT starts, expire, statistics, db_table FROM srv_anketa WHERE id ='$row2[ank_id]'");
$rowa = mysqli_fetch_array($sqla);
if ($rowa['db_table'] == 1)
save('db_table', '_active');
$text = $rowa['statistics'];
if ($text != '')
echo ' ' . $text . "\n";
else
echo ' ' . "\n";
if ($row2['show_title'] == 0)
echo ' ' . $row['naslov'] . '' . "\n";
else
echo ' ' . "\n";
$sql = sisplet_query("SELECT COUNT(*) AS count FROM srv_vrednost v, srv_data_vrednost" . get('db_table') . " d WHERE v.spr_id='$spremenljivka' AND v.id=d.vre_id");
$row = mysqli_fetch_array($sql);
$total = $row['count'];
$sql = sisplet_query("SELECT id, naslov FROM srv_vrednost WHERE spr_id='$spremenljivka' ORDER BY vrstni_red");
while ($row = mysqli_fetch_array($sql)) {
//prikaz statistike za moske(pri glasovanju)
if ($spol == 1) {
$sql1 = sisplet_query("SELECT COUNT(*) AS count FROM srv_data_vrednost" . get('db_table') . " v, srv_data_glasovanje g WHERE v.vre_id='$row[id]' AND v.usr_id=g.usr_id AND g.spr_id='$spremenljivka' AND g.spol='1' ");
$row1 = mysqli_fetch_array($sql1);
} //prikaz statistike za zenske(pri glasovanju)
elseif ($spol == 2) {
$sql1 = sisplet_query("SELECT COUNT(*) AS count FROM srv_data_vrednost" . get('db_table') . " v, srv_data_glasovanje g WHERE v.vre_id='$row[id]' AND v.usr_id=g.usr_id AND g.spr_id='$spremenljivka' AND g.spol='2' ");
$row1 = mysqli_fetch_array($sql1);
} else {
$sql1 = sisplet_query("SELECT COUNT(*) AS count FROM srv_data_vrednost" . get('db_table') . " WHERE vre_id='$row[id]'");
$row1 = mysqli_fetch_array($sql1);
}
if ($total > 0)
$procent = round($row1['count'] / $total, 3) * 100;
else
$procent = 0;
echo '
' . $row['naslov'] . ':' . "\n";
//ce gre za glasovanje in imamo nastavljen prikaz grafa ga izrisemo
if ($row2['show_graph'] == 1) {
echo '