skin = $surveySkin; else $this->skin = 0; if ((isset ($_REQUEST['anketa']) && $_REQUEST['anketa'] > 0) || (isset ($anketa) && $anketa > 0)) { $this->anketa = (isset ($anketa) && $anketa > 0) ? $anketa : $_REQUEST['anketa']; } else { // nekje se uporablja tudi brez IDja ankete!!! //die("SAS: SID missing!"); } SurveyInfo::getInstance()->SurveyInit($this->anketa); SurveyInfo::getInstance()->resetSurveyData(); $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); $this->survey_type = $this->getSurvey_type($this->anketa); $this->stran = isset($_GET['a']) ? $_GET['a'] : null; } /*Globalne nastavitve * Osnovni podatki * Respondenti * Design * Obveščanje * Piškotek * Trajanje * Komentarji * Dostop */ function anketa_nastavitve_global() {//OSTANE global $lang; global $site_url; global $site_path; global $admin_type; global $global_user_id; /* Globalne nastavitve ankete: veljajo za celoto anketo ne glede na uporabnika*/ $row = SurveyInfo::getInstance()->getSurveyRow(); $preklici_url = ltrim(str_replace("&s=1","",$_SERVER['REQUEST_URI']),"/"); $preklici_url = "'". $site_url . $preklici_url . "'"; echo '
' . "\n\r"; echo ' ' . "\n\r"; echo ' ' . "\n\r"; echo ' ' . "\n\r"; echo ' ' . "\n\r"; /*Osnovni podatki*/ if ($_GET['a'] == 'osn_pod' || $_GET['a'] == 'nastavitve') { /* OSNOVNI PODATKI */ echo '
'; echo '' . $lang['srv_osnovniPodatki'] . ''; echo '
'; echo ''; echo ' '; echo ' ' . strlen($row['naslov']) . '/'.ANKETA_NASLOV_MAXLENGTH.''; echo '
'; echo '
'; echo ' '; echo ' '; echo ' ' . strlen($row['akronim']) . '/'.ANKETA_AKRONIM_MAXLENGTH.''; echo '
'; echo '
'; echo ''; echo ''; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '; echo ' ' . strlen($row['intro_opomba']) . '/'.ANKETA_NOTE_MAXLENGTH.''; echo '
'; // Ce ima uporabnik mape, lahko izbere v katero mapo se anketa uvrsti UserSetting::getInstance()->Init($global_user_id); $show_folders = UserSetting::getInstance()->getUserSetting('survey_list_folders'); $selected_folder = 0; $sqlFA = sisplet_query("SELECT folder FROM srv_mysurvey_anketa WHERE usr_id='".$global_user_id."' AND ank_id='".$this->anketa."'"); if(mysqli_num_rows($sqlFA) > 0){ $rowFA = mysqli_fetch_array($sqlFA); $selected_folder = $rowFA['folder']; } $sqlF = sisplet_query("SELECT id, naslov FROM srv_mysurvey_folder WHERE usr_id='".$global_user_id."' ORDER BY naslov ASC"); if($show_folders == 1 && mysqli_num_rows($sqlF) > 0){ echo '
'; echo ''; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ''; echo '
'; } echo '
'; /* JEZIK */ echo '
'; echo '' . $lang['lang'] . Help::display('srv_nastavitve_jezik').''; $lang_admin = $row['lang_admin']; $lang_resp = $row['lang_resp']; $lang_array = array(); // Preberemo razpoložljive jezikovne datoteke if ($dir = opendir('../../lang')) { while (($file = readdir($dir)) !== false) { if ($file != '.' AND $file != '..') { if (is_numeric(substr($file, 0, strpos($file, '.')))) { $i = substr($file, 0, strpos($file, '.')); if ($i > 0) { $file = '../../lang/'.$i.'.php'; @include($file); $lang_array[$i] = $lang['language']; } } } } } // nastavimo jezik nazaj if ($lang_admin > 0) { $file = '../../lang/'.$lang_admin.'.php'; @include($file); } echo '
'; echo ''.$lang['srv_language_admin_survey'].':'; ksort($lang_array); foreach ($lang_array AS $key => $val) { if ($key == 1 || $key == 2) { echo '
'; echo ''; echo ''; echo '
'; } } echo '
'; echo '
'; echo '
'; echo ''; asort($lang_array); echo ''; echo '
'; // Preverimo, ce je funkcionalnost v paketu, ki ga ima uporabnik $userAccess = UserAccess::getInstance($global_user_id); if($userAccess->checkUserAccess($what='prevajanje')){ $lang_link = 'window.location.href=\'index.php?anketa='.$this->anketa.'&a=prevajanje\'; return false;'; $color = 'white-black'; } else{ $lang_link = 'popupUserAccess(\'prevajanje\'); return false;'; $color = 'yellow user_access_locked'; } echo '
'; echo ''; echo '
'; echo '
'; echo '
'; // Gumb shrani - vmes echo '
'; echo ''; echo ''; echo '
'; /* INTERAKTIVNI ELEMENTI */ echo '
'; echo ''.$lang['srv_interaktivni_elementi'].''; SurveySetting::getInstance()->Init($this->anketa); $survey_privacy = SurveySetting::getInstance()->getSurveyMiscSetting('survey_privacy'); $survey_hint = SurveySetting::getInstance()->getSurveyMiscSetting('survey_hint'); if ($survey_hint == '') $survey_hint = 1; $survey_hide_title = SurveySetting::getInstance()->getSurveyMiscSetting('survey_hide_title'); $survey_track_reminders = SurveySetting::getInstance()->getSurveyMiscSetting('survey_track_reminders'); if ($survey_track_reminders == '') $survey_track_reminders = 0; $display_backlink = SurveySetting::getInstance()->getSurveyMiscSetting('display_backlink'); $multiple_pages = false; $sqlg = sisplet_query("SELECT id FROM srv_grupa WHERE ank_id = '$this->anketa'"); if (mysqli_num_rows($sqlg) > 1) $multiple_pages = true; // Indikator napredka echo '
'; echo ''; echo ''; echo ' '; echo '
'; // Naslov ankete za uporabnike echo '
'; echo ''; echo ''; echo ' '; echo '
'; // Nadaljuj kasneje if($this->survey_type > 1 && !SurveyInfo::getInstance()->checkSurveyModule('panel')){ echo '
'; echo ''; echo ''; echo ' '; echo '
'; } // Gumb nazaj echo '
'; echo ''; echo ''; echo ' '; echo '
'; // Namig echo '
'; echo ''; echo ''; echo ' '; echo '
'; /* KNJIZNICA */ $sqlk = sisplet_query("SELECT * FROM srv_library_anketa WHERE ank_id='$this->anketa' AND uid='$global_user_id'"); $moje = mysqli_num_rows($sqlk); $sqlk = sisplet_query("SELECT * FROM srv_library_anketa WHERE ank_id='$this->anketa' AND uid='0'"); $javne = mysqli_num_rows($sqlk); if ($admin_type == 0 || $admin_type == 1) { echo '
'; echo ''; echo ''; echo ' '; echo '
'; } echo '
'; echo ''; echo ''; echo ' '; echo '
'; ?> '; echo '' .$lang['srv_privacy'] .' '.Help::display('srv_privacy_setting').':'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo ''; // Oozorilo na vprašanja echo '
'; echo ''.$lang['srv_opozorilo_vprasanja'].Help::display('srv_splosnenas_opozorilo').':'; echo '
'; echo ''.$lang['srv_no_reminder_all'].''; echo '
'; echo '
'; echo ' '.$lang['srv_soft_reminder_all'].''; echo '
'; echo '
'; echo ''.$lang['srv_hard_reminder_all'].''; echo '
'; echo '
'; echo '
'; /* ZAKLJUCEK (samo pri formi) */ if($row['survey_type'] == 1){ echo '
'; echo ''.$lang['srv_end_label'].''; if ($row['url'] != '') $url = $row['url']; else $url = $site_url; echo '
'; echo ''; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo ''; echo '
'; // Prikaz zakljucka echo '
'; echo ''; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; // Besedilo zakljucka echo ''; // Gumb konec echo '
'; echo ''; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; // Gumb nazaj echo '
'; echo ''; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo '
'; } /* STEVILCENJE */ echo '
'; echo '' . $lang['srv_nastavitveStevilcenje'] . ''; // Izklop prestevilcevanja $enumerate = SurveySetting::getInstance()->getSurveyMiscSetting('enumerate'); if ($enumerate == '') $enumerate = 1; echo '
'; echo ''; echo ''; echo ' '; echo '
'; //način številčenja echo '
'; echo ''; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; /* JS TRACKING */ if ($admin_type == 0 || $admin_type == 1) { echo '
'.$lang['srv_js_tracking'].''; echo '
'; echo ''.$lang['js_tracking_note'].''; echo ''; echo '
'; echo '
'; } } /* PISKOTEK */ if ($_GET['a'] == A_PRIKAZ) { echo '
'; echo '' . $lang['srv_data_valid_units_settings'] . ''; echo '
'; echo ''.$lang['srv_prikaz_default_valid'].''; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; // Pri volitvah ne moremo prikazati datuma respondenta /*if(!SurveyInfo::getInstance()->checkSurveyModule('voting')){ echo '
'; echo ''.$lang['srv_prikaz_showItime'].''; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; } echo '
'; echo ''.$lang['srv_prikaz_showLineNumber'].''; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
';*/ echo '
'; echo '
'; } /*Piskotek*/ if ($_GET['a'] == 'piskot') { // Pri volitvah ne moremo popravljati nastavitev piskotka if(SurveyInfo::getInstance()->checkSurveyModule('voting')){ echo '
'; echo '' . $lang['srv_cookie'] . ''; echo ''.$lang['srv_voting_no_cookie'].''; echo '
'; echo '
'; return; } echo '
'; echo '' . $lang['settings'] . ''; // Piskotkov nimamo, ce imamo vklopljen modul panel if(!SurveyInfo::getInstance()->checkSurveyModule('panel')){ echo ''; // Shrani piskotek za X casa echo ''; echo ''; } // Nikoli ne more popravljati svojih odgovorov (tudi ce se npr. vrne na prejsnjo stran) echo '
'; echo '' . $lang['srv_subsequent_answers'] . Help :: display('srv_subsequent_answers') . ':'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; // Prepoznaj respondenta echo '
'; echo '' . $lang['srv_user'] . Help :: display('srv_user_from_cms') . ':'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; // Ob izpolnjevanju prikazi email echo '
'; echo '' . $lang['srv_user_cms_show'] . ':'; echo '
'; echo '0?'':' disabled="true" ').'/>'; echo ''; echo '
'; echo '
'; echo '
'; // Masovno vnasanje - modul Vnos echo '
'.$lang['srv_vrsta_survey_type_5'].''; echo '

'.$lang['srv_vnos_navodila'].'

'; echo '
'; echo '' . $lang['srv_mass_input'] . ':'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; // For modul maza, show all cookie settings $isMaza = (SurveyInfo::checkSurveyModule('maza')) ? 1 : 0; ?> anketa . "' AND (uid='" . $global_user_id . "' OR uid IN (SELECT user FROM srv_dostop_manage WHERE manager='$global_user_id' ))"; $sqlDostopAvtor = sisplet_query($stringDostopAvtor); $rowDostopAvtor = mysqli_fetch_assoc($sqlDostopAvtor); $avtorRow = SurveyInfo::getInstance()->getSurveyRow(); echo '
'; echo '' . $lang['access'] . ''; /*echo '
'; echo ''; echo ''; echo '
';*/ echo ''."\n"; echo '
'; echo '' . $lang['srv_block_ip'] . Help :: display('srv_block_ip') . ':'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '

'.$lang['srv_block_ip_warning'].'

'; echo '
'; // Preverimo, ce je funkcionalnost v paketu, ki ga ima uporabnik global $global_user_id; $userAccess = UserAccess::getInstance($global_user_id); // dodajanje gesel za anketo echo '
'.$lang['srv_password'].' '.Help::display('srv_dostop_password').''; if(!$userAccess->checkUserAccess($what='password')){ $userAccess->displayNoAccess($what='password'); } else{ echo '
'; $ss = new SurveySkupine($this->anketa); $spr_id = $ss->hasSkupine(2); echo ''; // Preprecimo submit na enter echo ''; // dodajanje gesel za anketo echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; if($spr_id > 0){ $vrednosti = $ss->getVrednosti($spr_id); if($vrednosti != 0){ foreach($vrednosti as $vrednost){ echo ''; echo ''; echo ''; echo ''; } } } echo '
'.$lang['password'].'
'.$vrednost['naslov'].'
'; echo '
'; echo ''; echo '
'; } echo '
'; } /*Trajanje*/ if ($_GET['a'] == 'trajanje') { echo '
'; echo ''; $this->DisplayNastavitveTrajanje(); $this->DisplayNastavitveMaxGlasov(); echo ''; echo '
'; if (isset($_GET['f'])) { switch ($_GET['f']) { case 'vabila_settings': $url =$site_url . 'admin/survey/index.php?anketa='.$this->anketa.'&a=vabila&m=settings'; break; } if (isset($url)) { echo ''.$lang['back'] . ''; } } echo '
'; echo ''; echo ''; echo '
'; } /*Respondenti*/ if ($_GET['a'] == 'resp') { $this->respondenti_iz_baze($row); } /*Komentarji*/ if ($_GET['a'] == 'urejanje') { // tukaj bom dodal še kontrolo na Avtorja ankete, tako da avtor lahko vedno spreminja urejanje (gorazd,1.9.2009) $stringDostopAvtor = "SELECT count(*) as isAvtor FROM srv_dostop WHERE ank_id = '" . $this->anketa . "' AND uid='" . $global_user_id . "'"; $sqlDostopAvtor = sisplet_query($stringDostopAvtor); $rowDostopAvtor = mysqli_fetch_assoc($sqlDostopAvtor); if ($admin_type == 0 || $rowDostopAvtor['isAvtor'] || isDemoSurvey($this->anketa)) { SurveySetting::getInstance()->Init($this->anketa); $survey_comment = SurveySetting::getInstance()->getSurveyMiscSetting('survey_comment'); $survey_comment_showalways = SurveySetting::getInstance()->getSurveyMiscSetting('survey_comment_showalways'); $question_comment = SurveySetting::getInstance()->getSurveyMiscSetting('question_comment'); $survey_comment_viewadminonly = SurveySetting::getInstance()->getSurveyMiscSetting('survey_comment_viewadminonly'); $survey_comment_viewauthor = SurveySetting::getInstance()->getSurveyMiscSetting('survey_comment_viewauthor'); $question_comment_viewadminonly = SurveySetting::getInstance()->getSurveyMiscSetting('question_comment_viewadminonly'); $question_comment_viewauthor = SurveySetting::getInstance()->getSurveyMiscSetting('question_comment_viewauthor'); $question_resp_comment_viewadminonly = SurveySetting::getInstance()->getSurveyMiscSetting('question_resp_comment_viewadminonly'); $question_resp_comment_inicialke = SurveySetting::getInstance()->getSurveyMiscSetting('question_resp_comment_inicialke'); $question_resp_comment_inicialke_alert = SurveySetting::getInstance()->getSurveyMiscSetting('question_resp_comment_inicialke_alert'); $question_resp_comment = SurveySetting::getInstance()->getSurveyMiscSetting('question_resp_comment'); $srv_qct = SurveySetting :: getInstance()->getSurveyMiscSetting('question_comment_text'); $question_note_view = SurveySetting::getInstance()->getSurveyMiscSetting('question_note_view'); $question_note_write = SurveySetting::getInstance()->getSurveyMiscSetting('question_note_write'); $question_resp_comment_show_open = SurveySetting::getInstance()->getSurveyMiscSetting('question_resp_comment_show_open'); $survey_comment_resp = SurveySetting::getInstance()->getSurveyMiscSetting('survey_comment_resp'); $survey_comment_showalways_resp = SurveySetting::getInstance()->getSurveyMiscSetting('survey_comment_showalways_resp'); $survey_comment_viewadminonly_resp = SurveySetting::getInstance()->getSurveyMiscSetting('survey_comment_viewadminonly_resp'); $survey_comment_viewauthor_resp = SurveySetting::getInstance()->getSurveyMiscSetting('survey_comment_viewauthor_resp'); $sortpostorder = SurveySetting::getInstance()->getSurveyMiscSetting('sortpostorder'); $addfieldposition = SurveySetting::getInstance()->getSurveyMiscSetting('addfieldposition'); $commentmarks = SurveySetting::getInstance()->getSurveyMiscSetting('commentmarks'); $commentmarks_who = SurveySetting::getInstance()->getSurveyMiscSetting('commentmarks_who'); $comment_history = SurveySetting::getInstance()->getSurveyMiscSetting('comment_history'); $srvlang_srv_question_respondent_comment = SurveySetting::getInstance()->getSurveyMiscSetting('srvlang_'.'srv_question_respondent_comment'.''); if ($srvlang_srv_question_respondent_comment == '') $srvlang_srv_question_respondent_comment = $lang['srv_question_respondent_comment']; $preview_disableif = SurveySetting::getInstance()->getSurveyMiscSetting('preview_disableif'); $preview_disablealert = SurveySetting::getInstance()->getSurveyMiscSetting('preview_disablealert'); $preview_displayifs = SurveySetting::getInstance()->getSurveyMiscSetting('preview_displayifs'); $preview_displayvariables = SurveySetting::getInstance()->getSurveyMiscSetting('preview_displayvariables'); $preview_hidecomment = SurveySetting::getInstance()->getSurveyMiscSetting('preview_hidecomment'); $preview_hide_survey_comment = SurveySetting::getInstance()->getSurveyMiscSetting('preview_hide_survey_comment'); $preview_survey_comment_showalways = SurveySetting::getInstance()->getSurveyMiscSetting('preview_survey_comment_showalways'); $preview_disable_test_insert = SurveySetting::getInstance()->getSurveyMiscSetting('preview_disable_test_insert'); if ( isset($_GET['show']) && $_GET['show']=='on_alert' ) { echo '
'; echo '
'.$lang['srv_comments_on_alert'].'
'; echo '
'; echo $lang['srv_comments_on_alert1'].' '.$lang['srv_here'].'. '; echo $lang['srv_comments_on_alert2']; echo ' '.$lang['srv_more_info'].'.'; echo '
'; echo '
'; } $css_width = ''; if ($survey_comment != "") { $css_width = 'min-height:250px;width:45% !important;'; $css_width2 = 'width:45% !important;'; } $advanced_expanded = isset($_GET['advanced_expanded']) ? $_GET['advanced_expanded'] : ''; echo '
'.$lang['comments'].''; echo '

'.$lang['srv_admin_s_comments_editor'].'

'; echo '
'; echo ''; echo '

('.$lang['srv_comments_admin_note1'].')

'; echo '
'; echo '
'; echo ''; echo '

('.$lang['srv_comments_admin_note2'].')

'; echo '
'; echo '

'.$lang['srv_admin_s_comments_resp'].'

'; echo '
'; echo ''; echo '

('.$lang['srv_comments_resp_note2'].')

'; echo '
'; echo '
'; echo ''; echo '

('.$lang['srv_comments_resp_note'].')

'; echo '
'; echo '

'.$lang['srv_admin_s_comments_links'].'

'; echo ''; echo '
'; ?> '.$lang['srv_admin_s_comments'].''; echo ''; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo '
'; echo ''; } //Komentarji - napredne nastavitve echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'.$lang['srv_preview_defaults'].''; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo '' . $lang['srv_preview_survey_comment_showalways'] .':'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_preview_disable_test_insert'] . ':'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo '
'; echo '
'.$lang['srv_admin_s_comments'].''.$lang['srv_admin_s_comments_txt'].''; echo '
'; echo '' . $lang['srv_comments_write'] . ':'; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_comments_view'] . ':'; echo '
'; echo ' '; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_survey_comment_show'] . ':'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_admin_q_notes'] . ''.$lang['srv_admin_q_notes_txt'].''; echo '
'; echo '' . $lang['srv_q_note_view'] . ':'; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_q_note_write'] . ':'; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_admin_q_comments'] . ''.$lang['srv_admin_q_comments_txt'].''; echo '
'; echo '' . $lang['srv_comments_write'] . ':'; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_comments_view'] . ':'; echo '
'; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_comments_respondents'] . ''; echo '

'.$lang['srv_comments_respondents_txt'].'

'; echo '
'; echo '' . $lang['srv_q_comment'] . ':'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_comments_view'] . ':'; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_comments_show_open'] . ':'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo '
'; echo '' .$lang['text'].' "'. $lang['srv_question_respondent_comment'] . '":'; echo '
'; echo ''; echo '';echo '
'; echo '
'; echo '

'.$lang['srv_resp_s_comments_txt'].'

'; echo '
'; echo '' . $lang['srv_comments_write'] . ':'; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_comments_view'] . ':'; echo '
'; echo ' '; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '

'.$lang['srv_extra_settings'].'

'; echo '
'; echo '' . $lang['srv_q_inicialke'] . ':'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_q_inicialke_alert'] . ':'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_settings_komentarji'] . ''; echo '
'; echo '' . $lang['orderby'] . ':'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_add_comment'] . ':'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_comments_marks'] . ':'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_comments_marks_who'] . ':'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_comment_history'] . ':'; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo '

'.$lang['srv_delete_comments3'].' ('.$lang['srv_delete_comments_txt2'].')

'; echo '
'; } } /*Dostop*/ if ($_GET['a'] == 'dostop') { // tukaj bom dodal še kontrolo na Avtorja ankete, tako da avtor lahko vedno spreminja dostop (gorazd,1.9.2009) $stringDostopAvtor = "SELECT count(*) as isAvtor FROM srv_dostop WHERE ank_id = '" . $this->anketa . "' AND (uid='" . $global_user_id . "' OR uid IN (SELECT user FROM srv_dostop_manage WHERE manager='$global_user_id' ))"; $sqlDostopAvtor = sisplet_query($stringDostopAvtor); $rowDostopAvtor = mysqli_fetch_assoc($sqlDostopAvtor); if ($admin_type <= $row['dostop'] || $rowDostopAvtor['isAvtor'] > 0) { echo '
' . $lang['srv_dostop_users'] . '' . Help :: display('srv_dostop_users'). ''; //Dodajanje dostopa - prikaži vse za admine - potrebuje prenovo /**if($admin_type == 0 || $admin_type == 1){ echo ''; }**/ echo '
'; $this->display_dostop_users(0); echo '
'; echo '
'; echo ''; echo '
'; echo '
'; // Dodajanje uproabnikov preko e-maila echo '
'.$lang['srv_dostop_addusers'].''; echo '
'; $this->display_add_survey_dostop(); echo '
'; echo '
'; } } /*Jezik*/ if ($_GET['a'] == 'jezik') { global $admin_lang; $lang_admin = $row['lang_admin']; $lang_resp = $row['lang_resp']; $admin_lang = $lang; // ce ni default jezik, damo za osnovnega, default jezik global $resp_lang; $file = '../../lang/'.$row['lang_resp'].'.php'; include($file); $resp_lang = $lang; //$lang_admin = $lang_resp; // nazaj na administrativnega $file = '../../lang/'.$lang_admin.'.php'; include($file); echo '
'.$lang['srv_extra_translations'].' '; $lang_id = ''; if ($row['multilang'] == 1) { echo ' '; } echo ''; echo '
'; echo ''; // da vemo, da nastavljamo ta besedila // Tabela standardnih besed echo ''; echo ''; echo ''; echo ''; // nazaj na administrativni jezik $file = '../../lang/'.$lang_admin.'.php'; include($file); echo ''; echo ''; // jezik nastavimo na nastavitev za respondente, ker ta text dejansko nastavljamo $file = '../../lang/'.$lang_resp.'.php'; include($file); // Pri gumbih ne prikazujemo editorja $this->extra_translation('srv_nextpage'); $this->extra_translation('srv_nextpage_uvod'); $this->extra_translation('srv_prevpage'); $this->extra_translation('srv_lastpage'); $this->extra_translation('srv_forma_send'); $this->extra_translation('srv_potrdi'); $this->extra_translation('srv_konec'); $this->extra_translation('srv_remind_sum_hard', 1); $this->extra_translation('srv_remind_sum_soft', 1); $this->extra_translation('srv_remind_num_hard', 1); $this->extra_translation('srv_remind_num_soft', 1); $this->extra_translation('srv_remind_hard', 1); $this->extra_translation('srv_remind_soft', 1); $this->extra_translation('srv_remind_hard_-99', 1); $this->extra_translation('srv_remind_soft_-99', 1); $this->extra_translation('srv_remind_hard_-98', 1); $this->extra_translation('srv_remind_soft_-98', 1); $this->extra_translation('srv_remind_hard_-97', 1); $this->extra_translation('srv_remind_soft_-97', 1); $this->extra_translation('srv_remind_hard_multi', 1); $this->extra_translation('srv_remind_soft_multi', 1); $this->extra_translation('srv_remind_captcha_hard', 1); $this->extra_translation('srv_remind_captcha_soft', 1); $this->extra_translation('srv_remind_email_hard', 1); $this->extra_translation('srv_remind_email_soft', 1); $this->extra_translation('srv_alert_number_exists', 1); $this->extra_translation('srv_alert_number_toobig', 1); $this->extra_translation('srv_ranking_avaliable_categories', 1); $this->extra_translation('srv_ranking_ranked_categories', 1); $this->extra_translation('srv_question_respondent_comment', 1); $this->extra_translation('srv_continue_later', 1); $this->extra_translation('srv_continue_later_txt', 1); $this->extra_translation('srv_continue_later_email', 1); $this->extra_translation('srv_dropdown_select', 1); $this->extra_translation('srv_wrongcode', 1); $this->extra_translation('user_bye_textA', 1); $this->extra_translation('srv_survey_non_active', 1); $this->extra_translation('srv_survey_deleted', 1); $this->extra_translation('srv_survey_non_active_notActivated', 1); $this->extra_translation('srv_survey_non_active_notStarted', 1); $this->extra_translation('srv_survey_non_active_expired', 1); $this->extra_translation('srv_survey_non_active_voteLimit', 1); // nastavimo jezik nazaj $file = '../../lang/'.$lang_admin.'.php'; include($file); echo '
'.($lang_id > 0 ? $lang['srv_language_respons_1'].': '.$resp_lang['language']:$lang['srv_language_admin'].': '.$lang['language']).''.$lang['srv_std_second'].': '; $file = '../../lang/'.$lang_resp.'.php'; include($file); echo $lang['language'].'
'.$lang['srv_std_translation'].'
'; echo '
'; // Gumb za ponastavitev prevoda v bazi pobriše že nastavljene prevode za izbran jezik echo '
'; echo ' '; echo '
'; // Ta del se v 2. fazi zamenja z gumbom "Večjezične ankete" echo '
'; echo '

'.$lang['srv_language_link2'].':'; // Preverimo, ce je funkcionalnost v paketu, ki ga ima uporabnik $userAccess = UserAccess::getInstance($global_user_id); if($userAccess->checkUserAccess($what='prevajanje')){ echo ' '.$lang['srv_language_link'].'

'; } else{ echo ' '.$lang['srv_language_link'].'

'; } echo '

'.$lang['srv_language_mySurveys'].'.

'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; } /*Forma*/ if ($_GET['a'] == 'forma') { } /*Nastavitve prikaza za mobilnike*/ if ($_GET['a'] == 'mobile_settings') { SurveySetting::getInstance()->Init($this->anketa); echo '
'; echo ''.$lang['srv_mobile_settings_title'].Help::display('srv_mobilne_tabele').''; // Prikaz slik pri mobilnikih (default da) $mobile_friendly = SurveySetting::getInstance()->getSurveyMiscSetting('mobile_friendly'); echo '
'; echo ''; echo ''; echo ' '; echo '
'; $display = ($mobile_friendly == 1) ? '' : 'displayNone'; echo '
'; // Prikaz slik pri mobilnikih (default da) $hide_mobile_img = SurveySetting::getInstance()->getSurveyMiscSetting('hide_mobile_img'); echo '
'; echo ''; echo ''; echo ' '; echo '
'; // Prilagoditev tabel pri mobilnikih /*$mobile_tables = SurveySetting::getInstance()->getSurveyMiscSetting('mobile_tables'); echo '
'; echo ''.$lang['srv_settings_mobile_tables'].':'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
';*/ echo '
'; echo '
'; } /*Nastavitve prikaza za tabele*/ if ($_GET['a'] == 'table_settings') { SurveySetting::getInstance()->Init($this->anketa); echo '
'; echo ''.$lang['srv_table_settings_title'].''; // Prilagoditev tabel na pc-ju $pc_tables = SurveySetting::getInstance()->getSurveyMiscSetting('pc_tables'); echo '
'; echo ''.$lang['srv_table_settings_pc_tables'].':'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; // Prilagoditev tabel pri mobilnikih $mobile_tables = SurveySetting::getInstance()->getSurveyMiscSetting('mobile_tables'); echo '
'; echo ''.$lang['srv_table_settings_mobile_tables'].':'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo '
'; } /*Metapodatki (Parapodatki)*/ if ($_GET['a'] == 'metadata') { SurveySetting::getInstance()->Init($this->anketa); $ip = SurveySetting::getInstance()->getSurveyMiscSetting('survey_ip'); $ip_show = SurveySetting::getInstance()->getSurveyMiscSetting('survey_show_ip'); $browser = SurveySetting::getInstance()->getSurveyMiscSetting('survey_browser'); $referal = SurveySetting::getInstance()->getSurveyMiscSetting('survey_referal'); $date = SurveySetting::getInstance()->getSurveyMiscSetting('survey_date'); $ip = $ip == '' ? 0 : $ip; $ip_show = $ip_show == '' ? 0 : $ip_show; $browser = $browser == '' ? 0 : $browser; $referal = $referal == '' ? 0 : $referal; $date = $date == '' ? 0 : $date; echo '
'; echo ''.$lang['srv_sledenje'].''; // Preverimo ce je vklopljen modul za volitve - potem ne pustimo nobenih preklopov $voting_disabled = ''; if(SurveyInfo::getInstance()->checkSurveyModule('voting')){ $voting_disabled = ' disabled'; echo '

'.$lang['srv_voting_warning_paradata'].'


'; } echo '
'; echo '

'.$lang['srv_metadata_desc'].'

'; echo '
'; echo '
'; echo ''; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ''; echo ' '; echo '
'; echo '
'; echo '
'; echo ''.$lang['srv_sledenje_ip_title'].''; //Shranjuj IP naslov respondenta echo '
'; echo ''; echo ''; echo ' '; echo '
'; echo '
'; echo '

'.$lang['srv_sledenje_ip_alert'].'


'; echo '
'; //Poveži IP v bazi s podatki if ($admin_type == 0 || $admin_type == 1){ echo '
'; echo '
'; echo ''; echo ''; echo ' '; echo '
'; echo '
'; echo '

'.$lang['srv_show_ip_alert'].'

'; echo '
'; echo '
'; } echo '
'; // Povezovanje identifikatorjev s podatki - samo za admine in ce so vklopljena email vabila if ($admin_type == 0 && SurveyInfo::getInstance()->checkSurveyModule('email')) { echo '
'; echo ''.$lang['srv_sledenje_identifikatorji_title'].' '.Help::display('srv_email_with_data').''; echo '
'; echo ''.$lang['srv_sledenje_identifikatorji'].':'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo '

