summaryrefslogtreecommitdiffstats
path: root/admin/survey/BranchingAjax.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/survey/BranchingAjax.php')
-rw-r--r--admin/survey/BranchingAjax.php430
1 files changed, 218 insertions, 212 deletions
diff --git a/admin/survey/BranchingAjax.php b/admin/survey/BranchingAjax.php
index 4ab75e6..81d035d 100644
--- a/admin/survey/BranchingAjax.php
+++ b/admin/survey/BranchingAjax.php
@@ -72,23 +72,34 @@ class BranchingAjax {
}
+ //generira blok (dropdown in menu) za missinge za kategorije
+ function ajax_get_missing_block () {
+ global $lang;
+
+ $b = new Branching($this->anketa);
+ $b->missings_menu($this->spremenljivka);
+ }
+
function ajax_if_new ($spremenljivka = null, $if = null, $endif = null, $tip = null) {
- Common::getInstance()->Init($this->anketa);
- Common::getInstance()->updateEditStamp();
global $lang;
+
+ Common::getInstance()->Init($this->anketa);
+ Common::getInstance()->updateEditStamp();
- if ($spremenljivka == null) $spremenljivka = $_POST['spremenljivka'];
- if ($if == null) $if = $_POST['if'];
- if ($endif == null) $endif = $_POST['endif'];
- if ($tip == null) $tip = $_POST['tip'];
- $copy = $_POST['copy'];
- $no_content = $_POST['no_content'];
+ $spremenljivka = (isset($_POST['spremenljivka']) && $spremenljivka == null) ? $_POST['spremenljivka'] : $spremenljivka;
+ $if = (isset($_POST['if']) && $if == null) ? $_POST['if'] : $if;
+ $endif = (isset($_POST['endif']) && $endif == null) ? $_POST['endif'] : $endif;
+ $tip = (isset($_POST['tip']) && $tip == null) ? $_POST['tip'] : $tip;
+
+ $copy = isset($_POST['copy']) ? $_POST['copy'] : 0;
+ $no_content = isset($_POST['no_content']) ? $_POST['no_content'] : 0;
$include_element = false;
$b = new Branching($this->anketa);
+
if ($spremenljivka >= 0 || $if >= 0) {
$sqln = sisplet_query("SELECT MAX(i.number) AS number FROM srv_if i, srv_branching b WHERE b.ank_id='$this->anketa' AND b.element_if=i.id");
@@ -118,9 +129,9 @@ class BranchingAjax {
// ce je blok Demografija na zadnjem mestu v anketi, potem pri "dodajanju na konec" dodamo pred demografijo --da je demografija vedno na koncu
$sqld = sisplet_query("SELECT b.element_if, b.vrstni_red FROM srv_if i, srv_branching b
- WHERE i.label = '$lang[srv_demografija]' AND i.tip='1' AND b.ank_id='$this->anketa' AND b.element_if=i.id AND parent='0' AND b.vrstni_red = (
- SELECT MAX(vrstni_red) FROM srv_branching WHERE ank_id='$this->anketa' AND parent = '0'
- )");
+ WHERE i.label = '$lang[srv_demografija]' AND i.tip='1' AND b.ank_id='$this->anketa' AND b.element_if=i.id AND parent='0'
+ AND b.vrstni_red = (SELECT MAX(vrstni_red) FROM srv_branching WHERE ank_id='$this->anketa' AND parent = '0')
+ ");
if (mysqli_num_rows($sqld) > 0) {
$rowd = mysqli_fetch_array($sqld);
@@ -196,13 +207,20 @@ class BranchingAjax {
Common::getInstance()->Init($this->anketa);
Common::getInstance()->updateEditStamp();
- if ($spremenljivka == null) $spremenljivka = $_POST['spremenljivka'];
- if ($if == null) $if = $_POST['if'];
- if ($endif == null) $endif = $_POST['endif'];
- if ($copy == null) $copy = $_POST['copy'];
- if ($drop == null) $drop = $_POST['drop'];
- if ($tip == null) $tip = $_POST['tip'];
- if ($podtip == null) $podtip = $_POST['podtip'];
+ if ($spremenljivka == null && isset($_POST['spremenljivka']))
+ $spremenljivka = $_POST['spremenljivka'];
+ if ($if == null && isset($_POST['if']))
+ $if = $_POST['if'];
+ if ($endif == null && isset($_POST['endif']))
+ $endif = $_POST['endif'];
+ if ($copy == null && isset($_POST['copy']))
+ $copy = $_POST['copy'];
+ if ($drop == null && isset($_POST['drop']))
+ $drop = $_POST['drop'];
+ if ($tip == null && isset($_POST['tip']))
+ $tip = $_POST['tip'];
+ if ($podtip == null && isset($_POST['podtip']))
+ $podtip = $_POST['podtip'];
if ($tip == 23) {
$copy = $podtip;
@@ -459,21 +477,23 @@ class BranchingAjax {
Common::getInstance()->updateEditStamp();
if(!$API_call){
- $child = $_POST['child'];
$parent = $_POST['parent'];
-
$tmp_p = str_replace('droppable_', '', $parent);
$tmp_p = explode('-', $tmp_p);
- $parent = $tmp_p[0];
- $vrstni_red = (int)$tmp_p[1];
- $page_break = (int)$tmp_p[2];
+
+ $parent = isset($tmp_p[0]) ? $tmp_p[0] : $parent;
+ $vrstni_red = isset($tmp_p[1]) ? $tmp_p[1] : $vrstni_red;
+ $page_break = isset($tmp_p[2]) ? $tmp_p[2] : $page_break;
+
+ $child = $_POST['child'];
$child = str_replace('branching_', '', $child);
}
$b = new Branching($this->anketa);
-
+
// droppal smo spremenljivko
- if (is_numeric($parent) && $child > 0) {
+ if (is_numeric($parent) && is_numeric($child) && $child > 0) {
+
if ($b->check_dropped_spremenljivka($child, $parent, $vrstni_red)) {
$sql = sisplet_query("SELECT pagebreak FROM srv_branching WHERE element_spr = '$child'");
@@ -510,7 +530,8 @@ class BranchingAjax {
}
// ce je za spremenljivko page break, ga moramo ohraniti tam, kjer je
- } elseif ($row['pagebreak'] == 1) { /*echo '$row[pb] == 1';*/
+ }
+ elseif ($row['pagebreak'] == 1) { /*echo '$row[pb] == 1';*/
$s = sisplet_query("SELECT element_spr FROM srv_branching WHERE parent='$parent' AND vrstni_red>='$vrstni_red' AND ank_id='$this->anketa' ORDER BY vrstni_red ASC LIMIT 1");
$r = mysqli_fetch_array($s);
@@ -532,7 +553,6 @@ class BranchingAjax {
} /*else echo ' no';*/
Cache::clear_branching_cache(); // drugace se polje pagebreak zakesira pri prikazu
-
}
// na zadnjem mestu vedno popravimo, da ni pagebreaka (ker je nepotreben in lahko kasneje ko se premika kaj pokvari)
@@ -541,17 +561,15 @@ class BranchingAjax {
// -- nastavljanje pagebreakov //
-
- //$b->repare_branching($row['parent']);
- //$b->repare_branching($parent);
$b->repare_branching();
- } else $b->dropped_alert();
-
- // droppal smo if ali endif
- } else {
-
- $child = str_replace('if', '', $child);
+ }
+ else
+ $b->dropped_alert();
+ }
+ // droppal smo if ali endif
+ else {
+ $child = str_replace('if', '', $child);
// droppal smo if
if (is_numeric($child)) {
@@ -672,13 +690,14 @@ class BranchingAjax {
Common::getInstance()->Init($this->anketa);
Common::getInstance()->updateEditStamp();
- if ($if == 0)
- $if = $_POST['if'];
+ $if = ($if == 0 && isset($_POST['if'])) ? $_POST['if'] : $if;
- if ($_POST['all'] == 1) $all = 1; else $all = 0; // ali brisemo tudi celotno vsebino pogoja/bloka
-
+ // ali brisemo tudi celotno vsebino pogoja/bloka
+ $all = (isset($_POST['all']) && $_POST['all'] == 1) ? 1 : 0;
+
$b = new Branching($this->anketa);
+
if ($if > 0) {
// preverimo, ce obstajajo ze podatki za spremenljivko - v tem primeru damo dodaten error
@@ -694,11 +713,12 @@ class BranchingAjax {
echo '<div class="popup_close"><a href="#" onClick="$(\'#dropped_alert\').hide(); $(\'#fade\').fadeOut(); return false;">✕</a></div>';
echo '<p>'.$lang['if_delete_data'].'</p>';
- echo '<p>'.$lang['srv_brisiifconfirm_all'].'</p><br />';
+ echo '<p class="top16">'.$lang['srv_brisiifconfirm_all'].'</p>';
- echo '<span class="buttonwrapper floatRight"><a class="ovalbutton ovalbutton_orange" href="#" onclick="if_remove(\''.$if.'\', \'1\'); return false;"><span>'.$lang['srv_if_rem_all'].'</span></a></span>';
- echo '<span class="buttonwrapper floatRight spaceRight"><a class="ovalbutton ovalbutton_gray" href="#" onclick="$(\'#dropped_alert\').hide(); $(\'#fade\').fadeOut(); return false;"><span>'.$lang['srv_analiza_arhiviraj_cancle'].'</span></a></span>';
- //echo '<p><a href="#" onclick="if_remove(\''.$if.'\', \'1\'); return false;">'.$lang['srv_if_rem_all'].'</a> <a href="#" onclick="$(\'#dropped_alert\').hide(); $(\'#fade\').fadeOut(); return false;">'.$lang['srv_analiza_arhiviraj_cancle'].'</a></p>';
+ echo '<div class="button_holder">';
+ echo ' <button class="medium white-blue" onclick="$(\'#dropped_alert\').hide(); $(\'#fade\').fadeOut(); return false;">'.$lang['srv_analiza_arhiviraj_cancle'].'</button>';
+ echo ' <button class="medium blue" onclick="if_remove(\''.$if.'\', \'1\'); return false;">'.$lang['srv_if_rem_all'].'</button>';
+ echo '</div>';
return;
}
@@ -865,14 +885,14 @@ class BranchingAjax {
Common::getInstance()->updateEditStamp();
}
- $text = $_POST['text'];
- $operator = $_POST['operator'];
- $negation = $_POST['negation'];
- $conjunction = $_POST['conjunction'];
- $vrednost = $_POST['vrednost'];
- $condition = $_POST['condition'];
- $spremenljivka = $_POST['spremenljivka'];
- $ostanek = $_POST['ostanek'];
+ $text = isset($_POST['text']) ? strip_tags($_POST['text']) : '';
+ $operator = isset($_POST['operator']) ? $_POST['operator'] : '';
+ $negation = isset($_POST['negation']) ? $_POST['negation'] : '';
+ $conjunction = isset($_POST['conjunction']) ? $_POST['conjunction'] : '';
+ $vrednost = isset($_POST['vrednost']) ? $_POST['vrednost'] : '';
+ $condition = isset($_POST['condition']) ? $_POST['condition'] : '';
+ $spremenljivka = isset($_POST['spremenljivka']) ? $_POST['spremenljivka'] : '';
+ $ostanek = isset($_POST['ostanek']) ? $_POST['ostanek'] : '';
//$vrednost = explode(',', $vrednost);
@@ -1080,7 +1100,7 @@ class BranchingAjax {
}
$if = $_POST['if'];
- $label = $_POST['label'];
+ $label = strip_tags($_POST['label']);
sisplet_query("UPDATE srv_if SET label='$label' WHERE id = '$if'");
}
@@ -1315,16 +1335,8 @@ class BranchingAjax {
function ajax_condition_editing_close () {
- $if_nova = $_POST['if_nova'];
$if = $_POST['if'];
- // tega ni vec
- /*if ($if_nova > 0) {
- echo '<script type="text/javascript">
- spremenljivka_new(\'0\', \''.$if_nova.'\', \'1\');
- </script>';
- }*/
-
$b = new Branching($this->anketa);
$b->display_if_label($if);
}
@@ -1418,12 +1430,6 @@ class BranchingAjax {
echo $row['id'];
}
- function ajax_get_new_if () {
- $sql = sisplet_query("SELECT * FROM misc WHERE what='new_if_$this->anketa'");
- $row = mysqli_fetch_array($sql);
- echo $row['value'];
- }
-
function ajax_if_collapsed () {
Common::updateEditStamp();
@@ -1459,7 +1465,7 @@ class BranchingAjax {
$id = $_POST['id'];
$text = $_POST['text'];
- $opomba = $_POST['opomba'];
+ $opomba = strip_tags($_POST['opomba']);
if ($id == -1) {
sisplet_query("UPDATE srv_anketa SET introduction='$text', intro_opomba='$opomba' WHERE id='$this->anketa'");
@@ -1610,20 +1616,24 @@ class BranchingAjax {
// ce je vse ok, preverimo se imena variabel (vprasanj in variabel znotraj vprasanj)
if ($code === true)
$code = $b->check_variable();
+
+ // ce je vse ok, preverimo se vrednosti stolpcev v gridu (ce je slucajno kaksna prazna)
+ if ($code === true)
+ $code = $b->check_grid_value();
// pogoji so ok
if ($code === true) {
if ($_GET['izpis'] == 'long') {
- echo '<p style="text-align: center"><b>'.$lang['srv_check_pogoji_ok'].'!</b></p>';
+
+ echo '<h2>'.$lang['srv_check_pogoji_ok2'].'</h2>';
+ echo '<div class="popup_close"><a href="#" onClick="$(\'#check_pogoji\').fadeOut(\'slow\'); $(\'#fade\').fadeOut(\'slow\');">✕</a></div>';
+
+ echo '<p>'.$lang['srv_check_pogoji_ok'].'!</p>';
- ?>
- <script>
- $(function () {
- $('#check_pogoji').animate({opacity: 1.0}, 3000).fadeOut('slow');
- $('#fade').fadeOut("slow");
- })
- </script>
- <?php
+ echo '<div class="button_holder">';
+ echo '<button class="medium blue" onClick="$(\'#check_pogoji\').fadeOut(\'slow\'); $(\'#fade\').fadeOut(\'slow\');">'.$lang['srv_zapri'].'</button>';
+ echo '</div>';
+
} else {
echo '1';
}
@@ -1640,39 +1650,49 @@ class BranchingAjax {
echo '<h2>'.$lang['srv_duplicate_question_variable'].'</h2>';
elseif ($code['type'] == 'variable')
echo '<h2>'.$lang['srv_duplicate_variables'].'</h2>';
+ elseif ($code['type'] == 'grid_value')
+ echo '<h2>'.$lang['srv_empty_grid_values'].'</h2>';
+
echo '<div class="popup_close"><a href="#" onClick="$(\'#check_pogoji\').fadeOut(\'slow\'); $(\'#fade\').fadeOut(\'slow\');">✕</a></div>';
// napaka v ifih
if ($code['type'] == 'if') {
$sql = sisplet_query("SELECT id, number FROM srv_if WHERE id = '$code[id]'");
$row = mysqli_fetch_array($sql);
- echo '<p>'.$lang['srv_check_pogoji_if'].' <a href="javascript:condition_editing(\''.$row['id'].'\');"><b>'.$row['number'].'</b></a></p>';
-
+ echo '<p class="bottom16">'.$lang['srv_check_pogoji_if'].' <a class="noline" href="javascript:condition_editing(\''.$row['id'].'\');$(\'#check_pogoji\').fadeOut(\'slow\');popupClose();"><b>'.$row['number'].'</b></a>.</p>';
+ }
// napaka v podifih, ki so nastavljeni na vrednosti spremenljivk
- } elseif ($code['type'] == 'podif') {
+ elseif ($code['type'] == 'podif') {
$sql = sisplet_query("SELECT id, naslov, variable FROM srv_spremenljivka WHERE id = '$code[id]'");
$row = mysqli_fetch_array($sql);
- echo '<p>'.$lang['srv_check_pogoji_spremenljivka'].': <b><a href="javascript:vprasanje_fullscreen(\''.$row['id'].'\');">'.$row['variable'].' - '.strip_tags($row['naslov']).'</a></b></p>';
-
+ echo '<p>'.$lang['srv_check_pogoji_spremenljivka'].': <b><a href="javascript:vprasanje_fullscreen(\''.$row['id'].'\');$(\'#check_pogoji\').fadeOut(\'slow\');popupClose();">'.$row['variable'].' - '.strip_tags($row['naslov']).'</a></b></p>';
+ }
// napaka z gnezdenjem loopov
- } elseif ($code['type'] == 'loop') {
+ elseif ($code['type'] == 'loop') {
$sql = sisplet_query("SELECT id, number FROM srv_if WHERE id = '$code[id]'");
$row = mysqli_fetch_array($sql);
- echo '<p>'.$lang['srv_check_pogoji_loop'].' <a href="javascript:condition_editing(\''.$row['id'].'\');"><b>'.$row['number'].'</b></a></p>';
-
- } elseif ($code['type'] == 'validation') {
+ echo '<p>'.$lang['srv_check_pogoji_loop'].' <a href="javascript:condition_editing(\''.$row['id'].'\');$(\'#check_pogoji\').fadeOut(\'slow\');popupClose();"><b>'.$row['number'].'</b></a></p>';
+ }
+ elseif ($code['type'] == 'validation') {
$sql = sisplet_query("SELECT id, naslov, variable FROM srv_spremenljivka WHERE id = '$code[id]'");
$row = mysqli_fetch_array($sql);
- echo '<p>'.$lang['srv_check_validacija'].': <b><a href="javascript:vprasanje_fullscreen(\''.$row['id'].'\');">'.$row['variable'].' - '.strip_tags($row['naslov']).'</a></b></p>';
-
+ echo '<p>'.$lang['srv_check_validacija'].': <b><a href="javascript:vprasanje_fullscreen(\''.$row['id'].'\');$(\'#check_pogoji\').fadeOut(\'slow\');popupClose();">'.$row['variable'].' - '.strip_tags($row['naslov']).'</a></b></p>';
+ }
// napaka z imeni variabel
- } elseif ($code['type'] == 'variable') {
+ elseif ($code['type'] == 'variable') {
+ foreach ($code['vars'] AS $var) {
+ echo '<strong>'.$var.'</strong><br />';
+ };
+ }
+ // napaka z vrednostmi v gridu
+ elseif ($code['type'] == 'grid_value') {
foreach ($code['vars'] AS $var) {
echo '<strong>'.$var.'</strong><br />';
};
}
+
// error code
echo '<p>';
if ($code['code'] == 1) {
@@ -1690,18 +1710,20 @@ class BranchingAjax {
}
echo '</p>';
-
- //echo '<p class="as_link" onclick="$(\'#check_pogoji\').fadeOut(\'slow\'); $(\'#fade\').fadeOut(\'slow\');">'.$lang['srv_zapri'].'</p>';
- echo '<span class="floatRight"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_orange" href="#" onclick="$(\'#check_pogoji\').fadeOut(\'slow\'); $(\'#fade\').fadeOut(\'slow\');">'.$lang['srv_zapri'].'</a></div></span>';
- }
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium blue" onClick="$(\'#check_pogoji\').fadeOut(\'slow\'); $(\'#fade\').fadeOut(\'slow\');">'.$lang['srv_zapri'].'</button>';
+ echo '</div>';
+ }
else {
echo '<h2>'.$lang['srv_check_pogoji_not_ok'].'</h2>';
echo '<div class="popup_close"><a href="#" onClick="$(\'#surveyTrajanje\').fadeOut(\'slow\'); $(\'#fade\').fadeOut(\'slow\');">✕</a></div>';
echo '<p>'.$lang['srv_check_pogoji_not_ok_txt'].'</p>';
-
- //echo '<p class="as_link" onclick="$(\'#surveyTrajanje\').fadeOut(\'slow\'); $(\'#fade\').fadeOut(\'slow\');">'.$lang['srv_zapri'].'</p>';
- echo '<span class="floatRight"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_orange" href="#" onclick="$(\'#surveyTrajanje\').fadeOut(\'slow\'); $(\'#fade\').fadeOut(\'slow\');">'.$lang['srv_zapri'].'</a></div></span>';
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium blue" onclick="$(\'#surveyTrajanje\').fadeOut(\'slow\'); $(\'#fade\').fadeOut(\'slow\');">'.$lang['srv_zapri'].'</button>';
+ echo '</div>';
}
}
}
@@ -1717,12 +1739,18 @@ class BranchingAjax {
$show_alert = SurveySetting::getInstance()->getSurveyMiscSetting('alert_close_block');
if($show_alert != '2'){
+
+ echo '<h2>'.$lang['alert_close_block_title'].'</h2>';
echo $lang['alert_close_block'];
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium blue" onclick="alert_close_block(); return false;">'.$lang['srv_zapri'].'</button>';
+ echo '</div>';
- echo '<span class="buttonwrapper floatRight">';
+ /* echo '<span class="buttonwrapper floatRight">';
echo '<a class="ovalbutton ovalbutton_grey" href="#" onclick="alert_close_block(); return false;"><span>'.$lang['srv_zapri'].'</span></a>';
- echo '</span>';
+ echo '</span>'; */
SurveySetting::getInstance()->setSurveyMiscSetting('alert_close_block', '2');
}
@@ -1795,7 +1823,6 @@ class BranchingAjax {
$results = $_POST['results'];
$status1 = $_POST['status1'];
- $status2 = $_POST['status2'];
if($what == 'finish_author' || $what == 'finish_respondent_cms' || $what == 'finish_respondent' || $what == 'finish_other' | $what == 'finish_other_emails') {
sisplet_query("INSERT INTO srv_alert (ank_id, $what) VALUES ('$this->anketa', '$results')
@@ -1806,7 +1833,7 @@ class BranchingAjax {
}
$b = new Branching($this->anketa);
- $b->toolbox_settings($status1, $status2);
+ $b->toolbox_settings($status1);
}
@@ -1934,89 +1961,22 @@ class BranchingAjax {
$sql = sisplet_query("SELECT * FROM post WHERE 1=0");
}
- if (mysqli_num_rows($sql) > 0) {
- if ($view == 1) {
- //echo '<b><a href="'.$site_url.'index.php?fl=4&fid='.$row['forum'].'&tid='.$tid.'&sortpostorder='.$sortpostorder.'" target="_blank">'.$lang['srv_forum_go'].'</a></b>';
- $rows = mysqli_num_rows($sql);
- if ($rows > 0) echo '<img src="'.$site_url.'/admin/survey/img_0/'.($sortpostorder==1?'up':'down').'.gif" style="float:right" title="'.($sortpostorder==1?$lang['forum_desc']:$lang['forum_asc']).'" />';
- echo '<br /><br />';
- } elseif ($view == 3) {
- echo '<div style="width:45%; float:left">';
- echo '<h3 class="red"><b>'.$lang['comments'].'</b>';
- $rows = mysqli_num_rows($sql);
- if ($rows > 0) echo '<img src="img_0/'.($sortpostorder==1?'up':'down').'.gif" style="float:right" title="'.($sortpostorder==1?$lang['forum_desc']:$lang['forum_asc']).'" />';
- echo '</h3>';
- }
- }
-
- // textarea za oddat komentar - zgoraj
+ /*/ textarea za oddat komentar - zgoraj
if ($addfieldposition == 1) {
$this->add_comment_field($spremenljivka, $type, $view);
echo '<br /><br />';
- }
+ }*/
- if (mysqli_num_rows($sql) > 0) {
-
- $i = 0;
- $rows = mysqli_num_rows($sql);
- while ($row = mysqli_fetch_array($sql)) {
-
- // Prikazemo zgodovino glede na nastavitev
- if($comment_history == '2' || (($comment_history == '0' || $comment_history == '') && $row['uid'] == $global_user_id)){
- if ($row['ocena'] == 0) echo '<span style="color:black">';
- elseif ($row['ocena'] == 1) echo '<span style="color:darkgreen">';
- elseif ($row['ocena'] == 2) echo '<span style="color:#999999">';
- elseif ($row['ocena'] == 3) echo '<span style="color:#999999">';
- else echo '<span>';
-
- echo '<b>'.$f->user($row['uid']).'</b> ('.$f->datetime1($row['time']).'):';
-
- if ($admin_type <= 1 || $rowi['insert_uid']==$global_user_id || $commentmarks_who==0) {
-
- echo '<div style="float:right">';
-
- if ($commentmarks == 1) {
- echo ' <select name="ocena" onchange="$.post(siteurl+\'ajax.php?a=comment_ocena\', {type: \'question_comment\', ocena: this.value, id: \''.$row['id'].'\', anketa: \''.$rowi['id'].'\'}, function () { add_comment(\''.$spremenljivka.'\', \''.$type.'\', \''.$view.'\', \'\' ); });">
- <option value="0"'.($row['ocena']==0?' selected':'').'>'.$lang['srv_undecided'].'</option>
- <option value="1"'.($row['ocena']==1?' selected':'').'>'.$lang['srv_todo'].'</option>
- <option value="2"'.($row['ocena']==2?' selected':'').'>'.$lang['srv_done'].'</option>
- <option value="3"'.($row['ocena']==3?' selected':'').'>'.$lang['srv_not_relevant'].'</option>
- </select>';
- } else {
- echo '<input type="checkbox" name="ocena_'.$row['id'].'" id="ocena_'.$row['id'].'" style="margin-right:3px;" onchange="$.post(siteurl+\'ajax.php?a=comment_ocena\', {type: \'question_comment\', ocena: (this.checked?\'2\':\'0\'), id: \''.$row['id'].'\', anketa: \''.$rowi['id'].'\'}, function () { add_comment(\''.$spremenljivka.'\', \''.$type.'\', \''.$view.'\', \'\' ); });" value="2" '.($row['ocena'] >= 2?' checked':'').' /><label for="ocena_'.$row['id'].'">'.$lang['srv_done'].'</label>';
- }
- //echo ' <br /><a href="javascript:comment_on_comment(\''.$rowt['id'].'\');">'.$lang['srv_comment_comment'].'</a>';
- echo '</div>';
- }
-
- echo '<br/>'.$row['vsebina'].'<hr>';
-
- echo '</span>';
- }
-
- //}
- $i++;
-
- // Nastavimo oglede foruma in teme
- if ($global_user_id > 0) {
- $sqla2 = sisplet_query("SELECT time FROM views WHERE pid='" .$row['id'] ."' AND uid='$global_user_id'");
- if (mysqli_num_rows($sqla2) > 0) {
- $sqla3 = sisplet_query("UPDATE views SET time=NOW() WHERE pid='" .$row['id'] ."' AND uid='$global_user_id'");
- } else {
- $sqla3 = sisplet_query("INSERT INTO views (pid, uid, time) VALUES ('" .$row['id'] ."', '$global_user_id', NOW())");
- }
- }
- }
- }
// textarea za oddat komentar - spodaj
if ($addfieldposition == 0 || $addfieldposition == '') {
- echo '<br />';
- $this->add_comment_field($spremenljivka, $type, $view);
+ echo '<div id="survey_comment_0_1">';
+ $this->add_comment_field($spremenljivka, $type, $view, true, false);
+ echo '</div>';
}
} else {
- $this->add_comment_field($spremenljivka, $type, $view);
+ //$this->add_comment_field($spremenljivka, $type, $view);
}
if ($_REQUEST['refresh'] != '1' || $view==3)
@@ -2172,7 +2132,7 @@ class BranchingAjax {
// komentarji respondentov
elseif ($type == 2) {
- $db_table = (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) ? '_active' : '';
+ $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString();
$orderby = $sortpostorder == 1 ? 'DESC' : 'ASC' ;
$sql = sisplet_query("SELECT d.*, u.time_edit FROM srv_data_text".$db_table." d, srv_user u WHERE d.spr_id='0' AND d.vre_id='$spremenljivka' AND u.id=d.usr_id ORDER BY d.id $orderby");
@@ -2322,29 +2282,42 @@ class BranchingAjax {
}
}
- function add_comment_field ($spremenljivka, $type, $view, $form=true) {
+ function add_comment_field ($spremenljivka, $type, $view, $form=true, $buttons=true) {
global $admin_type;
global $global_user_id;
global $lang;
global $site_url;
$rowanketa = SurveyInfo::getInstance()->getSurveyRow();
-
- echo '<textarea name="vsebina" id="vsebina_'.$spremenljivka.'_'.$view.'" style="width:100%; height:50px; margin-bottom:10px; border:1px red solid;"></textarea><br />';
- echo '<input type="submit" value="'.$lang['send'].'" onclick="add_comment(\''.$spremenljivka.'\', \''.$type.'\', \''.$view.'\', $(\'#vsebina_'.$spremenljivka.'_'.$view.'\').val()); return false;" />';
-
- if (($type == 0 || $view==3) && ($admin_type == 0 || $global_user_id==$rowanketa['insert_uid'])) {
-
- echo '<div style="float:right">';
-
- // Link na pregled splosnih komentarjev
- echo '<span style="margin-right: 20px;"><a href="'.$site_url.'/admin/survey/index.php?anketa='.$this->anketa.'&a=komentarji_anketa">'.$lang['srv_comment_overview'].'</a></span>';
-
- // Link na nastavitve komentarjev
- echo '<a href="'.$site_url.'/admin/survey/index.php?anketa='.$this->anketa.'&a=urejanje">'.$lang['settings'].'</a>';
-
+
+
+ $tip_lang = '';
+ if ($type == 1 && $view == 4) //splošen komentar na strani testiranje
+ $tip_lang = 'S';
+ if ($type == 0 && $view == 1) //splošen komentar v dropdownu
+ $tip_lang = 'S';
+ if ($spremenljivka != 0) //komentar na vprašanja
+ $tip_lang = 'Q';
+
+ if ($type == 5) //komentar na pogoj
+ $tip_lang = 'IF';
+ elseif ($type == 6) //komentar na blok
+ $tip_lang = 'B';
+
+
+ echo '<textarea name="vsebina" placeholder="'.$lang['srv_comments_add_comment'.$tip_lang.''].'" id="vsebina_'.$spremenljivka.'_'.$view.'"></textarea>';
+
+ if ($buttons) {
+ echo '<div class="button_holder bottom0">';
+
+ if($_GET['a'] == 'comment_manage')
+ echo ' <button class="medium white-blue" onClick="closeCommentQtip(\''.$spremenljivka.'_'.$view.'\');">'.$lang['edit1338'].'</button>';
+ else
+ echo ' <button class="medium white-blue" onClick="toggleAddComment(\''.$spremenljivka.'_'.$view.'\');">'.$lang['edit1338'].'</button>';
+
+ echo ' <button class="medium blue" onclick="add_comment(\''.$spremenljivka.'\', \''.$type.'\', \''.$view.'\', $(\'#vsebina_'.$spremenljivka.'_'.$view.'\').val()); return false;">'.$lang['srv_comments_new'].'</button>';
echo '</div>';
- }
+ }
}
/**
@@ -2382,10 +2355,12 @@ class BranchingAjax {
include_once('../../main/survey/app/global_function.php');
new \App\Controllers\SurveyController(true);
- $spremenljivka = $_POST['spremenljivka'];
+ if(isset($_POST['spremenljivka'])){
+ $spremenljivka = $_POST['spremenljivka'];
- save('forceShowSpremenljivka', true);
- \App\Controllers\Vprasanja\VprasanjaController::getInstance()->displaySpremenljivka($spremenljivka);
+ save('forceShowSpremenljivka', true);
+ \App\Controllers\Vprasanja\VprasanjaController::getInstance()->displaySpremenljivka($spremenljivka);
+ }
}
function ajax_calculation_edit_variable () {
@@ -2675,6 +2650,30 @@ class BranchingAjax {
$b->repare_condition($if);
$b->calculation_editing_inner($condition);
}
+
+ function ajax_quota_sort() {
+ Common::getInstance()->Init($this->anketa);
+ Common::getInstance()->updateEditStamp();
+
+ $condition = $_POST['condition'];
+ $sortable = $_POST['sortable'];
+ $sortable = explode('&', $sortable);
+
+ $i=1;
+ foreach ($sortable AS $val) {
+ $quota = explode('=', $val);
+ $quota = $quota[1];
+
+ $s = sisplet_query("UPDATE srv_quota SET vrstni_red='{$i}' WHERE id='{$quota}'");
+ if (!$s) echo mysqli_error($GLOBALS['connect_db']);
+
+ $i++;
+ }
+
+ $b = new Branching($this->anketa);
+ $b->repare_condition($if);
+ //$b->calculation_editing_inner($condition);
+ }
function ajax_spremenljivka_preview_print() {
global $lang;
@@ -2699,11 +2698,11 @@ class BranchingAjax {
</head>
<body>
<?
-
- echo '<div id="printIcon">';
- echo '<a href="#" onclick="window.print(); return false;"><span class="faicon print_small icon-grey_dark_link"></span> '.$lang['hour_print2'].'</a>';
- echo '</div>';
+ echo '<div class="button_holder print_button">';
+ echo '<button class="small blue" onclick="window.print(); return false;">'.$lang['hour_print2'].'</button>';
+ echo '</div>';
+
include_once('../../main/survey/app/global_function.php');
new \App\Controllers\SurveyController(true);
@@ -2721,7 +2720,7 @@ class BranchingAjax {
save('forceShowSpremenljivka', true);
\App\Controllers\Vprasanja\VprasanjaController::getInstance()->displaySpremenljivka($_GET['spremenljivka']);
}
-
+
?>
</body>
</html>
@@ -2731,7 +2730,7 @@ class BranchingAjax {
function ajax_toolbox_add_advanced () {
$b = new Branching($this->anketa);
- $b->toolbox_add_advanced();
+ $b->toolbox_add_advanced($popup=true);
}
function ajax_toggle_toolbox () {
@@ -2765,15 +2764,27 @@ class BranchingAjax {
echo '<div class="popup_close"><a href="#" onClick="$(\'#vrednost_edit\').hide().html(\'\'); $(\'#fade\').fadeOut(); return false;">✕</a></div>';
- echo '<h2>'.$lang['srv_find_replace'].'</h2>';
+ echo '<h2><span class="faicon blue replace"></span>'.$lang['srv_find_replace'].'</h2>';
- echo '<p class="gray">'.$lang['srv_find_text'].'</p>';
-
- echo '<p><label style="display:inline-block; width:100px">'.$lang['srv_find'].': </label><input type="text" name="find" style="width:200px"><span id="find_count" style="color:red; margin:0 20px"></span></p>';
- echo '<p><label style="display:inline-block; width:100px">'.$lang['srv_replace_with'].': </label><input type="text" name="replace" style="width:200px"></p>';
-
- echo '<span class="floatRight"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_orange btn_savesettings" onclick="find_replace_do(); return false;" href="#"><span>'.$lang['srv_replace'].'</span></a></div></span>';
- echo '<span class="floatRight spaceRight"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_gray btn_savesettings" onclick="$(\'#vrednost_edit\').hide().html(\'\'); $(\'#fade\').fadeOut(); return false;" href="#"><span>'.$lang['srv_cancel'].'</span></a></div></span>';
+ echo '<p class="bottom16">'.$lang['srv_find_text'].'</p>';
+
+ echo '<div class="setting_holder">';
+ echo '<p>'.$lang['srv_find'].':</p>';
+ echo '<div class="find-holder">';
+ echo '<input type="text" class="text large" name="find">';
+ echo '<span class="red" id="find_count" style="margin-left: 16px;"></span>';
+ echo '</div>';
+ echo '</div>';
+
+ echo '<div class="setting_holder">';
+ echo '<p>'.$lang['srv_replace_with'].':</p>';
+ echo '<input type="text" class="text large" name="replace">';
+ echo '</div>';
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium white-blue" onClick="$(\'#vrednost_edit\').hide().html(\'\'); $(\'#fade\').fadeOut(); return false;">'.$lang['srv_cancel'].'</button>';
+ echo '<button class="medium blue" onclick="find_replace_do(); return false;">'.$lang['srv_replace'].'</button>';
+ echo '</div>';
}
function ajax_find_replace_count() {
@@ -2924,11 +2935,6 @@ class BranchingAjax {
if (!$sql) echo mysqli_error($GLOBALS['connect_db']);
$if_id = mysqli_insert_id($GLOBALS['connect_db']);
- $sqlm = sisplet_query("SELECT * FROM misc WHERE what='new_if_$this->anketa'");
- if (mysqli_num_rows($sqlm) > 0)
- sisplet_query("UPDATE misc SET value='$if_id' WHERE what='new_if_$this->anketa'");
- else
- sisplet_query("INSERT INTO misc (what, value) VALUES ('new_if_$this->anketa', '$if_id')");
if ($this->spremenljivka > 0 || ($if > 0 && $endif == 1)) {
$sql = sisplet_query("SELECT * FROM srv_branching WHERE element_spr = '$this->spremenljivka' AND element_if='$if'");