subpage = (isset($_GET['b'])) ? $_GET['b'] : 'new'; $this->template_category = (isset($_GET['c'])) ? $_GET['c'] : '0'; } // Izris strani za ustvarjanje ankete public function displayNewSurveyPage(){ global $lang; global $site_url; global $site_path; // Leva stran - meni echo '
'; $this->displayLeftMenu(); echo '
'; // Desna stran - vsebina echo '
'; echo '
'; echo ''; $this->displayRightContent(); echo '
'; echo '
'; } // Izris levega menija private function displayLeftMenu(){ global $lang; global $site_url; global $site_path; global $admin_type; // Nova anketa echo ''.$lang['srv_newSurvey_survey_new'].''; // Anketa iz predloga (knjiznice) - samo na www.1ka.si, testu in arnesu if/**((strpos($site_url, 'www.1ka.si') !== false && !isVirtual()) || strpos($site_url, 'test.1ka.si') || strpos($site_url, '1ka.arnes.si') || isDebug())**/(1){ echo ''.$lang['srv_newSurvey_survey_template'].''; if($this->subpage == 'template'){ echo ''; } } // Kopiraj mojo anketo echo ''.$lang['srv_newSurvey_survey_copy'].''; // Uvoz ankete - 1ka format echo ''.$lang['srv_newSurvey_survey_archive'].''; // Anketa iz besedila echo ''.$lang['srv_newSurvey_survey_from_text'].''; if(HierarhijaHelper::aliImaDostopDoIzdelovanjaHierarhije()) { echo ''.$lang['srv_hierarchy'].''; } } // Izris desne vsebine private function displayRightContent(){ global $global_user_id; // Preverimo, ce je funkcionalnost v paketu, ki ga ima uporabnik $userAccess = UserAccess::getInstance($global_user_id); if(!$userAccess->checkUserAccess()){ $userAccess->displayNoAccess(); return; } // Anketa iz predloge if($this->subpage == 'template') $this->displayRightContentTemplates(); // Kopiranje iz moje ankete elseif($this->subpage == 'copy') $this->displayRightContentCopy(); // Anketa iz arhiva (uvoz) elseif($this->subpage == 'archive') $this->displayRightContentArchive(); // Hierarhija elseif($this->subpage == 'hierarhija') $this->displayRightContentHierarhija(); // Iz besedila elseif($this->subpage == 'from_text') $this->displayRightContentFromText(); // Nova anketa else $this->displayRightContentNew(); } // Vsebina za ustvarjanje nove ankete private function displayRightContentNew(){ global $lang; global $site_url; global $site_path; global $global_user_id; // 1. sklop - ime ankete echo '
'; // Naslov echo '
' . $lang['srv_newSurvey_survey_new'] . '
'; echo '
' . $lang['srv_noSurvey_settings'] . '
'; echo '
'; // Interno ime echo '
'; echo ''; echo ''; echo '0 / ' . ANKETA_NASLOV_MAXLENGTH . ''; echo '
'; // Objavljeno ime echo '
'; echo ''; echo ''; echo '0 / ' . ANKETA_AKRONIM_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'); $sql = sisplet_query("SELECT * FROM srv_mysurvey_folder WHERE usr_id='$global_user_id' ORDER BY naslov ASC"); if($show_folders == 1 && mysqli_num_rows($sql) > 0){ echo '
'; echo ''; echo ''; echo '
'; } echo '
'; echo '
'; // 2. sklop - tip ankete (navadna, forma, glasovanje) echo '
'; echo '
' . $lang['srv_noSurvey_type'] . '
'; echo '
'; // Navadna anketa echo ''; // Forma echo ''; // Glasovanje echo ''; echo '
'; echo '
'; // 3. sklop - skin ankete echo '
'; echo '' . $lang['srv_noSurvey_skin'] . ' ' . Help::display('srv_choose_skin') . ''; // Gorenje ima svoj default skin if(Common::checkModule('gorenje')) echo '

'; else if(Common::checkModule('automaticservis')) echo '

'; else echo '

'; // Puscica levo echo ''; echo '
'; // Gorenje ima samo 1 skin if(Common::checkModule('gorenje')){ echo '
'; echo 'GorenjeGroup (' . $lang['default'] . ')'; echo '
'; echo ''; echo '
'; echo '
'; } else{ // Loop cez vse skine (zaenkrat samo sistemske) $st = new SurveyTheme(); $skins = $st->getGroups(); foreach ($skins['0']['skins'] as $key => $skin) { $simple_name = preg_replace("/\.css$/", '', $skin); // Default skin po novem izkljucimo if ($simple_name != 'Default') { echo '
'; echo '
'; echo ''; echo '
'; echo $simple_name . ($simple_name == '1kaBlue' ? ' (' . $lang['default'] . ')' : ''); // Vprasajcki if ($simple_name == 'Embed' || $simple_name == 'Embed2' || $simple_name == 'Fdv' || $simple_name == 'Uni' || $simple_name == 'Slideshow') echo ' ' . Help:: display('srv_skins_' . $simple_name); echo '
'; } } } echo '
'; // Puscica desno echo ''; echo '
'; // Gumba naprej in preklici echo '
'; echo ''; echo ''; echo '
'; } // Vsebina za ustvarjanje ankete iz predloge private function displayRightContentTemplates(){ global $lang; global $site_url; global $site_path; global $global_user_id; $this->setTemplates(); // 1. sklop - ime ankete echo '
'; // Naslov echo '
' . $lang['srv_newSurvey_survey_template'] . '
'; echo '
' . $lang['srv_noSurvey_settings'] . '
'; echo '
'; // Interno ime echo '
'; echo ''; echo ''; echo '0 / ' . ANKETA_NASLOV_MAXLENGTH . ''; echo '
'; // Objavljeno ime echo '
'; echo ''; echo ''; echo '0 / ' . ANKETA_AKRONIM_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'); $sql = sisplet_query("SELECT * FROM srv_mysurvey_folder WHERE usr_id='$global_user_id' ORDER BY naslov ASC"); if($show_folders == 1 && mysqli_num_rows($sql) > 0){ echo '
'; echo ''; echo ''; echo '
'; } echo '
'; echo '
'; // 2. sklop - izbira predloge echo '
'; echo '
' . $lang['srv_newSurvey_survey_template_choose'] . '
'; echo ''; // Mobile dropdown za izbiro tipa predloge echo ''; echo '
'; echo '
'; // Prikaz predlog foreach($this->templates as $template_id => $template_name){ $this->displayRightContentTemplate($template_id); } echo '
'; echo '
'; echo '
'; // Gumba naprej in preklici echo '
'; echo ''; echo ''; echo '
'; } // Pripravimo podatke o vseh predlogah na trenutni strani private function setTemplates(){ global $lang; // Pridobimo seznam templatov anket za izbrano kategorijo in jezik $lang_str = ($lang['id'] == '1') ? '_slo' : '_eng'; $cat_str = ($this->template_category == '0') ? '' : ' AND kategorija=\''.$this->template_category.'\''; $sql = sisplet_query("SELECT kategorija, ank_id".$lang_str." AS ank_id, naslov".$lang_str." AS naslov, desc".$lang_str." AS opis FROM srv_anketa_template WHERE ank_id".$lang_str.">0 ".$cat_str.""); while($row = mysqli_fetch_array($sql)){ SurveyInfo::getInstance()->SurveyInit($row['ank_id']); $survey_type = SurveyInfo::getInstance()->getSurveyColumn('survey_type'); if($survey_type === '0') $survey_type_str = $lang['srv_vrsta_survey_type_0']; elseif($survey_type === '1') $survey_type_str = $lang['srv_vrsta_survey_type_1']; else $survey_type_str = $lang['srv_vrsta_survey_type_2']; $this->templates[$row['ank_id']] = array( 'naslov' => $row['naslov'], 'tip' => $survey_type_str, 'opis' => $row['opis'] ); } } // Prikazemo posamezen element predloge private function displayRightContentTemplate($template_id){ global $lang; global $site_url; $template_data = $this->templates[$template_id]; echo '
'; // Naslov echo ''; // Vsebina echo '
'.$template_data['naslov'].'
'; echo '
'; if($template_data['opis'] != '') echo (strlen($template_data['opis']) > 140) ? substr($template_data['opis'], 0, 137).'...' : $template_data['opis']; else echo $template_data['naslov']; echo '
'; // Predogled echo '
'; echo ' '.$lang['srv_newSurvey_survey_template_preview'].''; echo '
'; echo '
'; } // Vsebina za kopiranje obstoječe ankete private function displayRightContentCopy(){ global $lang; global $site_url; global $site_path; global $global_user_id; //1. sklop ime ankete, mapa - se doda v 2. fazi redizajna @TG // 2. sklop - seznam obstoječih anket echo '
'; echo '
' . $lang['srv_newSurvey_survey_copy'] . '
'; echo '
'.$lang['srv_newSurvey_survey_copy_title'].'
'; //echo ''; //echo ''; echo '