'.$lang['srv_show_mail_with_data3'].'.

'; echo '
'; echo '
'; } } /* Nastavitve pdf/rtf izvozov */ if ($_GET['a'] == 'export_settings') { SurveySetting::getInstance()->Init($this->anketa); // Nastavitve za izpis vprasalnika echo '
'; echo ''.$lang['srv_export_survey_settings'].''; // Številčenje vprašanj (default da) $export_numbering = SurveySetting::getInstance()->getSurveyMiscSetting('export_numbering'); echo '
'; echo ''; echo ''; echo ' '; echo '
'; // Prikaz pogojev (default da) $export_show_if = SurveySetting::getInstance()->getSurveyMiscSetting('export_show_if'); echo '
'; echo ''; echo ''; echo ' '; echo '
'; // Prikazi uvoda (default ne) $export_show_intro = SurveySetting::getInstance()->getSurveyMiscSetting('export_show_intro'); echo '
'; echo ''; echo ''; echo ' '; echo '
'; echo '
'; // Nastavitve za izpis odgovorov respondentov echo '
'; echo ''.$lang['srv_export_results_settings'].''; // Številčenje vprašanj (default da) $export_data_numbering = SurveySetting::getInstance()->getSurveyMiscSetting('export_data_numbering'); echo '
'; echo ''; echo ''; echo ' '; echo '
'; // Prikaz recnuma (default da) $export_data_show_recnum = SurveySetting::getInstance()->getSurveyMiscSetting('export_data_show_recnum'); echo '
'; echo ''; echo ''; echo ' '; echo '
'; // Prikaz pogojev (default da) $export_data_show_if = SurveySetting::getInstance()->getSurveyMiscSetting('export_data_show_if'); echo '
'; echo ''; echo ''; echo ' '; echo '
'; // Page break med posameznimi respondenti (default ne) $export_data_PB = SurveySetting::getInstance()->getSurveyMiscSetting('export_data_PB'); echo '
'; echo ''; echo ''; echo ' '; echo '
'; // Izpusti vprasanja brez odgovora (default ne) $export_data_skip_empty = SurveySetting::getInstance()->getSurveyMiscSetting('export_data_skip_empty'); echo '
'; echo ''; echo ''; echo ' '; echo '
'; // Izpusti podvprasanja brez odgovora (default ne) $export_data_skip_empty_sub = SurveySetting::getInstance()->getSurveyMiscSetting('export_data_skip_empty_sub'); echo '
'; echo ''; echo ''; echo ' '; echo '
'; // Tip izvoza (1->dolg oz. razsirjen, 2->kratek oz. skrcen) echo '
'; $export_data_type = SurveySetting::getInstance()->getSurveyMiscSetting('export_data_type'); echo ''; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo ''; echo ' '; echo '
'; echo '
'; echo '
'; } /* Nastavitve GDPR */ if ($_GET['a'] == A_GDPR) { $gdpr = new GDPR(); $gdpr->displayGDPRSurvey($this->anketa); } if ($_GET['a'] != 'jezik' && $_GET['a'] != 'trajanje' && $_GET['a'] != A_GDPR && $_GET['a'] != 'dostop') { echo '
'; echo ''; echo ''; echo '
'; } if (isset($_GET['s']) && $_GET['s'] == '1') { echo '
'; echo ''; } echo ''; } function anketa_nastavitve_mail() { global $lang; global $site_url; global $site_path; global $admin_type; global $global_user_id; /* Globalne nastavitve ankete: veljajo za celoto anketo ne glede na uporabnika*/ $row = SurveyInfo::getInstance()->getSurveyRow(); $http_referer = parse_url($_SERVER['HTTP_REFERER']); //If yes, parse referrer $referer_url = $http_referer['query']; $show_back_button = false; if(preg_match('/anketa='.$this->anketa.'&a='.A_INVITATIONS.'/', $referer_url) || $_GET['show_back'] == 'true') $show_back_button = true; echo '
'.$lang['srv_email_setting_title'].''; echo '
' . "\n\r"; echo ' ' . "\n\r"; echo ' ' . "\n\r"; echo ' ' . "\n\r"; $MA = new MailAdapter($this->anketa); echo ''.$lang['srv_email_setting_select_server'].' '; echo ''; // Google smtp je viden samo starim, kjer je ze vklopljen if($MA->isGoogle()){ echo ''; } echo ''; echo Help :: display('srv_mail_mode'); #1ka mail system $enkaSettings = $MA->get1KASettings(); echo '
'; echo '
'; echo ''.$lang['srv_email_setting_settings'].'
'; echo '
is1KA() ? ' class="displayNone"' : '').'>'; # from echo '

'; echo '

'; # replyTo echo '

'; echo '

'; echo '
'; #GMAIL - Google $enkaSettings = $MA->getGoogleSettings(); echo '
isGoogle() ? ' class="displayNone"' : '').'>'; # from echo '

'; echo '

'; # replyTo echo '

'; echo '

'; #Password echo '

'; echo '

'; echo '
'; #SMTP $enkaSettings = $MA->getSMTPSettings(); echo '
isSMTP() ? ' class="displayNone"' : '').'>'; # from - NICE echo '

'; echo '

'; # from echo '

'; echo '

'; # replyTo echo '

'; echo '

'; #Username echo '

'; echo '

'; #Password echo '

'; echo '

'; #autentikacija echo '

'; echo $lang['srv_email_setting_autentication']; echo ''; echo ''; echo '

'; #Varnost SMTPSecure echo '

'; echo $lang['srv_email_setting_encryption']; echo ''; echo $lang['srv_email_setting_encryption_none'].''; echo ''; echo ''; echo '

'; #port echo '

'; echo $lang['srv_email_setting_port_note']; echo '

'; #host echo '

'; echo '

'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; if (preg_match('/anketa='.$this->anketa.'&a='.A_INVITATIONS.'/', $referer_url) || $show_back_button) { //echo '
'; echo ''; echo '
'; } if (isset($_GET['s']) && $_GET['s'] == '1') { echo '
'; echo ''; } } /** * funkcija, ki prikaze polja za nastavitev ekstra prevodov * */ function extra_translation ($text, $editor = 0) { global $lang; global $admin_lang; global $resp_lang; $lang_id = isset($_GET['lang_id']) ? (int)$_GET['lang_id'] : ''; if ($lang_id > 0) $lang_id = '_'.$lang_id; else $lang_id = ''; $value = SurveySetting::getInstance()->getSurveyMiscSetting('srvlang_'.$text.$lang_id); if ($value == '') $value = $lang[$text]; $onclick = 'onclick="inline_jezik_edit(\'srvlang_'.$text.$lang_id.'\');"'; // Popravimo text za naslednjo stran na uvodu $next_uvod = ''; if($text == 'srv_nextpage_uvod') $next_uvod = $lang_id == '' ? $admin_lang['srv_nextpage_uvod_desc'] : $resp_lang['srv_nextpage_uvod_desc']; echo ''; echo ''.($lang_id==''?$admin_lang[$text]:$resp_lang[$text]).' '.($text == 'srv_nextpage_uvod' ? ' ('.$next_uvod.')' : '').' '; echo ''.$lang[$text].''; echo '
'.$value.'
'; if($editor == 1) echo ''; echo ''; echo '
'; echo ''; } function anketa_nice_links () { global $lang; echo '
'; echo '
'.$lang['srv_nice_url'].''; $sql = sisplet_query("SELECT l.link, a.id, a.naslov FROM srv_nice_links l, srv_anketa a WHERE a.id=l.ank_id ORDER BY l.link ASC"); $table_exists = 0; while ($row = mysqli_fetch_array($sql)) { if ($table_exists == 0) { echo '

'.$lang['srv_nice_url_note'].'

'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; $table_exists = 1; } echo ''; echo ''; echo ''; echo ''; } if ($table_exists == 1){ echo '
'.$lang['srv_nice_url_extension'].''.$lang['srv_nice_url_surveyname'].'
'.$row['link'].''.$row['naslov'].'
'; echo '
'; echo '
'; } echo '
'; echo '
'; } /** * prikaze ankete z administrativnim dostopom za pomoč * */ function anketa_admin () { global $lang; echo '
'; $sql = sisplet_query("SELECT srv_anketa.id, srv_anketa.naslov, users.email FROM srv_anketa, users WHERE users.id=srv_anketa.insert_uid AND dostop_admin >= DATE(NOW()) ORDER BY edit_time DESC"); if (!$sql) echo mysqli_error($GLOBALS['connect_db']); while ($row = mysqli_fetch_array($sql)) { echo '

'.$row['naslov'].' ('.$row['email'].')

'; } echo '
'; } /** * prikaze izbrisanje ankete * */ function anketa_deleted () { global $lang; echo '
'; echo '
'.$lang['srv_anketa_deleted'].''; $sql = sisplet_query("SELECT srv_anketa.id, srv_anketa.naslov, users.email FROM srv_anketa, users WHERE users.id=srv_anketa.insert_uid AND active='-1' ORDER BY edit_time DESC"); if (!$sql) echo mysqli_error($GLOBALS['connect_db']); $table_exists = 0; while ($row = mysqli_fetch_array($sql)) { if ($table_exists == 0) { echo '

'.$lang['srv_anketa_deleted_note'].'

'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; $table_exists = 1; } echo ''; echo ''; echo ''; echo ''; echo ''; } if ($table_exists == 1){ echo '
'.$lang['srv_data_deleted_surveyname'].''.$lang['srv_data_deleted_user'].'
'.$row['naslov'].''.$row['email'].'
'; echo '
'; echo '
'; } echo '
'; echo '
'; } /** * prikaze izbrisanje podatke * */ function data_deleted () { global $lang; echo '
'; echo '
'.$lang['srv_data_deleted'].''; $sql = sisplet_query("SELECT a.id, a.naslov, users.email, COUNT(u.id) AS deleted FROM srv_anketa a, srv_user u, users WHERE u.deleted='1' AND u.ank_id=a.id AND users.id=a.insert_uid GROUP BY a.id ORDER BY edit_time DESC"); if (!$sql) echo mysqli_error($GLOBALS['connect_db']); $table_exists = 0; while ($row = mysqli_fetch_array($sql)) { if ($table_exists == 0) { echo '

'.$lang['srv_data_deleted_note'].'

'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; $table_exists = 1; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } if ($table_exists == 1) echo '
'.$lang['srv_data_deleted_surveyname'].''.$lang['srv_data_deleted_user'].''.$lang['srv_data_deleted'].'
'.$row['naslov'].''.$row['email'].''.$row['deleted'].'
'; echo '
'; echo '
'; } // online urejanje CSS datoteke function anketa_editcss() { $st = new SurveyTheme($this->anketa); $st->edit_css(); } function anketa_vabila() { global $lang; if ($_GET['a'] == A_VABILA) { $this->anketa_vabila_nastavitve(); } elseif ($_GET['a'] == A_OTHER_INV) { $this->anketa_vabila_drugo(); } } function anketa_vabila_nastavitve() { global $lang, $site_url, $global_user_id; $d = new Dostop(); # Opozorilo o napakah $this->survey_errors(); # Opozorilo - anketa ni aktivna $this->activation_error(); // Delite povezavo do ankete echo '
'.$lang['srv_publication_survey_links'].'
'; //echo '

'.$lang['srv_publication_survey_links_note'].'

'; //Lep URL - dodajanje // Preverimo, ce je funkcionalnost v paketu, ki ga ima uporabnik $userAccess = UserAccess::getInstance($global_user_id); if(!$userAccess->checkUserAccess($what='nice_url')){ echo '
'; echo '
'; echo '
'; echo ' '; echo ' '.SurveyInfo::getRawSurveyLink().''; echo '
'; echo ' '; echo '
'; /* echo ' '; */ echo ' '; echo '
'; } else{ echo '
'; echo '
'; echo '
'; echo ' '; echo ' '.SurveyInfo::getRawSurveyLink().''; echo '
'; echo ' '; echo '
'; // Gumb za dodajanje lepega linka echo ' '; echo '
'; if (isset($_GET['error'])) { $error = $_GET['error']; /* ?>'; // Prekratek lep url if(strlen($error) <= 2) echo '

'.$error.' '.$lang['srv_nice_url_short'].'

'; // Predolg lep url elseif(strlen($error) > 20) echo '

'.$error.' '.$lang['srv_nice_url_long'].'

'; // Ze obstaja else echo '

'.$error.' '.$lang['srv_nice_url_taken'].'

'; echo '
'; } } // Zlistamo nice URL, povezave za skupine in jezike $this->niceUrlSettings(); // Spodnji kvadratki // Več načinov deljenja ankete echo '
'; echo '
'; // Vabila echo '
'; echo '
'; echo '
'; echo $lang['srv_publication_invitations']; if(!$userAccess->checkUserAccess('arhivi')) echo ''; echo '
'; echo '
'; // Drugi nacini echo '
'; echo '
'; echo '
'; echo $lang['srv_publication_survey_more']; echo '
'; echo '
'; echo '
'; echo ''; echo ''; } # Opozorilo - anketa ni aktivna private function activation_error(){ global $lang; $row = SurveyInfo::getInstance()->getSurveyRow(); if ($row['active']==0) { echo '
'; //echo '
'; //echo ' '.$lang['srv_publication_survey_noactive']; //echo '
'; //echo '

'.$lang['srv_publication_survey_noactive_note'].'

'; echo '
'; //echo '

'.$lang['srv_anketa_noactive2'].'

'; echo '

'.$lang['srv_publication_survey_noactive_note3'].'

'; //Toggle kopiran iz headerja if (SurveyInfo::getSurveyColumn('active') == 1) { # anketa je aktivna # V kolikor gre za hierarhijo in uporabnik ni administrator hierarhije if (SurveyInfo::getInstance()->checkSurveyModule('hierarhija')){ if ($hierarhija_type == 1) { echo ''; } else{ echo ''; } } else { echo ''; } echo '
'; echo '
'; } else { $anketa_active = "anketa_active('" . $this->anketa . "','" . $row['active'] . "'); "; //Preden anketo aktiviramo preverimo, če gre tudi za izgradnjo hierarhije in če anketa še ni bila aktivirana if (SurveyInfo::getInstance()->checkSurveyModule('hierarhija')){ if ($hierarhija_type == 1) { echo ''; } else{ echo ''; } } else { echo ''; } echo '
'; echo '
'; } echo '
'; //echo '

'.$lang['srv_publication_survey_noactive_note2'].'

'; echo '
'; } } # Opozorilo o napakah private function survey_errors(){ global $lang; $sd = new SurveyDiagnostics($this->anketa); $sd->doDiagnostics(); $diagnostic = $sd->getDiagnostic(); if (is_array($diagnostic) && count($diagnostic) > 0) { echo '
'; echo '
'; echo ' '.$lang['srv_warning']; echo ''; echo '
'; echo $lang['srv_publication_survey_warnings'].'\''.$lang['srv_testiranje'].'\'.'; echo '
'; } } function anketa_vabila_drugo() { global $lang, $site_url, $global_user_id; $d = new Dostop(); # Opozorilo o napakah $this->survey_errors(); # Opozorilo - anketa ni aktivna $this->activation_error(); // Preverimo, ce je funkcionalnost v paketu, ki ga ima uporabnik $userAccess = UserAccess::getInstance($global_user_id); // Več načinov deljenja ankete echo '
'.$lang['srv_publication_survey_more'].'
'; echo '
'; //QR koda echo '
'; echo '
'; echo '
'; echo $lang['srv_anketa_href_friends']; echo '
'; //echo $lang['srv_anketa_href_friends_text']; echo '
'; //jazvem echo '
'; echo '
'; echo '
'; echo $lang['srv_anketa_href_jazvem']; echo '
'; //echo $lang['srv_anketa_href_friends_text']; echo '
'; echo '
'; echo '
'; // Več načinov deljenja ankete echo '
'.$lang['srv_publication_survey_integration'].'
'; echo '
'; //HTML koda echo '
'; echo '
'; echo '
'; echo $lang['srv_anketa_href']; echo '
'; //echo $lang['srv_anketa_href_text']; echo '
'; //HTML koda + števec echo '
'; echo '
'; echo '
'; echo $lang['srv_anketa_href_count']; echo '
'; //echo $lang['srv_anketa_href_count_text']; echo '
'; // iFrame - brez js echo '
'; echo '
'; echo '
'; echo $lang['srv_anketa_href_inojs']; echo '
'; //echo $lang['srv_anketa_href_inojs_text']; echo '
'; // iFrame - js echo '
'; echo '
'; echo '
'; echo $lang['srv_anketa_href_ijs']; echo '
'; //echo $lang['srv_anketa_href_ijs_text']; echo '
'; echo '
'; echo ''; } function niceUrlSettings() { global $lang, $site_url, $global_user_id; $p = new Prevajanje($this->anketa); $p->dostop(); $lang_array = $p->get_all_translation_langs(); $row = SurveyInfo::getInstance()->getSurveyRow(); $p->include_lang($p->lang_resp); $base_lang_resp = $lang['language']; $p->include_base_lang(); $link = SurveyInfo::getSurveyLink(); $preview_disableif = SurveySetting::getInstance()->getSurveyMiscSetting('preview_disableif'); $preview_disablealert = SurveySetting::getInstance()->getSurveyMiscSetting('preview_disablealert'); $preview_displayifs = SurveySetting::getInstance()->getSurveyMiscSetting('preview_displayifs'); $preview_displayvariables = SurveySetting::getInstance()->getSurveyMiscSetting('preview_displayvariables'); $preview_hidecomment = SurveySetting::getInstance()->getSurveyMiscSetting('preview_hidecomment'); $preview_options = ''.($preview_disableif==1?'&disableif=1':'').($preview_disablealert==1?'&disablealert=1':'').($preview_displayifs==1?'&displayifs=1':'').($preview_displayvariables==1?'&displayvariables=1':'').($preview_hidecomment==1?'&hidecomment=1':'').''; echo '
'; //Zlistamo vse lepe url-je $title = 0; $sqll = sisplet_query("SELECT id, link FROM srv_nice_links WHERE ank_id = '$this->anketa' ORDER BY id desc"); while ($rowl = mysqli_fetch_assoc($sqll)) { if ($title == 0) { echo '
'; echo '
'.$lang['srv_publication_survey_niceurl'].'
'; $title = 1; } $link_nice = $site_url . $rowl['link']; echo '
'; echo '
'; echo ' '; echo ' '.$site_url.''.$rowl['link'].''; echo '
'; echo ' '; echo '
'; echo ' '.$lang['srv_diagnostika_testiranje_copy_url']; echo '
'; echo '
'; } // Povezave za skupine in jezike // Navaden url $ss = new SurveySkupine($this->anketa); $spr_id = $ss->hasSkupine(); $vrednosti = $ss->getVrednosti($spr_id); if (count($lang_array) > 0 || $spr_id > 0){ echo '
'; echo '
'.$lang['srv_publication_survey_grouplang'].'
'; if (count($lang_array) > 0){ echo '
'; echo '
'.$base_lang_resp.''.$lang['srv_nice_url_default_lang'].'
'; echo '
'; echo '
'; echo '
'; echo '
'.$lang['srv_nice_url_no_group'].'
'; echo '
'; echo ' '; echo ' '.$link.''; echo '
'; echo '
'; echo ' '.$lang['srv_diagnostika_testiranje_copy_url']; echo '
'; echo '
'; } } // Imamo vec linkov za skupine if($spr_id > 0){ foreach($vrednosti as $vrednost){ $link_skupine = isset($vrednost['nice_url']) ? $vrednost['nice_url'] : $vrednost['url']; echo '
'; echo '
'.$vrednost['naslov'].'
'; echo '
'; echo ' '; echo ' '.$link_skupine.''; echo '
'; echo '
'; echo ' '.$lang['srv_diagnostika_testiranje_copy_url']; echo '
'; echo '
'; } } // Imamo vec linkov za jezike if (count($lang_array) > 0) { foreach ($lang_array AS $lang_id => $lang_name) { echo '
'; echo '
'.$lang_name.'
'; echo '
'; echo '
'; echo '
'; echo '
'.$lang['srv_nice_url_no_group'].'
'; echo '
'; echo ' '; echo ' '.$link.'?language='.$lang_id.''; echo '
'; echo '
'; echo ' '.$lang['srv_diagnostika_testiranje_copy_url']; echo '
'; echo '
'; if($spr_id > 0){ foreach($vrednosti as $vrednost){ $link_skupine = isset($vrednost['nice_url']) ? $vrednost['nice_url'] : $vrednost['url']; echo '
'; echo '
'.$vrednost['naslov'].'
'; echo '
'; echo ' '; echo ' '.$link_skupine.'&language='.$lang_id.''; echo '
'; echo '
'; echo ' '.$lang['srv_diagnostika_testiranje_copy_url']; echo '
'; echo '
'; } } } } } function displayInvSurveyPopup() { global $lang; echo '
'; echo ''.$lang['srv_popup_title'].':'; echo '

'.$lang['srv_embed_js'].Help :: display('srv_popup_js').'

'; echo ''; echo '
'; } /** * nastavitve za obveščanje na email * */ function email_nastavitve ($show_fieldset = true) { global $lang; global $site_url; global $site_path; global $admin_type; global $global_user_id; $row = SurveyInfo::getInstance()->getSurveyRow(); # echo '
'; // če ni aktivna damo opozorilo echo '
' . "\n\r"; echo '' . "\n\r"; echo '
'; $this->respondenti_iz_baze($row,$show_fieldset); echo '
'; if ($admin_type == 0) { if ($show_fieldset) { echo '
'.$lang['srv_show_mail_with_data'].''; } else { echo '

4.'.$lang['srv_show_mail_with_data'].'

'; } echo ''.$lang['srv_show_mail_with_data2'].': '; echo ''.$lang['no'].' '; echo ''.$lang['yes'].' '; echo '

* '.$lang['srv_show_mail_with_data3'].'

'; if ($show_fieldset) { echo '
'; } } echo '
'; echo ''; if (isset($_GET['s']) && $_GET['s'] == '1') { echo '
'; echo ''; } #echo '
'; } /** * vrne kodo ankete, ki se jo uporabi za embed * */ function getEmbed ($js = true) { global $site_url; $link = SurveyInfo::getSurveyLink(); SurveyInfo::getInstance()->SurveyInit($this->anketa); $row = SurveyInfo::getInstance()->getSurveyRow(); $iframe = ''; $javascript = ''; if ($js) return htmlentities($iframe.$javascript, ENT_QUOTES); else return htmlentities($iframe, ENT_QUOTES); } /** * vrne kodo ankete, ki se jo uporabi za popup embed * */ function getPopup () { global $site_url; $link = SurveyInfo::getSurveyLink().'&popup=1'; SurveyInfo::getInstance()->SurveyInit($this->anketa); $row = SurveyInfo::getInstance()->getSurveyRow(); $javascript = ''; // Dodatek ce bomo delali se naprej popup embed (cross domain problem) //if(window.addEventListener){window.addEventListener("message", function(e){if(e.data == "closePopup"){document.getElementById("popup_iframe").remove();document.getElementById("popup_div").remove();}});} return htmlentities($javascript, ENT_QUOTES); } /** * @desc prika?e nastavitve alerta za formo */ function alert_nastavitve() {//OSTANE global $lang; global $site_url; global $admin_type; $anketa = $this->anketa; $preklici_url = ltrim(str_replace("&s=1","",$_SERVER['REQUEST_URI']),"/"); $preklici_url = "'". $site_url . $preklici_url . "'"; /* moznosti: * 'complete' -> obvsetilo o izpolnjeni anketi (respondent, respondent iz cms, avtor + dostop, dodatn-emaili) * 'delete' -> obvestilo o izbrisani anketi (avtor + dostop, dodatni -emaili) * 'active' -> obvestilo o aktivnosti, neaktivnosti ankete (avtor + dostop, dodatni -emaili) * 'expire' -> obvestilo o izteku ankete (avtor + dostop, dodatni -emaili) * 'email_server' -> nastavitve mail streznika */ if ( isset($_GET['m']) && $_GET['m'] != "") { $tab = $_GET['m']; } else { $tab = $_GET['m'] = 'complete'; } // preberemo nastavitve alertov $sqlAlert = sisplet_query("SELECT * FROM srv_alert WHERE ank_id = '$anketa'"); if (!$sqlAlert) echo mysqli_error($GLOBALS['connect_db']); if (mysqli_num_rows($sqlAlert) > 0) { $rowAlert = mysqli_fetch_array($sqlAlert); } else { SurveyAlert::getInstance()->Init($anketa, $global_user_id); $rowAlert = SurveyAlert::setDefaultAlertBeforeExpire(); } $days = $rowAlert['expire_days']; $sqlS = sisplet_query("SELECT id, expire, survey_type, insert_uid, DATE_SUB(expire,INTERVAL $days DAY) as newdate FROM srv_anketa WHERE id = '$anketa'"); if (!$sqlS) echo mysqli_error($GLOBALS['connect_db']); $rowS = mysqli_fetch_array($sqlS); $rowAlert['newdate'] = $rowS['newdate']; $sqlu = sisplet_query("SELECT email FROM users WHERE id = '$rowS[insert_uid]'"); $rowu = mysqli_fetch_array($sqlu); $MailReply = $rowu['email']; $custom_alert = array(); $sql_custom_alert = sisplet_query("SELECT uid, type FROM srv_alert_custom WHERE ank_id = '$this->anketa'"); while ($row_custom_alert = mysqli_fetch_array($sql_custom_alert)) { $custom_alert[$row_custom_alert['type']][$row_custom_alert['uid']] = 1; } if ($tab == 'complete') { //Obveščanje o izpolnjeni anketi echo '
' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo '
'; echo ' ' . $lang['srv_alert_completed_2'] . ''; echo '
'; echo ''.$lang['srv_alert_completed_prejemniki'].''; // respondent - ne prikazemo ce gre za glasovanje oz. volitve if($rowS['survey_type'] != 0 && !SurveyInfo::getInstance()->checkSurveyModule('voting')){ echo '
'; //echo ''; $this->display_alert_label('finish_respondent',($rowAlert['finish_respondent'] == 1)); echo '
'; // Ce imamo vec prevodov omogocimo za vsak prevod svoj email $this->display_alert_label('finish_respondent_language',($rowAlert['finish_respondent'] == 1)); } // respondent iz cms ne prikazemo ce gre za volitve if(!SurveyInfo::getInstance()->checkSurveyModule('voting')){ echo '
'; //echo ''; $this->display_alert_label('finish_respondent_cms',($rowAlert['finish_respondent_cms'] == 1)); echo '
'; } //Avtor ankete oz. souredniki echo '
'; echo ''; $this->display_alert_label('finish_author',($rowAlert['finish_author'] == 1)); echo '
'; //Posebej navedeni maili echo '
'; echo ''; echo ' '; echo ' '; if ($rowAlert['finish_other_if']>0) { if ($b==null) $b = new Branching($this->anketa); $b->conditions_display($rowAlert['finish_other_if']); } echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '

