summaryrefslogtreecommitdiffstats
path: root/admin/survey/classes/class.SurveyConditionProfiles.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/survey/classes/class.SurveyConditionProfiles.php')
-rw-r--r--admin/survey/classes/class.SurveyConditionProfiles.php218
1 files changed, 131 insertions, 87 deletions
diff --git a/admin/survey/classes/class.SurveyConditionProfiles.php b/admin/survey/classes/class.SurveyConditionProfiles.php
index 20ae21a..54e471d 100644
--- a/admin/survey/classes/class.SurveyConditionProfiles.php
+++ b/admin/survey/classes/class.SurveyConditionProfiles.php
@@ -96,11 +96,16 @@ class SurveyConditionProfiles
public function getProfileName($pid) {
return self::$profiles[$pid]['name'];
}
+
+ public function getProfileConditionId($p_id = null){
+
+ return (int)($p_id == null ? self::$profiles[self :: $currentProfileId]['if_id'] : self::$profiles[$p_id]['if_id']);
+ }
/* Vrne ID in ime trenutno izbranega profila
*
*/
- function getCurentProfile() {
+ public function getCurentProfile() {
return array('id'=>self::$currentProfileId,'name'=>self::$profiles[self::$currentProfileId]['name']);
}
@@ -130,14 +135,14 @@ class SurveyConditionProfiles
static function DisplayLink($hideAdvanced = true) {
global $lang;
+
// profili statusov
$allProfiles = self :: $profiles;
$css = (self :: $currentProfileId == SCP_DEFAULT_PROFILE ? ' gray' : '');
if ($hideAdvanced == false || self :: $currentProfileId != SCP_DEFAULT_PROFILE) {
- echo '<li class="space">&nbsp;</li>';
echo '<li>';
- echo '<span class="as_link'.$css.'" id="link_condition_profile" title="' . $lang['srv_condition'] . '" onClick="conditionProfileAction(\'showProfiles\');">' . $lang['srv_condition'] . '</span>'."\n";
+ echo ' <span class="'.$css.'" id="link_condition_profile" title="' . $lang['srv_condition'] . '" onClick="conditionProfileAction(\'showProfiles\');">' . $lang['srv_condition'] . '</span>'."\n";
echo '</li>';
}
}
@@ -154,32 +159,44 @@ class SurveyConditionProfiles
static function ajax() {
- $pid = $_POST['pid'];
+
+ $pid = isset($_POST['pid']) ? $_POST['pid'] : null;
+
switch ($_GET['a']) {
+
case 'show_condition_profile' :
self :: showProfiles($pid);
break;
+
case 'change_condition_profile' :
-# if (isset($_POST['condition_label']) && $_POST['condition_label'] != '') {
-# self :: setConditionLabel($pid,$_POST['condition_label']);
-# }
if (isset($_POST['condition_error']) && $_POST['condition_error'] != '') {
self :: setConditionError($pid,$_POST['condition_error']);
}
- self :: setDefaultProfileId($pid);
+
+ if (isset($_POST['meta_akcija']) && $_POST['meta_akcija'] == 'invitations') {
+ $SIN = new SurveyInvitationsNew($_POST['anketa']);
+ $SIN -> setAdvancedConditionProfile($_POST['pid']);
+ }
+ else
+ self :: setDefaultProfileId($pid);
break;
+
case 'condition_remove' :
self :: conditionRemove();
break;
+
case 'create_condition_profile' :
self :: createNewProfile();
break;
+
case 'delete_condition_profile' :
self :: deleteProfile();
break;
+
case 'rename_condition_profile' :
self :: renameProfile();
break;
+
default:
echo 'ERROR! Missing function for action: '.$_GET['a'].'! (SurveyConditionProfile)';
break;
@@ -202,38 +219,48 @@ class SurveyConditionProfiles
echo '<div class="popup_close"><a href="#" onClick="conditionProfileAction(\'cancle\'); return false;">✕</a></div>';
if ( self :: $currentProfileId != SCP_DEFAULT_PROFILE ) {
- echo '<div id="not_default_setting">';
+ echo '<div id="not_default_setting" class="popup_note">';
echo $lang['srv_not_default_setting'];
- echo '</div><br class="clr displayNone">';
+ echo '</div>';
}
- echo '<div class="condition_profile_holder">';
+
+ echo '<div class="popup_main with_menu">';
+
+ echo '<div class="popup_left condition_profile_holder">';
- echo '<div id="condition_profile" class="select">';
- foreach (self :: $profiles as $key => $value) {
-
- echo ' <div class="option' . ( $_currMPID == $value['id'] ? ' active' : '') . '" id="condition_profile_' . $value['id'] . '" value="'.$value['id'].'">';
-
- echo $value['name'];
-
- if($_currMPID == $value['id']){
- if ( self :: $profiles[$_currMPID]['if_id'] != 0) {
- echo '<a href="#" title="'.$lang['srv_delete_profile'].'" onclick="conditionProfileAction(\'deleteAsk\'); return false;"><span class="faicon delete floatRight"></span></a>';
- }
- if ( self :: $profiles[$_currMPID]['if_id'] != 0) {
- echo '<a href="#" title="'.$lang['srv_rename_profile'].'" onclick="conditionProfileAction(\'renameAsk\'); return false;"><span class="faicon edit floatRight spaceRight"></span></a>';
- }
- }
-
- echo '</div>';
- }
- echo '</div>';
- echo '<div class="clr"></div>';
+ echo '<div id="condition_profile" class="list select">';
+ foreach (self :: $profiles as $key => $value) {
+
+ echo '<div class="list-item option' . ( $_currMPID == $value['id'] ? ' active' : '') . '" id="condition_profile_' . $value['id'] . '" value="'.$value['id'].'">';
+
+ echo $value['name'];
+
+ if($_currMPID == $value['id']){
+ echo '<div class="profile_icons">';
+
+ if ( self :: $profiles[$_currMPID]['if_id'] != 0) {
+ echo '<a href="#" title="'.$lang['srv_delete_profile'].'" onclick="conditionProfileAction(\'deleteAsk\'); return false;"><span class="faicon delete floatRight"></span></a>';
+ }
+ if ( self :: $profiles[$_currMPID]['if_id'] != 0) {
+ echo '<a href="#" title="'.$lang['srv_rename_profile'].'" onclick="conditionProfileAction(\'renameAsk\'); return false;"><span class="faicon edit floatRight spaceRight"></span></a>';
+ }
+
+ echo '</div>';
+ }
+
+ echo '</div>';
+ }
+ echo '</div>';
+
+ echo '<button class="small white-black" onclick="conditionProfileAction(\'newName\'); return false;"><span class="faicon plus_32"></span>'.$lang['srv_create_new_profile'].'</button>';
+
echo '</div>';
// tukaj prikazemo vsebino ifa
- echo '<div id="div_cp_preview">';
+ echo '<div id="div_cp_preview" class="popup_right">';
+
echo ' <div id="div_cp_preview_content">';
if (self :: $profiles[$_currMPID]['if_id'] > 0) {
@@ -245,17 +272,17 @@ class SurveyConditionProfiles
}
echo ' </div>';
+
echo '</div>';
echo '</div>';
- echo '<div id="conditionProfileButtons">';
// gumbi: preklici, ustvari nov, pozeni trenutni
- echo '<span class="floatRight spaceLeft" ><span class="buttonwrapper"><a class="ovalbutton ovalbutton_orange" href="#" onclick="conditionProfileAction(\'run\'); return false;"><span>'.$lang['srv_run_selected_profile'].'</span></a></span></span>';
- echo '<span class="floatRight spaceLeft" ><span class="buttonwrapper"><a class="ovalbutton ovalbutton_gray" href="#" onclick="conditionProfileAction(\'newName\'); return false;"><span>'.$lang['srv_create_new_profile'].'</span></a></span></span>';
- echo '<span class="floatRight spaceLeft" ><span class="buttonwrapper"><a class="ovalbutton ovalbutton_gray" href="#" onclick="conditionProfileAction(\'cancle\'); return false;"><span>'.$lang['srv_close_profile'].'</span></a></span></span>';
+ echo '<div id="conditionProfileButtons" class="button_holder">';
+ echo ' <button class="medium white-blue" onclick="conditionProfileAction(\'cancle\'); return false;">'.$lang['srv_close_profile'].'</button>';
+ echo ' <button class="medium blue" onclick="conditionProfileAction(\'run\'); return false;">'.$lang['srv_run_selected_profile'].'</button>';
echo '</div>';
@@ -263,25 +290,50 @@ class SurveyConditionProfiles
echo '<div id="conditionProfileCoverDiv"></div>';
// div za shranjevanje novega profila
- echo '<div id="newProfile">'.$lang['srv_missing_profile_name'].': ';
- echo '<input id="newProfileName" name="newProfileName" type="text" size="45" />';
- echo '<span class="floatRight spaceLeft" ><span class="buttonwrapper"><a class="ovalbutton ovalbutton_gray" href="#" onclick="conditionProfileAction(\'newCancle\'); return false;"><span>'.$lang['srv_close_profile'].'</span></a></span></span>';
- echo '<span class="floatRight spaceLeft" ><span class="buttonwrapper"><a class="ovalbutton ovalbutton_orange" href="#" onclick="conditionProfileAction(\'newCreate\'); return false;"><span>'.$lang['srv_save_profile'].'</span></a></span></span>';
+ echo '<div id="newProfile">';
+
+ echo '<div class="setting_holder">';
+ echo '<div class="setting_item">';
+ echo '<label>'.$lang['srv_missing_profile_name'].':</label>';
+ echo '<input id="newProfileName" name="newProfileName" type="text" class="text large" />';
+ echo '</div>';
+ echo '</div>';
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium white-blue" onClick="conditionProfileAction(\'newCancle\'); return false;">'.$lang['srv_close_profile'].'</button>';
+ echo '<button class="medium blue" onclick="conditionProfileAction(\'newCreate\'); return false;">'.$lang['srv_save_profile'].'</button>';
+ echo '</div>';
+
echo '</div>';
// div za preimenovanje
- echo '<div id="renameProfileDiv">'.$lang['srv_missing_profile_name'].': ';
- echo '<input id="renameProfileName" name="renameProfileName" type="text" value="' . self :: $profiles[$_currMPID]['name'] . '" size="45" />';
- echo '<input id="renameProfileId" type="hidden" value="' . self :: $profiles[$_currMPID]['id'] . '" />';
- echo '<span class="floatRight spaceLeft" ><span class="buttonwrapper"><a class="ovalbutton ovalbutton_gray" href="#" onclick="conditionProfileAction(\'renameCancle\'); return false;"><span>'.$lang['srv_close_profile'].'</span></a></span></span>';
- echo '<span class="floatRight spaceLeft" ><span class="buttonwrapper"><a class="ovalbutton ovalbutton_orange" href="#" onclick="conditionProfileAction(\'renameConfirm\'); return false;"><span>'.$lang['srv_rename_profile_yes'].'</span></a></span></span>';
+ echo '<div id="renameProfileDiv">';
+
+ echo '<div class="setting_holder">';
+ echo '<div class="setting_item">';
+ echo '<label>'.$lang['srv_missing_profile_name'].':</label>';
+ echo '<input id="renameProfileName" name="renameProfileName" type="text" class="text large" value="' . self :: $profiles[$_currMPID]['name'] . '"/>';
+ echo '<input id="renameProfileId" type="hidden" value="' . self :: $profiles[$_currMPID]['id'] . '" />';echo '</div>';
+ echo '</div>';
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium white-blue" onClick="conditionProfileAction(\'renameCancle\'); return false;">'.$lang['srv_close_profile'].'</button>';
+ echo '<button class="medium blue" onclick="conditionProfileAction(\'renameConfirm\'); return false;">'.$lang['srv_rename_profile_yes'].'</button>';
echo '</div>';
+ echo '</div>';
+
// div za brisanje
- echo '<div id="deleteProfileDiv">'.$lang['srv_missing_profile_delete_confirm'].': <b>' . self :: $profiles[$_currMPID]['name'] . '</b>?';
+ echo '<div id="deleteProfileDiv">';
+
+ echo $lang['srv_missing_profile_delete_confirm'].': <span class="semi-bold">' . self :: $profiles[$_currMPID]['name'] . '</span>?';
echo '<input id="deleteProfileId" type="hidden" value="' . self :: $profiles[$_currMPID]['id'] . '" />';
- echo '<span class="floatRight spaceLeft" ><span class="buttonwrapper"><a class="ovalbutton ovalbutton_gray" href="#" onclick="conditionProfileAction(\'deleteCancle\'); return false;"><span>'.$lang['srv_close_profile'].'</span></a></span></span>';
- echo '<span class="floatRight spaceLeft" ><span class="buttonwrapper"><a class="ovalbutton ovalbutton_orange" href="#" onclick="conditionProfileAction(\'deleteConfirm\'); return false;"><span>'.$lang['srv_delete_profile_yes'].'</span></a></span></span>';
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium white-blue" onClick="conditionProfileAction(\'deleteCancle\'); return false;">'.$lang['srv_close_profile'].'</button>';
+ echo '<button class="medium blue" onclick="conditionProfileAction(\'deleteConfirm\'); return false;">'.$lang['srv_delete_profile_yes'].'</button>';
+ echo '</div>';
+
echo '</div>';
}
@@ -322,8 +374,8 @@ class SurveyConditionProfiles
/* pobrisemo se za ifom*/
$sql = sisplet_query("SELECT * FROM srv_condition WHERE if_id = '$if'");
while ($row = mysqli_fetch_array($sql)) {
- if ((int)$row[id] > 0) {
- sisplet_query("DELETE FROM srv_condition_vre WHERE cond_id='$row[id]'");
+ if ((int)$row['id'] > 0) {
+ sisplet_query("DELETE FROM srv_condition_vre WHERE cond_id='".$row['id']."'");
}
}
if ((int)$if > 0) {
@@ -725,8 +777,8 @@ class SurveyConditionProfiles
$vre_id = (isset($options['vre']) && $options['vre'] != null) ? $options['vre'] : null;
$grd_id = (isset($options['grd']) && $options['grd'] != null) ? $options['grd'] : null;
$isDouble = (isset($options['isDouble']) && $options['isDouble'] != null) ? $options['isDouble'] : false;
- $tip = self::$_HEADER[$spr_id.'_0']['tip'];
- if ( $spr_id != null && count(self::$_HEADER[$spr_id.'_0']['grids']) > 0 ) {
+ $tip = isset(self::$_HEADER[$spr_id.'_0']['tip']) ? self::$_HEADER[$spr_id.'_0']['tip'] : null;
+ if ( $spr_id != null && isset(self::$_HEADER[$spr_id.'_0']['grids']) && count(self::$_HEADER[$spr_id.'_0']['grids']) > 0 ) {
switch ($tip) {
case 1 :
case 3 :
@@ -797,13 +849,6 @@ class SurveyConditionProfiles
}
-# static function setConditionLabel($pid,$condition_label) {
-# if ((int)$pid > 0 ) {
-# $updateString = "UPDATE srv_condition_profiles SET condition_label = '" . $condition_label . "' WHERE id = '" . $pid . "'";
-# $sqlInsert = sisplet_query($updateString);
-# }
-# }
-
static function setConditionError($pid,$condition_error) {
if ((int)$pid > 0 ) {
$updateString = "UPDATE srv_condition_profiles SET condition_error = '" . $condition_error . "' WHERE id = '" . $pid . "'";
@@ -811,47 +856,45 @@ class SurveyConditionProfiles
}
}
- static function getConditionString($if_id = null)
- {
+ static function getConditionString($if_id = null){
global $lang;
- # $condition_label = self::$profiles[self::$currentProfileId]['condition_label'];
ob_start();
$b = new Branching(self::$sid );
- if ($if_id == null || (int)$if_id == 0)
- {
+ if ($if_id == null || (int)$if_id == 0){
$if_id = (int)self::$profiles[self :: $currentProfileId]['if_id'];
}
+
$b->display_if_label($if_id);
- #$condition_label = mysqli_escape_string(ob_get_contents());
$condition_label = ob_get_contents();
ob_end_clean();
+
if ( $if_id > 0 && $condition_label != '') {
- echo '<div id="conditionProfileNote">';
- #if (self::$profiles[self :: $currentProfileId]['type'] == 'inspect') {
- # echo '<span class="floatLeft">'.$lang['srv_profile_data_is_filtred_zoom'].'</span>';
- #} else {
- echo '<span class="floatLeft">'.$lang['srv_profile_data_is_filtred'].'</span>';
- #}
- echo '<span class="floatLeft spaceLeft clr_if"><b>('.self::$profiles[self :: $currentProfileId]['name'].')</b></span>';
- echo '<span class="floatLeft spaceLeft">'.$condition_label.'</span>';
- // ali imamo napake v ifu
- if ((int)self::$profiles[$if_id]['condition_error'] != 0) {
- echo '<br>';
- echo '<span style="border:1px solid #009D91; background-color: #34D0B6; padding:5px; width:auto;"><img src="img_0/error.png" /> ';
- echo '<span class="red strong">'.$lang['srv_profile_condition_has_error'].'</span>';
- echo '</span>';
- }
- echo '<span class="as_link spaceLeft" id="link_condition_edit">'.$lang['srv_profile_edit'].'</span>';
- echo '<span class="as_link spaceLeft" id="link_condition_remove">'.$lang['srv_profile_remove'].'</span>';
- #if (self::$profiles[self :: $currentProfileId]['type'] == 'inspect') {
- # echo '<span class="as_link spaceLeft" onclick="window.location=\'index.php?anketa='.self::$sid.'&a=data&m=quick_edit&quick_view=1\'">'.$lang['srv_zoom_link_whoisthis'].'</span>';
- #}
+ echo '<div id="conditionProfileNote" class="filter_box">';
+
+ echo ' <div class="header">';
+
+ echo ' <span class="semi-bold">'.self::$profiles[self :: $currentProfileId]['name'].'</span>';
+
+ echo ' <span class="condition">'.$condition_label.'</span>';
+
+ // ali imamo napake v ifu
+ if (isset(self::$profiles[$if_id]['condition_error']) && (int)self::$profiles[$if_id]['condition_error'] != 0) {
+ echo ' <span class="red semi-bold">'.$lang['srv_profile_condition_has_error'].'</span>';
+ }
+
+ echo ' <div class="icons">';
+ echo ' <span class="faicon edit" id="link_condition_edit" title="'.$lang['srv_profile_edit'].'"></span>';
+ echo ' <span class="faicon delete" id="link_condition_remove" title="'.$lang['srv_profile_remove'].'"></span>';
+ echo ' </div>';
+
+ echo ' </div>';
+
echo '</div>';
- echo '<br class="clr" />';
+
return true;
}
@@ -913,7 +956,8 @@ class SurveyConditionProfiles
}
static function conditionRemove() {
- # nastavimo privzet profil oziroma brez pogojev.
+
+ # nastavimo privzet profil oziroma brez pogojev.
#Če pa je izbran profil bil slučajno inspect, ga v celoti odstranimo, da pobrišemo predhodne nastavitve zaradi gnezdenja
if (isset($_POST['pid']) && (int)$_POST['pid'] > 0) {
$currentProfileId = (int)$_POST['pid'];