'.$lang['srv_newSurvey_survey_copy_paragraph'].'

'; echo '
'; echo ''; echo '
'; echo '
'; // Gumba naprej in preklici echo '
'; echo ''; echo ''; echo '
'; } // Vsebina za uvažanje ankete iz arhiva private function displayRightContentArchive(){ global $lang; global $site_url; global $site_path; // 1. sklop - ime ankete echo '
'; // Naslov echo '
' . $lang['srv_newSurvey_survey_archive'] . '
'; echo '
' . $lang['srv_newSurvey_survey_archive_title'] . '
'; echo '

'.$lang['srv_arhiv_datoteka_save_txt2'].'

'; echo ''; echo '
'; echo '
'; echo ''; //echo ''; echo ''; //custom label echo ''; echo ''; echo ''; //echo $lang['srv_arhiv_datoteka_save_txt2'].'.'; echo '


'; echo '
'; echo '
'; // Izpis napake pri uvozu if(isset($_GET['error'])){ if($_GET['error'] == '2') echo '

'.$lang['srv_newSurvey_survey_archive_error2'].'

'; else echo '

'.$lang['srv_newSurvey_survey_archive_error1'].'

'; } echo '
'; echo ''; echo ''; // Gumba naprej in preklici echo '
'; echo ''; echo ''; echo '
'; } /** * Modul za ustvarjanje hierarhije */ private function displayRightContentHierarhija(){ global $lang; global $site_url; global $site_path; // V kolikor nima pravic za ustvarjanje hierarhije je blank page if(!HierarhijaHelper::aliImaDostopDoIzdelovanjaHierarhije()){ return false; } // 1. sklop - ime ankete echo '
'; // Naslov echo '
' . $lang['srv_hierarchy'] . '
'; // Glavno okno za prikaz uvoda in izbire ankete echo '
'; if(!empty($_GET['c']) && $_GET['c'] == 'izbira'){ echo '

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