'.$lang['message_content'].'

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; if ($rowAlert['finish_text'] != '') { $text = $rowAlert['finish_text']; } else { // Podpis $signature = Common::getEmailSignature(); $text = nl2br($lang['srv_alert_finish_text'].$signature); } // prikaze editor za ne-spremenljivko (za karkoli druzga pac) echo '
'; echo ''; echo ''; echo '
'; echo '
'; //Navodila na desni echo '
'; echo '
'; echo '

'.$lang['srv_alert_instruction1'].'

'; echo '

'.$lang['srv_alert_instruction1a'].':

'; echo '
'; // ta se skriva, potreben respondent iz CMS, da dobi NAME echo ''.$lang['srv_alert_instruction2'].''; echo '

'.$lang['srv_alert_instruction_survey'].'

'; echo '

'.$lang['srv_alert_instruction_date'].'

'; echo '

'.$lang['srv_alert_instruction_site'].'

'; echo '

'.$lang['srv_alert_instruction_url'].'

'; echo '

'.$lang['srv_alert_instruction_pdf'].'

'; echo '

'.$lang['srv_alert_instruction_rtf'].'

'; $row = SurveyInfo::getInstance()->getSurveyRow(); # če imamo prepoznavanje uporabnik iz CMS, potem ponudimo tudi META_REFERAL_URL if ($rowAlert['finish_respondent_cms'] == 1) echo '

'.$lang['srv_alert_instruction_meta_referer_url'].'

'; echo '
'; echo '
'; $sqlSistemske = sisplet_query("SELECT s.id, s.naslov, s.variable FROM srv_spremenljivka s, srv_grupa g WHERE s.sistem='1' AND s.gru_id=g.id AND g.ank_id='$anketa' ORDER BY g.vrstni_red, s.vrstni_red"); $prefix = ""; while ($rowSistemske = mysqli_fetch_assoc($sqlSistemske)) { $prefix = $prefix . $rowSistemske['variable'] . ', '; } if($prefix != "") { echo '

'.$lang['srv_alert_instruction_available'].'

'; echo '

'.rtrim($prefix, ", ").'

'; echo '

'.$lang['srv_alert_instruction_system'].'

'; echo '

'.$lang['srv_alert_instruction_sample'].'

'; } else{ // ni sistemskih spremenljivk echo '

'.$lang['srv_alert_no_sys_var'].'

'; } echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; if (isset($_GET['s']) && $_GET['s'] == '1') { echo '
'; echo ''; } echo '
'; } else if ($tab == 'expired') { global $site_path, $global_user_id; //Obveščanje o izteku ankete echo '
' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo '
'; echo ' ' . $lang['srv_alert_expired_2'] . ''; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '

'. $lang['srv_alert_expire_expire_at'] .'

'; echo $rowS['expire'].$lang['at'].'00:00'; echo '
'; echo '
'; echo '

'. $lang['srv_alert_expire_note_at'] .'

'; echo '

'.$rowAlert['newdate'].''.$lang['at'].'01:00

'; echo '
'; echo '
'; echo ''.$lang['srv_alert_expire_prejemniki'].''; echo '
'; echo ''; $this->display_alert_label('expire_author',($rowAlert['expire_author'] == 1)); echo '
'; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '

'.$lang['message_content'].'

'; echo '
'; echo ''; echo ''; echo '
'; if ($rowAlert['expire_text'] != ''){ $text = $rowAlert['expire_text']; } else{ // Podpis $signature = Common::getEmailSignature(); $text = nl2br($lang['srv_alert_expire_text'].$signature); } // prikaze editor za ne-spremenljivko (za karkoli druzga pac) echo '
'; echo ''; echo ''; echo '
'; echo '
'; //Navodila na desni echo '
'; echo '
'; echo '

'.$lang['srv_alert_instruction1'].'

'; echo '

'.$lang['srv_alert_instruction1a'].':

'; echo '

'.$lang['srv_alert_instruction4'].'

'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; if (isset($_GET['s']) && $_GET['s'] == '1') { echo '
'; echo ''; } echo '
'; } // Obveščanje o spremembi aktivnosti ankete else if ($tab == 'active') { echo '
' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo '
'; echo '' . $lang['srv_alert_active_2'] . ''; echo '
'; echo ''.$lang['srv_alert_active_prejemniki'].''; echo '
'; echo ''; $this->display_alert_label('active_author',($rowAlert['active_author'] == 1)); echo '
'; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '

'.$lang['message_content'].'

'; echo '

'.$lang['srv_alert_oblika_deactivate_note'].'

'; echo '
'; echo ''; echo ''; echo '
'; if ($rowAlert['active_text0'] != '') { $text0 = $rowAlert['active_text0']; } else { // Podpis $signature = Common::getEmailSignature(); $text0 = nl2br($lang['srv_alert_active_text0'].$signature); } // prikaze editor za ne-spremenljivko (za karkoli druzga pac) echo '
'; echo ''; echo ''; echo '
'; echo '

'.$lang['srv_alert_oblika_activate_note'].'

'; echo '
'; echo ''; echo ''; echo '
'; if ($rowAlert['active_text1'] != '') { $text1 = $rowAlert['active_text1']; } else { // Podpis $signature = Common::getEmailSignature(); $text1 = nl2br($lang['srv_alert_active_text1'].$signature); } echo '
'; echo ''; echo ''; echo '
'; echo '
'; //Navodila na desni echo '
'; echo '
'; echo '

'.$lang['srv_alert_instruction1'].'

'; echo '

'.$lang['srv_alert_instruction1a'].':

'; echo '

'.$lang['srv_alert_instruction5'].'

'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; if (isset($_GET['s']) && $_GET['s'] == '1') { echo '
'; echo ''; } echo '
'; } else if ($tab == 'delete') { echo '
' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; //Obveščanje o izbrisu ankete echo '
'; echo '' . $lang['srv_alert_surveydelete'] . ''; echo '
'; echo ''.$lang['srv_alert_surveydelete_text'].''; echo '
'; echo ''; $this->display_alert_label('delete_author',($rowAlert['delete_author'] == 1)); echo '
'; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '

'.$lang['message_content'].'

'; echo '
'; echo ''; echo ''; echo '
'; if ($rowAlert['delete_text'] != '') { $text = $rowAlert['delete_text']; } else { // Podpis $signature = Common::getEmailSignature(); $text = nl2br($lang['srv_alert_delete_text'].$signature); } // prikaze editor za ne-spremenljivko (za karkoli druzga pac) echo '
'; echo ''; echo ''; echo '
'; echo '
'; //Navodila na desni echo '
'; echo '
'; echo '

'.$lang['srv_alert_instruction1'].'

'; echo '

'.$lang['srv_alert_instruction1a'].':

'; echo '

'.$lang['srv_alert_instruction5a'].'

'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; if (isset($_GET['s']) && $_GET['s'] == '1') { echo '
'; echo ''; } echo '
'; } else if ($tab == 'email_server') { // Gorenje tega nima if (!Common::checkModule('gorenje') && $admin_type == '0') $this->viewServerSettings(); } else { print_r($tab); } ?> '; echo ''.$lang['srv_user_base_email_server_settings'].''; $row = SurveyInfo::getInstance()->getSurveyRow(); // Opozorilo, ce imamo vklopljena vabila, da gre za iste nastavitve $isEmail = (int)SurveyInfo::getInstance()->checkSurveyModule('email'); if($isEmail) echo '

'.$lang['srv_email_server_settings_warning'].'

'; echo '
' . "\n\r"; echo ' ' . "\n\r"; echo ' ' . "\n\r"; echo ' ' . "\n"; echo ' ' . "\n\r"; $MA = new MailAdapter($this->anketa); // Dostop za posiljanje mailov preko 1ka serverja $enabled1ka = ( $MA->is1KA() || (($admin_type == 0) && ($mysql_database_name == 'www1kasi' || $mysql_database_name == 'test1kasi' || $mysql_database_name == 'real1kasi' || $mysql_database_name == '1kaarnessi')) ) ? true : false; echo '
'; echo ''.$lang['srv_email_setting_select_server'].''; echo '
'; echo 'is1KA() ? 'checked ="checked" ' : '').' '.($enabled1ka ? '' : ' disabled="disabled"').' onclick="$(\'#send_mail_mode1, #send_mail_mode2\').hide();$(\'#send_mail_mode0\').show();">'; echo ''; echo '
'; // Google smtp je viden samo starim, kjer je ze vklopljen if($MA->isGoogle()){ echo '
'; echo 'isGoogle() ? 'checked ="checked" ' : '').' onclick="$(\'#send_mail_mode0, #send_mail_mode2\').hide(); $(\'#send_mail_mode1\').show();">'; echo ''; echo '
'; } echo '
'; echo 'isSMTP() ? 'checked ="checked" ' : '').' onclick="$(\'#send_mail_mode0, #send_mail_mode1\').hide(); $(\'#send_mail_mode2\').show();">'; echo ''; echo Help :: display('srv_mail_mode'); echo '
'; echo '
'; #1KA $enkaSettings = $MA->get1KASettings($raziskave=true); echo '
is1KA() ? ' class="displayNone"' : '').'>'; echo ''.$lang['srv_email_setting_settings'].''; echo '
'; # from echo '

'; echo '

'; # replyTo echo '

'; echo '

'; echo '
'; #GMAIL - Google $enkaSettings = $MA->getGoogleSettings(); echo '
isGoogle() ? ' class="displayNone"' : '').'>'; echo ''.$lang['srv_email_setting_adapter1_note'].'
'; echo '
'.$lang['srv_email_setting_settings'].'
'; # from echo '

'; echo '

'; # replyTo echo '

'; echo '

'; #Password echo '

'; echo '

'; echo '
'; #SMTP $enkaSettings = $MA->getSMTPSettings(); echo '
isSMTP() ? ' class="displayNone"' : '').'>'; //echo ''.$lang['srv_email_setting_adapter2_note'].'
'; echo '

'.$lang['srv_email_setting_settings'].'

'; echo '
'; # from - NICE echo '
'; echo ''.$lang['srv_email_setting_from_nice'].''; echo ''; echo '
'; # from echo '
'; echo ''.$lang['srv_email_setting_from'].''; echo ''; echo '
'; echo '
'; echo '
'; # replyTo echo '
'; echo ''.$lang['srv_email_setting_reply'].Help::display('srv_obvescanje_odgovorZa').''; echo ''; echo '
'; echo '
'; echo '
'; #Username echo '
'; echo ''.$lang['srv_email_setting_username'].''; echo ''; echo '
'; #Password echo '
'; echo ''.$lang['srv_email_setting_password'].''; echo ''; echo '
'; echo '
'; echo '
'; #autentikacija echo '
'; echo ''.$lang['srv_email_setting_autentication'].''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; #Varnost SMTPSecure echo '
'; echo ''.$lang['srv_email_setting_encryption'].''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; #port echo '
'; echo ''.$lang['srv_email_setting_port'].$lang['srv_email_setting_port_note'].''; echo ''; echo '
'; #host echo '
'; echo ''.$lang['srv_email_setting_host'].''; echo ''; echo '
'; echo '
'; echo '
'; #delay echo '
'; echo ''.$lang['srv_email_setting_smtp_delay'].' '.Help::display('srv_inv_delay').':'; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; // Gumb preveri nastavitve echo ''; // Gumb shrani echo ''; echo '
'; if (isset($_GET['s']) && $_GET['s'] == '1') { echo ''; } } /** * @desc poslje maile userjem iz baze */ function usermailing() {//OSTANE global $lang; global $site_url; global $site_path; global $global_user_id; // preverimo aktivnost //$sql = sisplet_query("SELECT active FROM srv_anketa WHERE id = '$this->anketa'"); //$row = mysqli_fetch_array($sql); $row = SurveyInfo::getInstance()->getSurveyRow(); // ce ne postamo ali ce anketa ni aktivna if (!isset ($_POST['mailto']) || ($row['active'] != 1)) { echo '
'; echo '
'; $this->anketa_aktivacija_note(); echo'
'; echo '
' . $lang['srv_mailing'] . ':'; echo '
'; echo '

' . $lang['srv_mailing_all'] . '

'; echo '

' . $lang['srv_mailing_nonrsp'] . '

'; echo '

' . $lang['srv_mailing_rsp'] . '

'; echo '

'.$lang['srv_mailing_all_with_status'].':

'; echo '

0 - ' . $lang['srv_userstatus_0'] . '

'; echo '

1 - ' . $lang['srv_userstatus_1'] . '

'; echo '

2 - ' . $lang['srv_userstatus_2'] . '

'; echo '

3 - ' . $lang['srv_userstatus_3'] . '

'; echo '

4 - ' . $lang['srv_userstatus_4'] . '

'; echo '

5 - ' . $lang['srv_userstatus_5'] . '

'; echo '

6 - ' . $lang['srv_userstatus_6'] . '

'; echo ''; echo '
'; $this->displayBtnMailtoPreview($row); echo '
'; // echo ''; echo '
'; echo '
'; echo '
'; echo '
'; $sa = new SurveyAdmin(1, $this->anketa); $sa->show_mailto_users('all', null); echo '
'; } else { // pošljemo emaile $errorMsg = null; //v odvisnosti od statusa polovimo emaile $mailto_radio = $_POST['mailto']; $mailto_status = (isset ($_POST['mailto_status']) && count($_POST['mailto_status']) > 0) ? implode(",", $_POST['mailto_status']) : null; $sa = new SurveyAdmin(1, $this->anketa); $arrayMailtoSqlString = $sa->getMailtoSqlString($mailto_radio, $mailto_status); $errorMsg = $arrayMailtoSqlString['errorMsg']; $sqlString = $arrayMailtoSqlString['sqlString']; // preberemo tekst za trenutno anketo $subject = ""; $text = ""; $sql_userbase_email = sisplet_query("SELECT * FROM srv_userbase_setting WHERE ank_id = '$this->anketa'"); if (mysqli_num_rows($sql_userbase_email) > 0) { // anketa že ima nastavljen text $row_userbase_email = mysqli_fetch_array($sql_userbase_email); } else { // anketa še nima nastavljenega teksta, preberemo privzetega (id=1) iz tabele srv_userbase_invitations $sql_userbase_invitations = sisplet_query("SELECT * FROM srv_userbase_invitations WHERE id = 1"); $row_userbase_email = mysqli_fetch_array($sql_userbase_invitations); } if ($row_userbase_email['replyto'] == '') { $sqluu = sisplet_query("SELECT email FROM users WHERE id = '$global_user_id'"); $rowuu = mysqli_fetch_array($sqluu); $row_userbase_email['replyto'] = $rowuu['email']; } // poiščemo sistemske spremenljivke iz vsebine preg_match_all( "/#(.*?)#/s", $row_userbase_email['text'], $sisVars); // poiščemo sistemske spremenljivke iz vsebine $sisVars =$sisVars[1]; // Poiščemo še sistemske spremenljivke iz ankete $sqlSistemske = sisplet_query("SELECT s.id, s.naslov, s.variable FROM srv_spremenljivka s, srv_grupa g WHERE s.sistem='1' AND s.gru_id=g.id AND g.ank_id='".$this->anketa."' ORDER BY g.vrstni_red, s.vrstni_red"); if (mysqli_num_rows($sqlSistemske) > 0) { while ($rowSistemske = mysqli_fetch_assoc($sqlSistemske)) { if (!isset($sisVars[strtoupper($rowSistemske['variable'])])) $sisVars[] = strtoupper($rowSistemske['variable']); } } $sql_userbase = sisplet_query("SELECT MAX(b.tip) AS tip FROM srv_userbase b, srv_user u WHERE b.usr_id=u.id AND u.ank_id='$this->anketa'"); if (!$sql_userbase) echo mysqli_error($GLOBALS['connect_db']); $row_userbase = mysqli_fetch_array($sql_userbase); $tip = $row_userbase['tip'] + 1; if ($errorMsg == null) { $sql = sisplet_query($sqlString); // preprečimo izisovanje warningov $warnings_msg = ""; $send_success = array (); $send_errors = array (); // ob_start(); // $htmlContent = ob_get_contents(); // ob_start(); $cnt = 0; while ($row = mysqli_fetch_array($sql)) { // dodamo sistemske spremenljivke in poiščemo njihove vrednosti $userSysData = array(); foreach ( $sisVars as $sysVar ) { $sqlUser = sisplet_query("SELECT d.text FROM srv_data_text".$this->db_table." d, srv_spremenljivka s , srv_grupa g WHERE d.spr_id=s.id AND d.usr_id='" . $row['id'] . "' AND s.variable = '".strtolower($sysVar)."' AND g.ank_id='" . $this->anketa . "' AND s.sistem = 1 AND s.gru_id=g.id "); if (!$sqlUser) echo mysqli_error($GLOBALS['connect_db']); $rowUser = mysqli_fetch_assoc($sqlUser); if ($rowUser['text'] != null) $userSysData[strtolower($sysVar)] = $rowUser['text']; } $email = $userSysData['email']; if (trim($email) != '' && $email != null) { // shranimo komu in kdaj je kdo poslal mail sisplet_query("INSERT INTO srv_userbase (usr_id, tip, datetime, admin_id) VALUES ('$row[id]', '$tip', NOW(), '" . $this->uid() . "')"); $url = SurveyInfo::getSurveyLink() . '?code=' . $row['pass'] . ''; if (trim($row['pass']) != '') { $unsubscribe = $site_url . 'admin/survey/unsubscribe.php?anketa=' . $this->anketa . '&code=' . $row['pass'] . ''; } else { $unsubscribe = $site_url . 'admin/survey/unsubscribe.php?anketa=' . $this->anketa . '&email=' . trim($email) . '&uid='.$row['id']; } // zamenjamo sistemske vrednosti $content = $row_userbase_email['text']; // za staro verzijo $content = str_replace('[URL]', '#URL#', $content); $content = str_replace('[CODE]', '#CODE#', $content); $content = str_replace(array ( '#URL#', '#CODE#', ), array ( '' . $url . '', $row['pass'], ), $content); $content = str_replace('#UNSUBSCRIBE#', ''.$lang['user_bye_hl'].'', $content); // poiščemo prestale variable katere je potrebno zamenjati v vsebini preg_match_all( "/#(.*?)#/s", $content, $toReplace); foreach ($toReplace[0] as $key => $seed) { $content = str_replace($toReplace[0][$key], $userSysData[strtolower($toReplace[1][$key])],$content); } $subject = $row_userbase_email['subject']; try { $MA = new MailAdapter($this->anketa, $type='alert'); $MA->addRecipients($email); if ($cnt++ == 0) { # en mail pošljemo tudi na enklikanketa $MA->addRecipients('enklikanketa@gmail.com'); } $resultX = $MA->sendMail(stripslashes($content), $subject); } catch (Exception $e) { } if ($resultX) { $status = 1; // poslalo ok $send_success[] = $email; } else { $status = 2; // ni poslalo $send_errors[] = $email; } // nastavimo status sisplet_query("INSERT INTO srv_userstatus (usr_id, tip, status, datetime) VALUES ('$row[id]', '$tip', '$status', NOW())"); # laststatus updejtamo samo če je bil pred tem status 0 - email še ni poslan ali 2 - napaka pri pošiljanju maila sisplet_query("UPDATE srv_user SET last_status = '$status' WHERE id = '$row[id]' AND last_status IN (0,2)"); } // počistimo warninge // ob_end_clean(); // echo $htmlContent; } echo 'Spodnje sporočilo:

' . $row_userbase_email['subject'] . ',
' . $row_userbase_email['text'] . '
'; if (count($send_success) > 0) { echo 'je bilo uspešno poslano na naslednje naslove:
'; foreach ($send_success as $email) { echo $email . ",
"; } } if (count($send_errors) > 0) { echo '
ni bilo uspešno poslano. Pri pošiljanju na naslednje naslove je prišlo do napake:
'; foreach ($send_errors as $email) { echo $email . ",
"; } } //echo '
Done'; // izpipemo warninge na koncu } else { echo '
' . $errorMsg . '
'; } } } /** * @desc prikaze tab Socialna omrezja */ function SN_Settings() { global $lang; global $site_url; global $site_path; echo '

'.$lang['srv_social_settings_text1'].'

'; echo '

'.$lang['srv_social_settings_text2'].$lang['srv_social_settings_text3'].$lang['srv_social_settings_text4'].'

'; echo '

'.$lang['srv_social_settings_text5'].''.$lang['srv_social_settings_text6'].'.

'; // Omrežja so sestavljane vprašanja. Začnejo se iz generatorja imen (name generator). S tem respondent (ego) navede objekte, prijatelje - alterje. , s katerim pridobimo imena pzanke in vprašanj. Druga kompnenta je zanka, ki za vse alterje določenega ega sproži enaka vprašanja. Dretja komponenta so vprašanja. Primer omrežja je tukaj, http://www.1ka.si/a/3510, vprašalnik pa najdemo v knjižnjic med Primerov 1KA anket http://www.1ka.si/admin/survey/index.php?a=knjiznica } /** * @desc prikaze tab arhivi */ function arhivi() { global $lang; echo '
'; echo '' . $lang['srv_questionnaire_archives'] . ''; echo '

'.$lang['srv_questionnaire_archives_text'].'

'; echo '
'; echo $lang['srv_questionnaire_archives_note'].':'; echo ''; echo '
'; echo '
'; echo ''; echo '
'; // Seznam ustvarjenih arhivov $sql = sisplet_query("SELECT a.id, a.naslov, a.intro_opomba, a.insert_time, a.edit_time, CONCAT(i.name, ' ', i.surname) AS insert_name, CONCAT(e.name, ' ', e.surname) AS edit_name FROM srv_anketa a, users i, users e WHERE a.insert_uid=i.id AND a.edit_uid=e.id AND a.backup = '$this->anketa' AND a.active>='0' ORDER BY a.insert_time DESC"); if (!$sql) echo mysqli_error($GLOBALS['connect_db']); if (mysqli_num_rows($sql) > 0) { echo '

' . $lang['srv_backup_list'] . ':

'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; while ($row = mysqli_fetch_array($sql)) { echo ''; echo ''; echo ''; if ($row['intro_opomba']=='') $opomba = "/"; else if (strlen($row['intro_opomba']) > 40) $opomba = substr($row['intro_opomba'], 0, 37).'...'; else $opomba = $row['intro_opomba']; echo ''; //Ikone echo ''; echo ''; } echo '
'.$lang['srv_questionnaire_archives_date'].''.$lang['srv_questionnaire_archives_by'].''.$lang['srv_questionnaire_archives_note2'].'
'.datetime($row['insert_time']).''.$row['insert_name'].''.$opomba.''; echo '
'; echo ''; echo ''; echo '
'; echo '
'; } echo '
'; } function arhivi_data() { global $lang; echo '
'; echo '' . $lang['srv_arhiv_data'] . ''; echo '

'.$lang['srv_backup_data_text'].'

'; echo '
'; echo ''; echo '
'; // Seznam ustvarjenih arhivov - 2. faza: kdo je arhiviral, opomba, možnost izbrisa $backups = array(); if ($handle = opendir( dirname(__FILE__) . '/SurveyBackup/' )) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { $file = explode('-', $entry); if ($file[0] == $this->anketa) { $backups[] = $entry; } } } closedir($handle); } if (count($backups) > 0) { echo '

' . $lang['srv_backup_data_list'] . ':

'; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ($backups AS $file) { $e = explode('-', $file); $e[2] = str_replace('.1ka', '', $e[2]); $e[2] = str_replace('.', ':', $e[2]); $e[2] = substr($e[2], 0, -3); echo ''; echo ''; //Ikone echo ''; echo ''; } echo '
'.$lang['srv_questionnaire_archives_date'].'
'.$e[1].' '.$e[2].''; echo '
'; //echo ''; echo ''; echo '
'; echo '
'; } echo '
'; } function arhivi_testdata() { global $lang; echo '
'; echo ''.$lang['srv_arhiv_testdata'].''; $link = SurveyInfo::getSurveyLink(); $surveyName = SurveyInfo::getInstance()->getSurveyTitle(); $preview_disableif = SurveySetting::getInstance()->getSurveyMiscSetting('preview_disableif'); $preview_disablealert = SurveySetting::getInstance()->getSurveyMiscSetting('preview_disablealert'); $preview_displayifs = SurveySetting::getInstance()->getSurveyMiscSetting('preview_displayifs'); $preview_displayvariables = SurveySetting::getInstance()->getSurveyMiscSetting('preview_displayvariables'); $preview_hidecomment = SurveySetting::getInstance()->getSurveyMiscSetting('preview_hidecomment'); $preview_options = '' . ($preview_disableif == 1 ? '&disableif=1' : '') . ($preview_disablealert == 1 ? '&disablealert=1' : '') . ($preview_displayifs == 1 ? '&displayifs=1' : '') . ($preview_displayvariables == 1 ? '&displayvariables=1' : '') . ($preview_hidecomment == 1 ? '&hidecomment=1' : '') . ''; echo '

'.$lang['srv_archive_test_data_text1'].''.$lang['srv_archive_test_data_text1a'].''.$lang['srv_archive_test_data_text2'].''.$lang['srv_archive_test_data_text2a'].''.$lang['srv_archive_test_data_text3'].'

'; //Nimamo nobenih vnosov $str_testdata_any = "SELECT count(*) as cnt, time_insert as time FROM srv_user WHERE ank_id='".$this->anketa."' AND (testdata='1' OR testdata='2') GROUP BY day(time_insert)"; $query_testdata_any = sisplet_query($str_testdata_any); list($testdata_any) = mysqli_fetch_row($query_testdata_any); if ((int)$testdata_any == 0) { echo '

'.$lang['srv_archive_test_data_none1']. $surveyName . $lang['srv_archive_test_data_none2'] . $lang['srv_archive_test_data_none3'].'.

'; } else { // Imamo vnose, izpišemo eno ali obe tabeli // Avtomatski vnosi $str_testdata = "SELECT count(*) as cnt, time_insert as time FROM srv_user WHERE ank_id='".$this->anketa."' AND (testdata='2') GROUP BY day(time_insert)"; $query_testdata = sisplet_query($str_testdata); $table_exists1 = 0; while ($testdata = mysqli_fetch_array($query_testdata)) { // Izpišemo naslov in začetek tabele if($table_exists1==0 && $testdata['cnt']!=0) { echo '

'.$lang['srv_archive_test_data_timeline_auto'].$surveyName.':

'; echo ''; echo ''; echo ''; echo ''; echo ''; $table_exists1=1; } echo ''; echo ''; echo ''; echo ''; } if($table_exists1==1) { echo '
'.$lang['srv_archive_test_data_date'].''.$lang['srv_archive_test_data_count'].'
'.date("d.m.Y",strtotime($testdata['time'])).''.$testdata['cnt'].'
'; } // Ročni vnosi $str_testdata = "SELECT count(*) as cnt, time_insert as time FROM srv_user WHERE ank_id='".$this->anketa."' AND (testdata='1') GROUP BY day(time_insert)"; $query_testdata = sisplet_query($str_testdata); $table_exists2 = 0; while ($testdata = mysqli_fetch_array($query_testdata)) { // Izpišemo naslov in začetek tabele if($table_exists2==0 && $testdata['cnt']!=0) { echo '

'.$lang['srv_archive_test_data_timeline_manual'].$surveyName.':

'; echo ''; echo ''; echo ''; echo ''; echo ''; $table_exists2=1; } echo ''; echo ''; echo ''; echo ''; } if($table_exists2==1) { echo '
'.$lang['srv_archive_test_data_date'].''.$lang['srv_archive_test_data_count'].'
'.date("d.m.Y",strtotime($testdata['time'])).''.$testdata['cnt'].'
'; } } echo '
'; } function arhivi_survey() { global $lang; // Izvoz samo ankete if($_GET['m'] == 'survey'){ echo '
'; echo ''.$lang['srv_survey_archives_ie_title'].Help::display('srv_arhiv_vprasalnik').''; echo '

'.$lang['srv_survey_archives_note_survey'].'

'; echo '
'; echo ''; echo '
'; echo '
'; } // Izvoz ankete s podatki else{ echo '
'; echo ''.$lang['srv_survey_archives_ie_data_title'].Help::display('srv_arhiv_podatki').''; echo '

'.$lang['srv_survey_archives_note_survey_data'].'

'; echo '
'; echo ''; echo '
'; echo '
'; } } // Preveri ce gre za prvo popravljanje podatkov in ce da, potem ustvari arhiv podatkov function checkFirstDataChange($inserted=false){ global $connect_db; $sql = sisplet_query('SELECT count(*) AS cnt FROM srv_tracking'.$this->db_table.' WHERE ank_id=\''.$this->anketa.'\' AND (`get` LIKE \'%edit_data%\' OR (`get` LIKE \'%a: "data", m: "quick_edit"%\' AND `get` LIKE \'%post: "1"%\') OR (`get` LIKE \'%a: "dataCopyRow"%\') OR (`get` LIKE \'%a: "dataDeleteMultipleRow"%\') OR (`get` LIKE \'%a: "dataDeleteRow"%\') OR (`get` LIKE \'%urejanje: "1"%\' AND status=\'4\')) ORDER BY datetime DESC'); $row = mysqli_fetch_array($sql); // Naredimo arhiv podatkov if($row['cnt'] == 0 || ($inserted && $row['cnt'] == 1)){ SurveyCopy::setSrcSurvey($this->anketa); SurveyCopy::setSrcConectDb($connect_db); SurveyCopy::saveArrayFile($data=true); } } /** * @desc skopira anketo */ function anketa_copy($anketa = 0) {//OSTANE // stara kopija kode je v classu class.SurveyCopy.php na dnu :) global $connect_db; if ($anketa > 0) $this->anketa = $anketa; $site = isset($_GET['site']) ? $_GET['site'] : 0; SurveyCopy :: setSrcSurvey($this->anketa); SurveyCopy :: setSrcConectDb($connect_db); SurveyCopy :: setDestSite($site); $new_anketa_id = SurveyCopy :: doCopy(); $napake = SurveyCopy :: getErrors(); if (is_countable($napake) && count($napake) > 0) print_r($napake); if (!$new_anketa_id) die("Can not create new survey!"); if (!$site || $site == 0) return $new_anketa_id; elseif ($site != -1) header("Refresh:1; url=index.php?anketa=$this->anketa&a=arhivi"); } /** * @desc kreira backup (skopira celotno anketo v novo) */ function backup_create($NoRedirect = false) {//OSTANE $anketa = $this->anketa_copy(); sisplet_query("UPDATE srv_anketa SET backup='$this->anketa', active='0', naslov = CONCAT( naslov, ' ', DAY(NOW()), '.', MONTH(NOW()), '.', YEAR(NOW()) ), intro_opomba='{$_POST['intro_opomba']}' WHERE id='$anketa'"); // vsilimo refresh podatkov SurveyInfo :: getInstance()->resetSurveyData(); if ($NoRedirect == false) { header("Refresh:1; url=index.php?anketa=$this->anketa&a=arhivi"); //header("Location: index.php?anketa=$this->anketa&a=arhivi"); } } /** * @desc kreira backup in da obvestilo o uspešnosti (skopira celotno anketo v novo) */ function backup_create_popup() {//OSTANE global $lang; $anketa = $this->anketa_copy(); sisplet_query("UPDATE srv_anketa SET backup='$this->anketa', active='0', naslov = CONCAT( naslov, ' ', DAY(NOW()), '.', MONTH(NOW()), '.', YEAR(NOW()) ) WHERE id='$anketa'"); // vsilimo refresh podatkov SurveyInfo :: getInstance()->resetSurveyData(); if ($anketa > 0 || true) { echo $lang['srv_backup_create_popup_ok']; } echo ''.$lang['srv_backup_create_popup_view'].''; echo ''.$lang['srv_backup_create_popup_close'].''; } /** * @desc prenese arhivsko anketo v folderje */ function backup_restore() {//OSTANE $row = SurveyInfo::getInstance()->getSurveyRow(); $active = 0; $backup = 0; $sql = sisplet_query("UPDATE srv_anketa SET active='$active', backup='$backup' WHERE id = '$this->anketa'"); // vsilimo refresh podatkov SurveyInfo :: getInstance()->resetSurveyData(); header("Location: index.php?anketa=$this->anketa"); } /** * prikaze tab z opcijami za vnos */ function vnos () { global $lang; $row = SurveyInfo::getInstance()->getSurveyRow(); echo '
'.$lang['settings'].''; echo '

'.$lang['srv_vnos_navodila'].'

'; /*echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_cookie'] . '';*/ //prepoznaj uporabnika iz sispleta echo '
' . "\n\r"; echo ' ' . "\n\r"; echo ' ' . "\n\r"; echo ' ' . "\n\r"; echo ' ' . "\n\r"; echo ''; echo ' ' . "\n\r"; echo ' ' . "\n\r"; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; if (isset($_GET['s']) && $_GET['s'] == '1') { echo '
'; echo ''; } } /** * @desc prikaze tab za uporabnost - nastavitve */ function uporabnost() { global $site_url; global $lang; $preklici_url = ltrim(str_replace("&s=1","",$_SERVER['REQUEST_URI']),"/"); $preklici_url = "'". $site_url . $preklici_url . "'"; SurveySetting::getInstance()->Init($this->anketa); if (count($_POST) > 0 && (isset($_POST['uporabnost_link']) || isset($_POST['uporabnost_razdeli']))) { $uporabnost_link = $_POST['uporabnost_link']; $uporabnost = $_POST['uporabnost']; sisplet_query("UPDATE srv_anketa SET uporabnost_link = '$uporabnost_link' WHERE id = '$this->anketa'"); $sqlg = sisplet_query("SELECT id FROM srv_grupa WHERE ank_id = '$this->anketa'"); while ($rowg = mysqli_fetch_array($sqlg)) { if ( isset($_POST['uporabnost_link_'.$rowg['id']])) { SurveySetting::getInstance()->setSurveyMiscSetting('uporabnost_link_'.$rowg['id'], $_POST['uporabnost_link_'.$rowg['id']]); } } if (isset($_POST['uporabnost_razdeli'])) { SurveySetting::getInstance()->setSurveyMiscSetting('uporabnost_razdeli', $_POST['uporabnost_razdeli']); } // vsilimo refresh podatkov SurveyInfo :: getInstance()->resetSurveyData(); } $row = SurveyInfo::getInstance()->getSurveyRow(); echo '
'.$lang['settings'].''; echo '
'; if ($row['uporabnost_link'] == '') $row['uporabnost_link'] = 'http://'; echo '

'.$lang['srv_vrsta_survey_note_4_3b'].'

'; echo '
'; echo '

'.$lang['srv_uporabnost_link'].'

'; echo ''; echo '
'; $uporabnost_razdeli = SurveySetting::getInstance()->getSurveyMiscSetting('uporabnost_razdeli'); echo '
'; echo ''.$lang['srv_uporabnost_razdeli'].':'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '

'.$lang['srv_uporabnost_warning'].'

'; echo '
'; echo '
'.$lang['srv_uporabnost_nadaljne'].''; echo '

'.$lang['srv_uporabnost_link_stran'].'

'; $sqlg = sisplet_query("SELECT id, naslov FROM srv_grupa WHERE ank_id = '$this->anketa' ORDER BY vrstni_red ASC"); while ($rowg = mysqli_fetch_array($sqlg)) { $link = SurveySetting::getInstance()->getSurveyMiscSetting('uporabnost_link_'.$rowg['id']); if ($link == '') $link = 'http://'; echo '
'; echo '

'.$rowg['naslov'].':

