anketa = $anketa;
SurveyInfo::getInstance()->SurveyInit($this->anketa);
UserSetting :: getInstance()->Init($global_user_id);
}
/**
* @desc prikaze vprasanje, uvod, zakljucek, statistiko v glasovanju
*/
function vprasanja() {
global $lang;
global $site_url;
global $admin_type;
$Branching = new Branching($this->anketa);
// naenkrat preberemo vse spremenljivke, da ne delamo queryja vsakic posebej
Cache::cache_all_srv_spremenljivka($this->anketa, true);
// enako za srv_branching
Cache::cache_all_srv_branching($this->anketa, true);
// cachiramo tudi srv_if
Cache::cache_all_srv_if($this->anketa);
// cache vseh spremenljivk
//$this->find_all_spremenljivka();
SurveyInfo::getInstance()->SurveyInit($this->anketa);
$rowA = SurveyInfo::getInstance()->getSurveyRow();
$Branching->survey_type = SurveyInfo::getInstance()->getSurveyColumn("survey_type");
echo '
'."\n\r";
if ($editmode == 0) {
// <-- Zgornja vrstica pri editiranju vprasanj ---
echo '
';
echo '
';
// variabla
echo '
';
echo $lang['srv_statistic_label'];
echo '
'."\n\r";
echo '
';
// prikažemo nastavitve vprasanja
$fullscreen = ( isset($_POST['fullscreen']) && $_POST['fullscreen'] != 'undefined') ? (int)$_POST['fullscreen'] : false;
echo '
'."\n\r";
echo '
';
/*if (!$fullscreen && false) {
// right spremenljivka icon menu
echo ' '."\n\r";
echo '';
} */
echo '
';
echo '
';
// --- Zgornja vrstica pri editiranju vprasanj -->
// <-- Editor teksta vprasanja ---
echo '
';
/*echo '
';*/
} else { // urejanje uvoda,zakljucka
// <-- Zgornja vrstica pri editiranju vprasanj ---
echo '
';
echo '
';
// variabla
echo '
';
echo $lang['srv_statistic_label'];
echo '
'."\n\r";
echo '
';
// prikažemo nastavitve vprasanja
$fullscreen = ( isset($_POST['fullscreen']) && $_POST['fullscreen'] != 'undefined') ? (int)$_POST['fullscreen'] : false;
echo '
'."\n\r";
echo ' '."\n\r";
echo '
';
if (!$fullscreen) {
// right spremenljivka icon menu
echo ' '."\n\r";
}
echo '
';
echo '
';
// --- Zgornja vrstica pri editiranju vprasanj -->
echo '
';
echo '
';
echo '
';
}
echo '
'."\n\r";
/*
//if ($row['statistics'] == '') {
// $text = $lang['results'];
//} else {
// $text = $row['statistics'];
//}
$text = $row['statistics'];
echo ' '."\n\r";
if ($editmode == 0) {
// <-- Zgornja vrstica pri editiranju vprasanj ---
echo '
';
echo '
';
// variabla
echo '
';
echo $lang['srv_statistics_edit'];
echo '
'."\n\r";
echo '
';
echo '
';
echo '
';
// --- Zgornja vrstica pri editiranju vprasanj -->
// <-- Editor teksta vprasanja ---
echo '
';
// --- Editor teksta vprasanja -->
echo '
';
}
else {
// <-- Zgornja vrstica pri editiranju vprasanj ---
echo '
';
echo '
';
// variabla
echo '
';
echo $lang['srv_statistics_edit'];
echo '
'."\n\r";
echo '
';
echo '
';
echo '
';
// --- Zgornja vrstica pri editiranju vprasanj -->
echo '
';
// --- Editor teksta vprasanja -->
echo '
';
echo '
';
}
echo '
'."\n\r";
*/
}
/**
* @desc pohendla ajax requeste
*/
function ajax () {
global $lang;
global $site_url;
if (isset ($_POST['results']))
$results = $_POST['results'];
if (isset ($_POST['spremenljivka']))
$spremenljivka = $_POST['spremenljivka'];
if (isset ($_POST['what']))
$what = $_POST['what'];
$displayExtra = (isset($_POST['displayExtra'])) ? $_POST['displayExtra'] : 0;
if ($_GET['a'] == 'glasovanje_settings') {
if($what == 'stat'){
sisplet_query("UPDATE srv_spremenljivka SET stat = '$results' WHERE id = '$spremenljivka'");
// ce vklopimo statistiko, izklopimo zakljucek
if($results != 0)
sisplet_query("UPDATE srv_anketa SET show_concl='0' WHERE id = '$this->anketa'");
else
sisplet_query("UPDATE srv_anketa SET show_concl='1' WHERE id = '$this->anketa'");
}
elseif($what == 'show_intro' || $what == 'show_concl' || $what == 'cookie' || $what == 'user_from_cms' || $what == 'block_ip' || $what == 'starts' || $what == 'expire' || $what == 'vote_limit' || $what == 'vote_count' || $what == 'countType' || $what == 'progressbar') {
sisplet_query("UPDATE srv_anketa SET $what = '$results' WHERE id = '$this->anketa'");
}
elseif($what == 'survey_hide_title') {
SurveySetting::getInstance()->Init($this->anketa);
SurveySetting::getInstance()->setSurveyMiscSetting('survey_hide_title', $results);
}
elseif($what == 'finish_author' || $what == 'finish_respondent_cms' || $what == 'finish_other' | $what == 'finish_other_emails') {
sisplet_query("INSERT INTO srv_alert (ank_id, $what) VALUES ('$this->anketa', '$results')
ON DUPLICATE KEY UPDATE $what = '$results' ");
//sisplet_query("UPDATE srv_alert SET $what = '$results' WHERE ank_id = '$this->anketa'");
}
elseif($what == 'akronim') {
if($results == 0)
sisplet_query("UPDATE srv_anketa SET $what = ' ' WHERE id = '$this->anketa'");
elseif($results == 1)
sisplet_query("UPDATE srv_anketa SET $what = '' WHERE id = '$this->anketa'");
else
sisplet_query("UPDATE srv_anketa SET $what = '$lang[poll]' WHERE id = '$this->anketa'");
}
elseif($what == 'skin_anketa') {
sisplet_query("UPDATE srv_anketa SET skin = '$results' WHERE id = '$this->anketa'");
}
elseif($what == 'embed'){
sisplet_query("UPDATE srv_glasovanje SET $what = '$results' WHERE spr_id = '$spremenljivka'");
$rowS = Cache::srv_spremenljivka($spremenljivka);
if($results == 1 && $rowS['stat'] == 0){
// updatamo skin, ne prikazemo gumba konec, vklopimo zakljucek
$url = SurveyInfo::getSurveyLink();
sisplet_query("UPDATE srv_anketa SET skin='Embed', concl_link='0', url='', concl_end_button='0', concl_back_button='0', show_concl='1' WHERE id = '$this->anketa'");
}
elseif($results == 1 && $rowS['stat'] > 0){
sisplet_query("UPDATE srv_anketa SET skin='Embed', concl_link='0', url='', concl_end_button='0', concl_back_button='0' WHERE id = '$this->anketa'");
}
else{
sisplet_query("UPDATE srv_anketa SET skin='Default', concl_end_button='1', concl_back_button='1' WHERE id = '$this->anketa'");
}
}
else{
sisplet_query("UPDATE srv_glasovanje SET $what = '$results' WHERE spr_id = '$spremenljivka'");
}
if($what == 'spol'){
//ustvarimo vprasanje za spol
if($results == 1){
$sqlGrupe = sisplet_query("SELECT id, naslov FROM srv_grupa g WHERE g.ank_id='$this->anketa' ORDER BY g.vrstni_red");
$rowGrupe = mysqli_fetch_assoc($sqlGrupe);
$grupa = $rowGrupe['id'];
//ustvarimo v bazi novo spremenljivko
$b = new Branching($this->anketa);
$spr_id = $b->nova_spremenljivka($grupa, 1, 1);
$sqlSpr = sisplet_query("UPDATE srv_spremenljivka SET size='2', naslov='Spol', vrstni_red='2' WHERE id='$spr_id'");
//dodamo 2 vrednosti (moski in zenska)
$sql = sisplet_query("DELETE FROM srv_vrednost WHERE spr_id='$spr_id'");
$sql = sisplet_query("INSERT INTO srv_vrednost (id, spr_id, naslov, variable, vrstni_red, other) VALUES ('', '$spr_id', 'Moški', 'M', '1', '')");
$sql = sisplet_query("INSERT INTO srv_vrednost (id, spr_id, naslov, variable, vrstni_red, other) VALUES ('', '$spr_id', 'Ženska', 'Ž', '2', '')");
}
//zbrisemo vprasanje za spol
else{
$sqlS = sisplet_query("SELECT s.id FROM srv_spremenljivka s, srv_grupa g WHERE g.ank_id='$this->anketa' AND s.gru_id=g.id AND s.vrstni_red='2'");
$rowS = mysqli_fetch_array($sqlS);
$spr_id = $rowS['id'];
//pobrisemo iz baze spremenljivko
$sql = sisplet_query("DELETE FROM srv_vrednost WHERE spr_id='$spr_id'");
$sql = sisplet_query("DELETE FROM srv_spremenljivka WHERE id='$spr_id'");
}
}
// Vsilimo refresh podatkov
SurveyInfo :: getInstance()->resetSurveyData();
$this->display_glasovanje_settings($displayExtra);
}
else if ($_GET['a'] == 'glasovanje_vprasanja') {
$this->vprasanja();
}
}
}
?>