summaryrefslogtreecommitdiffstats
path: root/admin/survey/classes/class.SurveyStatusProfiles.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.SurveyStatusProfiles.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.SurveyStatusProfiles.php')
-rw-r--r--admin/survey/classes/class.SurveyStatusProfiles.php412
1 files changed, 220 insertions, 192 deletions
diff --git a/admin/survey/classes/class.SurveyStatusProfiles.php b/admin/survey/classes/class.SurveyStatusProfiles.php
index 11946a3..1563ddd 100644
--- a/admin/survey/classes/class.SurveyStatusProfiles.php
+++ b/admin/survey/classes/class.SurveyStatusProfiles.php
@@ -7,7 +7,8 @@
*/
session_start();
-DEFINE (STR_DLMT, "|");
+if (!defined(STR_DLMT)) define(STR_DLMT, "|");
+
class SurveyStatusProfiles
{
@@ -133,16 +134,18 @@ class SurveyStatusProfiles
}
# če smo v vpogledu pohandlammo posebej
- if (($_podstran == A_COLLECT_DATA && $_GET['m'] == 'quick_edit') || $_POST['podstran'] == 'quick_edit') {
+ if (($_podstran == A_COLLECT_DATA && isset($_GET['m']) && $_GET['m'] == 'quick_edit') || (isset($_POST['podstran']) && $_POST['podstran'] == 'quick_edit')) {
$_podstran = 'vpogled';
}
+
+
self::$currentProfileId = SurveyUserSetting :: getInstance()->getSettings('default_status_profile_'.$_podstran);
if (!self::$currentProfileId) {
-
#self::$currentProfileId = 2;
self::$currentProfileId = self::$survayDefaultUstrezni; # je lahko 2 ali 3
}
+
# ustrezni je lahko samo če so kakšni ustrezni zapisi v bazi ob pogoju da pa neustrezni obstajajao
if (self::$allValidCount == 0 && self::$allUserCount > 0) {
if (self::$currentProfileId == 2 || self::$currentProfileId == 3 ) {
@@ -153,16 +156,18 @@ class SurveyStatusProfiles
# ce imamo nastavljen curent pid in profil z tem pid ne obstaja nastavomo na privzet profil
if (self::$currentProfileId != 1) {
+
if (!isset(self::$profiles[self::$currentProfileId])) {
self::$currentProfileId = 1;
- }
+ }
}
# ce ne obstajajo podatki za cpid damo error
if (!isset(self::$profiles[self::$currentProfileId])) {
die("Profile data is missing!");
return false;
- } else {
+ }
+ else {
return true;
}
}
@@ -186,7 +191,7 @@ class SurveyStatusProfiles
static function DisplayProfile( $pid = null) {
global $lang;
-
+
if ($pid == null ) {
$pid = self::$currentProfileId;
}
@@ -197,29 +202,46 @@ class SurveyStatusProfiles
#vsebino shranimo v buffer
ob_start();
- if ( self::$currentProfileId != SSP_DEFAULT_PROFILE ) {
- echo '<div id="not_default_setting">';
+
+ echo '<div class="popup_close"><a href="#" onClick="$(\'#fade\').fadeOut(\'slow\');$(\'#fullscreen\').fadeOut(\'slow\').html(\'\'); return false;">✕</a></div>';
+
+
+ if ( self::$currentProfileId != SSP_DEFAULT_PROFILE ) {
+ 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="popup_close"><a href="#" onClick="$(\'#fade\').fadeOut(\'slow\');$(\'#fullscreen\').fadeOut(\'slow\').html(\'\'); return false;">✕</a></div>';
- echo ' <div id="status_profile_holder">';
+ echo '<div class="popup_main with_menu">';
+
+ echo ' <div id="status_profile_holder" class="popup_left">';
self :: DisplayProfileOptions($pid);
echo ' </div>';
- echo ' <div id="status_profile_data_holder">';
+ echo ' <div id="status_profile_data_holder" class="popup_right">';
self :: DisplayProfileData($pid);
- echo ' <br class="clr" />';
echo ' </div>';
-
+
+ echo ' </div>';
+
+
// cover Div
echo '<div id="statusProfileCoverDiv"></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" value=""/>';
+ echo '</div>';
+ echo '</div>';
+
+ echo '<div class="button_holder">';
+
$button = new PopUpButton($lang['srv_save_profile']);
echo $button -> setFloat('right')
->setButtonColor('orange')
@@ -227,12 +249,26 @@ class SurveyStatusProfiles
$button = new PopUpButton($lang['srv_cancel']);
echo $button -> setFloat('right')
-> addAction('onClick','statusProfileAction(\'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="' . self::$profiles[$pid]['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="' . self::$profiles[$pid]['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_rename_profile_yes']);
echo $button -> setFloat('right')
->setButtonColor('orange')
@@ -242,65 +278,54 @@ class SurveyStatusProfiles
echo $button -> setFloat('right')
-> addAction('onClick','statusProfileAction(\'renameCancel\'); return false;');
echo '</div>';
+ echo '</div>';
// div za brisanje
- echo '<div id="deleteProfileDiv">'.$lang['srv_missing_profile_delete_confirm'].': <b>' . self::$profiles[$pid]['name'] . '</b>?';
- echo '<input id="deleteProfileId" type="hidden" value="' . $pid . '" />';
+ echo '<div id="deleteProfileDiv">';
+
+ echo $lang['srv_missing_profile_delete_confirm'].': <span class="semi-bold">' . self::$profiles[$pid]['name'] . '</span>?';
+
+ echo '<input id="deleteProfileId" type="hidden" value="' . $pid . '" />';
+
+ echo '<div class="button_holder">';
$button = new PopUpButton($lang['srv_delete_profile_yes']);
- echo $button -> setFloat('right')
- ->setButtonColor('orange')
+ echo $button -> setButtonColor('orange')
-> addAction('onClick','statusProfileAction(\'deleteConfirm\'); return false;');
$button = new PopUpButton($lang['srv_cancel']);
- echo $button -> setFloat('right')
- -> addAction('onClick','statusProfileAction(\'deleteCancel\'); return false;');
+ echo $button -> addAction('onClick','statusProfileAction(\'deleteCancel\'); return false;');
echo '</div>';
+ echo '</div>';
$content = ob_get_clean();
#dodamo vsebino
$popUp->setContent($content);
- /*
- if ($pid < 0) { #Imamo sejo, lahko poženemo samo kot sejo
- $run_lbl = $lang['srv_run_as_session_profile'];
- echo '<span class="floatRight spaceLeft" ><span class="buttonwrapper"><a class="ovalbutton ovalbutton_orange" href="#" onclick="statusProfileAction(\'runSession\'); return false;"><span>'.$run_lbl.'</span></a></span></span>';
- } else {
- # shrani - pozeni
- $run_lbl = $lang['srv_run_profile'];
- echo '<span class="floatRight spaceLeft" ><span class="buttonwrapper"><a class="ovalbutton ovalbutton_orange" href="#" onclick=""><span>'.$run_lbl.'</span></a></span></span>';
- $run_lbl = $lang['srv_run_as_session_profile'];
- echo '<span class="floatRight spaceLeft" ><span class="buttonwrapper"><a class="ovalbutton ovalbutton_gray" href="#" onclick="statusProfileAction(\'runSession\'); return false;"><span>'.$run_lbl.'</span></a></span></span>';
-
- }
- */
- $button = new PopUpButton($lang['srv_choose_profile']);
- $button -> setFloat('right')
- ->setButtonColor('orange')
- -> addAction('onClick','statusProfileAction(\'choose\'); return false;');
+
+ # dodamo gumb Prekliči
+ $button = new PopUpCancelButton();
$popUp->addButton($button);
#dodamo gumb shrani
- if (self::$profiles[$pid]['system'] != 1 && $pid != -1)
- {
+ if (self::$profiles[$pid]['system'] != 1 && $pid != -1){
$button = new PopUpButton($lang['srv_save_profile']);
- $button -> setFloat('right')
- -> addAction('onClick','statusProfileAction(\'save\'); return false;');
+ $button -> addAction('onClick','statusProfileAction(\'save\'); return false;');
$popUp->addButton($button);
}
$button = new PopUpButton($lang['srv_new_profile_name']);
- $button -> setFloat('right')
- -> addAction('onClick','statusProfileAction(\'newName\'); return false;');
+ $button -> addAction('onClick','statusProfileAction(\'newName\'); return false;');
$popUp->addButton($button);
-
- # dodamo gumb Prekliči
- $button = new PopUpCancelButton();
- $button -> setFloat('right');
+
+ $button = new PopUpButton($lang['srv_choose_profile']);
+ $button ->setButtonColor('orange')
+ -> addAction('onClick','statusProfileAction(\'choose\'); return false;');
$popUp->addButton($button);
+
echo $popUp;
}
@@ -321,56 +346,50 @@ class SurveyStatusProfiles
# preverimo kaere statuse disejblamo na podlagi izbire načina kreiranja datoteke (samo 5,6 / vsi satusi)
list($collect_all_status) = mysqli_fetch_row(sisplet_query("SELECT collect_all_status FROM srv_data_files WHERE sid = '".self::$sid."'"));
- echo '<table><tr>';
+
+ echo '<div class="valid_units_wrap">';
+
// dodamo veljavne
foreach (self::$appropriateStatus as $index) {
- if ($cnt&1) {
- echo '</tr><tr>';
- }
- echo '<td style="width:50%">';
- echo '<label><input name="srv_userstatus[]" type="checkbox" id="' . $index . '"' .
+ echo '<div class="valid_units_box">';
+ echo '<input name="srv_userstatus[]" type="checkbox" id="' . $index . '"' .
($curentProfileData['status'.$index] == 1 ? ' checked="checked"' : '') .
- ($disabled || ( (int)$collect_all_status == 0 && $index < 5 ) ? ' disabled="true"' : '' ). '/>';
+ ($disabled || ( (int)$collect_all_status == 0 && $index < 5 ) ? ' disabled' : '' ). '/><label for="' . $index . '">';
echo '<span'.($disabled || ( (int)$collect_all_status == 0 && $index < 5 ) ? ' class="gray"' : '' ).'>'.$lang['srv_userstatus_' . $index]. ' ('.$index.')</span>';
- echo '</label></td>';
- $cnt++;
+ echo '</label></div>';
}
+
// dodamo neveljavne
foreach (self::$unAppropriateStatus as $index) {
- if ($cnt&1)
- echo '</tr><tr>';
- echo '<td style="width:50%">';
- echo '<label><input name="srv_userstatus[]" type="checkbox" id="' . $index . '"' .
+ echo '<div class="valid_units_box">';
+ echo '<input name="srv_userstatus[]" type="checkbox" id="' . $index . '"' .
($curentProfileData['status'.$index] == 1 ? ' checked="checked"' : '') .
- ($disabled || ( (int)$collect_all_status == 0 && $index < 5 ) ? ' disabled="true"' : '' ) . '/>';
+ ($disabled || ( (int)$collect_all_status == 0 && $index < 5 ) ? ' disabled' : '' ) . '/><label for="' . $index . '">';
//echo $lang['srv_userstatus_' . $index]. " (".$index.")";
echo '<span'.($disabled || ( (int)$collect_all_status == 0 && $index < 5 ) ? ' class="gray"' : '' ).'>'.$lang['srv_userstatus_' . $index]. ' ('.$index.')</span>';
- echo '</label></td>';
- $cnt++;
+ echo '</label></div>';
}
+
// dodamo null
foreach (self::$unKnownStatus as $index) {
-
- if ($cnt&1)
- echo '</tr><tr>';
- echo '<td style="width:50%">';
- echo '<label><input name="srv_userstatus[]" type="checkbox" id="' . $index . '"' .
+ echo '<div class="valid_units_box">';
+ echo '<input name="srv_userstatus[]" type="checkbox" id="' . $index . '"' .
($curentProfileData['status'.$index] == 1 ? ' checked="checked"' : '') .
- ($disabled || ( (int)$collect_all_status == 0 && $index < 5 ) ? ' disabled="true"' : '' ) . '/>';
+ ($disabled || ( (int)$collect_all_status == 0 && $index < 5 ) ? ' disabled' : '' ) . '/><label for="' . $index . '">';
//echo $lang['srv_userstatus_' . $index]. " (".$index.")";
echo '<span'.($disabled || ( (int)$collect_all_status == 0 && $index < 5 ) ? ' class="gray"' : '' ).'>'.$lang['srv_userstatus_' . $index]. ' ('.$index.')</span>';
- echo '</label></td>';
- $cnt++;
+ echo '</label></div>';
}
- echo '</tr></table>';
+ echo '</div>'; #valid_units_wrap
echo '</fieldset>';
-
+ $html_disabled = '';
+ $css_disabled = '';
if ($disabled ) {
$html_disabled = ' disabled="true"';
- $css_disabled = ' class="gray"';
+ $css_disabled = ' disabled';
}
@@ -379,19 +398,51 @@ class SurveyStatusProfiles
// lurkerji
# lurker = 0 - obveezno ni lurker, lurker = 1 - obvezno je lurker, lurker = 2 - je ali ni lurker
- #echo '<hr><label><input type="checkbox" name="srv_userstatus[]" id="lurker" '.($curentProfileData['statuslurker'] == 1 ? ' checked="checked"' : '') . ($disabled ? ' disabled="true"' : '' ) . '> '.$lang['srv_lurkers'].'</label>';
- echo '<label'.$css_disabled.'>'.$lang['srv_lurkers'].'</label>';
- echo '<label'.$css_disabled.'><input type="radio" name="srv_us_lurker" value="0" '.((int)$curentProfileData['statuslurker'] == 0 ? ' checked="checked"' : '') .$html_disabled. '> '.$lang['no'].'</label>';
- echo '<label'.$css_disabled.'><input type="radio" name="srv_us_lurker" value="1" '.((int)$curentProfileData['statuslurker'] == 1 ? ' checked="checked"' : '') .$html_disabled. '> '.$lang['srv_only_empty'].'</label>';
- echo '<label'.$css_disabled.'><input type="radio" name="srv_us_lurker" value="2" '.((int)$curentProfileData['statuslurker'] == 2 ? ' checked="checked"' : '') .$html_disabled. '> '.$lang['srv_also'].'</label>';
- echo '<br/><label class="small">'.$lang['srv_lurkers_subnote'].'</label>';
+ #echo '<hr><label><input type="checkbox" name="srv_userstatus[]" id="lurker" '.($curentProfileData['statuslurker'] == 1 ? ' checked="checked"' : '') . ($disabled ? ' disabled' : '' ) . '> '.$lang['srv_lurkers'].'</label>';
+
+ echo '<div class="setting_holder '.$css_disabled.'">';
+ echo '<p class="setting_title">'.$lang['srv_lurkers'];
+ echo '<br><span class="italic">'.$lang['srv_lurkers_subnote'].'</span></p>';
+
+ echo '<div class="horizontal">';
+ echo '<div class="setting_item">';
+ echo '<input type="radio" id="srv_us_lurker0" name="srv_us_lurker" value="0" '.((int)$curentProfileData['statuslurker'] == 0 ? ' checked="checked"' : '') .$html_disabled. '>';
+ echo '<label for="srv_us_lurker0">'.$lang['no'].'</label>';
+ echo '</div>';
+ echo '<div class="setting_item">';
+ echo '<input type="radio" id="srv_us_lurker1" name="srv_us_lurker" value="1" '.((int)$curentProfileData['statuslurker'] == 1 ? ' checked="checked"' : '') .$html_disabled. '>';
+ echo '<label for="srv_us_lurker1">'.$lang['srv_only_empty'].'</label>';
+ echo '</div>';
+ echo '<div class="setting_item">';
+ echo '<input type="radio" id="srv_us_lurker2" name="srv_us_lurker" value="2" '.((int)$curentProfileData['statuslurker'] == 2 ? ' checked="checked"' : '') .$html_disabled. '>';
+ echo '<label for="srv_us_lurker2">'.$lang['srv_also'].'</label>';
+ echo '</div>';
+
+ echo '</div>';
+ echo '</div>';
// testni vnosi
# testni = 0 - obveezno ni testni, testni = 1 - obvezno je tesni, testni = 2 - je ali ni testni
- echo '<br/><br/><label'.$css_disabled.'>'.$lang['srv_testni_vnos'].'</label>';
- echo '<label'.$css_disabled.'><input type="radio" name="srv_us_testni" value="0" '.((int)$curentProfileData['statustestni'] == 0 ? ' checked="checked"' : '') .$html_disabled. '> '.$lang['no'].'</label>';
- echo '<label'.$css_disabled.'><input type="radio" name="srv_us_testni" value="1" '.((int)$curentProfileData['statustestni'] == 1 ? ' checked="checked"' : '') .$html_disabled. '> '.$lang['srv_only_test'].'</label>';
- echo '<label'.$css_disabled.'><input type="radio" name="srv_us_testni" value="2" '.((int)$curentProfileData['statustestni'] == 2 ? ' checked="checked"' : '') .$html_disabled. '> '.$lang['srv_also'].'</label>';
+
+ echo '<div class="setting_holder '.$css_disabled.'">';
+ echo '<p class="setting_title">'.$lang['srv_testni_vnos'].'</p>';
+
+ echo '<div class="horizontal">';
+ echo '<div class="setting_item">';
+ echo '<input type="radio" id="srv_us_testni0" name="srv_us_testni" value="0" '.((int)$curentProfileData['statustestni'] == 0 ? ' checked="checked"' : '') .$html_disabled. '>';
+ echo '<label for="srv_us_testni0">'.$lang['no'].'</label>';
+ echo '</div>';
+ echo '<div class="setting_item">';
+ echo '<input type="radio" id="srv_us_testni1" name="srv_us_testni" value="1" '.((int)$curentProfileData['statustestni'] == 1 ? ' checked="checked"' : '') .$html_disabled. '>';
+ echo '<label for="srv_us_testni1">'.$lang['srv_only_test'].'</label>';
+ echo '</div>';
+ echo '<div class="setting_item">';
+ echo '<input type="radio" id="srv_us_testni2" name="srv_us_testni" value="2" '.((int)$curentProfileData['statustestni'] == 2 ? ' checked="checked"' : '') .$html_disabled. '>';
+ echo '<label for="srv_us_testni2">'.$lang['srv_also'].'</label>';
+ echo '</div>';
+
+ echo '</div>';
+ echo '</div>';
echo '</fieldset>';
@@ -401,10 +452,25 @@ class SurveyStatusProfiles
echo '<legend>' . $lang['srv_usableResp_usable_unit'] . '</legend>';
// 2->uporabni, 1->delno uporabni, 0->neuporabni
- echo '<label'.$css_disabled.'><input type="checkbox" name="srv_us_nonusable" value="1" '.((int)$curentProfileData['statusnonusable'] == 1 ? ' checked="checked"' : '') .$html_disabled. '> '.$lang['srv_usableResp_unusable'].'</label>';
- echo '<span class="spaceLeft"></span><label'.$css_disabled.'><input type="checkbox" name="srv_us_partusable" value="1" '.((int)$curentProfileData['statuspartusable'] == 1 ? ' checked="checked"' : '') .$html_disabled. '>'.$lang['srv_usableResp_partusable'].'</label>';
- echo '<span class="spaceLeft"></span><label'.$css_disabled.'><input type="checkbox" name="srv_us_usable" value="1" '.((int)$curentProfileData['statususable'] == 1 ? ' checked="checked"' : '') .$html_disabled. '>'.$lang['srv_usableResp_usable'].'</label>';
+
+ echo '<div class="setting_holder '.$css_disabled.'">';
+ echo '<div class="horizontal">';
+ echo '<div class="setting_item">';
+ echo '<input type="checkbox" id="srv_us_nonusable" name="srv_us_nonusable" value="1" '.((int)$curentProfileData['statusnonusable'] == 1 ? ' checked="checked"' : '') .$html_disabled. '>';
+ echo '<label for="srv_us_nonusable">'.$lang['srv_usableResp_unusable'].'</label>';
+ echo '</div>';
+ echo '<div class="setting_item">';
+ echo '<input type="checkbox" id="srv_us_partusable" name="srv_us_partusable" value="1" '.((int)$curentProfileData['statuspartusable'] == 1 ? ' checked="checked"' : '') .$html_disabled. '>';
+ echo '<label for="srv_us_partusable">'.$lang['srv_usableResp_partusable'].'</label>';
+ echo '</div>';
+ echo '<div class="setting_item">';
+ echo '<input type="checkbox" id="srv_us_usable" name="srv_us_usable" value="1" '.((int)$curentProfileData['statususable'] == 1 ? ' checked="checked"' : '') .$html_disabled. '>';
+ echo '<label for="srv_us_usable">'.$lang['srv_usableResp_usable'].'</label>';
+ echo '</div>';
+
+ echo '</div>';
+ echo '</div>';
echo '</fieldset>';
echo '</form>';
@@ -418,15 +484,18 @@ class SurveyStatusProfiles
$_sql_qry = sisplet_query($_sql_string);
$_sql_row = mysqli_fetch_assoc($_sql_qry);
- echo '<div id="status_profile" class="select">';
+ echo '<div id="status_profile" class="list select">';
+
foreach ( self::$profiles as $key => $profile ) {
if ($key != 1 || ($key == 1 && (int)$_sql_row['collect_all_status'] > 0 )) {
- echo '<div id="status_profile_'.$profile['id'].'" class="option' . ($profile['id'] == $pid ? ' active' : '') . '" value="'.$profile['id'].'" '.($profile['id'] == $pid ? '' : ' onclick="show_status_profile_data(' . $profile['id'] . '); return false;"').'>';
+ echo '<div id="status_profile_'.$profile['id'].'" class="list-item option' . ($profile['id'] == $pid ? ' active' : '') . '" value="'.$profile['id'].'" '.($profile['id'] == $pid ? '' : ' onclick="show_status_profile_data(' . $profile['id'] . '); return false;"').'>';
echo $profile['name'];
if($profile['id'] == $pid){
+ echo '<div class="profile_icons">';
+
#dodamo gumb izbriši
if (self::$profiles[$pid]['system'] != 1 ){
echo ' <a href="#" onclick="statusProfileAction(\'deleteAsk\'); return false;" value="'.$lang['srv_delete_profile'].'"><span class="faicon delete_circle icon-orange_link floatRight" style="margin-top:1px;"></span></a>'."\n";
@@ -435,6 +504,8 @@ class SurveyStatusProfiles
if (self::$profiles[$pid]['system'] != 1 && $pid != -1){
echo ' <a href="#" onclick="statusProfileAction(\'renameAsk\'); return false;" value="'.$lang['srv_rename_profile'].'"><span class="faicon edit floatRight spaceRight"></span></a>'."\n";
}
+
+ echo '</div>';
}
echo '</div>';
@@ -443,9 +514,7 @@ class SurveyStatusProfiles
echo '</div>';
echo '<script>';
- echo '$(function() {';
- echo 'scrollToProfile("#status_profile_'.$pid.'");';
- echo '});';
+ echo ' $(function(){ scrollToProfile("#status_profile_'.$pid.'"); });';
echo '</script>';
}
@@ -453,8 +522,11 @@ class SurveyStatusProfiles
*
*/
static function ajax() {
- $pid = $_POST['pid'];
+
+ $pid = isset($_POST['pid']) ? $_POST['pid'] : null;
+
switch ($_GET['a']) {
+
case 'displayProfile' :
if (isset($pid) && $pid != null)
{
@@ -462,34 +534,42 @@ class SurveyStatusProfiles
}
self :: DisplayProfile($pid);
break;
+
case 'chooseProfile' :
self :: setDefaultProfileId($pid);
break;
+
case 'saveProfile':
self :: saveProfile($pid);
break;
+
case 'run_status_profile':
self :: saveProfile($pid);
self :: setDefaultProfileId($pid);
break;
+
case 'save_status_profile':
$new_id = self :: saveNewProfile($pid);
self :: setDefaultProfileId($new_id);
echo $new_id;
break;
+
case 'deleteProfile':
self :: DeleteProfile($pid);
break;
+
case 'renameProfile':
self :: renameProfile($pid);
-
break;
- case 'showColectDataSetting':
- self :: showColectDataSetting();
+
+ case 'showInvalidResponsesWarning':
+ self :: showInvalidResponsesWarning();
break;
+
case 'saveCollectDataSetting':
self :: saveCollectDataSetting();
break;
+
case 'changeOnlyValidRadio':
self :: changeOnlyValidRadio();
break;
@@ -568,12 +648,14 @@ class SurveyStatusProfiles
}
static function setDefaultProfileId($pid=null, $podstran = null) {
+
# ce je seja, preverimo ali obstaja cene nardimo privzetega 1
if ($pid == -1) {
if (!(isset($_SESSION['statusProfile']))) {
$pid = null;
}
}
+
if ($podstran == null ) {
if ( isset($_POST['meta_akcija']) ) {
$_action = $_POST['meta_akcija'];
@@ -596,7 +678,7 @@ class SurveyStatusProfiles
}
# če smo v vpogledu pohandlammo posebej
- if (($_action == A_COLLECT_DATA && $_GET['m'] == 'quick_edit') || $_POST['podstran'] == 'quick_edit') {
+ if (($_action == A_COLLECT_DATA && isset($_GET['m']) && $_GET['m'] == 'quick_edit') || $_POST['podstran'] == 'quick_edit') {
$_action = 'vpogled';
}
@@ -684,7 +766,7 @@ class SurveyStatusProfiles
$mpds = self::getStatusArray((int)$pid);
}
$result = '';
-
+ $prefix = '';
if ($mpds) {
$result .= ' AND last_status IN (';
foreach ( self::$appropriateStatus as $index) {
@@ -727,11 +809,15 @@ class SurveyStatusProfiles
return $result;
}
+
static function getStatusArray($pid=null) {
+
if ($pid == null) {
$pid = self::$currentProfileId;
}
- $mpd = self::$profiles[$pid];
+
+ $mpd = isset(self::$profiles[$pid]) ? self::$profiles[$pid] : null;
+
return $mpd;
}
@@ -953,96 +1039,35 @@ class SurveyStatusProfiles
static function DisplayLink($hideAdvanced = true, $hideSeperator = false) {
global $lang;
+
// profili statusov
$statusProfiles = self :: getProfiles();
$izbranStatusProfile = self :: getCurentProfileId();
$css = ($izbranStatusProfile == SSP_DEFAULT_PROFILE ? ' gray' : '');
if ($hideAdvanced == false || $izbranStatusProfile != SSP_DEFAULT_PROFILE) {
- if ($hideSeperator == false) {
- echo '<li class="space">&nbsp;</li>';
- }
+
echo '<li>';
- echo '<span class="as_link'.$css.'" onclick="show_status_profile();return false;" title="' . $lang['srv_statusi'] . '">' . $lang['srv_statusi'] . '</span>';
- echo '</li>';
-
+ echo ' <span class="'.$css.'" onclick="show_status_profile(); return false;" title="' . $lang['srv_statusi'] . '">' . $lang['srv_statusi'] . '</span>';
+ echo '</li>';
}
}
- public static function FileGeneratingSetting($hideAdvanced = true) {
+ static function showInvalidResponsesWarning() {
global $lang, $admin_type;
-
- $_sql_string = "SELECT collect_all_status FROM srv_data_files WHERE sid = '".self::$sid."'";
- $_sql_qry = sisplet_query($_sql_string);
- $_sql_row = mysqli_fetch_assoc($_sql_qry);
- echo '<li class="space">&nbsp;</li>';
- echo '<li>';
- $css = ((int)$_sql_row['collect_all_status'] > 0 ? ' gray' : '');
- echo '<span class="as_link'.$css.'" onclick="showColectDataSetting(); return false;" title="' . $lang['srv_collect_data_setting_note'] . '">' . $lang['srv_collect_data_setting_note'] . '</span>';
- echo '</li>';
-
- return;
- }
-
- static function showColectDataSetting() {
- global $lang, $admin_type;
+ echo '<h2>'.$lang['srv_invalid_units_warning_title'].'</h2>';
+ echo '<div class="popup_close"><a href="#" onClick="popupClose(); return false;">✕</a></div>';
- $_sql_string = "SELECT collect_all_status FROM srv_data_files WHERE sid = '".self::$sid."'";
- $_sql_qry = sisplet_query($_sql_string);
- list($collect_all_status) = mysqli_fetch_row($_sql_qry);
-
- $str_qry_cnt_user = "SELECT count(*) FROM srv_user AS u WHERE u.ank_id = '".self::$sid."'";
- $_qry_cnt_user = sisplet_query($str_qry_cnt_user);
- list($all_user_cnt) = mysqli_fetch_row($_qry_cnt_user);
- #vsebino shranimo v buffer
- $content = '';
-
- # kadar imamo uporabnikov več kakor ONLY_VALID_LIMIT (5000) ne dovolimo nastaviti na vse statuse, zato dodamo obvestilo
- # le admin lahko nastavi da generira tudi nad 5000 takrat nastavimo collect_all_status = 2
- if ($all_user_cnt > ONLY_VALID_LIMIT && (int)$admin_type > 1)
- {
- $content .= '<span class="red strong">';
- $content .= 'Anketa vsebuje več kakor '.ONLY_VALID_LIMIT.' respondentov, zato je dovoljen prikaz le ustreznih!';
- $content .= '</span><br/><br/>';
- $content .= '<span class="gray">'.$lang['srv_collect_data_setting_note'] . Help :: display('srv_collect_data_setting').'</span>';
- $content .= '<label class="gray">';
- $content .= '<input type="checkbox" id="collect_all_status" name="collect_all_status" '.((int)$collect_all_status > 0 ? '' : ' checked' ).' autocomplete="off" disabled="disabled">';
- $content .= $lang['srv_collect_all_status_0'].'</label>';
- }
- else
- {
- $content .= '<span '.($admin_type <= 1 ? '' : ' class="gray"').'>'.$lang['srv_collect_data_setting_note'] . Help :: display('srv_collect_data_setting').'</span>';
- $content .= '<label'.($admin_type <= 1 ? '' : ' class="gray"').'>';
- $content .= '<input type="checkbox" id="collect_all_status" name="collect_all_status" '.((int)$collect_all_status > 0 ? '' : ' checked').' autocomplete="off"'.($admin_type <= 1 ? '' : ' disabled="disabled"').'>';
- $content .= $lang['srv_collect_all_status_0'].'</label>';
- }
- $content .= '<br class="clr">';
- $content .= '<br class="clr">';
- $content .= '<span class="bold as_link" onclick="deleteSurveyDataFile(\''.$lang['srv_deleteSurveyDataFile_confirm'].'\');" title="'.$lang['srv_deleteSurveyDataFile_link'].'">'.$lang['srv_deleteSurveyDataFile_link'].'</span>';
-
-
- $popUp = new PopUp();
- $popUp->setId('div_data_file');
- $popUp -> setHeaderText($lang['srv_file_settings']);
-
- #dodamo vsebino
- $popUp -> setContent($content);
-
- #dodamo gumb izberi profil
- $button = new PopUpButton($lang['srv_save_profile']);
- $button -> setFloat('right')
- -> setButtonColor('orange')
- -> addAction('onClick','changeColectDataStatus(); return false;');
- $popUp->addButton($button);
-
- # dodamo gumb Prekliči
- $button = new PopUpCancelButton();
- $button -> setFloat('right');
- $popUp->addButton($button);
+ echo '<div class="popup_content">';
+ echo ' <p class="bottom16">'.$lang['srv_invalid_units_warning_text'].'</p>';
+ echo '</div>';
- echo $popUp;
+ echo '<div class="button_holder">';
+ echo ' <button class="medium white-blue" onClick="refreshDataFile(); return false;">'.$lang['no'].'</button>';
+ echo ' <button class="medium blue" onClick="deleteInvalidAnswers(); return false;">'.$lang['yes'].'</button>';
+ echo '</div>';
}
@@ -1112,10 +1137,14 @@ class SurveyStatusProfiles
$values = self::getProfilesValues();
$collect_all_status = $values['all_status'];
+
+ $disabledValid = '';
+ $disabledGray = '';
+ $disabledAll = '';
+ $disabledAllGray = '';
// če ni ustreznih uporabnikov je privzeto vsi
if (self::$allValidCount == 0) {
-
$pid = 1;
$disabledValid = ' disabled="disabled"';
$disabledGray = ' gray';
@@ -1133,36 +1162,35 @@ class SurveyStatusProfiles
}
}
- echo '<label class="middle'.$disabledAllGray.'">';
echo '<input type="radio" id="statusAllUnit" name="statusOnlyValid" value="1"'.($pid == 1?' checked="checked"':'').$disabledAll.' onchange="changeOnlyValidRadio();" autocomplete="off">';
- echo $lang['srv_data_all_units'].'&nbsp;('.(int)self::$allUserCount.')';
- echo '</label>';
- echo '&nbsp;';
+ echo '<label for="statusAllUnit" class="middle'.$disabledAllGray.'">'.$lang['srv_data_all_units'].'&nbsp;('.(int)self::$allUserCount.')</label>';
if (self::$survayDefaultUstrezni == 2) {
- echo '<label class="middle'.$disabledGray .'">';
echo '<input type="radio" id="statusValidUnit" name="statusOnlyValid" value="2"'.($pid==2?' checked="checked"':'').$disabledValid.' onchange="changeOnlyValidRadio();" autocomplete="off">';
- echo $lang['srv_data_valid_units'].'&nbsp;('.(int)self::$allValidCount.')';
- echo '</label>';
+ echo '<label for="statusValidUnit" class="middle'.$disabledGray.'">'.$lang['srv_data_valid_units'].'&nbsp;('.(int)self::$allValidCount.') '.Help::display('srv_data_only_valid').'</label>';
}
else {
- echo '<label class="middle'.$disabledGray .'">';
echo '<input type="radio" id="statusValidUnit" name="statusOnlyValid" value="3"'.($pid==3?' checked="checked"':'').$disabledValid.' onchange="changeOnlyValidRadio();" autocomplete="off">';
- echo $lang['srv_data_finished_units'].'&nbsp;('.(int)self::$allValidCount.')';
+ echo '<label for="statusValidUnit" class="middle'.$disabledGray.'">'.$lang['srv_data_finished_units'].' ('.(int)self::$allValidCount.') '.Help::display('srv_data_only_valid').'</label>';
}
-
- echo '&nbsp;'.Help::display('srv_data_only_valid');
+
+ // Zapisemo stevilo odgovorov v hidden variablo za js
+ echo '<input type="hidden" name="statusAllCount" value="'.(int)self::$allUserCount.'">';
+ echo '<input type="hidden" name="statusOnlyValidCount" value="'.(int)self::$allValidCount.'">';
+ echo '<input type="hidden" name="statusOnlyInvalidCount" value="'.((int)self::$allUserCount - (int)self::$allValidCount).'">';
}
static function changeOnlyValidRadio() {
+
if (isset($_POST['checked']) && (int)$_POST['checked'] > 0) {
$dpid = (int)$_POST['checked'];
- } else {
+ }
+ else {
#$dpid = 2;
$dpid = (int)self::$survayDefaultUstrezni;
}
+
self::setDefaultProfileId($dpid);
-
}
/** preveri obstoj profila in vrne enak id če obstaja, če ne vrne id privzetega profila