'; echo ''; echo '
'; } echo '
'; // Gumb shrani echo '
'; echo ''; echo ''; echo '
'; echo ''; } /** * @desc prikaze vnose v anketo */ function displayIzvozi() { global $lang, $site_url, $global_user_id; $sdf = SurveyDataFile::get_instance(); $sdf->init($this->anketa); $sdf->prepareFiles(); $headFileName = $sdf->getHeaderFileName(); $dataFileName = $sdf->getDataFileName(); $dataFileStatus = $sdf->getStatus(); if ($dataFileStatus== FILE_STATUS_NO_DATA || $dataFileStatus == FILE_STATUS_NO_FILE || $dataFileStatus == FILE_STATUS_SRV_DELETED){ echo '
'.$lang['srv_no_data'].''; Common::noDataAlert(); echo '
'; return false; } /* if ($_GET['m'] == 'excel') { echo '
'; } */ if($_GET['m'] == 'excel_xls') { echo ''; } else if($_GET['m'] == 'txt') { echo ''; } else if($_GET['m'] == 'spss') { echo ''; } else if($_GET['m'] == 'sav') { echo ''; } $row = SurveyInfo::getInstance()->getSurveyRow(); //sedaj se prikaze staticno ob vsakem izvozu /* if($_GET['m'] != 'export_PDF'){ if(session_id() == '') session_start(); echo '
'; echo '

'.$lang['settings'].'

'; echo ''; echo '
'; // Izvozi identifikatorje echo '
'; echo ''; echo '
'; // Izvozi podatke echo '
'; echo ''; echo '
'; // Izvozi podatke in parapodatke echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo ''; echo '
'; echo '
'; } */ # v odvisnosti od $_GET['m'] prikazemo podstran if ($_GET['m'] == M_EXPORT_EXCEL_XLS) { echo '
'.$lang['srv_lnk_excel_xls'].''; $this->exportSettingsData(); echo '
'; /* echo $lang['srv_izvoz_Excel_xls_labels']; echo '
'; // Izvozi podatke kot stevilske vrednosti echo '
'; echo ' '; echo '
'; // Izvozi podatke kot labele echo '
'; echo ' '; echo '
'; echo '
'; echo '
'; */ echo $lang['srv_izvoz_Excel_xls_note1']; echo '
'; echo ''; echo '
'; $this->filterNote(); echo '

'.$lang['srv_izvoz_Excel_xls_prirocnik'].'

'; echo '
'; } elseif ($_GET['m'] == M_EXPORT_TXT) { echo '
'.$lang['srv_lnk_excel'].''; $this->exportSettingsData(); echo '
'; echo '
'; echo ''.$lang['srv_expor_excel_cell_delimiter'].Help::display('srv_izvozCSV_locitveni').':'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo '
'; echo ''.$lang['srv_export_texts'].Help::display('srv_izvozCSV_tekst').':'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo '
'; echo ''.$lang['srv_izvoz_txt_format'].''; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo $lang['srv_izvoz_Excel_note_a']; echo '
'; echo ''; echo '
'; $this->filterNote(); echo '

'.$lang['srv_izvoz_Excel_note_2'].'

'; } elseif ($_GET['m'] == M_EXPORT_SPSS) { echo '
'.$lang['srv_lnk_spss'].''; $this->exportSettingsData(); echo '
'; echo '

'.$lang['srv_izvoz_SPSS_faq'].'

'; echo '

'.$lang['srv_izvoz_SPSS_note'].'

'; echo '

'.$lang['srv_izvoz_step1'].'

'; echo '
'; echo '

'.$lang['srv_izvoz_step1_SPSS'].'

'; echo '
'; echo ''; echo '
'; echo '
'; echo '

'.$lang['srv_izvoz_step2'].'

'; echo '
'; echo '

'.$lang['srv_izvoz_step2a_SPSS'].'

'; echo '
'; echo ''; echo '
'; echo '

'.$lang['srv_izvoz_step2b_SPSS'].'

'; echo '
'; echo '

'.$lang['srv_izvoz_step3'].'

'; echo '
'; echo '
    '; echo '
  • '.$lang['srv_izvoz_step3a_SPSS'].'
  • '; echo '
  • '.$lang['srv_izvoz_step3b_SPSS'].'
  • '; echo '
  • '.$lang['srv_izvoz_step3c_SPSS'].'
  • '; echo '
'; echo '
'; echo '

'.$lang['srv_izvoz_step4'].'

'; echo '
'; echo '

'.$lang['srv_izvoz_step4_SPSS'].'

'; echo '
'; echo '

'.$lang['srv_izvoz_step5'].'

'; echo '
'; echo '

'.$lang['srv_izvoz_step5_SPSS'].'

'; echo '
'; $this->filterNote(); echo '
'; } /* elseif ($_GET['m'] == M_EXPORT_SAV) { echo '
'.$lang['srv_lnk_sav'].''; echo $lang['srv_izvoz_SAV_note1']; echo '
'; echo ''; echo '
'; echo '

'.$lang['srv_izvoz_SAV_note2a'].''.$lang['srv_izvoz_SAV_note2b'].''.$lang['srv_izvoz_SAV_note2c'].'

'; echo '
'; } */ elseif ($_GET['m'] == 'export_PDF') { $pageBreak = isset($_GET['pageBreak']) ? $_GET['pageBreak'] : 0; $type = isset($_GET['type']) ? $_GET['type'] : 0; $if = isset($_GET['if']) ? $_GET['if'] : 0; $font = isset($_GET['font']) ? $_GET['font'] : 12; echo ''.$lang['srv_export_questionnare_0'].''; echo '

'; echo $lang['srv_export_questionnare_1'].'

'; echo $lang['srv_export_questionnare_2']; echo '

'; # PDF in RTF izvoz rezultatov echo '
'; echo '' . $lang['srv_lnk_PDF/RTF'] . ''; echo '' . ' PDF - (Adobe Acrobat)'; echo '
'; echo ''; echo ' DOC - (Microsoft Word)'; echo '
'; //vsak resp na svoji strani echo '
'; echo '' . $lang['settings'] . ''; echo ''; echo ''; echo ''; //dolg/kratek izpis vprasanj v pdf echo '
'; echo ''; echo ''; echo ''; echo ''; //prikaz if-ov echo '
'; echo ''; echo ''; echo ''; //velikost fonta echo '
'; echo ''; echo ''; //echo ''; echo '
'; } echo ''; } /** * @desc prikaze vnose v anketo */ /*function displayVnosi() {//OSTANE global $lang; $row = SurveyInfo::getInstance()->getSurveyRow(); if ($_GET['m'] == 'SN_izvozi') { echo '
' . "\n\r"; //Excel izvozi echo '
'; echo 'EXCEL IZVOZI'; echo ''; echo '
'; echo '
'; // echo ''; echo $lang['srv_izvoz_Excel_note'] . '
'; echo '
'; echo '
'; echo '
'; //SPSS izvozi echo '
'; echo 'SPSS IZVOZI ZA EGE'; // echo '

Ker se pri nekaterih SPSS verzijah pri izvozu podatkov pojavljajo tezave, je treba izvoz datoteke s podatki opraviti v EXCELu, nato pa s spodnjimi SPSS datotekami s strukturami (sintaksami) podatke uvoziti v SPSS iz EXCELa.

'; echo '
'; echo '

' . $lang['srv_export'] . ' SPSS: ' . $lang['srv_structure'] . ' ' . $lang['srv_and'] . ' ' . $lang['srv_data'] . '

' . $lang['srv_notext'] . ': ' . $lang['srv_structure'] . ' ' . $lang['srv_and'] . ' ' . $lang['srv_data'] . '

' . "\n\r"; echo '

' . $lang['srv_metapodatki'] . ' SPSS: ' . $lang['srv_structure'] . ' ' . $lang['srv_and'] . ' ' . $lang['srv_data'] . '

'; echo '
'; echo '
'; echo '
'; // echo ''; echo $lang['srv_izvoz_SPSS_note'] . '
'; echo '
'; echo '
'; // EGO echo '
'; echo '
'; echo 'SPSS IZVOZI ZA ALTERJE'; echo '
'; } else { // data iz baze echo '
' . "\n\r"; $this->displayData(); echo '
'; } } */ // nastavitve glede katere podatke se naj izvozi private function exportSettingsData(){ global $lang; global $global_user_id; //pridobi nastavitve za export ankete //kateri podatki so v export se sedaj veze na naketo (0-onlydata, 1-data in paradata, 2-identifikatorji) $sql_export_mode = sisplet_query("SELECT value FROM srv_user_setting_for_survey ". "WHERE sid = '" . $this->anketa . "' AND what='default_export_data_mode' AND uid='$global_user_id'"); $export_mode = 0; if($sql_export_mode){ $export_mode = mysqli_fetch_assoc($sql_export_mode); $export_mode = isset($export_mode['value']) ? $export_mode['value'] : 0; } echo $lang['srv_izvoz_settings_data']; echo '
'; // Izvozi podatke echo '
'; echo ''; echo '
'; // Izvozi podatke in parapodatke echo '
'; echo ''; echo '
'; //pridobi header, da vidimo, ce imamo identifikatorje $SDF = SurveyDataFile::get_instance(); $SDF->init($this->anketa); $headFileName = $SDF->getHeaderFileName(); $HEADERS = unserialize(file_get_contents($headFileName)); // Izvozi identifikatorje, ce obstajajo if((isset($HEADERS['_settings']['count_system_data_variables']) && (int)$HEADERS['_settings']['count_system_data_variables'] > 0)){ echo '
'; echo ''; echo '
'; } echo '
'; } private function filterNote(){ global $lang; echo '

'.$lang['srv_izvoz_filter_note'].'


'; } /** * @desc prikaze podatke v tabeli */ function displayData() { global $lang; global $site_url; //include_once ('DisplaySurveyData.php'); $dsd = new DisplaySurveyData($this->anketa); $dsd->display(); } /** * @desc Vrne ID trenutnega uporabnika (ce ni prijavljen vrne 0) */ function uid() { global $global_user_id; return $global_user_id; } /** * @desc Vrne vse uporabnike iz baze */ static function db_select_users() { return sisplet_query("SELECT name, surname, id, email FROM users ORDER BY name ASC"); } /** * @desc Vrne vse nepobrisane uporabnike iz baze */ private static function db_select_users_forLevel($anketa = null) { global $global_user_id, $admin_type; // tip admina: 0=>admin, 1=>manager, 2=>clan, 3=>user switch ( $admin_type ) { // admin vidi vse case 0: return sisplet_query("SELECT name, surname, id, email FROM users WHERE status!='0' ORDER BY name ASC"); break; // manager vidi ljudi pod sabo case 1: if ($anketa === null) return sisplet_query("SELECT a.name, a.surname, a.id, a.email FROM users a, srv_dostop_manage m WHERE a.status!='0' AND m.manager='" .$global_user_id ."' AND m.user=a.id"); else return sisplet_query("SELECT a.name, a.surname, a.id, a.email FROM users a, srv_dostop_manage m WHERE a.status!='0' AND m.manager='" .$global_user_id ."' AND m.user=a.id UNION SELECT u.name, u.surname, u.id, u.email FROM users u, srv_dostop d WHERE d.ank_id='$anketa' AND d.uid=u.id"); break; case 2: case 3: // TODO // clani in userji lahko vidijo samo tiste ki so jim poslali maile in so se registrirali // ce smo v urejanju nastavitve ankete vidijo vse, ki so dodeljeni anketi, da jim lahko nastavijo if ($anketa === null) return sisplet_query("SELECT name, surname, id, email FROM users WHERE 1 = 0"); else return sisplet_query("SELECT u.name, u.surname, u.id, u.email FROM users u, srv_dostop d WHERE u.status!='0' AND d.ank_id='$anketa' AND d.uid=u.id"); break; } return null; } function display_dostop_users($show_all=0){ global $global_user_id, $admin_type, $lang; $avtorRow = SurveyInfo::getInstance()->getSurveyRow(); echo '

'.$lang['srv_dostop_users_list'].'

'; // Prikazemo samo userje ki lahko urejajo anketo if($show_all == 0){ echo ' ' . "\n"; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; $sql1 = sisplet_query("SELECT u.name, u.surname, u.id, u.email FROM users u, srv_dostop d WHERE d.ank_id='$this->anketa' AND d.uid=u.id"); while ($row1 = mysqli_fetch_array($sql1)) { // Da ga ne pocistimo, ce je disablan (sam sebe ne more odstranit in avtorja se ne sme odstranit) if($avtorRow['insert_uid'] == $row1['id'] || $global_user_id == $row1['id']) echo ' ' . "\n"; echo ''; echo ' '; echo ' '; echo ' '; // Avtor ne rabi ikone za urejanje echo ' '; echo ''; } echo '
'; //echo ''; echo '' . $lang['srv_dostop_users_username'] . '' . $lang['srv_dostop_users_email'] . '
'.$row1['name'] . ($avtorRow['insert_uid'] == $row1['id'] ? ' (' . $lang['author'] . ')' : '') .''.$row1['email'].''; if($avtorRow['insert_uid'] != $row1['id']) echo '
'; echo '
'; //echo ''.$lang['srv_dostop_users_removeselected'].''; } // Prikazemo vse userje, ki jih lahko uporabnik dodaja else{ $sql1 = $this->db_select_users_forLevel($this->anketa); if ( mysqli_num_rows($sql1) > 0 ) { echo ''.$lang['srv_dostop_show_all'].''; echo ''.$lang['srv_dostop_hide_all'].''; echo ' ' . "\n"; while ($row1 = mysqli_fetch_array($sql1)) { $sql2 = sisplet_query("SELECT ank_id, uid FROM srv_dostop WHERE ank_id='$this->anketa' AND uid='$row1[id]'"); $checked = (mysqli_num_rows($sql2) > 0) ? ' checked="checked"' : ''; // Da ga ne pocistimo ce je disablan (sam sebe ne more odstranit in avtorja se ne sme odstranit) if($avtorRow['insert_uid'] == $row1['id'] || $global_user_id == $row1['id']) echo ' ' . "\n"; echo '
' . "\n"; echo ''; if ($checked != '') echo ' '; echo '
' . "\n"; } } } } // Dodajanje uredniskega dostopa do ankete public function display_add_survey_dostop(){ global $lang; global $admin_type; echo '

'; // Admini in managerji lahko dodajo dostop komurkoli if($admin_type == 0 || $admin_type == 1){ echo $lang['srv_dostop_adduserstxt_admin'].' '.AppSettings::getInstance()->getSetting('app_settings-app_name').'. '; } // Ostali uporabniki lahko dodajo dostop samo ze registriranim uporabnikom else{ echo $lang['srv_dostop_adduserstxt'].' '.AppSettings::getInstance()->getSetting('app_settings-app_name').'! '; } // AAI ima poseben link na help if(isAAI()){ echo $lang['srv_dostop_adduserstxt_aai_more']; } echo '

'; echo ''; echo '
'; echo ''; echo ''; echo '
'; echo '

'.$lang['srv_dostop_adduserstxt_end'].'

'; //Opcijsko sporočilo echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo '
'; echo '
'; // Gumb za dodajanje in posiljanje echo '
'; echo ''; echo '
'; } /** * @desc Vrne podatke o uporabniku */ static function db_select_user($uid) { return sisplet_query("SELECT name, surname, id, email FROM users WHERE id='$uid'"); } /** Preveri ali uporabnik ustreza minimalni zahtevi statusa * * @param $minimum_role_request minimalna zahteva (lahko podamo kot array posamezno) * @return true/false */ function user_role_cehck($minimum_role_request = U_ROLE_ADMIN) { global $admin_type; if (is_array($minimum_role_request) && count($minimum_role_request) > 0) { // ce podamo kot array preverimo za vsak zapis posebej foreach ($minimum_role_request as $role) { if ($admin_type == $role) return true; } } else { if ($admin_type <= $minimum_role_request) return true; } return false; } var $getSurvey_type = null; function getSurvey_type($sid) { if ($this->getSurvey_type != null) return $this->getSurvey_type; // polovimo tip ankete $str_survey_type = sisplet_query("SELECT survey_type FROM srv_anketa WHERE id = '" . $sid . "'"); $row_survey_type = mysqli_fetch_assoc($str_survey_type); $this->getSurvey_type = isset($row_survey_type['survey_type']) ? $row_survey_type['survey_type'] : null; return $this->getSurvey_type; } /** * TODO ??? * * @param mixed $what * @param mixed $isChecked * $forma - pri hitirh nastavitvah forme prikazemo nekje krajsi text */ function display_alert_label($what, $isChecked = false, $forma = false) { global $lang, $global_user_id; $custom_alert = array(); $sql_custom_alert = sisplet_query("SELECT uid, type FROM srv_alert_custom WHERE ank_id = '$this->anketa'"); while ($row_custom_alert = mysqli_fetch_array($sql_custom_alert)) { $custom_alert[$row_custom_alert['type']][$row_custom_alert['uid']] = 1; } switch ($what) { case 'finish_respondent_language': // respondent ki je zakljucil anketo v drugem jeziku (mu omogocimo nastavljanje custom maila za obvescanje) if ($isChecked) { $p = new Prevajanje($this->anketa); $p->dostop(); $jeziki = $p->get_all_translation_langs(); if(!empty($jeziki)){ $row = SurveyInfo::getInstance()->getSurveyRow(); foreach($jeziki as $key => $jezik){ echo '
'; echo ''; echo ''; echo '
'; } } } break; case 'finish_respondent': // respondent ki je zakljucil anketo if ($isChecked) { // preverimo, ali obstaja sistemska spremenljivka email, če ne jo dodamo $sqlEmail = sisplet_query("SELECT s.sistem, s.variable, s.id FROM srv_spremenljivka s, srv_grupa g WHERE s.sistem='1' AND s.variable='email' AND s.gru_id=g.id AND g.ank_id='$this->anketa'"); $sqlIme = sisplet_query("SELECT s.sistem, s.variable, s.id FROM srv_spremenljivka s, srv_grupa g WHERE s.sistem='1' AND s.variable='ime' AND s.gru_id=g.id AND g.ank_id='$this->anketa'"); // ce sta dodani obe sistemski spremenljivki, je vse ok $email_ok = $ime_ok = false; if ( mysqli_num_rows($sqlEmail) > 0 && mysqli_num_rows($sqlIme) > 0) { $email_ok = $ime_ok = true; } else { // manjka ena ali obe potrebni sistemski spremenljivki // email je nujen, zato ga dodamo avtomatsko if ( mysqli_num_rows($sqlEmail) == 0 ) { //dodamo email $sa = new SurveyAdmin(1, $this->anketa); if (in_array('email',$sa->alert_add_necessary_sysvar( array('email') , false))) { $email_ok = true; } // email v tem primeru spremenimo, da je viden, ker gre za alert $sqlEmail = sisplet_query("SELECT s.id FROM srv_spremenljivka s, srv_grupa g WHERE s.sistem='1' AND s.variable='email' AND s.gru_id=g.id AND g.ank_id='$this->anketa'"); $rowEmail = mysqli_fetch_array($sqlEmail); sisplet_query("UPDATE srv_spremenljivka SET visible='1' WHERE id = '$rowEmail[id]'"); // emailu po novem nastavimo preverjanje pravilnosti emaila in mehko opozorilo na to preverjanje $v = new Vprasanje($this->anketa); $v->spremenljivka = $rowEmail['id']; $v->set_email($reminder=1); } else { // email je ze dodan, damo tekst za ok $email_ok = true; } // preverimo še za ime if ( mysqli_num_rows($sqlIme) == 0 ) { } else{ $ime_ok = true; } } echo ''; echo ''; if ($email_ok && $ime_ok) { echo ' '; $sql1 = sisplet_query("SELECT finish_respondent_if FROM srv_alert WHERE ank_id='$this->anketa'"); $row1 = mysqli_fetch_array($sql1); echo ' '; if ($row1['finish_respondent_if']>0) { if ($b==null) $b = new Branching($this->anketa); $b->conditions_display($row1['finish_respondent_if']); } echo ''.$lang['srv_alert_respondent_note_ok_email_ime'].' '; } else { if ($ime_ok) { // pomeni da email ni ok! napaka echo ''.$lang['srv_alert_respondent_note_notok_email'].''; } else { // email je ok, ime ni, uporabnika vprasamo, ali hoce se ime echo ''; $sql1 = sisplet_query("SELECT finish_respondent_if FROM srv_alert WHERE ank_id='$this->anketa'"); $row1 = mysqli_fetch_array($sql1); echo ' '; if ($row1['finish_respondent_if']>0) { if ($b==null) $b = new Branching($this->anketa); $b->conditions_display($row1['finish_respondent_if']); } echo '

'.$lang['srv_alert_respondent_note_ok_email'].'

'; if(!$forma){ echo '

'.$lang['srv_alert_respondent_note_ime'].''; echo ' '.$lang['srv_alert_respondent_note_link'].'

'; } } } // preverimo sistemske nastavitve in spremenljivke ime } else { echo ''; echo ''; } break; case 'finish_respondent_cms': // respondent prepoznan iz CMS ko je izpolnil anketo //respondent iz cms echo ''; echo ''; if ($isChecked) { // preverimo sistemske nastavitve in spremenljivke //$sqlCMS = sisplet_query("SELECT user_from_cms FROM srv_anketa WHERE id='$this->anketa'"); //$rowCMS = mysqli_fetch_assoc($sqlCMS); $rowCMS = SurveyInfo::getInstance()->getSurveyRow(); if ($rowCMS['user_from_cms'] > 0) { echo ' '; $sql1 = sisplet_query("SELECT finish_respondent_cms_if FROM srv_alert WHERE ank_id='$this->anketa'"); $row1 = mysqli_fetch_array($sql1); echo ' '; if ($row1['finish_respondent_cms_if']>0) { if ($b==null) $b = new Branching($this->anketa); $b->conditions_display($row1['finish_respondent_cms_if']); } echo ''.$lang['srv_alert_respondent_cms_note_ok'].' '; } else { echo '

'.$lang['srv_alert_respondent_cms_note'].''; echo ' '.$lang['srv_alert_respondent_cms_note_link'].'

'; } } break; case 'finish_author': // obveščanje o izpolnjeni anketi case 'expire_author': // obveščanje o poteku ankete case 'active_author': // obveščanje o aktivaciji/deaktivaciej ankete case 'delete_author': // obveščanje o izbrisu ankete // preberemo nastavitve alertov $sqlAlert = sisplet_query("SELECT * FROM srv_alert WHERE ank_id = '$this->anketa'"); if (!$sqlAlert) echo mysqli_error($GLOBALS['connect_db']); if (mysqli_num_rows($sqlAlert) > 0) { $rowAlert = mysqli_fetch_array($sqlAlert); } else { SurveyAlert::getInstance()->Init($this->anketa, $global_user_id); $rowAlert = SurveyAlert::setDefaultAlertBeforeExpire(); } // avtor ankete if($forma) { echo ''; echo ''; } else { echo ''; echo ''; } if ($isChecked) { //$sql = sisplet_query("SELECT insert_uid, edit_uid FROM srv_anketa WHERE id='$this->anketa'"); //$row = mysqli_fetch_assoc($sql); $b = null; $row = SurveyInfo::getInstance()->getSurveyRow(); if ($what == 'finish_author') $db_field = 'alert_complete'; else if ($what == 'expire_author') $db_field = 'alert_expire'; else if ($what == 'active_author') $db_field = 'alert_active'; else if ($what == 'delete_author') $db_field = 'alert_delete'; // polovimo avtorja - novo kjer se ga lahko tudi izklopi (zaenkrat samo pri koncani anketi) if($what == 'finish_author'){ $sqlAuthor = $this->db_select_user($row['insert_uid']); $rowAuthor = mysqli_fetch_array($sqlAuthor); $sql1 = sisplet_query("SELECT *, uid AS id FROM srv_dostop WHERE ank_id='$this->anketa' AND uid='".$row['insert_uid']."'"); $row1 = mysqli_fetch_array($sql1); // Ce smo ravno z ajaxom vklopili obvescanje avtorja, ga tudi aktiviramo if(isset($_POST['checked']) && isset($_POST['what']) && $_POST['what']=='finish_author'){ $checked = ($_POST['checked'] == true) ? ' checked="checked" ' : ''; } else{ $checked = ($row1[$db_field] == '1') ? ' checked="checked" ' : ''; } echo '
'; echo '
'; echo ''; echo ''; if ($what == 'finish_author') { echo ''; echo ' '; echo ' '; if ($row1['alert_complete_if']>0) { if ($b==null) $b = new Branching($this->anketa); $b->conditions_display($row1['alert_complete_if']); } echo ''; } echo '
'; echo '
'; } // polovimo avtorja pri ostalih obvestilih else{ $sqlAuthor = $this->db_select_user($row['insert_uid']); $rowAuthor = mysqli_fetch_array($sqlAuthor); $sql1 = sisplet_query("SELECT *, uid AS id FROM srv_dostop WHERE ank_id='$this->anketa' AND uid='".$row['insert_uid']."'"); $row1 = mysqli_fetch_array($sql1); echo '
'; echo '
'; echo ''; echo ''; if ($what == 'finish_author') { echo ''; echo ' '; echo ' '; if ($row1['alert_complete_if']>0) { if ($b==null) $b = new Branching($this->anketa); $b->conditions_display($row1['alert_complete_if']); } echo ''; } echo '
'; echo '
'; } // polovimo ostale userje ki imajo dostop $sql1 = sisplet_query("SELECT u.id, u.name, u.surname, u.email, dostop.".$db_field.", dostop.alert_complete_if FROM users as u " ." RIGHT JOIN (SELECT sd.uid, sd.".$db_field.", sd.alert_complete_if FROM srv_dostop as sd WHERE sd.ank_id='".$this->anketa."') AS dostop ON u.id = dostop.uid WHERE u.id != '".$row['insert_uid']."'"); while ($row1 = mysqli_fetch_assoc($sql1)) { if ($row1['id']) { // se zgodi da je prazno za metauserje // avtor je vedno chekiran $checked = ( $row1[$db_field] == '1') ? ' checked="checked"' : ''; echo '
'; echo '
'; echo ''; echo ''; if ($what == 'finish_author') { echo ''; echo ' '; echo ' '; if ($row1['alert_complete_if']>0) { if ($b==null) $b = new Branching($this->anketa); $b->conditions_display($row1['alert_complete_if']); } echo ''; } echo '
'; echo '
'; } } } break; } } /** * TODO ??? * * @param mixed $row */ function showUserCodeSettings($row = null) { global $lang; if ($row == null) { $row = SurveyInfo::getInstance()->getSurveyRow(); } $disabled = true; $disabled2 = false; if (SurveyInfo::getInstance()->checkSurveyModule('email') || SurveyInfo::getInstance()->checkSurveyModule('phone')){ $disabled = false; } if ($row['usercode_skip'] == 1) { $disabled2 = true; } #echo ' '; echo '' . $lang['usercode_skip'] . Help::display('usercode_skip') . ':'; echo '' . "\n\r"; echo '' . "\n\r"; echo '' . "\n\r"; echo ''; echo '
'; echo '
'; #echo ' '; echo '' . $lang['usercode_required'] . help::display('usercode_required') . ': '; echo '' . "\n\r"; echo '' . "\n\r"; echo ''; echo '
'; echo '
'; $nagovorText = ($row['usercode_text'] && $row['usercode_text'] != null && $row['usercode_text'] != "") ? $row['usercode_text'] : $lang['srv_basecode']; #echo ' '; echo '' . $lang['usercode_text'] . ': '; echo ' ' . "\n\r"; echo ''; echo '
'; } /** * TODO ??? * * @param mixed $row */ function respondenti_iz_baze($row = null, $show_fieldset=true) { global $lang; global $admin_type; if ($row == null) { $row = SurveyInfo::getInstance()->getSurveyRow(); } /* aktivnost vec ni pogoj za vklop email vabil: * - omogočiti aktiviranje emial zavihka, četudi je anketa neaktivna (preprečiti pa pošijanje emailov če je ankete neaktivna) */ if ($admin_type <= 1) { $_cssDisabled = ''; $_disabled = ''; } else { $_cssDisabled = ' gray'; $_disabled = ' disabled="disabled"'; } echo '' . "\n\r"; echo '' . "\n\r"; echo '' . "\n\r"; if ($show_fieldset) { echo '
'; echo '' . $lang['srv_user_base_vabila'] . ''; } else { echo '

3. ' . $lang['srv_user_base_vabila'] . '

'; } if ($_cssDisabled == '' && $_disabled == '') { echo ''; echo ' checkSurveyModule('email') ? ' checked="checked"' : '') . ' onChange="//handleUserCodeSetting();" '.$_disabled.'/>' . "\n\r"; echo ' checkSurveyModule('email') ? ' checked="checked"' : '') . ' onChange="//handleUserCodeSetting();" '.$_disabled.'/>' . "\n\r"; echo '
'; } // dodatne nastavitve za pošiljanje kode pri izpolnjevanju ankete if ($_GET['a'] == 'vabila' || $_GET['a'] == 'email' ) { echo '
'; $this->showUserCodeSettings($row); echo '
'; } if ($admin_type > 1) echo ''.$lang['srv_user_base_user_note'].''; if ($show_fieldset) { echo '
'; } } /** * TODO ??? * */ function anketa_aktivacija_note() { global $lang; $row = SurveyInfo::getInstance()->getSurveyRow(); if ($row['active'] == 0) { echo $lang['srv_url_survey_not_active']; echo ' ' . "\n\r"; echo ' '; echo ' '; echo ' ' . $lang['srv_anketa_setActive'] . ''; echo ' ' . "\n\r"; echo ' ' . "\n\r"; } else { echo $lang['srv_url_intro_active']; echo ' ' . "\n\r"; echo ' '; echo ' '; echo ' ' . $lang['srv_anketa_setNoActive'] . ''; echo ' ' . "\n\r"; echo ' ' . "\n\r"; } } function anketa_diagnostika_note($diagnostics,$show_link = false) { global $lang; $diagnostics->printNote($show_link); } /** * @desc prikaze dropdown z nastavitvami ankete (globalne, za celo 1ko) -- Prva stran -> Nastavitve -> Sistemske nastavitve * Sistemske nastavitve: mora biti admin da ima dostop */ function anketa_nastavitve_system() { global $lang; global $site_url; global $site_path; global $admin_type; global $global_user_id; $preklici_url = ltrim(str_replace("&s=1","",$_SERVER['REQUEST_URI']),"/"); $preklici_url = "'". $site_url . $preklici_url . "'"; // Ni admin - nima pravic if ($admin_type != 0) { echo '
'; echo $lang['srv_settingsSystemNoRights']; echo '
'; return; } echo '
'; echo '
'; echo ' '; echo ' '; // SISTEMSKE NASTAVITVE (prej v settings_optional.php) echo '
'.$lang['as_basic'].''; echo '
'; AppSettings::getInstance()->displaySettingsGroup('basic'); // Kdo lahko ureja ankete echo '
'; echo ''; $result = sisplet_query("SELECT value FROM misc WHERE what='SurveyDostop'"); list ($SurveyDostop) = mysqli_fetch_row($result); echo ''; echo '
'; // Default trajanje piskotka echo '
'; echo ''; $result = sisplet_query("SELECT value FROM misc WHERE what='SurveyCookie'"); list ($SurveyCookie) = mysqli_fetch_row($result); echo ''; echo '
'; echo '
'; echo '
'; // INFO echo '
'.$lang['as_info'].''; echo '
'; AppSettings::getInstance()->displaySettingsGroup('info'); echo '
'; echo '
'; // OMEJITVE echo '
'.$lang['as_limits'].''; echo '
'; AppSettings::getInstance()->displaySettingsGroup('limits'); echo '
'; echo '
'; // SMTP NASTAVITVE echo '
'.$lang['as_smtp'].''; echo '
'; AppSettings::getInstance()->displaySettingsGroup('smtp'); echo '
'; echo '
'; // MODULI echo '
'.$lang['as_modules'].''; echo '
'; AppSettings::getInstance()->displaySettingsGroup('modules'); echo '
'; echo '
'; /* Missingi - zakomentirano, prenova po redizajnu $smv = new SurveyMissingValues(); $smv->SystemFilters(); */ // save gumb echo '
'; echo ''; echo ''; echo '
'; // div za prikaz uspešnosti shranjevanja if (isset($_GET['s']) && $_GET['s'] == '1') { echo '
'; echo ''; } echo '
'; } /** * nastavitve predvidenih casov za komponente ankete in vprasanj iz katerih se nato racuna celotna dolzina vprasanj in ankete * */ function anketa_nastavitve_predvidenicasi () { global $lang; global $site_url; $preklici_url = ltrim(str_replace("&s=1","",$_SERVER['REQUEST_URI']),"/"); $preklici_url = "'". $site_url . $preklici_url . "'"; echo '
'; echo ''; echo '
'.$lang['srv_testiranje_predvidenicas'].''; echo '

