summaryrefslogtreecommitdiffstats
path: root/admin/survey/classes/class.SurveyVariablesProfiles.php
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-05-27 13:08:29 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2024-05-27 13:08:29 +0200
commit75160b12821f7f4299cce7f0b69c83c1502ae071 (patch)
tree27e25e4ccaef45f0c58b22831164050d1af1d4db /admin/survey/classes/class.SurveyVariablesProfiles.php
parentprvi-commit (diff)
download1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.gz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.bz2
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.lz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.xz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.zst
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.zip
Diffstat (limited to 'admin/survey/classes/class.SurveyVariablesProfiles.php')
-rw-r--r--admin/survey/classes/class.SurveyVariablesProfiles.php203
1 files changed, 130 insertions, 73 deletions
diff --git a/admin/survey/classes/class.SurveyVariablesProfiles.php b/admin/survey/classes/class.SurveyVariablesProfiles.php
index 110f767..eafd63f 100644
--- a/admin/survey/classes/class.SurveyVariablesProfiles.php
+++ b/admin/survey/classes/class.SurveyVariablesProfiles.php
@@ -11,7 +11,7 @@
*
*/
DEFINE ('SVP_DEFAULT_PROFILE', 0);
-DEFINE (NEW_LINE, "\n");
+if (!defined(NEW_LINE)) define(NEW_LINE, "\n");
class SurveyVariablesProfiles
{
@@ -149,7 +149,7 @@ class SurveyVariablesProfiles
}
# ce profil ni inspect ali ce ga ne ignoriramone vrnemo variable
- $variables = unserialize(self::$profiles[$pid]['variables']);
+ $variables = isset(self::$profiles[$pid]['variables']) ? unserialize(self::$profiles[$pid]['variables']) : null;
if (is_array($variables))
{
$result=array();
@@ -185,9 +185,8 @@ class SurveyVariablesProfiles
$css = ($izbranProfil == SVP_DEFAULT_PROFILE ? ' gray' : '');
if ($hideAdvanced == false || $css != ' gray') {
- echo '<li class="space">&nbsp;</li>';
echo '<li>';
- echo '<span class="as_link'.$css.'" onclick="displayVariableProfile();" title="'.$lang['srv_filtri'].'">'.$lang['srv_filtri'].'</span>';
+ echo ' <span class="'.$css.'" onclick="displayVariableProfile();" title="'.$lang['srv_filtri'].'">'.$lang['srv_filtri'].'</span>';
echo '</li>';
}
@@ -215,14 +214,26 @@ class SurveyVariablesProfiles
}
$variable_label = implode(', ',$vars);
- echo '<div id="variableProfileNote">';
- echo '<span class="floatLeft">'.$lang['srv_profile_variables_is_filtred'].'</span>';
- echo '<span class="floatLeft">'.$variable_label.'</span>';
- echo '<span class="as_link spaceLeft" onclick="displayVariableProfile();">'.$lang['srv_profile_edit'].'</span>';
- echo '<span class="as_link spaceLeft" onclick="removeVariableProfile();">'.$lang['srv_profile_remove'].'</span>';
- echo '</div>';
- echo '<br class="clr" />';
+ echo '<div id="variableProfileNote" class="filter_box">';
+
+ echo ' <div class="header">';
+ echo ' <span class="semi-bold">'.$lang['srv_profile_variables_is_filtred'].'</span>';
+
+ echo ' <div class="icons">';
+ echo ' <span class="faicon edit" onclick="displayVariableProfile();" title="'.$lang['srv_profile_edit'].'"></span>';
+ echo ' <span class="faicon delete" onclick="removeVariableProfile();" title="'.$lang['srv_profile_remove'].'"></span>';
+ echo ' </div>';
+
+ echo ' </div>';
+
+
+ echo ' <div class="content">';
+ echo ' <span class="floatLeft">'.$variable_label.'</span>';
+ echo ' </div>';
+
+ echo '</div>';
+
return true;
}
return false;
@@ -245,7 +256,7 @@ class SurveyVariablesProfiles
static function ajax() {
- $pid = $_POST['pid'];
+ $pid = isset($_POST['pid']) ? $_POST['pid'] : null;
if ($_POST['podstran'] == 'monitoring') {
self::$monitoring = true; self::refreshAvailableProfiles();
@@ -253,14 +264,14 @@ class SurveyVariablesProfiles
switch ($_GET['a']) {
case 'displayProfile':
- self::displayProfiles($_POST['pid']);
+ self::displayProfiles($pid);
break;
case 'changeProfile':
- self::displayProfiles($_POST['pid']);
+ self::displayProfiles($pid);
break;
case 'chooseProfile':
- self::chooseProfile($_POST['pid']);
+ self::chooseProfile($pid);
break;
case 'saveProfile':
self::saveProfile();
@@ -269,10 +280,10 @@ class SurveyVariablesProfiles
$new_id = self :: newProfileVariables();
break;
case 'renameProfile':
- $updated = self::renameVariableProfile($_POST['pid'],$_POST['name']);
+ $updated = self::renameVariableProfile($pid,$_POST['name']);
break;
case 'deleteProfile':
- self::deleteVariableProfile($_POST['pid']);
+ self::deleteVariableProfile($pid);
break;
}
}
@@ -281,6 +292,8 @@ class SurveyVariablesProfiles
static function displayProfiles ($cvp = null) {
global $lang;
+ $pid = isset($_POST['pid']) ? $_POST['pid'] : null;
+
$popUp = new PopUp();
$popUp->setId('div_variable_profiles');
$popUp->setHeaderText($lang['srv_spremenljivke_settings']);
@@ -292,144 +305,188 @@ class SurveyVariablesProfiles
if ($cvp == null)
$cvp = self::$currentId;
+
$svp_ap = self::$profiles;
$svp_pv = self :: getProfileVariables($cvp);
$svp_av = self::$SDF->getSurveyVariables();
if ( self::$currentId != SVP_DEFAULT_PROFILE ) {
- echo '<div id="not_default_setting">';
+ echo '<div id="not_default_setting" class="popup_note red">';
echo $lang['srv_not_default_setting'];
echo '</div>';
- echo '<br class="clr" />';
}
- echo '<div class="variable_profile_holder">';
- echo ' <div id="variable_profile" class="select">';
+
+ echo '<div class="popup_main with_menu">';
+
+
+ echo '<div class="variable_profile_holder popup_left">';
+
+ echo ' <div id="variable_profile" class="list select">';
foreach ($svp_ap as $key => $value) {
- echo '<div class="option'.($cvp==$value['id']?' active':'').'" value="'.$value['id'].'" '.($cvp==$value['id'] ? '' : ' onclick="changeVariableProfile(\''.$value['id'].'\');"').'>';
+ echo '<div class="list-item option'.($cvp==$value['id']?' active':'').'" value="'.$value['id'].'" '.($cvp==$value['id'] ? '' : ' onclick="changeVariableProfile(\''.$value['id'].'\');"').'>';
echo $value['name'];
if($cvp == $value['id']){
+
+ echo '<div class="profile_icons">';
+
// izbriši
if ((int)$cvp != 0){
- echo ' <a href="#" onclick="variableProfileAction(\'deleteAsk\'); return false;" value="'.$lang['srv_delete_profile'].'"><span class="faicon delete_circle icon-orange_link floatRight" style="margin-top:1px;"></span></a>'."\n";
+ echo ' <a href="#" onclick="variableProfileAction(\'deleteAsk\'); return false;" value="'.$lang['srv_delete_profile'].'"><span class="faicon delete_circle icon-orange_link floatRight" style="margin-top:1px;"></span></a>'."\n";
}
// preimenuj
if ((int)$cvp != 0){
- echo ' <a href="#" onclick="variableProfileAction(\'renameAsk\'); return false;" value="'.$lang['srv_rename_profile'].'"><span class="faicon edit icon-as_link floatRight spaceRight"></span></a>'."\n";
+ echo ' <a href="#" onclick="variableProfileAction(\'renameAsk\'); return false;" value="'.$lang['srv_rename_profile'].'"><span class="faicon edit icon-as_link floatRight spaceRight"></span></a>'."\n";
}
+
+ echo '</div>';
}
echo '</div>';
}
echo ' </div>';
- // izberi / odznaci vse
- echo '<div style="position:absolute; bottom:20px; left:20px;">';
- echo '<a href="#" onClick="variableProfileSelectAll(1); return false;">'.$lang['srv_select_all'].'</a>';
- echo ' / <a href="#" onClick="variableProfileSelectAll(0); return false;">'.$lang['srv_deselect_all'].'</a>';
- echo '</div>';
-
echo '</div>';
- echo '<div id="vp_list">';
+ echo '<div id="vp_list" class="popup_right">';
$empty = count($svp_pv) == 0;
- echo '<ul id="vp_list_ul" class="left">';
- if (count($svp_av) > 0)
- {
- foreach($svp_av as $key => $variabla)
- {
+ echo '<div id="vp_list_ul" class="settings_block">';
+ if (count($svp_av) > 0){
+
+ foreach($svp_av as $key => $variabla){
$_name = self::$SDF->getVariableName($key);
$checked = ($empty || in_array($key, $svp_pv));
- echo '<li'.($checked?' class="selected"':'').'>';
- echo '<label>';
- echo '<input type="checkbox" '.($checked?' checked="checekd"':'').' name="vp_list_li" value="'.$key.'" id="variable_'.$key.'" onchange="variableProfileCheckboxChange(this);">'.limitString($_name);
- echo '</label></li>';
+
+ echo '<div class="setting_line">';
+ echo ' <input type="checkbox" '.($checked?' checked="checekd"':'').' name="vp_list_li" value="'.$key.'" id="variable_'.$key.'" onchange="variableProfileCheckboxChange(this);">';
+ echo ' <label for="variable_'.$key.'">'.limitString($_name).'</label>';
+ echo '</div>';
}
}
- echo '</ul>';
+ echo '</div>';
+
+ // izberi / odznaci vse
+ echo '<div class="settings_block">';
+ echo ' <div class="setting_line">';
+ echo ' <a href="#" onClick="variableProfileSelectAll(1); return false;">'.$lang['srv_select_all'].'</a> / <a href="#" onClick="variableProfileSelectAll(0); return false;">'.$lang['srv_deselect_all'].'</a>';
+ echo ' </div>';
+ echo '</div>';
echo '</div>';
+
+
+ echo '</div>';
+
+
// cover Div
echo '<div id="variableProfileCoverDiv"></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 '<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">';
+
+ $button = new PopUpButton($lang['srv_cancel']);
+ echo $button -> setFloat('right')
+ -> addAction('onClick','variableProfileAction(\'newCancel\'); return false;');
+
$button = new PopUpButton($lang['srv_save_profile']);
echo $button -> setFloat('right')
->setButtonColor('orange')
-> addAction('onClick','variableProfileAction(\'newSave\'); return false;');
- $button = new PopUpButton($lang['srv_cancel']);
- echo $button -> setFloat('right')
- -> addAction('onClick','variableProfileAction(\'newCancel\'); return false;');
+
+ 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="'.$svp_ap[$cvp]['name'].'" size="45" />';
+ 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" value="'.$svp_ap[$cvp]['name'].'" class="text large" />';
echo '<input id="renameProfileId" type="hidden" value="'.$pid.'" />';
+ echo '</div>';
+ echo '</div>';
+
+ echo '<div class="button_holder">';
+
+ $button = new PopUpButton($lang['srv_cancel']);
+ echo $button -> setFloat('right')
+ -> addAction('onClick','variableProfileAction(\'renameCancel\'); return false;');
+
$button = new PopUpButton($lang['srv_rename_profile_yes']);
echo $button -> setFloat('right')
->setButtonColor('orange')
-> addAction('onClick','variableProfileAction(\'renameProfile\'); return false;');
- $button = new PopUpButton($lang['srv_cancel']);
- echo $button -> setFloat('right')
- -> addAction('onClick','variableProfileAction(\'renameCancel\'); return false;');
+ echo '</div>';
+
echo '</div>';
// div za brisanje
- echo '<div id="deleteProfileDiv">'.$lang['srv_missing_profile_delete_confirm'].': <b>'.$svp_ap[$cvp]['name'].'</b>?';
+ echo '<div id="deleteProfileDiv">';
+
+ echo $lang['srv_missing_profile_delete_confirm'].': <span class="semi-bold">'.$svp_ap[$cvp]['name'].'</span>?';
echo '<input id="deleteProfileId" type="hidden" value="'.$pid.'" />';
- $button = new PopUpButton($lang['srv_delete_profile_yes']);
- echo $button -> setFloat('right')
- ->setButtonColor('orange')
- -> addAction('onClick','variableProfileAction(\'deleteConfirm\'); return false;');
+ echo '<div class="button_holder">';
$button = new PopUpButton($lang['srv_cancel']);
echo $button -> setFloat('right')
-> addAction('onClick','variableProfileAction(\'deleteCancel\'); return false;');
+
+ $button = new PopUpButton($lang['srv_delete_profile_yes']);
+ echo $button -> setFloat('right')
+ ->setButtonColor('orange')
+ -> addAction('onClick','variableProfileAction(\'deleteConfirm\'); return false;');
+
+ echo '</div>';
+
echo '</div>';
$content = ob_get_clean();
#dodamo vsebino
$popUp->setContent($content);
- # gumb izberi
- $button = new PopUpButton($lang['srv_choose_profile']);
- $button -> setFloat('right')
- ->setButtonColor('orange')
- -> addAction('onClick','variableProfileAction(\'choose\'); return false;');
+ # dodamo gumb Preklici
+ $button = new PopUpCancelButton();
$popUp->addButton($button);
# gumb shrani
- if ((int)$cvp != 0)
- {
+ if ((int)$cvp != 0){
$button = new PopUpButton($lang['srv_save_profile']);
- $button -> setFloat('right')
- ->setButtonColor('gray')
- -> addAction('onClick','variableProfileAction(\'save\'); return false;');
+ $button->addAction('onClick','variableProfileAction(\'save\'); return false;');
$popUp->addButton($button);
}
# gumb shrani kot now
$button = new PopUpButton($lang['srv_new_profile_name']);
- $button -> setFloat('right')
- -> addAction('onClick','variableProfileAction(\'newName\'); return false;');
+ $button->addAction('onClick','variableProfileAction(\'newName\'); return false;');
$popUp->addButton($button);
- # dodamo gumb Preklici
- $button = new PopUpCancelButton();
- $button -> setFloat('right');
+ # gumb izberi
+ $button = new PopUpButton($lang['srv_choose_profile']);
+ $button -> setFloat('right')
+ ->setButtonColor('orange')
+ -> addAction('onClick','variableProfileAction(\'choose\'); return false;');
$popUp->addButton($button);
-
echo $popUp;
}
@@ -464,7 +521,7 @@ class SurveyVariablesProfiles
return $pid;
}
- function saveProfile()
+ static function saveProfile()
{
global $lang;