'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo '
'; }else{ echo $lang['srv_hierarchy_description']; } echo '
'; echo '
'; // Gumbi echo '
'; if(!empty($_GET['c']) && $_GET['c'] == 'izbira'){ echo '' . $lang['back'] . ''; echo '' . $lang['srv_potrdi'] . ''; }else { echo ''.$lang['srv_cancel'].''; echo ''.$lang['next1'].''; } echo '
'; } // Uvoz ankete iz besedila public function displayRightContentFromText(){ global $lang; global $site_url; global $site_path; global $global_user_id; // 1. sklop - ime ankete echo '
'; echo '
'; // Naslov echo '
' . $lang['srv_newSurvey_survey_from_text'] . '
'; echo '
' . $lang['srv_noSurvey_settings'] . '
'; echo '
'; // Interno ime echo '
'; echo ''; echo ''; echo '0 / ' . ANKETA_NASLOV_MAXLENGTH . ''; echo '
'; // Objavljeno ime echo '
'; echo ''; echo ''; echo '0 / ' . ANKETA_AKRONIM_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'); $sql = sisplet_query("SELECT * FROM srv_mysurvey_folder WHERE usr_id='$global_user_id' ORDER BY naslov ASC"); if($show_folders == 1 && mysqli_num_rows($sql) > 0){ echo '
'; echo ''; echo ''; echo '
'; } echo '
'; echo '
'; // 2. sklop - uvoz iz besedila echo '
'; // Naslov echo '
' . $lang['srv_newSurvey_survey_from_text_title'] . ' '.Help::display('srv_create_survey_from_text', "title").'
'; echo '

' . $lang['srv_newSurvey_survey_from_text_text1'] . '

'; echo '

' . $lang['srv_newSurvey_survey_from_text_text2'] . '

'; echo '

' . $lang['srv_newSurvey_survey_from_text_text3'] . '

'; echo '
'; // Input okno za text echo '
'; //echo ''; echo ''; echo '
'; // Preview okno echo '
'; echo ''.$lang['srv_poglejanketo2'].''; echo '
'; echo '
'; echo '
'; // Gumba naprej in preklici echo '
'; echo ''; echo ''; echo '
'; } /** * Uporabnik se je ravnokar registriral in se nima nobenih anket * */ function displayNoSurveySequence(){ global $lang; global $site_url; global $site_path; global $global_user_id; echo '
'; // Prva stran echo '
'; echo '
'; $sql = sisplet_query("SELECT * FROM users WHERE id='$global_user_id'"); $row = mysqli_fetch_array($sql); $text = $row['name'] . ' ' . $row['surname']; $text = (strlen($text) > 25) ? substr($text, 0, 25) . '...' : $text; $text = trim($text); echo '
'; echo ''; echo $lang['noSurvey_sequence_1'] . $text .'!'; echo '
'; // Video if (isset($_GET['b']) && $_GET['b'] == 'video') { echo '
'; if($lang['id'] == '1') echo '

'; else echo '

'; echo '
'; } // Spisek funkcionalnosti if (isset($_GET['b']) && $_GET['b'] == 'features') { echo '
'; echo '

'.$lang['noSurvey_sequence_features'].'

'; echo '

' . $lang['noSurvey_sequence_features_h1'] . '

'; echo '
    '; echo '
  • ' . $lang['noSurvey_sequence_features_li1'] . '
  • '; echo '
  • ' . $lang['noSurvey_sequence_features_li2'] . '
  • '; echo '
'; echo '

' . $lang['noSurvey_sequence_features_h2'] . '

'; echo '
    '; echo '
  • ' . $lang['noSurvey_sequence_features_li3'] . '
  • '; echo '
  • ' . $lang['noSurvey_sequence_features_li4'] . '
  • '; echo '
  • ' . $lang['noSurvey_sequence_features_li5'] . '
  • '; echo '
  • ' . $lang['noSurvey_sequence_features_li6'] . '
  • '; echo '
  • ' . $lang['noSurvey_sequence_features_li7'] . '
  • '; echo '
  • ' . $lang['noSurvey_sequence_features_li8'] . '
  • '; echo '
  • ' . $lang['noSurvey_sequence_features_li9'] . '
  • '; echo '
'; echo '

' . $lang['noSurvey_sequence_features_h3'] . '

'; echo '
    '; echo '
  • ' . $lang['noSurvey_sequence_features_li10'] . '
  • '; echo '
  • ' . $lang['noSurvey_sequence_features_li11'] . '
  • '; echo '
  • ' . $lang['noSurvey_sequence_features_li12'] . '
  • '; echo '
  • ' . $lang['noSurvey_sequence_features_li13'] . '
  • '; echo '
  • ' . $lang['noSurvey_sequence_features_li14'] . '
  • '; echo '
  • ' . $lang['noSurvey_sequence_features_li15'] . '
  • '; echo '
  • ' . $lang['noSurvey_sequence_features_li16'] . '
  • '; echo '
  • ' . $lang['noSurvey_sequence_features_li17'] . '
  • '; echo '
'; $cenik_link = ($lang['id'] == '1') ? 'https://www.1ka.si/d/sl/cenik' : 'https://www.1ka.si/d/en/services/'; echo '

'.$lang['noSurvey_sequence_button_cenik_text'].''.$lang['noSurvey_sequence_button_cenik'].'.

'; echo '
'; } // Ustvari anketo echo '
'; echo '
'; echo '
'; echo ''; echo '
'; echo '
'; echo $lang['noSurvey_sequence_button_create']; echo '
'; echo '
'; echo $lang['noSurvey_sequence_2']; $anketa_url = "'".$site_url.'/admin/survey/index.php?b=new_survey'."'"; echo '
'; echo ''; echo '
'; echo '
'; // Videovodic box if(!isset($_GET['b']) || $_GET['b'] != 'video'){ echo '
'; echo '
'; echo '
'; echo ''; echo '
'; echo '
'; echo $lang['noSurvey_sequence_3']; echo '
'; echo '
'; echo $lang['noSurvey_sequence_4']; $video_url = "'".$site_url.'/admin/survey/index.php?b=video'."'"; echo '
'; echo ''; echo '
'; echo '
'; } // Ogled funkcionalnosti box if(!isset($_GET['b']) || $_GET['b'] != 'features'){ echo '
'; echo '
'; echo '
'; echo ''; echo '
'; echo '
'; echo $lang['noSurvey_sequence_5']; echo '
'; echo '
'; echo $lang['noSurvey_sequence_6']; $features_url = "'".$site_url.'/admin/survey/index.php?b=features'."'"; echo '
'; echo ''; echo '
'; echo '
'; } echo '
'; echo '
'; echo '
'; } public function ajax(){ global $lang; if ($_GET['a'] == 'from_text_preview') { $text = (isset($_POST['text'])) ? $_POST['text'] : ''; $text = str_replace('\n', '
', strip_tags($text)); // Ce imamo prazno if($text == ''){ $text = ''.$lang['srv_poglejanketo2'].''; } else{ // Pobrisemo vmesne odvecne presledke $text = preg_replace( '/(
){3,}/', '

', $text ); // Wrapamo naslove (prazna vrstica spredaj) $text = preg_replace( '/

([^<>]+)/', '

$1', $text ); // Wrapamo variable (vsaka v novi vrstici) $text = preg_replace( '/
([^<>]+)/', '
$1', $text ); // Dodamo se textbox ce je samo vprasanje $text = preg_replace( '/([^<>]+<\/span>)

/', '$1


', $text ); // Wrapamo se prvo vrstico kot naslov $text = preg_replace( '/([^<>]+)
/', '$1
', $text, 1 ); // Dodamo se textbox na zadnjo vrstico ce je potrebno $text = preg_replace( '/([^<>]+<\/span>)\Z/', '$1
', $text ); // Dodamo se textbox na prvo vrstico, ce je potrebno $text = preg_replace( '/([^<>]+<\/span>)

/', '$1


', $text, 1 ); } echo $text.'

'; } } }