'.$lang['srv_predvidenicasi_help'].'

'; echo '
'; echo ''; echo '  s'; echo '
'; echo '

'.$lang['srv_predvidenicasi_note'].'

'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; for ($tip=1; $tip<= 21; $tip++) { if ($tip <= 8 || $tip >= 16) { echo ''; echo ''; echo ''; if ($tip<=3 || $tip==6 || $tip==16 || $tip==17 || $tip==18 || $tip==19 || $tip==20) echo ''; else echo ''; if ($tip==3){ $kategorija_max = GlobalMisc::getMisc('timing_kategorija_max_'.$tip); echo ''; } else echo ''; echo ''; } } echo '
'.$lang['srv_question_type'].''.$lang['srv_timing_vprasanje'].''.$lang['srv_timing_kategorija'].''.$lang['srv_timing_kategorija_max'].'
'.$lang['srv_vprasanje_tip_'.$tip].'  s  s  s
'; echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo ''; echo '
'; } function tabTestiranje () { global $lang; // predvideni casi if ($_GET['m'] == 'predvidenicas') { $this->testiranje_predvidenicas(); } // testni podatki elseif ($_GET['m'] == 'testnipodatki') { $this->testiranje_testnipodatki(); } // cas elseif ($_GET['m'] == M_TESTIRANJE_CAS) { $this->testiranje_cas();; } // cas elseif ($_GET['m'] == 'cas') { $this->testiranje_cas(); } } /** * izracuna predvidene case po straneh glede na število in dolžino vprašanj * */ function testiranje_predvidenicas($samo_izracunaj_skupini_cas=0) { global $lang; $expected_time = array(); $expected_time_block = array(); $block_labels_by_number = array(); $expected_vprasanja = array(); $verjetnost = array(); $verjetnost_block = array(); //from php 7.2 this helps to round numbers calculated in bcmod() - without it, it always rounds down to int bcscale(1); $sql = sisplet_query("SELECT introduction FROM srv_anketa WHERE id = '$this->anketa'"); $row = mysqli_fetch_array($sql); $introduction = isset($row['introduction']) ? $row['introduction'] : $lang['srv_intro']; $expected_vprasanja[0][0] = strlen(strip_tags($introduction)) * GlobalMisc::getMisc('timing_vprasanje_5') / 100; $expected_vprasanja[0][1] = 1; $expected_vprasanja[0][2] = $lang['srv_vprasanje_tip_5']; $expected_vprasanja[0][3] = $lang['srv_intro_label']; $expected_time[0][0] = $expected_vprasanja[0][0] + GlobalMisc::getMisc('timing_stran'); $expected_time[0][1] = $expected_time[0][0]; $block_spr_data = $this->get_block_data_by_spr_id(); $sql = sisplet_query("SELECT id, naslov, vrstni_red FROM srv_grupa g WHERE g.ank_id='$this->anketa' ORDER BY g.vrstni_red ASC"); while ($row = mysqli_fetch_array($sql)) { $expected_time[$row['vrstni_red']][0] = 0; $expected_time[$row['vrstni_red']][1] = 0; $sql1 = sisplet_query("SELECT id, naslov FROM srv_spremenljivka WHERE gru_id='$row[id]' AND visible = '1'"); while ($row1 = mysqli_fetch_array($sql1)) { $expected_vprasanja[$row1['id']][0] = $this->vprasanje_predvideni_cas($row1['id']); $expected_vprasanja[$row1['id']][1] = $this->vprasanje_verjetnost($row1['id']); $expected_vprasanja[$row1['id']][2] = strip_tags($row1['naslov']); $expected_vprasanja[$row1['id']][3] = strip_tags($row['naslov']); if(isset($block_spr_data[$row1['id']]['label'])) $expected_vprasanja[$row1['id']][4] = strip_tags($block_spr_data[$row1['id']]['label']); else $expected_vprasanja[$row1['id']][4] = ''; $expected_time[$row['vrstni_red']][0] += $expected_vprasanja[$row1['id']][0] * $expected_vprasanja[$row1['id']][1]; // dejanski $expected_time[$row['vrstni_red']][1] += $expected_vprasanja[$row1['id']][0]; // bruto - z vsemi vprasanji if (isset($verjetnost[$row['vrstni_red']]) && $expected_vprasanja[$row1['id']][1] > $verjetnost[$row['vrstni_red']]) $verjetnost[$row['vrstni_red']] = $expected_vprasanja[$row1['id']][1]; } if(isset($verjetnost[$row['vrstni_red']])) $expected_time[$row['vrstni_red']][0] += GlobalMisc::getMisc('timing_stran') * $verjetnost[$row['vrstni_red']]; // pri dejanskem trajanju strani upostevamo verjetnost najverjetnejsega vprasanja na strani (stran se pojavi z najvisjo verjetnostjo vseh vprasanj na strani) $expected_time[$row['vrstni_red']][1] += GlobalMisc::getMisc('timing_stran'); } $sql = sisplet_query("SELECT * FROM srv_if as bl LEFT JOIN srv_branching as br ON br.parent = bl.id WHERE bl.enabled='0' AND bl.tip='1' AND br.ank_id = '$this->anketa' ORDER BY bl.number ASC, br.vrstni_red ASC"); $last_block_st = -1; while ($row = mysqli_fetch_array($sql)) { $new_block = $last_block_st != $row['number']; if($new_block){ $last_block_st = $row['number']; $label = $row['label'] ? $row['label']: $lang['srv_blok'].' '.$last_block_st; $block_labels_by_number[$last_block_st] = $label; $expected_time_block[$last_block_st-1][0] = 0; $expected_time_block[$last_block_st-1][1] = 0; } if(!$row['element_if']){ $expected_time_block[$last_block_st-1][0] += $expected_vprasanja[$row['element_spr']][0] * $expected_vprasanja[$row['element_spr']][1]; // dejanski $expected_time_block[$last_block_st-1][1] += $expected_vprasanja[$row['element_spr']][0]; // bruto - z vsemi vprasanji if ( !isset($verjetnost_block[$last_block_st-1]) || $expected_vprasanja[$row['element_spr']][1] > $verjetnost_block[$last_block_st-1]) $verjetnost_block[$last_block_st-1] = $expected_vprasanja[$row['element_spr']][1]; } else{ $sql1 = sisplet_query("SELECT * FROM srv_branching WHERE parent='".$row['element_if']."' ORDER BY vrstni_red ASC"); while ($row1 = mysqli_fetch_array($sql1)) { if(array_key_exists($last_block_st, $expected_time_block)){ $expected_time_block[$last_block_st-1][0] += $expected_vprasanja[$row1['element_spr']][0] * $expected_vprasanja[$row1['element_spr']][1]; // dejanski $expected_time_block[$last_block_st-1][1] += $expected_vprasanja[$row1['element_spr']][0]; // bruto - z vsemi vprasanji $expected_vprasanja[$row1['element_spr']][4] = $label; if ( !isset($verjetnost_block[$last_block_st-1]) || $expected_vprasanja[$row1['element_spr']][1] > $verjetnost_block[$last_block_st-1]) $verjetnost_block[$last_block_st-1] = $expected_vprasanja[$row1['element_spr']][1]; } } } if($new_block){ $expected_time_block[$last_block_st-1][0] += GlobalMisc::getMisc('timing_stran') * $verjetnost_block[$last_block_st-1]; // pri dejanskem trajanju strani upostevamo verjetnost najverjetnejsega vprasanja na strani (stran se pojavi z najvisjo verjetnostjo vseh vprasanj na strani) $expected_time_block[$last_block_st-1][1] += GlobalMisc::getMisc('timing_stran'); } } // izpis za strani $max = 0; $total = 0; $total_brez_pogojev = 0; foreach ($expected_time AS $key => $val) { if ($val[1] > $max) $max = $val[1]; $total += $val[0]; $total_brez_pogojev += $val[1]; } if ($max == 0) return; if ($samo_izracunaj_skupini_cas == 2) { return $total; } $skupni_cas = (bcdiv($total, 60, 0)>0?bcdiv($total, 60, 0).'min ':'').''.round(bcmod($total, 60), 0).'s'; $skupni_cas_brez_pogojev = (bcdiv($total_brez_pogojev, 60, 0)>0?bcdiv($total_brez_pogojev, 60, 0).'min ':'').''.round(bcmod($total_brez_pogojev, 60), 0).'s'; if ($samo_izracunaj_skupini_cas == 1) return $skupni_cas; echo '
'.$lang['srv_total_trajanje'].''; echo '

'.$lang['srv_dejansko_trajanje'].':

'; echo '

'.$skupni_cas.'

'; echo '
'; echo '
'.$lang['srv_casi_po_straneh'].''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ($expected_time AS $vrstni_red => $time) { $sql = sisplet_query("SELECT naslov FROM srv_grupa WHERE vrstni_red='$vrstni_red' AND ank_id = '$this->anketa'"); $row = mysqli_fetch_array($sql); $naslov = isset($row['naslov']) && $row['naslov'] != '' ? $row['naslov'] : $lang['srv_intro_label']; echo ''; echo ''; echo ''; echo ''; echo ''; } echo ''; echo '
'.$lang['srv_casi_po_straneh_stran'].''.$lang['srv_neto_t_cas'].' / '.$lang['srv_bruto_t_cas'].'
'.$naslov.''; echo ($time[0]<60?round($time[0],1).'s ':round($time[0]/60,1).'min ').'/ '.($time[1]<60?round($time[1],1).'s ':round($time[1]/60,1).'min ').''; echo ''; echo '
'; echo '
'; if ((($time[1]-$time[0])/$max*85) > 0) echo '
'; echo '
'; echo '
'.$lang['srv_casi_po_vprasanjih_skupaj'].''.$skupni_cas.' / '.$skupni_cas_brez_pogojev.'
'; echo '
'; echo '
'.$lang['srv_neto_t_cas'].''; echo '
'.$lang['srv_bruto_t_cas'].''; echo '
'; echo '
'; // izpis za vprasanja $max = 0; $bruto_total = 0; $neto_total = 0; foreach ($expected_vprasanja AS $vpr) { if ($vpr[0] > $max) $max = $vpr[0]; $bruto_total += $vpr[0]; $neto_total += $vpr[0] * $vpr[1]; } $prevstran = false; echo '
'.$lang['srv_casi_po_vprasanjih_strani'].''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ($expected_vprasanja AS $vprasanje) { if (!$prevstran || $prevstran != $vprasanje[3]) { echo ''; $prevstran = $vprasanje[3]; } $bruto = $vprasanje[0]; $verjetnost = $vprasanje[1]; $neto = $bruto * $verjetnost; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo ''; echo '
'.$lang['srv_casi_po_straneh_stran'].'/'.$lang['srv_casi_po_vprasanjih_vprasanje'].''.$lang['srv_bruto_v_cas'].''.$lang['srv_verjetnost_pojavitve'].''.$lang['srv_neto_v_cas'].'/'.$lang['srv_bruto_v_cas_long'].'
'.$vprasanje[3].'
'.skrajsaj($vprasanje[2], 30).''.round($bruto, 1).'s'.round($verjetnost*100, 2).'%'; echo round($neto, 1).'s / '.round($bruto, 1).'s'; echo ''; echo '
'; echo '
'; if (($bruto-$neto)/$max*85 > 0) echo '
'; echo '
'; echo '
'.$lang['srv_casi_po_vprasanjih_skupaj'].''.(bcdiv($bruto_total, 60, 0)>0?bcdiv($bruto_total, 60, 0).'min ':'').''.round(bcmod($bruto_total, 60), 0).'s'.(bcdiv($neto_total, 60, 0)>0?bcdiv($neto_total, 60, 0).'min ':'').''.round(bcmod($neto_total, 60), 0).'s / '.(bcdiv($bruto_total, 60, 0)>0?bcdiv($bruto_total, 60, 0).'min ':'').''.round(bcmod($bruto_total, 60), 0).'s
'; echo '
'; echo '
'.$lang['srv_neto_v_cas'].''; echo '
'.$lang['srv_bruto_v_cas_long'].''; echo '
'; echo '
'; //CASI PO BLOKIH if($block_spr_data){ // izpis za bloke $maxb = 0; $totalb = 0; foreach ($expected_time_block AS $key => $val) { if ($val[1] > $maxb) $maxb = $val[1]; $totalb += $val[0]; } echo '
'.$lang['srv_casi_po_blokih'].''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ($expected_time_block AS $vrstni_red => $time) { echo ''; echo ''; echo ''; echo ''; echo ''; } echo ''; echo '
'.$lang['srv_casi_po_blokih_blok'].''.$lang['srv_neto_t_cas'].' / '.$lang['srv_bruto_t_cas'].'
'.$block_labels_by_number[$vrstni_red+1].''; echo ($time[0]<60?round($time[0],1).'s ':round($time[0]/60,1).'min ').'/ '.($time[1]<60?round($time[1],1).'s ':round($time[1]/60,1).'min ').''; echo ''; echo '
'; echo '
'; if ((($time[1]-$time[0])/$maxb*85) > 0) echo '
'; echo '
'; echo '
'.$lang['srv_casi_po_vprasanjih_skupaj'].''.(bcdiv($totalb, 60, 0)>0?bcdiv($totalb, 60, 0).'min ':'').''.round(bcmod($totalb, 60), 0).'s
'; echo '
'; echo '
'.$lang['srv_neto_t_cas'].''; echo '
'.$lang['srv_bruto_t_cas'].''; echo '
'; echo '
'; // izpis za vprasanja po blokih $max = 0; $bruto_total = 0; $neto_total = 0; foreach ($expected_vprasanja AS $vpr) { if($vpr[4]){ if ($vpr[0] > $max) $max = $vpr[0]; $bruto_total += $vpr[0]; $neto_total += $vpr[0] * $vpr[1]; } } $prevstran = false; echo '
'.$lang['srv_casi_po_vprasanjih_bloki'].''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ($expected_vprasanja AS $vprasanje) { if($vprasanje[4]){ if (!$prevstran || $prevstran != $vprasanje[4]) { echo ''; $prevstran = $vprasanje[4]; } $bruto = $vprasanje[0]; $verjetnost = $vprasanje[1]; $neto = $bruto * $verjetnost; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } } echo ''; echo '
'.$lang['srv_casi_po_straneh_stran'].'/'.$lang['srv_casi_po_vprasanjih_vprasanje'].''.$lang['srv_bruto_v_cas'].''.$lang['srv_verjetnost_pojavitve'].''.$lang['srv_neto_v_cas'].'/'.$lang['srv_bruto_v_cas_long'].'
'.$vprasanje[4].'
'.skrajsaj($vprasanje[2], 30).''.round($bruto, 1).'s'.round($verjetnost*100, 2).'%'; echo round($neto, 1).'s / '.round($bruto, 1).'s'; echo ''; echo '
'; echo '
'; if (($bruto-$neto)/$max*85 > 0) echo '
'; echo '
'; echo '
'.$lang['srv_casi_po_vprasanjih_skupaj'].''.(bcdiv($bruto_total, 60, 0)>0?bcdiv($bruto_total, 60, 0).'min ':'').''.round(bcmod($bruto_total, 60), 0).'s'.(bcdiv($neto_total, 60, 0)>0?bcdiv($neto_total, 60, 0).'min ':'').''.round(bcmod($neto_total, 60), 0).'s / '.(bcdiv($bruto_total, 60, 0)>0?bcdiv($bruto_total, 60, 0).'min ':'').''.round(bcmod($bruto_total, 60), 0).'s
'; echo '
'; echo '
'.$lang['srv_neto_v_cas'].''; echo '
'.$lang['srv_bruto_v_cas_long'].''; echo '
'; echo '
'; } } /** * Dobi podatke o bloku za vsako spremenljivko, ali false, ce ni blokov */ function get_block_data_by_spr_id(){ global $lang; $data = array(); $block_query = sisplet_query("SELECT * FROM srv_if as bl LEFT JOIN srv_branching as br ON br.parent = bl.id WHERE bl.enabled='0' AND bl.tip='1' AND br.ank_id = '$this->anketa' ORDER BY br.vrstni_red ASC", 'array'); if($block_query){ foreach ($block_query as $row) { $label = $row['label'] ? $row['label']: $lang['srv_blok'].' '.$row['number']; $data[$row['element_spr']] = array('label' => $label); } return $data; } return false; } /** * oceni predvideni cas za vprasanje * * @param mixed $spremenljivka */ function vprasanje_predvideni_cas ($spremenljivka) { $sql1 = sisplet_query("SELECT id, naslov, tip FROM srv_spremenljivka WHERE id = '$spremenljivka'"); $row1 = mysqli_fetch_array($sql1); $expected_time = strlen(strip_tags($row1['naslov'])) * GlobalMisc::getMisc('timing_vprasanje_'.$row1['tip']) / 100; // vprasanja, ki imajo tudi kategorije/vrednosti if ($row1['tip'] <= 3 || $row1['tip'] == 6 || $row1['tip'] == 16 || $row1['tip'] == 17 || $row1['tip'] == 18 || $row1['tip'] == 19 || $row1['tip'] == 20) { $sql2 = sisplet_query("SELECT naslov FROM srv_vrednost WHERE spr_id='$row1[id]'"); //for those types we have max time option if($row1['tip'] == 3){ $expected_time_temp = 0; while ($row2 = mysqli_fetch_array($sql2)) { $expected_time_temp += strlen(strip_tags($row2['naslov'])) * GlobalMisc::getMisc('timing_kategorija_'.$row1['tip']) / 100; } //if time is greater than max time, use max time $max_time = GlobalMisc::getMisc('timing_kategorija_max_'.$row1['tip']); $expected_time += (isset($expected_time_temp) && $max_time > $expected_time_temp) ? $expected_time_temp : $max_time; } //types that doesnt have max time option else{ while ($row2 = mysqli_fetch_array($sql2)) { $expected_time += strlen(strip_tags($row2['naslov'])) * GlobalMisc::getMisc('timing_kategorija_'.$row1['tip']) / 100; } } } return $expected_time; } /** * oceni verjetnost prikaza vprasanja glede na pogoje, ki so mu nastavljeni * * @param mixed $spremenljivka */ function vprasanje_verjetnost ($spremenljivka) { $sql = sisplet_query("SELECT parent FROM srv_branching WHERE element_spr = '$spremenljivka'"); $row = mysqli_fetch_array($sql); if ($row['parent'] == 0) return 1; // vprasanje se vedno prikaze //echo $this->if_verjetnost($row['parent']).'
'; return $this->if_verjetnost($row['parent']); } /** * oceni verjetnost da bo pogoj (if) izpolnjen * * @param mixed $if */ function if_verjetnost ($if) { $sql = sisplet_query("SELECT parent FROM srv_branching WHERE element_if = '$if'"); if (mysqli_num_rows($sql) == 0) return 0; $row = mysqli_fetch_array($sql); // izracunamo se verjetnost parentov if ($row['parent'] > 0){ // dodaten pogoj da nismo v deadlocku (zaradi bugov se znata v branchingu pojavit ifa, ki imata drug drugega za parenta) $sqlX = sisplet_query("SELECT parent, element_if FROM srv_branching WHERE parent='".$if."' AND element_if='".$row['parent']."'"); if(mysqli_num_rows($sqlX) > 0){ return 0; } $parent = $this->if_verjetnost($row['parent']); } else $parent = 1; $sql = sisplet_query("SELECT tip FROM srv_if WHERE id = '$if'"); $row = mysqli_fetch_array($sql); if ($row['tip'] == 1) return 1 * $parent; // blok je vedno 'izpolnjen' $eval = ' $total = '; $i = 0; // racunanje verjetnosti za podani if $sql = sisplet_query("SELECT * FROM srv_condition WHERE if_id = '$if' ORDER BY vrstni_red ASC"); while ($row = mysqli_fetch_array($sql)) { $value = ''; if(($value = $this->condition_verjetnost($row['id'])) !== false){ if ($i++ != 0){ if ($row['conjunction'] == 0) $eval .= ' * '; else $eval .= ' + '; } for ($i=1; $i<=$row['left_bracket']; $i++) $eval .= ' ( '; $eval .= $value; for ($i=1; $i<=$row['right_bracket']; $i++) $eval .= ' ) '; } } $eval .= ';'; if($eval != ' $total = ;') @eval($eval); //echo '--'.$eval.'--'; else $total = 1; if ($total > 1) return 1 * $parent; else return $total * $parent; } /** * vrne verjetnost, da je izpolnjen condition (ena vrstica v IFu) * * @param mixed $condition */ function condition_verjetnost ($condition) { $sql = sisplet_query("SELECT * FROM srv_condition WHERE id = '$condition'"); if (mysqli_num_rows($sql) == 0) return 0; $row = mysqli_fetch_array($sql); // obicne spremenljivke if ($row['spr_id'] > 0) { $row2 = Cache::srv_spremenljivka($row['spr_id']); // radio, checkbox, dropdown in multigrid if ($row2['tip'] <= 3 || $row2['tip'] == 6) { // obicne spremenljivke if ($row['vre_id'] == 0) { $sql1 = sisplet_query("SELECT id FROM srv_vrednost WHERE spr_id='$row[spr_id]'"); $vse_vrednosti = mysqli_num_rows($sql1); $sql1 = sisplet_query("SELECT * FROM srv_condition_vre WHERE cond_id = '$condition'"); $izbrane_vrednosti = mysqli_num_rows($sql1); if ($vse_vrednosti > 0) $p = $izbrane_vrednosti / $vse_vrednosti; else $p = 0; if ($row['operator'] == 0) return $p; else return 1 - $p; // multigrid } elseif ($row['vre_id'] > 0) { $sql1 = sisplet_query("SELECT id FROM srv_grid WHERE spr_id='$row[spr_id]'"); $vse_vrednosti = mysqli_num_rows($sql1); $sql1 = sisplet_query("SELECT * FROM srv_condition_grid WHERE cond_id = '$condition'"); $izbrane_vrednosti = mysqli_num_rows($sql1); if ($vse_vrednosti > 0) $p = $izbrane_vrednosti / $vse_vrednosti; else $p = 0; if ($row['operator'] == 0) return $p; else return 1 - $p; } // number in text } else { return 0.5; } // recnum } elseif ($row['spr_id'] == -1) { return 1 / $row['modul']; // calculations } elseif ($row['spr_id'] == -2) { return 0.5; // quotas } elseif ($row['spr_id'] == -3) { return 1; } return false; } /** * prikazuje povprecne case po straneh ipd.... * */ function testiranje_cas($samo_izracunaj_skupini_cas=0) { global $lang; global $global_user_id; global $admin_type; SurveyUserSetting :: getInstance()->Init($this->anketa, $global_user_id); // nastavitve iz popupa $rezanje = SurveyUserSetting::getInstance()->getSettings('rezanje'); if ($rezanje == '') $rezanje = 0; $rezanje_meja_sp = SurveyUserSetting::getInstance()->getSettings('rezanje_meja_sp'); if ($rezanje_meja_sp == '') $rezanje_meja_sp = 5; $rezanje_meja_zg = SurveyUserSetting::getInstance()->getSettings('rezanje_meja_zg'); if ($rezanje_meja_zg == '') $rezanje_meja_zg = 5; $rezanje_predvidena_sp = SurveyUserSetting::getInstance()->getSettings('rezanje_predvidena_sp'); if ($rezanje_predvidena_sp == '') $rezanje_predvidena_sp = 10; $rezanje_predvidena_zg = SurveyUserSetting::getInstance()->getSettings('rezanje_predvidena_zg'); if ($rezanje_predvidena_zg == '') $rezanje_predvidena_zg = 200; $rezanje_preskocene = SurveyUserSetting::getInstance()->getSettings('rezanje_preskocene'); if ($rezanje_preskocene == '') $rezanje_preskocene = 1; $get_predvideni = isset($_GET['predvideni']) ? $_GET['predvideni'] : ''; $get_prikazi01 = isset($_GET['prikazi01']) ? $_GET['prikazi01'] : ''; $get_pages = isset($_GET['pages']) ? $_GET['pages'] : ''; /* ++ Predvideni casi */ if ($get_predvideni == 1 || $rezanje == 1) { $expected_time = array(); $expected_vprasanja = array(); $verjetnost = array(); $sql = sisplet_query("SELECT introduction FROM srv_anketa WHERE id = '$this->anketa'"); $row = mysqli_fetch_array($sql); // nagovor racunamo kot da gre za labelo $expected_vprasanja[0][0] = strlen(strip_tags($row['introduction'])) * GlobalMisc::getMisc('timing_vprasanje_5') / 100; $expected_vprasanja[0][1] = 1; $expected_vprasanja[0][2] = $lang['srv_vprasanje_tip_5']; $expected_vprasanja[0][3] = $lang['srv_intro_label']; $expected_time[0][0] = $expected_vprasanja[0][0] + GlobalMisc::getMisc('timing_stran'); $expected_time[0][1] = $expected_time[0][0]; $sql = sisplet_query("SELECT id, naslov, vrstni_red FROM srv_grupa g WHERE g.ank_id='$this->anketa' ORDER BY g.vrstni_red ASC"); while ($row = mysqli_fetch_array($sql)) { $expected_time[$row['vrstni_red']][0] = 0; $expected_time[$row['vrstni_red']][1] = 0; $sql1 = sisplet_query("SELECT id, naslov FROM srv_spremenljivka WHERE gru_id='$row[id]' AND visible='1'"); while ($row1 = mysqli_fetch_array($sql1)) { $expected_vprasanja[$row1['id']][0] = $this->vprasanje_predvideni_cas($row1['id']); $expected_vprasanja[$row1['id']][1] = $this->vprasanje_verjetnost($row1['id']); $expected_vprasanja[$row1['id']][2] = strip_tags($row1['naslov']); $expected_vprasanja[$row1['id']][3] = strip_tags($row['naslov']); $expected_time[$row['vrstni_red']][0] += $expected_vprasanja[$row1['id']][0] * $expected_vprasanja[$row1['id']][1]; // dejanski $expected_time[$row['vrstni_red']][1] += $expected_vprasanja[$row1['id']][0]; // bruto - z vsemi vprasanji if (!isset($verjetnost[$row['vrstni_red']]) || $expected_vprasanja[$row1['id']][1] > $verjetnost[$row['vrstni_red']]) $verjetnost[$row['vrstni_red']] = $expected_vprasanja[$row1['id']][1]; } $expected_time[$row['vrstni_red']][0] += GlobalMisc::getMisc('timing_stran') * $verjetnost[$row['vrstni_red']]; // pri dejanskem trajanju strani upostevamo verjetnost najverjetnejsega vprasanja na strani (stran se pojavi z najvisjo verjetnostjo vseh vprasanj na strani) $expected_time[$row['vrstni_red']][1] += GlobalMisc::getMisc('timing_stran'); } } /* -- Predvideni casi */ // statusi SurveyStatusCasi :: Init($this->anketa); $izbranStatusCasi = SurveyStatusCasi :: getCurentProfileId(); $statusArray = SurveyStatusCasi::getStatusArray($izbranStatusCasi); $status = ''; foreach ($statusArray AS $key => $val) { if ($key == 'statusnull' && $val == 1) $status .= ($status!=''?',':'') . '-1'; if ($key == 'status0' && $val == 1) $status .= ($status!=''?',':'') . '0'; if ($key == 'status1' && $val == 1) $status .= ($status!=''?',':'') . '1'; if ($key == 'status2' && $val == 1) $status .= ($status!=''?',':'') . '2'; if ($key == 'status3' && $val == 1) $status .= ($status!=''?',':'') . '3'; if ($key == 'status4' && $val == 1) $status .= ($status!=''?',':'') . '4'; if ($key == 'status5' && $val == 1) $status .= ($status!=''?',':'') . '5'; if ($key == 'status6' && $val == 1) $status .= ($status!=''?',':'') . '6'; if ($key == 'statuslurker' && $val == 1) $lurker = ""; else $lurker = " AND lurker='0' "; } // preberemo vse timestampe za strani v anketi $sql = sisplet_query("SELECT ug.usr_id, UNIX_TIMESTAMP(ug.time_edit) AS time_edit_u, g.vrstni_red FROM srv_user_grupa".$this->db_table." ug, srv_grupa g, srv_user u WHERE ug.usr_id=u.id AND u.last_status IN ($status) $lurker AND ug.gru_id=g.id AND g.ank_id='$this->anketa' ORDER BY usr_id, gru_id"); if (!$sql) echo mysqli_error($GLOBALS['connect_db']); if (mysqli_num_rows($sql) == 0) { if ($samo_izracunaj_skupini_cas == 1) { return null; } elseif ($samo_izracunaj_skupini_cas == 2) { return array(null, null); } else { echo '
'.$lang['srv_analiza_no_entry'].'
'; } } $user_grupa = array(); while ($row = mysqli_fetch_array($sql)) { $user_grupa[$row['usr_id']][$row['vrstni_red']] = $row['time_edit_u']; } if (mysqli_num_rows($sql) == 0) { die(); } // cache mysql-a $usrs_id = array(); foreach ($user_grupa AS $usr_id => $val) { $usrs_id[] = $usr_id; } $cache_row = array(); $sql_c = sisplet_query("SELECT id, recnum, time_insert, UNIX_TIMESTAMP(time_insert) AS time_insert_u FROM srv_user WHERE id IN (".implode(',', $usrs_id).")"); if (!$sql_c) echo mysqli_error($GLOBALS['connect_db']); while ($row_c = mysqli_fetch_array($sql_c)) { $cache_row[ $row_c['id'] ] = $row_c; } $cache_row1 = array(); $sql1_c = sisplet_query("SELECT usr_id, time_edit, UNIX_TIMESTAMP(time_edit) AS time_edit_u FROM srv_user_grupa".$this->db_table." WHERE usr_id IN (".implode(',', $usrs_id).") AND gru_id = '0'"); if (!$sql1_c) echo mysqli_error($GLOBALS['connect_db']); while ($row1_c = mysqli_fetch_array($sql1_c)) { $cache_row1[ $row1_c['usr_id'] ] = $row1_c; } // izracunamo razlike v casih, da dobimo za vsakega userja koliko casa je bil na posamezni strani $casi = array(); foreach ($user_grupa AS $usr_id => $val) { $row = isset($cache_row[$usr_id]) ? $cache_row[$usr_id] : array(); $row1 = isset($cache_row1[$usr_id]) ? $cache_row1[$usr_id] : array(); $prev = (isset($row1['time_edit']) && $row1['time_edit'] != '' ? $row1['time_edit_u'] : $row['time_insert_u']); // nagovor if (isset($row1['time_edit']) && $row1['time_edit'] != '') $casi[0][$usr_id] = abs($row1['time_edit_u'] - $row['time_insert_u']); if (isset($row['recnum']) && $row['recnum'] > 0) { // zapisi brez recnuma ne pridejo v poštev, ker nimajo pravih časov foreach ($val AS $vrstni_red => $time_edit) { $casi[$vrstni_red][$usr_id] = abs($time_edit - $prev); $prev = $time_edit; } } } // porezemo zgornjih in spodnjih 5% casov vsake strani $spodnja = $rezanje_meja_sp / 100; $zgornja = $rezanje_meja_zg / 100; // REZANJE foreach ($casi AS $vrstni_red => $val1) { asort($casi[$vrstni_red]); $len = count($casi[$vrstni_red]); $odrezi_sp = (int) round ( $len * $spodnja , 0); $odrezi_zg = (int) round ( $len * $zgornja , 0); $i = 1; foreach ($casi[$vrstni_red] AS $key => $val2) { if ($rezanje == 0) { // rezanje po zgornji in spodnji meji if ($i <= $odrezi_sp || $i > $len-$odrezi_zg) { unset($casi[$vrstni_red][$key]); } } else { // rezanje glede na 10% in 200% predvidenih vrednosti if ($val2 < $expected_time[$vrstni_red][0]*$rezanje_predvidena_sp/100 || $val2 > $expected_time[$vrstni_red][0]*$rezanje_predvidena_zg/100) { unset($casi[$vrstni_red][$key]); } } $i++; } } // izracunamo povprecne case $sql = sisplet_query("SELECT MAX(vrstni_red) AS max FROM srv_grupa WHERE ank_id = '$this->anketa'"); $row = mysqli_fetch_array($sql); $count = array(); $povprecni_casi = array(); $user_casi = array(); $max_time_on_page = 0; // Na zacetku nastavimo vse povprecne case po straneh na 0 for ($i=0; $i<=$row['max']; $i++){ $povprecni_casi[$i] = 0; } // Loop po vseh straneh foreach ($casi AS $vrstni_red => $uporabniki_na_strani) { // pogledamo za preskocene strani - samo ce nimamo nastavljeno, da se uposteva preskocene kot 0s $preskocene = array(); if ($rezanje_preskocene == 0) { $sqlp = sisplet_query("SELECT ug.usr_id FROM srv_user_grupa".$this->db_table." ug, srv_grupa g WHERE g.id=ug.gru_id AND g.vrstni_red='$vrstni_red' AND ug.preskocena='1'"); while ($rowp = mysqli_fetch_array($sqlp)) { array_push($preskocene, $rowp['usr_id']); } } // Loop po vseh uporabnikih na strani (cas, ki ga je prezivel na trenutni strani) foreach ($uporabniki_na_strani AS $usr_id => $time) { // Racunanje casov - eliminiramo preskocene samo ce imamo to nastavitev vklopljeno //if (!in_array($usr_id, $preskocene) || $rezanje_preskocene==1) { // neto je kao povprecno trajanje strani in uposteva tudi 0s, 1s ce se je preskocilo if(isset($povprecni_casi[$vrstni_red])) $povprecni_casi[$vrstni_red] += $time; else $povprecni_casi[$vrstni_red] = $time; // Pristejemo cas userja if(isset($user_casi[$usr_id])) $user_casi[$usr_id] += $time; else $user_casi[$usr_id] = $time; //} // Zabelezimo najdaljsi obisk strani if ($time > $max_time_on_page) $max_time_on_page = $time; } // Izracunamo povprecje na strani if (count($uporabniki_na_strani) > 0){ $povprecni_casi[$vrstni_red] = $povprecni_casi[$vrstni_red] / count($uporabniki_na_strani); } $count[$vrstni_red] = count($casi[$vrstni_red]); } // Loop po povprecnih casih in dobimo najvecji povprecni cas in celoten cas $max = 0; $total_povprecni_cas = 0; $total_predvideni_cas = 0; foreach ($povprecni_casi AS $key => $val) { // Shranimo vecji povprecni cas if ($val > $max) $max = $val; // Pristejemo povprecni cas strani celotnemu povprecnemu casu $total_povprecni_cas += $val; } if ($get_predvideni == 1) { if ($rezanje_preskocene == 1) { foreach ($expected_time AS $key => $val) { if ($val[0] > $max) $max = $val[0]; $total_predvideni_cas += $val[0]; } } else { foreach ($expected_time AS $key => $val) { if ($val[1] > $max) $max = $val[1]; $total_predvideni_cas += $val[1]; } } } // Izracunamo mediano, min in max cas na anketi $total_median_cas = 0; $total_min_cas = 0; $total_max_cas = 0; // Sortiramo case uporabnikov po velikosti sort($user_casi, SORT_NUMERIC); $user_count = count($user_casi); // Dobimo index srednjega elementa $user_median_index = floor($user_count / 2); // Liho stevilo userjev - dobimo mediano - vrednost srednjega if ($user_count % 2 === 1) { $total_median_cas = $user_casi[$user_median_index]; } // Sodo stevilo - izracunamo mediano iz srednjih dveh else { if(isset($user_casi[$user_median_index-1])) $total_median_cas = ($user_casi[$user_median_index-1] + $user_casi[$user_median_index]) / 2; else $total_median_cas = $user_casi[$user_median_index]; } // Zabelezimo min in max cas uporabnika na anketi $total_min_cas = $user_casi[0]; $total_max_cas = $user_casi[$user_count-1]; if ($max == 0) return; // izpis $skupni_cas = (bcdiv($total_povprecni_cas, 60, 0) > 0 ? bcdiv($total_povprecni_cas, 60, 0).'min ':'').''.round(bcmod($total_povprecni_cas, 60), 0).'s'; $predviden_cas = (bcdiv($total_predvideni_cas, 60, 0)>0?bcdiv($total_predvideni_cas, 60, 0).'min ':'').''.round(bcmod($total_predvideni_cas, 60), 0); $mediana = (bcdiv($total_median_cas, 60, 0) > 0 ? bcdiv($total_median_cas, 60, 0).'min ':'').''.round(bcmod($total_median_cas, 60), 0).'s'; $minimum = (bcdiv($total_min_cas, 60, 0) > 0 ? bcdiv($total_min_cas, 60, 0).'min ':'').''.round(bcmod($total_min_cas, 60), 0).'s'; $maximum = (bcdiv($total_max_cas, 60, 0) > 0 ? bcdiv($total_max_cas, 60, 0).'min ':'').''.round(bcmod($total_max_cas, 60), 0).'s'; $numerus = $user_count; // Ce izipsujemo samo dejanski cas na nekem drugem mestu if ($samo_izracunaj_skupini_cas > 0){ // Vracamo array tudi z mediano if($samo_izracunaj_skupini_cas == 2) return array($skupni_cas, $mediana); else return $skupni_cas; } // Prvi segment - dejansko trajanje, mediana... echo '
'.$lang['srv_total_trajanje'].''; echo '

'.$lang['srv_dejansko_trajanje_real'].':

'; echo '

'.$skupni_cas.'

'; echo '

'.$lang['median'].':

'; echo '

'.$mediana.'

'; echo '

Min:

'; echo '

'.$minimum.'

'; echo '

Max:

'; echo '

'.$maximum.'

'; echo '

'.$lang['numerus'].':

'; echo '

'.$numerus.'

'; echo '
'; echo '
'.$lang['srv_dejanski_casi'].''; echo '

'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ($povprecni_casi AS $vrstni_red => $time) { $naslov = $lang['srv_intro_label']; $sql = sisplet_query("SELECT naslov FROM srv_grupa WHERE vrstni_red='$vrstni_red' AND ank_id = '$this->anketa'"); if(mysqli_num_rows($sql) > 0){ $row = mysqli_fetch_array($sql); if($row['naslov'] != '') $naslov = $row['naslov']; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo ''; echo ''; echo '
'.$lang['srv_casi_po_straneh_stran'].''.$lang['srv_neto_v_cas']; if ($get_predvideni == 1) { echo ' / '.$lang['srv_testiranje_predvidenicas_1']; } echo ''.$lang['srv_stevilo_enot'].'
'.$naslov.''.($time<60 ? round($time,1).'s ' : round($time/60,1).'min '); if ($get_predvideni == 1) { if ($rezanje_preskocene == 1) $time = $expected_time[$vrstni_red][0]; else $time = $expected_time[$vrstni_red][1]; echo ' / '.($time<60 ? round($time,1).'s ' : round($time/60,1).'min ').''; } echo ''; echo '
'; echo '
'; if ($get_predvideni == 1) { if ($rezanje_preskocene == 1) $time = $expected_time[$vrstni_red][0]; else $time = $expected_time[$vrstni_red][1]; echo '
'; } echo '
'; echo '
'.(isset($count[$vrstni_red]) ? $count[$vrstni_red] : 0).'
'.$lang['srv_anl_suma1'].''.$skupni_cas; if ($get_predvideni == 1) { if ($rezanje_preskocene == 1) $time = $expected_time[$vrstni_red][0]; else $time = $expected_time[$vrstni_red][1]; echo ' / '.$predviden_cas.'s'; } echo '
'; echo '
'; echo '
'.$lang['srv_neto_t_cas'].''; if ($get_predvideni == 1) echo '
'.$lang['srv_testiranje_predvidenicas_1'].''; echo '
'; echo '
'; // pridejo prevelike tabele if ($max_time_on_page > 1000 && $admin_type > 0) return; // izpis histograma casov za vsako stran echo '
'.$lang['srv_frekvencna_porazdelitev'].''; echo '
'; echo '
'; echo ''; echo '
'; if ($rezanje_preskocene == 1) { echo '
'; echo ' '; echo '
'; } echo '
'; // Zdruzimo vse case po straneh na en histogram if ($get_pages != '1') { // Dobimo case resevanja celotne ankete - po respondentih $skupni_casi = array(); // Loop po posameznih straneh - sestejemo case po straneh na skupni cas na anketi foreach ($casi AS $stran => $casi_na_strani) { // Loop po vseh casih na strani foreach ($casi_na_strani AS $usr_id => $cas_na_strani) { if (isset($skupni_casi[$usr_id])) $skupni_casi[$usr_id] += $cas_na_strani; else $skupni_casi[$usr_id] = $cas_na_strani; } } // Nastavimo se min cas in max cas na anketi $max_cas_na_anketi = 0; $min_cas_na_anketi = 0; foreach ($skupni_casi AS $usr_id => $cas_na_anketi){ if ($cas_na_anketi > $max_cas_na_anketi) $max_cas_na_anketi = $cas_na_anketi; if ($cas_na_anketi < $min_cas_na_anketi || $min_cas_na_anketi == 0) $min_cas_na_anketi = $cas_na_anketi; } // Pretvorimo v minute foreach ($skupni_casi AS $usr_id => $cas_na_anketi) { $skupni_casi[$usr_id] = (int) round($cas_na_anketi / 60, 0); } $max_cas_na_anketi = (int) round($max_cas_na_anketi / 60, 0); $min_cas_na_anketi = (int) round($min_cas_na_anketi / 60, 0); if($get_prikazi01 == 1) $min_cas_na_anketi = 0; else $min_cas_na_anketi = 2; // Pripravimo podatke za histogram $histogram_data = array(); // Napolnimo vrednosti 0 na vsakem koraku (minuti) for ($t=0; $t<=$max_cas_na_anketi; $t++) $histogram_data[$t] = 0; // Napolnimo vrednosti v histogram in dobimo najvecjo vrednost $histogram_max_data = 0; foreach ($skupni_casi AS $usr_id => $cas_na_anketi) { $histogram_data[$cas_na_anketi]++; if($histogram_data[$cas_na_anketi] > $histogram_max_data) $histogram_max_data = $histogram_data[$cas_na_anketi]; } // Izrisemo histogram - ce imamo kaksno vrednost nad 0 if ($histogram_max_data != 0) { echo ''; // Sivi stolpci echo ''; for ($t=$min_cas_na_anketi; $t<=$max_cas_na_anketi; $t++) { if(isset($histogram_data[$t])){ echo ''; } } echo ''; // Spodnja os echo ''; // Korak 1 min if ($max_cas_na_anketi <= 20) { for ($t=$min_cas_na_anketi; $t<=$max_cas_na_anketi; $t++) { echo ''; } } // Korak 10 min else { $colspan = 10 - $min_cas_na_anketi; echo ''; for ($t=10; $t<=$max_cas_na_anketi; $t+=10) { // Pri zadnji labeli odstejemo span if(($t + 10) > count($histogram_data)) $colspan = count($histogram_data) - $t; else $colspan = 10; echo ''; } } echo ''; echo '
'; echo '
'; echo '
'.$t.'min'.''.$min_cas_na_anketi.'min'.$t.'
'; } } // Casi po straneh - 1 histogram na stran else{ foreach ($casi AS $stran => $casi_na_strani) { // Izpisemo naslov posamezne strani $naslov = $lang['srv_intro_label']; $sql = sisplet_query("SELECT naslov FROM srv_grupa WHERE vrstni_red='$stran' AND ank_id='$this->anketa'"); if(mysqli_num_rows($sql) > 0){ $row = mysqli_fetch_array($sql); if($row['naslov'] != '') $naslov = $row['naslov']; } echo '

'.$naslov.'

'; // Dobimo podatke za histogram // Nastavimo min cas in max cas na anketi $max_cas_na_strani = 0; $min_cas_na_strani = 0; foreach ($casi_na_strani AS $usr_id => $cas_na_strani) { if ($cas_na_strani > $max_cas_na_strani) $max_cas_na_strani = $cas_na_strani; if ($cas_na_strani < $min_cas_na_strani || $min_cas_na_strani == 0) $min_cas_na_strani = $cas_na_strani; } // Pretvorimo v minute $max_cas_na_strani = (int) round($max_cas_na_strani / 60, 0); $min_cas_na_strani = (int) round($min_cas_na_strani / 60, 0); if($get_prikazi01 == 1) $min_cas_na_strani = 0; // Pripravimo podatke za histogram $histogram_data = array(); // Napolnimo vrednosti 0 na vsakem koraku (minuti) for ($t=0; $t<=$max_cas_na_strani; $t++) $histogram_data[$t] = 0; // Napolnimo vrednosti v histogram in dobimo najvecjo vrednost $histogram_max_data = 0; foreach ($casi_na_strani AS $usr_id => $cas_na_strani) { // Pretvorimo v minute $cas_na_strani = (int) round($cas_na_strani / 60, 0); $histogram_data[$cas_na_strani]++; if($histogram_data[$cas_na_strani] > $histogram_max_data) $histogram_max_data = $histogram_data[$cas_na_strani]; } // Izrisemo histogram za stran - ce imamo kaksno vrednost nad 0 if ($histogram_max_data != 0) { echo ''; // Sivi stolpci echo ''; for ($t=$min_cas_na_strani; $t<=$max_cas_na_strani; $t++) { if(isset($histogram_data[$t])){ echo ''; } } echo ''; // Spodnja os echo ''; // Korak 1 min if ($max_cas_na_strani <= 20) { for ($t=$min_cas_na_strani; $t<=$max_cas_na_strani; $t++) { echo ''; } } // Korak 10 min else { if ($min_cas_na_strani == 0) echo ''; else echo ''; for ($t=10; $t<=$max_cas_na_strani; $t+=10) { $colspan = 10; if(($t + 10) > count($histogram_data)) $colspan = $t + 10 - count($histogram_data); if($min_cas_na_strani != 0) $colspan -= 2; echo ''; } } echo ''; echo '
'; echo '
'; echo '
'.$t.'min'.'0'.'min'.'2'.'min'.''.$t.'
'; } } } echo '
'; } /** * opcije za rezanje */ function show_rezanje_casi () { global $lang; global $global_user_id; SurveyUserSetting :: getInstance()->Init($this->anketa, $global_user_id); $rezanje = SurveyUserSetting::getInstance()->getSettings('rezanje'); if ($rezanje == '') $rezanje = 0; $rezanje_meja_sp = SurveyUserSetting::getInstance()->getSettings('rezanje_meja_sp'); if ($rezanje_meja_sp == '') $rezanje_meja_sp = 5; $rezanje_meja_zg = SurveyUserSetting::getInstance()->getSettings('rezanje_meja_zg'); if ($rezanje_meja_zg == '') $rezanje_meja_zg = 5; $rezanje_predvidena_sp = SurveyUserSetting::getInstance()->getSettings('rezanje_predvidena_sp'); if ($rezanje_predvidena_sp == '') $rezanje_predvidena_sp = 10; $rezanje_predvidena_zg = SurveyUserSetting::getInstance()->getSettings('rezanje_predvidena_zg'); if ($rezanje_predvidena_zg == '') $rezanje_predvidena_zg = 200; $rezanje_preskocene = SurveyUserSetting::getInstance()->getSettings('rezanje_preskocene'); if ($rezanje_preskocene == '') $rezanje_preskocene = 1; echo '

'.$lang['srv_rezanje'].'

'; echo ''; echo ''; echo '
'; echo ' '; echo ' '; echo '
'; } /** * shrani nastavitve * */ function save_rezanje_casi () { global $global_user_id; SurveyUserSetting::getInstance()->Init($this->anketa, $global_user_id); SurveyUserSetting::getInstance()->saveSettings('rezanje', $_POST['rezanje']); SurveyUserSetting::getInstance()->saveSettings('rezanje_meja_sp', $_POST['rezanje_meja_sp']); SurveyUserSetting::getInstance()->saveSettings('rezanje_meja_zg', $_POST['rezanje_meja_zg']); SurveyUserSetting::getInstance()->saveSettings('rezanje_predvidena_sp', $_POST['rezanje_predvidena_sp']); SurveyUserSetting::getInstance()->saveSettings('rezanje_predvidena_zg', $_POST['rezanje_predvidena_zg']); SurveyUserSetting::getInstance()->saveSettings('rezanje_preskocene', $_POST['rezanje_preskocene']); } function string_format($cnt,$lang_root) { global $lang; $txt = ''; //if ($cnt > 0) $txt .= ''; if (isset($lang[$lang_root.'_'.$cnt])) { $txt .= $cnt.' '.$lang[$lang_root.'_'.$cnt]; } else { $txt .= $cnt.' '.$lang[$lang_root.'_more']; } //if ($cnt > 0) $txt .= ''; return $txt; } /** * odsteje dva datuma, $d1 - D2 * */ function diff ($d1, $d2) { //echo $d1.' '.$d2; $d1 = (is_string($d1) ? strtotime($d1) : $d1); $d2 = (is_string($d2) ? strtotime($d2) : $d2); //echo ' ('.$d1.' '.$d2.')
'; $diff_secs = abs($d1 - $d2); return $diff_secs; } private $usr_id; /** * vnese izbrano stevilo testnih podatkov * */ function testiranje_testnipodatki () { global $lang; if (isset($_POST['stevilo_vnosov']) && $_POST['stevilo_vnosov'] > 0) { // Nastavitev da vstavljamo samo veljavne vnose $only_valid = isset($_POST['only_valid']) ? $_POST['only_valid'] : 0; if(session_id() == '') {session_start();} $_SESSION['progressBar'][$this->anketa]['status'] = 'ok'; $_SESSION['progressBar'][$this->anketa]['total'] = (int)$_POST['stevilo_vnosov']; $_SESSION['progressBar'][$this->anketa]['current'] = 0; session_commit(); SurveyInfo::getInstance()->SurveyInit($this->anketa); $rowa = SurveyInfo::getInstance()->getSurveyRow(); if ($rowa['survey_type'] < 2) return; // samo za anketo na več straneh in branching... $sql = sisplet_query("SELECT MAX(recnum) AS recnum FROM srv_user WHERE ank_id = '$this->anketa' AND preview='0'"); $row = mysqli_fetch_array($sql); $recnum = $row['recnum'] + 1; //$sql = sisplet_query("SELECT s.id, s.tip, s.size, s.ranking_k, s.design FROM srv_spremenljivka s, srv_grupa g WHERE s.gru_id=g.id AND g.ank_id='$this->anketa' AND s.visible='1' ORDER BY g.vrstni_red, s.vrstni_red"); $sql = sisplet_query("SELECT s.id, s.tip, s.size, s.ranking_k, s.design, s.cela FROM srv_spremenljivka s, srv_grupa g WHERE s.gru_id=g.id AND g.ank_id='$this->anketa' AND s.visible='1' ORDER BY g.vrstni_red, s.vrstni_red"); # zabeležimo id-je za arhiv testnih vnosov $arrayTestni = array(); for ($i=1; $i<=$_POST['stevilo_vnosov']; $i++) { session_start(); $_SESSION['progressBar'][$this->anketa]['current'] = $i; session_commit(); // izberemo random hash, ki se ni v bazi (to more bit, ker je index na fieldu cookie) do { $rand = md5(mt_rand(1, mt_getrandmax()).'@'.$_SERVER['REMOTE_ADDR']); $sql1 = sisplet_query("SELECT id FROM srv_user WHERE cookie = '$rand'"); } while (mysqli_num_rows($sql1) > 0); $sql2 = sisplet_query("INSERT INTO srv_user (ank_id, preview, testdata, cookie, user_id, ip, time_insert, recnum, referer, last_status, lurker) VALUES ('$this->anketa', '0', '2', '$rand', '0', '$_SERVER[REMOTE_ADDR]', NOW(), '$recnum', '$_SERVER[HTTP_REFERER]', '6', '0')"); if (!$sql2) echo mysqli_error($GLOBALS['connect_db']); $this->usr_id = mysqli_insert_id($GLOBALS['connect_db']); // Survey v zanki vsakič kreiramo znova zaradi IFov !!! include_once('../../main/survey/app/global_function.php'); new \App\Controllers\SurveyController(true); save('usr_id', $this->usr_id); $s = \App\Controllers\CheckController::getInstance(); $arrayTestni[] = $this->usr_id; mysqli_data_seek($sql, 0); while ($row = mysqli_fetch_array($sql)) { $srv_data_vrednost = ""; $srv_data_grid = ""; $srv_data_checkgrid = ""; $srv_data_text = ""; $srv_data_textgrid = ""; $srv_data_rating = ""; $srv_data_map = ""; $srv_data_heatmap = ""; if ($row['tip'] != 5) { // radio ali select if ( ($row['tip']==1 || $row['tip']==3) ) { $sql1 = sisplet_query("SELECT id, other FROM srv_vrednost WHERE spr_id='$row[id]'"); // Ce imamo samo veljavne vedno oznacimo enega if($only_valid == 1) $rand = rand(1, mysqli_num_rows($sql1)); else $rand = rand(0, mysqli_num_rows($sql1)); if ($rand > 0) { for ($j=1; $j<=$rand; $j++) $row1 = mysqli_fetch_array($sql1); $vrednost = $row1['id']; } else { $vrednost = 0; } if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { if (isset($vrednost) && $vrednost > 0) { $srv_data_vrednost .= "('$row[id]', '$vrednost', '$this->usr_id'),"; if ($row1['other'] == 1) $srv_data_text .= "('$row[id]', '$vrednost', '".$this->randomString()."', '', '$this->usr_id'),"; } } else { $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } // checkbox } elseif ($row['tip'] == 2) { if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { unset($vrednost); $sql1 = sisplet_query("SELECT id, other FROM srv_vrednost WHERE spr_id='$row[id]'"); $randX = 0; if($only_valid == 1) $randX = rand(1, mysqli_num_rows($sql1)); $j=1; while ($row1 = mysqli_fetch_array($sql1)) { $rand = rand(-1, 1); if ($rand > 0){ $vrednost[$row1['id']] = $row1['id']; } // Ce imamo samo veljavne vedno oznacimo enega if($randX == $j && $only_valid == 1){ $vrednost[$row1['id']] = $row1['id']; } $j++; } if (isset($vrednost)) { foreach ($vrednost AS $key => $val) { if ($val > 0) { $srv_data_vrednost .= "('$row[id]', '$val', '$this->usr_id'),"; if (isset($row1['other']) && $row1['other'] == 1) $srv_data_text .= "('$row[id]', '$val', '".$this->randomString()."', '', '$this->usr_id'),"; } } } } else { $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } // multigrid } elseif ($row['tip'] == 6) { $sql1 = sisplet_query("SELECT id, other FROM srv_vrednost WHERE spr_id = '$row[id]'"); while ($row1 = mysqli_fetch_array($sql1)) { if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { $sql2 = sisplet_query("SELECT id FROM srv_grid WHERE spr_id='$row[id]'"); // Ce imamo samo veljavne vedno oznacimo enega if($only_valid == 1) $rand = rand(1, mysqli_num_rows($sql2)); else $rand = rand(0, mysqli_num_rows($sql2)); if ($rand > 0) { for ($j=1; $j<=$rand; $j++) $row2 = mysqli_fetch_array($sql2); $grid_id = $row2['id']; } else { $grid_id = 0; } if ($grid_id > 0) { $srv_data_grid .= "('$row[id]', '$row1[id]', '$this->usr_id', '$grid_id'),"; } if ($row1['other'] == 1 && $grid_id > 0) $srv_data_text .= "('$row[id]', '$row1[id]', '".$this->randomString()."', '', '$this->usr_id'),"; } else { $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } } // multicheckbox } elseif ($row['tip'] == 16) { $sql1 = sisplet_query("SELECT id, other FROM srv_vrednost WHERE spr_id = '$row[id]'"); while ($row1 = mysqli_fetch_array($sql1)) { $sql2 = sisplet_query("SELECT id FROM srv_grid WHERE spr_id = '$row[id]' ORDER BY vrstni_red"); $randX = 0; if($only_valid == 1) $randX = rand(1, mysqli_num_rows($sql2)); $j=1; while ($row2 = mysqli_fetch_array($sql2)) { if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { $rand = rand(-1, 1); if ($rand > 0) { $grid_id = $row2['id']; } else { $grid_id = 0; } // Ce imamo samo veljavne vedno oznacimo enega if($randX == $j && $only_valid == 1){ $grid_id = $row2['id']; } $j++; if ($grid_id > 0) { $srv_data_checkgrid .= "('$row[id]', '$row1[id]', '$this->usr_id', '$grid_id'),"; } if ($row1['other'] == 1 && $grid_id > 0) $srv_data_text .= "('$row[id]', '$row1[id]', '".$this->randomString()."', '', '$this->usr_id'),"; } else { $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } } } } // multitext elseif ($row['tip'] == 19) { $sql1 = sisplet_query("SELECT id, other FROM srv_vrednost WHERE spr_id = '$row[id]'"); while ($row1 = mysqli_fetch_array($sql1)) { $sql2 = sisplet_query("SELECT id FROM srv_grid WHERE spr_id = '$row[id]' ORDER BY vrstni_red"); while ($row2 = mysqli_fetch_array($sql2)) { if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { // Ce imamo samo veljavne imamo vedno vrednost if($only_valid == 1) $value = $this->randomString(); else $value = rand(0,1)==0 ? $this->randomString() : ''; $grid_id = $row2['id']; if ($value != '') { $srv_data_textgrid .= "('$row[id]', '$row1[id]', '$this->usr_id', '$grid_id', '$value'),"; } // vsebino text polja vnesemo v vsakem primeru if ($row1['other'] == 1 && $value != '') $srv_data_text .= "('$row[id]', '$row1[id]', '".$this->randomString()."', '', '$this->usr_id'),"; } else { $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } } } } //Lokacija elseif($row['tip'] == 26){ //choose location $sql1 = sisplet_query("SELECT id FROM srv_vrednost WHERE spr_id = '$row[id]'", 'array'); //so vrednosti, se pravi je choose if($sql1){ foreach($sql1 as $row1){ if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { // Ce imamo samo veljavne imamo vedno vrednost if($only_valid == 1) $vrednost = $this->randomString(); else $vrednost = rand(0,1)==0 ? $this->randomString() : ''; $srv_data_map .= "(" . $this->usr_id . ", '$row[id]', '$row1[id]', ". $this->anketa . ", '', '', '', '". ($vrednost != '' ? $vrednost : '-1')."', ''),"; } else { $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } } } //niso vrednosti, se pravi je moja ali multi lokacija else{ if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { $make_input = ($only_valid == 1 ? true : rand(0,1)==0); if($make_input){ $lat = floatval(mt_rand(454000, 466500)/10000); $lng = floatval(mt_rand(136000, 163900)/10000); // Ce imamo samo veljavne imamo vedno vrednost if($only_valid == 1) $vrednost = $this->randomString(); else $vrednost = rand(0,1)==0 ? $this->randomString() : ''; $srv_data_map .= "(" . $this->usr_id . ", '$row[id]', '$row1[id]', ". $this->anketa . ", '$lat', '$lng', '[N/A]', '". ($vrednost != '' ? $vrednost : '-1')."', ''),"; } } else { $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } } } //Heatmap elseif($row['tip'] == 27){ //choose location $sql1 = sisplet_query("SELECT id FROM srv_vrednost WHERE spr_id = '$row[id]'", 'array'); //so vrednosti, se pravi je choose if($sql1){ foreach($sql1 as $row1){ if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { // Ce imamo samo veljavne imamo vedno vrednost if($only_valid == 1) $vrednost = $this->randomString(); else $vrednost = rand(0,1)==0 ? $this->randomString() : ''; $srv_data_heatmap .= "(" . $this->usr_id . ", '$row[id]', '$row1[id]', ". $this->anketa . ", '', '', '', '". ($vrednost != '' ? $vrednost : '-1')."', ''),"; } else { $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } } } //niso vrednosti, se pravi je moja ali multi lokacija else{ if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { $make_input = ($only_valid == 1 ? true : rand(0,1)==0); if($make_input){ $lat = floatval(mt_rand(454000, 466500)/10000); $lng = floatval(mt_rand(136000, 163900)/10000); // Ce imamo samo veljavne imamo vedno vrednost if($only_valid == 1) $vrednost = $this->randomString(); else $vrednost = rand(0,1)==0 ? $this->randomString() : ''; $srv_data_heatmap .= "(" . $this->usr_id . ", '$row[id]', '$row1[id]', ". $this->anketa . ", '$lat', '$lng', '[N/A]', '". ($vrednost != '' ? $vrednost : '-1')."', ''),"; } } else { $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } } } // multinumber elseif ($row['tip'] == 20) { $sql1 = sisplet_query("SELECT id, other FROM srv_vrednost WHERE spr_id = '$row[id]'"); while ($row1 = mysqli_fetch_array($sql1)) { $sql2 = sisplet_query("SELECT id FROM srv_grid WHERE spr_id = '$row[id]' ORDER BY vrstni_red"); while ($row2 = mysqli_fetch_array($sql2)) { if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { // Ce imamo samo veljavne imamo vedno vrednost if($only_valid == 1) $value = $this->randomNumber(); else $value = rand(0,1)==0 ? $this->randomNumber() : ''; $grid_id = $row2['id']; if ($value != '') { $srv_data_textgrid .= "('$row[id]', '$row1[id]', '$this->usr_id', '$grid_id', '$value'),"; } // vsebino text polja vnesemo v vsakem primeru if ($row1['other'] == 1 && $value != '') $srv_data_text .= "('$row[id]', '$row1[id]', '".$this->randomString()."', '', '$this->usr_id'),"; } else { $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } } } } // textbox elseif ($row['tip'] == 4) { if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { $vrednost = rand(0,1)==0 ? $this->randomString() : ''; if (isset($vrednost) && $vrednost != '') $srv_data_text .= "('$row[id]', '', '$vrednost', '', '$this->usr_id'),"; } else { $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } } // textbox* elseif ($row['tip'] == 21) { $sql1 = sisplet_query("SELECT id FROM srv_vrednost WHERE spr_id = '$row[id]'"); while ($row1 = mysqli_fetch_array($sql1)) { if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { // Ce imamo samo veljavne imamo vedno vrednost if($only_valid == 1) $vrednost = $this->randomString(); else $vrednost = rand(0,1)==0 ? $this->randomString() : ''; if (isset($vrednost) && $vrednost != '') $srv_data_text .= "('$row[id]', '$row1[id]', '$vrednost', '', '$this->usr_id'),"; } else { $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } } } // number elseif ($row['tip'] == 7) { ####### za ureditev avtomatskega vnosa glede na dolzino stevila if($row['ranking_k']==0){ //ce je stevilo $newLength = $row['cela']; }elseif($row['ranking_k']==1){ //ce je drsnik $rowParams = Cache::srv_spremenljivka($row['id']); $spremenljivkaParams = new enkaParameters($rowParams['params']); $slider_MaxNumLabel = ($spremenljivkaParams->get('slider_MaxNumLabel') ? $spremenljivkaParams->get('slider_MaxNumLabel') : 100); $newLength = strlen((string)$slider_MaxNumLabel)-1; } ####### za ureditev avtomatskega vnosa glede na dolzino stevila - konec if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { $ij=1; unset($vrednost); // Ce imamo samo veljavne imamo vedno vrednost if($only_valid == 1){ //if ($row['size'] >= 1) $vrednost[0] = $this->randomNumber(); if ($row['size'] >= 1) $vrednost[0] = $this->randomNumber($newLength); //if ($row['size'] >= 2) $vrednost[1] = $this->randomNumber(); if ($row['size'] >= 2) $vrednost[1] = $this->randomNumber($newLength); } elseif (rand(0,1) == 0) { //if ($row['size'] >= 1) $vrednost[0] = $this->randomNumber(); if ($row['size'] >= 1) $vrednost[0] = $this->randomNumber($newLength); //if ($row['size'] >= 2) $vrednost[1] = $this->randomNumber(); if ($row['size'] >= 2) $vrednost[1] = $this->randomNumber($newLength); } if (isset($vrednost)){ $text = ''; $text2 = ''; foreach ($vrednost AS $key => $val) { if($ij==1){ if ($val != '') $text = $val; } else{ if ($val != '') $text2 = $val; } $ij++; } $srv_data_text .= "('$row[id]', '', '$text', '$text2', '$this->usr_id'),"; } } else { $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } } // compute elseif ($row['tip'] == 22) { if (true){ $val = $s->checkCalculation(-$row['id']); // za spremenljivke je v srv_calculation, v cnd_id zapisan id spremenljivke kot minus (plus je za kalkulacije v ifih) if ($val != '') $srv_data_text .= "('$row[id]', '', '$val', '', '$this->usr_id'),"; } } // 8_datum elseif ($row['tip'] == 8) { if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { // Ce imamo samo veljavne imamo vedno vrednost if($only_valid == 1) $vrednost = $this->randomDate(); else $vrednost = rand(0,1)==0 ? $this->randomDate() : ''; if (isset($vrednost) && $vrednost != '') $srv_data_text .= "('$row[id]', '', '$vrednost', '', '$this->usr_id'),"; } else { $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } } // ranking elseif ($row['tip'] == 17) { if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { //cifre if($row['design'] == 1 or true){ // tukaj se pac vse generira tukaj $sql1 = sisplet_query("SELECT id FROM srv_vrednost WHERE spr_id = '$row[id]' AND vrstni_red>0 ORDER BY vrstni_red"); $rows = mysqli_num_rows($sql1); if ($row['ranking_k'] > 0) $rows = $row['ranking_k']; unset($array); // Ce imamo samo veljavne imamo vedno vrednosti if($only_valid == 1){ if (rand(0,1) == 0) $rows = floor($rows/2); $array = range(1, $rows); shuffle($array); } elseif (rand(0,1) == 0) { if (rand(0,1) == 0) $rows = floor($rows/2); $array = range(1, $rows); shuffle($array); } while($row1 = mysqli_fetch_array($sql1)){ if (isset($array) && count($array) > 0) { $vrednost = array_pop($array); if (isset($vrednost) && $vrednost != '') $srv_data_rating .= "('$row[id]', '$row1[id]', '$this->usr_id', '$vrednost'),"; } } } //n==k (sortable) else if($row['design'] == 2){ } //n>k else if($row['design'] == 0){ } } else $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } // vsota elseif ($row['tip'] == 18) { $sql1 = sisplet_query("SELECT id FROM srv_vrednost WHERE spr_id = '$row[id]' AND vrstni_red>0 ORDER BY vrstni_red"); while($row1 = mysqli_fetch_array($sql1)){ if ($s->checkSpremenljivka($row['id'], $isTestData=true)){ unset($vrednost); // Ce imamo samo veljavne imamo vedno vrednosti if($only_valid == 1) $vrednost = $this->randomNumber(); elseif(rand(0,1) == 0) $vrednost = $this->randomNumber(); if (isset($vrednost) && $vrednost != '') $srv_data_text .= "('$row[id]', '$row1[id]', '$vrednost', '', '$this->usr_id'),"; } else $srv_data_vrednost .= "('$row[id]', '-2', '$this->usr_id'),"; } } // Kombinirana tabela elseif($row['tip'] == 24){ // Loop cez podtabele kombinirane dabele $sqlC = sisplet_query("SELECT s.id, s.tip FROM srv_grid_multiple m, srv_spremenljivka s WHERE m.parent='$row[id]' AND m.spr_id=s.id ORDER BY m.vrstni_red"); while ($rowC = mysqli_fetch_array($sqlC)) { // multigrid if ($rowC['tip'] == 6) { $sql1 = sisplet_query("SELECT id, other FROM srv_vrednost WHERE spr_id = '$rowC[id]'"); while ($row1 = mysqli_fetch_array($sql1)) { if ($s->checkSpremenljivka($rowC['id'], $isTestData=true)) { $sql2 = sisplet_query("SELECT id FROM srv_grid WHERE spr_id='$rowC[id]'"); // Ce imamo samo veljavne vedno oznacimo enega if($only_valid == 1) $rand = rand(1, mysqli_num_rows($sql2)); else $rand = rand(0, mysqli_num_rows($sql2)); if ($rand > 0) { for ($j=1; $j<=$rand; $j++) $row2 = mysqli_fetch_array($sql2); $grid_id = $row2['id']; } else { $grid_id = 0; } if ($grid_id > 0) { $srv_data_grid .= "('$rowC[id]', '$row1[id]', '$this->usr_id', '$grid_id'),"; } if ($row1['other'] == 1 && $grid_id > 0) $srv_data_text .= "('$rowC[id]', '$row1[id]', '".$this->randomString()."', '', '$this->usr_id'),"; } else { $srv_data_vrednost .= "('$rowC[id]', '-2', '$this->usr_id'),"; } } // multicheckbox } elseif ($rowC['tip'] == 16) { $sql1 = sisplet_query("SELECT id, other FROM srv_vrednost WHERE spr_id = '$rowC[id]'"); while ($row1 = mysqli_fetch_array($sql1)) { $sql2 = sisplet_query("SELECT id FROM srv_grid WHERE spr_id = '$rowC[id]' ORDER BY vrstni_red"); $randX = 0; if($only_valid == 1) $randX = rand(1, mysqli_num_rows($sql2)); $j=1; while ($row2 = mysqli_fetch_array($sql2)) { if ($s->checkSpremenljivka($rowC['id'], $isTestData=true)) { $rand = rand(-1, 1); if ($rand > 0) { $grid_id = $row2['id']; } else { $grid_id = 0; } // Ce imamo samo veljavne vedno oznacimo enega if($randX == $j && $only_valid == 1){ $grid_id = $row2['id']; } $j++; if ($grid_id > 0) { $srv_data_checkgrid .= "('$rowC[id]', '$row1[id]', '$this->usr_id', '$grid_id'),"; } if ($row1['other'] == 1 && $grid_id > 0) $srv_data_text .= "('$rowC[id]', '$row1[id]', '".$this->randomString()."', '', '$this->usr_id'),"; } else { $srv_data_vrednost .= "('$rowC[id]', '-2', '$this->usr_id'),"; } } } } // multitext elseif ($rowC['tip'] == 19) { $sql1 = sisplet_query("SELECT id, other FROM srv_vrednost WHERE spr_id = '$rowC[id]'"); while ($row1 = mysqli_fetch_array($sql1)) { $sql2 = sisplet_query("SELECT id FROM srv_grid WHERE spr_id = '$rowC[id]' ORDER BY vrstni_red"); while ($row2 = mysqli_fetch_array($sql2)) { if ($s->checkSpremenljivka($row['id'], $isTestData=true)) { // Ce imamo samo veljavne imamo vedno vrednost if($only_valid == 1) $value = $this->randomString(); else $value = rand(0,1)==0 ? $this->randomString() : ''; $grid_id = $row2['id']; if ($value != '') { $srv_data_textgrid .= "('$rowC[id]', '$row1[id]', '$this->usr_id', '$grid_id', '$value'),"; } // vsebino text polja vnesemo v vsakem primeru if ($row1['other'] == 1 && $value != '') $srv_data_text .= "('$rowC[id]', '$row1[id]', '".$this->randomString()."', '', '$this->usr_id'),"; } else { $srv_data_vrednost .= "('$rowC[id]', '-2', '$this->usr_id'),"; } } } } // multinumber elseif ($rowC['tip'] == 20) { $sql1 = sisplet_query("SELECT id, other FROM srv_vrednost WHERE spr_id = '$rowC[id]'"); while ($row1 = mysqli_fetch_array($sql1)) { $sql2 = sisplet_query("SELECT id FROM srv_grid WHERE spr_id = '$rowC[id]' ORDER BY vrstni_red"); while ($row2 = mysqli_fetch_array($sql2)) { if ($s->checkSpremenljivka($rowC['id'], $isTestData=true)) { // Ce imamo samo veljavne imamo vedno vrednost if($only_valid == 1) $value = $this->randomNumber(); else $value = rand(0,1)==0 ? $this->randomNumber() : ''; $grid_id = $row2['id']; if ($value != '') { $srv_data_textgrid .= "('$rowC[id]', '$row1[id]', '$this->usr_id', '$grid_id', '$value'),"; } // vsebino text polja vnesemo v vsakem primeru if ($row1['other'] == 1 && $value != '') $srv_data_text .= "('$rowC[id]', '$row1[id]', '".$this->randomString()."', '', '$this->usr_id'),"; } else { $srv_data_vrednost .= "('$rowC[id]', '-2', '$this->usr_id'),"; } } } } } } } // vprasanja shranjujemo sproti, zaradi IFov !!! // odrezemo zadnjo vejico, ker smo jo dodajali kar povsod $srv_data_grid = substr($srv_data_grid, 0, -1); $srv_data_vrednost = substr($srv_data_vrednost, 0, -1); $srv_data_text = substr($srv_data_text, 0, -1); $srv_data_checkgrid = substr($srv_data_checkgrid, 0, -1); $srv_data_textgrid = substr($srv_data_textgrid, 0, -1); $srv_data_rating = substr($srv_data_rating, 0, -1); $srv_data_map = substr($srv_data_map, 0, -1); $srv_data_heatmap = substr($srv_data_heatmap, 0, -1); if ($srv_data_grid != '') { $sq = sisplet_query("INSERT INTO srv_data_grid".$this->db_table." (spr_id, vre_id, usr_id, grd_id) VALUES $srv_data_grid"); if (!$sq) echo 'err011: '.mysqli_error($GLOBALS['connect_db']); } if ($srv_data_vrednost != '') { $sq = sisplet_query("INSERT INTO srv_data_vrednost".$this->db_table." (spr_id, vre_id, usr_id) VALUES $srv_data_vrednost"); if (!$sq) echo 'err012: '.mysqli_error($GLOBALS['connect_db']); } if ($srv_data_text != '') { $sq = sisplet_query("INSERT INTO srv_data_text".$this->db_table." (spr_id, vre_id, text, text2, usr_id) VALUES $srv_data_text"); if (!$sq) echo 'err013: '.mysqli_error($GLOBALS['connect_db']); } if ($srv_data_checkgrid != ''){ $sq = sisplet_query("INSERT INTO srv_data_checkgrid".$this->db_table." (spr_id, vre_id, usr_id, grd_id) VALUES $srv_data_checkgrid"); if (!$sq) echo 'err014: '.mysqli_error($GLOBALS['connect_db']); } if ($srv_data_textgrid != '') { $sq = sisplet_query("INSERT INTO srv_data_textgrid".$this->db_table." (spr_id, vre_id, usr_id, grd_id, text) VALUES $srv_data_textgrid"); if (!$sq) echo 'err015: '.mysqli_error($GLOBALS['connect_db']); } if ($srv_data_rating != '') { $sq = sisplet_query("INSERT INTO srv_data_rating (spr_id, vre_id, usr_id, vrstni_red) VALUES $srv_data_rating"); if (!$sq) echo 'err016: '.mysqli_error($GLOBALS['connect_db']); } if ($srv_data_map != '') { $sq = sisplet_query("INSERT INTO srv_data_map (usr_id, spr_id, vre_id, ank_id, lat, lng, address, text, vrstni_red) VALUES $srv_data_map"); if (!$sq) echo 'err016: '.mysqli_error($GLOBALS['connect_db']); } if ($srv_data_heatmap != '') { $sq = sisplet_query("INSERT INTO srv_data_heatmap (usr_id, spr_id, vre_id, ank_id, lat, lng, address, text, vrstni_red) VALUES $srv_data_heatmap"); if (!$sq) echo 'err017: '.mysqli_error($GLOBALS['connect_db']); } } $recnum++; } # zabeležimo kdaj so bili dodani testni vnosi if (count($arrayTestni)) { global $global_user_id; $ins_date = date ("Y-m-d H:m:s"); $insert_qry = "INSERT INTO srv_testdata_archive (ank_id, add_date, add_uid, usr_id) VALUES "; $prefix = ''; foreach ($arrayTestni AS $at_user_id) { $insert_qry .= $prefix."('".$this->anketa."', '$ins_date', '$global_user_id', '$at_user_id')"; $prefix = ', '; } sisplet_query($insert_qry); } if(session_id() == '') {session_start();} $_SESSION['progressBar'][$this->anketa]['status'] = 'end'; session_commit(); unset($_SESSION['progressBar'][$this->anketa]); // ce getCollectTimer ne prebere vec 'end' (se prehitro refresha), se tukaj odstranimo sejo header("Location: index.php?anketa=$this->anketa&a=testiranje&m=testnipodatki"); } elseif ((isset($_GET['delete_testdata']) && $_GET['delete_testdata'] == 1) || (isset($_GET['delete_autogen_testdata']) && $_GET['delete_autogen_testdata'] == 1)) { if(isset($_GET['delete_autogen_testdata']) && $_GET['delete_autogen_testdata'] == 1) sisplet_query("DELETE FROM srv_user WHERE ank_id='$this->anketa' AND testdata='2'"); else sisplet_query("DELETE FROM srv_user WHERE ank_id='$this->anketa' AND (testdata='1' OR testdata='2')"); #datoteki z podatki moramo zgenerirati na novo sisplet_query("UPDATE srv_data_files SET head_file_time='0000-00-00', data_file_time='0000-00-00' WHERE sid='$this->anketa'"); sisplet_query("COMMIT"); header("Location: ".$_SERVER['HTTP_REFERER']); // izpis podatkov } else { $sql = sisplet_query("SELECT COUNT(*) AS count FROM srv_user WHERE ank_id='$this->anketa' AND (testdata='1' OR testdata='2')"); $row = mysqli_fetch_array($sql); $total_rows = $row['count']; echo '
'; echo '
'.$lang['srv_testiranje_vnosi'].''; echo '

'.$lang['srv_testni_nagovor'].'

'; echo '
'; echo $lang['srv_stevilo_vnosov'].':'; echo '
'; echo ''; echo '(max. 1000)'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo '
'; echo ''; echo '

'.$lang['srv_testni_nakonec'].'

'; echo ''.$lang['srv_delete_testdata'].' ('.$total_rows.')'; if ($total_rows > 0) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
Labela Veljavni odgovori (Grafični prikaz)
'; $prevpage = 0; $sql = sisplet_query("SELECT s.id, s.gru_id, s.tip, s.naslov, g.naslov AS pagename FROM srv_spremenljivka s, srv_grupa g WHERE s.gru_id=g.id AND s.visible='1' AND g.ank_id='$this->anketa' ORDER BY g.vrstni_red, s.vrstni_red"); while ($row = mysqli_fetch_array($sql)) { // labela in compute ne upostevamo if ($row['tip'] != 5 && $row['tip'] != 22) { if ($prevpage == 0 || $row['gru_id'] != $prevpage) { if ($prevpage > 0) { echo ''; echo '
'; } echo '
'; echo ''.$row['pagename'].''; // echo ' - '; echo ''; $prevpage = $row['gru_id']; } echo ''; // radio ali select, checkbox, textbox, textbox*, number, datum if ( ($row['tip']==1 || $row['tip']==3 || $row['tip']==2 || $row['tip']==4 || $row['tip']==21 || $row['tip']==7 || $row['tip']==8) ) { $sqlc = sisplet_query("SELECT COUNT(*) AS count FROM srv_data_vrednost".$this->db_table." dv, srv_user u WHERE dv.usr_id=u.id AND (u.testdata='1' OR u.testdata='2') AND spr_id='$row[id]' AND vre_id='-2'"); $rowc = mysqli_fetch_array($sqlc); $p = round(($total_rows-$rowc['count'])/$total_rows*100,2); // multigrid } elseif ($row['tip'] == 6) { $sql1 = sisplet_query("SELECT id FROM srv_vrednost WHERE spr_id = '$row[id]'"); while ($row1 = mysqli_fetch_array($sql1)) { $sqlc = sisplet_query("SELECT COUNT(*) AS count FROM srv_data_grid".$this->db_table." dg, srv_user u WHERE dg.usr_id=u.id AND (u.testdata='1' OR u.testdata='2') AND spr_id='$row[id]' AND vre_id='$row1[id]' AND grd_id='-2'"); $rowc = mysqli_fetch_array($sqlc); $p = round(($total_rows-$rowc['count'])/$total_rows*100,2); } // multicheckbox } elseif ($row['tip'] == 16) { $sql1 = sisplet_query("SELECT id FROM srv_vrednost WHERE spr_id = '$row[id]'"); while ($row1 = mysqli_fetch_array($sql1)) { $sql2 = sisplet_query("SELECT id FROM srv_grid WHERE spr_id = '$row[id]' ORDER BY vrstni_red"); while ($row2 = mysqli_fetch_array($sql2)) { $sqlc = sisplet_query("SELECT COUNT(*) AS count FROM srv_data_checkgrid".$this->db_table." cg, srv_user u WHERE cg.usr_id=u.id AND (u.testdata='1' OR u.testdata='2') AND spr_id='$row[id]' AND vre_id='$row1[id]' AND grd_id='-2'"); $rowc = mysqli_fetch_array($sqlc); $p = round(($total_rows-$rowc['count'])/$total_rows*100,2); } } } // multitext, multinumber elseif ($row['tip'] == 19 || $row['tip'] == 20) { $sql1 = sisplet_query("SELECT id FROM srv_vrednost WHERE spr_id = '$row[id]'"); while ($row1 = mysqli_fetch_array($sql1)) { $sql2 = sisplet_query("SELECT id FROM srv_grid WHERE spr_id = '$row[id]' ORDER BY vrstni_red"); while ($row2 = mysqli_fetch_array($sql2)) { $sqlc = sisplet_query("SELECT COUNT(*) AS count FROM srv_data_textgrid".$this->db_table." tg, srv_user u WHERE tg.usr_id=u.id AND (u.testdata='1' OR u.testdata='2') AND spr_id='$row[id]' AND vre_id='$row1[id]' AND grd_id='0' AND text='-2'"); $rowc = mysqli_fetch_array($sqlc); $p = round(($total_rows-$rowc['count'])/$total_rows*100,2); } } } // ranking, vsota elseif ($row['tip'] == 17 || $row['tip'] == 18) { $sql1 = sisplet_query("SELECT id FROM srv_vrednost WHERE spr_id = '$row[id]' AND vrstni_red>0 ORDER BY vrstni_red"); while($row1 = mysqli_fetch_array($sql1)){ $sqlc = sisplet_query("SELECT COUNT(*) AS count FROM srv_data_text".$this->db_table." dt, srv_user u WHERE dt.usr_id=u.id AND (u.testdata='1' OR u.testdata='2') AND spr_id='$row[id]' AND vre_id='$row1[id]' AND text='-2'"); $rowc = mysqli_fetch_array($sqlc); $p = round(($total_rows-$rowc['count'])/$total_rows*100,2); } } echo ''; echo ''; } } echo '
'.skrajsaj(strip_tags($row['naslov']),50).''; echo '
'; echo '
'; echo ' '.$p.'% ('.($total_rows-$rowc['count']).')'; echo '
'; echo '
'; echo '
'; echo '
'; } } } /** * zgenerira random string za vpis v tekstovno polje * */ function randomString ($length = 10, $chars = 'abcdefghijklmnopqrstuvwxyz') { // Length of character list $chars_length = (strlen($chars) - 1); // Start our string $string = $chars[mt_rand(0, $chars_length)]; // Generate random string for ($i = 1; $i < $length; $i = strlen($string)) { // Grab a random character from our list $r = $chars[mt_rand(0, $chars_length)]; // Make sure the same two characters don't appear next to each other if ($r != $string[$i - 1]) $string .= $r; } // Return the string return $string; } function randomNumber ($length = 4, $chars = '0123456789') { return $this->randomString($length, $chars); } function randomDate ($startDate = '01.01.1950', $endDate = '') { if ($endDate == '') $endDate = date("d.m.Y"); $days = round((strtotime($endDate) - strtotime($startDate)) / (60 * 60 * 24)); $n = rand(0,$days); return date("d.m.Y",strtotime("$startDate + $n days")); } function displayBtnMailtoPreview($row) { global $lang; echo ''; } function DisplayNastavitveTrajanje() { global $lang; global $site_url; # vsilimo refresh podatkov SurveyInfo :: getInstance()->resetSurveyData(); $row = SurveyInfo::getInstance()->getSurveyRow(); $starts = date('d.m.Y',strtotime($row['starts'])); $_expire = explode('-',$row['expire']); $expire = $_expire[2].'.'.$_expire[1].'.'.$_expire[0]; // Preklop domene na oneclicksurvey.com - ne pustimo spremembe aktivnosti if(DomainChange::check1kaDomainChange() && DomainChange::getInstance($global_user_id)->domainChangeLimits()){ return; } echo '
'; echo ''.$lang['srv_activate_duration_2'].''; echo '
'; echo '' . $lang['srv_activate_duration_manual_from'].''; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo '' . $lang['srv_activate_duration_manual_to'].''; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ' '; } function DisplayNastavitveMaxGlasov() { global $lang; global $site_url; global $site_path; global $admin_type; global $global_user_id; $row = SurveyInfo::getInstance()->getSurveyRow(); //Nastavitev max stevila glasov echo '
'; echo ''.$lang['srv_vote_quotas'].' '.Help::display('srv_activity_quotas').''; echo '
'; echo '' . $lang['srv_vote_quotas_2'] . ':'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; // Opozorilo, da je limit odgovorov presezen echo '
'; echo '
'.$lang['srv_vote_quotas_all_warning'].'
'; echo '
'; // Opozorilo, da je limit odgovorov presezen echo '
'; echo '
'; echo ''.$lang['srv_vote_count'].':'; echo ''; echo '
'; echo '

'.$lang['srv_survey_voteLimit_warning'].':

'; $srv_survey_non_active_voteLimit = SurveySetting::getInstance()->getSurveyMiscSetting('srvlang_srv_survey_non_active_voteLimit'); if ($srv_survey_non_active_voteLimit == '') $srv_survey_non_active_voteLimit = $lang['srv_survey_non_active_voteLimit']; echo '

'.$srv_survey_non_active_voteLimit.'

'; echo '

'; echo '
'; } /** * Uporabnik (administrator, manager) lahko dodajata nove uporabnike in jim dodelita dostop */ public function dodeljeniUporabniki(){ global $admin_type; global $lang; global $global_user_id; // managerji in admini lahko dodajajo uporabnike, ki jih nato managirajo if( !($admin_type == 1 || $admin_type == 0) ) return ''; $error = isset($_GET['error']) ? $_GET['error'] : ''; // MANAGER lahko samo doda novega uporabnika pod sebe if($admin_type == 1){ echo '
'.$lang['n_users_list_add'].''; echo '
'; echo ' '.$lang['srv_users_add_new_type2'].''; echo '
'; // Na virtualkah imajo managerji omejitev st. dodeljenih uporabnikov - ZAENKRAT JE TO ONEMOGOCENO, KASNEJE SE LAHKO OMEJI NA PAKET /*if(false && isVirtual() && $admin_type == 1){ // Limit st. dodeljenih uporabnikov $managed_accounts_limit = 5; // Prestejemo dodeljene uporabnike $sql = sisplet_query("SELECT u.email FROM srv_dostop_manage m, users u WHERE m.manager='".$global_user_id."' AND u.id=m.user AND u.email NOT LIKE ('D3LMD-%') AND u.email NOT LIKE ('UNSU8MD-%') "); $managed_accounts_count = mysqli_num_rows($sql); echo '

'; echo $lang['srv_users_add_assigned_max_1'].' '.$managed_accounts_limit.' '.$lang['srv_users_add_assigned_max_2'].'

'; // Manager na virtualkah ima omejitev koliko uporabnikov lahko pregleduje if($managed_accounts_count >= $managed_accounts_limit){ echo '

'; echo $lang['srv_users_add_assigned_max_reached']; echo '

'; return; } elseif($managed_accounts_count > 0){ echo '

'; echo $lang['srv_users_add_assigned_current'].' '.$managed_accounts_count.' '.$lang['of'].' '.$managed_accounts_limit.'

'; } }*/ // Dodajanje novih uporabnikov pod pregled - ustvari racun, doda uporabnika pod pregled in mu poslje mail echo '
'; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '.(empty($_GET['add']) && $error=='email'?''.$lang['srv_added_false'].'':''); echo '
'; echo '
'; echo ' '; echo ' '.(empty($_GET['add']) && $error=='pass'?''.$lang['pass_doesnt_match'].'':''); echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo '
'; echo '
'; echo '
'; //new_user_option // Managerji lahko dodajajo samo uporabnike z dolocenimi emaili (če jim domeno posebej nastavi admin) // TODO: trenutno onemogočimo dodaja ostalih uporabnikov za managerje. Ko bo stvar vezana na domeno se jim bo omogočilo dodajanje samo domenskih /*elseif(false && $admin_type == 1){ UserSetting :: getInstance()->Init($global_user_id); $emails = UserSetting :: getInstance()->getUserSetting('manage_domain'); echo '
'; echo '

'.sprintf($lang['srv_manager_add_user3'], $emails).'
'.$lang['srv_manager_add_user4'].'

'; echo '

'; echo '

'; echo '
'; }*/ echo '
'; } // ADMIN lahko tudi doda uporabnika brez pregleda in doda obstojecega pod pregled else{ echo '
'.$lang['n_users_list_add'].''; echo '
'; echo ''.$lang['srv_users_add_new_type'].''; // Dodajanje novega uporabnika v sistem echo '
'; echo ' '; echo ' '; echo '
'; // Dodajanje novega uporabnika v sistem in pod svoj pregled echo '
'; echo ' '; echo ' '; echo '
'; // Dodajanje obstoječega uporabnika pod pregled echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; // Dodajanje novih uporabnikov - ustvari racun in mu poslje mail echo '
'; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '.(empty($_GET['add']) && $error=='email'?''.$lang['srv_added_false'].'':''); echo '
'; echo '
'; echo ' '; echo ' '.(empty($_GET['add']) && $error=='pass'?''.$lang['pass_doesnt_match'].'':''); echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo ' '; echo ' '; echo '
'; echo '
'; echo ' '; echo '
'; echo '
'; echo '
'; // Dodajanje novih uporabnikov pod pregled - ustvari racun, doda uporabnika pod pregled in mu poslje mail echo '
'; echo '
'; echo '
'; echo '
'; echo ''.$lang['name'].':'; echo ''; echo '
'; echo '
'; echo ''.$lang['surname'].':'; echo ''; echo '
'; echo '
'; echo '
'; echo '

'.$lang['email'].':

'; echo ' '.(empty($_GET['add']) && $error=='email'?''.$lang['srv_added_false'].'':''); echo '
'; echo '
'; echo '
'; echo '

'.$lang['password'].':

'; echo ' '.(empty($_GET['add']) && $error=='pass'?''.$lang['pass_doesnt_match'].'':''); echo '
'; echo '
'; echo '

'.$lang['password_confirm'].':

'; echo ''; echo '
'; echo '
'; echo '
'; echo ' '; echo '
'; echo '
'; echo '
'; // Dodajanje obstojecih uporabnikov pod pregled echo '
'; echo '
'; echo '
'; echo '

'.$lang['srv_manager_add_user_label'].':

'; echo ' '; echo '
'; echo '
'; echo ' '; echo '
'; echo '
'; echo '
'; echo '
'; } } /** * Seznam vseh uporabnikov znotraj 1ke */ public function allUsersList(){ global $lang; global $admin_type; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'.$lang['edit2'].'' . $lang['srv_survey_list_users_name'] . '' . $lang['srv_survey_list_users_email'] . '' . $lang['admin_type'] . '' . $lang['lang'] . '' . $lang['srv_survey_list_users_aai'] . '' . $lang['srv_survey_list_users_survey_count'] . '' . $lang['srv_survey_list_users_survey_archive_count'] . '' . $lang['srv_manager_count'] . '' . $lang['srv_manager_count_manager'] . '' . $lang['users_gdpr_title'] . '' . $lang['srv_survey_list_users_registred'] . '' . $lang['srv_survey_list_users_last_login'] . '
'; } /** * Osnovni pregled uporabnikov za managerje in admine */ public function assignedUsersList(){ global $lang; global $admin_type; global $global_user_id; $sqlU = sisplet_query("SELECT name, surname, email FROM users WHERE id='".$global_user_id."'"); $rowU = mysqli_fetch_array($sqlU); //echo "Ime: ".$rowU['name']; // PREGLED NAD UPORABNIKI - TABELA echo '
'; // Naslov /*echo '

'; if($admin_type == 0) echo $lang['administrator']; elseif($admin_type == 1) echo $lang['manager']; else echo $lang['user']; echo ': '.$rowU['name'].' '.$rowU['surname'].' ('.$rowU['email'].')'; echo ' '; echo '

'; */ echo '

'.$lang['srv_users_assigned_title'].'

'; // Tabela echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'.$lang['edit2'].'' . $lang['srv_survey_list_users_name'] . '' . $lang['srv_survey_list_users_email'] . '' . $lang['admin_type'] . '' . $lang['lang'] . '' . $lang['srv_survey_list_users_aai'] . '' . $lang['srv_survey_list_users_survey_count'] . '' . $lang['srv_survey_list_users_survey_archive_count'] . '' . $lang['users_gdpr_title'] . '' . $lang['srv_survey_list_users_registred'] . '' . $lang['srv_survey_list_users_last_login'] . '
'; echo '
'; } /** * Seznam vseh izbrisanih uporabnikov znotraj 1ke */ public function deletedUsersList(){ global $lang; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'.$lang['srv_survey_list_users_name'].''.$lang['srv_survey_list_users_email'].''.$lang['admin_type'].''.$lang['lang'].''.$lang['registered'].'
'; } /** * Seznam vseh odjavljenih uporabnikov * V bazi vsi uporabniki, ki so odjavljeni samo pridobijo status 0 */ public function unsignedUsersList(){ global $lang; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'.$lang['srv_survey_list_users_name'].''.$lang['srv_survey_list_users_email'].''.$lang['admin_type'].''.$lang['lang'].''.$lang['registered'].'
'; } /** * Seznam vseh uporabnikov, ki so prejeli email in ga niso potrdili */ public function unconfirmedMailUsersList(){ global $lang; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'.$lang['edit2'].''.$lang['srv_survey_list_users_name'].''.$lang['srv_survey_list_users_email'].''.$lang['admin_type'].''.$lang['lang'].''.$lang['registered'].'
'; } /** * Seznam uporabnikov, ki imajo dostop do SA modula */ public function SAuserListIndex(){ global $lang, $global_user_id, $admin_type; if($admin_type > 0) return false; $sql_uporabniki = sisplet_query("SELECT id, u.name, u.surname, u.email, d.ustanova, d.aai_email, DATE_FORMAT(d.created_at, '%d.%m.%Y - %H:%i') AS created_at, d.updated_at FROM srv_hierarhija_dostop AS d LEFT JOIN users AS u ON u.id=d.user_id ORDER BY u.name", "obj"); echo 'Dodaj uporabniku SA dostop

'; if(empty($sql_uporabniki)){ echo $lang['srv_hierarchy_users_access_no_data']; return false; } if(!empty($sql_uporabniki->name)) { $uporabniki[0] = $sql_uporabniki; }else{ $uporabniki = $sql_uporabniki; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach($uporabniki as $uporabnik) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
'.$lang['srv_hierarchy_users_name'].''.$lang['srv_hierarchy_users_email'].''.$lang['srv_hierarchy_users_organization'].''.$lang['srv_hierarchy_users_created'].'
'.$uporabnik->name .' '. $uporabnik->surname.''.$uporabnik->email.''.$uporabnik->ustanova .''.$uporabnik->created_at.''; echo ''; echo '
'; } // Prikaz naprednih modulov - NOVO (v urejanje->nastavitve) function showAdvancedModules(){ global $lang, $site_url, $global_user_id, $admin_type; # preberemo osnovne nastavitve $row = SurveyInfo::getInstance()->getSurveyRow(); # preberemo vklopljene module $modules = SurveyInfo::getSurveyModules(); $disabled = ''; $css_disabled = ''; if (isset($modules['slideshow'])){ $disabled = ' disabled="disabled"'; $css_disabled = ' gray'; } if ($_GET['a'] == 'uporabnost'){ echo '
'.$lang['srv_uporabnost'].Help::display('srv_evalvacija_strani').''; echo '

'.$lang['srv_vrsta_survey_note_4_3'].'

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; if(isset($modules['uporabnost'])){ $this->uporabnost(); } echo '
'; } elseif (($_GET['a'] == A_HIERARHIJA_SUPERADMIN) && Hierarhija\HierarhijaHelper::preveriDostop($this->anketa)){ // Blok za vklop in izklop hierarhije skrijemo, če je hierarhija aktivna if(!SurveyInfo::getInstance()->checkSurveyModule('hierarhija')) { echo '
' . $lang['srv_hierarchy'] . ''; echo '' . $lang['srv_hierarchy_description'] . ''; echo ''; echo '
'; echo '

'.$lang['srv_hierarchy_intro_select_title'].':

'; echo '
'; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo 'Vklopi modul '; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; }else { $hierarhija = new \Hierarhija\Hierarhija($this->anketa); echo '
'; echo '
'; $hierarhija->displayHierarhijaNavigationSuperAdmin(); echo '
'; echo '
'; if($_GET['m'] == M_ADMIN_UREDI_SIFRANTE){ $hierarhija->hierarhijaSuperadminSifranti(); }elseif($_GET['m'] == M_ADMIN_UVOZ_SIFRANTOV){ $hierarhija->hierarhijaSuperadminUvoz(); }elseif($_GET['m'] == M_ADMIN_UPLOAD_LOGO){ $hierarhija->hierarhijaSuperadminUploadLogo(); }elseif($_GET['m'] == M_ADMIN_IZVOZ_SIFRANTOV){ $hierarhija->izvozSifrantov(); }elseif($_GET['m'] == M_ANALIZE){ if($_GET['r'] == 'custom'){ $HC = new \Hierarhija\HierarhijaPorocilaClass($this->anketa); $HC->izvoz(); }else { $HA = new HierarhijaAnalysis($this->anketa); $HA->Display(); } }elseif($_GET['m'] == M_HIERARHIJA_STATUS){ if($_GET['izvoz'] == 'status'){ // Izvoz tabele status \Hierarhija\HierarhijaIzvoz::getInstance($this->anketa)->csvIzvozStatusa(); }else { $hierarhija->statistikaHierjearhije(); } }elseif($_GET['m'] == M_ADMIN_AKTIVACIJA){ $hierarhija->aktivacijaHierarhijeInAnkete(); }elseif($_GET['m'] == M_ADMIN_KOPIRANJE){ $hierarhija->kopiranjeHierarhijeInAnkete(); }elseif($_GET['m'] == M_UREDI_UPORABNIKE && $_GET['izvoz'] == 1) { // za vse ostalo je ure uredi uporabnike - M_UREDI_UPORABNIKE \Hierarhija\HierarhijaIzvoz::getInstance($this->anketa)->csvIzvozVsehUporabnikov(); }elseif($_GET['m'] == M_UREDI_UPORABNIKE && $_GET['izvoz'] == 'struktura-analiz') { // za vse ostalo je uredi uporabnike - M_UREDI_UPORABNIKE if(!empty($_GET['n']) && $_GET['n'] == 1){ \Hierarhija\HierarhijaIzvoz::getInstance($this->anketa)->csvIzvozStruktureZaObdelavo(false, true); }else { \Hierarhija\HierarhijaIzvoz::getInstance($this->anketa)->csvIzvozStruktureZaObdelavo(); } }else{ $hierarhija->izberiDodajanjeUporabnikovNaHierarhijo(); } echo '
'; echo '
'; } } elseif ($_GET['a'] == 'kviz'){ echo '
'.$lang['srv_kviz'].''; echo '

'.$lang['srv_vrsta_survey_note_6_4'].'

'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo '
'; if(isset($modules['quiz'])){ $sq = new SurveyQuiz($this->anketa); $sq->displaySettings(); } echo '
'; } elseif ($_GET['a'] == 'voting'){ // Ce so vabila ze vklopljena ne pustimo vklopa if(isset($modules['voting']) || (!isset($modules['voting']) && SurveyInfo::getInstance()->checkSurveyModule('email'))){ $disabled = ' disabled="disabled"'; $css_disabled = ' gray'; } echo '
'.$lang['srv_voting'].''; echo '

'.$lang['srv_voting_info'].'

'; echo '

'.$lang['srv_voting_info_link'].'

'; echo '

'.$lang['srv_voting_info_warning'].'

'; // Opozorilo, da so vabila ze vklopljena in zato modula ni mogoce vklopiti if(!isset($modules['voting']) && SurveyInfo::getInstance()->checkSurveyModule('email')){ echo '

'.$lang['srv_voting_info_error'].'

'; } echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo '
'; if(isset($modules['voting'])){ $sv = new SurveyVoting($this->anketa); $sv->displaySettings(); } echo '
'; } elseif ($_GET['a'] == 'advanced_paradata'){ echo '
'.$lang['srv_advanced_paradata'].''; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo '
'; if(isset($modules['advanced_paradata'])){ $sap = new SurveyAdvancedParadata($this->anketa); $sap->displaySettings(); } echo '
'; } elseif ($_GET['a'] == 'advanced_timestamps'){ echo '
'.$lang['srv_advanced_timestamps'].''; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo '
'; if(isset($modules['advanced_timestamps'])){ $sat = new SurveyAdvancedTimestamps($this->anketa); $sat->displaySettings(); } echo '
'; } elseif ($_GET['a'] == 'json_survey_export'){ echo '
'.$lang['srv_json_survey_export'].''; echo ''; echo '
'; echo '
'; echo '
'; if(isset($modules['srv_json_survey_export'])){ $sjs = new SurveyJsonSurveyData($this->anketa); $sjs->displaySettings(); } echo '
'; } elseif ($_GET['a'] == 'slideshow'){ echo '
'.$lang['srv_slideshow_fieldset_label'].''; echo ''; echo '
'.$lang['srv_vrsta_survey_note_9_2'].''; echo '
'; echo '
'; echo '
'; if(isset($modules['slideshow'])){ $ss = new SurveySlideshow($this->anketa); $ss->ShowSlideshowSetings(); } echo '
'; } elseif ($_GET['a'] == 'vnos') { echo '
'.$lang['srv_vnos'].''; echo ''; echo '
'.$lang['srv_vrsta_survey_note_5_3'].''; echo '
'; echo '
'; echo '
'; if($row['user_from_cms'] == 2 && $row['cookie'] == -1){ $this->vnos(); } echo '
'; } elseif ($_GET['a'] == A_TELEPHONE){ echo '
'; if(isset($modules['phone'])){ $ST = new SurveyTelephone($this->anketa); $ST->action($_GET['m']); } echo '
'; $hide_tel_fieldset = ''; if ($_GET['m'] == 'recipients_lists') { $hide_tel_fieldset = 'displayNone'; } // Ce je anketar ne vidi teh nastavitev $isAnketar = Common::isUserAnketar($this->anketa, $global_user_id); if(!$isAnketar){ if(isset($modules['phone'])){ $sqlT = sisplet_query("SELECT count(*) AS cnt FROM srv_invitations_recipients WHERE ank_id='$this->anketa' AND deleted='0' AND phone!=''"); $rowT = mysqli_fetch_array($sqlT); // Ce se nimamo nobene stevilke v bazi, pustimo da se lahko ugasne if($rowT['cnt'] == 0){ echo '
'.$lang['srv_vrsta_survey_type_7'].' '.Help::display('srv_telephone_help').''; echo '
'; echo ''; echo ''; echo '
'; echo '

'.$lang['srv_vrsta_survey_note_7_3'].'

'; echo '
'; } /*else{ echo ''.$lang['srv_vrsta_survey_type_7'].' '.Help::display('srv_telephone_help'); echo '
'; }*/ } else{ echo '
'.$lang['srv_vrsta_survey_type_7'].' '.Help::display('srv_telephone_help').''; echo '
'; echo ''; echo ''; echo '
'; echo '

'.$lang['srv_vrsta_survey_note_7_3'].'

'; echo '
'; } } } elseif ($_GET['a'] == A_CHAT){ global $site_path; echo '
'.$lang['srv_vrsta_survey_type_14'].''; echo '

'.$lang['srv_vrsta_survey_note_14_1'].'

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; if(isset($modules['chat'])){ $sc = new SurveyChat($this->anketa); $sc->displaySettings(); } echo '
'; } elseif ($_GET['a'] == A_PANEL){ global $site_path; echo '
'.$lang['srv_vrsta_survey_type_15'].''; echo '

'.$lang['srv_vrsta_survey_note_15_1'].'

'; echo '

'.$lang['srv_vrsta_survey_note_15_1a'].'

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; if(isset($modules['panel'])){ $sp = new SurveyPanel($this->anketa); $sp->displaySettings(); } echo '
'; } elseif ($_GET['a'] == A_EMAIL_ACCESS){ global $site_path; echo '
'.$lang['srv_vrsta_survey_type_19'].''; echo '

'.$lang['srv_vrsta_survey_note_19_1'].'

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; if(isset($modules['email_access'])){ $sea = new SurveyEmailAccess($this->anketa); $sea->displaySettings(); } echo '
'; } elseif ($_GET['a'] == A_FIELDWORK){ global $site_path; // tole bom dopolnil po potrebi // // Ce je anketar ne vidi teh nastavitev $isAnketar = Common::isUserAnketar($this->anketa, $global_user_id); if(!$isAnketar){ // tole bom dopo } echo '
'; $ST = new SurveyFieldwork($this->anketa); $ST->action($_GET['m']); echo '
'; } elseif ($_GET['a'] == A_MAZA){ global $site_path; echo '
'.$lang['srv_maza'].''; echo ''; echo '
'.$lang['srv_maza_note'].''; echo '
'; echo '
'; echo '
'; if(isset($modules['maza'])){ $MS = new MAZA($this->anketa); $MS ->display(); } echo '
'; } elseif ($_GET['a'] == A_WPN){ global $site_path; echo '
'.$lang['srv_wpn'].''; echo ''; echo '
'.$lang['srv_wpn_note'].''; echo '
'; echo '
'; echo '
'; if(isset($modules['wpn'])){ $MS = new WPN($this->anketa); $MS ->display(); } echo '
'; } elseif ($_GET['a'] == 'social_network'){ if ($_GET['m'] == 'respondenti' || $_GET['m'] == "") { echo '
'.$lang['srv_vrsta_survey_type_8'].''; echo '

'.$lang['srv_vrsta_survey_note_8_3'].'

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; if(isset($modules['social_network'])){ $this->SN_Settings(); } echo '
'; echo '
'; } } elseif ($_GET['a'] == A_360){ echo '
'.$lang['srv_vrsta_survey_type_11'].''; echo ''; echo '
'.$lang['srv_vrsta_survey_note_11_1'].''; echo '
'; echo '
'; echo '
'; // urejanje respondentov if(isset($modules['360_stopinj'])){ $S360 = new Survey360($this->anketa); $S360->displaySettings(); } echo '
'; } elseif ($_GET['a'] == A_360_1KA){ echo '
'.$lang['srv_vrsta_survey_type_12'].''; echo ''; echo '
'.$lang['srv_vrsta_survey_note_12_1'].''; echo '
'; echo '
'; echo '
'; // urejanje respondentov if(isset($modules['360_stopinj_1ka'])){ $S360 = new Survey3601ka($this->anketa); $S360->displaySettings(); } echo '
'; } elseif ($_GET['a'] == 'evoli'){ echo '
Evoli'; echo '

Napredna poročila Evoli

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; } elseif ($_GET['a'] == 'evoli_teammeter'){ echo '
Evoli team meter'; echo '

Napredna poročila Evoli team meter

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; // urejanje respondentov if(isset($modules['evoli_teammeter'])){ $evoliTM = new SurveyTeamMeter($this->anketa); $evoliTM->displaySettings(); } echo '
'; } elseif ($_GET['a'] == 'evoli_quality_climate'){ echo '
Evoli quality climate'; echo '

Napredna poročila Evoli quality climate

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; // urejanje respondentov if(isset($modules['evoli_quality_climate'])){ $evoliTM = new SurveyTeamMeter($this->anketa); $evoliTM->displaySettings(); } echo '
'; } elseif ($_GET['a'] == 'evoli_teamship_meter'){ echo '
Evoli teamship meter'; echo '

Napredna poročila Evoli teamship meter

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; // urejanje respondentov if(isset($modules['evoli_teamship_meter'])){ $evoliTM = new SurveyTeamMeter($this->anketa); $evoliTM->displaySettings(); } echo '
'; } elseif ($_GET['a'] == 'evoli_organizational_employeeship_meter'){ echo '
Evoli organizational employeeship meter'; echo '

Napredna poročila Evoli organizational employeeship meter

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; // urejanje respondentov if(isset($modules['evoli_organizational_employeeship_meter'])){ $evoliTM = new SurveyTeamMeter($this->anketa); $evoliTM->displaySettings(); } echo '
'; } elseif ($_GET['a'] == 'evoli_employmeter'){ echo '
Evoli employ meter'; echo '

Napredna poročila Evoli employeeship meter

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; } elseif ($_GET['a'] == 'mfdps'){ echo '
MFDPŠ'; echo '

Napredni izvozi MFDPŠ

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; } elseif ($_GET['a'] == 'borza'){ echo '
Borza'; echo '

Napredni izvozi Borza

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; } elseif ($_GET['a'] == 'mju'){ echo '
MJU'; echo '

Napredni izvozi MJU

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; if(isset($modules['mju'])){ $sme = new SurveyMJUEnote($this->anketa); $sme->displaySettings(); } echo '
'; } elseif ($_GET['a'] == 'excell_matrix'){ echo '
Excelleration matrix'; echo '

'.$lang['srv_vrsta_survey_note_16_1'].'

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; } } function formatNumber ($value, $digit = 0, $form=null) { # Kako izpisujemo decimalke in tisočice $default_seperators = array( 0=>array('decimal_point'=>'.', 'thousands'=>','), 1=>array('decimal_point'=>',', 'thousands'=>'.')); if (is_array($form) && isset($form['decimal_point'])&& isset($form['thousands'])) { $decimal_point = $form['decimal_point']; $thousands = $form['thousands']; } else { $decimal_point = $default_seperators['decimal_point']; $thousands = $default_seperators['thousands']; } if ($value <> 0 && $value != null) $result = round($value, $digit); else $result = "0"; $result = number_format($result, $digit, $decimal_point, $thousands); return $result; } function globalUserSettings () { global $lang, $global_user_id, $admin_type, $site_url; $preklici_url = ltrim(str_replace("&s=1","",$_SERVER['REQUEST_URI']),"/"); $preklici_url = "'". $site_url . $preklici_url . "'"; # polovimo nastavitve uporabnika UserSetting::getInstance()->Init($global_user_id); # ali zaklepamo anketo ob aktivaciji $lockSurvey = UserSetting::getInstance()->getUserSetting('lockSurvey'); # ali je anketa aktivna ob aktivaciji $autoActiveSurvey = UserSetting::getInstance()->getUserSetting('autoActiveSurvey'); # ali imamo star napreden vmesnik za moje ankete $advancedMySurveys = UserSetting::getInstance()->getUserSetting('advancedMySurveys'); # ali imamo gumb za enklik kreiranje ankete $oneclickCreateMySurveys = UserSetting::getInstance()->getUserSetting('oneclickCreateMySurveys'); # ali so komentarji aktivirani ob kreaciji ankete $activeComments = UserSetting::getInstance()->getUserSetting('activeComments'); # uvod ob aktivaciji $showIntro = UserSetting::getInstance()->getUserSetting('showIntro'); # zakljucek ob aktivaciji $showConcl = UserSetting::getInstance()->getUserSetting('showConcl'); # ime za respondente ob aktivaciji $showSurveyTitle = UserSetting::getInstance()->getUserSetting('showSurveyTitle'); # Prikaži bližnico za jezik v statusni vrstici $showLanguageShortcut = UserSetting::getInstance()->getUserSetting('showLanguageShortcut'); echo '
'; echo '
' . "\n\r"; //echo ' ' . "\n\r"; //echo ' ' . "\n\r"; echo ' ' . "\n\r"; echo ' ' . "\n\r"; echo '
'.$lang['srv_interface_settings'].''; // Jezik vmesnika $sql = sisplet_query("SELECT lang FROM users WHERE id = '$global_user_id'"); $row = mysqli_fetch_array($sql); $lang_admin = $row['lang']; echo '
'; echo ''; echo '
'; echo '
'; echo ''.$lang['srv_settings_interfaceshow'] . ':'; // Prikaži ikono za jezik v navigacijski vrstici ankete, desno zgoraj - TE NASTAVITVE NE UPOSTEVAMO VEC /*echo '
'; echo ''; echo ''; echo ''; echo '
';*/ // Opcija enklik ustvarjanja ankete (v mojih anketah) echo '
'; echo ''; echo ''; echo ''; echo '
'; // Možnost prikaza SA ikone pri vseh anketah if($admin_type < 3) { $showSAicon = UserSetting::getInstance()->getUserSetting('showSAicon'); echo '
'; echo ''; echo ''; echo ''; echo '
'; } echo '
'; echo '
'; echo '
'.$lang['srv_survey_settings'].''; echo '
'; echo ''.$lang['srv_settings_oncreation'] . ':'; // Aktivna anketa ob aktivaciji - TO PUSTIMO SAMO ADMINOM ZARADI GDPR OPOZORILA OB AKTIVACIJI if($admin_type == '0'){ echo '
'; echo ''; echo ''; echo ''; echo '
'; } // Komentarji aktivirani ob kreaciji ankete echo '
'; echo ''; echo ''; echo ''; echo '
'; // Uvod ob aktivaciji prikazan echo '
'; echo ''; echo ''; echo ''; echo '
'; // Zakljucek ob aktivaciji prikazan echo '
'; echo ''; echo ''; echo ''; echo '
'; // Ime ob aktivaciji prikazano za respondente echo '
'; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo ''.$lang['srv_settings_onactivation'] . ':'; // Zaklep urejanja ob aktivaciji echo '
'; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo '
'; // save gumb echo '
'; echo ''; echo ''; echo '
'; // div za prikaz uspešnosti shranjevanja if (isset($_GET['s']) && $_GET['s'] == '1') { echo '
'; echo ''; } // API avtentikacija echo '
'.$lang['srv_api'].Help::display('srv_nastavitve_API').''; echo '

'.$lang['srv_api_auth'].':

'; echo '
'; echo ''; echo '
'; echo $lang['additional_info_api']; echo '
'; // Izvoz vseh anket v paket echo '
'.$lang['srv_archive_surveys'].Help::display('archive_surveys').''; echo '

'.$lang['srv_archive_surveys_text1'].'

'; echo '

'.$lang['srv_archive_surveys_text2'].'

'; echo '

'.$lang['srv_archive_surveys_text3'].'

'; echo '
'; echo ' '; echo ' '; echo '
'; echo '
'; echo '
'; } function globalUserMyProfile () { global $lang, $global_user_id, $admin_type, $site_domain, $site_url; $preklici_url = ltrim(str_replace("&s=1","",$_SERVER['REQUEST_URI']),"/"); $preklici_url = "'". $site_url . $preklici_url . "'"; // podatki prijavljenega uporabnika $sql = sisplet_query("SELECT id, name, surname, email, type, gdpr_agree, last_login FROM users WHERE id = '$global_user_id'"); $row = mysqli_fetch_array($sql); echo '
'; echo '
' . "\n\r"; echo ' ' . "\n\r"; echo ' ' . "\n\r"; echo '
'.$lang['edit_data'].''; //Prijavljeni kot, status, zadnja prijava, aktivni paket echo '
'; if($row['type'] == '0') $type = $lang['admin_admin']; elseif($row['type'] == '1') $type = $lang['admin_manager']; else $type = $lang['admin_narocnik']; echo ''; echo '
'; } else{ $rowA = mysqli_fetch_array($sqlA); $userAccess = UserAccess::getInstance($global_user_id); $package_name = $userAccess->getPackageName($rowA['package_id']); // Ce ima paket 2 ali 3 if($rowA['package_id'] == '2' || $rowA['package_id'] == '3'){ // Ce je paket ze potekel if(strtotime($rowA['time_expire']) < time()){ $package_string = ''; $package_string .= $package_name; $package_string .= ' ('.$lang['srv_access_package_expire'].' '.date("d.m.Y", strtotime($rowA['time_expire'])).')'; $package_string .= ''; $package_string .= '
'; } else{ $package_string = $package_name; $package_string .= ' ('.$lang['srv_access_package_valid'].' '.date("d.m.Y", strtotime($rowA['time_expire'])).')'; $package_string .= '
'; } } else{ $package_string = $package_name; $package_string .= ' ('.$lang['srv_access_package_free'].')'; $package_string .= '
'; } } echo '
'.$package_string.'
'; } echo '
'; echo '
'; // AAI nima moznosti spreminjanja imena, priimka, emaila, gesla... if(isAAI()){ echo ''.$lang['srv_profil_aai_warning'].''; } else{ echo '

'.$lang['srv_profil_settings_text'].'

'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; $alternativni_emaili = User::getInstance()->allEmails('brez primarnega'); echo '
'; echo ''; echo '
'; echo ''; if(!empty($alternativni_emaili)) echo 'primaryEmail() == $row['email'] ? 'checked="checked"' : '').'>'; echo '
'; echo '
'; //Alternativni maili if(!empty($alternativni_emaili)){ foreach($alternativni_emaili as $email) { echo '
'; echo ''; echo '
'; echo ''; echo '
'; echo 'active == 1 ? 'checked="checked"' : '').'> '; echo '
'; echo '
'; } } echo '
'; echo '
'.$lang['srv_profil_settings_addemail'].'
'; echo '
'; echo ''; // Ce je vklopljen modul gorenje, preverimo ce ima se default geslo in izpisemo opozorilo if (Common::checkModule('gorenje')){ if(SurveyGorenje::checkGorenjePassword()) echo '

'.$lang['gorenje_password_warning'].'

'; } // Geslo echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; // Prejemanje obvestil echo '
'; echo ''.$lang['srv_gdpr_user_options'].' '.Help::display('srv_gdpr_user_options').''; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; // Google 2 FA $user_option = User::option($global_user_id, 'google-2fa-secret'); $user_option_validate = User::option($global_user_id, 'google-2fa-validation'); echo '
'; echo ''; echo ''; echo '
'; if (empty($user_option)) { $google2fa = new \Sonata\GoogleAuthenticator\GoogleAuthenticator(); $googleSecret = $google2fa->generateSecret(); $googleLink = \Sonata\GoogleAuthenticator\GoogleQrUrl::generate($row['email'], $googleSecret, $site_domain); //Prikaži QR kodo echo ''; } elseif (! empty($user_option) && $user_option_validate == 'NOT') { echo '
'; echo '
'.$lang['google_2fa_admin_validate'].'
'; echo '
'; echo '
'; echo ' '; echo ' '; echo '
'; echo ''; echo '
'; } else { echo ''; } echo '
'; echo ' '; echo '
'; } echo '
'; // Save gumb - ce ni AAI if(!isAAI()){ echo '
'; echo ' '; echo ' '; echo '
'; // div za prikaz uspešnosti shranjevanja if (isset($_GET['s']) && $_GET['s'] == '1') { echo '
'; echo ''; } } echo '
'; echo '
'; } function globalUserChangeArchive () { global $lang, $global_user_id, $admin_type, $site_domain, $site_url; // podatki prijavljenega uporabnika $sql = sisplet_query("SELECT id, name, surname, email, type, gdpr_agree, last_login FROM users WHERE id = '$global_user_id'"); $row = mysqli_fetch_array($sql); echo '
'; echo '
' . "\n\r"; echo ' ' . "\n\r"; echo ' ' . "\n\r"; // Tabela aktivnosti (prijav) echo '
'.$lang['srv_login_tracking_title'].''; echo '
'; echo '
'; echo ''; echo ''; $result = sisplet_query ("SELECT IP, kdaj FROM user_login_tracker WHERE uid='".$global_user_id."' ORDER BY kdaj desc"); if (mysqli_num_rows($result) == 0) { echo $lang['srv_login_tracking_noData']; } else { $count = 0; while ($row = mysqli_fetch_array ($result)) { echo '= 5 ? ' class="displayNone"' : '').($count == 4 ? ' class="show_as_last_row"' : '').'>'; echo ''; echo ''; echo ''; $count++; } } echo ''; echo '
'; echo '
'; //Gumb za izpis vseh prijav v tabeli - update v 2. fazi @TG /**if(mysqli_num_rows($result) > 25){ echo ''; }**/ echo '
'; UserTrackingClass::init()->userTrackingDisplay(); echo '
'; } function setGlobalUserSetting() { global $lang, $global_user_id; # polovimo nastavitve uporabnika UserSetting::getInstance()->Init($global_user_id); if (isset($_REQUEST['name']) && isset($_REQUEST['value'])) { $name = $_REQUEST['name']; $value = $_REQUEST['value']; UserSetting::getInstance()->setUserSetting($name, $value); UserSetting::getInstance()->saveUserSetting(); } else {echo 'napaka';} } function showLockSurvey() { global $lang, $global_user_id, $admin_type; UserSetting::getInstance()->Init($global_user_id); # ali zaklepamo anketo ob aktivaciji $lockSurvey = (int)UserSetting::getInstance()->getUserSetting('lockSurvey'); if ($admin_type == '0' || $admin_type == '1') { echo '
'; echo ' '; echo ' '; echo '
'; } if ((int)$lockSurvey > 0) { echo '

'.$lang['srv_unlock_popup'].'

'; } } function ajax_showTestSurveySMTP(){ ob_start(); global $lang, $global_user_id; global $admin_type; $error = false; $msg = null; $email_msg = $lang['srv_mail_test_smtp_test_success']; $email_subject = $lang['srv_mail_test_smtp_test']; $mailMode = $_REQUEST['SMTPMailMode']; $MA = new MailAdapter($this->anketa); $settings = $MA->getSettingsFromRequest($_REQUEST); $SmailMode = $mailMode === 1 ? 'google' : 'smtp'; $settings_saved = $MA->getSettings($SmailMode); if ($mailMode == 1 || $mailMode == 2){ $email = $settings['SMTPFrom']; } else if (isset ($_COOKIE['uid'])) { $email = base64_decode ($_COOKIE['uid']); } else { $error = true; $msg = $lang['srv_mail_test_smtp_mail_detect_error']; } $settings['SMTPPassword'] = empty($_REQUEST['SMTPPassword']) ? $settings_saved['SMTPPassword'] : $_REQUEST['SMTPPassword']; if (validEmail($email)){ // preverimo password - ne sme bit prazen if (($mailMode == 1 || $mailMode == 2) && empty($settings['SMTPPassword'])){ # password $error = true; $msg = $lang['srv_mail_test_smtp_password_error']; } } else { $error = true; $msg = $lang['srv_mail_test_smtp_mail_detect_error']; } // preverjanje je ok.. poizkusimo poslat testni email if ($error == false){ $MA->addRecipients($email); $result = $MA->sendMailTest($email_msg, $email_subject, $mailMode, $settings); if ($result == false){ $error = true; $msg = $lang['srv_mail_test_smtp_not_possible']; } } echo '
'; echo '

'.$lang['srv_mail_test_smtp'].'

'; echo ''; // če imamo napake jo izpišemo if ($error == true){ echo $lang['srv_mail_test_smtp_error'].': '. $msg; } else{ echo $lang['srv_mail_test_smtp_sent'].': '.$email; } #vsebino shranimo v buffer $content = ob_get_clean(); echo $content; echo '
'; echo ''; echo '
'; echo '
'; } } ?>