diff --git a/.gitignore b/.gitignore index 3371c6ed9..561097b8c 100644 --- a/.gitignore +++ b/.gitignore @@ -49,5 +49,6 @@ docker /.htaccess /composer.bat /composer.phar +/composer.lock /.favorites.json diff --git a/admin/survey/classes/class.Vprasanje.php b/admin/survey/classes/class.Vprasanje.php index 0c7179c9a..762c711fb 100644 --- a/admin/survey/classes/class.Vprasanje.php +++ b/admin/survey/classes/class.Vprasanje.php @@ -43,24 +43,14 @@ class Vprasanje { * */ function display () { - - //echo '
'; - + $this->tabs(); echo '
'; $this->vprasanje_edit(); echo '
'; - - //echo '
'; - //$b = new Branching($this->anketa); - //$b->vprasanje($this->spremenljivka); - //echo '
'; - - $this->edit_buttons(); - - //echo '
'; + $this->edit_buttons(); } /** @@ -75,7 +65,6 @@ class Vprasanje { $rows = SurveyInfo::getInstance()->getSurveyRow(); echo '
'; - //echo ' '; echo ''.$lang['srv_osnovno'].''; @@ -89,21 +78,10 @@ class Vprasanje { // Tab validacija echo ''.$lang['srv_validation'].''; - - //SurveySetting::getInstance()->Init($this->anketa); - //$question_comment = SurveySetting::getInstance()->getSurveyMiscSetting('question_comment'); - //$question_resp_comment = SurveySetting::getInstance()->getSurveyMiscSetting('question_resp_comment'); - //if ($question_comment==1 || $question_resp_comment==1) // Tab opomba echo ''.$lang['srv_note'].($row['note']!=''?'*':'').''; - - // urejanje label za grafe - //echo ''; - - # tabulator za manjkajoče vrednosti za posamezno vprašanje - #echo ''; - + // Tab tracking sprememb na vprašanju if (($admin_type == 0 || $admin_type == 1) && $rows['vprasanje_tracking'] > 0){ echo ''; - /*echo '';*/ - - # rekodiranje - je premaknjeno k podatkom -> izračuni -> rekodiranje - #echo ''; - echo ''; - } echo ''; - - - //$this->edit_buttons(); - + echo ''; echo ''; - } /** @@ -336,7 +300,7 @@ class Vprasanje { if ( in_array($row['tip'], array(1, 2, 3, 6, 16, 17, 18, 19, 20, 24)) ) { if ( in_array($row['tip'], array(1, 2, 3, 17, 18)) ){ - echo '
'.$lang['srv_kategorije_odgovorov'].''; + echo '
'.$lang['srv_kategorije_odgovorov'].''; } else{ echo '
'.$lang['srv_podvprasanja'].''; @@ -411,32 +375,51 @@ class Vprasanje { if ( in_array($row['tip'], array(7, 19, 20, 21)) ) { - if($row['signature'] != 1){ //ce ni elektronski podpis - $displayFieldset = 'display: block'; - }else{ - $displayFieldset = 'display: none'; - } - //echo '
'.$lang['srv_kategorije_odgovorov'].''; - echo '
'.$lang['srv_kategorije_odgovorov'].''; - - if ( in_array($row['tip'], array(21)) ) { - $this->edit_textboxes(); - } - - if ( in_array($row['tip'], array(7)) ) { - if ($row['ranking_k'] == 0){ //ce je izbrano stevilo in ne drsnik - $this->edit_num_size(); - $this->edit_num_enota(); - } - } - - if ($row['ranking_k'] == 0){ //ce je izbrano stevilo in ne drsnik - $this->edit_width(); - } - - echo '
'; - } - + + $captcha = ($spremenljivkaParams->get('captcha') ? $spremenljivkaParams->get('captcha') : 0); + + //ce ni elektronski podpis, upload ali captcha + if($row['signature'] != 1 && $row['upload'] < 1 && $captcha != 1){ + $displayFieldset = 'display: block'; + } + else{ + $displayFieldset = 'display: none'; + } + + echo '
'.$lang['srv_kategorije_odgovorov'].''; + + if ( in_array($row['tip'], array(21)) ) { + $this->edit_textboxes(); + } + + if ( in_array($row['tip'], array(7)) ) { + if ($row['ranking_k'] == 0){ //ce je izbrano stevilo in ne drsnik + $this->edit_num_size(); + $this->edit_num_enota(); + } + } + + if ($row['ranking_k'] == 0){ //ce je izbrano stevilo in ne drsnik + $this->edit_width(); + } + + echo '
'; + + + // Poseben segment za upload datoteke + if($row['upload'] == 1){ + $displayFieldset = 'display: block'; + } + else{ + $displayFieldset = 'display: none'; + } + + echo '
'.$lang['srv_vprasanje_upload_limit_title'].' '.Help::display('srv_upload_limit').''; + echo '

'.$lang['srv_vprasanje_upload_limit'].'

'; + echo '

'.$lang['srv_vprasanje_upload_limit_type'].'

'; + echo '
'; + } + // manjkajoce vrednosti - besedilo if ( in_array($row['tip'], array(21)) ) { echo '
'.$lang['srv_manjkajoce_vrednosti2'].' '.Help::display('srv_missing_values').''; @@ -754,46 +737,24 @@ class Vprasanje { $spr_id = $row['id']; //prikazovanje/skrivanje nastavitev za osvetljevanje - if($hotspot_region_visibility_option) - { + if($hotspot_region_visibility_option){ $hotspot_visibility_display = 'style=""'; - }else - { + } + else{ $hotspot_visibility_display = 'style="display:none"'; } //prikazovanje/skrivanje nastavitev za osvetljevanje - konec //preveri, ce je kaksno obmocje shranjeno v bazi - //$sqlR = sisplet_query("SELECT * FROM srv_hotspot_regions WHERE spr_id = $spr_id"); $sqlR = sisplet_query("SELECT region_index, vre_id, region_name FROM srv_hotspot_regions WHERE spr_id = $spr_id"); - //$rowR = mysqli_fetch_array($sql); - -/* //********************************************************* - //ce se je uredilo obmocja, presaltalo na drugo postavitev in tam brisalo vrednosti (srv_vrednost), je potrebno restorat izbrisane odgovore iz srv_hotspot_regions v srv_vrednost - //prestej koliko je v bazi vrednosti in obmocij - $sqlc = sisplet_query("SELECT COUNT(*) AS count FROM srv_vrednost WHERE spr_id=$spr_id"); - $rowc = mysqli_fetch_assoc($sqlc); - $vre_num = $rowc['count']; //stevilo vrednosti - $sqlcr = sisplet_query("SELECT COUNT(*) AS count FROM srv_hotspot_regions WHERE spr_id=$spr_id"); - $rowcr = mysqli_fetch_assoc($sqlcr); - $reg_num = $rowcr['count']; //stevilo obmocij - - if ( mysqli_num_rows($sqlR) != 0 && ($reg_num != $vre_num) ){ //ce imamo nekaj obmocij in ce je stevilo vrednosti razlicno od stevila obmocij - //$i = sisplet_query("INSERT INTO srv_vrednost (id, spr_id, naslov, size, vrstni_red) VALUES ('', '$this->spremenljivka', '$naslov', '$size', '$vrstni_red')"); - echo ' - - '; - } - //********************************************************* */ - if($row['tip'] == 1 || $row['tip'] == 2){ $enota_orientation = $row['orientation']; - }else if($row['tip'] == 6){ + } + else if($row['tip'] == 6){ $enota_orientation = $row['enota']; - }else if($row['tip'] == 17){ + } + else if($row['tip'] == 17){ $enota_orientation = $row['design']; } ?> @@ -813,131 +774,107 @@ class Vprasanje { if($row['tip'] == 6 || $row['tip'] == 17){ //ce je radio grid ali razvrscanje, pokazi naslov kot "Obmocja" echo '
'.$lang['srv_hot_spot_regions_menu'].''; - }elseif($row['tip'] == 1 || $row['tip'] == 2){ //ce je radio ali checkbox, pokazi naslov kot "Obmocja - Kategorije odgovorov" + } + elseif($row['tip'] == 1 || $row['tip'] == 2){ //ce je radio ali checkbox, pokazi naslov kot "Obmocja - Kategorije odgovorov" echo '
'.$lang['srv_hot_spot_regions_menu'].' - '.$lang['srv_kategorije_odgovorov'].''; } - //Sporocilo ob odsotnosti slike - echo '

'.$lang['srv_hotspot_message'].'

'; + //Sporocilo ob odsotnosti slike + echo '

'.$lang['srv_hotspot_message'].'

'; - -/* //Dodajanje območja - gumb - //echo '

'.$lang['srv_hot_spot_regions'].'

'; - //echo '

'; - echo '

'; */ + if (mysqli_num_rows($sqlR) != 0){ + //pokazi shranjena obmocja + while ($rowR = mysqli_fetch_array($sqlR)) { + echo '
'.$rowR['region_name'].'

'; + } + } - + + //Dodajanje območja - gumb + echo '

'; + + //Izbira barve izbranega obmocja + //if($row['tip'] != 6) //ce ni grid, torej radio ali checkbox dodaj nastavitev za barvo izbranega obmocja + if($row['tip'] != 6 && $row['tip'] != 17) //ce ni grid in ni razvrscanje, torej radio ali checkbox dodaj nastavitev za barvo izbranega obmocja + { + if ($hotspot_region_color == '') { + $value = '#000000'; + //echo ''.$lang['srv_hotspot_region_color_text'].': '.$lang['srv_te_default'].' '; + echo ''.$lang['srv_hotspot_region_color_text'].':'.Help::display('srv_hotspot_region_color').' '.$lang['srv_te_default'].' '; + }else{ + $value = $hotspot_region_color; + } + + echo ''.$lang['srv_hotspot_region_color_text'].': '.Help::display('srv_hotspot_region_color').' '; + echo ''; + echo ''; + + //echo '
'; + } + //Izbira barve izbranega obmocja - konec + + //Regions visibility options ********************************************** + + //checkbox za "Osvetljevanje" + echo '
'; - - //Regions visibility options - konec **************************************************************** - - //Tooltips options - if($row['tip'] == 1 || $row['tip'] == 2){ //ce je radio ali checkbox - $srv_hotspot_tooltip = 'srv_hotspot_tooltip'; - //}else if($row['tip'] == 6){ - }else if($row['tip'] == 6 ||$row['tip'] == 17){ - $srv_hotspot_tooltip = 'srv_hotspot_tooltip_grid'; - } - //echo '

'.$lang['srv_hotspot_tooltips_options_title'].': '; - //echo '

'.$lang['srv_hotspot_tooltips_options_title'].':'.Help::display('srv_hotspot_tooltip').' '; - echo '

'.$lang['srv_hotspot_tooltips_options_title'].':'.Help::display($srv_hotspot_tooltip).' '; - echo ''; - echo '

'; - - -/* //checkbox za "Komentar" - echo ''; - //echo '
'; - //checkbox za "Komentar" - konec */ - - echo ''; } @@ -1013,144 +950,140 @@ class Vprasanje { /** - * Tip multilokacija - * + * Tip multilokacija + * * Doloci najvisjo stevilo dovoljenih vnosov - markerjev * @global type $lang */ function st_markerjev() { - global $lang; - - $row = Cache::srv_spremenljivka($this->spremenljivka); - $newParams = new enkaParameters($row['params']); - //$min = $newParams->get('date_range_min'); - $max = $newParams->get('max_markers') ? $newParams->get('max_markers') : 1; - $input = $newParams->get('multi_input_type') ? $newParams->get('multi_input_type') : 'marker'; + global $lang; - echo '

'; - echo ''.$lang['srv_vprasanje_max_marker_map'].': '.Help::display('srv_vprasanje_max_marker_map').''; - echo ''; - - //ce je moja lokacija, je disablan, ker je lahko samo 1 odgovor - - //number - /*echo ''; - echo '';*/ - - //roleta - echo ''; - echo '

'; -} + $row = Cache::srv_spremenljivka($this->spremenljivka); + $newParams = new enkaParameters($row['params']); + + //$min = $newParams->get('date_range_min'); + $max = $newParams->get('max_markers') ? $newParams->get('max_markers') : 1; + $input = $newParams->get('multi_input_type') ? $newParams->get('multi_input_type') : 'marker'; + + echo '

'; + echo ''.$lang['srv_vprasanje_max_marker_map'].': '.Help::display('srv_vprasanje_max_marker_map').''; + echo ''; + + //roleta + echo ''; + echo '

'; + } /** * vrstica za fokusiranje mape (text kraja, lokacije) */ function fokus_mape() { - global $lang; - - $row = Cache::srv_spremenljivka($this->spremenljivka); - $newParams = new enkaParameters($row['params']); - $fokus = $newParams->get('fokus_mape'); //dobi fokus mape + global $lang; + + $row = Cache::srv_spremenljivka($this->spremenljivka); + $newParams = new enkaParameters($row['params']); + $fokus = $newParams->get('fokus_mape'); //dobi fokus mape - echo '

'; - echo ''.$lang['srv_vprasanje_fokus_map'].': '; - echo ''; - echo ''; - echo ''; - echo '

'; -} + echo '

'; + echo ''.$lang['srv_vprasanje_fokus_map'].': '; + echo ''; + echo ''; + echo ''; + echo '

'; + } /** * vrstica za naslov podvprasanja v oblacek markerja */ function naslov_podvprasanja_map() { - global $lang; - - $row = Cache::srv_spremenljivka($this->spremenljivka); - $newParams = new enkaParameters($row['params']); - $naslov = $newParams->get('naslov_podvprasanja_map'); //dobi naslov podvprasanja mape - $marpod = $newParams->get('marker_podvprasanje'); //ali dodam podvprasanje v infowindow + global $lang; + + $row = Cache::srv_spremenljivka($this->spremenljivka); + $newParams = new enkaParameters($row['params']); + + $naslov = $newParams->get('naslov_podvprasanja_map'); //dobi naslov podvprasanja mape + $marpod = $newParams->get('marker_podvprasanje'); //ali dodam podvprasanje v infowindow - echo '

'; - echo ''.$lang['srv_vprasanje_naslov_podvprasanja_map'].': '.Help::display('naslov_podvprasanja_map').''; - echo ''; - echo ''; - echo ''; - echo '

'; + echo '

'; + echo ''.$lang['srv_vprasanje_naslov_podvprasanja_map'].': '.Help::display('naslov_podvprasanja_map').''; + echo ''; + echo ''; + echo ''; + echo '

'; } /** * vrstica za poizvedovanje trenutne lokacije */ function userLocation() { - global $lang; - - $row = Cache::srv_spremenljivka($this->spremenljivka); - $newParams = new enkaParameters($row['params']); - $usrloc = $newParams->get('user_location'); //ali se poizve trenutna lokacija - $input = $newParams->get('multi_input_type') ? $newParams->get('multi_input_type') : 'marker'; + global $lang; + + $row = Cache::srv_spremenljivka($this->spremenljivka); + $newParams = new enkaParameters($row['params']); + $usrloc = $newParams->get('user_location'); //ali se poizve trenutna lokacija + $input = $newParams->get('multi_input_type') ? $newParams->get('multi_input_type') : 'marker'; - echo '

'; - echo ''; - echo ''; - echo ''; - echo ''; - echo '

'; -} + echo '

'; + echo ''; + echo ''; + echo ''; + echo ''; + echo '

'; + } /** * vrstica za podvprasanje v markerju - infowindow */ function markerPodvprasanje() { - global $lang; - - $row = Cache::srv_spremenljivka($this->spremenljivka); - $newParams = new enkaParameters($row['params']); - $marpod = $newParams->get('marker_podvprasanje'); //ali dodam podvprasanje v infowindow + global $lang; + + $row = Cache::srv_spremenljivka($this->spremenljivka); + $newParams = new enkaParameters($row['params']); + $marpod = $newParams->get('marker_podvprasanje'); //ali dodam podvprasanje v infowindow $input = $newParams->get('multi_input_type') ? $newParams->get('multi_input_type') : 'marker'; echo '

'; echo ''; - echo ''; - echo ''; - echo ''; - echo '

'; -} + + echo ''; + echo ''; + echo ''; + echo '

'; + } /** * vrstica za podvprasanje v markerju - infowindow */ function dodaj_SearchBox() { - global $lang; - - $row = Cache::srv_spremenljivka($this->spremenljivka); - $newParams = new enkaParameters($row['params']); - $marpod = $newParams->get('dodaj_searchbox'); //ali dodam podvprasanje v infowindow + global $lang; + + $row = Cache::srv_spremenljivka($this->spremenljivka); + $newParams = new enkaParameters($row['params']); + $marpod = $newParams->get('dodaj_searchbox'); //ali dodam podvprasanje v infowindow $input = $newParams->get('multi_input_type') ? $newParams->get('multi_input_type') : 'marker'; - echo ''; -} + .Help::display('dodaj_searchbox').''; + echo ''; + echo ''; + echo ''; + echo '

'; + } /** @@ -1852,13 +1785,11 @@ class Vprasanje { //editiranje podtipa pri radio (hor., ver., dropdown) - //if($row['tip'] == 1 || $row['tip'] == 3){ if($row['tip'] == 1 || ($row['tip'] == 3 && !$row['info'])){ $this->edit_radio_subtype(); } //editiranje orientacije pri checkboxu (hor., ver.) - //if($row['tip'] == 2 ){ if($row['tip'] == 2 || ($row['tip'] == 3 && $row['info'])){ $this->edit_checkbox_subtype(); } @@ -1887,9 +1818,9 @@ class Vprasanje { $this->edit_name_generator_design(); } - //podtip lokacija - moja lokacija - if ($row['tip'] == 26) { - $this->edit_subtype_map(); + //podtip lokacija - moja lokacija + if ($row['tip'] == 26) { + $this->edit_subtype_map(); } //podtip heatmap @@ -1898,16 +1829,10 @@ class Vprasanje { } echo ''; - - //echo '
'; - + echo ' $(document).ready(function() {'; + echo ' $("#spremenljivka_podtip_' . $row['id'] . '").selectbox();'; // kreira custom dropdown z možnostjo predogleda vprašanja + echo ' });'; + echo ''; } /** @@ -3484,8 +3409,7 @@ class Vprasanje { echo ''; //image hotspot if ($admin_type == 0){ //echo ''; -/* echo ''; - echo ''; //image hotspot */ + } //echo ''; echo ''; @@ -3568,11 +3492,7 @@ class Vprasanje { echo '

'; echo ''.$lang['srv_vprasanje_upload_type'].':'; - - //staro, radibo buttni da in ne - //echo ''.$lang['no1']; - //echo ''.$lang['yes'].''; - + //novo, dropdown s fotografijami onChange="change_upload(\'' . $row['id'] . '\', this.value);" echo ''; + + echo ''; // Nastavimo prikaz nastavitve za stevilo vidnih moznosti v select box - ce imamo selectbox je ta moznost vidna, drugace ni - //if ($row['tip'] == 6 || $row['tip'] == 16){ if (($row['tip'] == 6 || $row['tip'] == 16) && $row['enota'] != 2){ $display = (($row['tip'] == 6 || $row['tip'] == 16) && $row['enota'] != 6 && $row['enota'] != 8) ? ' style="display:none;"' : ''; $displayprvavrstica_roleta =' style="display:none;"'; - //$display = (($row['tip'] == 6 || $row['tip'] == 16 || $row['tip'] == 24) && $row['enota'] != 6) ? ' style="display:none;"' : ''; $sbSizeVse = $row['grids']; } elseif($row['tip'] == 1 || $row['tip'] == 2){ @@ -6410,18 +6328,10 @@ class Vprasanje { $implodednaslov = implode(";", $naslov); //zdruzi elemente array v string $newParams->set('slider_DescriptiveLabel_defaults_naslov1', $implodednaslov); -/* echo ' - - '; */ - }else{ //ce so custom opisne labele - //$_POST['tiplabele'] //console.log("tip labele tukaj: "+'.$_POST['tiplabele'].'); -/* echo ' - - '; */ + + } + else{ //ce so custom opisne labele + } } else if($slider_VmesneDescrLabel != 1){ @@ -6940,16 +6850,11 @@ class Vprasanje { $naslov = $_POST['hotspot_image']; $row = Cache::srv_spremenljivka($spr_id); - //$row = Cache::srv_spremenljivka(4407); $newParams = new enkaParameters($row['params']); - //$sql = sisplet_query("SELECT * FROM srv_vrednost WHERE id = '$vrednost'"); - //$row = mysqli_fetch_array($sql); - - if (strtolower(substr($naslov, 0, 3)) == '

' && strtolower(substr($naslov, -4)) == '

') { - //$naslov = '

'.nl2br($naslov).'

'; - $tmp = substr(substr($naslov, 0, -4), 3); + $tmp = substr(substr($naslov, 0, -4), 3); + if (strpos($tmp, "

") === false) $naslov = $tmp; } @@ -6957,48 +6862,36 @@ class Vprasanje { $purifier = New Purifier(); $naslov = $purifier->purify_DB($naslov); - //$sql = sisplet_query("UPDATE srv_vrednost SET naslov='$naslov', variable='$variable', variable_custom='$variable_custom', random='$random' WHERE id = '$vrednost'"); - - //$sql = sisplet_query("UPDATE srv_spremenljivka SET image_hotspot='$naslov' WHERE id='$spr_id'"); - //$slider_MinNumLabel = $newParams->get('slider_MinNumLabel'); if (isset($_POST['hotspot_image'])){ - if ($_POST['hotspot_image'] == ""){ + + if ($_POST['hotspot_image'] == ""){ $hotspot_image = ""; - }else{ + } + else{ $hotspot_image = $_POST['hotspot_image']; $dimensions_present = strpos($hotspot_image,'style='); //ce slika nima dimenzij - //if($dimensions_present == "" || $_POST['height'] == ""){ - if($dimensions_present == ""){ + if($dimensions_present == ""){ + //pobrisi obstojeci parameter hotspot_image $newParams->set('hotspot_image', ""); - //$newParams->set('hotspot_image', $hotspot_image); $params = $newParams->getString(); - //$sql = sisplet_query("UPDATE srv_spremenljivka SET params='$params' WHERE id='$spr_id'"); $sql = sisplet_query("UPDATE srv_spremenljivka SET params='$params' WHERE id='$spr_id'"); $length = strlen($hotspot_image); //dobi dolzino celotne html kode za sliko $hotspot_image = substr($hotspot_image, 0, ($length-2)); //izlusci vse razen zadnjih dveh znakov, kjer se zakljuci html koda za sliko - //$hotspot_image = $hotspot_image . ' width="'.$_POST['width'].'px" heigth="'.$_POST['height'].'px" />'; - $hotspot_image = $hotspot_image . 'style="height:'.$_POST['height'].'px; width:'.$_POST['width'].'px;" />'; + + $hotspot_image = $hotspot_image . 'style="height:'.$_POST['height'].'px; width:'.$_POST['width'].'px;" />'; } } - -/* //pobrisi obstojeci parameter hotspot_image - $newParams->set('hotspot_image', ""); - //$newParams->set('hotspot_image', $hotspot_image); - $params = $newParams->getString(); - //$sql = sisplet_query("UPDATE srv_spremenljivka SET params='$params' WHERE id='$spr_id'"); - $sql = sisplet_query("UPDATE srv_spremenljivka SET params='$params' WHERE id='$spr_id'"); */ - + //vnesi parameter hotspot_image $newParams->set('hotspot_image', $hotspot_image); $params = $newParams->getString(); $sql = sisplet_query("UPDATE srv_spremenljivka SET params='$params' WHERE id='$spr_id'"); } - if (!$sql) echo mysqli_error($GLOBALS['connect_db']); echo mysql_real_unescape_string($naslov); @@ -7834,7 +7727,6 @@ class Vprasanje { } //posodobi skrite vrednosti odgovorov za diferencial trak - //function ajax_diferencial_trak_skrite_vrednosti(){ function ajax_diferencial_trak_skrite_vrednosti($spr_id, $num_grids, $diferencial_trak_starting_num){ if(isset ($_POST['spr_id'])){ $spr_id = $_POST['spr_id']; diff --git a/admin/survey/classes/surveyData/class.SurveyDataDisplay.php b/admin/survey/classes/surveyData/class.SurveyDataDisplay.php index 1eb21390c..f25d710a0 100644 --- a/admin/survey/classes/surveyData/class.SurveyDataDisplay.php +++ b/admin/survey/classes/surveyData/class.SurveyDataDisplay.php @@ -155,9 +155,11 @@ class SurveyDataDisplay{ SurveySession::sessionStart(self::$sid); # nastavimo limite - self::setVars(); + self::setVars(); + # podakcija - self::$subAction = isset($_GET['m']) && $_GET['m'] != '' ? $_GET['m'] : M_COLLECT_DATA_VIEW; + self::$subAction = isset($_GET['m']) && $_GET['m'] != '' ? $_GET['m'] : M_COLLECT_DATA_VIEW; + # informacije ankete SurveyInfo::getInstance()->SurveyInit($sid); self::$survey = SurveyInfo::getInstance()->getSurveyRow(); @@ -167,7 +169,12 @@ class SurveyDataDisplay{ self::$db_table = '_active'; # ali je anketa tipa SN - social network - self::$is_social_network = (SurveyInfo::getInstance()->checkSurveyModule('social_network')) ? true : false; + self::$is_social_network = (SurveyInfo::getInstance()->checkSurveyModule('social_network')) ? true : false; + + # Ce imamo vklopljeno povezovanje z identifikatorji, potem prikaz identifikatorjev izklopimo + if(self::$survey['show_email'] == '1'){ + self::$_VARS[VAR_SHOW_SYSTEM] = false; + } # ali prikazujemo datum na začetku ankete (Če smo v identifikatorjih ne smemo zaradi povezovanja) if ( (self::$_VARS[VAR_SHOW_DATE] == true || (int)SurveyInfo :: getInstance()->getSurveyColumn('showItime') == 1) && self::$_VARS[VAR_SHOW_SYSTEM] == false ) { @@ -1068,11 +1075,11 @@ class SurveyDataDisplay{ echo '

  • '; - if (self::$_VARS[VAR_SHOW_SYSTEM] != true ) { + if (self::$_VARS[VAR_SHOW_SYSTEM] != true) { echo ''; } else { - echo ''; + echo ''; } echo '
  • '; @@ -1087,7 +1094,7 @@ class SurveyDataDisplay{ echo ''; } else { - echo ''; + echo ''; } echo ''; @@ -1095,12 +1102,12 @@ class SurveyDataDisplay{ // podatki echo '
  • '; - echo ' '; + echo ' '; echo '
  • '; // meta echo '
  • '; - echo ' '; + echo ' '; echo '
  • '; // če imamo sistemske podatke katere moramo prikazovati ločeno - IDENTIFIKATORJI @@ -1113,18 +1120,18 @@ class SurveyDataDisplay{ // Po novem vedno prikazemo checkbox identifikatorji - samo je odkljukan in disablan else{ echo '
  • '; - echo ' '; + echo ' '; echo '
  • '; } // datum echo '
  • '; - echo ''; + echo ''; echo '
  • '; // zaporedna številka echo '
  • '; - echo ''; + echo ''; echo '
  • '; // pomoč - ? @@ -1225,8 +1232,11 @@ class SurveyDataDisplay{ echo ''; } - echo '
    '; - echo '
    '; + echo '
    '; + + + echo '
    '; + # če ne uporabljamo privzetega časovnega profila izpišemo opozorilo SurveyTimeProfiles :: printIsDefaultProfile(); @@ -1241,13 +1251,21 @@ class SurveyDataDisplay{ # če imamo filter spremenljivk ga izpišemo SurveyVariablesProfiles:: getProfileString(); - } + } + else{ + echo '

    '.$lang['srv_data_settings_identifier_notice'].'

    '; + } # če imamo rekodiranje $SR = new SurveyRecoding(self::$sid); - $SR -> getProfileString(); + $SR -> getProfileString(); + echo '
    '; + + + + $folder = $site_path . EXPORT_FOLDER.'/'; echo '
    '; diff --git a/admin/survey/classes/surveyData/old/class.CollectIncrementalData.php b/admin/survey/classes/surveyData/old/class.CollectIncrementalData.php deleted file mode 100644 index 5f7c41621..000000000 --- a/admin/survey/classes/surveyData/old/class.CollectIncrementalData.php +++ /dev/null @@ -1,5652 +0,0 @@ - 0) { - $this->Init($sid); - - // Zacasno povecamo ram samo za veliko nijz anketo - global $mysql_database_name; - if($sid == '123146' && $mysql_database_name == 'www1kasi'){ - ini_set('memory_limit', '2048M'); - } - - } - else { - echo $lang[''].'Napaka! Missing SID!'; - return false; - exit(); - } - } - - /** Inicializacija - * - * @param $sid - */ - public function Init($sid = null) { - global $site_path,$lang; - - if (is_numeric($sid) && (int)$sid > 0) { - $this->folder = $site_path . EXPORT_FOLDER.'/'; - - #nastavimo imena datotek - $this->header_file_name = $this->folder . 'export_header_'.$sid.'.dat'; - $this->data_file_name = $this->folder . 'export_data_'.$sid.'.dat'; - - - #resetiramo vse pointerje - $this->cleanup(); - - # nastavimo id ankete - $this->sid = $sid; - - # aktivne tabele - $str_survey = "SELECT db_table FROM srv_anketa WHERE id = '".$this->sid."'"; - $qry_survey = sisplet_query($str_survey); - list($db_table) = mysqli_fetch_row($qry_survey); - if ((int)$db_table == 1) { - $this->db_table = '_active'; - } else { - $this->db_table = ''; - } - - # nastavimo globalni folder - $this->folder = $site_path . EXPORT_FOLDER.'/'; - - SurveyStatusProfiles::Init($this->sid); - SurveySetting::getInstance()->Init($this->sid); - - // Preverimo ce moramo pobrisati datoteko da je zgeneriramo na novo (ce imamo vklopljen filter na uporabnost) - $this->checkUsability(); - - // Preverimo ce imamo testne podatke - $this->checkTestData(); - - # če gremo preko ajaxa ne kreiramo datoteke - $arrStr = explode("/", $_SERVER['SCRIPT_NAME'] ); - $arrStr = array_reverse($arrStr ); - - if ((isset($_REQUEST['setSkipCreate']) && $_REQUEST['setSkipCreate'] == '1') || $arrStr[0] == 'ajax.php') { - $this->setSkipCreate(true); - } - $this->checkFileStatus(); - } - else { - return null; - } - } - - public function checkFileStatus() { - # nastavimo privzete vrednosti - $head_file_time = 0; - $data_file_time = 0; - $collect_all_status = 1; #privzeto lovimo vse statuse - $collect_full_meta = true; # privzeto lovimo meta podatke - $last_update = 0; # kdaj je bil zadnji updejt - $is_valid_user_limit = ''; # privzeto lovimo vse statuse - - # preverimo katere podatke vse lovimo - $_sql_string = "SELECT UNIX_TIMESTAMP(head_file_time), UNIX_TIMESTAMP(data_file_time), collect_all_status, collect_full_meta, DATE_FORMAT(last_update,'%d.%m.%Y %H:%i:%s') FROM srv_data_files WHERE sid = '".$this->sid."'"; - $_sql_qry = sisplet_query($_sql_string); - if (mysqli_num_rows($_sql_qry) > 0) { - # preberemo vrednosti ankete - list($head_file_time, $data_file_time, $collect_all_status, $collect_full_meta, $last_update) = mysqli_fetch_row($_sql_qry); - } - $head_file_time = (int)$head_file_time; - $data_file_time = (int)$data_file_time; - - - # preberemo max time iz datoteke in uporabimo manjšega - if (IS_WINDOWS) { - $command = 'awk -F"|" "BEGIN {max = 0} {if ('.TIME_FIELD.' > max && '.TIME_FIELD.' > 0) max='.TIME_FIELD.' } END {print max}" '.$this->data_file_name; - } else { - $command = 'awk -F\'|\' \'BEGIN {max = 0} {if ('.TIME_FIELD.' > max && '.TIME_FIELD.' > 0) max='.TIME_FIELD.' } END {print max}\' '.$this->data_file_name; - } - $user_time_from_file = shell_exec($command); - $user_time_from_file = (int)$user_time_from_file; - - - if ( (int)$user_time_from_file > 0) { - # updejtamo v bazi če je slučajno datum v datoteki manjši kot v bazi - if ((int)$user_time_from_file < (int)$data_file_time && (int)$data_file_time > 0 ) { - $str_qry_update = "UPDATE srv_data_files SET data_file_time = '".(int)$user_time_from_file."' WHERE sid = '".$this->sid."'"; - $updated = sisplet_query($str_qry_update); - sisplet_query('COMMIT'); - } - $data_file_time = min((int)$data_file_time,(int)$user_time_from_file); - } - - # če je respondentov več kot ONLY_VALID_LIMIT (5000) lovimo samo ustrezne - $str_qry_cnt_user = "SELECT count(*) FROM srv_user AS u WHERE u.ank_id = '".$this->sid."' AND u.preview='0' AND u.deleted='0'"; - $_qry_cnt_user = sisplet_query($str_qry_cnt_user); - list($all_user_cnt) = mysqli_fetch_row($_qry_cnt_user); - $all_user_cnt = (int)$all_user_cnt; - - # če je collect_all_status = 2 je admin nastavil da se lovijo vsi statusi, popravimo tudi čas, da se datoteka zgenerira na novo - if ((int)$all_user_cnt > ONLY_VALID_LIMIT && (int)$collect_all_status == 1) { - $collect_all_status = 0; - $str_qry_update = "INSERT INTO srv_data_files (sid, collect_all_status, data_file_time) VALUES ('".$this->sid."','".(int)$collect_all_status."', '0000-00-00') ON DUPLICATE KEY UPDATE collect_all_status = '".(int)$collect_all_status."', data_file_time = '0000-00-00'"; - $updated = sisplet_query($str_qry_update); - sisplet_query('COMMIT'); - } - - if ((int)$collect_all_status > 0 ) { - $collect_all_status = true; - $is_valid_user_limit = ''; - } else { - $collect_all_status = false; - $is_valid_user_limit = VALID_USER_LIMIT_STRING; - } - - # če datoteka s podatki ne obstaja nastavimo data_time na 0, da generiramo vse userje - $data_file_name = $this->folder . 'export_data_'.$this->sid.'.dat'; - - if (!file_exists($data_file_name)) { - $data_file_time = 0; - } - $this->data_file_name = $data_file_name; - $this->head_file_time = (int)$head_file_time; - $this->data_file_time = (int)$data_file_time; - $this->collect_all_status = (int)$collect_all_status; - $this->collect_full_meta = $collect_full_meta; - $this->is_valid_user_limit = $is_valid_user_limit; - $this->last_update = $last_update; - - $str_survey = "SELECT *, UNIX_TIMESTAMP(edit_time) AS srv_edit_time FROM srv_anketa WHERE id = '".$this->sid."' AND active IN (0,1)"; - $qry_survey = sisplet_query($str_survey); - $this->survey = mysqli_fetch_assoc($qry_survey); - $this->max_anketa_time = (int)$this->survey['srv_edit_time']; - - # polovimo datum zadnjega userja - $str_qry_usr_time = "SELECT max(UNIX_TIMESTAMP(GREATEST(u.time_insert,u.time_edit))) FROM srv_user AS u WHERE u.ank_id = '".$this->sid."' AND u.preview='0' AND u.deleted='0' ".$this->is_valid_user_limit; - $qry_usr_time = sisplet_query($str_qry_usr_time); - if (mysqli_num_rows($qry_usr_time)) { - list($max_usr_time) = mysqli_fetch_row($qry_usr_time); - $this->max_usr_time = (int)$max_usr_time; - } - - // Ce ne belezimo parapodatka datum responsa - $no_paradata_date = SurveySetting::getInstance()->getSurveyMiscSetting('survey_date'); - if($no_paradata_date == 1) - $this->max_usr_time = time(); - - #prikazujemo sistemske - # ali prisilimo prikaz sistemskih spremenljivk - if ($this->survey['show_email'] == 1 || SurveyInfo::getInstance()->checkSurveyModule('360_stopinj')) { - $this->force_show_hiden_system = true; - } else { - $this->force_show_hiden_system = false; - } - - # če še nimamo respondentov - deluje ok samo ce je vklopljeno zbiranje parapodatka datum - if ((int)$this->max_usr_time == 0 && $no_paradata_date == 0) { - $this->fileStatus = FILE_STATUS_NO_DATA; - return; - } - - # preverimo da anketa ni izbrisana - if ((int)$this->survey['active'] >= 0) { - - # najprej preverimo head datoteko - if ((int)$this->head_file_time != (int)$this->max_anketa_time || (int)$this->max_anketa_time == 0) { - # head datoteka je stara, pobrišemo obe datoteki - $this->fileStatus = FILE_STATUS_NO_FILE; - #pobrišemo vse morebitne ostanke datotek - $this->clearSurveyDataFiles(); - return; - } - - // Ce imamo izklopljeno belezenje parapodatka datum in imamo vsaj 1 vnos moramo vedno generirati datoteko - if($no_paradata_date == 1 && $all_user_cnt > 0){ - - $this->fileStatus = FILE_STATUS_NO_FILE; - - # preverimo obstoj header datoteke - if (file_exists($this->folder . 'export_header_'.$this->sid.'.dat')) { - - # če datoteka obstaja, nastavimo status na stari podatki - if (file_exists($this->folder . 'export_data_'.$this->sid.'.dat')) { - $this->fileStatus = FILE_STATUS_OLD; - } - } - } - // Ce imamo vnos uporabnika nastavimo status na ni datoteke - elseif ((int)$this->max_usr_time > 0) { - - $this->fileStatus = FILE_STATUS_NO_FILE; - - # preverimo obstoj header datoteke - if (file_exists($this->folder . 'export_header_'.$this->sid.'.dat')) { - - # če datoteka obstaja, nastavimo status na stari podatki - if (file_exists($this->folder . 'export_data_'.$this->sid.'.dat')) { - $this->fileStatus = FILE_STATUS_OLD; - # če so podatki up to date nastavimo status na OK - if ((int)$this->data_file_time == (int)$this->max_usr_time && (int)$this->max_usr_time > 0) { - $this->fileStatus = FILE_STATUS_OK; - } - } - } - } - } else { - # Anketa je izbrisana - $this->fileStatus = FILE_STATUS_SRV_DELETED; - } - - } - - // Preverimo ce imamo vklopljen filter na uporabnost in ce imamo v headerju zapisan stolpec za usability (drugace moramo generirati datoteko na novo) - public function checkUsability(){ - - // Preverimo ce imamo vklopljen filter na usability - if(SurveyStatusProfiles::usabilitySettings()){ - - // Preverimo ce imamo usability stolpec v header datoteki - $usability = $this->getHeaderVariable('usability'); - if($usability == null){ - $this->clearSurveyDataFiles(); - } - } - } - - // Preverimo ce imamo testne podatke na novo -> potem moramo generirati datoteko na novo - public function checkTestData(){ - - # test data - $str_qry_cnt_testdata = "SELECT count(*) FROM srv_user AS u WHERE u.ank_id = '".$this->sid."' AND preview='0' AND (u.testdata = '1' OR u.testdata = '2') AND u.deleted = '0'"; - $_qry_cnt_testdata = sisplet_query($str_qry_cnt_testdata); - list($has_test_data) = mysqli_fetch_row($_qry_cnt_testdata); - - $this->has_test_data = $has_test_data > 0 ? true : false; - - // Preverimo ce prej nismo imeli testnih podatkov - $settings = $this->getHeaderVariable('_settings'); - if($settings['hasTestData'] != 1 && $this->has_test_data){ - $this->clearSurveyDataFiles(); - } - } - - public function getStatus() { - - if ($this->fileStatus != null) { - return $this->fileStatus; - } else { - $this->checkFileStatus(); - } - return $this->fileStatus; - } - - public function getFiles($logClass = null) { - global $site_url, $lang, $site_path; - - # pobrišemo izbrisane userje - $this->deleteUsers(); - - $crf = $this->checkRealFile(); - - SurveyTrackIncremental::write($this->sid,'getFiles: STATUS: => '. $this->fileStatus); - - if ( $this->fileStatus == FILE_STATUS_OK ) { - return true; - } - - # če datoteke še ni ali če je stara - if ( $this->fileStatus == FILE_STATUS_NO_FILE || $this->fileStatus == FILE_STATUS_OLD ) { - - if ($this->fileStatus != FILE_STATUS_NO_FILE && (int)$this->data_file_time > 0 && file_exists($this->data_file_name)) { - SurveyTrackIncremental::write($this->sid,'getFiles: OLD! => '."$crf[result],$crf[file],$crf[db]"); - # delamo inkremental - $inkremental_user_limit = " AND u.time_edit > FROM_UNIXTIME('".(int)$this->data_file_time."') "; - } else { - #forsamo status no file - $this->fileStatus == FILE_STATUS_NO_FILE; - - # lovimo vse userje - datoteko generiramo na novo - SurveyTrackIncremental::write($this->sid,'getFiles: NO FILE! => '."$crf[result],$crf[file],$crf[db]"); - $inkremental_user_limit = ''; - } - - $str_qry_usr_cnt = "SELECT count(u.id) FROM srv_user AS u WHERE u.ank_id = '".$this->sid."' AND u.preview='0' AND u.deleted='0' ".$this->is_valid_user_limit.$inkremental_user_limit; - $qry_usr_cnt = sisplet_query($str_qry_usr_cnt); - list($user_cnt) = mysqli_fetch_row($qry_usr_cnt); - - SurveyTrackIncremental::write($this->sid,'getFiles: New user count=> '.(int)$user_cnt); - - if ((int) $user_cnt == 0) { - SurveyTrackIncremental::write($this->sid,'getFiles: no new user! Is this true realy??? Check line above!!!'); - return; - } - # pozenemo generiranje datoteke - if ($this->fileStatus == FILE_STATUS_OLD && $this->skipCreate == true) { - # ne posodabljamo - SurveyTrackIncremental::write($this->sid,'getFiles: Skip creating.'); - } else { - if ($this->_force_quick_create == true ) { - SurveyTrackIncremental::write($this->sid,'getFiles: ForceQuickCreate.'); - # če vsilimo hitro kreiranje - $lock = new ExclusiveLock( "survey_lock_".$this->sid, FALSE); - if( $lock->lock( ) == FALSE ) { - SurveyTrackIncremental::write($this->sid,'LOCK: alreadyLocked for survey: '.$this->sid); - $this->writeLockMessage($lock->getLockDate()); - #error("Locking failed"); - } else { - $CH = (int)$this->createHeadFile(); - $CD = (int)$this->createDataFile(); - $autoCreate = ($CH == true && $CD == true); - } - $lock->unlock(); - } else if ((int)$user_cnt < AUTO_CREATE_LIMIT ) { - SurveyTrackIncremental::write($this->sid,'getFiles: AutoCreateWithOutProgressBar.'); - $lock = new ExclusiveLock( "survey_lock_".$this->sid, FALSE); - if( $lock->lock( ) == FALSE ) { - SurveyTrackIncremental::write($this->sid,'LOCK: alreadyLocked for survey: '.$this->sid); - $this->writeLockMessage($lock->getLockDate()); - #error("Locking failed"); - } else { - # če je uporabnikov malo, jih dodamo brez progressbara - $CH = (int)$this->createHeadFile(); - $CD = (int)$this->createDataFile(); - $autoCreate = ($CH == true && $CD == true); - } - $lock->unlock(); - } else { - # preverimo ali je kreacija že v teku, nato še 1x polovimo statuse ankete - # morda je bilo zagnano z drugom browserjem, in je medtem prišlo do spremembe v datoteki - $lock = new ExclusiveLock( "survey_lock_".$this->sid, FALSE); - if( $lock->lock( ) == FALSE ) { - SurveyTrackIncremental::write($this->sid,'LOCK: alreadyLocked for survey: '.$this->sid); - $this->writeLockMessage($lock->getLockDate()); - #error("Locking failed"); - } else { - # še 1x preverimo datoteko za vsak slučajm če je morda procedura čakala zaradi lock-a iz drugega browserja - $this->checkFileStatus(); - SurveyTrackIncremental::write($this->sid,'Status checked once again!'); - if ($this->fileStatus == FILE_STATUS_OK) { - # lahko da je vmes druga procedura uspešno končala. zato vrnemo da je vse ok. - SurveyTrackIncremental::write($this->sid,'Status changed to OK!'); - return true; - } - - # kdaj je bio nazadnje updejtano - $u = strtotime($this->last_update); - # zaradi konsistentnosti polovimo trenutni čas z mysql-om - $qry = sisplet_query("SELECT NOW()"); - list($_now) = mysqli_fetch_row($qry); - $n = strtotime($_now); - - # ugotovimo razliko v sekundah - $diff = (int)($n-$u); - # ne pustimo konstantnega osveževanja - največ na 60 s - if ($diff > AUTO_CREATE_TIME_LIMIT || $this->fileStatus == FILE_STATUS_NO_FILE) { - SurveyTrackIncremental::write($this->sid,'getFiles: AutoCreateWithProgressBar. Calling AJAX!'); - $autoCreate = $this->showAutoCreateIncrementalFile(); - } else { - SurveyTrackIncremental::write($this->sid,'getFiles: Skip creating due time limit.'.$diff); - # echo 'Posodobljeno: '.date('d.m.Y h:i:s', strtotime($this->last_update)); - } - } - } - } - $this->checkFileStatus(); - return $autoCreate; - } - - return; - } - - public function setCollectMassive($isMasive = false) { - $this->isCollectingMassive = $isMasive; - } - - public function setForeceQuickCreate($force_quick_create = false) { - $this->_force_quick_create = $force_quick_create; - } - - public function getFilesMassive($logClass = null) { - global $site_url, $lang, $site_path; - - # pobrišemo izbrisane userje - $this->deleteUsers(); - - $crf = $this->checkRealFile(); - - SurveyTrackIncremental::write($this->sid,'this->getFilesMassive -> status'.(int)$this->fileStatus); - SurveyTrackIncremental::write($this->sid,'Check file result:'."$crf[result],$crf[file],$crf[db]"); - - if ( $this->fileStatus == FILE_STATUS_OK ) { - return true; - } - - # če datoteke še ni ali če je stara - if ( $this->fileStatus == FILE_STATUS_NO_FILE || $this->fileStatus == FILE_STATUS_OLD ) { - - try { - $lock = new ExclusiveLock( "survey_lock_".$this->sid, FALSE); - if( $lock->lock( ) == FALSE ) { - SurveyTrackIncremental::write($this->sid,'LOCK: alreadyLocked for survey: '.$this->sid); - $this->writeLockMessage($lock->getLockDate()); - #error("Locking failed"); - } else { - # pozenemo generiranje datoteke - $CH = (int)$this->createHeadFile(); - $CD = (int)$this->createDataFile(); - $this->checkFileStatus(); - $autoCreate = ($CH == true && $CD == true); - } - $lock->unlock(); - - return $autoCreate; - } catch (Exception $e) { - if ($logClass != null) { - SurveyTrackIncremental::write($this->sid,'getFilesMassive() Exception:'.$e->getMessage()); - } - } - } - return; - } - - public function testFilesMassive($logClass = null) { - global $site_url, $lang, $site_path; - - $SL = new SurveyLog(); - $SL->addMessage(SurveyLog::INFO, " -".$this->sid." FS->".(int)$this->fileStatus); - $SL->write(); - - return (int)$this->fileStatus; - } - - public function resetDataFile() { - if ($this->sid > 0) { - # pobrišemo zapis v bazi - $qstr = "DELETE FROM srv_data_files WHERE sid = '".$this->sid."'"; - $qry = sisplet_query($qstr); - $qry = sisplet_query("COMMIT"); - - # odstranimo sejo - session_start(); - - $_SESSION['incrementalProgressBar'][$this->sid] = null; - unset($_SESSION['incrementalProgressBar'][$this->sid]); - session_commit(); - - #pobrišemo še vse datoteke - $this->clearSurveyDataFiles(); - } - } - - public function showAutoCreateIncrementalFile() { - - global $lang; - - # da ne podvajamo skripte za kreiranje datoteke - if ($this->skipCreate == true) { - return false; - } - - echo '
    '; - - #TODO!!! dodati povezavo do resetiranja kompletne datoteke s podatki, naj pobriše iz baze, datoteko, in sejo - echo $lang['srv_incremental_in_progress'].'
    '; - echo '
    '; - echo ''.$lang['srv_incremental_start_note'].''; - echo '
     
    '; - echo '
    '; - echo '
    '; - echo '
    '; - echo '
    '.$lang['srv_incremental_all_reccords'].''.$lang[''].'Zbiram osnovne podatke. Prosim počakajte...
    '; - echo '
    '.$lang['srv_incremental_current_reccords'].'...
    '; - echo '
    '.$lang['srv_incremental_left_reccords'].'...
    '; - echo '
    '; - - global $admin_type; - - # če je admin ponudimo možnost resetiranja - if ($admin_type == '0') { - echo '

    '.$lang[''].'V primeru težav, oziroma v kolikor se skripta za dlje časa ustavi, poženite ponovno generiranje: tukaj'; - } - - echo '
    '; - - ?> - - skipCreateIfInProgress() == true) { - return false; - } - # nastavimo status da smo v kreiranju - $this->setStartInProgress('header'); - - $result = false; - # pripravimo ime header datoteke - $head_file_name = $this->folder . 'export_header_'.$this->sid.'.dat'; - - $need_new_head_file = false; - - # če je head deatoteka že bila kreirana - if ( (int)$this->max_anketa_time > 0 && $this->max_anketa_time == $this->head_file_time ) { - # ali datoteka fizično obstaja - if (!file_exists($head_file_name)) { - #head datoteka ne obstaja potrebno je kreirat novo - $need_new_head_file = true; - } - } else { - # datoteka še ni bila kreirana - $need_new_head_file = true; - # pobrišemo morebitne predhodne datoteke ankete - $this->clearSurveyDataFiles(); - } - - # head file is old, need to create new - if ($need_new_head_file == true) { - $this->_HEADER = null; # za vsak slučaj - - $this->create_qry_questions(); # ne sme bit '' - $this->get_qry_groups(); - - # polovimo podatke loopa - $this->collectLoop(); - - if ( $this->_str_questions !== '') { - $this->CollectHeaders(); - - #zapišemo header datoteko - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hs'] = 99; - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = 1; - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = 1; - session_commit(); - file_put_contents($head_file_name, serialize($this->_HEADER)); - unset($this->_HEADER); - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hs'] = 100; - session_commit(); - - if ($this->noErrors) { - #updejtamo zapis v bazi - # data time damo na 0 ker moramo datoteko s podatki zgenerirati čisto na novo. - $str_qry_exist_files_update = "INSERT INTO srv_data_files (sid, head_file_time, data_file_time) VALUES ('".$this->sid."',FROM_UNIXTIME('".$this->max_anketa_time."'), '0000-00-00') ON DUPLICATE KEY UPDATE head_file_time = FROM_UNIXTIME('".$this->max_anketa_time."'), data_file_time = '0000-00-00'"; - $updated = sisplet_query($str_qry_exist_files_update); - sisplet_query("COMMIT"); - if ($updated) { - $result = true; - } else { - $this->trigerError('updateHeader', $str_qry_exist_files_update . " ".mysqli_error($GLOBALS['connect_db'])); - $result = false; - } - } - } else { - $this->trigerError('createHeaderFile', 'Not set this->survey[edit_header_time] ('.$this->sid.')'); - $result = false; - } - - } else { - if ((int)$this->max_anketa_time > 0) { - # Head file is ok! - $result = true; - } else { - # survey time error! - $this->trigerError('createHeaderFile', 'Survey time error this->survey[edit_header_time] ('.$this->sid.')'); - $result= false; - } - } - $this->setStopInProgress('header'); - return $result; - } - - public function createDataFile() { - SurveyTrackIncremental::write($this->sid,'createDataFile()'); - - # če je generacija že v teku ne pustimo ponovnega zagona - if ($this->skipCreateIfInProgress() == true) { - SurveyTrackIncremental::write($this->sid,'createDataFile()->skipCreateIfInProgress'); - return false; - } - # nastavimo status da smo v kreiranju - $this->setStartInProgress('data'); - - $result = false; - - # ali moramo dodati userje v datoteko - $need_new_data = false; - - # pripravimo ime data datoteke - $data_file_name = $this->folder . 'export_data_'.$this->sid.'.dat'; - - if ((int)$this->data_file_time > 0) { - if ((int)$this->data_file_time != (int)$this->max_usr_time) { - # potrebno je dodati userje - $need_new_data = true; - } - } else { - # imeli smo spremembo v head datoteki, ali pa userjev še nismo dodajali, pobrišemo morebitno data datoteko - $this->clearSurveyDataFiles($data_file_name); #samo z podatki - # potrebno je dodati userje - $need_new_data = true; - } - - - # če moramo dodati userjSe v datoteko - if ($need_new_data == true) { - - #pobrišemo še morebitne prazne vrstice - if (IS_WINDOWS) { - $cmd1 = 'sed "/^$/d" '.$this->data_file_name.' > '.$this->data_file_name.'.empt && mv '.$this->data_file_name.'.empt '.$this->data_file_name; - } else { - $cmd1 = 'sed \'/^$/d\' '.$this->data_file_name.' > '.$this->data_file_name.'.empt && mv '.$this->data_file_name.'.empt '.$this->data_file_name; - } - $out_command1 = shell_exec($cmd1); - if (file_exists($this->data_file_name.'.empt')) { - unlink($this->data_file_name.'.empt'); - } - - SurveyTrackIncremental::write($this->sid,'createDataFile() -> adding new data: true'); - # naredimo aray z query-i/ string-i vseh uporabnikov ( naredimmo v loopih, da ne pride out_of memory) - $this->create_qry_users(); - - # preverimo ali datoteka obstaja in ali že imamo zapise da prilagodimo line seperator - $this->new_line_seperator = null; - - $lines = $this->getLinesCnt(); - - if ((int)$lines > 0) { - $this->new_line_seperator = NEW_LINE; - } - - # datoteko pripravimo za dodajanje - $file_handler = fopen($data_file_name,"a"); - - $this->create_qry_questions(); # ne sme bit '' - $this->get_qry_groups(); - - // Randomizacija v blokih in vprasanjih - $this->get_array_random(); - - # naredimo pointerje na podatke če še ne obstajajo - $this->create_array_vrednosti(); # za vrednosti ankete - $this->create_array_gridi(); # za gride ankete - $this->create_array_SPSS(); # skreira array z polji za spss - - $_array_vrednosti = $this->get_array_vrednosti(); # za vrednosti ankete - $_array_gridi = $this->get_array_gridi(); # za vrednosti ankete - - if ($this->noErrors) { - SurveyTrackIncremental::write($this->sid,'createDataFile()->No errors so far! :)'); - - # zloopamo skozi vprašanja - if ($this->_cnt_questions > 0) { - mysqli_data_seek($this->_qry_questions, 0); - } - $_tmpCnt = 0; - - # polovimo podatke loopa - $this->collectLoop(); - - # skreiramo vrstni red vprašanj - $this->createAllQuestionsOrder(); - - # polovimo missing vrednosti če so nastavljene drugače kot privzeto - #TODO če uporabnik na anketi spremeni da naj bo -1 -6 se to ne upošteva. - $this->setSurveyMissingValues(); - - # v loopu dodamo podatke v data file - if ($this->noErrors && count($this->_str_users) > 0) { - if ($this->isCollectingMassive == false ) { - #updejtamo status - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['current'] = 0; - $_SESSION['incrementalProgressBar'][$this->sid]['total'] = $this->_cnt_all_users; - session_commit(); - } - foreach ($this->_str_users AS $c => $string_user) { - - # resetiramo POINTER-je - Array-je do podatkov - $this->_qry_data_vrednost = null; - $this->_array_data_vrednost = null; - $this->_qry_data_text = null; - $this->_array_data_text = null; - $this->_qry_data_grids = null; - $this->_array_data_grids = null; - $this->_qry_data_check_grids = null; - $this->_array_data_check_grids = null; - $this->_qry_data_number = null; - $this->_array_data_number = null; - $this->_qry_data_rating = null; - $this->_array_data_rating = null; - $this->_qry_data_text_grid = null; - $this->_array_data_text_grid = null; - $this->_qry_data_vrednost_cond = null; - $this->_array_data_vrednost_cond = null; - $this->_qry_data_map = null; - $this->_array_data_map = null; - $this->_qry_data_heatmap = null; - $this->_qry_data_heatmap_regions = null; - $this->_array_data_heatmap = null; - $this->_array_data_heatmap_regions = null; - $this->_qry_data_random = null; - $this->_array_data_random = null; - - # polovimo id-je strani do katerih je prišel posamezen uporabnik - $this->create_array_user_grupa($string_user); - - # naredimo vse potrebne querije v pointerje - $this->create_array_data_vrednost($string_user); - $this->create_array_data_text($string_user); - $this->create_array_data_grids($string_user); - $this->create_array_data_check_grids($string_user); - $this->create_array_data_number($string_user); - $this->create_array_data_rating($string_user); - $this->create_array_data_text_grid($string_user); - $this->create_array_data_text_upload($string_user); - $this->create_array_data_vrednost_cond($string_user); - $this->create_array_data_map($string_user); - $this->create_array_data_heatmap($string_user); - $this->create_array_data_heatmap_regions($string_user); - $this->create_array_data_random($string_user); - - if ($this->noErrors) { - $this->CollectData($c,$file_handler); - } - } - } else { - SurveyTrackIncremental::write($this->sid,'createDataFile()->some errors: ucount:'.(int)count($this->_str_users)); - if ($this->noErrors == false) { - $SL = new SurveyLog(); - $SL->addMessage(SurveyLog::ERROR, ' ---> SCD::creatingData file failed! ($this->noErrors == false) (sid:'.$this->sid.')'); - $SL->write(); - } - } - - #preverimo da res ni prišlo do napak - if ($this->noErrors) { - SurveyTrackIncremental::write($this->sid,'createDataFile() last_user_time:'.$this->last_usr_time); - SurveyTrackIncremental::write($this->sid,'createDataFile() max_user_time:'.$this->max_usr_time); - $strSel = "SELECT count(*) FROM srv_data_files WHERE sid = '$this->sid'"; - $qrySel = sisplet_query($strSel); - list($cntSel) = mysqli_fetch_row($qrySel); - - if ($cntSel > 0) { - $str_qry = "UPDATE srv_data_files SET data_file_time = FROM_UNIXTIME('".$this->max_usr_time."'), last_update = NOW() WHERE sid = '".$this->sid."'"; - $updated = sisplet_query($str_qry); - sisplet_query('COMMIT'); - } else { - $str_qry = "INSERT INTO srv_data_files (sid, data_file_time, last_update ) VALUES ('".$this->sid."',FROM_UNIXTIME('".$this->max_usr_time."'), NOW())"; - $updated = sisplet_query($str_qry); - sisplet_query('COMMIT'); - } - - if ($updated) { - $result = true; - SurveyTrackIncremental::write($this->sid,'createDataFile()->Mysql Write Success! RESULT:'.(int)$result ); - } else { - $result = false; - SurveyTrackIncremental::write($this->sid,'createDataFile()->ERROR! Mysql Write Error! RESULT:'.(int)$result); - $this->trigerError('updateDataSql', 'MYSQL ERROR in qry: '.$str_qry_exist_files_update . " ".mysqli_error($GLOBALS['connect_db'])); - } - } - #$this->logClass->write(); - } else { - SurveyTrackIncremental::write($this->sid,'createDataFile()->Errors! :('); - } - - # zapremo datoteko - if ($file_handler !== null) { - fclose($file_handler); - - // Se enkrat izvedemo generiranje ce imamo filter za uporabnost (ker ga racunamo na podlagi ze obstojece datoteke) - if (SurveyStatusProfiles::usabilitySettings()) { - $SUR = new SurveyUsableResp($this->sid, $generateDataFile=true); - - // Resetiramo status filter (da izracunamo za vse enote) - $SUR->setStatusFilter($status_filter=''); - - // Izracunamo uporabnost za vsako enoto - $usability = $SUR->calculateData(); - - $file_handler_old = fopen($data_file_name,"r"); - - $data_file_name_new = $this->folder . 'export_data_'.$this->sid.'_2.dat'; - $file_handler_new = fopen($data_file_name_new,"a"); - - // Beremo datoteko vrstico po vrstico - $cnt = 1; - while (($line = fgets($file_handler_old)) !== false) { - - // dodamo vrstici na koncu uporabnost - $usability_status = (isset($usability['data'][$cnt]['status'])) ? $usability['data'][$cnt]['status'] : 0; - $line = str_replace($this->new_line_seperator, '', $line); - $line .= STR_DLMT . $usability_status; - - fwrite($file_handler_new, $line . $this->new_line_seperator); - - $cnt++; - } - - fclose($file_handler_old); - fclose($file_handler_new); - - // Pobrisemo staro datoteko - unlink($file_handler_old); - - // Preimenujemo novo datoteko - rename($data_file_name_new, $data_file_name); - } - } - - # če datoteka s pod atki ne obstaja nastavimo filestatus na 0, če ne pa na 1 - $data_file_name = $this->folder . 'export_data_'.$this->sid.'.dat'; - if (file_exists($data_file_name)) { - $fileStatus = 1; - $this->fileStatus = FILE_STATUS_OK; - } else { - $fileStatus = 0; - } - } - - if ($this->isCollectingMassive == false) { - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['current'] = $_SESSION['incrementalProgressBar'][$this->sid]['total']; - $_SESSION['incrementalProgressBar'][$this->sid]['fileStatus'] = (int)$fileStatus; - $_SESSION['incrementalProgressBar'][$this->sid]['status'] = 0; - session_commit(); - } - - #echo number_format(memory_get_usage() / 1024) . " KB (before cleanup data)
    "; - # naredimo še cleanup - $this->cleanup(); - - # nastavimo status da smo končali kreiranje - $this->setStopInProgress('data'); - return $result; - } - - - /** - * Vsako spremenljivko shranimo pod svojim ID-jem - * spremenljivka ima enega ali več gridov ( odviso od dimenzi: eno=>(radio, check, vsota...) multi=>(multigrid, multicheck, multibox) - * vsak grid pa lahko ima eno ali več variabel (odgovor, tekstovni odgovor... ) - * - * vse skupaj shranjujemo v urejenem arrayu - * HEADERS[SPR_ID] => array( tip => tip variable - * variable => ime Variable - * naslov => Naslov variable - * cnt_grids => koliko je gridov - * grids[ID] => array( - * variables[ID] => array(variable => ime variable - * naslov => naslov variable - * other => ali je polje drugo - * text => ali je tekstovni odgovor - * spss => polje za spss - * ) - * ) - * ) - */ - public function CollectHeaders() { - global $lang; - global $admin_type; - - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['total'] = $this->_cnt_all_users; - session_commit(); - - # v header dodomo userid - $sequence = 1; # vodimo zaporedno števiko polja v bazi - $_data_sequence = 1; # vodimo zaporedno števiko polja v bazi kjer se začnejo "resni" podatki - - # dodamo dodatne nastavitve - if ((int)$this->collect_all_status > 0) { - # vse statuse - $_HEADER['_settings']['collectAllStatus'] = '1'; - } else { - # samo statuse 6 in 5 - $_HEADER['_settings']['collectAllStatus'] = '0'; - } - - if ($this->has_test_data == true) { - # ali vsebuje test data - $_HEADER['_settings']['hasTestData'] = '1'; - } else { - $_HEADER['_settings']['hasTestData'] = '0'; - } - if ($this->collect_full_meta == true) { - # ali vsebuje Meta data - $_HEADER['_settings']['collectFullMeta'] = '1'; - } else { - $_HEADER['_settings']['collectFullMeta'] = '0'; - } - if ($this->force_show_hiden_system == true) { - # ali vsebuje Meta data - $_HEADER['_settings']['force_show_hiden_system'] = '1'; - } else { - $_HEADER['_settings']['force_show_hiden_system'] = '0'; - } - # count normal variables - preštejemo normalne variable, ki niso sistemske kot je email, ime.... in se v podatkih prikazujejo normalno - $_HEADER['_settings']['count_normal_data_variables'] = 0; - # count system variables - preštejemo sistemske kot je email, ime.... in se v podatkih ne smejo prikazovat - $_HEADER['_settings']['count_system_data_variables'] = 0; - - # user ID - $_HEADER['uid']= array ('tip'=>'m', 'variable'=>'uid', 'naslov' =>'User ID', - 'grids' => array(0 => Array('variables'=>array(0 => Array ('variable'=>'uid', 'naslov'=>'User ID','spss'=>'F11.0','sequence'=>$sequence)) - ,'naslov'=>'uid','cnt_vars' => 1))); - $_HEADER['uid']['sequences'] = $sequence; - $sequence++; - $_data_sequence++; - - # ustreznost uporabnika - $_HEADER['relevance']= array ('tip'=>'m', 'variable'=>'relevance', 'naslov' =>$lang['srv_data_relevance'], - 'grids' => array(0 => Array('variables'=>array(0 => Array ('variable'=>'relevance', 'naslov'=>$lang['srv_data_relevance'],'spss'=>'F3.0','sequence'=>$sequence)) - ,'naslov'=>$lang['srv_data_relevance'],'cnt_vars' => 1))); - $_HEADER['relevance']['sequences'] = $sequence; - $sequence++; - $_data_sequence++; - - # EMAIL VABILO - invitation - $_HEADER['invitation']= array ('tip'=>'m', 'variable'=>'invitation', 'naslov' =>$lang['srv_data_invitation'], - 'grids' => array(0 => Array('variables'=>array(0 => Array ('variable'=>'invitation', 'naslov'=>$lang['srv_data_invitation'],'spss'=>'F3.0','sequence'=>$sequence)) - ,'naslov'=>$lang['srv_data_invitation'],'cnt_vars' => 1))); - $_HEADER['invitation']['sequences'] = $sequence; - $sequence++; - $_data_sequence++; - - # status uporabnika - $_HEADER['status']= array ('tip'=>'m', 'variable'=>'status', 'naslov' =>$lang['srv_data_status'], - 'grids' => array(0 => Array('variables'=>array(0 => Array ('variable'=>'status', 'naslov'=>$lang['srv_data_status'],'spss'=>'F3.0','sequence'=>$sequence)) - ,'naslov'=>$lang['srv_data_status'],'cnt_vars' => 1))); - $_HEADER['status']['sequences'] = $sequence; - $sequence++; - $_data_sequence++; - - # ali je uporabnik lurker - $_HEADER['lurker']= array ('tip'=>'m', 'variable'=>'lurker', 'naslov' =>$lang['srv_data_lurker'], - 'grids' => array(0 => Array('variables'=>array(0 => Array ('variable'=>'lurker', 'naslov'=>$lang['srv_data_lurker'],'spss'=>'F3.0','sequence'=>$sequence)) - ,'naslov'=>$lang['srv_data_lurker'],'cnt_vars' => 1))); - $_HEADER['lurker']['sequences'] = $sequence; - $sequence++; - $_data_sequence++; - - # - $_HEADER['unx_ins_date']= array ('tip'=>'m', 'variable'=>'unx_ins_date', 'naslov' =>'unx_ins_date', - 'grids' => array(0 => Array('variables'=>array(0 => Array ('variable'=>'unx_ins_date', 'naslov'=>'unx_ins_date','spss'=>'F20.0','sequence'=>$sequence)) - ,'naslov'=>'unx_ins_date','cnt_vars' => 1))); - $_HEADER['unx_ins_date']['sequences'] = $sequence; - $sequence++; - $_data_sequence++; - - $_HEADER['recnum'] = array('tip'=>'m', 'variable'=>'recnum', 'naslov' =>'Record number', - 'grids' => array(0 => Array('variables'=>array(0 => Array ('variable'=>'recnum','naslov'=>'Record number','spss'=>'F5.0','sortType'=>'number','sequence'=>$sequence)), - 'naslov'=>'recnum','cnt_vars' => 1))); - $_HEADER['recnum']['sequences'] = $sequence; - $sequence++; - $_data_sequence++; - - #dodamo geslo - code - if ($this->force_show_hiden_system == true) { - $_HEADER['code'] = array('tip'=>'m', 'variable'=>'code', 'naslov' =>'Geslo', - 'grids' => array(0 => Array('variables'=>array(0 => Array ('variable'=>'code','naslov'=>'Geslo','spss'=>'A6','sequence'=>$sequence)), - 'naslov'=>'Geslo','cnt_vars' => 1))); - $_HEADER['code']['sequences'] = $sequence; - $sequence++; - $_data_sequence++; - } - - # če vsebuje testne podatke dodamo tudi to polje - if ($this->has_test_data) { - $_HEADER['testdata']= array ('tip'=>'m', 'variable'=>'testdata', 'naslov' =>$lang['srv_data_test'], - 'grids' => array(0 => Array('variables'=>array(0 => Array ('variable'=>'testdata', 'naslov'=>$lang['srv_data_test'],'spss'=>'F3.0','sequence'=>$sequence)) - ,'naslov'=>$lang['srv_data_test'],'cnt_vars' => 1))); - $_HEADER['testdata']['sequences'] = $sequence; - $sequence++; - $_data_sequence++; - } - - # date insert (Meta) - $_HEADER['itime']= array ('tip'=>'m', 'variable'=>'itime', 'naslov' =>$lang['srv_data_date'], - 'grids' => array(0 => - Array('variables'=>array(0 => - Array ('variable'=>'itime', 'naslov'=>$lang['srv_data_date'],'spss'=>'DATETIMEw','sortType'=>'date','sequence'=>$sequence)) - ,'naslov'=>$lang['srv_data_date'],'cnt_vars' => 1))); - $_HEADER['itime']['sequences'] = $sequence; - $sequence++; - $_data_sequence++; - - - - # s katero sekvenco se začnejo podatki - $_HEADER['_settings']['dataSequence'] = $_data_sequence; - - # naredimo pointerje na podatke če še ne obstajajo - $this->create_array_vrednosti(); # za vrednosti ankete - $this->create_array_gridi(); # za gride ankete - $this->create_array_SPSS(); # skreira array z polji za spss - $_array_vrednosti = $this->get_array_vrednosti(); # za vrednosti ankete - $_array_gridi = $this->get_array_gridi(); # za vrednosti ankete - - // Randomizacija v blokih in vprasanjih - $this->get_array_random(); - - # zloopamo skozi vprašanja - if ($this->_cnt_questions > 0) { - mysqli_data_seek($this->_qry_questions, 0); - } - - $this->createAllQuestionsOrder(); - - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hs'] = 8; - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = count($this->AllQuestionsOrder); - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = 0; - session_commit(); - - $cntHs=0; - - // Stejemo loope za numeric vprasanje - $num_loop_cnt = array(); - - # dodamo vprašanja ki so v loopu - if ($this->noErrors && count($this->AllQuestionsOrder) > 0) { - foreach ($this->AllQuestionsOrder AS $_vprasanje_array) { - $cntHs++; - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = $cntHs; - session_commit(); - - # dodelimo vrednosti loopa - $rowVprasanje = $this->AllQuestionsData[$_vprasanje_array['id']]; - - // nastavimo vrstni red ce loopamo po numericu - $num_loop_cnt[$_vprasanje_array['id']]++; - - # spremenljivki dodamo loop_id da je konsistentno z podatki - $rowVprasanje['spr_id'] = $rowVprasanje['spr_id'].'_'.$_vprasanje_array['loop_id']; - // $rowVprasanje['loop_id'] = $_vprasanje_array['loop_id']; - $_vrednosti = $this->get_array_vrednosti($this->_array_loop_on_spr[$rowVprasanje['if_id']]); - $_loop_vrednost = $this->_array_vre_on_loop[$rowVprasanje['if_id']][$_vprasanje_array['loop_id']]; - // $rowVprasanje['loop_vre_id'] = $_loop_vrednost; - - $spr_id = $rowVprasanje['spr_id']; - $vrednostLoopSufix = ''; - # popravimo ime variable če smo v loopu - if(isset($this->_array_vre_on_loop[$rowVprasanje['if_id']][$_vprasanje_array['loop_id']])) { - - // Posebej obravnavamo loop po numeric vprasanju - samo nastavimo suffix _1, _2... - if($this->_array_vre_on_loop[$rowVprasanje['if_id']][$_vprasanje_array['loop_id']] == 'num_loop'){ - $rowVprasanje['variable'] = strip_tags($rowVprasanje['variable'])."_".$num_loop_cnt[$_vprasanje_array['id']]; - } - else{ - # id spremenljivke po kateri loopamo - $_loop_on_spr_id = $this->_array_loop_on_spr[$rowVprasanje['if_id']]; - #variabla spremenljivke po kateri loopamo - $_loop_on_spr_variable = $this->AllQuestionsData[$_loop_on_spr_id]['variable']; - # id variable po kateri loopamo (v okviru $_loop_on_spr_id) - $_loop_on_variable_id = $_vrednosti[$_loop_vrednost]; - # naslov variable po keteri loopamo (v okviru $_loop_on_spr_id) - $_vrednost_naslov = $_array_vrednosti[$_loop_on_spr_id][$_loop_on_variable_id['id']]['naslov']; - $rowVprasanje['variable'] = strip_tags($rowVprasanje['variable'])."_".$_vrednosti[$_loop_vrednost]['variable']; - $vrednostLoopSufix = "_".$_vrednosti[$_loop_vrednost]['variable']; - if ($_vrednost_naslov != '' && $_loop_on_spr_variable != '' && $rowVprasanje['naslov'] != '') { - # zamenjamo ime spremenljivke med #q1# (#q1# z naslovom trenutne variable) - $rowVprasanje['naslov'] = str_replace("#$_loop_on_spr_variable#", "$_vrednost_naslov", $rowVprasanje['naslov']); - } - } - } - - # pomožne variable - $tip = $rowVprasanje['tip']; - $_tmp_spr_id = explode('_',$rowVprasanje['spr_id']); - $spr_id = $_tmp_spr_id[0]; - $spr_data_id = $rowVprasanje['spr_id']; - - // Pri kalkulaciji izpisemo labelo v imenu, ce jo imamo - $spr_naslov = ($tip == '22' && $rowVprasanje['label'] != '') ? strip_tags($rowVprasanje['label']) : strip_tags($rowVprasanje['naslov']); - - $spr_naslov_graf = strip_tags($rowVprasanje['naslov_graf']); - $spr_edit_graf = $rowVprasanje['edit_graf']; - $spr_wide_graf = $rowVprasanje['wide_graf']; - $spr_antonucci = $rowVprasanje['antonucci']; - $spr_variable = strip_tags($rowVprasanje['variable']); - $spr_size = $rowVprasanje['size']; - $spr_cela = $rowVprasanje['cela']; - $grid_subtitle1 = $rowVprasanje['grid_subtitle1']; - $grid_subtitle2 = $rowVprasanje['grid_subtitle2']; - $spr_decimalna = $rowVprasanje['decimalna']; - $spr_skala = $rowVprasanje['skala']; - $spr_sistem = $rowVprasanje['sistem']; - $spr_upload = $rowVprasanje['upload']; - $spr_signature = $rowVprasanje['signature']; - $spr_random = $rowVprasanje['random']; - - #!!! po novem tako ali tako število znakov za spss lovimo iz datoteke s podatki - - # TODO $spss_lngth mora biti enak za vse in sicer je enak največjemu možnemu številu znakov - # TODO zato je potrebno zdužit vse ($spss_lngth, $spss_lngth2, $spss_lngth3) - $spss_lngth = $this->_array_SPSS[$spr_id]['text']; - $spss_lngth2 = $this->_array_SPSS[$spr_id]['text2']; - $spss_lngth3 = isset($this->_array_SPSS[$spr_id]['vrednost']) && $this->_array_SPSS[$spr_id]['vrednost'] != '' ? $this->_array_SPSS[$spr_id]['vrednost'] : 0; - - $_HEADER[$spr_data_id] = array('spr_id'=>$spr_id, 'tip'=>$tip, 'variable'=>$spr_variable, 'naslov'=>$spr_naslov, 'sistem'=>$spr_sistem, 'skala'=>$spr_skala, 'naslov_graf'=>$spr_naslov_graf, 'edit_graf'=>$spr_edit_graf, 'wide_graf'=>$spr_wide_graf); - # kontrola sistemskih skritih spremenljivk - # kadar ne vsilimo prikaza sistemskih spremenljivk (lahko omogoči le admin) - if ($this->force_show_hiden_system == false - && $spr_sistem == '1' - && in_array($spr_variable,unserialize (SYSTEM_VARIABLES)) # unserialize (SYSTEM_VARIABLES) -> definition.php = array('email','telefon','ime','priimek','naziv','drugo') - # pri formi ali glasovanjzu prikazujemo tudi sistemske - && ( $this->survey['survey_type'] != 1 && $this->survey['survey_type'] != 0)) { - - $_HEADER[$spr_data_id]['hide_system'] = '1'; - - # povečamo števec sistemskih variabel - $_HEADER['_settings']['count_system_data_variables'] ++; - } else { - # povečamo števec normalnih - $_HEADER['_settings']['count_normal_data_variables'] ++; - } - - # če je sistemska variabla jo označimo - if (in_array($spr_variable,unserialize (SYSTEM_VARIABLES))) { - $_HEADER[$spr_data_id]['is_system'] = '1'; - } - - if ( $spr_upload == '1' || $spr_upload == '2') { - $_HEADER[$spr_data_id]['upload'] = '1'; - } - - if ( $spr_signature == '1' ) { - $_HEADER[$spr_data_id]['signature'] = '1'; - } - - if (isset($rowVprasanje['enota']) && $rowVprasanje['enota'] > 0) { - $_HEADER[$spr_data_id]['enota'] = $rowVprasanje['enota']; - } - - # dodoamo loop parent - if (isset($rowVprasanje['loop_parent']) && $rowVprasanje['loop_parent'] > 0) { - $_HEADER[$spr_data_id]['loop_parent'] = $rowVprasanje['loop_parent']; - $_HEADER[$spr_data_id]['antonucci'] = $rowVprasanje['antonucci']; - } - - # dodoamo parent loop id - if (isset($_vprasanje_array['parent_loop_id']) && $_vprasanje_array['parent_loop_id'] > 0) { - $_HEADER[$spr_data_id]['parent_loop_id'] = $_vprasanje_array['parent_loop_id']; - } - # Dodamo še loop id - $_HEADER[$spr_data_id]['loop_id'] = $_vprasanje_array['loop_id']; - - $_GRIDS = array(); - $_seq_prefix = ''; - $_sequences = ''; - - // v odvisnosti od tipa vprašanja pohandlamo podatke - switch ( $tip ) { - - # RADIO - case 1: - # DROPDOWN - case 3: - $cnt=0; - # dodamo header variable - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>null, 'naslov'=>$spr_naslov, 'variable'=>$spr_variable, 'other'=>false,'text'=>false,'spss'=>'F'.$spss_lngth3.'.0','sequence'=>$sequence); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - $arrayVrednost = $_array_vrednosti[$spr_id]; - - if (count($arrayVrednost)>0) { - foreach ($arrayVrednost as $kid=> $vrednost) { - # dodamo še eno polje za tekstovne odgovore drugo - if ($vrednost['other'] == 1) { - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>$vrednost['id'],'naslov'=>$vrednost['naslov'], - 'variable'=>$spr_variable.'_'.$vrednost['vrstni_red'].STR_OTHER_TEXT, 'other'=>true,'text'=>true,'spss'=>'A'.$spss_lngth,'sequence'=>$sequence,'naslov_graf'=>$vrednost['naslov_graf']); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - $_GRIDS[0]['cnt_other'] += 1; - } // end if - #dodamo opcije (za spss) - if ($vrednost['other'] == 0 || $vrednost['other'] == 1) { - $_HEADER[$spr_data_id]['options'][$vrednost['variable']] = ($vrednost['naslov'] != null) ? $vrednost['naslov'] : $vrednost['variable']; - $_HEADER[$spr_data_id]['options_graf'][$vrednost['variable']] = ($vrednost['naslov_graf'] != null) ? $vrednost['naslov_graf'] : $_HEADER[$spr_data_id]['options'][$vrednost['variable']]; - } - } // end foreach - - } // end if - - $_GRIDS[0]['cnt_vars'] = $cnt; - $_GRIDS[0]['naslov'] = $spr_variable; - $_HEADER[$spr_data_id]['cnt_grids'] = 1; - $_HEADER[$spr_data_id]['cnt_all'] = $cnt; - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - - if (isset($rowVprasanje['inline_edit'])) $_HEADER[$spr_data_id]['inline_edit'] = $rowVprasanje['inline_edit']; - break; - - - # CHECKBOX - case 2: - $arrayVrednost = $_array_vrednosti[$spr_id]; - $cnt=0; - if (count($arrayVrednost)>0) { - foreach ($arrayVrednost as $vrednost) { - - # dodamo header variable samo za ne -missing variable - if ($vrednost['other'] == 0 || $vrednost['other'] == 1) { - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>$vrednost['id'], 'naslov'=>$vrednost['naslov'], 'variable'=>$vrednost['variable'].$vrednostLoopSufix, 'other'=>false,'text'=>false,'spss'=>'F'.$spss_lngth3.'.0','sequence'=>$sequence,'naslov_graf'=>$vrednost['naslov_graf']); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - #dodamo še header za polja drugo - if ($vrednost['other'] == 1) { - // dodamo v array 'variables' - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>$vrednost['id'], 'naslov'=>$vrednost['naslov'], 'variable'=>$vrednost['variable'].$vrednostLoopSufix.STR_OTHER_TEXT, 'other'=>true,'text'=>true,'spss'=>'A'.$spss_lngth,'sequence'=>$sequence,'naslov_graf'=>$vrednost['naslov_graf']); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - $_GRIDS[0]['cnt_other'] += 1; - } // end if - } - } // end foreach - } // end if - - #dodamo opcije (za spss) - $_HEADER[$spr_data_id]['options']['0'] = '0'; - $_HEADER[$spr_data_id]['options']['1'] = '1'; - - $_GRIDS[0]['cnt_vars'] = $cnt; - $_GRIDS[0]['naslov'] = $spr_variable; - $_HEADER[$spr_data_id]['cnt_grids'] = 1; - $_HEADER[$spr_data_id]['cnt_all'] = $cnt; - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - break; - - - # TEXT - case 4: - $cnt=0; - # dodamo header variable - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>null, 'naslov'=>$spr_naslov, 'variable'=>$spr_variable, 'other'=>false, 'text'=>true, 'spss'=>'A'.$spss_lngth,'sequence'=>$sequence); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - $_GRIDS[0]['cnt_vars'] = $cnt; - $_GRIDS[0]['naslov'] = $spr_variable; - $_HEADER[$spr_data_id]['cnt_grids'] = 1; - $_HEADER[$spr_data_id]['cnt_all'] = $cnt; - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - break; - - - # MULTIRADIO - case 6: - # ali je dvojni grid - $double = (int)($rowVprasanje['enota'] == 3); - - $double_data = array(); - # Pri multigridu je logika obratna. variable predstavljajo podvprašanja, srv_grid pa odgovore - $cntGrid = 0; - $arrayVrednost = $_array_vrednosti[$spr_id]; - if (count($arrayVrednost)>0) { - # če imamo dvojni grid gremo 2_skozi - for ($i=1; $i<=$double+1;$i++) { - // for $double - $double_data[$i]['subtitle'] = $rowVprasanje['grid_subtitle'.$i]; - if ($double == 1) { - $var_appendix = '_'.$i; - } else { - $var_appendix = ''; - } - $part = $i; - foreach ($arrayVrednost as $kid=> $vrednost) { - - // Za kombinirane tabele popravimo ime variable - if($rowVprasanje['gru_id'] == -2){ - $arr = explode("_", $spr_variable, 2); - $sprVar = $arr[0]; - $vrednost['variable'] = $sprVar.'_'.$vrednost['variable']; - } - - # dodamo header samo za nemissing variable - if ($vrednost['other'] == 0 || $vrednost['other'] == 1) { - $cnt = 0; - $_GRIDS[$cntGrid]['variables'][$cnt] = array('vr_id'=>$vrednost['id'], - 'naslov'=>$vrednost['naslov'], - 'naslov2'=>$vrednost['naslov2'], - 'variable'=>$vrednost['variable'].$var_appendix.$vrednostLoopSufix, - 'other'=>false, - 'text'=>false, - 'spss'=>'F'.$spss_lngth3.'.0','sequence'=>$sequence, - 'naslov_graf'=>$vrednost['naslov_graf']); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - if ($vrednost['other'] == 1) { - $_GRIDS[$cntGrid]['variables'][$cnt] = array('vr_id'=>$vrednost['id'],'naslov'=>$vrednost['naslov'], 'variable'=>$vrednost['variable'].$var_appendix.$vrednostLoopSufix.STR_OTHER_TEXT, 'other'=>true,'text'=>true,'spss'=>'A'.$spss_lngth,'sequence'=>$sequence,'naslov_graf'=>$vrednost['naslov_graf']); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - $_GRIDS[$cntGrid]['cnt_other'] += 1; - } // end if - $_GRIDS[$cntGrid]['cnt_vars'] = $cnt; - $_GRIDS[$cntGrid]['naslov'] = $vrednost['variable'].$var_appendix; - $_GRIDS[$cntGrid]['part'] = $i; - $_HEADER[$spr_data_id]['cnt_all'] += $cnt; - $cntGrid++; - } - } // end foreach - - } // end for $double - } // end if - - #dodamo opcije (za spss) - $arrayGrids = $_array_gridi[$spr_id]; - if (count($arrayGrids) > 0) { - foreach ($arrayGrids AS $kid => $grid) { - if ($grid['other'] == 0 || $grid['other'] == 1) { - $_HEADER[$spr_data_id]['options'][$grid['variable']] = ($grid['naslov'] != null) ? $grid['naslov'] : $grid['variable']; - // Opcije za dodaten naslov grida pri grafu - $_HEADER[$spr_data_id]['options_graf'][$grid['variable']] = ($grid['naslov_graf'] != null) ? $grid['naslov_graf'] : $_HEADER[$spr_data_id]['options'][$grid['variable']]; - } - } - } - - $_HEADER[$spr_data_id]['cnt_grids'] = $cntGrid; - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - - if ($double == 1) { - $_HEADER[$spr_data_id]['double'] = $double_data; - } - break; - - - # NUMBER - case 7: - - # pri number lahko imamo dve variabli grida, če je size 2 - $cnt_v = 0; - $arrayVrednost = $_array_vrednosti[$spr_id]; - if (count($arrayVrednost) > 0) { - $cnt=0; - foreach ($arrayVrednost as $kid=> $vrednost) { - if ($vrednost['other'] == 0) { - if ($spr_size > 1) { - # če imamo več variabel - $_variable = $vrednost['variable'].$vrednostLoopSufix; - } else { #imamo samo eno variablo - $_variable = $spr_variable.$vrednostLoopSufix; - } - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>$vrednost['id'], 'naslov'=>$vrednost['naslov'], 'variable'=>$_variable, 'other'=>false, 'text'=>false,'spss'=>'F'.($spr_cela+$spr_decimalna).($spr_decimalna > 0 ? ('.'.$spr_decimalna) : '.0'),'sortType'=>'number','sequence'=>$sequence,'naslov_graf'=>$vrednost['naslov_graf']); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt_v++; - $cnt++; - } // end if - - } // end foreach - $_GRIDS[0]['cnt_vars'] = $cnt_v; - $_GRIDS[0]['naslov'] = $spr_variable; - - } // end if - $_GRIDS[0]['enota'] = $spr_variable; - $_HEADER[$spr_data_id]['cnt_grids'] = 1; - $_HEADER[$spr_data_id]['cnt_all'] += $cnt_v; - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - break; - - - # DATUM - case 8: - $cnt=0; - - # dodamo header variable - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>null, 'naslov'=>$spr_naslov, 'variable'=>$spr_variable, 'other'=>false, 'text'=>true,'spss'=>'A10','sortType'=>'date','sequence'=>$sequence); - - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - - $_HEADER[$spr_data_id]['cnt_grids'] = 1; - $_GRIDS[0]['cnt_vars'] = $cnt; - $_GRIDS[0]['naslov'] = $spr_variable; - $_HEADER[$spr_data_id]['cnt_all'] += $cnt; - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - break; - - - # MULTICHECKBOX - case 16: - # MULTITEXT - case 19: - # MULTINUMBER - case 20: - // srv_variable predstavljajo podvprašanja, srv_grid pa možne pododkovore - $_spss = ($tip == 16) - ? 'F'.$spss_lngth3.'.0' - : (($tip == 19) - ? 'A'.$spss_lngth2 - : 'F'.($spr_cela+$spr_decimalna).($spr_decimalna > 0 ? ('.'.$spr_decimalna) : '.0')); - - $row = Cache::srv_spremenljivka($spr_id); - $newParams = new enkaParameters($row['params']); - $is_datum = $newParams->get('multigrid-datum'); - #'sortType'=>'date' - $grid_id=0; - - $arrayGrids = $_array_gridi[$spr_id]; - $arrayVrednost = $_array_vrednosti[$spr_id]; - if (count($arrayVrednost) > 0) { - foreach ($arrayVrednost as $kid=> $vrednost) { - - // Za kombinirane tabele popravimo ime variable - if($rowVprasanje['gru_id'] == -2){ - $arr = explode("_", $spr_variable, 2); - $sprVar = $arr[0]; - $vrednost['variable'] = $sprVar.'_'.$vrednost['variable']; - } - - $cnt=0; - if (count($arrayGrids) > 0) { - foreach ($arrayGrids AS $kid => $grid) { - if ($grid['other'] == 0 || $grid['other'] == 1) { - $_GRIDS[$grid_id]['variables'][$cnt] = array('vr_id'=>$vrednost['id'], 'gr_id'=>$grid['id'], 'naslov'=>$grid['naslov'], 'variable'=>$vrednost['variable'].'_'.$grid['variable'].$vrednostLoopSufix, 'other'=>false, 'text'=>false,'spss'=>$_spss,'sequence'=>$sequence,'naslov_graf'=>$grid['naslov_graf']); - - if((int)$is_datum === 1) { - $_GRIDS[$grid_id]['variables'][$cnt]['sortType'] ='date'; - } - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - } - } // end foreach - if ($vrednost['other'] == 1) { - $_GRIDS[$grid_id]['variables'][$cnt] = array('vr_id'=>$vrednost['id'],'naslov'=>$vrednost['naslov'], 'variable'=>$vrednost['variable'].$vrednostLoopSufix.STR_OTHER_TEXT, 'other'=>true,'text'=>true,'spss'=>'A'.$spss_lngth,'sequence'=>$sequence,'naslov_graf'=>$vrednost['naslov_graf']); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - $_GRIDS[$grid_id]['cnt_other'] += 1; - } // end if - - } // end if - - $_GRIDS[$grid_id]['cnt_vars'] = $cnt; - $_GRIDS[$grid_id]['naslov'] = $vrednost['naslov']; - $_GRIDS[$grid_id]['variable'] = $vrednost['variable']; - $_GRIDS[$grid_id]['naslov_graf'] = $vrednost['naslov_graf']; - $_HEADER[$spr_data_id]['cnt_all'] += $cnt; - $grid_id++; - } // end foreach - } // end if - - if ($tip == 16) { - #dodamo opcije (za spss) - $_HEADER[$spr_data_id]['options']['0'] = '0'; - $_HEADER[$spr_data_id]['options']['1'] = '1'; - } - - $_HEADER[$spr_data_id]['cnt_grids'] = $grid_id; - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - break; - - - # RANKING - case 17: - # VSOTA - case 18: - $_spss = ($tip == 17) - ? 'F'.$spss_lngth3.'.0' - : 'F'.($spr_cela+$spr_decimalna).($spr_decimalna > 0 ? ('.'.$spr_decimalna) : '.0'); - - $cnt=0; - $arrayVrednost = $_array_vrednosti[$spr_id]; - if (count($arrayVrednost) > 0) { - foreach ($arrayVrednost as $kid=> $vrednost) { - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>$vrednost['id'],'naslov'=>$vrednost['naslov'], 'variable'=>$vrednost['variable'].$vrednostLoopSufix, 'other'=>false, 'text'=>false,'spss'=>$_spss,'sequence'=>$sequence,'naslov_graf'=>$vrednost['naslov_graf']); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - if ($tip == 17) { - $_HEADER[$spr_data_id]['options'][$vrednost['vrstni_red']] = $vrednost['vrstni_red']; - } - } // end foreach - } // end if - $_HEADER[$spr_data_id]['cnt_grids'] = 1; - $_GRIDS[0][ 'cnt_vars'] = $cnt; - $_GRIDS[0]['naslov'] = $spr_variable; - $_HEADER[$spr_data_id]['cnt_all'] += $cnt; - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - break; - - - # BESEDILO* - case 21: - $cnt=0; - $arrayVrednost = $_array_vrednosti[$spr_id]; - if (count($arrayVrednost) > 0) { - foreach ($arrayVrednost as $kid=> $vrednost) { - if ($vrednost['other'] == 0) { - - $_variable = (count($arrayVrednost) == 1) - ? $spr_variable - : $vrednost['variable'].$vrednostLoopSufix ; - $_naslov = (trim($vrednost['naslov']) != '' && trim($vrednost['naslov']) != $lang['srv_new_text']) ? $vrednost['naslov'] : $spr_naslov; - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>$vrednost['id'],'naslov'=>$_naslov, 'variable'=>$_variable, 'other'=>false, 'text'=>true,'spss'=>'A'.$spss_lngth,'sequence'=>$sequence); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - } // end if - } // end foreach - } // end if - $_HEADER[$spr_data_id]['cnt_grids'] = 1; - $_GRIDS[0]['cnt_vars'] = $cnt; - $_GRIDS[0]['naslov'] = $spr_variable; - $_HEADER[$spr_data_id]['cnt_all'] += $cnt; - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - break; - - - # KALKULACIJA - case 22: - $cnt=0; - # dodamo header variable - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>null, 'naslov'=>$spr_naslov, 'variable'=>$spr_variable, 'other'=>false, 'text'=>true,'spss'=>'F'.$spss_lngth.'.0','sequence'=>$sequence); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - $_HEADER[$spr_data_id]['cnt_grids'] = 1; - $_GRIDS[0]['cnt_vars'] = $cnt; - $_GRIDS[0]['naslov'] = $spr_variable; - $_HEADER[$spr_data_id]['cnt_all'] += $cnt; - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - break; - - - # KVOTA - case 25: - $cnt=0; - # dodamo header variable - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>null, 'naslov'=>$spr_naslov, 'variable'=>$spr_variable, 'other'=>false, 'text'=>true,'spss'=>'F'.$spss_lngth.'.0','sequence'=>$sequence); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - $_HEADER[$spr_data_id]['cnt_grids'] = 1; - $_GRIDS[0]['cnt_vars'] = $cnt; - $_GRIDS[0]['naslov'] = $spr_variable; - $_HEADER[$spr_data_id]['cnt_all'] += $cnt; - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - break; - - - # SN - IMENA - case 9: - $cnt=0; - $arrayVrednost = $this->SNVariablesForSpr[$_vprasanje_array['id']]; - if (count($arrayVrednost) > 0) { - foreach ($arrayVrednost as $kid=> $vrednost) { - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>$vrednost,'naslov'=>($spr_variable.'_'.($cnt+1)), 'variable'=>($spr_variable.'_'.($cnt+1)), 'other'=>false, 'text'=>true,'spss'=>'A'.$spss_lngth,'sequence'=>$sequence); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - } // end foreach - } // end if - $_HEADER[$spr_data_id]['cnt_grids'] = 1; - $_GRIDS[0]['cnt_vars'] = $cnt; - $_GRIDS[0]['naslov'] = $spr_variable; - $_HEADER[$spr_data_id]['cnt_all'] += $cnt; - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - break; - - - # Lokacija - case 26: - $row = Cache::srv_spremenljivka($spr_id); - - if($row['enota'] == 3){ - $cnt=0; - $arrayVrednost = $_array_vrednosti[$spr_id]; - if (count($arrayVrednost) > 0) { - foreach ($arrayVrednost as $kid=> $vrednost) { - if ($vrednost['other'] == 0) { - - $_variable = (count($arrayVrednost) == 1) ? $spr_variable - : $vrednost['variable'].$vrednostLoopSufix ; - $_naslov = (trim($vrednost['naslov']) != '' && trim($vrednost['naslov']) != $lang['srv_new_text']) ? $vrednost['naslov'] : $_variable; - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>$vrednost['id'],'naslov'=>$_naslov, 'variable'=>$_variable, 'other'=>false, 'text'=>true,'spss'=>'A'.$spss_lngth,'sequence'=>$sequence); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - } // end if - } // end foreach - } // end if - $_HEADER[$spr_data_id]['cnt_grids'] = 1; - $_GRIDS[0]['cnt_vars'] = $cnt; - $_GRIDS[0]['naslov'] = $spr_variable; - $_HEADER[$spr_data_id]['cnt_all'] += $cnt; - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - } - else{ - $newParams = new enkaParameters($row['params']); - $is_podvprasanje = $newParams->get('marker_podvprasanje') == 1; - $multi_input_type = $newParams->get('multi_input_type'); - if($multi_input_type == 'marker'){ - $arrayNaslovov = ($is_podvprasanje) ? - array(array('naslov' => $lang['srv_data_column_naslov_map'], 'variable' => $spr_variable.'a'), - array('naslov' => $lang['srv_data_column_vrednost_map'], 'variable' => $spr_variable.'b'), - array('naslov' => $lang['srv_data_column_koordinate_map'], 'variable' => $spr_variable.'c')) - : array(array('naslov' => $lang['srv_data_column_naslov_map'], 'variable' => $spr_variable.'a'), - array('naslov' => $lang['srv_data_column_koordinate_map'], 'variable' => $spr_variable.'b')); - } - else - $arrayNaslovov = array(array('naslov' => $lang['srv_data_column_koordinate_map'], 'variable' => $spr_variable.'a')); - - //kot grid - $cnt=0; - # dodamo header variable - foreach($arrayNaslovov as $naslo){ - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>null, 'naslov'=>$naslo['naslov'], 'variable'=>$naslo['variable'], 'other'=>false, 'text'=>true, 'spss'=>'A'.$spss_lngth,'sequence'=>$sequence); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - - $cnt++; - } - //$cnt++; - $_GRIDS[0]['cnt_vars'] = count($arrayNaslovov); - $_GRIDS[0]['naslov'] = $spr_variable; - $_HEADER[$spr_data_id]['cnt_grids'] = count($arrayNaslovov); - $_HEADER[$spr_data_id]['cnt_all'] = count($arrayNaslovov); - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - } - break; - - - # HEATMAP - case 27: - $arrayNaslovov = array($lang['srv_data_column_koordinate_map']); - //kot grid - $cnt=0; - # dodamo header variable - foreach($arrayNaslovov as $naslo){ - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>null, 'naslov'=>$naslo, 'variable'=>$spr_variable, 'other'=>false, 'text'=>true, 'spss'=>'A'.$spss_lngth,'sequence'=>$sequence); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - } - //checkbox vrednosti za imena obmocij - $arrayVrednost = $_array_vrednosti[$spr_id]; - if (count($arrayVrednost)>0) { - foreach ($arrayVrednost as $vrednost) { - - # dodamo header variable samo za ne -missing variable - if ($vrednost['other'] == 0 || $vrednost['other'] == 1) { - $_GRIDS[0]['variables'][$cnt] = array('vr_id'=>$vrednost['id'], 'naslov'=>$vrednost['naslov'], 'variable'=>$vrednost['variable'].$vrednostLoopSufix, 'other'=>false,'text'=>false,'spss'=>'F'.$spss_lngth3.'.0','sequence'=>$sequence,'naslov_graf'=>$vrednost['naslov_graf']); - $_sequences .= $_seq_prefix.$sequence; - $_seq_prefix = '_'; - $sequence++; - $cnt++; - #dodamo še header za polja drugo - } - } // end foreach - } // end if - //checkbox vrednosti za imena obmocij - konec - #dodamo opcije (za spss) - $_HEADER[$spr_data_id]['options']['0'] = '0'; - $_HEADER[$spr_data_id]['options']['1'] = '1'; - - - $_GRIDS[0]['cnt_vars'] = $cnt; //stevilo stolpcev pod enim vprasanjem - $_GRIDS[0]['naslov'] = $spr_variable; - $_HEADER[$spr_data_id]['cnt_grids'] = 1; - $_HEADER[$spr_data_id]['cnt_all'] = $cnt; //koliko stolpcev mora pokriti naslov tega vprasanja - $_HEADER[$spr_data_id]['sequences'] = $_sequences; - - break; - } - - $_HEADER[$spr_data_id]['grids'] = $_GRIDS; - } // end foreach ($this->AllQuestionsOrder AS $_vprasanje_array) { - } // end if (count($this->AllQuestionsOrder) > 0) - - ################# - # DODAMO SPECIAL META - if ($this->collect_full_meta) { - # s katero sekvenco se začnejo meta podatki - $_HEADER['_settings']['metaSequence'] = $sequence; - - $_HEADER['meta'] = array('tip'=>'sm', 'variable'=>'smeta', 'naslov' =>$lang['srv_displaydata_meta'],'cnt_all'=>2); - # Datum insert, datum edit, datume in čase za posamezno stran - $_g_cnt = 0; - $_tmp_seq = $sequence; - - // Na zacetku prikazemo randomizacijo ce je prisotna pri kaksnem vprasanju ali bloku - foreach ($this->_array_random as $random_parent) { - - if($random_parent['type'] == 'spr'){ - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>'Random '.$random_parent['variable']); - $_HEADER['meta']['grids'][$_g_cnt]['variables'][0] = Array ('variable'=>'random_'.$random_parent['id'],'naslov'=>$random_parent['variable'],'sequence'=>$sequence); - $_g_cnt++; - $sequence++; - } - elseif($random_parent['type'] == 'blok_spr'){ - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>'Random B'.$random_parent['number']); - $_HEADER['meta']['grids'][$_g_cnt]['variables'][0] = Array ('variable'=>'random_'.$random_parent['id'],'naslov'=>'B'.$random_parent['number'],'sequence'=>$sequence); - $_g_cnt++; - $sequence++; - } - elseif($random_parent['type'] == 'blok_blok'){ - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>'Random B'.$random_parent['number']); - $_HEADER['meta']['grids'][$_g_cnt]['variables'][0] = Array ('variable'=>'random_'.$random_parent['id'],'naslov'=>'B'.$random_parent['number'],'sequence'=>$sequence); - $_g_cnt++; - $sequence++; - } - } - - # če mamo da prepozna uporabnika iz sispleta - if ((int)$this->survey['user_from_cms'] > 0) { - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>'E-mail iz CMS'); - $_HEADER['meta']['grids'][$_g_cnt]['variables'][0] = Array ('variable'=>'usr_from_cms','naslov'=>'E-mail iz CMS','spss'=>'A256','sequence'=>$sequence); - $sequence++; - $_g_cnt ++; - } - - # datum - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>$lang['date']); - #time insert - $_HEADER['meta']['grids'][$_g_cnt]['variables'][0] = Array ('variable'=>'t_insert','naslov'=>$lang['date_insert'],'spss'=>'DATETIMEw','sortType'=>'date','sequence'=>$sequence); - $sequence++; - - #time header - $_HEADER['meta']['grids'][$_g_cnt]['variables'][1] = Array ('variable'=>'t_edit','naslov'=>$lang['date_edit'],'spss'=>'DATETIMEw','sortType'=>'date','sequence'=>$sequence); - $sequence++; - - # dodamo št. variabel na grupo - $_HEADER['meta']['grids'][$_g_cnt]['cnt_vars'] = 2; - $_g_cnt ++; - - # datumi in časi po posameznih straneh - # zaloopamo skozi strani - - # zaloopamo skozi strani - $page = 1; - foreach ($this->_array_groups as $gid => $grupa) { - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>$lang['page'].' '.$page); - # date on page - $_HEADER['meta']['grids'][$_g_cnt]['variables'][0] = Array ('variable'=>'date_'.$page,'naslov'=>'datum_'.$page,'spss'=>'DATETIMEw','sortType'=>'date','sequence'=>$sequence); - $sequence++; - /* zaradi hitrosti ne računamo časa na strani - //time on page - $_HEADER['meta']['grids'][$_g_cnt]['variables'][1] = Array ('variable'=>'time_'.$page,'naslov'=>'cas_'.$page,'spss'=>'F5','sequence'=>$sequence); - $sequence++; - $_HEADER['meta']['grids'][$_g_cnt]['cnt_vars'] = 2; - */ - $_HEADER['meta']['grids'][$_g_cnt]['cnt_vars'] = 1; - $page++; - $_g_cnt++; - } - - /* ZARADI VAROVANJA PODATKOV SMO ZAČASNO ONEMOGOČILI LOVLJENJE IP-jev */ - #IP - $ip = SurveySetting::getInstance()->getSurveyMiscSetting('survey_ip'); - $ip_show = SurveySetting::getInstance()->getSurveyMiscSetting('survey_show_ip'); - if($ip==0 && $ip_show==1 && ($admin_type == 0 || $admin_type == 1)){ - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>'IP', - 'variables' => array( 0 => Array ('variable'=>'IP','naslov'=>'IP','spss'=>'A32','sequence'=>$sequence))); - $sequence++; $_g_cnt++; - } - - # JS - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>'JS', - 'variables' => array( 0 => Array ('variable'=>'JS','naslov'=>'JavaScript','spss'=>'A256','sequence'=>$sequence))); - $sequence++; $_g_cnt++; - - # Browser - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>$lang['browser'], - 'variables' => array( 0 => Array ('variable'=>'Browser','naslov'=>$lang['browser'],'spss'=>'A256','sequence'=>$sequence))); - $sequence++; $_g_cnt++; - - # Browser version - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>$lang['browser_version'], - 'variables' => array( 0 => Array ('variable'=>'BrowserVersion','naslov'=>$lang['browser_version'],'spss'=>'A256','sequence'=>$sequence))); - $sequence++; $_g_cnt++; - - # OS - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>'OS', - 'variables' => array( 0 => Array ('variable'=>'OS','naslov'=>$lang['srv_para_graph_os'],'spss'=>'A256','sequence'=>$sequence))); - $sequence++; $_g_cnt++; - - # Device - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>$lang['srv_para_graph_device'], - 'variables' => array( 0 => Array ('variable'=>'Device','naslov'=>$lang['srv_para_graph_device'],'spss'=>'A256','sequence'=>$sequence))); - $sequence++; $_g_cnt++; - - # Referer - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>'Referer', - 'variables' => array( 0 => Array ('variable'=>'Referer','naslov'=>'Referer','spss'=>'A256','sequence'=>$sequence))); - $sequence++; $_g_cnt++; - - # unsubscribed - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>'Unsubscribed', - 'variables' => array( 0 => Array ('variable'=>'Unsubscribed','naslov'=>'Unsubscribed','spss'=>'A2','sequence'=>$sequence))); - $sequence++; $_g_cnt++; - - # jezik - language - $_HEADER['meta']['grids'][$_g_cnt] = Array('naslov'=>$lang['lang'], - 'variables' => array( 0 => Array ('variable'=>'Language','naslov'=>$lang['lang'],'spss'=>'A256','sequence'=>$sequence))); - $sequence++; $_g_cnt++; - - # dodamo št. variabel za celotno skupino - $_HEADER['meta']['cnt_all'] = $sequence - $_tmp_seq; - } #### META #### - - // USABILITY - # če vsebuje nastavitev da filtriramo po uporabnosti dodamo tudi to polje - if (SurveyStatusProfiles::usabilitySettings()) { - $_HEADER['usability'] = Array('naslov'=>$lang['srv_usableResp_usability'], - 'variables' => array( 0 => Array ('variable'=>'Usability','naslov'=>$lang['srv_usableResp_usability'],'spss'=>'A2','sequence'=>$sequence))); - - $sequence++; - } - - $this->_HEADER = $_HEADER; - } - - /*** - * - */ - public function CollectData($c,$file_handler) { - global $site_path, $site_url, $lang, $admin_type; - - # zloopamo skozi userje - #$new_line_seperator = ($c==0) ? '' : NEW_LINE; - - # osvežimo podatke - if (mysqli_num_rows($this->_qry_users[$c]) > 0) { - mysqli_data_seek($this->_qry_users[$c], 0); - } - $_tmpCnt = $c * MAX_USER_PER_LOOP; - - $_dataLine = ""; - - $p = new Prevajanje($this->sid); - $jeziki = $p->get_all_langs(); - # lang od 0 je privzet - $jeziki[0] = $lang['language']; - $jeziki[$lang['id']] = $lang['language']; - if ($this->noErrors) { - while ($rowUser = mysqli_fetch_assoc($this->_qry_users[$c])) { - #sleep(1); - $_tmpCnt++; - #updejtamo status (v masovnem dodajnju ne uporabljamo seje) - if ($this->isCollectingMassive == false) { - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['current'] = $_tmpCnt; - $_SESSION['incrementalProgressBar'][$this->sid]['total'] = $this->_cnt_all_users; - session_commit(); - } - - $uid = $rowUser['usr_id']; - # dodamo usr id k podatkom - $_dataLine .= $rowUser['usr_id']; - - # dodamo ustreznost k podatkom - relevance - $_dataLine .= STR_DLMT. (($rowUser['status'] == 5 || $rowUser['status'] == 6) && $rowUser['lurker'] == 0 ? '1' : '0'); - - # dodamo email (invitation)k podatkom - če je bilo poslano z emailom ali je uporabnik ročno vnesel email - $_dataLine .= STR_DLMT. ((int)$rowUser['inv_res_id'] > 0 - # uporabnik je bil dodan z email vabilom - ? ((int)$rowUser['status'] == 1 || (int)$rowUser['status'] >= 3 - # email je bil odposlan - ? '1' - # email ni bil odposlan ali je bila napaka - : '2') - # uporabnik ni bil dodan z email vabilom - : '0'); - - # dodamo status k podatkom - $_dataLine .= STR_DLMT.$rowUser['status']; - - # dodamo lurkerje - $_dataLine .= STR_DLMT.$rowUser['lurker']; - - #dodamo unx_ins_date - $_dataLine .= STR_DLMT.max($rowUser['unx_ins_date'],$rowUser['unx_edt_date']); - - #dodamo recnum - $_dataLine .= STR_DLMT.$rowUser['recnum']; - - #dodamo geslo - if ($this->force_show_hiden_system == true) { - $_dataLine .= STR_DLMT.$rowUser['pass']; - } - - # če vsebuje testne podatke dodamo tudi kolono z tem statusom - if ($this->has_test_data) { - $_dataLine .= STR_DLMT.(int)$rowUser['testdata']; - } - - # dodamo insert time k podatkom - $_dataLine .= STR_DLMT.date("d.m.Y",strtotime($rowUser['time_insert'])); - - #dodamo uporabnikove podatke - # zloopamo skozi vprašanja - - # TOLE SEM ZAKOMENTIRAL KER SE MI ZDI DA NI POTRBNO, KER TAKO AL TAKO LOOPAMO PO arrayu - /*if ($this->_cnt_questions > 0) { - mysqli_data_seek($this->_qry_questions, 0); - }*/ - # dodamo vprašanja ki so v loopu - $userAnswerLine = ''; - - #resetiramo - $this->_user_spr_answer_count = array('cnt'=>0, 'last'=>0, 'spremenljivke'=>array()); - $pages = array(); - if ($this->noErrors && count($this->AllQuestionsOrder) > 0) { - foreach ($this->AllQuestionsOrder AS $_vprasanje_array) { - - // if ($this->noErrors) { - // while ($rowVprasanje = mysqli_fetch_assoc($this->_qry_questions)) { - $rowVprasanje = $this->AllQuestionsData[$_vprasanje_array['id']]; - # spremenljivki dodamo loop_id da je konsistentno z podatki - $rowVprasanje['spr_id'] = $rowVprasanje['spr_id'].'_'.$_vprasanje_array['loop_id']; - if (isset($this->_array_loop_on_spr[$rowVprasanje['if_id']])) { - $_vrednosti = $this->get_array_vrednosti($this->_array_loop_on_spr[$rowVprasanje['if_id']]); - } - if(isset($this->_array_vre_on_loop[$rowVprasanje['if_id']][$_vprasanje_array['loop_id']])) { - $_loop_vrednost = $this->_array_vre_on_loop[$rowVprasanje['if_id']][$_vprasanje_array['loop_id']]; - } - # popravimo ime variable če smo v loopu - if(isset($this->_array_vre_on_loop[$rowVprasanje['if_id']][$_vprasanje_array['loop_id']])) { - $rowVprasanje['variable'] = strip_tags($rowVprasanje['variable'])."_".$_vrednosti[$_loop_vrednost]['variable']; - } - - # pomožne variable - $tip = $rowVprasanje['tip']; - $_tmp_spr_id = explode('_',$rowVprasanje['spr_id']); - $spr_id = $_tmp_spr_id[0]; - $spr_data_id = $rowVprasanje['spr_id']; - $spr_naslov = strip_tags($rowVprasanje['naslov']); - $spr_variable = strip_tags($rowVprasanje['variable']); - $spr_size = $rowVprasanje['size']; - $spr_cela = $rowVprasanje['cela']; - $grid_subtitle1 = $rowVprasanje['grid_subtitle1']; - $grid_subtitle2 = $rowVprasanje['grid_subtitle2']; - $spr_decimalna = $rowVprasanje['decimalna']; - $spr_skala = $rowVprasanje['skala']; - $spr_sistem = $rowVprasanje['sistem']; - $spr_page = $rowVprasanje['gru_id']; - $spr_upload = $rowVprasanje['upload']; - $spr_signature = $rowVprasanje['signature']; - $spr_visible = $rowVprasanje['visible']; - $spr_dostop = $rowVprasanje['dostop']; - $pages[$spr_page] = true; - - # ponastavimo katere vrednosti se beležijo kot neodgovori na spremenljivko - # ali je to -3 ali -1. Če uporabnik še ni bil na tej strani je -3 če ne je -1 - # ali pa če gre za email vabila dodamo status -3 - if ((($rowUser['status'] == 6 || $rowUser['status'] == 5 ) && $rowUser['lurker'] != 1) ) { - // Ce je skrito je -2 (-2d da ga pobrisemo z -3 ce je potrebno) - if($spr_visible == 0 || !(($admin_type <= $spr_dostop && $admin_type>=0) || ($admin_type==-1 && $spr_dostop==4))){ - $VALUE_FOR_MISSING = '-2d'; - } - else{ - # če so veljavni odgovori damo -1 ali -3 - # na -3 popravimo na okncu - #$VALUE_FOR_MISSING = isset($this->_array_user_grupa[$uid][$spr_page]) ? '-1' : '-1'; - $VALUE_FOR_MISSING = '-1'; - } - } - else if ( $rowUser['status'] == 0 || $rowUser['status'] == 1 || $rowUser['status'] == 2 ) { - # če je email vabilo - #$VALUE_FOR_MISSING = '-3'; - $VALUE_FOR_MISSING = '-5'; - } - else { - # to so lurkerji - # če imamo neveljavne odgovore damo -5 - $VALUE_FOR_MISSING = '-5'; - } - # array z vrednosmi rabimo za podatke in za polja drugo - if (isset($this->_array_vrednosti[$spr_id])) { - $spr_vrednosti = $this->_array_vrednosti[$spr_id]; - } - #gridi - if (isset($this->_array_gridi[$spr_id])) { - $spr_gridi = $this->_array_gridi[$spr_id]; - } - - #ODGOVORI - #tekstovno odgovori - $spr_data_text = $this->get_array_data_text($uid,$spr_data_id); - unset($this->_array_data_text[$uid][$spr_data_id]); - # vrednostni odgovori - $spr_data_vred = $this->get_array_data_vrednost($uid,$spr_data_id); - unset($this->_array_data_vrednost[$uid][$spr_data_id]); - # preslkočeni vrednostni odgovori - $spr_data_vrednost_cond = $this->get_array_data_vrednost_cond($uid,$spr_data_id); - unset($this->_array_data_vrednost_cond[$uid][$spr_data_id]); - # grid odgovori - $spr_data_grid = $this->get_array_data_grids($uid,$spr_data_id); - unset($this->_array_data_grids[$uid][$spr_data_id]); - # grid odgovori za checkbox - $spr_data_grid_check = $this->get_array_data_check_grids($uid,$spr_data_id); - unset($this->_array_data_check_grids[$uid][$spr_data_id]); - # ranking odgovori - $spr_data_ranking = $this->get_array_data_rating($uid,$spr_data_id); - unset($this->_array_data_rating[$uid][$spr_data_id]); - # textgrid odgovori - $spr_data_grid_text = $this->get_array_data_text_grid($uid,$spr_data_id); - unset($this->_array_data_text_grid[$uid][$spr_data_id]); - # lokacijski odgovori - $spr_data_map = $this->get_array_data_map($uid,$spr_data_id); - unset($this->_array_data_map[$uid][$spr_data_id]); - # heatmap odgovori - $spr_data_heatmap = $this->get_array_data_heatmap($uid,$spr_data_id); - unset($this->_array_data_heatmap[$uid][$spr_data_id]); - $spr_data_heatmap_regions = $this->get_array_data_heatmap_regions($uid,$spr_data_id); - unset($this->_array_data_heatmap_regions[$uid][$spr_data_id]); - - - switch ( $tip ) { - // v odvisnosti od tipa vprašanja pohandlamo podatke - # RADIO BUTTON - case 1: - # DROPDOWN - SELECT - case 3: - - $answer = null; - $_vred = null; - if (is_array($spr_data_vred)) { - $key = key($spr_data_vred); - if (isset($spr_data_vred[$key])) { - $_vred = $spr_data_vred[$key]; - } - } else { - $_vred = $VALUE_FOR_MISSING; - } - if ($_vred > 0) { - $answer = $spr_vrednosti[$_vred]['variable']; - } else { - $answer = $_vred; - } - if ( $answer == '' || $answer == null) { - $answer = $VALUE_FOR_MISSING; - } - - # dodamo podatek - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answer,$uid); - - #Tip 3 sem dodal , ker se zaradi buga lahko tudi pri roleti pojavi polje drugo - if ($tip == 1 || $tip == 3) { - // radio - # poiščemo polja drugo - if (count($spr_vrednosti) > 0) - foreach ($spr_vrednosti AS $vid => $vrednost) { - if ($vrednost['other'] == 1) { - if ($this->isNotAnswerMissing($answer)) { - $answerOther = $answer; - } - else { - if (isset($spr_data_text[$vid]['text'])) { - $answerOther = ($spr_data_text[$vid]['text'] == "" || $spr_data_text[$vid]['text'] == null) ? $VALUE_FOR_MISSING : $spr_data_text[$vid]['text']; - } - elseif($spr_vrednosti[$vid]['variable'] != $answer){ - // Ce je bil -1 texta ni mogel vnesti in mora bit -2 - if($VALUE_FOR_MISSING == -1) - $answerOther = '-2d'; - else - $answerOther = $VALUE_FOR_MISSING; - } - else { - $answerOther = $VALUE_FOR_MISSING; - } - } - # dodamo podatek - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answerOther,$uid); - - } - } - } - break; - - # CHECKBOX - case 2: - $answer = null; - $_tmp_answers = array(); - - ## če ni lurker damo celemu checboxu 0 kadar ni izbran in ne -1 - /*if ((int)$rowUser['lurker'] == 1) { - $_anything_set = false; - } else { - $_anything_set = true; - }*/ - $_anything_set = false; - $_has_missing = NULL; - - # najprej dodelimo odgovore posameznim vrednostim če obstatajo - if (count($spr_vrednosti) > 0) - foreach ($spr_vrednosti AS $vid => $vrednost) { - - if (isset($spr_data_vred[$vid]) && $_has_missing == NULL) { - - # če je spr_data_vrednost obstaja je checkbox obkljukan - #preverimo ali imamo missing - if ($vrednost['other'] != 0 && $vrednost['other'] != 1 ) { - # odgovor je missing, vse vrednosti nastavimo na ta missing, zato pobrišemo morebitne že dodane odgovore - unset($_tmp_answers); - unset($spr_data_vred[$vid]); - #$_anything_set = false; - $_has_missing = $spr_vrednosti[$vid]['variable']; - } else { - $_tmp_answers[$vid] = 1; - unset($spr_data_vred[$vid]); - $_anything_set = true; - } - } else if (isset($spr_data_vrednost_cond[$vid])) { - $_tmp_answers[$vid] = $spr_data_vrednost_cond[$vid]; - #$_anything_set = true; - } - - } - - // če ni nič nastavljeno, je lahko samo -1, -2, -3,-4 - $missing_answers = 0; - # preverimo ali so ostale še kakšne vrednosti, potem so najbrž missingi - #najprej preverimo missing na variabli - if (is_array($spr_data_vred) && count($spr_data_vred) > 0 ) { - unset($_tmp_answers); - $_has_missing = end($spr_data_vred); - $missing_answers = $_has_missing; - $_anything_set = false; - } - - if ($_anything_set == false || $_has_missing != null) { - if ($_has_missing != null) { - # immamo misssing value - $missing_answers = $_has_missing; - } else if (is_array($spr_data_vred) && count($spr_data_vred) > 0 ) { - $missing_answers = end($spr_data_vred); # lahko da je -2, -4 - } else { - // lahko je -1, -3 - $missing_answers = $VALUE_FOR_MISSING; - } - } - - # še enkrat zloopamo skozi vrednosti in dodelimo odgovore, tudi za polja drugo - if (count($spr_vrednosti) > 0) { - if ($missing_answers == 0 ) { - $missing_answers = $VALUE_FOR_MISSING; - } - foreach ($spr_vrednosti AS $vid => $vrednost) { - # dodamo samo variable ki niso missing - if ($vrednost['other'] == 0 || $vrednost['other'] == 1) { - if (isset($_tmp_answers[$vid])) { - $answer = $_tmp_answers[$vid]; - } else if ($_anything_set == true){ - #pri checkboxu je lahko tudi 0 - $answer = 0; - } else { - $answer = $missing_answers; - } - - # dodamo odgovor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answer,$uid); - - #dodamo še polje drugo - if ($vrednost['other'] == 1) { - - #ce smo meli checkboc obkljukan - if (isset($_tmp_answers[$vid])) { - $answerOther = ($spr_data_text[$vid]['text'] == "" || $spr_data_text[$vid]['text'] == null) ? $VALUE_FOR_MISSING : $spr_data_text[$vid]['text']; - } else if ($missing_answers !== null) { - // Ce je bil 0 texta ni mogel vnesti in mora bit -2 - if($VALUE_FOR_MISSING == -1) - $answerOther = '-2d'; - else - $answerOther = $missing_answers; - } else if ($answer == 0) { - $answerOther = $VALUE_FOR_MISSING; - } else { - $answerOther = $answer; - } - # dodamo odgvor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answerOther,$uid); - - } - } - } - } - - break; - - # TEXT - case 4: - $answer = null; - # ce obstaja $spr_data_vred je po vsej vrjetnosti missing - if ( count($spr_data_vred) > 0 ) { - $key = key($spr_data_vred); - $answer = $spr_data_vred[$key]; - //unset ($spr_data_vred[$key]); - } else { - $answer = $spr_data_text[0]['text']; - } - if ( $answer == '' || $answer == null) { - $answer = $VALUE_FOR_MISSING; - } - # dodamo odgovor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answer,$uid); - - break; - - # NAGOVOR - /* - case 5: - # dodamo odgovor - $userAnswerLine .= STR_DLMT.' '; - break; - */ - # MULTI RADIO BUTTON - case 6: - - # dvojni gridi so zapisani v $spr_data_grid_check - if ((int)$rowVprasanje['enota'] != 3) { - # ni dvojni grid - $answer = null; - # zloopamo skozi podvprašanja (srv_vrednost - if (count($spr_vrednosti) > 0) - foreach ($spr_vrednosti AS $vid => $vrednost) { - $missing_answer=false; - if (is_array($spr_data_vred) && count($spr_data_vred) == 1 ) { - $answer = end($spr_data_vred); # lahko da je -2, -4 - $missing_answer = true; - } else if (isset($spr_data_grid[$vid])) { - if ($spr_data_grid[$vid] > 0) { - if ($spr_gridi[$spr_data_grid[$vid]]['other'] == 0) { - # preberemo grid vrednost - $answer = $spr_gridi[$spr_data_grid[$vid]]['variable']; // tukaj dodelimo ime variable, lahko bi tudi id ali vrstni red??? - $missing_answer = false; - } else { - $answer = $spr_gridi[$spr_data_grid[$vid]]['other']; - } - }else { - # je missing - $answer = $spr_data_grid[$vid]; - $missing_answer = true; - } - } else { - $answer = $VALUE_FOR_MISSING; - $missing_answer = true; - } - - # dodamo odgovor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answer,$uid); - - - if ($vrednost['other'] == 1) { - # če answer ni missing - if ($missing_answer == false) { - if (isset($spr_data_text[$vid]['text'])) { - $answerOther = ($spr_data_text[$vid]['text'] == "" || $spr_data_text[$vid]['text'] == null) ? $VALUE_FOR_MISSING : $spr_data_text[$vid]['text']; - }else { - $answerOther = $VALUE_FOR_MISSING; - } - } else { - $answerOther = $answer; - } - # dodamo odgvor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answerOther,$uid); - - } - } - } else { - # DOUBLE GRID - - # če imamo dvojni grid gremo 2_skozi - $double = (int)($rowVprasanje['enota'] == 3); - $_tmp_answers = array(); - - for ($i=1; $i<=$double+1;$i++) { - // for $double - - # sfiltriramo odgovore za posamezen part - $_tmp_part_answers = array(); - if (count($spr_data_grid_check) > 0) { - foreach($spr_data_grid_check as $vre_id => $grids) { - if (count($grids) > 0) { - foreach($grids AS $gid => $grid) { - if ($spr_gridi[$gid]['part'] == $i) { - if ($spr_gridi[$gid]['other'] == 0) { - $_tmp_part_answers[$vre_id] = $spr_gridi[$gid]['variable']; - } else { - $_tmp_part_answers[$vre_id] = $spr_gridi[$gid]['other']; - } - } - } - } - } - } - $answer = null; - # zloopamo skozi podvprašanja (srv_vrednost - if (count($spr_vrednosti) > 0) { - foreach ($spr_vrednosti AS $vid => $vrednost) { - $missing_answer=false; - if (is_array($spr_data_vred) && count($spr_data_vred) == 1 ) { - $answer = end($spr_data_vred); # lahko da je -2, -4 - $missing_answer = true; - } else if (isset($_tmp_part_answers[$vid])) { - if ($_tmp_part_answers[$vid] > 0) { - # preberemo grid vrednost - $answer = $_tmp_part_answers[$vid]; // tukaj dodelimo ime variable, lahko bi tudi id ali vrstni red??? - $missing_answer = false; - } else { - $answer = $_tmp_part_answers[$vid]; // tukaj dodelimo ime variable, lahko bi tudi id ali vrstni red??? - $missing_answer = true; - } - } else { - $answer = $VALUE_FOR_MISSING; - $missing_answer = true; - } - - # dodamo odgovor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answer,$uid); - - - if ($vrednost['other'] == 1) { - # če answer ni missing - if ($missing_answer == false) { - $answerOther = ($spr_data_text[$vid]['text'] == "" || $spr_data_text[$vid]['text'] == null) ? $VALUE_FOR_MISSING : $spr_data_text[$vid]['text']; - } else { - $answerOther = $answer; - } - # dodamo odgvor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answerOther,$uid); - - } - } - } - } // for $double - } - break; - # NUMBER - case 7: - # DATE - case 8: - - $_vred = null; - $answer0 = null; - - # ce imamo odgovor - if (isset ($spr_data_text[0])) { - $answer0 = ($spr_data_text[0]['text'] != '') ? $spr_data_text[0]['text'] : $VALUE_FOR_MISSING; - - } else if (is_array($spr_data_vred)) { - $key = key($spr_data_vred); - if (isset($spr_data_vred[$key])) { - $_vred = $spr_data_vred[$key]; - } - #pogledamo če je odgovor missing: - if (isset($spr_vrednosti[$_vred])) { - $answer0 = $spr_vrednosti[$_vred]['variable']; - } else { - $answer0 = $_vred; - } - - } - - $answer0 = ($answer0 == null ) ? $VALUE_FOR_MISSING : $answer0; - # dodamo odgovor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answer0,$uid); - - - - # ve imamo size = 2 - if ($tip == 7 && $spr_size > 1) { - - $answer1 = null; - # ce imamo odgovor - if (isset ($spr_data_text[0])) { - $answer1 = ($spr_data_text[0]['text2'] != '') ? $spr_data_text[0]['text2'] : $VALUE_FOR_MISSING; - } else if (is_array($spr_data_vred)) { - $key = key($spr_data_vred); - if (isset($spr_data_vred[$key])) { - $_vred = $spr_data_vred[$key]; - } - #pogledamo če je odgovor missing: - if (isset($spr_vrednosti[$_vred])) { - $answer1 = $spr_vrednosti[$_vred]['variable']; - } else { - $answer1 = $_vred; - } - } - - $answer1 = ($answer1 == null ) ? $VALUE_FOR_MISSING : $answer1; - - # dodamo odgovor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answer1,$uid); - - } - break; - - - # MULTI CHECKBOX - case 16: - # delamo na nivoju $spr_vrednosti kar predstavlja podvprašanje - if (count($spr_vrednosti) > 0) { - foreach ($spr_vrednosti AS $vid => $vrednost) { - $_tmp_answers = array(); - $_anything_set = false; - $_missing_answer = NULL; - # zloopamo skozi podvprašanja in nastavimo izbrane odgovore - if (count($spr_gridi) > 0) { - foreach ($spr_gridi AS $gid => $grid) { - if (isset($spr_data_grid_check[$vid][$gid]) && $_missing_answer == NULL) { - # če je spr_data_vrednost obstaja je checkbox obkljukan - #Najprej preverimo ali je odgovro missing... - if ($spr_gridi[$gid]['other'] == 0 || $spr_gridi[$gid]['other'] == 1) { - $_tmp_answers[$vid][$gid] = 1; - $_anything_set = true; - } else { - $_missing_answer = $spr_gridi[$gid]['other']; - # izrišemo morebitne 1 ke pri vrednostih ki imajo kakršnkoli missing - # ker ne more bit hkrati -99 ne vem in veljavni odgovor - unset($_tmp_answers); - $_anything_set = false; - } - unset($spr_data_grid_check[$vid][$gid]); - } - } - } - # nastavimo ali missinge, ali neveljavne ali 0; - if ($_anything_set == false) { - if ($_missing_answer != NULL) { - # missing je že nastavljen - } else if (is_array($spr_data_vred) && count($spr_data_vred) > 0 ) { - $_missing_answer = end($spr_data_vred); - } else { - $_missing_answer = $VALUE_FOR_MISSING; - } - } - # dodamo odgovore - if (count($spr_gridi)>0) { - foreach ($spr_gridi AS $gid => $grid) { - # dodamo samo gride ki niso missingi - if ($spr_gridi[$gid]['other'] == 0 || $spr_gridi[$gid]['other'] == 1) { - $answer = '0'; - # če je nastavljen missing so vsi gridi na podvprašanje enaki missingu - if ($_missing_answer != NULL ) { - $answer = $_missing_answer; - } else if (isset($_tmp_answers[$vid][$gid])) { - $answer = $_tmp_answers[$vid][$gid]; - } - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id, $answer,$uid); - - } - } - # dodamo še odgovore other text - if ($vrednost['other'] == 1) { - if ($_missing_answer != null) { - $answerOther = $_missing_answer; - } else if (isset($spr_data_text[$vid]['text']) && $spr_data_text[$vid]['text'] !== '') { - $answerOther = $spr_data_text[$vid]['text']; - } else { - if ($_anything_set == false) { - if (is_array($spr_data_vred) && count($spr_data_vred) > 0 ) { - $answerOther = end($spr_data_vred); - } else { - $answerOther = $VALUE_FOR_MISSING; - } - } else { - $answerOther = $VALUE_FOR_MISSING; - } - } - # dodamo odgvor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answerOther,$uid); - - } - } - } // end foreach spr_vrednost - } // end if count spr_vrednost - - break; - - # RANKING - case 17: - if (count($spr_vrednosti ) > 0) - foreach ($spr_vrednosti AS $vid => $vrednost) { - $answer = null; - if (isset($spr_data_ranking[$vid])) { - $answer = $spr_data_ranking[$vid]; - } else if (is_array($spr_data_vred) && count($spr_data_vred) > 0 ) { - $answer = end($spr_data_vred); - } - - if ($answer == "" || $answer == null) { - $answer = $VALUE_FOR_MISSING; - } // end if - - # dodamo odgvor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answer,$uid); - - } // end foreach - break; - - - #VSOTA - case 18: - if (count($spr_vrednosti ) > 0) - foreach ($spr_vrednosti AS $vid => $vrednost) { - $answer = null; - if (isset($spr_data_text[$vid]['text'])) { - $answer = $spr_data_text[$vid]['text']; - } else if (is_array($spr_data_vred) && count($spr_data_vred) > 0 ) { - $answer = end($spr_data_vred); - } - - if ($answer == "" || $answer == null) { - $answer = $VALUE_FOR_MISSING; - } // end if - - # dodamo odgvor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answer,$uid); - - } // end foreach - break; - - # MULTITEXT - case 19: - # MULTINUMBER - case 20: - - $answer = null; - $_tmp_answers = array(); - $_anything_set = array(); - - //$_missing_value = null; # missing je na celo variablo (old) - $missing_value_temp = $VALUE_FOR_MISSING; - - # preverimo al mamo missing (-2 ali -4, ce je bila naknadno dodana) nad celo spremenljivko - if (isset($spr_data_vred) && count($spr_data_vred) == 1) { - $missing_value_temp = (is_array($spr_data_vred) && count($spr_data_vred) == 1 ) ? end($spr_data_vred) : $VALUE_FOR_MISSING; - #Imamo missing // missingise po novem shranjujeo v srv_vrednost za celotno spremenljivko - //$_missing_value = reset($spr_data_vred); (old) - } - - $is_grid_missing = array(); - - # zloopamo skozi podvprašanja in nastavimo izbrane odgovore - if (count($spr_vrednosti ) > 0) { - foreach ($spr_vrednosti AS $vid => $vrednost) { - if (count($spr_gridi) > 0) { - foreach ($spr_gridi AS $gid => $grid) { - # dodajamo samo odgovore ki so veljavni - if ($grid['other'] == 0) { - if (isset($spr_data_grid_text[$vid][$gid])) { - # imamo veljaven odgovor - $_tmp_answers[$vid][$gid] = $spr_data_grid_text[$vid][$gid]; - $_anything_set[$vid] = true; - } else if (isset($spr_data_grid[$vid])) { - $_tmp_answers[$vid][$gid] = $spr_gridi[$spr_data_grid[$vid]]['other']; - } else { - $_tmp_answers[$vid][$gid] = $missing_value_temp; - } - - } - } - } - } - } - - # dodamo odgovore - if(count($spr_vrednosti) > 0) - foreach ($spr_vrednosti AS $vid => $vrednost) { - if(count($spr_gridi) > 0) - foreach ($spr_gridi AS $gid => $grid) { - if ($grid['other'] == 0) { - # dodamo samo veljavne gride - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$_tmp_answers[$vid][$gid],$uid); - - - } - } - - # dodamo še odgovore other text - if ($vrednost['other'] == 1) { - # če mamo missing dodamo missing - if (isset($is_grid_missing[$vid])) { - $answerOther = $is_grid_missing[$vid]; - } else if ($_anything_set[$vid]) { - $answerOther = ($spr_data_text[$vid]['text'] == "" || $spr_data_text[$vid]['text'] == null) ? $missing_value_temp : $spr_data_text[$vid]['text']; - } else { - $answerOther = $missing_value_temp; - } - - # dodamo odgvor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answerOther,$uid); - - } - } - break; - - # BESEDILO * - case 21: - # zloopamo skozi podvprašanja in nastavimo izbrane odgovore - if(count($spr_vrednosti) > 0) - foreach ($spr_vrednosti AS $vid => $vrednost) { - if ($vrednost['other'] == 0) { - - $answer = null; - - # imamo signature vprašanje - if($spr_signature == 1){ - - if(isset($spr_data_text[$vid]['text'])) - $answer = $spr_data_text[$vid]['text'] . ' '; - - if(@getimagesize($site_url.'main/survey/uploads/'.$rowUser['usr_id'].'_'.$spr_id.'_'.$this->sid.'.png')) - $answer .= '('.$site_url.'main/survey/uploads/'.$rowUser['usr_id'].'_'.$spr_id.'_'.$this->sid.'.png)'; - } - else if (isset($spr_data_text[$vid]['text']) && $spr_signature != 1) { - - if ($spr_upload == 1 || $spr_upload == 2) { - # imamo upload vprašanje - # imena datotek - $filename = substr($this->get_array_data_text_upload($spr_data_text[$vid]['text']),strlen($uid.'_')); - $answer = ''.$site_url.'main/survey/download.php?anketa='.$this->sid.'&code='.$spr_data_text[$vid]['text'].''; - } - else { - # imamo normalno text vprašanje - $answer = $spr_data_text[$vid]['text']; - } - - } - else if (is_array($spr_data_vred) && count($spr_data_vred) > 0 ) { - - #$answer = end($spr_data_vred); - - $key = key($spr_data_vred); - if (isset($spr_data_vred[$key])) { - $_vred = $spr_data_vred[$key]; - } - #pogledamo če je odgovor missing: - if (isset($spr_vrednosti[$_vred])) { - $answer = $spr_vrednosti[$_vred]['variable']; - } else { - $answer = $_vred; - } - } - - if ($answer == "" || $answer == null) { - $answer = $VALUE_FOR_MISSING; - } // end if - - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answer,$uid); - } - } - break; - - # Kalkulacija - case 22: - - $_vred = null; - $answer0 = null; - - # ce imamo odgovor - if (isset ($spr_data_text[0]) && $spr_data_text[0]['text'] != '') { - $answer0 = $spr_data_text[0]['text']; - } else if (is_array($spr_data_vred) && count($spr_data_vred) > 0 ) { - $answer0 = end($spr_data_vred); - } - - $answer0 = ($answer0 == null ) ? $VALUE_FOR_MISSING : $answer0; - # dodamo odgovor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answer0,$uid); - - - break; - - # Kvota - case 25: - - $_vred = null; - $answer0 = null; - - # ce imamo odgovor - if (isset ($spr_data_text[0]) && $spr_data_text[0]['text'] != '') { - $answer0 = $spr_data_text[0]['text']; - } else if (is_array($spr_data_vred) && count($spr_data_vred) > 0 ) { - $answer0 = end($spr_data_vred); - } - - $answer0 = ($answer0 == null ) ? $VALUE_FOR_MISSING : $answer0; - # dodamo odgovor - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answer0,$uid); - - break; - - # SN - IMENA * - case 9: - - # zloopamo skozi podvprašanja in nastavimo izbrane odgovore - $arrayVrednost = $this->SNVariablesForSpr[$_vprasanje_array['id']]; - if (!is_array($arrayVrednost)) { - $arrayVrednost = array(); - } - if(count($spr_vrednosti) > 0) - foreach ($spr_vrednosti AS $vid => $vrednost) { - if (in_array($vid,$arrayVrednost)) { - $answer = null; - if (isset($spr_data_text[$vid]['text'])) { - # imamo normalno text vprašanje - $answer = $spr_data_text[$vid]['text']; - - } else if (is_array($spr_data_vred) && count($spr_data_vred) > 0 ) { - $answer = end($spr_data_vred); - } - - if ($answer == "" || $answer == null) { - $answer = $VALUE_FOR_MISSING; - } // end if - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answer,$uid); - - } - } - - break; - - # Lokacija - case 26: - $row = Cache::srv_spremenljivka($spr_id); - if($row['enota'] == 3){ - if(count($spr_vrednosti) > 0){ - # zloopamo skozi podvprašanja in nastavimo izbrane odgovore - if (isset ($spr_data_map)) { - if(empty($spr_data_map)){ - //missingi, lahko da je -4 - $missing_value_temp = (is_array($spr_data_vred) && count($spr_data_vred) == 1 ) ? end($spr_data_vred) : $VALUE_FOR_MISSING; - for($i = 0; $i < count($spr_vrednosti); $i++){ - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$missing_value_temp,$uid); - } - } - else{ - $answerArr = (count($spr_data_map['izpis']) > 0) ? $spr_data_map['izpis'] : $VALUE_FOR_MISSING; - - if(count($spr_data_map) > 0) - foreach ($spr_data_map['izpis'] AS $izpis) { - $answer = null; - - if (isset($izpis['vrednost'])) { - # imamo normalno text vprašanje - $answer = $izpis['vrednost']; - } - if ($answer == "" || $answer == null) { - $answer = $VALUE_FOR_MISSING; - } // end if - - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answer,$uid); - } - } - } - } - - } - else{ - $_vred = null; - $answerArr = null; - $answerAdd = null; - $answerVre = null; - $answerKoo = null; - - $newParams = new enkaParameters($row['params']); - $is_podvprasanje = $newParams->get('marker_podvprasanje') == 1; - //$podvprasanje_naslov = ''; - $is_podvprasanje ? $podvprasanje_naslov = $newParams->get('naslov_podvprasanja_map') : - $podvprasanje_naslov = ''; - - $multi_input_type = $newParams->get('multi_input_type'); - - # ce imamo odgovor - if (isset ($spr_data_map)) { - $missing_value_temp = (is_array($spr_data_vred) && count($spr_data_vred) == 1 ) ? end($spr_data_vred) : $VALUE_FOR_MISSING; - $answerArr = (is_countable($spr_data_map['izpis']) && count($spr_data_map['izpis']) > 0) ? $spr_data_map['izpis'] : $missing_value_temp; - } else if (is_array($spr_data_map)) { - $key = key($spr_data_map); - if (isset($spr_data_map[$key])) { - $_vred = $spr_data_map[$key]; - } - #pogledamo če je odgovor missing: - if (isset($spr_vrednosti[$_vred])) { - $answerAdd = $spr_vrednosti[$_vred]['variable']; - $answerVre = $spr_vrednosti[$_vred]['variable']; - $answerKoo = $spr_vrednosti[$_vred]['variable']; - } else { - $answerAdd = $_vred; - $answerVre = $_vred; - $answerKoo = $_vred; - } - } - - if ($answerArr == null || $answerArr == $missing_value_temp){ - $answerAdd = $answerVre = $answerKoo = $missing_value_temp; - } - elseif($answerArr[0]['address'] == '-2'){ - $answerAdd = $answerVre = $answerKoo = '-2'; - } - else{ - foreach($answerArr as $varArr){ - if($answerKoo != null){ - $answerAdd .= '
    '.$varArr['address']; - $answerVre .= '
    '.$varArr['vrednost']; - $answerKoo .= '
    '.$varArr['koordinate']; - } - else{ - $answerAdd = $varArr['address']; - $answerVre = $varArr['vrednost']; - $answerKoo = $varArr['koordinate']; - } - } - - //rabil prej, da so se linki izrisali - ce se bo rabilo, prestavi v SurveyDisplayData - /*$answerAdd = ''.$answerAdd.''; - - $answerKoo = ''.$answerKoo.'';*/ - } - - # dodamo odgovor - if($multi_input_type == 'marker') - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answerAdd,$uid); - if($is_podvprasanje) - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answerVre,$uid); - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answerKoo,$uid); - } - break; - - # Heatmap - case 27: - $_vred = null; - $answerArr = null; - $answerAdd = null; - $answerVre = null; - $answerKoo = null; - - $row = Cache::srv_spremenljivka($spr_id); - $newParams = new enkaParameters($row['params']); - //echo ''; - //echo ''; - # ce imamo odgovor - if (isset ($spr_data_heatmap)) { - $answerArr = (is_countable($spr_data_heatmap['izpis']) && count($spr_data_heatmap['izpis']) > 0) ? $spr_data_heatmap['izpis'] : $VALUE_FOR_MISSING; - } else if (is_array($spr_data_heatmap)) { - $key = key($spr_data_heatmap); - if (isset($spr_data_heatmap[$key])) { - $_vred = $spr_data_heatmap[$key]; - $_vred = $spr_data_heatmap[$key]; - } - #pogledamo če je odgovor missing: - if (isset($spr_vrednosti[$_vred])) { - $answerAdd = $spr_vrednosti[$_vred]['variable']; - $answerVre = $spr_vrednosti[$_vred]['variable']; - $answerKoo = $spr_vrednosti[$_vred]['variable']; - } else { - $answerAdd = $_vred; - $answerVre = $_vred; - $answerKoo = $_vred; - } - } - - if ($answerArr == null || $answerArr == $VALUE_FOR_MISSING){ - $answerAdd = $answerVre = $answerKoo = $VALUE_FOR_MISSING; - } - elseif($answerArr[0]['address'] == '-2'){ - $answerAdd = $answerVre = $answerKoo = '-2'; - } - else{ - foreach($answerArr as $varArr){ - $answerAdd .= '
    '.$varArr['address']; - $answerVre .= '
    '.$varArr['vrednost']; - $answerKoo .= '
    '.$varArr['koordinate']; - } - } - - # dodamo odgovor za koordinate - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answerKoo,$uid); - - //za območja - if (is_array($spr_data_heatmap_regions)) { - - //priprava spremenljivk za koordinate točk - $pointx = $this->preparePointCoords($answerKoo, 1, 0); - $pointy = $this->preparePointCoords($answerKoo, 0, 1); - $numberOfPointsInside=array(); - - if (count($spr_vrednosti) > 0) { - $i=0; - foreach ($this->_array_data_heatmap_regions[(int)$spr_id] AS $regions){ - $answerReg = null; - $numberOfPointsInside[$regions['region_name']] = 0; //belezi stevilo tock znotraj trenutnega obmocja - - $poly = $this->convertPolyString($regions['region_coords']); //pretvori polje s tockami obmocja v ustrezno obliko - - //preveri, ali je posamezna tocka znotraj trenutnega obmocja - for ($z=0; $zinsidePoly($poly, $pointx[$z]["x"], $pointy[$z]["y"]); - if ($inside == true){ - $numberOfPointsInside[$regions['region_name']]++; - } - } - //preveri, ali je posamezna tocka znotraj trenutnega obmocja - konec - - //priprava odgovora za preglednico s podatki - if($answerKoo < 0) //ce je missing - { - $answerReg = $answerKoo; - }else - { - $answerReg = $numberOfPointsInside[$regions['region_name']]; - } - - $i++; - # dodamo odgovor s stevilom tock znotraj obmocja - $userAnswerLine .= STR_DLMT.$this->recode_answer($spr_id,$answerReg,$uid); - - } - } - } - //za območja - konec - break; - } - } // end while - } // end if ($this->noErrors) - - // popravimo -1, -4 in -2d (text za drugo) => -3, začnemo odzadaj in spreminjamo -1, -4 in -2d v -3 dokler obstajajo ampak samo če status ni 6 - $changed = false; - if ((int)$rowUser['status'] !== 6 && !empty($userAnswerLine)) { - - # ugotovimo do katere spremenljivke sploh zamenjujemo vrednosti ker če je pri tabelah odgovor vsaj na 1 variablo, potem tam pustimo -1 - $valuesToChange = $this->calculateValuesToChange($uid); - $userAnswerLineArray = explode('|',$userAnswerLine); - - $reversed = array_reverse($userAnswerLineArray); - foreach ($reversed AS $key => $value) { - - if ($key+1 > $valuesToChange) { - break; - } - - if ($value == -1 || $value == -4 || $value == '-2d') { - $reversed[$key] = -3; - $changed = true; - } else { - $reversed[$key] = $value; - } - } - if ($changed) { - $userAnswerLineArray = array_reverse($reversed); - $userAnswerLine = (implode('|', $userAnswerLineArray)); - } - } - - // Popravimo -2d (text za drugo, ce je naknadno nastavljen na -2, ker ni bil oznacen radio/checkbox za drugo) - $userAnswerLine = str_replace('-2d','-2',$userAnswerLine); - - // Naknadno popravimo se -2, ce je lurker (-5), ker nekatere drugace ostanejo - if ($VALUE_FOR_MISSING == -5) { - $userAnswerLine = str_replace('-2','-5',$userAnswerLine); - } - - // dodamo podatke k userju - $_dataLine .= $userAnswerLine; - - ############ - # DODAMO META PODATKE - if ($this->noErrors && $this->collect_full_meta) { - - // Random vrstni redi - - foreach ($this->_array_random as $random_parent) { - - $type = ($random_parent['type'] == 'spr') ? 'spr' : 'block'; - $random_data = $this->get_array_data_random($uid, $random_parent['id'], $type); - unset($this->_array_data_random[$uid][$type][$random_parent['id']]); - - $_dataLine .= STR_DLMT.$random_data; - } - - # če mamo da prepozna uporabnika iz sispleta - if ((int)$this->survey['user_from_cms'] > 0) { - $_dataLine .= STR_DLMT; - if ((int)$rowUser['user_id'] > 0) { - $_dataLine .= $this->get_user_CMS_email((int)$rowUser['user_id']); - } - } - - # datum insert, datum edit - $_dataLine .= STR_DLMT.datetime($rowUser['time_insert']); - $_dataLine .= STR_DLMT.datetime($rowUser['time_edit']); - - # strani in časi - foreach ($this->_array_groups AS $gid => $grupa) { - - if ($this->_array_user_grupa[$uid][$gid] != '') { - $_dataLine .= STR_DLMT.datetime($this->_array_user_grupa[$uid][$gid]); - } else { - $_dataLine .= STR_DLMT.''; - } - } - - /* ZARADI VAROVANJA PODATKOV SMO ZAČASNO ONEMOGOČILI LOVLJENJE IP-jev */ - $ip = SurveySetting::getInstance()->getSurveyMiscSetting('survey_ip'); - $ip_show = SurveySetting::getInstance()->getSurveyMiscSetting('survey_show_ip'); - if($ip==0 && $ip_show==1 && ($admin_type == 0 || $admin_type == 1)){ - $_dataLine .= STR_DLMT.$rowUser['ip']; - } - - $_dataLine .= STR_DLMT.$rowUser['javascript']; - $_dataLine .= STR_DLMT.$rowUser['useragent']; - $_dataLine .= STR_DLMT.$rowUser['browser']; - $_dataLine .= STR_DLMT.$rowUser['os']; - $_dataLine .= STR_DLMT.$lang['srv_para_graph_device'.$rowUser['device']]; - $_dataLine .= STR_DLMT.$rowUser['referer']; - $_dataLine .= STR_DLMT.$rowUser['unsubscribed']; - $_dataLine .= STR_DLMT.$jeziki[$rowUser['language']]; - } - - // Pocistimo vrednosti, ker drugace v nekaterih primereih prihaja do zelo cudnih bugov - unset($rowVprasanje); - unset($spr_vrednosti); - unset($spr_gridi); - - #zapišemo vsako vrstico posebej - if ($this->noErrors && !empty($_dataLine)) { - # zapišemo vrstico z predhodnim vrivom nove vrstice - $success = fwrite($file_handler, $this->new_line_seperator . $_dataLine); - fflush($file_handler); - if ((int)$success > 0) { - $this->last_usr_time = max($this->last_usr_time,$rowUser['unx_ins_date'],$rowUser['unx_edt_date']); - } else { - # imamo napako vse skupaj prekinemo - $this->noErrors = false; - } - $_dataLine = null; - unset($_dataLine); - } else { - # dodamo v log napako - $SL = new SurveyLog(); - $SL->addMessage(SurveyLog::ERROR, " ERROR user ".$rowUser['usr_id']." for ank_id".$this->sid); - $SL->write(); - } - $this->new_line_seperator = NEW_LINE; - } // end while user loop - } // end if ($this->noErrors) - - - # za progressbar dodamo števec (samo ko nismo v masovnem) - if ($this->isCollectingMassive == false) { - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['current'] = $_tmpCnt; - session_commit(); - } - } - - /** zgeneriramo order string za userje (recorde) */ - private function getRecOrderString($isStatus = null) { - // samo če imamo polje isStatus = status vrnemo Order za st.status čene vrnemo u. - //$orderStr = " ORDER BY u.recnum ASC"; - $orderStr = " ORDER BY u.id ASC"; - return $orderStr; - } - - - - /** isNotAnswerMissing() - * @desc vrne true če odgovor NI manjkajoča vrednost - * - * @return boolean - */ - private function isNotAnswerMissing($answer) { - if ($answer == -1 || $answer == -2 || $answer == -3 || $answer == -4 - || $answer == -96 || $answer == -97 || $answer == -98 || $answer == -99 ) { - return true; - } else { - return false; - } - } - - - - /** - * @desc vrne qry z vsemi stranmi - * ko prvič pokličemo naredimo query - */ - private function get_qry_groups () { - if ($this->_qry_groups === null ) { - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hs'] = 2; - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = 0; - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = 0; - session_commit(); - - $str_qry_groups = "SELECT id FROM srv_grupa WHERE ank_id='".$this->sid."' ORDER BY vrstni_red"; - $this->_qry_groups = sisplet_query($str_qry_groups); - if (!$this->_qry_groups) { - $this->trigerError('get_qry_groups', 'MYSQL ERROR in qry: '.$str_qry_groups . " ".mysqli_error($GLOBALS['connect_db'])); - } - - # koliko zapicov - $this->_cnt_groups = mysqli_num_rows($this->_qry_groups); - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = $this->_cnt_groups; - session_commit(); - - #naredimo še string z id grupami za večkratno uporabo - $str = ''; - $cnt=0; - if ($this->_cnt_groups > 0) { - $this->_array_groups = array(); - $prefix =''; - while ($row = mysqli_fetch_assoc($this->_qry_groups)) { - $cnt++; - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = $cnt; - session_commit(); - - $this->_array_groups[$row['id']] = $row['id']; - $str.=$prefix.$row['id']; - $prefix = ','; - } - $this->_str_groups = $str; - } - } - if ($this->_cnt_groups > 0) { - mysqli_data_seek($this->_qry_groups, 0); - } - return $this->_qry_groups; - - } - - /** - * @desc vrne qry z vsemi spremenljivkami (vprašanji) - * ko prvič pokličemo naredimo query - */ - private function create_qry_questions () { - - if ($this->_qry_questions === null) { - - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hs'] = 1; - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = 0; - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = 0; - session_commit(); - - //po novem lovimo tudi sistemske pa jih odstranimo pri prikazu in izvozih - $str_qry_questions = "SELECT s.id, s.tip, s.variable, REPLACE(REPLACE(REPLACE(s.naslov,'\n',' '),'\r','
    '),'|','
    ') as naslov, s.label, s.gru_id, s.gru_id, s.random, s.size, s.cela, s.decimalna, s.skala, s.enota, s.sistem, s.upload, s.signature, s.grid_subtitle1, s.grid_subtitle2, s.inline_edit, REPLACE(REPLACE(REPLACE(s.naslov_graf,'\n',' '),'\r','
    '),'|','
    ') as naslov_graf, s.edit_graf, s.wide_graf, antonucci, s.visible, s.dostop FROM srv_spremenljivka AS s, srv_grupa AS g WHERE s.gru_id = g.id AND g.ank_id = '".$this->sid."' AND s.tip != '5' ORDER BY g.vrstni_red, s.vrstni_red"; - - $this->_qry_questions = sisplet_query($str_qry_questions); - if (!$this->_qry_questions) { - $this->trigerError('create_qry_questions', 'MYSQL ERROR in qry: '.$str_qry_questions . " ".mysqli_error($GLOBALS['connect_db'])); - } - - $this->_cnt_questions = mysqli_num_rows($this->_qry_questions); - - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = $this->_cnt_questions; - session_commit(); - - #naredimo še string z id spremenljivkami za večkratno uporabo - $str = ''; - $cnt=0; - if ($this->_cnt_questions > 0) { - $sprIds = array(); - while ($row = mysqli_fetch_assoc($this->_qry_questions)) { - $cnt++; - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = $cnt; - session_commit(); - - if ($row['tip'] != 24) { - $sprIds[] = $row['id']; - } else { - $sqlSub = sisplet_query("SELECT s.id FROM srv_spremenljivka AS s JOIN srv_grid_multiple AS sgm ON (s.id = sgm.spr_id) WHERE sgm.parent = '$row[id]' ORDER BY sgm.vrstni_red"); - while (list($subSprId) = mysqli_fetch_row($sqlSub)) { - $sprIds[] = $subSprId; - } - } - } - if (count($sprIds) > 0) { - $this->_str_questions = implode(',',$sprIds); - } - } - } - } - - /** - * @desc vrne qry z vsemi userji - * ko prvič pokličemo naredimo query - */ - private function create_qry_users() { - - if ($this->_qry_users === null ) { - if ((int)$this->data_file_time > 0 && file_exists($this->folder . 'export_data_'.$this->sid.'.dat')) { - # delamo inkremental - $inkremental_user_limit = " AND u.time_edit > FROM_UNIXTIME('".(int)$this->data_file_time."') "; - } else { - # lovimo vse userje - datoteko generiramo na novo - $inkremental_user_limit = ''; - } - $str_qry_cnt = "SELECT count(*) FROM srv_user AS u WHERE u.ank_id = '".$this->sid."' AND u.preview='0' AND u.deleted='0' ".$inkremental_user_limit .$this->is_valid_user_limit; - $_qry_cnt = sisplet_query($str_qry_cnt); - $_allUsers_count = mysqli_fetch_row($_qry_cnt); - - $this->_cnt_all_users = 0; - $c = 0; - # naredimo array querijev za userje, limitirano po max vrednosti userjev na loop (MAX_USER_PER_LOOP) - do { - # če ne lovimo meta nardimo manjši query - if ($this->collect_full_meta) { - $str_qry = "SELECT u.id AS usr_id, u.cookie, u.recnum, u.last_status as status, u.pass, u.testdata, u.lurker, u.unsubscribed, UNIX_TIMESTAMP(u.time_insert) AS unx_ins_date, UNIX_TIMESTAMP(u.time_edit) AS unx_edt_date, u.user_id, u.inv_res_id". - ", u.time_insert, u.time_edit, u.ip, u.javascript, REPLACE(u.useragent,'|',' ') as useragent, u.browser, u.os, u.device, REPLACE(u.referer,'|',' ') as referer, language FROM srv_user AS u WHERE u.ank_id = '".$this->sid."' AND u.preview='0' AND u.deleted='0' ".$inkremental_user_limit.$this->is_valid_user_limit.$this->getRecOrderString().' LIMIT '.($c * MAX_USER_PER_LOOP).','.MAX_USER_PER_LOOP; - } else { - $str_qry = "SELECT u.id AS usr_id, u.cookie, u.recnum, u.last_status as status, u.testdata, u.lurker, u.unsubscribed, UNIX_TIMESTAMP(u.time_insert) AS unx_ins_date, UNIX_TIMESTAMP(u.time_edit) AS unx_edt_date, u.user_id, u.inv_res_id FROM srv_user AS u WHERE u.ank_id = '".$this->sid."' AND u.preview='0' AND u.deleted='0' ".$inkremental_user_limit.$this->is_valid_user_limit.$this->getRecOrderString().' LIMIT '.($c * MAX_USER_PER_LOOP).','.MAX_USER_PER_LOOP; - } - $this->_qry_users[$c] = sisplet_query($str_qry); - if (!$this->_qry_users[$c]) { - $this->trigerError('create_qry_users', 'MYSQL ERROR in qry: '.$str_qry . " ".mysqli_error($GLOBALS['connect_db'])); - } - - #naredimo še string z id userjev za večkratno uporabo - $str = ''; - if (mysqli_num_rows($this->_qry_users[$c]) > 0) { - $prefix =''; - while ($row = mysqli_fetch_assoc($this->_qry_users[$c])) { - $str.=$prefix.$row['usr_id']; - $prefix = ','; - } - $this->_str_users[$c] = ' AND usr_id IN ('.$str.') '; - } - $this->_cnt_all_users += mysqli_num_rows($this->_qry_users[$c]); - - $c ++; - } while ($c * MAX_USER_PER_LOOP <= $_allUsers_count['0']); - } - - - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['total'] = $this->_cnt_all_users; - session_commit(); - - } - - /** Skreiramo pointer do arraya z vrednostmi - */ - - private function create_array_vrednosti() { - # ce ne ce obstaja qry - if ($this->_qry_vrednosti !== null) { - return $this->_qry_vrednosti; - } else { - if ($this->_str_questions != '') { - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hs'] = 4; - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = 0; - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = 0; - session_commit(); - - $str_qry = "SELECT id, spr_id, REPLACE(REPLACE(REPLACE(naslov,'\n',' '),'\r','
    '),'|',' ') as naslov, REPLACE(REPLACE(REPLACE(naslov2,'\n',' '),'\r','
    '),'|',' ') as naslov2, variable, vrstni_red, other, REPLACE(REPLACE(REPLACE(naslov_graf,'\n',' '),'\r','
    '),'|',' ') as naslov_graf FROM srv_vrednost WHERE spr_id IN (".$this->_str_questions.") order by spr_id, vrstni_red"; - //$str_qry = "SELECT id, spr_id, REPLACE(REPLACE(REPLACE(naslov,'\n',' '),'\r','
    '),'|',' ') as naslov, variable, vrstni_red, other FROM srv_vrednost WHERE spr_id IN (".$this->_str_questions.") order by spr_id, vrstni_red"; - $this->_qry_vrednosti = sisplet_query($str_qry); - if (!$this->_qry_vrednosti) { - $this->trigerError('create_array_vrednosti', 'MYSQL ERROR in qry: '.$str_qry . " ".mysqli_error($GLOBALS['connect_db'])); - } - $this->_cnt_vrednosti = mysqli_num_rows($this->_qry_vrednosti); - } - } - } - - /** - * @desc vrne array z vrednostm za posamezno spremenljivko (spr_id) - * ko prvič pokličemo naredimo query in napolnimo array - */ - public function get_array_vrednosti($spid=null) { - if ($spid != null && (int)$spid > 0 ) { - # če že imamo podatek in iščemo za posamezno spremenljivko - if (isset($this->_array_vrednosti[$spid])) - return $this->_array_vrednosti[$spid]; - } else { - # vrenmo celoten array - if ($this->_array_vrednosti !== null) { - return $this->_array_vrednosti; - } - } - - # ce ne ce obstaja qry - if ($this->_qry_vrednosti === null) { - $this->create_array_vrednosti(); - } - - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hs'] = 4; - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = $this->_cnt_vrednosti; - session_commit(); - - $cnt=0; - if ($this->_cnt_vrednosti > 0) { - mysqli_data_seek($this->_qry_vrednosti, 0); - while ( list($id, $spr_id, $naslov, $naslov2, $variable, $vrstni_red, $other, $naslov_graf) = mysqli_fetch_row($this->_qry_vrednosti)) { - $cnt++; - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = $cnt; - session_commit(); - - $this->_array_vrednosti[(int)$spr_id][(int)$id] = array('id'=>(int)$id, 'naslov'=>strip_tags($naslov), 'naslov2'=>strip_tags($naslov2), 'variable'=>$variable, 'vrstni_red'=>(int)$vrstni_red, 'other'=>(int)$other, 'naslov_graf'=>strip_tags($naslov_graf) ); - } - } - if ($spid != null && (int)$spid > 0 ) { - return $this->_array_vrednosti[$spid]; - } else { - return $this->_array_vrednosti; - } - } - - /** Skreiramo pointer do arraya z gridi - */ - private function create_array_gridi() { - # ce ne ce obstaja qry - if ($this->_qry_gridi !== null) { - return $this->_qry_gridi; - } else { - if ($this->_str_questions != '') { - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hs'] = 5; - $_SESSION['incrementalProgressBar'][$this->sid]['ha'] = 0; - $_SESSION['incrementalProgressBar'][$this->sid]['hc'] = 0; - session_commit(); - $str_qry = "SELECT id, spr_id, REPLACE(REPLACE(REPLACE(naslov,'\n',' '),'\r','
    '),'|',' ') as naslov, variable, other, part, REPLACE(REPLACE(REPLACE(naslov_graf,'\n',' '),'\r','
    '),'|',' ') as naslov_graf, vrstni_red FROM srv_grid WHERE spr_id IN (".$this->_str_questions.") ORDER BY spr_id, vrstni_red"; - //$str_qry = "SELECT id, spr_id, REPLACE(REPLACE(REPLACE(naslov,'\n',' '),'\r','
    '),'|',' ') as naslov, variable, other, part, vrstni_red FROM srv_grid WHERE spr_id IN (".$this->_str_questions.") ORDER BY spr_id, vrstni_red"; - $this->_qry_gridi = sisplet_query($str_qry); - if (!$this->_qry_gridi) { - $this->trigerError('create_array_gridi', 'MYSQL ERROR in qry: '.$str_qry . " ".mysqli_error($GLOBALS['connect_db'])); - } - - - $this->_cnt_gridi = mysqli_num_rows($this->_qry_gridi); - } - } - } - - /** - * @desc vrne array z vrednostm za posamezno spremenljivko (spr_id) - * ko prvič pokličemo naredimo query in napolnimo array - */ - - private function get_array_gridi($grid=null) { - if ($grid != null && (int)$grid > 0 ) { - # če že imamo podatek in iščemo za posamezno spremenljivko - if (isset($this->_array_gridi[$grid])) - return $this->_array_gridi[$grid]; - } else { - # vrenmo celoten array - if ($this->_array_gridi !== null) { - return $this->_array_gridi; - } - } - - # ce ne ce obstaja qry - if ($this->_qry_gridi === null) { - $this->create_array_gridi(); - } - - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = $this->_cnt_gridi; - session_commit(); - $cnt=0; - if ($this->_cnt_gridi > 0) { - mysqli_data_seek($this->_qry_gridi, 0); - while ( list($id, $spr_id, $naslov, $variable, $other, $part, $naslov_graf) = mysqli_fetch_row($this->_qry_gridi)) { - $cnt++; - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = $cnt; - session_commit(); - $this->_array_gridi[(int)$spr_id][(int)$id] = array('id'=>(int)$id, 'naslov'=>strip_tags($naslov), 'variable'=>$variable, 'other'=>(int)$other, 'part'=>(int)$part, 'naslov_graf'=>strip_tags($naslov_graf)); - } - } - if ($grid != null && (int)$grid > 0 ) { - return $this->_array_gridi[$grid]; - } else { - return $this->_array_gridi; - } - } - - /** - * @desc vrne id strani do katere je prišel uporabnik - * - */ - private function create_array_user_grupa($string_user) { - - if ($this->_str_groups != '') { - $qry_string = 'SELECT gru_id, usr_id, time_edit, preskocena FROM srv_user_grupa'.$this->db_table.' WHERE gru_id IN ('.$this->_str_groups.')'.$string_user; - $qry = sisplet_query($qry_string); - if (!$qry) { - $this->trigerError('create_array_user_grupa', 'MYSQL ERROR in qry: '.$qry_string . " ".mysqli_error($GLOBALS['connect_db'])); - } - - $this->_array_user_grupa = array(); - while ($row = mysqli_fetch_assoc($qry)) { - $this->_array_user_grupa[(int)$row['usr_id']][(int)$row['gru_id']] = $row['time_edit']; - } - } - - } - - private function create_array_SPSS() { - if ($this->_array_SPSS === null) { - if ($this->_str_questions != '') { - - //$str_query = 'SELECT spr_id, max(LENGTH(text)) AS length, max(LENGTH(text2)) AS length2 FROM srv_data_text'.$this->db_table.' WHERE spr_id IN ('.$this->_str_questions.') GROUP BY spr_id'; - $str_query = 'SELECT dt.spr_id, MAX(LENGTH(dt.text)) AS length, MAX(LENGTH(dt.text2)) AS length2 FROM srv_data_text'.$this->db_table.' dt, srv_grupa g, srv_spremenljivka s WHERE dt.spr_id = s.id AND s.gru_id=g.id AND g.ank_id='.$this->sid.' GROUP BY dt.spr_id'; - $_qry_SPSS = sisplet_query($str_query); - $str_query = 'SELECT spr_id, max(LENGTH(text)) AS length FROM srv_data_textgrid'.$this->db_table.' WHERE spr_id IN ('.$this->_str_questions.') GROUP BY spr_id'; - $_qry_SPSS1 = sisplet_query($str_query); - # polovimo še max vrednosti za variable - $str_query = 'SELECT spr_id, max(LENGTH(vrstni_red)) AS length FROM srv_vrednost WHERE spr_id IN ('.$this->_str_questions.') GROUP BY spr_id order by spr_id, vrstni_red'; - $tmp_qry_SPSS = sisplet_query($str_query); - - $this->_array_SPSS = array(); - - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hs'] = 6; - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = (int)mysqli_num_rows($_qry_SPSS)+(int)mysqli_num_rows($_qry_SPSS1)+(int)mysqli_num_rows($tmp_qry_SPSS); - session_commit(); - $cnt=0; - - - while (list($spr_id,$text,$text2) = mysqli_fetch_row($_qry_SPSS)) { - $cnt++; - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = $cnt; - session_commit(); - $this->_array_SPSS[$spr_id] = array('text'=>(int)$text, 'text2'=>(int)$text2); - } - - - while (list($spr_id,$text) = mysqli_fetch_row($_qry_SPSS1)) { - $cnt++; - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = $cnt; - session_commit(); - #$this->_array_SPSS[$spr_id]['text2'] = ((int)$text < $this->MISSING_MAX_LENGTH ? $this->MISSING_MAX_LENGTH :$text); - $this->_array_SPSS[$spr_id]['text2'] = $text; - } - - # polovimo še max vrednosti za variable - while (list($spr_id,$vrstni_red) = mysqli_fetch_row($tmp_qry_SPSS)) { - $cnt++; - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = $cnt; - session_commit(); - #$this->_array_SPSS[$spr_id]['vrednost'] = ((int)$vrstni_red < $this->MISSING_MAX_LENGTH ? $this->MISSING_MAX_LENGTH : $vrstni_red); - $this->_array_SPSS[$spr_id]['vrednost'] = $vrstni_red; - } - } - } - return $this->_array_SPSS; - } - - /** - * @desc vrne array z vsemi bloki in vprasanji, ki imajo vklopljeno randomizacijo - * ko prvič pokličemo naredimo query - */ - private function get_array_random () { - - # ce smo ze zakesirali vrednosti - if ($this->_array_random_cached) { - return $this->_array_random; - } - - $this->_array_random = array(); - - - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hs'] = 2; - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = 0; - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = 0; - session_commit(); - - // Preberemo vsa VPRASANJA ki imajo vklopljeno randomizacijo - $str_qry_random_spr = "SELECT s.id, s.variable FROM srv_spremenljivka s, srv_grupa g WHERE g.ank_id='".$this->sid."' AND s.gru_id=g.id AND s.random='1' ORDER BY s.vrstni_red"; - $_qry_random_spr = sisplet_query($str_qry_random_spr); - if (!$_qry_random_spr) { - $this->trigerError('get_array_random', 'MYSQL ERROR in qry: '.$str_qry_random_spr . " ".mysqli_error($GLOBALS['connect_db'])); - } - - # koliko zapicov - $cnt_rows = mysqli_num_rows($_qry_random_spr); - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = $cnt_rows; - session_commit(); - - // Napolnimo array z randomiziranimi vprasanji - $cnt = 0; - if ($cnt_rows > 0) { - while ($row = mysqli_fetch_array($_qry_random_spr)) { - $cnt++; - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = $cnt; - session_commit(); - - $this->_array_random[$row['id']]['id'] = $row['id']; - $this->_array_random[$row['id']]['variable'] = $row['variable']; - $this->_array_random[$row['id']]['type'] = 'spr'; - } - } - - - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hs'] = 2; - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = 0; - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = 0; - session_commit(); - - // Preberemo vse BLOKE ki imajo vklopljeno randomizacijo - $str_qry_random_blok = "SELECT i.id, i.random, i.label, i.number FROM srv_if i, srv_branching b WHERE b.ank_id='".$this->sid."' AND b.element_if=i.id AND (i.random>=0 OR i.random=-2) AND i.tip='1'"; - $_qry_random_blok = sisplet_query($str_qry_random_blok); - if (!$_qry_random_blok) { - $this->trigerError('get_array_random', 'MYSQL ERROR in qry: '.$str_qry_random_blok . " ".mysqli_error($GLOBALS['connect_db'])); - } - - # koliko zapicov - $cnt_rows = mysqli_num_rows($_qry_random_blok); - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = $cnt; - session_commit(); - - // Napolnimo array z randomiziranimi bloki - $cnt = 0; - if ($cnt_rows > 0) { - - while ($row = mysqli_fetch_array($_qry_random_blok)) { - $cnt++; - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = $cnt; - session_commit(); - - $this->_array_random[$row['id']]['id'] = $row['id']; - $this->_array_random[$row['id']]['variable'] = $row['label']; - $this->_array_random[$row['id']]['number'] = $row['number']; - - // Blok ima randomizirane bloke - if($row['random'] == -2){ - $this->_array_random[$row['id']]['type'] = 'blok_blok'; - } - // Blok ima randomizirana vprasanja - else{ - $this->_array_random[$row['id']]['type'] = 'blok_spr'; - } - } - } - - - // Oznacimo da smo izvedli kesiranje - $this->_array_random_cached = true; - - return $this->_array_random; - } - - # FUNKCIJE ZA PODATKE - - /** srv_data_vrednost - * @desc vrne array z gridi za posameznega userja in spremenljivko - * ko prvič pokličemo naredimo query in napolnimo array - */ - private function create_array_data_vrednost ($string_user) { - - if ($this->_str_questions != '') { - # popravimo string za omejevanje userjev - $_string_user = str_replace(array(' AND usr_id IN (', ')'), '', $string_user); - $_string_user = explode(',',$_string_user); - $string_user = ' AND usr_id BETWEEN '.$_string_user[0].' AND '.end($_string_user); - - //$str_query = 'SELECT spr_id, vre_id, usr_id FROM srv_data_vrednost'.$this->db_table.' WHERE spr_id IN ('.$this->_str_questions.') '.$string_user; - $str_query = 'SELECT spr_id, vre_id, usr_id, loop_id FROM srv_data_vrednost'.$this->db_table.' WHERE spr_id IN ('.$this->_str_questions.')' . $string_user; - - $this->_qry_data_vrednost = sisplet_query($str_query); - if (!$this->_qry_data_vrednost) { - $this->trigerError('create_array_data_vrednost', 'MYSQL ERROR in qry: '.$str_query . " ".mysqli_error($GLOBALS['connect_db'])); - } - - - } - } - /** Vrnemo vrednost za uid in spr_id za tabelo srv_data_vrednost - * srv_data_vrednost - * @param $uid - * @param $spr_id - */ - private function get_array_data_vrednost ($uid, $spid) { - if (isset($this->_array_data_vrednost[$uid][$spid])) { - return $this->_array_data_vrednost[$uid][$spid]; - } - - if ($this->_array_data_vrednost === null) { - if ($this->_qry_data_vrednost === null) { - return array(); - } - - if (mysqli_num_rows($this->_qry_data_vrednost)) { - mysqli_data_seek($this->_qry_data_vrednost, 0); - while ( list($spr_id, $vre_id, $usr_id,$loop_id) = mysqli_fetch_row($this->_qry_data_vrednost)) { - - $loop_id = ($loop_id == null || $loop_id == '') ? 0 : $loop_id; - $this->_array_data_vrednost[(int)$usr_id][$spr_id.'_'.$loop_id][(int)$vre_id] = (int)$vre_id; - } - - } - if (isset($this->_array_data_vrednost[$uid][$spid])) { - return $this->_array_data_vrednost[$uid][$spid]; - } else { - return array(); - } - } else { - return array(); - } - - } - - /** srv_data_text - * @desc vrne array z gridi za posameznega userja in spremenljivko - * ko prvič pokličemo naredimo query in napolnimo array - */ - private function create_array_data_text ($string_user) { - - if ($this->_str_questions != '') { - # popravimo string za omejevanje userjev - $_string_user = str_replace(array(' AND usr_id IN (', ')'), '', $string_user); - $_string_user = explode(',',$_string_user); - $string_user = ' AND usr_id BETWEEN '.$_string_user[0].' AND '.end($_string_user); - - //$str_query = "SELECT spr_id, vre_id, usr_id, REPLACE(text,'\n',' ') as text, REPLACE(text2,'\n',' ') as text2 FROM srv_data_text".$this->db_table." WHERE spr_id IN (".$this->_str_questions.")".$string_user; - $str_query = "SELECT spr_id, vre_id, usr_id, REPLACE(REPLACE(REPLACE(text,'\n',' '),'\r',' '),'|',' ') as text, REPLACE(REPLACE(REPLACE(text2,'\n',' '),'\r',' '),'|',' ') as text2, loop_id FROM srv_data_text".$this->db_table." WHERE spr_id IN (".$this->_str_questions.') ' - //'AND usr_id BETWEEN '.substr($string_user, strpos($string_user, '(')+1, strpos($string_user, ',')-strpos($string_user, '(')-1)." AND ".substr($string_user, strrpos($string_user, ',')+1, strrpos($string_user, ')')-strrpos($string_user, ',')-1); - .$string_user; - - $this->_qry_data_text = sisplet_query($str_query); - - if (!$this->_qry_data_text) { - $this->trigerError('create_array_data_text', 'MYSQL ERROR in qry: '.$str_query . " ".mysqli_error($GLOBALS['connect_db'])); - } - } - } - /** Vrnemo vrednost za uid in spr_id za tabelo srv_data_text - * - * @param $uid - * @param $spr_id - */ - private function get_array_data_text ($uid, $spid) { - - if (isset($this->_array_data_text[$uid][$spid])) { - return $this->_array_data_text[$uid][$spid]; - } - - if ($this->_array_data_text === null ) { - if ($this->_qry_data_text === null) { - return array(); - } - - if (mysqli_num_rows($this->_qry_data_text)) { - mysqli_data_seek($this->_qry_data_text, 0); - while ( list($spr_id, $vre_id, $usr_id, $text, $text2, $loop_id) = mysqli_fetch_row($this->_qry_data_text)) { - $loop_id = ($loop_id == null || $loop_id == '') ? 0 : $loop_id; - # adslashes je potreben za analize - $this->_array_data_text[(int)$usr_id][$spr_id.'_'.$loop_id][(int)$vre_id] = array('text'=>trim(addslashes(strip_tags($text))), 'text2'=>trim(addslashes(strip_tags($text2)))); - } - } - if (isset($this->_array_data_text[$uid][$spid])) { - return $this->_array_data_text[$uid][$spid]; - } else { - return array(); - } - } else { - return array(); - } - } - /** srv_data_map - * @desc vrne array z gridi za posameznega userja in spremenljivko - * ko prvič pokličemo naredimo query in napolnimo array - */ - private function create_array_data_map ($string_user) { - - // Ce ni nobenega vprasanja tega tipa v anketi, ne rabimo tega izvajat - if(!(isset($this->_cnt_questions_types['26']) && $this->_cnt_questions_types['26'] > 0)) - return; - - if ($this->_str_questions != '') { - - # popravimo string za omejevanje userjev - $_string_user = str_replace(array(' AND usr_id IN (', ')'), '', $string_user); - $_string_user = explode(',',$_string_user); - $string_user = ' AND usr_id BETWEEN '.$_string_user[0].' AND '.end($_string_user); - - //$str_query = "SELECT spr_id, vre_id, usr_id, REPLACE(text,'\n',' ') as text, REPLACE(text2,'\n',' ') as text2 FROM srv_data_text".$this->db_table." WHERE spr_id IN (".$this->_str_questions.")".$string_user; - $str_query = "SELECT spr_id, usr_id, REPLACE(REPLACE(REPLACE(address,'\n',' '),'\r',' '),'|',' ') as address, " - . "REPLACE(REPLACE(REPLACE(text,'\n',' '),'\r',' '),'|',' ') as text, lat, lng, " - . "loop_id FROM srv_data_map WHERE spr_id IN (".$this->_str_questions.') ' - //'AND usr_id BETWEEN '.substr($string_user, strpos($string_user, '(')+1, strpos($string_user, ',')-strpos($string_user, '(')-1)." AND ".substr($string_user, strrpos($string_user, ',')+1, strrpos($string_user, ')')-strrpos($string_user, ',')-1); - .$string_user; - - $this->_qry_data_map = sisplet_query($str_query); - - if (!$this->_qry_data_map) { - $this->trigerError('create_array_data_map', 'MYSQL ERROR in qry: '.$str_query . " ".mysqli_error($GLOBALS['connect_db'])); - } - } - } - - /** srv_data_heatmap - * @desc vrne array z gridi za posameznega userja in spremenljivko - * ko prvič pokličemo naredimo query in napolnimo array - */ - private function create_array_data_heatmap ($string_user) { - - // Ce ni nobenega vprasanja tega tipa v anketi, ne rabimo tega izvajat - if(!(isset($this->_cnt_questions_types['27']) && $this->_cnt_questions_types['27'] > 0)) - return; - - if ($this->_str_questions != '') { - - # popravimo string za omejevanje userjev - $_string_user = str_replace(array(' AND usr_id IN (', ')'), '', $string_user); - $_string_user = explode(',',$_string_user); - $string_user = ' AND usr_id BETWEEN '.$_string_user[0].' AND '.end($_string_user); - - //$str_query = "SELECT spr_id, vre_id, usr_id, REPLACE(text,'\n',' ') as text, REPLACE(text2,'\n',' ') as text2 FROM srv_data_text".$this->db_table." WHERE spr_id IN (".$this->_str_questions.")".$string_user; - $str_query = "SELECT spr_id, usr_id, REPLACE(REPLACE(REPLACE(address,'\n',' '),'\r',' '),'|',' ') as address, " - . "REPLACE(REPLACE(REPLACE(text,'\n',' '),'\r',' '),'|',' ') as text, lat, lng, " - . "loop_id FROM srv_data_heatmap WHERE spr_id IN (".$this->_str_questions.') ' - //'AND usr_id BETWEEN '.substr($string_user, strpos($string_user, '(')+1, strpos($string_user, ',')-strpos($string_user, '(')-1)." AND ".substr($string_user, strrpos($string_user, ',')+1, strrpos($string_user, ')')-strrpos($string_user, ',')-1); - .$string_user; - - $this->_qry_data_heatmap = sisplet_query($str_query); - - if (!$this->_qry_data_heatmap) { - $this->trigerError('create_array_data_heatmap', 'MYSQL ERROR in qry: '.$str_query . " ".mysqli_error($GLOBALS['connect_db'])); - } - } - } - - private function create_array_data_heatmap_regions ($string_user) { - - // Ce ni nobenega vprasanja tega tipa v anketi, ne rabimo tega izvajat - if(!(isset($this->_cnt_questions_types['27']) && $this->_cnt_questions_types['27'] > 0)) - return; - - if ($this->_str_questions != '') { - -/* $str_query_regions = "SELECT id, vre_id, spr_id, region_name, region_coords FROM srv_hotspot_regions WHERE spr_id =".$this->_str_questions.' '; - echo ''; - $this->_qry_data_heatmap_regions = sisplet_query($str_query_regions); */ - $spremenljivke_id = explode(",", $this->_str_questions); - $this->_qry_data_heatmap_regions = array(); //polje s SQL stavki - foreach ($spremenljivke_id AS $val) { - //echo ''; - $str_query_regions = "SELECT id, vre_id, spr_id, region_name, region_coords FROM srv_hotspot_regions WHERE spr_id =".$val.' '; - array_push($this->_qry_data_heatmap_regions, $str_query_regions); - } -/* foreach ($this->_qry_data_heatmap_regions AS $query){ - echo ''; - } */ - } - } - - /** Vrnemo vrednost za uid in spr_id za tabelo srv_data_map - * - * @param $uid - * @param $spr_id - */ - private function get_array_data_map ($uid, $spid) { - - if (isset($this->_array_data_map[$uid][$spid])) { - return $this->_array_data_map[$uid][$spid]; - } - - // Ce ni nobenega vprasanja tega tipa v anketi, ne rabimo tega izvajat - if(!(isset($this->_cnt_questions_types['26']) && $this->_cnt_questions_types['26'] > 0)) - return array(); - - if ($this->_array_data_map === null ) { - if ($this->_qry_data_map === null) { - return array(); - } - - $i=0; - if (mysqli_num_rows($this->_qry_data_map)) { - mysqli_data_seek($this->_qry_data_map, 0); - - while ( list($spr_id, $usr_id, $address, $text, $lat, $lng, $loop_id) = mysqli_fetch_row($this->_qry_data_map)) { - $loop_id = ($loop_id == null || $loop_id == '') ? 0 : $loop_id; - //ce respondent ni vnesel vrednosti v infowindow - if($text == '' || $text == null) $text = '-1'; - - # adslashes je potreben za analize - if($this->_array_data_map[(int)$usr_id][$spr_id.'_'.$loop_id]){ - $this->_array_data_map[(int)$usr_id][$spr_id.'_'.$loop_id]['izpis'][$i] = - array('address'=>addslashes(strip_tags($address)), 'vrednost'=>addslashes(strip_tags($text)), - 'koordinate'=> $lat . ', ' . $lng); - /*$this->_array_data_map[(int)$usr_id][$spr_id.'_'.$loop_id]['map_data'][$i] = - array('address'=>addslashes(strip_tags($address)), - 'text'=> $text ? addslashes(strip_tags($text)) : '', 'lat'=>$lat, 'lng'=> $lng);*/ - } - else{ - $this->_array_data_map[(int)$usr_id][$spr_id.'_'.$loop_id] = - array('izpis'=>array(array('address'=>addslashes(strip_tags($address)), 'vrednost'=>addslashes(strip_tags($text)), - 'koordinate'=>$lat . ', ' . $lng)), - 'spr_id' => $spr_id, 'usr_id' => $usr_id, 'loop_id' => $loop_id/* - 'map_data'=> array(array('address'=>addslashes(strip_tags($address)), 'text'=> $text ? addslashes(strip_tags($text)) : '', - 'lat'=>$lat, 'lng'=> $lng))*/); - } - $i++; - } - } - if (isset($this->_array_data_map[$uid][$spid])) { - return $this->_array_data_map[$uid][$spid]; - } else { - return array(); - } - } else { - return array(); - } - } - - /** Vrnemo vrednost za uid in spr_id za tabelo srv_data_heatmap - * - * @param $uid - * @param $spr_id - */ - private function get_array_data_heatmap ($uid, $spid) { - - if (isset($this->_array_data_heatmap[$uid][$spid])) { - return $this->_array_data_heatmap[$uid][$spid]; - } - - // Ce ni nobenega vprasanja tega tipa v anketi, ne rabimo tega izvajat - if(!(isset($this->_cnt_questions_types['27']) && $this->_cnt_questions_types['27'] > 0)) - return array(); - - if ($this->_array_data_heatmap === null ) { - if ($this->_qry_data_heatmap === null) { - return array(); - } - - $i=0; - if (mysqli_num_rows($this->_qry_data_heatmap)) { - mysqli_data_seek($this->_qry_data_heatmap, 0); - - while ( list($spr_id, $usr_id, $address, $text, $lat, $lng, $loop_id) = mysqli_fetch_row($this->_qry_data_heatmap)) { - $loop_id = ($loop_id == null || $loop_id == '') ? 0 : $loop_id; - //ce respondent ni vnesel vrednosti v infowindow - if($text == '' || $text == null) $text = '-1'; - - # adslashes je potreben za analize - if($this->_array_data_heatmap[(int)$usr_id][$spr_id.'_'.$loop_id]){ - $this->_array_data_heatmap[(int)$usr_id][$spr_id.'_'.$loop_id]['izpis'][$i] = - array('address'=>addslashes(strip_tags($address)), 'vrednost'=>addslashes(strip_tags($text)), - 'koordinate'=> $lat . ', ' . $lng); - /*$this->_array_data_map[(int)$usr_id][$spr_id.'_'.$loop_id]['map_data'][$i] = - array('address'=>addslashes(strip_tags($address)), - 'text'=> $text ? addslashes(strip_tags($text)) : '', 'lat'=>$lat, 'lng'=> $lng);*/ - } - else{ - $this->_array_data_heatmap[(int)$usr_id][$spr_id.'_'.$loop_id] = - array('izpis'=>array(array('address'=>addslashes(strip_tags($address)), 'vrednost'=>addslashes(strip_tags($text)), - 'koordinate'=>$lat . ', ' . $lng)), - 'spr_id' => $spr_id, 'usr_id' => $usr_id, 'loop_id' => $loop_id/* - 'map_data'=> array(array('address'=>addslashes(strip_tags($address)), 'text'=> $text ? addslashes(strip_tags($text)) : '', - 'lat'=>$lat, 'lng'=> $lng))*/); - } - $i++; - } - } - if (isset($this->_array_data_heatmap[$uid][$spid])) { - return $this->_array_data_heatmap[$uid][$spid]; - } else { - return array(); - } - } else { - return array(); - } - } - - private function get_array_data_heatmap_regions ($uid, $spid) { - - if (isset($this->_array_data_heatmap_regions[$uid][$spid])) { - return $this->_array_data_heatmap_regions[$uid][$spid]; - } - - // Ce ni nobenega vprasanja tega tipa v anketi, ne rabimo tega izvajat - if(!(isset($this->_cnt_questions_types['27']) && $this->_cnt_questions_types['27'] > 0)) - return array(); - - if ($this->_array_data_heatmap_regions[$uid][$spid] === null) { - - foreach($this->_qry_data_heatmap_regions as $query){ - //echo ''; - $regionsQuery = sisplet_query($query); - - if ($regionsQuery === null) { - # napaka - return array(); - } - //echo ''; - $i=0; - if (mysqli_num_rows($regionsQuery)) { - //mysqli_data_seek($this->_qry_data_heatmap_regions, 0); - while ( list($region_id, $vre_id, $spr_id, $region_name, $region_coords) = mysqli_fetch_row($regionsQuery) ) { - # adslashes je potreben za analize - $this->_array_data_heatmap_regions[(int)$spr_id][$i] = array('region_name'=>addslashes(strip_tags($region_name)), 'region_coords'=>$region_coords); - - $i++; - } - } - } - - if (isset($this->_array_data_heatmap_regions[(int)$spr_id])) { - return $this->_array_data_heatmap_regions[(int)$spr_id]; - } else { - return array(); - } - } else { - return array(); - } - } - - /** srv__data_vrednost_cond - * @desc vrne array z vrednostmi kateri imajo -2 za posameznega userja in spremenljivko - * ko prvič pokličemo naredimo query in napolnimo array - */ - private function create_array_data_vrednost_cond ($string_user) { - if ($this->_str_questions != '') { - # popravimo string za omejevanje userjev - $_string_user = str_replace(array(' AND usr_id IN (', ')'), '', $string_user); - $_string_user = explode(',',$_string_user); - $string_user = ' AND usr_id BETWEEN '.$_string_user[0].' AND '.end($_string_user); - - $str_query = "SELECT spr_id, vre_id, usr_id, text, loop_id FROM srv_data_vrednost_cond WHERE spr_id IN (".$this->_str_questions.') ' - .$string_user; - $this->_qry_data_vrednost_cond = sisplet_query($str_query); - if (!$this->_qry_data_vrednost_cond) { - $this->trigerError('create_array_data_vrednost_cond', 'MYSQL ERROR in qry: '.$str_query . " ".mysqli_error($GLOBALS['connect_db'])); - } - } - } - /** Vrnemo vrednost za uid in spr_id za tabelo srv_data_vrednost_cond - * - * @param $uid - * @param $spr_id - */ - private function get_array_data_vrednost_cond ($uid, $spid) { - if (isset($this->_array_data_vrednost_cond[$uid][$spid])) { - return $this->_array_data_vrednost_cond[$uid][$spid]; - } - - if ($this->_array_data_vrednost_cond === null ) { - if ($this->_qry_data_vrednost_cond === null) { - # napaka - return array(); - } - - if (mysqli_num_rows($this->_qry_data_vrednost_cond)) { - mysqli_data_seek($this->_qry_data_vrednost_cond, 0); - while ( list($spr_id, $vre_id, $usr_id, $text, $loop_id) = mysqli_fetch_row($this->_qry_data_vrednost_cond)) { - $loop_id = ($loop_id == null || $loop_id == '') ? 0 : $loop_id; - # adslashes je potreben za analize - $this->_array_data_vrednost_cond[(int)$usr_id][$spr_id.'_'.$loop_id][(int)$vre_id] = addslashes(strip_tags($text)); - } - } - if (isset($this->_array_data_vrednost_cond[$uid][$spid])) { - return $this->_array_data_vrednost_cond[$uid][$spid]; - } else { - return array(); - } - } else { - return array(); - } - } - - /** srv_data_grid (active) - * @desc vrne array z gridi za posameznega userja in spremenljivko - * ko prvič pokličemo naredimo query in napolnimo array - */ - private function create_array_data_grids ($string_user) { - if ($this->_str_questions != '') { - # popravimo string za omejevanje userjev - $_string_user = str_replace(array(' AND usr_id IN (', ')'), '', $string_user); - $_string_user = explode(',',$_string_user); - $string_user = ' AND usr_id BETWEEN '.$_string_user[0].' AND '.end($_string_user); - - //$str_query = 'SELECT spr_id, vre_id, usr_id, grd_id FROM srv_data_grid'.$this->db_table.' WHERE spr_id IN ('.$this->_str_questions.') '.$string_user; - $str_query = 'SELECT spr_id, vre_id, usr_id, grd_id, loop_id FROM srv_data_grid'.$this->db_table.' WHERE spr_id IN ('.$this->_str_questions.')'.$string_user; - - //' AND usr_id BETWEEN '.substr($string_user, strpos($string_user, '(')+1, strpos($string_user, ',')-strpos($string_user, '(')-1)." AND ".substr($string_user, strrpos($string_user, ',')+1, strrpos($string_user, ')')-strrpos($string_user, ',')-1); - - $this->_qry_data_grids = sisplet_query($str_query); - if (!$this->_qry_data_grids) { - $this->trigerError('create_array_data_grids', 'MYSQL ERROR in qry: '.$str_query . " ".mysqli_error($GLOBALS['connect_db'])); - } - - } - } - /** Vrnemo vrednost za uid in spr_id za tabelo srv_data_grids - * - * @param $uid - * @param $spr_id - */ - private function get_array_data_grids ($uid, $spid) { - - if (isset($this->_array_data_grids[$uid][$spid])) { - - return $this->_array_data_grids[$uid][$spid]; - } - - if ($this->_array_data_grids === null) { - if ($this->_qry_data_grids === null) { - # napaka - return array(); - } - - if (mysqli_num_rows($this->_qry_data_grids)) { - mysqli_data_seek($this->_qry_data_grids, 0); - while (list($spr_id, $vre_id, $usr_id, $grd_id, $loop_id)= mysqli_fetch_row($this->_qry_data_grids)) { - $loop_id = ($loop_id == null || $loop_id == '') ? 0 : $loop_id; - $this->_array_data_grids[(int)$usr_id][$spr_id.'_'.$loop_id ][(int)$vre_id] = (int)$grd_id; - } - } - } - if (isset($this->_array_data_grids[$uid][$spid])) { - return $this->_array_data_grids[$uid][$spid]; - } else { - return array(); - } - - } - - /** srv_data_checkgrid - * @desc vrne array z gridi za posameznega userja in spremenljivko - * ko prvič pokličemo naredimo query in napolnimo array - */ - private function create_array_data_check_grids ($string_user) { - if ($this->_str_questions != '') { - # popravimo string za omejevanje userjev - $_string_user = str_replace(array(' AND usr_id IN (', ')'), '', $string_user); - $_string_user = explode(',',$_string_user); - $string_user = ' AND usr_id BETWEEN '.$_string_user[0].' AND '.end($_string_user); - - $str_query = 'SELECT spr_id, vre_id, usr_id, grd_id, loop_id FROM srv_data_checkgrid'.$this->db_table.' WHERE spr_id IN ('.$this->_str_questions.') '.$string_user; - - - $this->_qry_data_check_grids = sisplet_query($str_query); - if (!$this->_qry_data_check_grids) { - $this->trigerError('create_array_data_check_grids', 'MYSQL ERROR in qry: '.$str_query . " ".mysqli_error($GLOBALS['connect_db'])); - } - } - } - /** Vrnemo vrednost za uid in spr_id za tabelo srv_data_checkgrid - * - * @param $uid - * @param $spr_id - */ - private function get_array_data_check_grids ($uid, $spid) { - if (isset($this->_array_data_check_grids[$uid][$spid])) { - return $this->_array_data_check_grids[$uid][$spid]; - } - if ($this->_array_data_check_grids === null) { - if ($this->_qry_data_check_grids === null) { - return array(); - } - - if (mysqli_num_rows($this->_qry_data_check_grids)) { - mysqli_data_seek($this->_qry_data_check_grids, 0); - while ( list($spr_id, $vre_id, $usr_id, $grd_id, $loop_id) = mysqli_fetch_row($this->_qry_data_check_grids)) { - $loop_id = ($loop_id == null || $loop_id == '') ? 0 : $loop_id; - $this->_array_data_check_grids[(int)$usr_id][$spr_id.'_'.$loop_id][(int)$vre_id][(int)$grd_id] = (int)$grd_id; - } - } - if (isset($this->_array_data_check_grids[$uid][$spid])) - return $this->_array_data_check_grids[$uid][$spid]; - else return array(); - } else { - return array(); - } - } - - /** srv_data_number - * @desc vrne array z gridi za posameznega userja in spremenljivko - * ko prvič pokličemo naredimo query in napolnimo array - */ - private function create_array_data_number ($string_user) { - if ($this->_str_questions != '') { - # popravimo string za omejevanje userjev - $_string_user = str_replace(array(' AND usr_id IN (', ')'), '', $string_user); - $_string_user = explode(',',$_string_user); - $string_user = ' AND usr_id BETWEEN '.$_string_user[0].' AND '.end($_string_user); - - $str_query = "SELECT spr_id, vre_id, usr_id, REPLACE(text,'\n',' ') as text, REPLACE(text2,'\n',' ') as text2, loop_id FROM srv_data_number WHERE spr_id IN (".$this->_str_questions.') '.$string_user; - $this->_qry_data_number = sisplet_query($str_query); - - if (!$this->_qry_data_number) { - $this->trigerError('create_array_data_number', 'MYSQL ERROR in qry: '.$str_query . " ".mysqli_error($GLOBALS['connect_db'])); - } - - } - } - /** Vrnemo vrednost za uid in spr_id za tabelo srv_data_number - * - * @param $uid - * @param $spr_id - */ - private function get_array_data_number ($uid, $spid) { - if (isset($this->_array_data_number[$uid][$spid])) { - return $this->_array_data_number[$uid][$spid]; - } - if ($this->_array_data_number === null) { - if ($this->_qry_data_number === null) { - return array(); - } - - if (mysqli_num_rows($this->_qry_data_number)) { - mysqli_data_seek($this->_qry_data_number, 0); - while ( list($spr_id, $vre_id, $usr_id, $text, $text2, $loop_id) = mysqli_fetch_row($this->_qry_data_number)) { - $loop_id = ($loop_id == null || $loop_id == '') ? 0 : $loop_id; - $this->_array_data_number[(int)$usr_id][$spr_id.'_'.$loop_id][(int)$vre_id] = array('text'=>strip_tags($text),'text2'=>strip_tags($text2)) ; - } - } - if (isset($this->_array_data_number[$uid][$spid])) - return $this->_array_data_number[$uid][$spid]; - else - return array(); - } else { - return array(); - } - } - - /** srv_data_rating - * @desc vrne array z gridi za posameznega userja in spremenljivko - * ko prvič pokličemo naredimo query in napolnimo array - */ - private function create_array_data_rating ($string_user) { - if ($this->_str_questions != '') { - # popravimo string za omejevanje userjev - $_string_user = str_replace(array(' AND usr_id IN (', ')'), '', $string_user); - $_string_user = explode(',',$_string_user); - $string_user = ' AND usr_id BETWEEN '.$_string_user[0].' AND '.end($_string_user); - - $str_query = 'SELECT spr_id, vre_id, usr_id, vrstni_red, loop_id FROM srv_data_rating WHERE spr_id IN ('.$this->_str_questions.') '.$string_user; - $this->_qry_data_rating = sisplet_query($str_query); - if (!$this->_qry_data_rating) { - $this->trigerError('create_array_data_rating', 'MYSQL ERROR in qry: '.$str_query . " ".mysqli_error($GLOBALS['connect_db'])); - } - - } - } - /** Vrnemo vrednost za uid in spr_id za tabelo srv_data_rating - * - * @param $uid - * @param $spr_id - */ - private function get_array_data_rating ($uid, $spid) { - if (isset($this->_array_data_rating[$uid][$spid])) { - return $this->_array_data_rating[$uid][$spid]; - } - - if ($this->_array_data_rating === null) { - if ($this->_qry_data_rating === null) { - return array(); - } - - if (mysqli_num_rows($this->_qry_data_rating)) { - - mysqli_data_seek($this->_qry_data_rating, 0); - while ( list($spr_id, $vre_id, $usr_id, $vrstni_red, $loop_id) = mysqli_fetch_row($this->_qry_data_rating)) { - $loop_id = ($loop_id == null || $loop_id == '') ? 0 : $loop_id; - $this->_array_data_rating[(int)$usr_id][$spr_id.'_'.$loop_id][(int)$vre_id] = (int)$vrstni_red; - } - } - if (isset($this->_array_data_rating[$uid][$spid])) - return $this->_array_data_rating[$uid][$spid]; - else - return array(); - } else { - return array(); - } - } - - /** srv_data_textgrid - * @desc vrne array z gridi za posameznega userja in spremenljivko - * ko prvič pokličemo naredimo query in napolnimo array - */ - private function create_array_data_text_grid ($string_user) { - if ($this->_str_questions != '') { - # popravimo string za omejevanje userjev - $_string_user = str_replace(array(' AND usr_id IN (', ')'), '', $string_user); - $_string_user = explode(',',$_string_user); - $string_user = ' AND usr_id BETWEEN '.$_string_user[0].' AND '.end($_string_user); - - $str_query = "SELECT spr_id, vre_id, usr_id, grd_id, REPLACE(REPLACE(REPLACE(REPLACE(text, '\\\\', '/'),'\n',' '),'\r','
    '),'|',' ') as text, loop_id FROM srv_data_textgrid".$this->db_table." WHERE spr_id IN (".$this->_str_questions.') '.$string_user; - - $this->_qry_data_text_grid = sisplet_query($str_query); - if (!$this->_qry_data_text_grid) { - $this->trigerError('create_array_data_text_grid', 'MYSQL ERROR in qry: '.$str_query . " ".mysqli_error($GLOBALS['connect_db'])); - } - - } - } - /** Vrnemo vrednost za uid in spr_id za tabelo srv_data_textgrid - * srv_data_textgrid - * @param $uid - * @param $spr_id - */ - private function get_array_data_text_grid ($uid, $spid) { - if (isset($this->_array_data_text_grid[$uid][$spid])) { - return $this->_array_data_text_grid[$uid][$spid]; - } - if ($this->_array_data_text_grid === null) { - if ($this->_qry_data_text_grid === null) { - return array(); - } - - if (mysqli_num_rows($this->_qry_data_text_grid)) { - mysqli_data_seek($this->_qry_data_text_grid, 0); - while ( list($spr_id, $vre_id, $usr_id, $grd_id, $text, $loop_id) = mysqli_fetch_row($this->_qry_data_text_grid)) { - $loop_id = ($loop_id == null || $loop_id == '') ? 0 : $loop_id; - $this->_array_data_text_grid[(int)$usr_id][$spr_id.'_'.$loop_id][(int)$vre_id][(int)$grd_id] = trim(strip_tags($text)); - } - - } - if (isset($this->_array_data_text_grid[$uid][$spid])) - return $this->_array_data_text_grid[$uid][$spid]; - else return array(); - } else { - return array(); - } - } - - /** srv_data_upload - * @desc vrne array z imeni datotek za upload polja - * ko prvič pokličemo naredimo query in napolnimo array - */ - private function create_array_data_text_upload ($string_user) { - # popravimo string za omejevanje userjev - $_string_user = str_replace(array(' AND usr_id IN (', ')'), '', $string_user); - $_string_user = explode(',',$_string_user); - $string_user = ' AND usr_id BETWEEN '.$_string_user[0].' AND '.end($_string_user); - - $str_query = "SELECT usr_id, code, filename FROM srv_data_upload WHERE ank_id = '" . $this->sid . "'".$string_user; - - $this->_qry_data_text_upload = sisplet_query($str_query); - if (!$this->_qry_data_text_upload) { - $this->trigerError('create_array_data_text_upload', 'MYSQL ERROR in qry: '.$str_query . " ".mysqli_error($GLOBALS['connect_db'])); - } - } - - /** Vrnemo vrednost za filename za posamezen code za tabelo srv_data_upload - * srv_data_upload - * @param $code - */ - private function get_array_data_text_upload ($_code) { - if (isset($this->_array_data_text_upload[$_code])) { - return $this->_array_data_text_upload[$_code]; - } - if ($this->_array_data_text_upload === null) { - if (mysqli_num_rows($this->_qry_data_text_upload)) { - mysqli_data_seek($this->_qry_data_text_upload, 0); - while ( list($usr_id, $code, $filename) = mysqli_fetch_row($this->_qry_data_text_upload)) { - $this->_array_data_text_upload[$code] = strip_tags($filename); - } - } - if(isset($this->_array_data_text_upload[$_code])) - return $this->_array_data_text_upload[$_code]; - else return 'Download'; - } else { - return 'Download'; - } - } - - /** - * Ustvarimo array z vrstnimi redi v randomizaciji (vprasanje ali blok) - */ - private function create_array_data_random ($string_user) { - - // Ce smo ze zakesirali ne rabimo naprej - if ($this->_array_data_random_cached){ - return; - } - - # popravimo string za omejevanje userjev - $_string_user = str_replace(array(' AND usr_id IN (', ')'), '', $string_user); - $_string_user = explode(',',$_string_user); - - $string_user = ' usr_id BETWEEN '.$_string_user[0].' AND '.end($_string_user); - - - // Najprej dobimo random podatke za randomizacijo znotraj vprasanj - $str_query = 'SELECT spr_id, usr_id, vrstni_red FROM srv_data_random_spremenljivkaContent WHERE '.$string_user; - $_qry_data_random = sisplet_query($str_query); - if (!$_qry_data_random) { - $this->trigerError('create_array_data_random', 'MYSQL ERROR in qry: '.$str_query . " ".mysqli_error($GLOBALS['connect_db'])); - } - - if (mysqli_num_rows($_qry_data_random)) { - while($row1 = mysqli_fetch_array($_qry_data_random)){ - $this->_array_data_random[$row1['usr_id']]['spr'][$row1['spr_id']] = $row1['vrstni_red']; - } - } - - - // Dobimo se random podatke za randomizacijo znotraj blokov - $str_query = 'SELECT block_id, usr_id, vrstni_red FROM srv_data_random_blockContent WHERE '.$string_user; - $_qry_data_random = sisplet_query($str_query); - if (!$_qry_data_random) { - $this->trigerError('create_array_data_random', 'MYSQL ERROR in qry: '.$str_query . " ".mysqli_error($GLOBALS['connect_db'])); - } - - if (mysqli_num_rows($_qry_data_random)) { - while($row2 = mysqli_fetch_array($_qry_data_random)){ - - // Zgradimo string z labelami vprasanj za prikaz v podatkih - $vrstni_red_string = ''; - - // Spremenljivke v blokih - if($this->_array_random[$row2['block_id']]['type'] == 'blok_spr'){ - - // Pridobimo imena vprasanj za izpis - $sqlLabele1 = sisplet_query("SELECT variable - FROM srv_spremenljivka - WHERE id IN (".$row2['vrstni_red'].") - ORDER BY FIND_IN_SET(id, '".$row2['vrstni_red']."') - "); - while($rowLabele1 = mysqli_fetch_array($sqlLabele1)){ - $vrstni_red_string .= $rowLabele1['variable'].','; - } - } - // Bloki v blokih - else{ - // Pridobimo imena blokov za izpis - $sqlLabele2 = sisplet_query("SELECT number - FROM srv_if - WHERE id IN (".$row2['vrstni_red'].") - ORDER BY FIND_IN_SET(id, '".$row2['vrstni_red']."') - "); - if($sqlLabele2){ - while($rowLabele2 = mysqli_fetch_array($sqlLabele2)){ - $vrstni_red_string .= 'B'.$rowLabele2['number'].','; - } - } - } - - $vrstni_red_string = substr($vrstni_red_string, 0, -1); - $this->_array_data_random[$row2['usr_id']]['block'][$row2['block_id']] = $vrstni_red_string; - } - } - - - // Oznacimo da smo opravili kesiranje - $this->_array_data_random_cached = true; - } - - /** - * Vrnemo podatke vrstnega reda za userja in element (vprasanje ali blok) - */ - private function get_array_data_random ($uid, $el_id, $el_type) { - - // Ce imamo vrednost jo vrnemo - if (isset($this->_array_data_random[$uid][$el_type][$el_id])) { - return $this->_array_data_random[$uid][$el_type][$el_id]; - } - else { - return ''; - } - } - - - public function trigerError($what, $error) { - - # trigger_error("Could not perform action. " . $error, E_USER_WARNING); - $this->noErrors = false; - $this->logError[][$what] = $error; - - return; - } - - - public function getLog() { - return array('error'=>$this->logError); - } - - /** - * @desc izracuna razliko med dvema datuma (za cas odgovarjanja na eno stran) - */ - private function date_diff($d1, $d2){ - $d1 = (is_string($d1) ? strtotime($d1) : $d1); - $d2 = (is_string($d2) ? strtotime($d2) : $d2); - - $diff_secs = abs($d1 - $d2); - $base_year = min(date("Y", $d1), date("Y", $d2)); - - $diff = mktime(0, 0, $diff_secs, 1, 1, $base_year); - - - $days_total = floor($diff_secs / (3600 * 24)); - $hours_total = floor($diff_secs / 3600); - - // total hours - if ($hours_total < 24) - return date("H:i:s", $diff); - else - return $hours_total.':'.date("i:s", $diff); - - - /* alternativni prikaz, ki izpise stevilo dni namesto ur - // total days - if ($days_total == 0) - return date("H:i:s", $diff); - else - return $days_total.' days '.date("H:i:s", $diff); - */ - } - - - public function collectLoop() { - # ali smo za to anketo že lovili loope, da se ne podvajamo - if ($this->_loop_collected == false) { - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hs'] = 3; - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = 0; - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = 0; - session_commit(); - - # na katero spremenljivko se veže loop - $this->_array_loop_on_spr = array(); - $this->_array_loop_parent = array(); - $loop_spr_select = "select l.if_id, l.spr_id FROM srv_branching AS b, srv_loop AS l WHERE b.ank_id = '".$this->sid."' AND b.element_if = l.if_id;"; - $qryLoop_spr_select = sisplet_query($loop_spr_select); - while (list($loop_id,$spr_id) = mysqli_fetch_row($qryLoop_spr_select)) { - $this->_array_loop_parent[$spr_id] = $loop_id; - $this->_array_loop_on_spr[$loop_id] = $spr_id; - $_cnt_loop++; - } - - #katere vrednosti uporablja posamezen loop ( kolikokrat se loop zavrti) - $this->_array_vre_on_loop = array(); - $this->_array_vrednosti_in_loops = array(); - $vre_on_loop_select = "select ld.id, ld.if_id, ld.vre_id FROM srv_loop_data AS ld WHERE ld.if_id IN (select l.if_id FROM srv_branching AS b, srv_loop AS l WHERE b.ank_id = '".$this->sid."' AND b.element_if = l.if_id) ORDER BY if_id, ld.vre_id, ld.id;"; - $qry_vre_on_loop_select = sisplet_query($vre_on_loop_select); - while (list($id, $loop_id,$vre_id) = mysqli_fetch_row($qry_vre_on_loop_select)) { - # če imamp SN -imena in je loop na SN - imena ne loopamo po vseh vrednostih, ampak samo po max vnosih - $this->_array_vre_on_loop[$loop_id][$id] = $vre_id; - $this->_array_vrednosti_in_loops[] = $vre_id; - - // Posebej nastavimo ce gre za loop po numeric vprasanju - if($vre_id == null){ - $this->_array_vre_on_loop[$loop_id][$id] = 'num_loop'; - $this->_array_vrednosti_in_loops[] = 'num_loop'; - } - } - - #preverimo katere spremenljvke so v katerem loopu - $this->_array_spr_in_loop = array(); - $this->_array_loop_has_spr = array(); - $b = new Branching ($this->sid); - $_loops = $b->spremenljivke_in_loop(); - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsa'] = count($_loops); - session_commit(); - - $cntHs=0; - if (count($_loops) > 0 ) { - foreach ($_loops AS $lkey => $spr_ids) { - $cntHs++; - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['hsc'] = $cntHs; - session_commit(); - - if (count($spr_ids) > 0 ) { - $this->_array_loop_has_spr[$lkey] = array(); - foreach ($spr_ids AS $spr_id) { - $this->_array_spr_in_loop[$spr_id] = $lkey; - $this->_array_loop_has_spr[$lkey][] = $spr_id; - } - } - } - } - $this->_loop_collected = true; - } - } - - public function createAllQuestionsOrder() { - - # delamo samo 1x - if ( $this->AllQuestionsData !==null && $this->AllQuestionsOrder != null) { - return array('AllQuestionsData'=>$this->AllQuestionsData, 'AllQuestionsOrder'=>$this->AllQuestionsOrder); - } - - # polovimo spremenljivke za survey Grid Multiple - kombinirana vprašanja - $sgmMap = array(); - $sqlSgmMap = sisplet_query("SELECT sgm.parent AS sgm_parrent, s.id, s.tip, s.variable, REPLACE(REPLACE(REPLACE(s.naslov,'\n',' '),'\r','
    '),'|','
    ') as naslov, s.gru_id, s.size, s.random, s.cela, s.decimalna, s.skala, s.enota, s.sistem, s.upload, s.signature, s.grid_subtitle1, s.grid_subtitle2, s.inline_edit, REPLACE(REPLACE(REPLACE(s.naslov_graf,'\n',' '),'\r','
    '),'|','
    ') as naslov_graf, s.edit_graf, s.wide_graf, s.antonucci, s.visible, s.dostop". - " FROM srv_spremenljivka AS s JOIN srv_grid_multiple AS sgm ON (s.id = sgm.spr_id) WHERE sgm.ank_id = '$this->sid' ORDER BY sgm.vrstni_red"); - while ($sgmRow = mysqli_fetch_assoc($sqlSgmMap)) { - $sgmMap[$sgmRow['sgm_parrent']][] = $sgmRow; - } - #peverimo ali so bili skreirani loopi - if ($this->_array_loop_on_spr == null || $this->_array_spr_in_loop == null) { - $this->collectLoop(); - } - - $this->AllQuestionsData = array(); - $this->AllQuestionsOrder = array(); - $star_loop_id = null; - - # za SN - imena - if(SurveyInfo::getInstance()->checkSurveyModule('social_network')){ - $sn_loop_variables = $this->getSNVariablesForSpr(); - } - - if ($this->_cnt_questions > 0) { - mysqli_data_seek($this->_qry_questions, 0); - - while ($rowMainVprasanje = mysqli_fetch_assoc($this->_qry_questions)) { - $rowVprasanja = array(); - - if (!is_countable($sgmMap[$rowMainVprasanje['id']]) || count($sgmMap[$rowMainVprasanje['id']]) == 0) { - $rowVprasanja[] = $rowMainVprasanje; - } - else { - # preverimo parent tip. mora biti 24 - if ((int)$rowMainVprasanje['tip'] == 24){ - # imamo kombinirano vprašanje - foreach ($sgmMap[$rowMainVprasanje['id']] AS $sgmRow) { - $tmpVprasanje = $sgmRow; - # popravimo variablo in besedilo - $tmpVprasanje['sgm_parrent'] = $rowMainVprasanje['id']; - $tmpVprasanje['variable'] = $rowMainVprasanje['variable'].'_'.$sgmRow['variable']; - $tmpVprasanje['naslov'] = $rowMainVprasanje['naslov']; - $rowVprasanja[] = $tmpVprasanje; - } - } - else - { # če ne ni kombinirana tabela - $rowVprasanja[] = $rowMainVprasanje; - } - - } - if (count($rowVprasanja) > 0) { - foreach ($rowVprasanja AS $rowVprasanje) { - $spr_id = $rowVprasanje['id']; - $this->AllQuestionsData[$rowVprasanje['id']] = array( - 'id' => $rowVprasanje['id'], - 'spr_id' => $spr_id, - 'sgm_parrent'=> $rowVprasanje['sgm_parrent'], - 'tip' => $rowVprasanje['tip'], - 'gru_id' => $rowVprasanje['gru_id'], - 'variable' => strip_tags($rowVprasanje['variable']), - 'naslov' => strip_tags($rowVprasanje['naslov']), - 'label' => strip_tags($rowVprasanje['label']), - 'size' => $rowVprasanje['size'], - 'cela' => $rowVprasanje['cela'], - 'grid_subtitle1' => $rowVprasanje['grid_subtitle1'], - 'grid_subtitle2' => $rowVprasanje['grid_subtitle2'], - 'decimalna' => $rowVprasanje['decimalna'], - 'skala' => $rowVprasanje['skala'], - 'sistem' => $rowVprasanje['sistem'], - 'enota' => $rowVprasanje['enota'], - 'if_id' => (isset($this->_array_spr_in_loop[$spr_id]) ? $this->_array_spr_in_loop[$spr_id] : 0), - 'upload' => $rowVprasanje['upload'], - 'signature' => $rowVprasanje['signature'], - 'naslov_graf' => $rowVprasanje['naslov_graf'], - 'edit_graf' => $rowVprasanje['edit_graf'], - 'wide_graf' => $rowVprasanje['wide_graf'], - 'antonucci' => $rowVprasanje['antonucci'], - 'visible' => $rowVprasanje['visible'], - 'dostop' => $rowVprasanje['dostop'], - 'random' => $rowVprasanje['random'] - ); - if ($rowVprasanje['inline_edit'] != 0) { - $this->AllQuestionsData[$rowVprasanje['id']]['inline_edit'] = $rowVprasanje['inline_edit']; - } - - // Zabelezimo stevilo vprasanj po tipu - $this->_cnt_questions_types[$rowVprasanje['tip']] = (isset($this->_cnt_questions_types[$rowVprasanje['tip']])) ? $this->_cnt_questions_types[$rowVprasanje['tip']]+1 : 1; - - # če je spremenljivka parent od loopa jo dodamo - if (isset($this->_array_loop_parent[$spr_id]) && $this->_array_loop_parent[$spr_id] > 0) { - $this->AllQuestionsData[$rowVprasanje['id']]['loop_parent'] = $this->_array_loop_parent[$spr_id]; - $this->AllQuestionsData[$rowVprasanje['id']]['antonucci'] = $rowVprasanje['antonucci']; - } - # dodamo vprašanje v vrstni red, če je vprašanje v loopu dodamo loop - if (!isset($this->_array_spr_in_loop[$spr_id])) { - # vprašanje ni v loopu - $this->AllQuestionsOrder[] = array('id'=>$spr_id,'loop_id'=>0); - $star_loop_id = null; # nismo v loopu - - } else { - # vprašanje je v lopu - $trenutni_loop_id = $this->_array_spr_in_loop[$spr_id]; # id loopa v katerem se nahaja spremenljivk - # na katero spremenljivko se dela loop - $loop_on_spr = $this->_array_loop_on_spr[$trenutni_loop_id]; - - # če ta loop in pripadajoča vprašanja še niso bila dodana v vrstni red, jih dodamoše ni bil - if ($trenutni_loop_id != $star_loop_id) { - - # loop še ni bil sprocesiran; - $_vrednosti_v_loopu = $this->_array_vre_on_loop[$trenutni_loop_id]; - - # preverimo ali smo v navadnem loopu ali v SN loopu - if (isset($this->SNVariablesForSpr[$loop_on_spr]) == false) { - # smo v navadnem loopu - # kolikokrat moramo iti skozi loop - if (count($_vrednosti_v_loopu)) { - foreach ($_vrednosti_v_loopu AS $li_id => $vrednost) { - # dodamo vprašanja ki so v posameznemm loopu. - if (count($this->_array_loop_has_spr[$trenutni_loop_id])) { - foreach($this->_array_loop_has_spr[$trenutni_loop_id] AS $vprasanje) { - $this->AllQuestionsOrder[] = array('id'=>$vprasanje,'loop_id'=>$li_id,'vre_id'=>$vrednost, 'parent_loop_id'=>$trenutni_loop_id); - } - } - } - } - } else { - # smo v SN loopu - skozi loop gremo samo za vrednosti ki so dodane kot sn imena - if (count($_vrednosti_v_loopu)) { - foreach ($_vrednosti_v_loopu AS $li_id => $vrednost) { - if (in_array($vrednost,$this->SNVariablesForSpr[$loop_on_spr])) { - # dodamo vprašanja ki so v posameznemm loopu. - if (count($this->_array_loop_has_spr[$trenutni_loop_id])) { - foreach($this->_array_loop_has_spr[$trenutni_loop_id] AS $vprasanje) { - $this->AllQuestionsOrder[] = array('id'=>$vprasanje,'loop_id'=>$li_id,'vre_id'=>$vrednost, 'parent_loop_id'=>$trenutni_loop_id); - } - } - } - } - } - - } - - # priredimo kateri loop smo že obdelali, da ne bomo 2x - $star_loop_id = $trenutni_loop_id; - } else { - # loop je že bil sprocesiran, ne naredimo nič - } - } - } - } - } - } - return array('AllQuestionsData'=>$this->AllQuestionsData, 'AllQuestionsOrder'=>$this->AllQuestionsOrder); - } - - /* - public function getVariableLabelsForLoop() { - $result = array(); - if (count($this->_array_vrednosti_in_loops) > 0) { - $sql_vrednosti = sisplet_query('select id, naslov, variable from srv_vrednost where id IN ('.implode(",",$this->_array_vrednosti_in_loops).') order by spr_id, vrstni_red'); - while (list($id, $naslov, $variabla) = mysqli_fetch_row($sql_vrednosti)) { - $result[$id] = array('naslov'=>$naslov, 'variabla'=>$variabla); - } - } - return $result; - - } -*/ - public function getArrayLoopOnSpremenljvika() { - return $this->_array_loop_on_spr; - } - public function getArrayVrednostOnLoop() { - return $this->_array_vre_on_loop; - } - - public function getSNVariablesForSpr() { - $_result = array(); - - if ($this->_cnt_questions > 0) { - mysqli_data_seek($this->_qry_questions, 0); - while ($rowVprasanje = mysqli_fetch_assoc($this->_qry_questions)) { - if($rowVprasanje['tip'] == 9) { - $_result[] = $rowVprasanje['id']; - } - } - } - - if (count($_result) > 0) { - foreach ($_result AS $spr_id) { - $string = "SELECT vre_id FROM srv_data_text".$this->db_table." WHERE spr_id = '".$spr_id."' GROUP BY vre_id"; - $qry = sisplet_query($string); - while ( $row = mysqli_fetch_assoc($qry)) { - if ( $row['vre_id'] > 0 ) { - $this->SNVariablesForSpr[$spr_id][$row['vre_id']] = $row['vre_id']; - } - } - - } - } - - return $this->SNVariablesForSpr; - } - - public function get_user_CMS_email($user_from_cms_id) { - # če še niammo arraya z e-maili - if ($this->_array_users_from_CMS == null) { - # polovimo emaile uporrabnikov iz CMS - $this->_array_users_from_CMS = array(); - - $string = "SELECT su.user_id, u.email FROM srv_user AS su JOIN users AS u ON su.user_id = u.id WHERE su.ank_id = '".$this->sid."' AND su.preview='0' AND su.deleted='0' AND su.user_id > 0"; - $qry = sisplet_query($string); - while ( $row = mysqli_fetch_assoc($qry)) { - $this->_array_users_from_CMS[$row['user_id']] = $row['email']; - } - } - - #ko smo že polovili e-maile - if (is_array($this->_array_users_from_CMS) && isset($this->_array_users_from_CMS[$user_from_cms_id])) { - return $this->_array_users_from_CMS[$user_from_cms_id]; - } else { - return ''; - } - } - - private function recode_answer($spr_id, $answer, $uid) { - $this->addUserSprAnswerCount($spr_id, $answer, $uid); - - # najprej preverimo ali imamo mapping za sistemske missige - $answer = isset($this->sysMissingMap[$answer]) && $this->sysMissingMap[$answer] != null - ? $this->sysMissingMap[$answer] - : $answer; - $_recoded = $answer; - if ( $this->_array_recode === null) { - $this->_array_recode = array(); - - # polovimo vse spremenljivke za katere moramo rekodirat - $strSelect = "SELECT spr_id, search, value, operator FROM srv_recode WHERE ank_id = '".$this->sid."' AND enabled='1' ORDER BY vrstni_red"; - $sqlSelect = sisplet_query($strSelect); - if (!$sqlSelect) { - #echo mysqli_error($GLOBALS['connect_db']); - } - if (mysqli_num_rows($sqlSelect)) { - while ($rowSelect = mysqli_fetch_assoc($sqlSelect)) { - $this->_array_recode[$rowSelect['spr_id']][] = array('s'=>$rowSelect['search'],'v'=>$rowSelect['value'],'o'=>$rowSelect['operator']); - } - } - } - if (isset($this->_array_recode[$spr_id])) { - $recoded = false; - if (isset($this->_array_recoded[$spr_id][$answer])) { - return $this->_array_recoded[$spr_id][$answer]; - } else if (count($this->_array_recode[$spr_id]) > 0 && $recoded == false) { - foreach ($this->_array_recode[$spr_id] AS $k => $do_recode) { - if ( $answer == $do_recode['s'] || (int)$do_recode['o'] > 0 && $recoded == false) { - $original = $_recoded; - $_recoded = $this->check_recode($_recoded,$do_recode['s'],$do_recode['v'],$do_recode['o']); - if ($original != $_recoded) { - $recoded = true; - } - } - } - $this->_array_recoded[$spr_id][$answer] = $_recoded; - } - } - - #vrnemo rezultat - return $_recoded; - } - - function check_recode ($answer,$search,$value,$operand) { - $_recoded = $answer; - switch ($operand) { - case 0: # == - $_recoded = $answer == $search ? $value : $answer; - break; - case 1: # <> - $_recoded = $answer != $search ? $value : $answer; - break; - case 2: # < - $_recoded = $answer < $search ? $value : $answer; - break; - case 3: # > - $_recoded = $answer > $search ? $value : $answer; - break; - case 4: # <= - $_recoded = $answer <= $search ? $value : $answer; - break; - case 5: # >= - $_recoded = $answer >= $search ? $value : $answer; - break; - case 6: # >= - $search = explode(',',$search); - $s1 = (int)$search[0]; - $s2 = (int)$search[1]; - $_recoded = (int)$answer >= $s1 && (int)$answer <= $s2 ? $value : $answer; - break; - } - return $_recoded; - } - - function convert($size) - { - $unit=array('b','kb','mb','gb','tb','pb'); - return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; - } - - public function getFileStatus() { - return $this->fileStatus; - } - public function getFileUpdated() { - return $this->last_update; - } - public function getHeadFileName() { - if (file_exists($this->folder . 'export_header_'.$this->sid.'.dat')) { - return $this->folder . 'export_header_'.$this->sid.'.dat'; - } else { - return null; - } - } - - public function getDataFileName() { - if (file_exists($this->folder . 'export_data_'.$this->sid.'.dat')) { - return $this->folder . 'export_data_'.$this->sid.'.dat'; - } else { - return null; - } - - } - - public function getAutoCreatingFile () { - return $this->autoCreatingFile; - } - - public function getSurveyVariables($filterTip = NULL) { - $result = array(); - if (!isset($this->_HEADER) || $this->_HEADER == null) { - $this->_HEADER = unserialize(file_get_contents($this->getHeadFileName())); - } - - if ($this->getHeadFileName() != null ) { - - foreach ($this->_HEADER AS $_vkey => $variable) { - # dodamo samo tiste variable, ki imajo numerični tip (navadne spremenljvke) - if (is_numeric($variable['tip'] ) - # ne dodamo sistemskih email, telefon, ime, priimek, naziv - && !( (int)$variable['hide_system'] == 1 - && in_array($variable['variable'],unserialize (SYSTEM_VARIABLES)) )# unserialize (SYSTEM_VARIABLES) -> definition.php = array('email','telefon','ime','priimek','naziv','drugo') - ) { - - # če filter ni setiran dodamo vse variable - if ( $filterTip == NULL ) { - $result[$_vkey] = $variable['sequences']; - } else if ( is_array($filterTip) && in_array($variable['tip'],$filterTip) ) { - $result[$_vkey] = $variable['sequences']; - } else if ( is_string($filterTip) && (string)$variable['tip'] == (string)$filterTip ) { - $result[$_vkey] = $variable['sequences']; - }else if ( is_numeric($filterTip) && (int)$variable['tip'] == (int)$filterTip ) { - $result[$_vkey] = $variable['sequences']; - } - } - } - } - return $result; - } - - public function getVariableName($variable) { - if (!isset($this->_HEADER) || $this->_HEADER == null) { - $this->_HEADER = unserialize(file_get_contents($this->getHeadFileName())); - } - - $result = ''; - if (isset($this->_HEADER[$variable])) { - $result = '(' . $this->_HEADER[$variable]['variable'] .') - '.$this->_HEADER[$variable]['naslov']; - } - return $result; - } - - public function getHeaderVariable($variable) { - if (!isset($this->_HEADER) || $this->_HEADER == null) { - if (trim($this->getHeadFileName()) != '') { - $this->_HEADER = unserialize(file_get_contents($this->getHeadFileName())); - } - } - return $this->_HEADER[$variable]; - } - - public function setSkipCreate($skipCreate = false) { - $this->skipCreate = $skipCreate; - } - - - public function getDataFileInfo() { - global $admin_type, $lang; - - $result = null; - - if ($admin_type == '0') { - - if ($this->fileStatus != FILE_STATUS_NO_FILE && (int)$this->data_file_time > 0 && file_exists($this->folder . 'export_data_'.$this->sid.'.dat')) { - # delamo inkremental - $inkremental_user_limit = " AND u.time_edit > FROM_UNIXTIME('".(int)$this->data_file_time."') "; - } else { - # lovimo vse userje - datoteko generiramo na novo - $inkremental_user_limit = ''; - } - - $str_qry_usr_cnt = "SELECT count(u.id) FROM srv_user AS u WHERE u.ank_id = '".$this->sid."' AND u.preview='0' AND u.deleted='0' ".$this->is_valid_user_limit.$inkremental_user_limit; - $qry_usr_cnt = sisplet_query($str_qry_usr_cnt); - list($user_cnt) = mysqli_fetch_row($qry_usr_cnt); - - // Preverimo ce imamo izklopljeno belezenje parapodatka datum - potem moramo vedno generirati datoteko - $no_paradata_date = SurveySetting::getInstance()->getSurveyMiscSetting('survey_date'); - - $result = '  '; - if ($this->fileStatus == FILE_STATUS_NO_DATA) - { - $result .= $lang['srv_dashboard_no_data']; - } - else if ($this->fileStatus == FILE_STATUS_NO_FILE) - { - $result .= $lang['srv_dashboard_no_file'].$lang['srv_dashboard_new_units'].(int)$user_cnt; - } - else if ($this->fileStatus == FILE_STATUS_OLD && $no_paradata_date == 0) { - $result .= $lang['srv_dashboard_not_up_to_date'].'('.$this->last_update.')'; - $result .= $lang['srv_dashboard_new_units'].(int) $user_cnt; - } - else if ($this->fileStatus == FILE_STATUS_OLD && $no_paradata_date == 1) { - $result .= $lang['srv_dashboard_up_to_date'].' ('.$this->last_update.')'; - } - else if ($this->fileStatus == FILE_STATUS_OK) { - $result .= $lang['srv_dashboard_up_to_date'].' ('.$this->last_update.')'; - } - } - return $result; - } - - function cleanup() { - # resetiramo vse pointerje - - $this->noErrors = true; - - $this->_HEADER = null; - $this->_qry_groups = null; # cache query za strani - $this->_str_groups = null; # cache string za strani - $this->_cnt_groups = 0; # cache število za strani - $this->_qry_questions = null; # cache query za vprašanja - $this->_str_questions = null; # cache string za vprašanja - $this->_cnt_questions = 0; # cache za število vprašanj - $this->_qry_users = null; # cache query za vprašanja - $this->_str_users = null; # cache string za user_id ji - $this->_cnt_all_users = 0; # cache za število userjev - $this->_qry_vrednosti = null; # cache query za vrednosti - $this->_array_vrednosti = null; # cache array z vrednostmi - $this->_cnt_vrednosti = 0; # cache za število vseh vrednosti - $this->_qry_gridi = null; # cache query za gride - $this->_array_gridi = null; # cache array z gridi - $this->_cnt_gridi = 0; # cache za število vseh gridov - $this->_qry_rand_blocks = null; # cache query za random bloke - $this->_qry_data_vrednost = null; - $this->_array_data_vrednost = null; - $this->_qry_data_text = null; - $this->_array_data_text = null; - $this->_qry_data_grids = null; - $this->_array_data_grids = null; - $this->_qry_data_check_grids = null; - $this->_array_data_check_grids = null; - $this->_qry_data_number = null; - $this->_array_data_number = null; - $this->_qry_data_rating = null; - $this->_array_data_rating = null; - $this->_qry_data_text_grid = null; - $this->_array_data_text_grid = null; - $this->_array_SPSS = null; # zakeširamo array usergrup za uporabnika - $this->_array_user_grupa = null; # zakeširamo array usergrup za uporabnika - $this->_array_users_from_CMS = null; - - $this->_loop_collected = false; # Ali smo že zakeširali loop - - } - - function skipCreateIfInProgress() { - $qstr = "SELECT updateInProgress, updateStartTime, TIME_TO_SEC(TIMEDIFF(now(), updateStartTime)) as diference FROM srv_data_files WHERE sid = '".$this->sid."'"; - $qqry = sisplet_query($qstr); - list($updateInProgress, $updateStartTime, $diference) = mysqli_fetch_row($qqry); - if ((int)$updateInProgress == 0) { - return false; - } else { - # v teku je kreacija datoteke preverimo da ni slučajno od te instance - if ($this->updateStartTime == $updateStartTime) { - #generacijo smo zagnali iz te instance - return false; - } else if ((int)$diference > (int)INCREMENTAL_LOCK_TIMEOUT) { - # preverimo še čas zaklepanja, če je većji kot INCREMENTAL_LOCK_TIMEOUT = 20 minut, pomeni da je nekaj šlo narove in pustimo ponovno generacijo datoteke - - return false; - } else { - #echo 'Kreacija datoteke je že v teku!'; - # generacija je že v teku in od zagona še ni minil 20 minut - return true; - } - } - } - - function setStartInProgress() { - if ($this->updnateStartTime == null) { - SurveyTrackIncremental::write($this->sid,'setStartInProgress() =>'.implode(',',func_get_args())); - - $str_qry_update = "INSERT INTO srv_data_files (sid, updateInProgress, updateStartTime) VALUES ('".$this->sid."','1', NOW()) ON DUPLICATE KEY UPDATE updateInProgress = '1', updateStartTime = NOW()"; - $updated = sisplet_query($str_qry_update); - sisplet_query('COMMIT'); - $qstr = "SELECT updateInProgress, updateStartTime FROM srv_data_files WHERE sid = '".$this->sid."'"; - $qqry = sisplet_query($qstr); - list($updateInProgress, $updateStartTime) = mysqli_fetch_row($qqry); - $this->updateStartTime = $updateStartTime; - session_start(); - $_SESSION['incrementalProgressBar'][$this->sid]['current'] = 0; - $_SESSION['incrementalProgressBar'][$this->sid]['total'] = $this->_cnt_all_users; - $_SESSION['incrementalProgressBar'][$this->sid]['status'] = 1; - session_commit(); - } - } - - function setStopInProgress() { - if ($this->updateStartTime != null) { - SurveyTrackIncremental::write($this->sid,'setStopInProgress() =>'.implode(',',func_get_args())); - $qstr = "SELECT updateInProgress, updateStartTime FROM srv_data_files WHERE sid = '".$this->sid."'"; - $qqry = sisplet_query($qstr); - list($updateInProgress, $updateStartTime) = mysqli_fetch_row($qqry); - if ($this->updateStartTime == $updateStartTime ) { - $str_qry_update = "INSERT INTO srv_data_files (sid, updateInProgress, updateStartTime) VALUES ('".$this->sid."','0', '0000-00-00') ON DUPLICATE KEY UPDATE updateInProgress = '0', updateStartTime = '0000-00-00'"; - $updated = sisplet_query($str_qry_update); - sisplet_query('COMMIT'); - $this->updateStartTime = null; - } - } - } - - function setSurveyMissingValues() { - $smv = new SurveyMissingValues($sid); - $smv -> Init(); - - $_sys_missings = $smv->GetSurveyMissingValues(); - if (is_array($_sys_missings) && count($_sys_missings) > 0) - foreach ($_sys_missings[1] AS $_sys_missing) { - #nastavimo mapping za rekodiranje sistemskih vrednosti - $this->sysMissingMap[$_sys_missing['defSysVal']] = $_sys_missing['value']; - } - } - - function clearSurveyDataFiles($filename=null) { - if ($filename !== null && trim($filename)!='') { - # brišemo specifično datoteko - if (file_exists($filename)) { - unlink($filename); - } - } else { - #pobrišemo header datoteke - if (file_exists($this->folder . 'export_header_'.$this->sid.'.dat')) { - unlink($this->folder . 'export_header_'.$this->sid.'.dat'); - } - #pobrišemo data datoteko - if (file_exists($this->folder . 'export_data_'.$this->sid.'.dat')) { - unlink($this->folder . 'export_data_'.$this->sid.'.dat'); - } - - # pobrišemo tmp file - if (file_exists($this->folder . 'export_data_'.$this->sid.'.tmp')) { - unlink($this->folder . 'export_data_'.$this->sid.'.tmp'); - } - if (file_exists($this->folder . 'export_data_'.$this->sid.'.dat_data1.tmp')) { - unlink($this->folder . 'export_data_'.$this->sid.'.dat_data1.tmp'); - } - if (file_exists($this->folder . 'export_data_'.$this->sid.'.dat_data1_1.tmp')) { - unlink($this->folder . 'export_data_'.$this->sid.'.dat_data1_1.tmp'); - } - - # odstranimo morebitne SN datoteke - header - $files = glob($this->folder.'export_sn_header_'.$this->sid.'_*.dat'); - if(count($files ) > 0) { - foreach ($files AS $file) { - unlink($file); - } - } - # odstranimo morebitne SN datoteke - data - $files = glob($this->folder.'export_sn_data_'.$this->sid.'_*.dat'); - if(count($files ) > 0) { - foreach ($files AS $file) { - unlink($file); - } - } - } - } - - public function checkRealFile() { - #preštejemo enote iz datoteke - if (IS_WINDOWS) { - $command = 'awk "NF != 0 {++count} END {print count}" '.$this->data_file_name; - } else { - $command = 'awk \'NF != 0 {++count} END {print count}\' '.$this->data_file_name; - } - - $lines = (int)shell_exec($command); - #preštejemo userje iz baze - if ((int)$this->collect_all_status == 1) { - # vse statuse - $str_qry_cnt = "SELECT count(*) FROM srv_user AS u WHERE u.ank_id = '".$this->sid."' AND u.preview='0' AND u.deleted='0'"; - $qryqry_cnt = sisplet_query($str_qry_cnt); - list($cnt) = mysqli_fetch_row($qryqry_cnt); - } else { - # samo ustrezne - $str_qry_cnt = "SELECT count(*) FROM srv_user AS u WHERE u.ank_id = '".$this->sid."' AND u.preview='0' AND u.deleted='0' AND u.last_status IN (5,6)"; - $qryqry_cnt = sisplet_query($str_qry_cnt); - list($cnt) = mysqli_fetch_row($qryqry_cnt); - } - #vsi statusi - $result = array('result'=>((int)$lines == (int)$cnt ? true : false), 'file'=>(int)$lines, 'db'=>$cnt); - return $result; - } - - function deleteUsers() { - # če fajl sploh obstaja - #datoteka s podatki - $f1 = $this->data_file_name; - #datoteka kam zapišemo user id-je ki jih je potrebno pobrisat - $f2 = $this->data_file_name.'.todel'; - # datoteka kamor začasno shranimo original - $f3 = $this->data_file_name.'_'.time().'.orig'; - - if ((int)$this->sid > 0 && file_exists($f1)) { - # zaklenemo izvajanje - $lock = new ExclusiveLock( "survey_lock_".$this->sid, FALSE); - if( $lock->lock( ) == FALSE ) { - SurveyTrackIncremental::write($this->sid,'deleteUsers(); LOCK: alreadyLocked for survey: '.$this->sid); - #error("Locking failed"); - } else { - try { - if ((int)$this->data_file_time > 0) { - # preberemo max time iz datoteke in uporabimo manjšega - if (IS_WINDOWS) { - $command = 'awk -F"|" "BEGIN {max = 0} {if ('.TIME_FIELD.' > max && '.TIME_FIELD.' > 0) max='.TIME_FIELD.' } END {print max}" '.$f1; - } else { - $command = 'awk -F\'|\' \'BEGIN {max = 0} {if ('.TIME_FIELD.' > max && '.TIME_FIELD.' > 0) max='.TIME_FIELD.' } END {print max}\' '.$f1; - } - $user_time_from_file = shell_exec($command); - - # delamo inkremental - $inkremental_user_limit = " AND u.time_edit > FROM_UNIXTIME('".max((int)$this->data_file_time,(int)$user_time_from_file)."') "; - } else { - # lovimo vse userje - datoteko generiramo na novo - $inkremental_user_limit = ''; - } - - # za inkrementalno brisanje datotek - $str_qry_deleted = "SELECT u.id AS usr_id FROM srv_user AS u WHERE u.ank_id = '".$this->sid."' ".$inkremental_user_limit; - $qry_users_deleted = sisplet_query($str_qry_deleted); - if (!$qry_users_deleted) { - $this->trigerError('create_qry_users', 'MYSQL ERROR in qry: '.$str_qry . " ".mysqli_error($GLOBALS['connect_db'])); - } - if (mysqli_num_rows($qry_users_deleted) > 0) { - # zapišemo v datoteko idje katere brišemo - - $file = fopen($f2, 'w'); - - while (list($usr_id) = mysqli_fetch_row($qry_users_deleted)) { - fwrite($file, $usr_id . "\n"); - } - - fclose($file); - - if (IS_WINDOWS) { - $cmd = 'cp '.$f1.' '.$f3.' && awk -F"|" "NR==FNR {++a[$0]; next} { f = $1; if (!a[$1]) print $0}" '.$f2.' '.$f3.' > '.$f1; - } else { - $cmd = 'cp '.$f1.' '.$f3.' && awk -F\'|\' \'NR==FNR {++a[$0]; next} { f = $1; if (!a[$1]) print $0}\' '.$f2.' '.$f3.' > '.$f1; - } - SurveyTrackIncremental::write($this->sid,'deleteUsers() Command:'.mysqli_real_escape_string($GLOBALS['connect_db'], $cmd)); - $out_command = shell_exec($cmd); - } - #če je vse ok, pobrišemo datoteke - if (file_exists($f1)) { - # pobrišemo datoteko z userji katere smo brisali - if (file_exists($f2)) { - unlink($f2); - } - # pobrišemo backup datoteko - if (file_exists($f3)) { - unlink($f3); - } - } - } catch (Exception $e) { - if ($logClass != null) { - SurveyTrackIncremental::write($this->sid,'deleteUsers() Exception:'.$e->getMessage()); - } - } - } - $lock->unlock(); - } - } - function writeLockMessage($lockDate) { - global $lang; - - echo '
    '; - echo $lang['srv_incremental_lock_message']; - echo '
    '; - # na 15 sekund refreshamo stran - echo ''; - } - - function getLinesCnt() - { - if (IS_WINDOWS) { - $command = 'awk "NF != 0 {++count} END {print count}" '.$this->data_file_name; - } else { - $command = 'awk \'NF != 0 {++count} END {print count}\' '.$this->data_file_name; - } - $lines = shell_exec($command); - return (int)$lines; - } - - private function addUserSprAnswerCount($spr, $answer, $uid) { - - # štejemo zadnji veljaven odgovor - $this->_user_spr_answer_count['cnt']++; - if ($answer != -1 && $answer != -4 && $answer !== '-2d') { - // sistemskih in skritih ne upoštevamo - if ($this->AllQuestionsData[$spr]['sistem'] == 1 || $this->AllQuestionsData[$spr]['visible'] == 0) { - // preskočimo - } else { - $this->_user_spr_answer_count['last'] = $this->_user_spr_answer_count['cnt']; - $this->_user_spr_answer_count['last_seen'] = $this->_user_spr_answer_count['cnt']; - } - } - - // Pogledamo se ce je respondent videl vprasanje (tudi ce je -1, ker ga potem ne smemo spremenit v -3) - if ($answer == -1 || $answer === '-2d') { - if (is_array($this->_array_user_grupa[$uid]) && array_key_exists($this->AllQuestionsData[$spr]['gru_id'], $this->_array_user_grupa[$uid])) { - $this->_user_spr_answer_count['last_seen'] = $this->_user_spr_answer_count['cnt'] - 1; - } - } - - if (!isset($this->_user_spr_answer_count['spremenljivke'][$spr])) { - $this->_user_spr_answer_count['spremenljivke'][$spr] = 0; - } - - $this->_user_spr_answer_count['spremenljivke'][$spr]++; - } - - private function calculateValuesToChange($uid) { - - $result = 0; - - if (count($this->_user_spr_answer_count['spremenljivke']) == 0) { - return $result; - } - //if ($this->_user_spr_answer_count['last'] == $this->_user_spr_answer_count['cnt']) { - if ($this->_user_spr_answer_count['last_seen'] == $this->_user_spr_answer_count['cnt']) { - return $result; - } - if (count($this->_user_spr_answer_count['spremenljivke']) == 0) { - return $result; - } - foreach ($this->_user_spr_answer_count['spremenljivke'] AS $cnt) { - //if ($this->_user_spr_answer_count['last'] > $result) { - if ($this->_user_spr_answer_count['last_seen'] > $result) { - $result += $cnt; - } - } - - return $this->_user_spr_answer_count['cnt'] - $result; - } - - private function convertPolyString($polypoints){ - $poly = array(); - $polyObjectArray = array(); - $j = 0; - $poly = explode(',',$polypoints); - - for($i = 0; $i $pointy) != ($poly[$j]["y"] > $pointy)) && ($pointx < ($poly[$j]["x"]-$poly[$i]["x"]) * ($pointy-$poly[$i]["y"]) / ($poly[$j]["y"]-$poly[$i]["y"]) + $poly[$i]["x"]) ) $inside = !$inside; - } - return $inside; - } - - private function preparePointCoords($answerKoo, $returnPointx, $returnPointy){ - $coordsWithComma = explode('
    ',$answerKoo); - $pointx = array(); - $pointy = array(); - - for($i = 1; $i \ No newline at end of file diff --git a/admin/survey/classes/surveyData/old/class.SurveyDisplayData.php b/admin/survey/classes/surveyData/old/class.SurveyDisplayData.php deleted file mode 100644 index b4f6bf954..000000000 --- a/admin/survey/classes/surveyData/old/class.SurveyDisplayData.php +++ /dev/null @@ -1,3551 +0,0 @@ -'ASC'); // vrstni red zapisov - rekordov - static private $_REC_LIMIT = ' NR==1,NR==50'; # string za limiz tapisov - - static private $_RECORD_COUNT = 0; # koliko zapisov dobimo po filtriranju - static private $_TOTAL_PAGES = 0; # koliko strani dobimo po filtriranju - static private $_ALL_QUESTION_COUNT = null; # koliko je vseh vprasanj - static private $_ALL_VARIABLES_COUNT = null; # koliko je vseh variables - - static private $SSNDF = null; # Class za SN_data fajle - static private $is_social_network = false; # ali je anketa tipa SN (social network) - - static private $_HEADERS = array(); - - static private $_HAS_TEST_DATA = false; # ali anketa vsebuje testne podatke - - static private $do_sort = false; # ali sploh sortiramo podatke - static private $sort_seq = null; # po katerem stolpcu sortiramo - static private $sort_type = null; # na kak način sortiramo sort_asc = / sort_dsc = - - static private $doCMSUserFilter = false; # ali filtriramo samo svoje ankete - - static private $usr_id = null; #id respondenta za ki ga trenutno prikazujemo - - static private $showItime = false; #ali prikazujemo insert time - static private $showLineNumber = false; #ali vrivamo line number - static private $lineoffset = 0; #po koliko celicah vrivamo line number - - static private $displayEditIcons = array( - 'dataIcons_quick_view' => true, - 'dataIcons_edit' => false, - 'dataIcons_write'=>false); #ali prikazujemo ikone za urejanje - - static private $displayEditIconsSettings = false; # ali prikazujemo okno s checkboxi za nastavitve tabele s podatki - - static private $printPreview = false; # ali prikazujemo podatke kot print preview; - - static private $canDisplayRelevance = true; # ali prikazujemo ustreznost - relevance; - - static private $quickEdit_recnum = array(); # array z prejsnjim in naslednjim recnumom (za vpogled - puscici naprej,nazaj) - - # LIMITI - static public $_VARS = array( - VAR_DATA => 1, # ali prikazujemo podatke - VAR_REC_ON_PAGE => 50, - VAR_CUR_REC_PAGE => 1, - VAR_META => 0, # ali prikazujemo meta (status) - VAR_METAFULL => 0, # ali prikazujemo full meta - VAR_SPR_LIMIT => 10, - VAR_SPR_PAGE => 1, - VAR_EDIT => 0, # ali imamo možnost urejanja (brisanje popravljanje) - VAR_PRINT => 0, # ali imamo možnost izpisa v PDF, RTF - VAR_MONITORING => 0, # ali smo v zavihku monitoring - VAR_CODING => 0, # ali smo v zavihku kodiranje - VAR_SHOW_SYSTEM => 0, # ali prikazujemo sistemske variable (telefon, email) - VAR_PDF_TYPE => 0, # tip izpisa pdf (0 -> kratek, 1 -> dolg, 2 -> zelo kratek) - VAR_SORT_SEQ => '', # po kateri sekvenci sortiramo - VAR_SORT_TYPE => '', # način sortiranja (naraščajoče, padajoče) - VAR_RELEVANCE => 1, # ali prikazujemo ustreznost - VAR_EMAIL => 1, # ali prikazujemo email status - VAR_CIRCLES => 0, # ali prikazujemo kroge antonučija - VAR_SHOW_DATE => 0, # ali prikazujemo kroge antonučija - VAR_SHOW_NO => 0, # ali prikazujemo kroge antonučija - ); - - - - static public $_CURRENT_STATUS_FILTER = ''; - static public $_VARIABLE_FILTER = ''; # sed string array z prikazanimi variablami z upoštevanjem filtrov - static private $_SVP_PV = array(); # array z prikazanimi variablami z upoštevanjem filtrov - - - static public $_PROFILE_ID_STATUS = null; - static public $_PROFILE_ID_VARIABLE = null; - static public $_PROFILE_ID_CONDITION = null; - - function __construct($anketa) { - self::Init($anketa); - } - - - /** Inicializacija - * - * @param $sid - */ - static public function Init($sid) { - - # nastavimo privzeto pot do folderjev - global $site_path, $global_user_id, $lang; - - self::$folder = $site_path . EXPORT_FOLDER.'/'; - # nastavimo id ankete - self::$sid = $sid; - - Common::deletePreviewData($sid); - - SurveySession::sessionStart(self::$sid); - - # nastavimo limite - self::setVars(); - # podakcija - self::$subAction = isset($_GET['m']) && $_GET['m'] != '' ? $_GET['m'] : M_COLLECT_DATA_VIEW; - # informacije ankete - SurveyInfo::getInstance()->SurveyInit($sid); - self::$survey = SurveyInfo::getInstance()->getSurveyRow(); - - # aktivne tabele - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - self::$db_table = '_active'; - - # ali je anketa tipa SN - social network - self::$is_social_network = (SurveyInfo::getInstance()->checkSurveyModule('social_network')) ? true : false; - - # ali prikazujemo datum na začetku ankete (Če smo v identifikatorjih ne smemo zaradi povezovanja) - if ( (self::$_VARS[VAR_SHOW_DATE] == true || (int)SurveyInfo :: getInstance()->getSurveyColumn('showItime') == 1) && self::$_VARS[VAR_SHOW_SYSTEM] == false ) { - //if (self::$_VARS[VAR_SHOW_DATE] == true && self::$_VARS[VAR_SHOW_SYSTEM] == false) { - self::$showItime = true; - } - else { - self::$showItime = false; - } - - # ali prikazujemo zaporedno številko. (Če smo v identifikatorjih ne smemo zaradi povezovanja) - if ( (self::$_VARS[VAR_SHOW_NO] == true || (int)SurveyInfo :: getInstance()->getSurveyColumn('showLineNumber') == 1) && self::$_VARS[VAR_SHOW_SYSTEM] == false ) { - //if (self::$_VARS[VAR_SHOW_NO] == true) { - self::$showLineNumber = true; - } - else { - self::$showLineNumber = false; - } - - self::$_CURRENT_STATUS_FILTER = STATUS_FIELD.'~/6|5/'; - - if (self::$subAction == M_COLLECT_DATA_MONITORING) - $monitoring = true; else $monitoring = false; - - self::$SDF = SurveyDataFile::get_instance(); - self::$SDF->init($sid); - - self::$headFileName = self::$SDF->getHeaderFileName(); - self::$dataFileName = self::$SDF->getDataFileName(); - self::$dataFileStatus = self::$SDF->getStatus(); - - SurveyStatusProfiles :: Init(self::$sid); - SurveyVariablesProfiles :: Init($sid, $global_user_id, true, $monitoring); - SurveyConditionProfiles :: Init($sid, $global_user_id); - SurveyTimeProfiles :: Init($sid, $global_user_id); - SurveyUserSetting :: getInstance()->Init($sid, $global_user_id); - SurveyDataSettingProfiles :: Init($sid); - SurveySetting::getInstance()->Init($sid); - - $sdsp_displayEditIcons = SurveyDataSettingProfiles :: getSetting('dataShowIcons'); - if ($sdsp_displayEditIcons != null && is_array($sdsp_displayEditIcons)) { - self::$displayEditIcons = $sdsp_displayEditIcons; - } - - if(isset($_SESSION['sid_'.self::$sid]['dataIcons_settings'])) - self::$displayEditIconsSettings = ($_SESSION['sid_'.self::$sid]['dataIcons_settings']); - - # ali filtriramo cms usejreve datotekoe - session_start(); - self::$doCMSUserFilter = $_SESSION['sid_'.$sid]['doCMSUserFilter']; - session_commit(); - - #inicializiramo class za datoteke - self::$CID = new CollectIncrementalData($sid); - $createdNewFile = (int)self::$CID -> getFiles(); - - if ((int)$createdNewFile == 1) { - self::$dataFileStatus = self::$CID->getFileStatus(); - } - - self::$dataFileUpdated = self::$CID->getFileUpdated(); - - if ( self::$dataFileStatus == FILE_STATUS_NO_DATA - || self::$dataFileStatus == FILE_STATUS_SRV_DELETED) { - Common::noDataAlert(); - return false; - } - - - - # če smo v identifikatorjih potem ne omogočamo urejanja - if (self::$_VARS[VAR_SHOW_SYSTEM] == true) { - foreach (self::$displayEditIcons AS $key => $value) { - self::$displayEditIcons[$key] = false; - } - } - - # nastavimo ali smo v urejanju. Po novem gledamo url - zaenkrat imamo pregled urejanje in izvoz skupaj - - if(self::$subAction == M_COLLECT_DATA_VIEW){ - // self::$_VARS[VAR_EDIT] = true; // ne vem kdo je dal to na true! - self::$_VARS[VAR_PRINT] = true; - } - if (self::$subAction == M_COLLECT_DATA_EDIT && self::$_VARS[VAR_SHOW_SYSTEM] == false) { - self::$_VARS[VAR_EDIT] = true; - } - // gorazd, ti si nekaj spremenil tole EDIT variablo - tuki se zdej v vsakem primeru nastavi edit - if (self::$displayEditIcons['dataIcons_edit'] == true && self::$_VARS[VAR_SHOW_SYSTEM] == false) { - self::$_VARS[VAR_EDIT] = true; - } else { - self::$_VARS[VAR_EDIT] = false; - } - - if ( self::$displayEditIcons['dataIcons_multiple'] ) { - self::$_VARS['spr_limit'] = 'all'; - } - - /* - # nastavimo ali smo v izpisih - if (self::$subAction == M_COLLECT_DATA_PRINT) { - self::$_VARS[VAR_PRINT] = true; - }*/ - - if (self::$subAction == M_COLLECT_DATA_MONITORING) { - self::$_VARS[VAR_MONITORING] = true; - self::$_VARS[VAR_PRINT] = true; - } - - if (self::$subAction == 'coding') { - self::$_VARS[VAR_CODING] = true; - } - - self::$_VARS[VAR_META] = self::$_VARS[VAR_METAFULL]; - - # Če so izbrani VSI vnosi, naj bo označena USTREZNOST, - # če pa so označeni le USTREZNI, je spoloh ni treba tega stolpca, saj so itak vsi ustrezni in je odveč. - $ssp_pid = SurveyStatusProfiles::getCurentProfileId(); - if ($ssp_pid == 2) { - self::$canDisplayRelevance = false; - } - - # preštejemo vsa vabila, če so vsi na ne, potem ne prikažemo vabil - if (IS_WINDOWS) { - $awk_cnt_str = 'awk -F"'.STR_DLMT.'" "'.EMAIL_FIELD.'~/1/'.' {cnt++} END {print cnt}" '.self::$dataFileName; - } else { - $awk_cnt_str = 'awk -F"'.STR_DLMT.'" \''.EMAIL_FIELD.'~/1/'.' {cnt++} END {print cnt}\' \''.self::$dataFileName.'\''; - } - - $emailCount = shell_exec($awk_cnt_str); - - #self::$_VARS[VAR_EMAIL] = self::$_VARS[VAR_RELEVANCE] && ((int)self::$survey['email'] == 1 && (int)self::$survey['user_base'] == 1); - if (((int)self::$survey['email'] == 0 && (int)self::$survey['user_base'] == 0) ) { - self::$_VARS[VAR_EMAIL] = 0; - } - - # nastavimo način sortiranja - self::setUpSort(); - - # plovimo privzete id-je uporabniškega filtra - self::setUserFilters(); - - # nastavimo uporabniške filtere - self::setUpFilter(); - - # nastavimo SN class - if (self :: $is_social_network) { - self::$SSNDF = new SurveySNDataFile(self::$sid); - self::$SSNDF->setVars(self::$_VARS); - self::$SSNDF->setParameter('canDisplayRelevance',self::$canDisplayRelevance); - self::$SSNDF->setParameter('showItime',self::$showItime); - self::$SSNDF->setParameter('showLineNumber',self::$showLineNumber); - } - - # nastavimo trenuten id respondenta (ce ga imamo) - if(isset($_GET['usr_id'])) { - self::$usr_id = $_GET['usr_id']; - } - } - - public function ajax() { - - switch ($_GET['a']) { - case 'displayDataPrintPreview' : - self :: displayDataPrintPreview(); - break; - case 'setSnDisplayFullTableCheckbox' : - self :: setSnDisplayFullTableCheckbox(); - break; - case 'set_data_search_filter' : - self :: setDataSearchFilter(); - break; - default: - echo 'Error! (class: SurveyAnalysis->ajax() - missing action)'; - break; - } - } - - - - /** vrne število vseh vprašanj - * - */ - public static function getQuestionCount() { - if (self::$_ALL_QUESTION_COUNT == null) { - self::$_ALL_VARIABLES_COUNT = 0; - self::$_ALL_QUESTION_COUNT = 0; - - if (self::$headFileName != null && self::$headFileName != '') { - foreach (unserialize(file_get_contents(self::$headFileName)) AS $_spremenljivka) { - if (isset($_spremenljivka['tip']) && $_spremenljivka['tip'] != 'm' && $_spremenljivka['tip'] != 'sm') { - self::$_ALL_VARIABLES_COUNT += $_spremenljivka['cnt_all']; - self::$_ALL_QUESTION_COUNT++; - } - } - } - } - - return self::$_ALL_QUESTION_COUNT; - } - - /** vrne število vseh variabel - * - */ - public function getVariablesCount() { - if (self::$_ALL_VARIABLES_COUNT == null) { - self::$_ALL_VARIABLES_COUNT = 0; - self::$_ALL_QUESTION_COUNT = 0; - if (self::$headFileName != null && self::$headFileName != '') { - foreach (unserialize(file_get_contents(self::$headFileName)) AS $_spremenljivka) { - if (isset($_spremenljivka['tip']) && $_spremenljivka['tip'] != 'm' && $_spremenljivka['tip'] != 'sm') { - self::$_ALL_VARIABLES_COUNT += $_spremenljivka['cnt_all']; - self::$_ALL_QUESTION_COUNT++; - } - } - } - } - return self::$_ALL_VARIABLES_COUNT; - } - - - /** - * @desc nastavi default vrednosti spremenljivk in prebere kar je blo GETano - */ - static function setVars () { - // preberemo kar je GETano - $data_view_settings = SurveySession::get('data_view_settings'); - - foreach (self::$_VARS AS $var => $val) { - if (isset($data_view_settings[$var])) - { - $_val = $data_view_settings[$var]; - if (is_string($_val) && $_val == 'true') - { - $_val = (int)true; - } - else if (is_string($_val) && $_val == 'false') - { - $_val = (int)false; - } - else if (is_numeric($_val)) - { - if( (float)$_val != (int)$_val ) - { - $_val = (float)$_val; - } - else - { - $_val = (int)$_val; - } - } - self::$_VARS[$var] = $_val; - } - else if (isset($_REQUEST[$var])) - { - self::$_VARS[$var] = $_REQUEST[$var]; - } - } - } - - /** - * @desc vrne vse spremenljivki v obliki, ki se poslje preko GETa - * v parametrih se poda spremenljivko, ki se bo nastavla (se prav ni taka, kot je zdej v self::$_VARS) - */ - static function getVars ($new_var=null, $new_val=null) { - $str = ''; - foreach (self::$_VARS AS $var => $val) { - if ($var == $new_var) { - $str .= '&'.$var.'='.$new_val; - } else { - $str .= '&'.$var.'='.$val; - } - } - return $str; - } - /** - * @desc vrne vse spremenljivki v obliki, ki se poslje preko GETa brez sorta, ker dodamo naknadno z javascriptom - * v parametrih se poda spremenljivko, ki se bo nastavla (se prav ni taka, kot je zdej v self::$_VARS) - */ - - static function getVarsNoSort ($new_var=null, $new_val=null) { - $str = ''; - foreach (self::$_VARS AS $var => $val) { - if ($var != VAR_SORT_SEQ && $var != VAR_SORT_TYPE) { - if ($var == $new_var) { - $str .= '&'.$var.'='.$new_val; - } else { - $str .= '&'.$var.'='.$val; - } - } - } - return $str; - } - - static private function setUpSort() { - # če smo postali sort nastavitve preko geta - if (isset($_GET['sort_seq']) && (int)$_GET['sort_seq'] > 0 ) - { - # sortiramo - self::$do_sort = true; - - # nastavimo po kateri sekvenci / stolpcu sortiramo - self::$sort_seq = (int)$_GET['sort_seq']; - - if (isset($_GET['sort_type']) && $_GET['sort_type'] === 'sort_dsc' ) - { - self::$sort_type = 'sort_dsc'; - } - else - { - self::$sort_type = 'sort_asc'; - } - } - else - { - # ne sortiramo - self::$do_sort = false; - } - } - - static private function setUserFilters() - { - #SurveyStatusProfiles :: setCurentProfileId(); - self::$_PROFILE_ID_STATUS = SurveyStatusProfiles :: getDefaultProfile(); - - # Nastavimo filtre variabel - $dvp = SurveyUserSetting :: getInstance()->getSettings('default_variable_profile'); - $_currentVariableProfile = SurveyVariablesProfiles :: checkDefaultProfile($dvp); - if ($dvp != $_currentVariableProfile) { - SurveyUserSetting :: getInstance()->saveSettings('default_variable_profile', $_currentVariableProfile); - } - self::$_PROFILE_ID_VARIABLE = $_currentVariableProfile; - - } - - - static public function setUpFilter() { - - # nastavimo filter po statusih - - if (self::$headFileName != null && self::$headFileName != '' && file_exists(self::$headFileName)) { - - # kadar zbiramo sistemske, moramo obvezno zbirati tudi podatke, ne smemo pa full meta - if (self::$_VARS[VAR_SHOW_SYSTEM]){ - self::$_VARS[VAR_DATA] = true; - self::$_VARS[VAR_META] = true; - self::$_VARS[VAR_METAFULL] = false; - self::$_VARS[VAR_SHOW_DATE] = false; - } - # filtriranje po statusih - self::$_CURRENT_STATUS_FILTER = SurveyStatusProfiles :: getStatusAsAWKString(); - - if (self::$dataFileStatus >= 0) { - self::$_HEADERS = unserialize(file_get_contents(self::$headFileName)); - - # ali imamo filter na testne podatke - if (isset(self::$_HEADERS['testdata']['grids'][0]['variables'][0]['sequence']) && (int)self::$_HEADERS['testdata']['grids'][0]['variables'][0]['sequence'] > 0) { - $test_data_sequence = self::$_HEADERS['testdata']['grids'][0]['variables'][0]['sequence']; - $filter_testdata = SurveyStatusProfiles :: getStatusTestAsAWKString($test_data_sequence); - } - # filtriranje po časih - $_time_profile_awk = SurveyTimeProfiles :: getFilterForAWK(self::$_HEADERS['unx_ins_date']['grids']['0']['variables']['0']['sequence']); - - # ali imamo filter na uporabnost - if (isset(self::$_HEADERS['usability']['variables'][0]['sequence']) && (int)self::$_HEADERS['usability']['variables'][0]['sequence'] > 0) { - $usability_data_sequence = self::$_HEADERS['usability']['variables'][0]['sequence']; - $filter_usability = SurveyStatusProfiles :: getStatusUsableAsAWKString($usability_data_sequence); - } - - # če nismo v indikatorjih (sistemske) - if (self::$_VARS[VAR_SHOW_SYSTEM] == false) { - # dodamo še ife - SurveyConditionProfiles :: setHeader(self::$_HEADERS); - $_condition_profile_AWK = SurveyConditionProfiles:: getAwkConditionString(); - - # dodamo še ife za inspect - $SI = new SurveyInspect(self::$sid); - $_inspect_condition_awk = $SI->generateAwkCondition(); - } - - # dodamo pogoj za filter prepoznave uporabnika iz cms - # vklopljeno more bit prepoznava userja iz cms - if (self::$doCMSUserFilter == true) { - $CMSUserCondition = self::createCMSUserFilter(); - } - - if (($_condition_profile_AWK != "" && $_condition_profile_AWK != null ) - || ($_inspect_condition_awk != "" && $_inspect_condition_awk != null) - || ($_time_profile_awk != "" && $_time_profile_awk != null) - || ($CMSUserCondition != "" && $CMSUserCondition != null) - || ($filter_testdata != null) - || ($filter_usability != null)) { - self::$_CURRENT_STATUS_FILTER = '('.self::$_CURRENT_STATUS_FILTER; - if ($_condition_profile_AWK != "" && $_condition_profile_AWK != null ) { - self::$_CURRENT_STATUS_FILTER .= '&&'.$_condition_profile_AWK; - } - if ($_inspect_condition_awk != "" && $_inspect_condition_awk != null ) { - self::$_CURRENT_STATUS_FILTER .= ' && '.$_inspect_condition_awk; - } - if ($_time_profile_awk != "" && $_time_profile_awk != null) { - self::$_CURRENT_STATUS_FILTER .= '&&'.$_time_profile_awk; - } - if ($CMSUserCondition != "" && $CMSUserCondition != null) { - self::$_CURRENT_STATUS_FILTER .= '&&'.$CMSUserCondition; - } - if ($filter_testdata != null ) { - self::$_CURRENT_STATUS_FILTER .= '&&('.$filter_testdata.')'; - } - if ($filter_usability != null ) { - self::$_CURRENT_STATUS_FILTER .= '&&('.$filter_usability.')'; - } - self::$_CURRENT_STATUS_FILTER .= ')'; - } - - # preštejemo vse zapise ki ustrezajo filtru po statusu - if (IS_WINDOWS) { - $awk_string = 'awk -F"'.STR_DLMT.'" "'.self::$_CURRENT_STATUS_FILTER.' {cnt++} END {print cnt}" '.self::$dataFileName; - $recCount = shell_exec($awk_string); - if ($_GET['debug'] == 1) { - print_r('
    '.$awk_string); - } - - } else { - $awk_string = 'awk -F"'.STR_DLMT.'" \''.self::$_CURRENT_STATUS_FILTER.' {cnt++} END {print cnt}\' \''.self::$dataFileName.'\''; - $recCount = shell_exec($awk_string); - if ($_GET['debug'] == 1) { - print_r('
    '.$awk_string); - } - } - if ((int)$recCount > 0 ) { - self::$_RECORD_COUNT = (int)$recCount; - } - - - if (self::$_VARS[VAR_REC_ON_PAGE] != 'all') { - self::$_TOTAL_PAGES = bcdiv(self::$_RECORD_COUNT, self::$_VARS[VAR_REC_ON_PAGE]); - - if (bcmod(self::$_RECORD_COUNT, self::$_VARS[VAR_REC_ON_PAGE]) > 0) - self::$_TOTAL_PAGES += 1; - if (self::$_VARS[VAR_CUR_REC_PAGE] > self::$_TOTAL_PAGES ) { - self::$_VARS[VAR_CUR_REC_PAGE] = self::$_TOTAL_PAGES; - } elseif (self::$_VARS[VAR_CUR_REC_PAGE] < 1 ) { - self::$_VARS[VAR_CUR_REC_PAGE] = 1; - } - - # nastavimo limit za datoteko - - $up = self::$_VARS[VAR_REC_ON_PAGE] * self::$_VARS[VAR_CUR_REC_PAGE]; - $low = $up - self::$_VARS[VAR_REC_ON_PAGE]+1; - - self::$_REC_LIMIT = ' NR=='.$low.',NR=='.$up.''; - } else { - # nastavimo limit za datoteko - self::$_REC_LIMIT = ''; - } - } - if (self::$_VARS[VAR_DATA]) { - $tmp_svp_pv = SurveyVariablesProfiles :: getProfileVariables(self::$_PROFILE_ID_VARIABLE ); - - # če je $svp_pv = null potem prikazujemo vse variable - # oziroma če je sistemski dodamo tudi vse, ker drugače lahko filter skrije telefon in email - if (count($tmp_svp_pv) == 0 || self::$_VARS[VAR_SHOW_SYSTEM] == true ) { - - $_sv = self::$SDF->getSurveyVariables(); - if (count($_sv) > 0) { - foreach ( $_sv as $vid => $variable) { - $tmp_svp_pv[$vid] = $vid; - } - } - } - } - self::$lineoffset=1; - # če prikazujemo sistemske ne prikazujemo recnumber - if (!self::$_VARS[VAR_SHOW_SYSTEM] && self::$_VARS[VAR_META] && self::$_VARS[VAR_METAFULL]) { - $svp_pv['recnum'] = 'recnum'; - #$svp_pv['code'] = 'code'; - self::$lineoffset++; - # za code ni ofseta - #self::$lineoffset++; - } - - if (self::$_VARS[VAR_DATA] && count($tmp_svp_pv) > 0) { - foreach ($tmp_svp_pv AS $_svp_pv) { - - # če imamo sistemski email ali telefon, ime, priimek (v header je nastavljno "hide_system" = 1) - # potem v odvisnosti od nastavitve prikazujemo samo navadne podatke ali pa samo te sistemske, zaradizaščite podatkov - $_sistemski = false; - if (!self::$_VARS[VAR_SHOW_SYSTEM] && self::$_HEADERS[$_svp_pv]['hide_system'] == '1') { - # prikazujemo samo nesistemske (nezaščitene) - unset(self::$_HEADERS[$_svp_pv]); - } else if (self::$_VARS[VAR_SHOW_SYSTEM] && self::$_HEADERS[$_svp_pv]['hide_system'] !== '1') { - # prikazujemo samo sistemske (zaščitene) podatke - unset(self::$_HEADERS[$_svp_pv]); - } else { - # če ne dodamo - $svp_pv[$_svp_pv] = $_svp_pv; - } - } - } - - #status - če smo v meta ali imamo profil vse enote - if ( (self::$_VARS[VAR_META] && self::$_VARS[VAR_METAFULL]) - || ( $ssp_pid = SurveyStatusProfiles::getCurentProfileId() == 1 )) { - $svp_pv['status'] = 'status'; - self::$lineoffset++; - } - - #lurker - if ( (self::$_VARS[VAR_META] && self::$_VARS[VAR_METAFULL]) - || ( $ssp_pid = SurveyStatusProfiles::getCurentProfileId() == 1 )) { - // dodamo v array da se prikazujejo tudi ti stolpci - $svp_pv['lurker'] = 'lurker'; - self::$lineoffset++; - } - # ustreznost - if (self::$_VARS[VAR_RELEVANCE] && self::$canDisplayRelevance && self::$_VARS[VAR_SHOW_SYSTEM] == false) { - // dodamo v array da se prikazujejo tudi ti stolpci - $svp_pv['relevance'] = 'relevance'; - self::$lineoffset++; - } - - # email tion - #email prikazujemo skupaj z ustreznostjo - if ( self::$_VARS[VAR_EMAIL] && self::$_VARS[VAR_SHOW_SYSTEM] == false ) { - // dodamo v array da se prikazujejo tudi ti stolpci - $svp_pv['invitation'] = 'invitation'; - self::$lineoffset++; - } - - if (isset(self::$_HEADERS['testdata'])) { - self::$_HAS_TEST_DATA = true; - $svp_pv['testdata'] = 'testdata'; - self::$lineoffset++; - } - # $svp_pv['unx_ins_date'] = 'unx_ins_date'; - - if (self::$_VARS[VAR_METAFULL] && self::$_VARS[VAR_SHOW_SYSTEM] == false) { - # dodamo tudi special meta - $svp_pv['meta'] = 'meta'; - } - - if (self::$showItime == true) { - $svp_pv['itime'] = 'itime'; - self::$lineoffset++; - } - - // ce imamo vklopljene sistemske ne smemo povezovat podatkov in zato urejamo po abecedi - if(self::$_VARS[VAR_SHOW_SYSTEM]){ - - $hasEmail = false; - - // Poiscemo sekvenco sistemske spremenljivke - foreach (self::$_HEADERS AS $spr => $spremenljivka) { - if (isset($spremenljivka['sistem']) && $spremenljivka['sistem'] == 1 && $spremenljivka['variable'] == 'email') { - $sequence = $spremenljivka['sequences']; - $hasEmail = true; - } - } - - if($hasEmail){ - # sortiramo - self::$do_sort = true; - - # nastavimo po kateri sekvenci / stolpcu sortiramo - self::$sort_seq = $sequence; - - self::$sort_type = 'sort_asc'; - } - } - - self::getQuestionCount(); - if (self::$_VARS[VAR_SPR_LIMIT] > self::$_ALL_QUESTION_COUNT) { - self::$_VARS[VAR_SPR_LIMIT] = 'all'; - } - - $spr_cont = 0; // za paginacijo spremenljivk - - if(self::$_VARS['spr_limit'] == 'all'){ - $_spr_on_pages_start = 0; - $_spr_on_pages_stop = self::$_VARS['spr_page']; - } - else{ - $_spr_on_pages_start = self::$_VARS['spr_page'] * self::$_VARS['spr_limit'] - self::$_VARS['spr_limit']; - $_spr_on_pages_stop = self::$_VARS['spr_page'] * self::$_VARS['spr_limit']; - } - - # skreiramo filter variabel za podatke - if (count(self::$_HEADERS) > 0) { - // zloopamo skozi spremenljivke in sestavimo filter po stolpcih - $_tmp_filter = ''; - foreach (self::$_HEADERS AS $spid => $spremenljivka) { - if (isset($svp_pv[$spid])) { - // paginacija spremenljivk - if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) { - if (count($spremenljivka['grids']) > 0 ) { - foreach ($spremenljivka['grids'] AS $gid => $grid) { - if (count ($grid['variables']) > 0) { - foreach ($grid['variables'] AS $vid => $variable ){ - $_tmp_filter .= $_prfx.$variable['sequence']; - $_prfx = ','; - } - } - } - } - } // end: paginacija spremenljivk - $spr_cont++; - } else - # če prikazujemo samo sistemske - if ( self::$_VARS[VAR_SHOW_SYSTEM] && in_array($spremenljivka['variable'], array('email','ime','priimek','telefon','naziv','drugo','odnos'))) { - if (count($spremenljivka['grids']) > 0 ) { - foreach ($spremenljivka['grids'] AS $gid => $grid) { - if (count ($grid['variables']) > 0) { - foreach ($grid['variables'] AS $vid => $variable ){ - $_tmp_filter .= $_prfx.$variable['sequence']; - $_prfx = ','; - } - } - } - } - $svp_pv[$spid] = $spid; - } - } - } - - # prilagodimo array profilov variabel - self::$_SVP_PV = $svp_pv; - if ($_tmp_filter != '') - { - self::$_VARIABLE_FILTER = $_tmp_filter; - } - } - - } - - /** Prikaže filtre za število podatkov.... - * - */ - public static function displayFilters() { - global $site_url, $site_path, $lang, $global_user_id; - - #debug - echo ''; - - if (self::$dataFileStatus == FILE_STATUS_NO_DATA) { - return false; - } - - - /*echo '
    '; - SurveyStatusProfiles::displayOnlyValidCheckbox(); - echo '
    ';*/ - $SSH = new SurveyStaticHtml(self::$sid); - $SSH -> displayTopSettings($podstran='data'); - - - # če imamo podatke - if (self::$dataFileStatus != FILE_STATUS_SRV_DELETED) { - - if ( self::$CID->getAutoCreatingFile() == false ) { - - echo ''; - } - - # ali imamo testne podatke - if (self::$_HAS_TEST_DATA) { - # izrišemo bar za testne podatke - $SSH -> displayTestDataBar(); - } - } - else { - print_r("Anketa je bila izbrisana! Prikaz podatkov ni mogoč!"); - } - - # skrit div za izbor profilov nastavitev - echo '
    '; - - # skrit div za izbor if-profilov - echo '
    '.NEW_LINE; - - # skrit div za izbor profilov intervala - echo '
    '.NEW_LINE; - } - - public static function displayPaginacija($position='_top') { - global $lang, $site_url; - - if ((int)self::$_RECORD_COUNT == 0) { - return false; - } - - # ŠTEVILO VNOSOV NA STRAN - echo '
    '; - echo ''; - if (self::$_VARS[VAR_REC_ON_PAGE] > self::$_RECORD_COUNT) { - self::$_VARS[VAR_REC_ON_PAGE] = 'all'; - } - - //$_tmp_limit = array(10,50,100,250,500,1000,2500,5000,10000); - $_tmp_limit = array(10,50,100,250,500); - $_select_records = ''; - - echo $_select_records; - - - # KATERA STRAN - if (self::$_VARS[VAR_REC_ON_PAGE] != 'all' && self::$_TOTAL_PAGES > 1) { - - echo ''; - - // puscica levo - if (self::$_VARS[VAR_CUR_REC_PAGE] > 1){ - echo ''; - } - - $_records_page = ''; - echo $_records_page; - - // puscica desno - if (self::$_VARS[VAR_CUR_REC_PAGE] < self::$_TOTAL_PAGES){ - echo ''; - } - } - - echo '
    '; - - - # ŠTEVILO SPREMENLJIVK NA STRAN - echo '
    '; - echo ''; - - self::getQuestionCount(); - if (self::$_VARS[VAR_SPR_LIMIT] > self::$_ALL_QUESTION_COUNT) { - self::$_VARS[VAR_SPR_LIMIT] = 'all'; - } - - //$_spr_limit = array(5=>'5',10=>'10',20=>'20',30=>'30',50=>'50',100=>'100','all'=>$lang['hour_all2']); - $_spr_limit = array(5=>'5',10=>'10',20=>'20',30=>'30',50=>'50'); - $_spr_on_page = ''; - - echo $_spr_on_page; - - - # KATERA STRAN - // prestejemo stevilo vprasanj - $questions = count(self::$_SVP_PV); - if (self::$_VARS[VAR_SPR_LIMIT] != 'all') { - - $spr_pages = bcdiv($questions, self::$_VARS[VAR_SPR_LIMIT]); - - if (bcmod($questions, self::$_VARS[VAR_SPR_LIMIT]) > 0) - $spr_pages += 1; - - if ($spr_pages > 1) { - - $_spr_page = ''; - echo $_spr_page; - - // puscica desno - if (self::$_VARS[VAR_SPR_PAGE] < $spr_pages){ - echo ''; - } - - } - } - echo '
    '; - } - - public static function displayLeftFilters() { - global $lang, $site_url; - # število zapisov na stran - echo '
      '; - echo '
    • '.$lang['srv_show'].':'; - echo '
    • '; - # ustreznost - if (self::$canDisplayRelevance) { - echo '
    • '; - if (self::$_VARS[VAR_SHOW_SYSTEM] != true ) { - echo ''; - } else { - echo ''; - } - echo '
    • '; - #echo '
    •  
    • '; - } - #email prikazujemo skupaj z ustreznost - - //if (self::$_VARS[VAR_EMAIL]) { - if ((int)self::$survey['email'] == 1 && (int)self::$survey['user_base'] == 1) { - # email - invitation status -# echo '
    •  
    • '; - echo '
    • '; - if (self::$_VARS[VAR_SHOW_SYSTEM] != true ) { - echo ''; - } else { - echo ''; - } - echo '
    • '; - } - # podatki - - echo '
    • '; - echo ''; - #echo Help :: display('displaydata_data'); - echo '
    • '; - - #echo '
    •  
    • '; - echo '
    • '; - - # če nismo lovili metapodatkov potem disejblamo - $_sql_string = "SELECT * FROM srv_data_files WHERE sid = '".self::$sid."'"; - $_sql_qry = sisplet_query($_sql_string); - $_sql_row = mysqli_fetch_assoc($_sql_qry); - - # VEDNO GENERIRAMO POLNE META PODATKE - $_sql_row['collect_full_meta'] = 1; - $disable_meta = (int)$_sql_row['collect_full_meta'] == 1 ? '' : ' disabled'; - $gray_meta = (int)$_sql_row['collect_full_meta'] == 1 ? '' : 'gray'; - - echo ''; - #echo Help :: display('displaydata_meta'); - echo '
    • '; - - //if (self::$_VARS[VAR_METAFULL]) { - # echo '
    •  
    • '; - # echo '
    • '; - # echo ''; - # #echo Help :: display('displaydata_status'); - # echo '
    • '; - #} - # če imamo sistemske podatke katere moramo prikazovati ločeno - IDENTIFIKATORJI - if (!isset(self::$_HEADERS['_settings']['count_system_data_variables']) - || (isset(self::$_HEADERS['_settings']['count_system_data_variables']) && (int)self::$_HEADERS['_settings']['count_system_data_variables'] > 0)) { - #echo '
    •  
    • '; - echo '
    • '; - echo ''; - #echo Help :: display('displaydata_system'); - echo '
    • '; - } - // Po novem vedno prikazemo checkbox identifikatorji - samo je odkljukan in disablan - else{ - echo '
    • '; - echo ''; - echo '
    • '; - } - - #datum - echo '
    • '; - echo ''; - echo '
    • '; - #zaporedna številka - echo '
    • '; - echo ''; - echo '
    • '; - - - #pomoč - ? - echo '
    • '.Help :: display('displaydata_checkboxes').'
    • '; - echo '
    '; - } - - // Search po tabeli s podatki - public static function displayDataSearch(){ - global $lang; - - $search = isset($_SESSION['sid_'.self::$sid]['data_search_filter']) ? $_SESSION['sid_'.self::$sid]['data_search_filter'] : ''; - - echo '
    '; - - echo ' '; - if($search != ''){ - echo ''.$lang['srv_displayData_search'].' "'.$search.'"!'; - } - - echo '
    '; - } - - // Shranimo iskanje v session - private function setDataSearchFilter(){ - - session_start(); - - $search = (isset($_POST['value']) && $_POST['value'] != '') ? trim($_POST['value']) : ''; - if($search != ''){ - $_SESSION['sid_'.self::$sid]['data_search_filter'] = $search; - } - else{ - $_SESSION['sid_'.self::$sid]['data_search_filter'] = ''; - } - - session_commit(); - - // Na koncu se popravimo paginacijo na prvo stran - SurveySession::sessionStart(self::$sid); - SurveySession::append('data_view_settings','cur_rec_page',1); - - return; - } - - - // Prikazemo editiranje na dnu (brisanje vecih hkrati...) - public static function displayBottomEdit(){ - global $lang; - if ((int)self::$_RECORD_COUNT > 0){ - echo '
    '; - - echo ' '; - echo ''.$lang['srv_select_all'].''; - echo ''; - echo '   '.$lang['srv_delete_selected'].''; - echo '

    '.$lang['srv_delete_infotext'].' '.Help::display('srv_delete_infotext').'

    '; - - echo '
    '; - } - } - - /** Naredi output podatkov v HTML tabelo - * - */ - public static function displayVnosiHTML() { - global $lang; - global $site_path; - global $global_user_id; - - // na vrhu in na dnu izrisemo paginacijo - if(self::$dataFileStatus != FILE_STATUS_NO_DATA && (int)self::$_RECORD_COUNT > 0) { - echo '
    '; - self::displayPaginacija($position='_top'); - echo '
    '; - - // Izrisemo search - if(!self::$_VARS[VAR_CODING]) - self::displayDataSearch(); - - - // Checkboxa za urejanje in izpise podatkov ter razpiranje dodatnih nastavitev - echo '
    '; - - echo ''; - if (self::$displayEditIcons['dataIcons_edit'] == true) { - echo ' '.Help::display('srv_podatki_urejanje_inline'); - } - echo '  '; - echo ''; - - $arrow = (isset($_SESSION['sid_' . self::$sid]['dataIcons_settings'])) ? $_SESSION['sid_' . self::$sid]['dataIcons_settings'] : 0; - echo '
    ' . $lang['srv_extra_settings'] . '
    '; - - echo '
    '; - } - - echo '
    '; - echo '
    '; - # če ne uporabljamo privzetega časovnega profila izpišemo opozorilo - SurveyTimeProfiles :: printIsDefaultProfile(); - - # če nismo v identifikatorjih - if (self::$_VARS[VAR_SHOW_SYSTEM] == false) { - # če imamo filter ifov ga izpišemo - SurveyConditionProfiles:: getConditionString(); - - # če imamo filter ifov za inspect ga izpišemo - $SI = new SurveyInspect(self::$sid); - $SI->getConditionString(); - - # če imamo filter spremenljivk ga izpišemo - SurveyVariablesProfiles:: getProfileString(); - } - # če imamo rekodiranje - $SR = new SurveyRecoding(self::$sid); - $SR -> getProfileString(); - echo '
    '; - - # če ni v teku avtomatska kreacija datoteke - if ( self::$CID->getAutoCreatingFile() == false ) { - - $folder = $site_path . EXPORT_FOLDER.'/'; - - echo '
    '; - if ((self::$dataFileStatus == 1 || self::$dataFileStatus == 0) && self::$dataFileName !== null) { - # filtri morajo prikazovat vsaj eno spremenljivko ali meta podatek - if (count(self::$_SVP_PV) > 0) { - - # če imamo kaj podatkov za prikaz - if ((int)self::$_RECORD_COUNT > 0) - { - if (self :: $is_social_network == false) { - if ( self::showMultiple() && self::$displayEditIcons['dataIcons_multiple'] ) - self::DisplayDataMultipleTable(); - else - self::DisplayDataTable(); - - } else { - # imamo SN omrežje - if (self::$_VARS[VAR_CIRCLES] == 0) { - self::DisplaySnLinks(); - self::DisplayDataTable(); - } - } - } - else - { # ni vrstic za prikaz - echo $lang['srv_data_no_data_filtred']; - } - } else { - echo '
    Ni podatkov za prikaz. Preverite filtre (Podatki, Para podatki, Polni para podatki)
    '; - } - } - - - if (self :: $is_social_network ) { - if (self::$SSNDF != null && self::$_VARS[VAR_CIRCLES] == 1) { - self::DisplaySnLinks(); - self::$SSNDF->outputSNDataFile(); - } - } - echo '
    '; // id="div_vnosi_data">'; - - - #izrišemo legendo statusov - self::displayStatusLegend(); - self::displayMetaStatusLegend(); - self::displayTestLegend(); - } - - // na vrhu in na dnu izrisemo paginacijo - if(self::$dataFileStatus != FILE_STATUS_NO_DATA){ - echo '
    '; - self::displayPaginacija($position='_bottom'); - echo '
    '; - - echo '
    '; - } - - // osvetlimo stolpec s spremenljivko - if (isset($_GET['highlight_spr'])) { - ?> 
    '; - - echo '
    '; - - # div v katerem po potrebi prikazujemo gumbe za skrolanje levo in desno - echo '
    '; - echo ''; - echo '    '; - echo ''; - echo '
    '; - - $display1kaIcon = self::$displayEditIcons['dataIcons_quick_view'] ; - - if (self::$printPreview == true) { - self::$displayEditIcons['dataIcons_edit'] = false; - self::$displayEditIcons['dataIcons_write'] = false; - $display1kaIcon = false; - } - # koliko stolpcev je colspan - $stolpci = ((int)self::$displayEditIcons['dataIcons_edit']*4) - + ((int)self::$displayEditIcons['dataIcons_write']*2) - + (int)$display1kaIcon; - - // Evoli ikona (ce je vklopljen modul) - if((SurveyInfo::getInstance()->checkSurveyModule('evoli') || SurveyInfo::getInstance()->checkSurveyModule('evoli_employmeter')) && self::$displayEditIcons['dataIcons_write'] == '1') - $stolpci += 3; - - // MFDPS ikona (ce je vklopljen modul) - if(SurveyInfo::getInstance()->checkSurveyModule('mfdps') && self::$displayEditIcons['dataIcons_write'] == '1') - $stolpci += 1; - - // BORZA ikona (ce je vklopljen modul) - if(SurveyInfo::getInstance()->checkSurveyModule('borza') && self::$displayEditIcons['dataIcons_write'] == '1') - $stolpci += 1; - - echo ''; - - # ali smo v edit načinu ali monitoringu - $cssEdit = (self::$_VARS[VAR_EDIT] || self::$_VARS[VAR_MONITORING]?' editData':''); - echo ''; - - // Nastavimo colgroup, da na njega vezemo vse sirine v tabeli, zaradi resizinga stolpcev - echo ''; - # colspan za ikonce - if ($stolpci > 0) { - //for ($i=0; $i<$stolpci; $i++) - // echo ''; - echo '1 ? (' span="'.$stolpci.'"') : '').'>'; - } - - $spr_cont = 0; - foreach (self::$_HEADERS AS $spid => $spremenljivka) { - if (isset(self::$_SVP_PV[$spid]) && count($spremenljivka['grids']) > 0) { - if(self::$showLineNumber && $spr_cont+1 == self::$lineoffset) { - echo ''; - } - - // paginacija spremenljivk - if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) { - foreach ($spremenljivka['grids'] AS $gid => $grid) { - if (count ($grid['variables']) > 0) { - foreach ($grid['variables'] AS $vid => $variable ){ - echo ''; - } - } - } - } - $spr_cont++; - } - - } - echo ''; - - echo ''; - echo ''; - - # colspan za ikonce - if ($stolpci > 0) { - echo ''; - - $spr_cont = 0; - foreach (self::$_HEADERS AS $spid => $spremenljivka) { - - if (isset(self::$_SVP_PV[$spid])) { - if(self::$showLineNumber && $spr_cont+1 == self::$lineoffset) { - echo ''; - } - // paginacija spremenljivk - if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) { - echo ''; - } - $spr_cont++; - - } - } - - echo ''; - - # colspan za ikonce - if ($stolpci > 0) { - echo ''; - - $spr_cont = 0; - foreach (self::$_HEADERS AS $spid => $spremenljivka) { - if (isset(self::$_SVP_PV[$spid]) && (count($spremenljivka['grids']) > 0 )) { - - if(self::$showLineNumber && $spr_cont+1 == self::$lineoffset) { - echo ''; - } - - // paginacija spremenljivk - if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) { - - foreach ($spremenljivka['grids'] AS $gid => $grid) { - if($spremenljivka['tip'] == 16 || $spremenljivka['tip'] == 19 || $spremenljivka['tip'] == 20){ - echo ''; - } - else{ - echo ''; - } - } - } - $spr_cont++; - } - - } - echo ''; - - # colspan za ikonce - if ($stolpci > 0) { - //for ($i=0; $i<$stolpci; $i++) - // echo ''; - echo ''; - - $spr_cont = 0; - $system_columns = array(); - foreach (self::$_HEADERS AS $spid => $spremenljivka) { - if (isset(self::$_SVP_PV[$spid]) && count($spremenljivka['grids']) > 0) { - if(self::$showLineNumber && $spr_cont+1 == self::$lineoffset) { - echo ''; - } - - // paginacija spremenljivk - if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) { - foreach ($spremenljivka['grids'] AS $gid => $grid) { - if (count ($grid['variables']) > 0) { - foreach ($grid['variables'] AS $vid => $variable ){ - echo ''; - } - } - } - } - $spr_cont++; - } - - } - echo''; - echo ''; - - - # PREBEREMO PODATKE - $_command = ''; - - # najprej po potrebi presortiramo - # na vindowsih ne delamo sorta (zaenkrat) - if (self::$do_sort == true) { - - $sortString = '-k '.self::$sort_seq; - - #ker tekstovnih ne sortira vredu sem odstranil parameter -n - # iz navodil: sorting keys can be interpreted numerically (-n option) instead of alphabetically (which is the default). - # če bodo težave bo potrebno parameter -n dodajat po potrebi - # $sort_numeric => - $sort_numeric = ''; - //$sort_numeric = '-n '; - - foreach (self::$_HEADERS AS $spid => $spremenljivka) { - if (count($spremenljivka['grids']) > 0 ) { - foreach ($spremenljivka['grids'] AS $gid => $grid) { - if (count ($grid['variables']) > 0) { - foreach ($grid['variables'] AS $vid => $variable ){ - if (self::$sort_seq == $variable['sequence']) { - - // za datumska polja je potrebno malo potelovadit - if ($variable['spss'] == 'DATETIMEw' || $variable['sortType'] == 'date') { - #12.09.2011 - $sortString = '-k '.self::$sort_seq.'.7,'.self::$sort_seq.'.10 -k'.self::$sort_seq.'.4,'.self::$sort_seq.'.5 -k'.self::$sort_seq.'.1,'.self::$sort_seq.'.2'; - } - - // za numericne spremenljivke in recnum uporabimo parameter -n da ne sortira po stringu - if ($variable['sortType'] == 'number') { - $sort_numeric = '-n '; - } - } - } - } - } - } - } - - if (IS_WINDOWS) { - #Cygwin Sort Command On Windows - # popravi pot do svojega sort-a - $_path_to_CygwinSort = PATH_TO_CYGWIN_FOLDER; - # $_command = $_path_to_CygwinSort.' -t"'.STR_DLMT.'"'.(self::$sort_type == 'sort_dsc' ? '-r' : '').' +'.(int)(self::$sort_seq-1).' '.self::$dataFileName.''; - $_command = $_path_to_CygwinSort.' -t"'.STR_DLMT.'" '.(self::$sort_type == 'sort_asc' ? '' : '-r ').$sort_numeric.$sortString.' '.self::$dataFileName; - } else { - # smo na linuxu - $_command = 'sort -t \\'.STR_DLMT.' '.(self::$sort_type == 'sort_asc' ? '' : '-r ' ).$sort_numeric.$sortString.' '.self::$dataFileName; - } - } - // polovimo vrstice z statusom 5,6 in jih damo v začasno datoteko - if (IS_WINDOWS) { - #$cmdLn1 = 'awk -F"'.STR_DLMT.'" "BEGIN {OFS=\"\x7C\"} '.self::$_CURRENT_STATUS_FILTER.' { print $0 }" '.self::$dataFileName.' > '.$tmp_files['filtred_status']; - #$out1 = shell_exec($cmdLn1); - # če smo predhodno sortirali - if (self::$do_sort == true) - { - $_command .= ' | gawk -F"'.STR_DLMT.'" "BEGIN {OFS=\"\x7C\"} '.self::$_CURRENT_STATUS_FILTER.' { print $0 }" '; - #$_command = 'awk -F"'.STR_DLMT.'" "BEGIN {OFS=\"\x7C\"} '.self::$_CURRENT_STATUS_FILTER.' { print $0 }" '.self::$dataFileName; - } - else - { - $_command = 'gawk -F"'.STR_DLMT.'" "BEGIN {OFS=\"\x7C\"} '.self::$_CURRENT_STATUS_FILTER.' { print $0 }" '.self::$dataFileName; - } - - } else { - #$cmdLn1 = 'awk -F"'.STR_DLMT.'" \'BEGIN {OFS="\x7C"} '.self::$_CURRENT_STATUS_FILTER.' { print $0 }\' '.self::$dataFileName.' > '.$tmp_files['filtred_status']; - #$out1 = shell_exec($cmdLn1); - # če smo predhodno sortirali - if (self::$do_sort) - { - $_command .= ' | awk -F"'.STR_DLMT.'" \'BEGIN {OFS="\x7C"} '.self::$_CURRENT_STATUS_FILTER.' { print $0 }\' '; - } - else - { - $_command = 'awk -F"'.STR_DLMT.'" \'BEGIN {OFS="\x7C"} '.self::$_CURRENT_STATUS_FILTER.' { print $0 }\' '.self::$dataFileName; - } - - } - - // pobrisemo vrstice ki ne vsebujejo iskalnega stringa (ce searchamo) in rdece boldamo rezultat - $search = isset($_SESSION['sid_'.self::$sid]['data_search_filter']) ? $_SESSION['sid_'.self::$sid]['data_search_filter'] : ''; - if($search != ''){ - if (IS_WINDOWS) { - $_command .= ' | sed "/'.$search.'/!d"'; - $_command .= ' | sed "s*'.$search.'*'.$search.'*g"'; - } else { - $_command .= ' | sed \'/'.$search.'/!d\''; - $_command .= ' | sed \'s*'.$search.'*'.$search.'*g\''; - } - } - - // paginacija po stolpcih (spremenljivkah) - if (IS_WINDOWS) { - #$cmdLn1_1 = 'cut -d "|" -f 1,'.self::$_VARIABLE_FILTER.' '.$tmp_files['filtred_status'].' > '.$tmp_files['filtred_spr_pagination']; - #$out1 = shell_exec($cmdLn1_1); - $_command .= ' | cut -d "|" -f 1,'.self::$_VARIABLE_FILTER; - } else { - #$cmdLn1_1 = 'cut -d \'|\' -f 1,'.self::$_VARIABLE_FILTER.' '.$tmp_files['filtred_status'].' > '.$tmp_files['filtred_spr_pagination']; - #$out1 = shell_exec($cmdLn1_1); - $_command .= ' | cut -d \'|\' -f 1,'.self::$_VARIABLE_FILTER; - } - - if (self::$_REC_LIMIT != '') { - #paginating - if (IS_WINDOWS) { - #$cmdLn2 = 'awk '.self::$_REC_LIMIT.' '.$tmp_files['filtred_spr_pagination'].' > '.$tmp_files['filtred_pagination']; - #$out2 = shell_exec($cmdLn2); - $_command .= ' | awk '.self::$_REC_LIMIT; - } else { - #$cmdLn2 = 'awk '.self::$_REC_LIMIT.' '.$tmp_files['filtred_spr_pagination'].' > '.$tmp_files['filtred_pagination']; - #$out2 = shell_exec($cmdLn2); - $_command .= ' | awk '.self::$_REC_LIMIT; - } - #$file_sufix = 'filtred_pagination'; - } else { - #$file_sufix = 'filtred_spr_pagination'; - } - - // zamenjamo | z '; - #$f = fopen ($tmp_files['filtred_sed'], 'r'); - if (file_exists($folder.'tmp_export_'.self::$sid.'_data'.TMP_EXT)) { - - if(self::$_VARS[VAR_REC_ON_PAGE] == 'all'){ - $up = 0; - $low = 1; - } - else{ - $up = self::$_VARS[VAR_REC_ON_PAGE] * self::$_VARS[VAR_CUR_REC_PAGE]; - $low = $up - self::$_VARS[VAR_REC_ON_PAGE]+1; - } - - $cntLines=$low ; - $f = fopen ($folder.'tmp_export_'.self::$sid.'_data'.TMP_EXT, 'r'); - while ($line = fgets ($f)) { - - echo ''; - - if ((int)$display1kaIcon == 1) { - echo ''; - } - if ($stolpci > 0 ) { - if (self::$displayEditIcons['dataIcons_edit'] == true) { - // checkbox za brisanje vecih vrstic hkrati - echo ''; - echo ''; - echo ''; - echo ''; - } - if (self::$displayEditIcons['dataIcons_write'] == true) { - echo ''; - echo ''; - - // Evoli ikona (ce je vklopljen modul) - if(SurveyInfo::getInstance()->checkSurveyModule('evoli')) { - echo ''; - echo ''; - echo ''; - } - if(SurveyInfo::getInstance()->checkSurveyModule('evoli_employmeter')) { - echo ''; - echo ''; - echo ''; - } - - // MFDPS ikona (ce je vklopljen modul) - if(SurveyInfo::getInstance()->checkSurveyModule('mfdps')) { - echo ''; - } - - // BORZA ikona (ce je vklopljen modul) - if(SurveyInfo::getInstance()->checkSurveyModule('borza')) { - echo ''; - } - } - } - - // URLje v besedilu spremenimo v __hiperlinke__ - $line = stripslashes(self::url_to_link($line)); - - # po potrebi vrinemo zaporedno številko - if (self::$showLineNumber ) { - $pos = self::getLineNumberCellOffset($line); - $line = substr_replace($line, ''; - - echo ''; - $cntLines++; - } - } else { - echo 'File does not exist (err.No.1)! :'.'tmp_export_'.self::$sid.'_data'.TMP_EXT; - #echo $folder.'tmp_export_'.self::$sid.'_data'.TMP_EXT; - } - echo ''; - echo '
    1 ? (' colspan="'.$stolpci.'"') : '').'> '; - } - - # dodamo skrit stolpec uid - echo ' '; - echo '
    '.$lang['srv_line_number'].'
    '; - echo '
    '; - echo '
    '.$spremenljivka['naslov'].'
    '; - echo '
    1 ? (' colspan="'.$stolpci.'"') : '').'> '; - } - - # dodamo skrit stolpec uid - echo ' '; - echo '
    '.$lang['srv_line_number'].'
    '; - echo '
    '; - echo '
    '.$grid['variable'].'
    '; - echo '
    '; - echo '
    '.$grid['naslov'].'
    '; - echo '
      1 ? (' colspan="'.$stolpci.'"') : '').'> '; - } - - # dodamo skrit stolpec uid - echo ' '; - echo '
    '.$lang['srv_line_number'].'
    '; - echo '
    '; - - if ($variable['sequence'] == self::$sort_seq && self::$sort_seq != null) { - $img_src = self::$sort_type == 'sort_dsc' ? 'sort_descending' : 'sort_ascending' ; - echo ''; - } - - // Zabelezimo sekvenco sistemskih identifikatorjev da jih pobarvamo - if($spremenljivka['is_system'] == 1) - $system_columns[] = $spremenljivka['sequences']; - - echo '
    '.$variable['naslov']; - if ($variable['other'] == 1) { - echo ' (text)'; - } - - /*// urejanje kalkulacije -- izracunane vrednosti v podatkih - if ($spremenljivka['tip'] == 22) { - echo ' ('.$lang['edit3'].')'; - }*/ - - echo '
    '; - - echo '
    - if (IS_WINDOWS) { - #$cmdLn3 = 'sed "s*'.STR_DLMT.'**g" '.$tmp_files[$file_sufix].' > '.$tmp_files['filtred_sed']; - #$out3 = shell_exec($cmdLn3); - $_command .= ' | sed "s*'.STR_DLMT.'*'.STR_LESS_THEN.'/td'.STR_GREATER_THEN.STR_LESS_THEN.'td'.STR_GREATER_THEN.'*g" >> '.$folder.'tmp_export_'.self::$sid.'_data'.TMP_EXT; - - } else { - #$cmdLn3 = 'sed \'s*'.STR_DLMT.'**g\' '.$tmp_files[$file_sufix].' > '.$tmp_files['filtred_sed']; - #$out3 = shell_exec($cmdLn3); - $_command .= ' | sed \'s*'.STR_DLMT.'**g\' >> ' - .$folder.'tmp_export_'.self::$sid.'_data'.TMP_EXT; - } - - if (IS_WINDOWS) { - # ker so na WINsih težave z sortom, ga damo v bat fajl in izvedemo :D - $file_handler = fopen($folder.'cmd_'.self::$sid.'_to_run.bat',"w"); - fwrite($file_handler,$_command); - fclose($file_handler); - $out_command = shell_exec($folder.'cmd_'.self::$sid.'_to_run.bat'); - unlink($folder.'cmd_'.self::$sid.'_to_run.bat'); - } else { - $out_command = shell_exec($_command); - } - - echo '
    '.$cntLines, $pos, 0); - } - - echo ''.$line.'
    '; - echo '
    '; // end div tableContainer - - /** - * kliki na ikonice za urejanje in izpis so definirane v script_analiza.js, analiza_init(); - */ - - // JS za urejanje vnosov (click in hover) (funkciji sta definirani v postProcess.js) - ?> - - ".$_command.""); - } - - // Editiranje na dnu - brisanje vec userjev hkrati... - - if(self::$dataFileStatus != FILE_STATUS_NO_DATA && (int)self::$displayEditIcons['dataIcons_edit'] == 1){ - self::displayBottomEdit(); - } - } - - static public function DisplayDataMultipleTable() { - global $lang, $site_path; - - if ( self::$dataFileStatus == FILE_STATUS_OLD) { - echo "Posodobljeno: ".date("d.m.Y, H:i:s", strtotime(self::$dataFileUpdated)); - } - - $folder = $site_path . EXPORT_FOLDER.'/'; - - // paginacija spremenljivk - $_spr_on_pages_stop = self::$_VARS['spr_page'] * self::$_VARS['spr_limit']; - $_spr_on_pages_start = self::$_VARS['spr_page'] * self::$_VARS['spr_limit'] - self::$_VARS['spr_limit']; - - $sql = sisplet_query("SELECT s.id, s.tip FROM srv_spremenljivka s, srv_grupa g WHERE s.tip='24' AND s.gru_id=g.id AND g.ank_id='".self::$sid."'"); - if ( mysqli_num_rows($sql) != 1 ) return; - $row = mysqli_fetch_assoc($sql); - $parent = $row['id']; - - $childs = array(); - $sql1 = sisplet_query("SELECT spr_id FROM srv_grid_multiple WHERE parent='$parent' AND ank_id='".self::$sid."'"); - while ( $row1 = mysqli_fetch_assoc($sql1) ) { - if ( isset( self::$_SVP_PV[$row1['spr_id'].'_0'] ) ) - $childs[] = $row1['spr_id']; - } - - #preberemo HEADERS iz datoteke - self::$_HEADERS = unserialize(file_get_contents(self::$headFileName)); - - $multiple = array(); - - foreach (self::$_HEADERS AS $spid => $spremenljivka) { - - if ( isset(self::$_SVP_PV[$spid]) && is_numeric($spremenljivka['tip']) ) { - - //$spr_id = explode('_', $spid)[0]; // PHP 5.4 - $spr_id = explode('_', $spid); - $spr_id = $spr_id[0]; - - if ( in_array($spr_id, $childs) ) { - $spremenljivka['seq'] = explode('_', $spremenljivka['sequences']); - $spremenljivka['spr_id'] = $spid; - $multiple[] = $spremenljivka; - } - } - } - - - $sequences = array(); $subseq = array(); $cols = array(); - - for ($spr=0; $spr'; - echo '
    '; - - # div v katerem po potrebi prikazujemo gumbe za skrolanje levo in desno - echo '
    '; - echo '<'; - echo ' '; - echo '>'; - echo '
    '; - - $display1kaIcon = self::$displayEditIcons['dataIcons_quick_view'] ; - - if (self::$printPreview == true) { - self::$displayEditIcons['dataIcons_edit'] = false; - self::$displayEditIcons['dataIcons_write'] = false; - $display1kaIcon = false; - } - # koliko stolpcev je colspan - $stolpci = ((int)self::$displayEditIcons['dataIcons_edit']*4) - + ((int)self::$displayEditIcons['dataIcons_write']*2) - + (int)$display1kaIcon ; - - echo ''; - # ali smo v edit načinu ali monitoringu - $cssEdit = (self::$_VARS[VAR_EDIT] || self::$_VARS[VAR_MONITORING]?' editData':''); - echo ''; - - // Nastavimo colgroup, da na njega vezemo vse sirine v tabeli, zaradi resizinga stolpcev - echo ''; - # colspan za ikonce - if ($stolpci > 0) { - //for ($i=0; $i<$stolpci; $i++) - // echo ''; - echo '1 ? (' span="'.$stolpci.'"') : '').'>'; - } - - $spr_cont = 0; - foreach (self::$_HEADERS AS $spid => $spremenljivka) { - if (isset(self::$_SVP_PV[$spid]) && count($spremenljivka['grids']) > 0) { - - $spr_id = explode('_', $spid); - $spr_id = $spr_id[0]; - - if ( in_array($spr_id, $childs) ) - $repeat = false; - else - $repeat = true; - - if (self::$showLineNumber && $spr_cont+1 == self::$lineoffset) { - echo ''; - } - - // paginacija spremenljivk - if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) { - foreach ($spremenljivka['grids'] AS $gid => $grid) { - if (count ($grid['variables']) > 0) { - foreach ($grid['variables'] AS $vid => $variable ){ - echo ''; - } - } - - if (!$repeat) break; - } - } - $spr_cont++; - } - - } - echo ''; - - echo ''; - echo ''; - - # colspan za ikonce - if ($stolpci > 0) { - echo ''; - - $spr_cont = 0; - foreach (self::$_HEADERS AS $spid => $spremenljivka) { - - if (isset(self::$_SVP_PV[$spid])) { - - $spr_id = explode('_', $spid); - $spr_id = $spr_id[0]; - - if ( in_array($spr_id, $childs) ) { - $colspan = $cols[ array_search($spr_id, $childs) ]; - } else { - $colspan = $spremenljivka['cnt_all']; - } - - if (self::$showLineNumber && $spr_cont+1 == self::$lineoffset) { - echo ''; - } - // paginacija spremenljivk - if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) { - echo ''; - } - $spr_cont++; - - } - } - - echo ''; - - # colspan za ikonce - if ($stolpci > 0) { - echo ''; - - $spr_cont = 0; - foreach (self::$_HEADERS AS $spid => $spremenljivka) { - if (isset(self::$_SVP_PV[$spid]) && (count($spremenljivka['grids']) > 0 )) { - - $spr_id = explode('_', $spid); - $spr_id = $spr_id[0]; - - if ( in_array($spr_id, $childs) ) - $repeat = false; - else - $repeat = true; - - if(self::$showLineNumber && $spr_cont+1 == self::$lineoffset) { - echo ''; - } - - // paginacija spremenljivk - if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) { - - foreach ($spremenljivka['grids'] AS $gid => $grid) { - echo ''; - - if (!$repeat) break; - } - } - $spr_cont++; - } - - } - echo ''; - - # colspan za ikonce - if ($stolpci > 0) { - //for ($i=0; $i<$stolpci; $i++) - // echo ''; - echo ''; - } - - # dodamo skrit stolpec uid - echo ''; - - $spr_cont = 0; - foreach (self::$_HEADERS AS $spid => $spremenljivka) { - if (isset(self::$_SVP_PV[$spid]) && count($spremenljivka['grids']) > 0) { - - $spr_id = explode('_', $spid); - $spr_id = $spr_id[0]; - - if ( in_array($spr_id, $childs) ) - $repeat = false; - else - $repeat = true; - - if (self::$showLineNumber && $spr_cont+1 == self::$lineoffset) { - echo ''; - } - - // paginacija spremenljivk - if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) { - foreach ($spremenljivka['grids'] AS $gid => $grid) { - if (count ($grid['variables']) > 0) { - foreach ($grid['variables'] AS $vid => $variable ){ - echo ''; - } - } - - if (!$repeat) break; - } - } - $spr_cont++; - } - - } - echo''; - echo ''; - - $_command = ''; - #preberemo podatke - - # najprej po potrebi presortiramo - # na vindowsih ne delamo sorta (zaenkrat) // zdej ga že? :) - if (self::$do_sort == true) { - # - $sortString = '-k '.self::$sort_seq; - - #ker tekstovnih ne sortira vredu sem odstranil parameter -n - # iz navodil: sorting keys can be interpreted numerically (-n option) instead of alphabetically (which is the default). - # če bodo težave bo potrebno parameter -n dodajat po potrebi - # $sort_numeric => - $sort_numeric = ''; #$sort_numeric = '-n ' - - # za datumska polja je potrebno malo potelovadit - foreach (self::$_HEADERS AS $spid => $spremenljivka) { - if (count($spremenljivka['grids']) > 0 ) { - foreach ($spremenljivka['grids'] AS $gid => $grid) { - if (count ($grid['variables']) > 0) { - foreach ($grid['variables'] AS $vid => $variable ){ - if (self::$sort_seq == $variable['sequence']) { - if ($variable['spss'] == 'DATETIMEw' || $variable['sortType'] == 'date') { - #12.09.2011 - $sortString = '-k '.self::$sort_seq.'.7,'.self::$sort_seq.'.10 -k'.self::$sort_seq.'.4,'.self::$sort_seq.'.5 -k'.self::$sort_seq.'.1,'.self::$sort_seq.'.2'; - } - } - } - } - } - } - } - - if (IS_WINDOWS) { - #Cygwin Sort Command On Windows - # popravi pot do svojega sort-a - $_path_to_CygwinSort = PATH_TO_CYGWIN_FOLDER; - # $_command = $_path_to_CygwinSort.' -t"'.STR_DLMT.'"'.(self::$sort_type == 'sort_dsc' ? '-r' : '').' +'.(int)(self::$sort_seq-1).' '.self::$dataFileName.''; - $_command = $_path_to_CygwinSort.' -t"'.STR_DLMT.'" '.(self::$sort_type == 'sort_asc' ? '' : '-r ').$sort_numeric.$sortString.' '.self::$dataFileName; - } else { - # smo na linuxu - $_command = 'sort -t \\'.STR_DLMT.' '.(self::$sort_type == 'sort_asc' ? '' : '-r ' ).$sort_numeric.$sortString.' '.self::$dataFileName; - } - } - // polovimo vrstice z statusom 5,6 in jih damo v začasno datoteko - if (IS_WINDOWS) { - #$cmdLn1 = 'awk -F"'.STR_DLMT.'" "BEGIN {OFS=\"\x7C\"} '.self::$_CURRENT_STATUS_FILTER.' { print $0 }" '.self::$dataFileName.' > '.$tmp_files['filtred_status']; - #$out1 = shell_exec($cmdLn1); - # če smo predhodno sortirali - if (self::$do_sort == true) { - $_command .= ' | gawk -F"'.STR_DLMT.'" "BEGIN {OFS=\"\x7C\"} '.self::$_CURRENT_STATUS_FILTER.' { print $0 }" '; - #$_command = 'awk -F"'.STR_DLMT.'" "BEGIN {OFS=\"\x7C\"} '.self::$_CURRENT_STATUS_FILTER.' { print $0 }" '.self::$dataFileName; - } else { - $_command = 'gawk -F"'.STR_DLMT.'" "BEGIN {OFS=\"\x7C\"} '.self::$_CURRENT_STATUS_FILTER.' { print $0 }" '.self::$dataFileName; - } - - } else { - #$cmdLn1 = 'awk -F"'.STR_DLMT.'" \'BEGIN {OFS="\x7C"} '.self::$_CURRENT_STATUS_FILTER.' { print $0 }\' '.self::$dataFileName.' > '.$tmp_files['filtred_status']; - #$out1 = shell_exec($cmdLn1); - # če smo predhodno sortirali - if (self::$do_sort) { - $_command .= ' | awk -F"'.STR_DLMT.'" \'BEGIN {OFS="\x7C"} '.self::$_CURRENT_STATUS_FILTER.' { print $0 }\' '; - } else { - $_command = 'awk -F"'.STR_DLMT.'" \'BEGIN {OFS="\x7C"} '.self::$_CURRENT_STATUS_FILTER.' { print $0 }\' '.self::$dataFileName; - } - - } - - // paginacija po stolpcih (spremenljivkah) - if (IS_WINDOWS) { - #$cmdLn1_1 = 'cut -d "|" -f 1,'.self::$_VARIABLE_FILTER.' '.$tmp_files['filtred_status'].' > '.$tmp_files['filtred_spr_pagination']; - #$out1 = shell_exec($cmdLn1_1); - $_command .= ' | cut -d "|" -f 1,'.self::$_VARIABLE_FILTER; - } else { - #$cmdLn1_1 = 'cut -d \'|\' -f 1,'.self::$_VARIABLE_FILTER.' '.$tmp_files['filtred_status'].' > '.$tmp_files['filtred_spr_pagination']; - #$out1 = shell_exec($cmdLn1_1); - $_command .= ' | cut -d \'|\' -f 1,'.self::$_VARIABLE_FILTER; - } - - if (self::$_REC_LIMIT != '') { - #paginating - if (IS_WINDOWS) { - #$cmdLn2 = 'awk '.self::$_REC_LIMIT.' '.$tmp_files['filtred_spr_pagination'].' > '.$tmp_files['filtred_pagination']; - #$out2 = shell_exec($cmdLn2); - $_command .= ' | awk '.self::$_REC_LIMIT; - } else { - #$cmdLn2 = 'awk '.self::$_REC_LIMIT.' '.$tmp_files['filtred_spr_pagination'].' > '.$tmp_files['filtred_pagination']; - #$out2 = shell_exec($cmdLn2); - $_command .= ' | awk '.self::$_REC_LIMIT; - } - #$file_sufix = 'filtred_pagination'; - } else { - #$file_sufix = 'filtred_spr_pagination'; - } - - // zamenjamo | z '; - #$f = fopen ($tmp_files['filtred_sed'], 'r'); - if (file_exists($folder.'tmp_export_'.self::$sid.'_data'.TMP_EXT)) { - - if(self::$_VARS[VAR_REC_ON_PAGE] == 'all'){ - $up = 0; - $low = 1; - } - else{ - $up = self::$_VARS[VAR_REC_ON_PAGE] * self::$_VARS[VAR_CUR_REC_PAGE]; - $low = $up - self::$_VARS[VAR_REC_ON_PAGE]+1; - } - - $cntLines=$low ; - $f = fopen ($folder.'tmp_export_'.self::$sid.'_data'.TMP_EXT, 'r'); - - $data = array(); - while ($line= fgets ($f)) { - $data[] = explode(''; - - - if ((int)$display1kaIcon == 1) { - echo ''; - } - if ($stolpci > 0 ) { - if (self::$displayEditIcons['dataIcons_edit'] == true) { - // checkbox za brisanje vecih vrstic hkrati - echo ''; - echo ''; - echo ''; - echo ''; - } - if (self::$displayEditIcons['dataIcons_write'] == true) { - echo ''; - echo ''; - } - } - - // URLje v besedilu spremenimo v __hiperlinke__ - $line = stripslashes(self::url_to_link($line)); - - # po potrebi vrinemo zaporedno številko - if (self::$showLineNumber && self::$_VARS[VAR_DATA]) { - $pos = self::getLineNumberCellOffset($line); - $line = substr_replace($line, ''; - - echo ''; - $cntLines++; - } - } else { - echo 'File does not exist (err.No.1)! :'.'tmp_export_'.self::$sid.'_data'.TMP_EXT; - #echo $folder.'tmp_export_'.self::$sid.'_data'.TMP_EXT; - } - echo ''; - echo '
    1 ? (' colspan="'.$stolpci.'"') : '').'> '; - } - - # dodamo skrit stolpec uid - echo ' '; - echo '
    '.$lang['srv_line_number'].'
    '; - echo '
    '; - echo '
    '.$spremenljivka['naslov'].'
    '; - echo '
    1 ? (' colspan="'.$stolpci.'"') : '').'> '; - } - - # dodamo skrit stolpec uid - echo ' '; - echo '
    '.$lang['srv_line_number'].'
    '; - echo '
    '; - echo '
    '.$grid['naslov'].'
    '; - echo '
      1 ? (' colspan="'.$stolpci.'"') : '').'>  '; - echo '
    '.$lang['srv_line_number'].'
    '; - echo '
    '; - - echo '
    '.$variable['naslov']; - if ($variable['other'] == 1) { - echo ' (text)'; - } - /*// urejanje kalkulacije -- izracunane vrednosti v podatkih - if ($spremenljivka['tip'] == 22) { - echo ' ('.$lang['edit3'].')'; - }*/ - if ($variable['sequence'] == self::$sort_seq && self::$sort_seq != null) { - $img_src = self::$sort_type == 'sort_dsc' ? 'sort_descending' : 'sort_ascending' ; - echo ''; - } - echo '
    '; - - echo '
    - if (IS_WINDOWS) { - #$cmdLn3 = 'sed "s*'.STR_DLMT.'**g" '.$tmp_files[$file_sufix].' > '.$tmp_files['filtred_sed']; - #$out3 = shell_exec($cmdLn3); - $_command .= ' | sed "s*'.STR_DLMT.'*'.STR_LESS_THEN.'/td'.STR_GREATER_THEN.STR_LESS_THEN.'td'.STR_GREATER_THEN.'*g" >> '.$folder.'tmp_export_'.self::$sid.'_data'.TMP_EXT; - - } else { - #$cmdLn3 = 'sed \'s*'.STR_DLMT.'**g\' '.$tmp_files[$file_sufix].' > '.$tmp_files['filtred_sed']; - #$out3 = shell_exec($cmdLn3); - $_command .= ' | sed \'s*'.STR_DLMT.'**g\' >> ' - .$folder.'tmp_export_'.self::$sid.'_data'.TMP_EXT; - - } - if (IS_WINDOWS) { - # ker so na WINsih težave z sortom, ga damo v bat fajl in izvedemo :D - $file_handler = fopen($folder.'cmd_'.self::$sid.'_to_run.bat',"w"); - fwrite($file_handler,$_command); - fclose($file_handler); - $out_command = shell_exec($folder.'cmd_'.self::$sid.'_to_run.bat'); - unlink($folder.'cmd_'.self::$sid.'_to_run.bat'); - } else { - $out_command = shell_exec($_command); - } - - echo '
    ', $line); - } - - - $dataoffset = 1; - $vrstni_red = array(); - foreach (self::$_HEADERS AS $key => $val) { - if ($key != '_settings') { - - $spr = explode('_', $key); - $spr = $spr[0]; - $vrstni_red[$key] = $dataoffset; - - if ( in_array($key, self::$_SVP_PV) ) { // TODO: tukaj je nekaj pocasno.. - if (is_numeric($spr)) { - $dataoffset += $val['cnt_all']; - } else { - $dataoffset++; - } - } - } - } - - - $newdata = array(); - for ($dataline=0; $dataline=0; $spr--) { - for ($j=0; $j<$cols[$spr]; $j++) { - - if ( ! in_array(trim($newlines[$i][ $vrstni_red[$multiple[$spr]['spr_id']] + ($cols[$spr]*($i)) + $j ]), array('-1', '-3', '-4')) ) { - $add = true; - break; - } - } - } - - if ( $add ) { // preverjamo da niso same -3 - - // pri vseh, razen prvi vrstici odstranimo podvojene vrednosti - if ($i > 0) { - $leave = array(); - for ($spr=count($multiple)-1; $spr>=0; $spr--) { - for ($j=0; $j<$cols[$spr]; $j++) { - $leave[] = $vrstni_red[$multiple[$spr]['spr_id']] + ($cols[$spr]*($i)) + $j; - } - } - for ($j=0; $j=0; $spr--) { // zacnemo od zadaj da si ne pokvarjamo indexov - - // zbrisemo na koncu (najprej na koncu, da si ne pokvarjamo indexov) - array_splice($newlines[$i], $vrstni_red[$multiple[$spr]['spr_id']] + ($cols[$spr]*($i+1)), $subseq[0]*$cols[$spr] - $cols[$spr]*($i+1) ); - - // zbrisemo na zacetku - array_splice($newlines[$i], $vrstni_red[$multiple[$spr]['spr_id']], $cols[$spr]*($i)); - } - - # dodamo UID. Mitja, tole sem jaz dodal, - # da se na začetek vsake vrstice doda UID, kateri je potreben za postprocess JS funkcije - # za urejanje, ker Ajda joka da v kombinirani tabeli ne deluje urejanje za podvojene vrstice - # Gorazd - $newlines[$i][0] = $origline[0]; - - // dodamo v nov array - $newdata[] = $newlines[$i]; - - } - } - - } - - unset($data); - $data = &$newdata; - - - foreach ($data AS $line) { - $line = implode('', $line); - - echo '
    '.$cntLines, $pos, 0); - } - - echo ''.$line.'
    '; - echo '
    '; // end div tableContainer - - /** - * kliki na ikonice za urejanje in izpis so definirane v script_analiza.js, analiza_init(); - */ - - // JS za urejanje vnosov (click in hover) (funkciji sta definirani v postProcess.js) - ?> - - ".$_command.""); - } - - // Editiranje na dnu - brisanje vec userjev hkrati... - if(self::$dataFileStatus != FILE_STATUS_NO_DATA && (int)self::$displayEditIcons['dataIcons_edit'] == 1){ - self::displayBottomEdit(); - } - } - - public static function url_to_link($text) { - if ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) - return preg_replace('!(https://[a-z0-9_./?=&-]+)!i', '$1 ', $text." "); - else - return preg_replace('!(http://[a-z0-9_./?=&-]+)!i', '$1 ', $text." "); - } - - /** Prikaze reseno anketo za posameznega uporabnika v hitrem nacinu - * - */ - public static function displayQuickEdit(){ - global $lang; - global $site_path; - - if (self::$dataFileStatus == FILE_STATUS_NO_DATA - || self::$dataFileStatus == FILE_STATUS_NO_FILE - || self::$dataFileStatus == FILE_STATUS_SRV_DELETED){ - return false; - } - - include_once('../../main/survey/app/global_function.php'); - new \App\Controllers\SurveyController(true); - save('usr_id', self::$usr_id); - - if (isset($_GET['quick_view']) && $_GET['quick_view'] == 0 ) { - $quick_view = false; - } else { - $quick_view = true; - } - - - $rowa = SurveyInfo::getInstance()->getSurveyRow(); - if ($quick_view) { - # če smo v quick_view disejblamo vse elemente forem - echo ""; - } - else{ - # če urejamo dodamo prazno js funkcijo submitForm da ne mece errorja (submit izvedemo rocno) - echo ""."\n"; - } - - echo '
    '; - echo '
    '; - - // title - echo '
    '; - - //echo $rowa['naslov']; - if (self::$quickEdit_recnum[3]['hasPrev'] == true) { - echo ''; - } - echo 'Recnum '.self::$quickEdit_recnum[2]; - if (self::$quickEdit_recnum[3]['hasNext'] == true) { - echo ''; - } - - echo '
    '; - - if ($quick_view == false) { - echo '
    '."\n"; - } - - if (isset($_GET['anketa'])) - { - save('anketa', $_GET['anketa']); - if ($quick_view == false) { - - //JS potreben za branching - \App\Controllers\JsController::getInstance()->generateBranchingJS(); - echo ''; - - // shranimo popravke v bazo - if(isset($_GET['post']) && $_GET['post'] == '1'){ - \App\Models\SaveSurvey::getInstance()->posted(); - } - } - - - $first_loop = 0; - - // prikažemo spremenljivke - vse grupe - do - { - // nastavimo naslednjo grupo / loop - if(get('loop_AW') == 0 && get('loop_id') == null){ - save('grupa', \App\Controllers\FindController::getInstance()->findNextGrupa()); - } elseif (get('loop_id') != null) { - save('loop_id', \App\Controllers\FindController::getInstance()->findNextLoopId()); - - if (get('loop_id') == null) - save('grupa', \App\Controllers\FindController::getInstance()->findNextGrupa()); - } - - echo '
    '."\n"; - - // zgeneriramo sistemske spremenljivke - \App\Controllers\HeaderController::getInstance()->displaySistemske();; - - - $offset = 0; - $zaporedna = 1; - if (SurveyInfo::getInstance()->getSurveyCountType() > 0) - { - // Preštejemo koliko vprašanj je bilo do sedaj - $sqlg = sisplet_query("SELECT vrstni_red FROM srv_grupa WHERE id='".get('grupa')."'"); - $rowg = mysqli_fetch_assoc($sqlg); - $vrstni_red = $rowg['vrstni_red']; - - $sqlCountPast = sisplet_query("SELECT count(*) as cnt FROM srv_spremenljivka s, srv_grupa g WHERE g.ank_id='".get('anketa')."' AND s.gru_id=g.id AND g.vrstni_red < '$vrstni_red' ORDER BY g.vrstni_red ASC, s.vrstni_red ASC"); - $rowCount = mysqli_fetch_assoc($sqlCountPast); - $offset = $rowCount['cnt']; - } - - // poiscemo vprasanja / spremenljivke - $sql = sisplet_query("SELECT id FROM srv_spremenljivka WHERE gru_id='".get('grupa')."' AND visible='1' ORDER BY vrstni_red ASC"); - while ($row = mysqli_fetch_array($sql)) { - - //ce gre za glasovanje in smo eno vprasanje ze prikazali, ostalih ne prikazemo - if( (SurveyInfo::getInstance()->getSurveyType() != 0) || ($zaporedna == 1)){ - - // preverimo, ce je na tej strani LOOP - if (get('loop_id') ==null) { - - // nastavimo pravi id trenutnega loopa - $if_id = \App\Controllers\FindController::find_parent_loop($row['id']); - if ($if_id > 0) { - - // Ce je prva spremenljivka v loopih izpisemo warning za urejanje - $first_loop = ($first_loop == 0) ? 1 : 2; - if($first_loop == 1) - echo '
    '.$lang['srv_loop_warning'].''.$lang['srv_loop_warning2'].'.
    '; - - save('loop_id', \App\Controllers\FindController::getInstance()->findNextLoopId($if_id)); - } - } - - // filtriramo spremenljivke glede na profil - $dvp = SurveyUserSetting :: getInstance()->getSettings('default_variable_profile'); - $_currentVariableProfile = SurveyVariablesProfiles :: checkDefaultProfile($dvp); - - # V VPOGLEDU NE FILTRIRAMO SPREMENLJIVK (v.v.: 27.11.2011) - #$tmp_svp_pv = SurveyVariablesProfiles :: getProfileVariables($_currentVariableProfile); - - # če je $svp_pv = null potem prikazujemo vse variable - # oziroma če je sistemski dodamo tudi vse, ker drugače lahko filter skrije telefon in email - if (count($tmp_svp_pv) == 0 || self::$_VARS[VAR_SHOW_SYSTEM] == true ) { - $_sv = self::$SDF->getSurveyVariables(); - - if (count($_sv) > 0) { - foreach ( $_sv as $vid => $variable) { - $tmp_svp_pv[$vid] = substr($vid, 0, strpos($vid, '_')); - } - } - } - else{ - foreach ( $tmp_svp_pv as $vid => $variable) { - $tmp_svp_pv[$vid] = substr($vid, 0, strpos($vid, '_')); - } - } - # V VPOGLEDU NE FILTRIRAMO SPREMENLJIVK (v.v.: 27.11.2011) - //if(in_array($row['id'],$tmp_svp_pv)) - \App\Controllers\Vprasanja\VprasanjaController::getInstance()->displaySpremenljivka($row['id'], $offset, $zaporedna); - } - - $zaporedna++; - } - if ($quick_view == false) { - \App\Controllers\JsController::getInstance()->generateSubmitJS(); - } - - echo '
    '."\n"; - } - while (get('grupa') != \App\Controllers\FindController::getInstance()->findNextGrupa() && - (\App\Controllers\FindController::getInstance()->findNextGrupa() > 0 || (get('loop_id') != null && \App\Controllers\FindController::getInstance()->findNextLoopId() != null))); - } - if ($quick_view == false) { - //echo ' ';... - echo ''; - echo ''; - - #echo '
    '."\n"; - } - else{ - echo ''."\n"; - } - - echo '
    '; # inner - - echo '
    '; - self::displayVnosIcons(); - echo '
    '; - - echo '



    '; - - echo '
    '; - - - //div na desni z metapodatki - echo '
    '; - self::displayQuickEditMeta(); - echo '
    '; - - // Preverimo ce gre za prvo urejanje - potem avtomatsko ustvarimo arhiv podatkov - if ($quick_view == false && isset($_GET['post']) && $_GET['post'] == '1') { - ob_flush(); - - $sas = new SurveyAdminSettings(); - $sas->checkFirstDataChange($inserted=true); - } - } - - public static function displayQuickEditFilters(){ - global $lang; - global $site_path; - - //echo '

    '.$lang['srv_data_title_quick_view'].'

    '; - - if (self::$dataFileStatus == FILE_STATUS_NO_DATA - || self::$dataFileStatus == FILE_STATUS_NO_FILE - || self::$dataFileStatus == FILE_STATUS_SRV_DELETED){ - return false; - } - - /*echo '
    '; - SurveyStatusProfiles::displayOnlyValidCheckbox(); - echo '
    ';*/ - $SSH = new SurveyStaticHtml(self::$sid); - $SSH -> displayTopSettings($podstran='quick_edit'); - - //$prev_next = self::displayQuickEditPagination(); - self::displayQuickEditPagination(); - - echo '
    '; - echo '
      '; - # div za filtre statusov - SurveyStatusProfiles::DisplayLink(false); - # div za profile variabel - SurveyVariablesProfiles::DisplayLink(false, false); - # filter za pogoje - ifi - SurveyConditionProfiles::DisplayLink(false); - # filter za čase - SurveyTimeProfiles::DisplayLink(false,false); - echo '
    '; - echo '
    '; - - # skrit div za izbor if-profilov - echo '
    '; - - # skrit div za izbor profilov intervala - echo '
    '; - - # če ne uporabljamo privzetega časovnega profila izpišemo opozorilo - $doNewLine = SurveyTimeProfiles :: printIsDefaultProfile(false); - if ($doNewLine) { - echo '
    '; - } - # če imamo filter ifov ga izpišemo - $doNewLine = SurveyConditionProfiles:: getConditionString($doNewLine ) || $doNewLine; - - # če imamo filter ifov za inspect ga izpišemo - $SI = new SurveyInspect(self::$sid); - $SI->getConditionString(); - - # če imamo filter spremenljivk ga izpišemo - # ker v vpogledu ne filtriramo spremenljivk, ne izpisujemo obvestila - #$doNewLine = SurveyVariablesProfiles:: getProfileString($doNewLine ) || $doNewLine; - - if ($doNewLine) { - echo '
    '; - } - - echo '
    '; - - self::displayVnosIcons(); - - echo '
    '; - } - - public static function displayQuickEditPagination() { - global $site_url, $lang; - - #Userje polovimo iz datoteke s pomočjo filtrov z AWK-jem - $_command = ''; - #preberemo podatke - - $tmp_file = self::$folder.'tmp_export_'.self::$sid.'_data'.TMP_EXT; - $file_handler = fopen($tmp_file,"w"); - fwrite($file_handler,"> '.$tmp_file; - } else { - $_command = 'awk -F"'.STR_DLMT.'" \'BEGIN {OFS=""} '.self::$_CURRENT_STATUS_FILTER.' { print "$uids[]=",'.USER_ID_FIELD.',";$uid_rec[",'.USER_ID_FIELD.',"]=",'.MOD_REC_FIELD.',";"}\' '.self::$dataFileName.' >> '.$tmp_file; - } - - if (IS_WINDOWS) { - $out_command = shell_exec($_command); - } else { - $out_command = shell_exec($_command); - } - include($tmp_file); - - if (file_exists($tmp_file)) { - unlink($tmp_file); - } - # če imamo zapise - $all = count($uids); - # current nastavimo na zadnji element - if ( $all > 0) { - // Če trenutni user ni nastavljen ga nastavimo. Upoštevamo tudi filtre, zato preberemo prvega iz filtriranega seznama - if(self::$usr_id == 0){ - self::$usr_id = reset($uids); - } - - - if (isset($_GET['quick_view']) && $_GET['quick_view'] == 0 ) { - $baseUrl = $site_url.'admin/survey/index.php?anketa='.self::$sid.'&a=data&m=quick_edit&quick_view='.$_GET['quick_view'].'&usr_id='; - } else { - $baseUrl = $site_url.'admin/survey/index.php?anketa='.self::$sid.'&a=data&m=quick_edit&usr_id='; - } - - if (self::$usr_id > 0 && isset(self::$usr_id,$uids)) { - $current = array_search(self::$usr_id,$uids); - - } else { - $current = count($uids)-1; - } - - echo ''; - - // vrnemo link na prejsnega, link na naslednjega in recnum trenutnega - //return array($baseUrl.$prev_page, $baseUrl.$next_page, $uid_rec[self::$usr_id], $controls); - self::$quickEdit_recnum = array($baseUrl.$prev_page, $baseUrl.$next_page, $uid_rec[self::$usr_id], $controls); - } - else { - // dobimo trenutnega userja - ce ni nastavljen v get-u - if(self::$usr_id == 0){ - $sqlu = sisplet_query("SELECT id FROM srv_user WHERE ank_id='".self::$sid."' ORDER BY recnum DESC LIMIT 1"); - $rowu = mysqli_fetch_array($sqlu); - self::$usr_id = $rowu['id']; - } - } - } - - public static function displayQuickEditMeta(){ - global $lang; - global $site_path; - global $admin_type; - - $rowa = SurveyInfo::getInstance()->getSurveyRow(); - - // dobimo trenutnega userja - if(self::$usr_id > 0){ - $sqlu = sisplet_query("SELECT * FROM srv_user WHERE ank_id='".self::$sid."' AND id='".self::$usr_id."' "); - $rowu = mysqli_fetch_array($sqlu); - } - else{ - $sqlu = sisplet_query("SELECT * FROM srv_user WHERE ank_id='".self::$sid."' ORDER BY recnum DESC "); - $rowu = mysqli_fetch_array($sqlu); - } - self::$usr_id = $rowu['id']; - - echo '
    '.$lang['srv_metapodatki'].'
    '; - - - echo ''; - - echo ''; - echo ''; - - // IP - $ip = SurveySetting::getInstance()->getSurveyMiscSetting('survey_ip'); - $ip_show = SurveySetting::getInstance()->getSurveyMiscSetting('survey_show_ip'); - if($ip==0 && $ip_show==1 && ($admin_type == 0 || $admin_type == 1)){ - echo ''; - echo ''; - } - - // recnum - echo ''; - echo ''; - - // browser - echo ''; - echo ''; - - // javascript - echo ''; - echo ''; - - // jezik - $p = new Prevajanje(self::$sid); - $jeziki = $p->get_all_langs(); - $jeziki['0'] = $lang['language']; - echo ''; - echo ''; - - // status - echo ''; - echo ''; - - // lurker - echo ''; - echo ''; - - //referer - echo ''; - echo ''; - - //email - samo forma - if($rowa['survey_type'] == 1){ - echo ''; - echo ''; - } - - // spreminjal - $datetime = strtotime($rowu['time_insert']); - $text = date("d.m.Y, H:i:s", $datetime); - echo ''; - echo ''; - - $datetime = strtotime($rowu['time_edit']); - $text = date("d.m.Y, H:i:s", $datetime); - echo ''; - echo ''; - - // preberemo popravljanje po straneh - $sqlG = sisplet_query("SELECT ug.time_edit, g.naslov FROM srv_user_grupa".self::$db_table." ug, srv_grupa g WHERE g.ank_id = '".self::$sid."' AND ug.usr_id = '".self::$usr_id."' AND g.id = ug.gru_id ORDER BY g.vrstni_red ASC"); - while($rowG = mysqli_fetch_array($sqlG)){ - - $datetime = strtotime($rowG['time_edit']); - $text = date("d.m.Y, H:i:s", $datetime); - - echo ''; - echo ''; - } - - if ( $admin_type <= 1 /* && what more??? */ ) { - - echo ''; - echo ''; - - } - - # preberemo vklopljene module - //potrebuje se za modul MAZA, da aplikacija izpolni te hidden inpute - //rabi pa se to za povezavo respondenta med tebelama maza_app_users in srv_user - if(SurveyInfo::checkSurveyModule('maza')){ - $maza_query = "SELECT mau.identifier, mau.deviceInfo, mau.tracking_log FROM maza_app_users as mau - JOIN maza_srv_users AS msu ON mau.id = msu.maza_user_id - JOIN srv_user AS su ON msu.srv_user_id = su.id - WHERE su.id = '".self::$usr_id."';"; - - $sql = sisplet_query($maza_query, 'array'); - - //it is already there - if(count($sql) > 0){ - //NextPin link - echo ''; - echo ''; - //Device info - echo ''; - echo ''; - //Tracking logs - echo ''; - echo ''; - } - } - - echo '
    '.$lang['srv_info_type'].':'.$lang['srv_vrsta_survey_type_'.SurveyInfo::getSurveyType()].'
    '.$lang['ip'].':'.($rowu['ip'] ? $rowu['ip'] : ' ').'
    '.$lang['srv_recnum'].':'.($rowu['recnum'] ? $rowu['recnum'] : ' ').'
    '.$lang['browser'].':'.($rowu['useragent'] ? $rowu['useragent'] : ' ').'
    '.$lang['javascript'].':'.(($rowu['javascript'] == 1) ? $lang['yes'] : $lang['no1']).'
    '.$lang['lang'].':'.$jeziki[$rowu['language']].'
    '.$lang['status'].':'.($rowu['last_status'] ? $rowu['last_status'] : ' ').'
    '.$lang['srv_data_lurker'].':'.(($rowu['lurker'] == 1) ? $lang['yes'] : $lang['no1']).'
    '.$lang['referer'].':'.($rowu['referer'] ? $rowu['referer'] : ' ').'
    '.$lang['email'].':'.($rowu['email'] ? $rowu['email'] : ' ').'
    '.$lang['timeinsert'].':'.$text.'
    '.$lang['timeedit'].':'.$text.'
    '.$rowG['naslov'].':'.$text.'
    '.$lang['srv_sc_txt1'].':'.$lang['srv_sc_txt2'].'
    '.$lang['srv_maza_nextpin_link'].':' - . 'http://traffic.ijs.si/NextPin/?user=1KAPanel_'.$sql[0]['identifier'].'
    '.$lang['srv_maza_device_info'].':'.$sql[0]['deviceInfo'].'
    '.$lang['srv_maza_user_app_logs'].':'.$sql[0]['tracking_log'].'
    '; - - - echo ''; - //echo ''; - - } - - - /* funkcija vrne AWK string za pogoj ali iščemo zapise trenutnega userja - * vklopljeno more bit prepoznava userja iz cms - * - */ - static function createCMSUserFilter() { - #poiščemo sekvenco meta podatka: usr_from_cms - $found=false; - $sequence = null; - if (count(self::$_HEADERS['meta']['grids']) > 0 && $found==false) { - foreach (self::$_HEADERS['meta']['grids'] AS $gid => $grids) { - if (count($grids['variables']) > 0 && $found==false) { - foreach ($grids['variables'] AS $vids => $variables) { - if ($variables['variable'] == 'usr_from_cms') { - $sequence = $variables['sequence']; - $found=true; - } - } - } - } - } - if ($found == true && (int)$sequence > 0) { - # polovimo email - global $global_user_id; - $sqlu = sisplet_query("SELECT email FROM users WHERE id = '".$global_user_id."'"); - list($email) = mysqli_fetch_row($sqlu); - if ($email != null &&trim($email) != '') { - - # nardimo awk string da primerjamo email - if (IS_WINDOWS) { - # za windows - $awkString = '($'.$sequence.'=='."\\\"".$email."\\\"".')'; - } else { - # za linux - $awkString = '($'.$sequence.'=='.'"'.$email.'"'.')'; - } - - return $awkString; - } - } - return null; - } - - static function displayOnlyCMS() { - global $lang; - # prikažemo samo če imamo ankete uporabnika iz cms - echo ''; - } - - static function displayPublicData($properties = array()) { - global $lang; - global $site_url; - - header('Cache-Control: no-cache'); - header('Pragma: no-cache'); - $anketa = self::$sid; - if ($anketa > 0) { - $sql = sisplet_query("SELECT lang_admin FROM srv_anketa WHERE id = '$anketa'"); - $row = mysqli_fetch_assoc($sql); - $lang_admin = $row['lang_admin']; - } else { - $sql = sisplet_query("SELECT value FROM misc WHERE what = 'SurveyLang_admin'"); - $row = mysqli_fetch_assoc($sql); - $lang_admin = $row['value']; - } - - #izpišemo HTML - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - - echo ''; - - echo '

    '.$lang['srv_publc_data_title_for'].self::$survey['naslov'].'

    '; - echo ''; - - echo '
    '; - //Izvoz v PDF / RTF / XLS - $_url1 = $site_url.'admin/survey/izvoz.php?dc='.base64_encode( - serialize( - array( 'b'=>'export', - 'a'=>'list_pdf', - 'anketa'=>$anketa))); - $_url2 = $site_url.'admin/survey/izvoz.php?dc='.base64_encode( - serialize( - array( 'b'=>'export', - 'a'=>'list_rtf', - 'anketa'=>$anketa))); - $_url3 = $site_url.'admin/survey/izvoz.php?dc='.base64_encode( - serialize( - array( 'b'=>'export', - 'a'=>'list_xls', - 'anketa'=>$anketa))); - echo '
    '; - echo '  '; - echo '  '; - echo ''; - - if (isset($properties['profile_id_status'])) - { - self::$_PROFILE_ID_STATUS = $properties['profile_id_status']; - SurveyStatusProfiles :: setCurentProfileId(self::$_PROFILE_ID_STATUS); - } - - if (isset($properties['profile_id_variable'])) - { - self::$_PROFILE_ID_VARIABLE = $properties['profile_id_variable']; - - SurveyVariablesProfiles::setCurrentProfileId(self::$_PROFILE_ID_VARIABLE); - } - if (isset($properties['profile_id_condition'])) - { - self::$_PROFILE_ID_CONDITION = $properties['profile_id_condition']; - - SurveyConditionProfiles::setCurrentProfileId(self::$_PROFILE_ID_CONDITION); - } - - - self::$printPreview = true; - self::$_VARS[VAR_DATA] = 1; - self::$_VARS[VAR_EDIT] = 0; - self::$_VARS[VAR_PRINT] = 0; - self::$_VARS[VAR_MONITORING] = 0; - if (isset(self::$_SVP_PV['invitation'])) { - unset(self::$_SVP_PV['invitation']); - } - - - # ponastavimo nastavitve- filter - self::setUpFilter(); - self::DisplayDataTable(); - - // JS ki vedno doda labele - ?>'; - - echo ''; - - echo ''; - echo ''; - } - - function displayDataPrintPreview() { - global $lang; - global $site_url; - - header('Cache-Control: no-cache'); - header('Pragma: no-cache'); - $anketa = $_REQUEST['anketa']; - if ($anketa > 0) { - $sql = sisplet_query("SELECT lang_admin FROM srv_anketa WHERE id = '$anketa'"); - $row = mysqli_fetch_assoc($sql); - $lang_admin = $row['lang_admin']; - } else { - $sql = sisplet_query("SELECT value FROM misc WHERE what = 'SurveyLang_admin'"); - $row = mysqli_fetch_assoc($sql); - $lang_admin = $row['value']; - } - - #izpišemo HTML - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - - echo ''; - echo ''; - #echo '
    '; - echo '
    '; - //Izvoz v PDF / RTF / XLS - $_url1 = $site_url.'admin/survey/izvoz.php?dc='.base64_encode( - serialize( - array( 'b'=>'export', - 'a'=>'list_pdf', - 'anketa'=>$anketa))); - $_url2 = $site_url.'admin/survey/izvoz.php?dc='.base64_encode( - serialize( - array( 'b'=>'export', - 'a'=>'list_rtf', - 'anketa'=>$anketa))); - $_url3 = $site_url.'admin/survey/izvoz.php?dc='.base64_encode( - serialize( - array( 'b'=>'export', - 'a'=>'list_xls', - 'anketa'=>$anketa))); - echo '
    '; - echo '  '; - echo '  '; - echo ''; - - echo '
    '; - echo $lang['srv_data_print_preview']; - echo '
    '; - - self::$printPreview = true; - self::$_VARS[VAR_DATA] = 1; - self::$_VARS[VAR_SPR_LIMIT] = 5; - self::$_VARS[VAR_META] = 0; - self::$_VARS[VAR_EMAIL] = 0; - self::$_VARS[VAR_RELEVANCE] = 0; - self::$_VARS[VAR_EDIT] = 0; - self::$_VARS[VAR_PRINT] = 0; - self::$_VARS[VAR_MONITORING] = 0; - if (isset(self::$_SVP_PV['invitation'])) { - unset(self::$_SVP_PV['invitation']); - } - - - # ponastavimo nastavitve- filter - self::setUpFilter(); - self::DisplayDataTable(); - echo '
    '; - - echo ''; - - echo ''; - echo ''; - } - - static function displayVnosIcons() { - global $lang; - - // gumbi na levi (delete, edit, izvozi...) - echo '
    '; - - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - - // omogocimo/onemogocimo popravljanje vnosa - if(isset($_GET['quick_view']) && $_GET['quick_view'] == 0){ - echo ''; - echo ''; - } - else{ - echo ''; - echo ''; - } - echo '
    '; - } - - static function displayStatusLegend (){ - - if (self::$dataFileStatus >= 0) { - #status - če smo v meta ali imamo profil vse enote - if ( (self::$_VARS[VAR_META] && self::$_VARS[VAR_METAFULL]) - || ( SurveyStatusProfiles::getCurentProfileId() == 1 )) { - SurveyAnalysisHelper::getInstance()->displayStatusLegend(); - } - } - } - static function displayTestLegend (){ - - if (self::$dataFileStatus >= 0) { - #testni vnosi - samo ce imamo testne - if (self::$_HAS_TEST_DATA) { - SurveyAnalysisHelper::getInstance()->displayTestLegend(); - } - } - } - static function displayMetaStatusLegend (){ - - if (self::$dataFileStatus >= 0) { - SurveyAnalysisHelper::getInstance()->displayMissingLegend(); - } - } - - static function DisplaySnLinks() { - global $lang, $site_url; - - echo '
    '; - - // Gumb za preklop na EGO - echo ''; - echo ''.$lang['srv_lnk_ego'].''; - echo ''; - - // Gumb za preklop na ALTER - echo ''; - echo ''.$lang['srv_lnk_alter'].''; - echo ''; - - echo '
    '; - } - - static function setSnDisplayFullTableCheckbox() { - - session_start(); - - $_SESSION['sid_'.self::$sid]['snCreateFullTable'] = (int)$_POST['fullTable'] == 1; - - session_commit(); - } - - static function getLineNumberCellOffset($line) { - - $offset = 0; - - if (self::$lineoffset > 0 ) { - for ($i = 0; $i < self::$lineoffset; $i++) { - $offset = strpos($line,'',$offset+1); - } - } - - return $offset; - } - - static function showMultiple () { - - $sql = sisplet_query("SELECT * FROM srv_grid_multiple WHERE ank_id = ".self::$sid." GROUP BY parent"); - if ( mysqli_num_rows($sql) == 1 ) - return true; - - return false; - } -} -?> \ No newline at end of file diff --git a/admin/survey/classes/surveyData/old/class.SurveySNDataFile.php b/admin/survey/classes/surveyData/old/class.SurveySNDataFile.php deleted file mode 100644 index 8ea53be05..000000000 --- a/admin/survey/classes/surveyData/old/class.SurveySNDataFile.php +++ /dev/null @@ -1,610 +0,0 @@ -surveyId = $sid; - $this->folder = $site_path . EXPORT_FOLDER.'/'; - - #inicializiramo class za datoteke - $this->SDF = SurveyDataFile::get_instance(); - $this->SDF->init($sid); - $this->headFileName = $this->SDF->getHeaderFileName(); - $this->dataFileName = $this->SDF->getDataFileName(); - $this->dataFileStatus = $this->SDF->getStatus(); - - session_start(); - - $this->snCreateFullTable = $_SESSION['sid_'.$sid]['snCreateFullTable']; - if ( $this->dataFileStatus == FILE_STATUS_NO_DATA - || $this->dataFileStatus == FILE_STATUS_SRV_DELETED) { - Common::noDataAlert(); - return false; - } - } - - public function setVars($_VARS) { - $this->_VARS = $_VARS; - } - public function setParameter($parameter,$value) { - $this->{$parameter} = $value; - } - /** Preštejemo loope - * - */ - function countLoops() { - if ($this->dataFileStatus >= 0 && $this->headFileName != '') { - $this -> _HEADERS = unserialize(file_get_contents($this->headFileName)) ; - # poiščemo skevence za vse variable loopa - #$_headers = $this -> _HEADERS; - $_headers = $this->getCleanHeader(); - - #preštejemo koliko loopov imamo - $this->sn_loop_parents = array(); - $this->sn_loop_spremenljivke = array(); - - if (count($_headers) > 0) { - foreach ($_headers as $spr => $spremenljivka) { - if ($spremenljivka['loop_parent'] > 0) { - $this->sn_loop_data[$spremenljivka['loop_parent']]['antonucci'] = $spremenljivka['antonucci']; - $this->sn_loop_data[$spremenljivka['loop_parent']]['spr'] = $spr; - $this->sn_loop_data[$spremenljivka['loop_parent']]['variable'] = $spremenljivka['variable']; - $this->sn_loop_data[$spremenljivka['loop_parent']]['naslov'] = $spremenljivka['naslov']; - } - # spremenljivka je parent za loop, preštejemo variable - if (count($spremenljivka['grids']) > 0) { - foreach($spremenljivka['grids'] AS $gid => $grid) { - if (count($grid['variables']) > 0) { - foreach($grid['variables'] AS $vid => $variable) { - # če smo v loop parent - if ($spremenljivka['loop_parent'] > 0) { - $this->sn_loop_parents[$spremenljivka['loop_parent']][$variable['sequence']] = $variable['sequence']; - - } - # če smo v loop spremenljivki - if ($spremenljivka['parent_loop_id'] > 0) { - $this->sn_loop_spremenljivke[$spremenljivka['parent_loop_id']][$spremenljivka['loop_id']][$variable['sequence']] = $variable['sequence']; - } - } - } - } - } - } - } - } - } - - /** Skreira datoteko z alterji iz obstoječe datoteke s podatki - * - */ - function createSNDataFile($lpid, $sn_loop_parent,$_SN_head_file_name,$_sn_filename) { - if ($this->dataFileStatus >= 0 && $this->headFileName != '') { - # če kreiramo nove, pobrišemo morebitne obstoječe datoteke - $this->deleteOldSnFiles(); - - - #popucamo headers - $_headers = $this->getCleanHeader(); - - $sn_loop_spremenljivke = $this->sn_loop_spremenljivke; - - # resetiramo array za SN_HEADER - $_empty_name_filter = array(); - $SN_HEADER = array(); - - $sequences = array(); # kam shranimo sequence - $loop_header_cnt = 0; - - if (count($sn_loop_parent) > 0 ) { - foreach ($sn_loop_parent as $lsid => $loop_sequence) { - $loop_header_cnt ++; - $_new_sequence = 1; - - # poiščemo variable loopa - if (isset($sn_loop_spremenljivke[$lpid]) && count($sn_loop_spremenljivke[$lpid]) > 0) { - $_loop_cnt = array_shift($sn_loop_spremenljivke[$lpid]); - } else { - $_loop_cnt = array(); - } - - $sequences[$lpid.'_'.$lsid] = array(); - - # Zloopamo skozi vse spremenljivke in dodamo v primerno skupino - if (count($_headers) > 0) { - foreach ($_headers as $spr => $spremenljivka) { - - if ($loop_header_cnt === 1 ) { - $tmp_spremenljivka = $spremenljivka; - } - # odvisno ali smo v loopu ali ne dodamo primerne spremnljivke - if ((int)$spremenljivka['loop_parent'] > 0 || (int)$spremenljivka['parent_loop_id']) { - # ali smo v parent spremenljivki ali v loop spremenljivkah - if ((int)$spremenljivka['loop_parent'] > 0 && $lpid == (int)$spremenljivka['loop_parent']){ - - $_first_parent_variable = 0; - - #smo v parent splemenljivki, dodamo samo variablo z primerno sekvenco - if (count($spremenljivka['grids']) > 0) { - foreach($spremenljivka['grids'] AS $gid => $grid) { - if (count($grid['variables']) > 0) { - foreach($grid['variables'] AS $vid => $variable) { - - if ($variable['sequence'] == $loop_sequence) { - #$sequences[$lpid.'_'.$lsid][$spr] = $variable['sequence']; - $sequences[$lpid.'_'.$lsid][] = $variable['sequence']; - # v sn imenih imamo samo 1 variablo - if ($loop_header_cnt === 1 && $_first_parent_variable === 0) { - $_empty_name_filter[] = '($'.$_new_sequence .' != -1 && $'.$_new_sequence .' != -2 && $'.$_new_sequence .' != -3 && $'.$_new_sequence .' != -4 && $'.$_new_sequence .' != -5)'; - $tmp_spremenljivka['grids'][$gid]['variables'][$vid]['sequence'] = $_new_sequence; - $tmp_spremenljivka['sequences'] = $_new_sequence; - $tmp_spremenljivka['cnt_grids'] = 1; - $tmp_spremenljivka['cnt_all'] = 1; - $tmp_spremenljivka['grids']['0']['cnt_vars'] = 1; - - $_new_sequence++; - $_first_parent_variable ++; - - } - } - # odstranimo ostale variable - if ( $gid == 0 && $vid > 0) { - unset($tmp_spremenljivka['grids'][$gid]['variables'][$vid]); - } else if ( $gid > 0) { - unset($tmp_spremenljivka['grids'][$gid]); - } - - } - } - } - - } - - # dodamo spremenljivko v nov header - if ($loop_header_cnt === 1) { - $SN_HEADER[$spr] = $tmp_spremenljivka; - } - } - # ali smo v spremenljivki v loopu - if ((int)$spremenljivka['parent_loop_id'] > 0) { - $add_this_spr = false; - $sequenceses = array(); - # smo v loop spremenljivkah, dodamo variable s pravo frekvenco - if (count($spremenljivka['grids']) > 0) { - foreach($spremenljivka['grids'] AS $gid => $grid) { - if (count($grid['variables']) > 0) { - foreach($grid['variables'] AS $vid => $variable) { - if (isset($_loop_cnt[$variable['sequence']])) { - $add_this_spr = true; - #$sequences[$lpid.'_'.$lsid][$spr] = $variable['sequence']; - $sequences[$lpid.'_'.$lsid][] = $variable['sequence']; - if ($loop_header_cnt === 1) { - $tmp_spremenljivka['grids'][$gid]['variables'][$vid]['sequence'] = $_new_sequence; - $sequenceses[] = $_new_sequence; - $_new_sequence++; - } - } - } - } - } - } - - # dodamo spremenljivko v nov header - if ($loop_header_cnt === 1 && $add_this_spr == true) { - $SN_HEADER[$spr] = $tmp_spremenljivka; - $SN_HEADER[$spr]['sequences'] = implode('_',$sequenceses); - } - } - } else { - if (true) { - - # nismo v loopu - $sequenceses = array(); - if (count($spremenljivka['grids']) > 0) { - foreach($spremenljivka['grids'] AS $gid => $grid) { - if (count($grid['variables']) > 0) { - foreach($grid['variables'] AS $vid => $variable) { - #$sequences[$lpid.'_'.$lsid][$spr] = $variable['sequence']; - $sequences[$lpid.'_'.$lsid][] = $variable['sequence']; - if ($loop_header_cnt === 1) { - $tmp_spremenljivka['grids'][$gid]['variables'][$vid]['sequence'] = $_new_sequence; - $sequenceses[] = $_new_sequence; - $_new_sequence++; - } - - } - } - } - } - - # dodamo spremenljivko v nov header - if ($loop_header_cnt === 1) { - $SN_HEADER[$spr] = $tmp_spremenljivka; - $SN_HEADER[$spr]['sequences'] = implode('_',$sequenceses); - } - } - } - } - } - } - } - # zapišemo header za SN datoteko - if (is_array($SN_HEADER) && count($SN_HEADER) > 0) { - #zapišemo SN header datoteko - file_put_contents($_SN_head_file_name, serialize($SN_HEADER)); - - } - # KREACIJA DATA DATOTEKE - # skreiramo fajle z potrebnimi skevencami - if (count($sequences) > 0) { - $_original_data_file = $this->dataFileName; - $_paste_files = ''; - foreach ($sequences AS $skey => $sequence) { - - if (is_array($sequence) && count($sequence)>0) { - $_sequence = implode(",",$sequence); - - if (IS_WINDOWS) { - $cmdLn1 = 'cut -d "|" -f '.$_sequence.' '.$_original_data_file.' > '.$this->folder.'export_sn_data_'.$this->surveyId.'_'.$lpid.'_'.$skey.'.dat'; - } else { - $cmdLn1 = 'cut -d \'|\' -f '.$_sequence.' '.$_original_data_file.' > '.$this->folder.'export_sn_data_'.$this->surveyId.'_'.$lpid.'_'.$skey.'.dat'; - } - $out1 = shell_exec($cmdLn1); - $_paste_files .= $this->folder.'export_sn_data_'.$this->surveyId.'_'.$lpid.'_'.$skey.'.dat '; - } - } - # združimo datoteke v eno - $_orig_date = explode("_",$_original_data_file); - $_orig_date = explode(".",$_orig_date[3]); - - #$_merged_file_name = $this->folder.'export_sn_data_'.$this->surveyId.'_'.$_orig_date[0].'.dat'; - $_merged_file_name = $_sn_filename; - $tmp_merged_file_name = $this->folder.'tmp_export_sn_data_'.$this->surveyId.'_'.$lpid.'_'.$_orig_date[0].'.dat'; - if (IS_WINDOWS) { - $cmdLn2 = 'paste -d "\n" '.$_paste_files .'> '.$tmp_merged_file_name; - } else { - $cmdLn2 = 'paste -d \'\n\' '.$_paste_files. '>' .$tmp_merged_file_name; - } - $out2 = shell_exec($cmdLn2); - - # pripravimo filtre, za data datoteko, da odstranimo zapise ki nimajo imen ( če je nekdo dodal samo 2 imena nekdo pa 5) - $_empty_name_filter = implode(' && ',$_empty_name_filter); - - # sfiltriramo zapise ki nimajo imen - if (IS_WINDOWS) { - $cmdLn3 = 'awk -F"'.STR_DLMT.'" "BEGIN {OFS=\"\x7C\"} '.$_empty_name_filter.' { print $0 }" ' . $tmp_merged_file_name .' > ' . $_merged_file_name; - } else { - $cmdLn3 = 'awk -F"'.STR_DLMT.'" \'BEGIN {OFS="\x7C"} '.$_empty_name_filter.' { print $0 }\' ' . $tmp_merged_file_name . ' > ' . $_merged_file_name; - } - $out3 = shell_exec($cmdLn3); - - # pobrišemo odvečne datoteke - foreach (explode(" ",$_paste_files) as $filename_to_delete) { - if (trim($filename_to_delete) != '') { - $this->SDF->deleteFile($filename_to_delete); - } - } - if (trim($tmp_merged_file_name) != '') { - $this->SDF->deleteFile($tmp_merged_file_name); - } - } - } - } - - function displayFullTableCheckbox() { - global $lang; - session_start(); - echo ''; - } - - - function outputSNDataFile() { - global $lang; - $this->countLoops(); - - # forsamo novo kreiranje! malo slaba rešitev - mogoče dodat enako kontrolao na zadnjega userja v SN fajlih - $this->deleteOldSnFiles(); - - $_original_head_file = $this->headFileName; - $_original_data_file = $this->dataFileName; - - # timestam head datoteke - $_orig_date_h = explode("_",$_original_head_file); - $_orig_date_h = explode(".",$_orig_date_h[3]); - # združimo datoteke v eno - $_orig_date_d = explode("_",$_original_data_file); - $_orig_date_d = explode(".",$_orig_date_d[3]); - - - $this-> displayFullTableCheckbox(); - - # Tukaj začnemo loopat po glavnih loopih in nardimo ločene tabele za vsak loop - - # zloopamo tolikokrat koliko imamo variabel za loop ( v loop_parent) - if (count($this->sn_loop_parents) > 0) { - foreach ($this->sn_loop_parents as $lpid => $sn_loop_parent) { - - # head ime datoteke za loop - $_SN_head_file_name = $this->folder.'export_sn_header_'.$this->surveyId.'_'.$lpid.'_'.$_orig_date_h[0].'.dat'; - # data ime datoteke za loop - $_sn_filename = $this->folder.'export_sn_data_'.$this->surveyId.'_'.$lpid.'_'.$_orig_date_d[0].'.dat'; - # začasno ime datoteke za loop - $_sn_tmp1 = $this->folder.'tmp_1_export_sn_data_'.$this->surveyId.'_'.$lpid.'_'.$_orig_date_d[0].'.dat'; - # če SN header in SN data datoteka obstaja - if (!file_exists($_SN_head_file_name) || !file_exists($_sn_filename)) { - $this->createSNDataFile($lpid, $sn_loop_parent,$_SN_head_file_name,$_sn_filename); - } - - # če SN header in SN data datoteka obstaja - if (file_exists($_SN_head_file_name) && file_exists($_sn_filename)) { - - # naložimo header - $SN_HEADER = unserialize(file_get_contents($_SN_head_file_name)); - echo '
    '; - echo '

    '.$lang['srv_loop_for_variable'].' ['. $this->sn_loop_data[$lpid]['variable']. '] - '. $this->sn_loop_data[$lpid]['naslov']. ' ('.$lang['srv_loop_antonucci_circle'].' '.$this->sn_loop_data[$lpid]['antonucci'].')

    '; - echo ''; - echo ''; - echo ''; - - # dodamo skrit stolpec uid - echo ''; - - $spr_cont = 0; - foreach ($SN_HEADER AS $spid => $spremenljivka) { - # if (isset(self::$_SVP_PV[$spid]) ) { - ## paginacija spremenljivk - # if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) { - if ($spr_cont > 0 && $spid != 'uid') { - echo ''; - #} - } - $spr_cont++; - #} - } #end foreach $SN_HEADER AS $spid => $spremenljivka - # nova vrstica - echo ''; - - # dodamo skrit stolpec uid - echo ''; - - $spr_cont = 0; - foreach ($SN_HEADER AS $spid => $spremenljivka) { - if ($spr_cont > 0 && $spid != 'uid') { - # if (isset(self::$_SVP_PV[$spid]) && (count($spremenljivka['grids']) > 0 )) { - ## paginacija spremenljivk - # if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) { - if (count($spremenljivka['grids']) > 0) { - foreach ($spremenljivka['grids'] AS $gid => $grid) { - echo ''; - } - } - #} - } - $spr_cont++; - #} - } - - # nova vrstica - echo ''; - - ## dodamo skrit stolpec uid - echo ''; - - $spr_cont = 0; - foreach ($SN_HEADER AS $spid => $spremenljivka) { - if ($spr_cont > 0 && $spid != 'uid') { - # if (isset(self::$_SVP_PV[$spid]) && count($spremenljivka['grids']) > 0) { - ## paginacija spremenljivk - # if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) { - if (count($spremenljivka['grids']) > 0){ - foreach ($spremenljivka['grids'] AS $gid => $grid) { - if (count ($grid['variables']) > 0) { - foreach ($grid['variables'] AS $vid => $variable ){ - echo ''; - } - } - } # end foreach - } #end if - # } - } - $spr_cont++; - #} - } - echo''; - echo ''; - echo ''; - - # dodamo podatke - if (file_exists($_sn_filename)) { - - // zamenjamo | z '; - $file_handler = fopen ($_sn_tmp1, 'r'); - while ($line= fgets ($file_handler)) { - echo ''; - echo ''; - } - echo ''; - echo ''; - echo '
    '; - if ($file_handler) { - fclose($file_handler); - } - - # pobrišemo tmp falj - if (trim($_sn_tmp1) != '') { - $this->SDF->deleteFile($_sn_tmp1); - } - } - } - - } - } - - } - /** Pobriše morebitne stare SN daoteke - * - */ - function deleteOldSnFiles() { - if ($this->surveyId > 0) { - - # odstranimo morebitne SN datoteke - header - $files = glob($this->folder.'export_sn_header_'.$this->surveyId.'_*.dat'); - if(count($files ) > 0) { - foreach ($files AS $file) { - unlink($file); - } - } - # odstranimo morebitne SN datoteke - data - $files = glob($this->folder.'export_sn_data_'.$this->surveyId.'_*.dat'); - if(count($files ) > 0) { - foreach ($files AS $file) { - unlink($file); - } - } - - } - } - - /* Tukaj pripravimo redosled in prikaz glavnih spremenljivk - * - */ - function getCleanHeader() { - # poiščemo skevence za vse variable loopa - $header = $this -> _HEADERS; - $cleanHeader = array(); - if (count($header) > 0) { - foreach ($header AS $spr_id => $spremenljivka) { - - if ($this->_VARS[VAR_DATA] == '1') { - $add_data = true; - } else { - $add_data = false; - } - - # preverimo ali delamo kompleksno tabelo al samo simpl - if ($this->snCreateFullTable == false) { - $add_data = $add_data && ((int)$spremenljivka['loop_parent'] > 0 || (int)$spremenljivka['parent_loop_id'] > 0); - } - if ( $spremenljivka['tip'] == 'm' || $spremenljivka['tip'] == 'sm') { - $add_data = false; - switch ($spremenljivka['variable']) { - case 'uid': - case 'recnum': - $add_data = true; - break; - case 'code': - # ce prikazujemo sistemske ne prikazujemo recnumber - if (!$this->_VARS[VAR_SHOW_SYSTEM] && $this->_VARS[VAR_META] && $this->_VARS[VAR_METAFULL]) { - $add_data = true; - } - break; - case 'status': - case 'lurker': - if ($this->_VARS[VAR_META] && $this->_VARS[VAR_METAFULL]) { - $add_data = true; - } - break; - case 'relevance': - if ($this->_VARS[VAR_RELEVANCE] && $this->canDisplayRelevance) { - $add_data = true; - } - break; - case 'invitation': - if ($this->_VARS[VAR_EMAIL]) { - $add_data = true; - } - break; - case 'testdata': - $header = $this->SDF->getHeader(); - if (isset($header['testdata'])) { - $add_data = true; - } - break; - case 'smeta': - case 'meta': - if ($this->_VARS[VAR_METAFULL]) { - $add_data = true; - } - break; - case 'itime': - if ($this->showItime == true) { - $add_data = true; - } - break; - } - } - if ($spremenljivka['hide_system'] == '1') { - $add_data = false; - } - if ($add_data == true ) { - $cleanHeader[$spr_id] = $spremenljivka; - } - } - } - return $cleanHeader; - } -} -?> \ No newline at end of file diff --git a/admin/survey/classes/surveyData/old/class.SurveyTrackIncremental.php b/admin/survey/classes/surveyData/old/class.SurveyTrackIncremental.php deleted file mode 100644 index efeaed9a9..000000000 --- a/admin/survey/classes/surveyData/old/class.SurveyTrackIncremental.php +++ /dev/null @@ -1,13 +0,0 @@ - 0) { - # pokličemo inkrementalno dodajanje za anketo - $CID = new CollectIncrementalData($anketa); -} - -print_r($_POST); -print_r($_GET); - -ob_flush(); \ No newline at end of file diff --git a/admin/survey/classes/surveyData/old/getCollectTimer.php b/admin/survey/classes/surveyData/old/getCollectTimer.php deleted file mode 100644 index e416dad8a..000000000 --- a/admin/survey/classes/surveyData/old/getCollectTimer.php +++ /dev/null @@ -1,110 +0,0 @@ -'Inicializacija...', - 2=>'Obdelujem datoteke s strukturo...', - 3=>'Obdelujem datoteke s podatki...', - 9=>'Končano...', - -1=>'Napaka...', - ); - */ - session_start(); - #time - $return['t'] = ($_SESSION['PMD']['start_time'] != null && (strtotime("now") - $_SESSION['PMD']['start_time']) > 0 ) - ? date('i:s', (strtotime("now") - $_SESSION['PMD']['start_time'])) - : '00:00' ; - #id - $return['id'] = $_SESSION['PMD']['actID']; - # skupni procenti - $return['pa'] = ($_SESSION['PMD']['all'] == 0) - ? number_format(100, 0, '', '') - : number_format((($_SESSION['PMD']['current'] / $_SESSION['PMD']['all']) * 100), 0, '', ''); - # procenti headerja - if ($_SESSION['PMD']['actID'] == 2) { - $return['ph'] = ($_SESSION['PMD']['allHead'] == 0 || $_SESSION['PMD']['current'] >= $_SESSION['PMD']['allHead']) - ? number_format(100, 0, '', '') - : number_format((($_SESSION['PMD']['current'] / $_SESSION['PMD']['allHead']) * 100), 0, '', ''); - # trenutni zapis - $return['nr'] = $_SESSION['PMD']['nrRow']; - $return['cr'] = $_SESSION['PMD']['current'] .'/'. $_SESSION['PMD']['allHead']; - } - if ($_SESSION['PMD']['actID'] == 3) { - $curent_data = $_SESSION['PMD']['current']-$_SESSION['PMD']['allHead'] < 0 ? 0 : $_SESSION['PMD']['current']-$_SESSION['PMD']['allHead']; - # procenti data - $return['pd'] = ($_SESSION['PMD']['all'] == 0) - ? number_format(100, 0, '', '') - : number_format((($_SESSION['PMD']['all'] > 0) ? ( $curent_data / $_SESSION['PMD']['all']) * 100 : 100), 0, '', ''); - $return['cd'] = $curent_data .' / ' .$_SESSION['PMD']['all']; - } - # procent trenutnega zapisa - if ($_SESSION['PMD']['actID'] == 3) { - # prikazuejemo samo za status 3 - $return['pr'] = number_format($_SESSION['PMD']['percentRow'], 0, '', ''); # procent trenutnega zapisa - $return['nr'] = $_SESSION['PMD']['nrRow']; # trenutni zapis - - } - echo json_encode($return); - - } else { # star način za podatke - - define('EXPORT_FOLDER', 'tmp', true); - - include($_SERVER['DOCUMENT_ROOT'].'/function.php'); - include_once $_SERVER['DOCUMENT_ROOT'].'/admin/survey/definition.php'; - - $folder = $site_path . EXPORT_FOLDER.'/'; - - $anketa = $_POST['anketa']; - - $_qry_all = sisplet_query('SELECT count(*) FROM srv_user AS u WHERE u.ank_id = \''.$anketa.'\''); - $_allCount = mysqli_fetch_row($_qry_all); - $allCount = $_allCount[0]; - - $str_qry_users = 'SELECT IF(UNIX_TIMESTAMP(MAX(time_edit)) = 0,UNIX_TIMESTAMP(MAX(time_insert)),UNIX_TIMESTAMP(MAX(time_edit))) AS DATE FROM srv_user WHERE ank_id = \''.$anketa.'\''; - $qry_users = sisplet_query($str_qry_users) or die(mysqli_error($GLOBALS['connect_db'])); - if (mysqli_num_rows($qry_users)) { - $row_users = mysqli_fetch_row($qry_users); - $timestamp = $row_users[0]; - } - $_dataFileName = $folder.'export_data_'.$anketa.'_'.$timestamp.'.dat'; - - #preberemo št vrstic v fajlu - $recCount = exec('wc -l '.$_dataFileName)+1; - echo '

    Obdelujemo zapis '.(int)$recCount.' od '.(int)$allCount.'!

    '; - } -} -?> \ No newline at end of file diff --git a/admin/survey/classes/surveyData/old/getIncrementalTimer.php b/admin/survey/classes/surveyData/old/getIncrementalTimer.php deleted file mode 100644 index af4b98065..000000000 --- a/admin/survey/classes/surveyData/old/getIncrementalTimer.php +++ /dev/null @@ -1,19 +0,0 @@ - \ No newline at end of file diff --git a/admin/survey/classes/surveyData/old/prepareDataIncremental.php b/admin/survey/classes/surveyData/old/prepareDataIncremental.php deleted file mode 100644 index 57ae4185d..000000000 --- a/admin/survey/classes/surveyData/old/prepareDataIncremental.php +++ /dev/null @@ -1,101 +0,0 @@ - 0) { - - session_start(); - - // nastavimo jezik - $lang_admin = (isset($_REQUEST['lang_admin'])) ? $_REQUEST['lang_admin'] : 1; - $file = $site_path.'/lang/'.$lang_admin.'.php'; - include($file); - - unset($_SESSION['incrementalProgressBar'][$anketa]); - list($usec, $sec) = explode(" ", microtime()); - # če - if ($_SESSION['incrementalProgressBar'][$anketa]['status'] != 1 - # ali smo začeli pred 30 min ali več, potem dovolimo ponoven start - # || ($_SESSION['incrementalProgressBar'][$anketa]['status'] == 1 - # && isset($_SESSION['incrementalProgressBar'][$anketa]['started']) - # && ($sec - (int)$_SESSION['incrementalProgressBar'][$anketa]['started']) > 1800 - # ) - - ){ - SurveyTrackIncremental::write($anketa,'Progress bar -> Ajax started for survey: '.$anketa); - # pobrišemo staro sejo - unset($_SESSION['incrementalProgressBar'][$anketa]); - - # nastavimo čas kdaj smo startali - $_SESSION['incrementalProgressBar'][$anketa]['started'] = $sec; - # nastavimo status da smo štartali - $_SESSION['incrementalProgressBar'][$anketa]['status'] = 1; - $_SESSION['incrementalProgressBar'][$anketa]['current'] = 0; - session_commit(); - - // Get the start time in microseconds, as a float value - $starttime = microtime(true); - - $lock = new ExclusiveLock( "survey_lock_".$anketa, FALSE); - if( $lock->lock( ) == FALSE ) { - SurveyTrackIncremental::write($anketa,'LOCK: alreadyLocked for survey: '.$anketa); - #error("Locking failed"); - } else { - - # pozenemo generiranje datoteke - $CID = new CollectIncrementalData($anketa); - $CH = (int)$CID->createHeadFile(); - // Get the difference between start and end in microseconds, as a float value - $diff = microtime(true) - $starttime; - - // Break the difference into seconds and microseconds - $sec = intval($diff); - $micro = $diff - $sec; - - // Format the result as you want it - // $final will contain something like "00:00:02.452" - $final = strftime('%T', mktime(0, 0, $sec)) . str_replace('0.', '.', sprintf('%.3f', $micro)); - echo '
    1:'.$final; - $CD = (int)$CID->createDataFile(); - - } - $lock->unlock(); - // Get the difference between start and end in microseconds, as a float value - $diff = microtime(true) - $starttime; - // Break the difference into seconds and microseconds - $sec = intval($diff); - $micro = $diff - $sec; - - // Format the result as you want it - // $final will contain something like "00:00:02.452" - $final = strftime('%T', mktime(0, 0, $sec)) . str_replace('0.', '.', sprintf('%.3f', $micro)); - echo '
    2:'.$final; - } else { - SurveyTrackIncremental::write($anketa,'Progress bar -> Ajax skiped for survey: '.$anketa); - } - } - - } else if ($_GET['action'] == 'clear') { - if ($anketa > 0) { - session_start(); - unset($_SESSION['incrementalProgressBar'][$anketa]); - session_commit(); - } - } - - ob_flush(); - -?> \ No newline at end of file diff --git a/admin/survey/export/latexclasses/class.LatexSurveyElement.php b/admin/survey/export/latexclasses/class.LatexSurveyElement.php index 6a25c2e21..03ca4bbb8 100644 --- a/admin/survey/export/latexclasses/class.LatexSurveyElement.php +++ b/admin/survey/export/latexclasses/class.LatexSurveyElement.php @@ -600,6 +600,11 @@ class LatexSurveyElement{ } if( ($export_format=='pdf'&&$fillablePdf==0)||$export_format=='rtf'){//ce je navaden pdf ali rtf dokument (brez moznosti izbire ali vnosa v polja) + + if($data){ + $data = $this->encodeText($data); + } + if($tip==1||$tip==6){ //radio ali multigrid z radio if($data){ //ce je odgovor respondenta if($enota!=11&&$enota!=12){ //ce ni VAS ali slikovni tip @@ -738,7 +743,8 @@ class LatexSurveyElement{ if($export_format == 'pdf'){ if($data!=''){ $TextBoxWithText = ' \\textcolor{crta}{\footnotesize{'.$data.'}} '; - $emptyTextBox = $TextBoxWithText; + //$TextBoxWithText = ' \\textcolor{crta}{\footnotesize{'.$this->encodeText($data).'}} '; + $emptyTextBox = $TextBoxWithText; }else{ if($this->export_subtype == 'q_empty' || $this->export_subtype == 'q_comments'){ $emptyTextBox = ' \fbox{\parbox{'.$textboxWidth.'\textwidth}{ \hphantom{\hspace{'.$textboxWidth.'\textwidth}} }} '; @@ -910,6 +916,7 @@ class LatexSurveyElement{ //if($numOfUl!=0){ if($numOfUl!=0 && $posLi !== false){ //ce imamo ul in li $text = str_replace('
      ','\begin{itemize} ', $text); + $text = str_replace('','\item ', $text); $text = str_replace('
    ','\end{itemize} \ ', $text); } @@ -1556,6 +1563,7 @@ class LatexSurveyElement{ if($spremenljivke['tip']==24){ //ce je kombinirana tabela //echo "stevilo stolpcev za izpis kombinirane podan: ".$numColSql."
    "; + //print_r($data); //if($presirokaKombo == 1 && count($data) != 0 && ($enota == 2 || $enota == 6)){ if($presirokaKombo == 1 && count($data) != 0 && (($enota == 2 || $enota == 6) || $export_data_type == 2 && $vodoravniOdgovoriTip[0] == 6)){ $numColSql = 1 + 1; @@ -1755,7 +1763,7 @@ class LatexSurveyElement{ if($export_data_type==0 || $export_data_type==1 || ($export_data_type==2 && $vodoravniOdgovoriTip[$j-1] != 6)){ //ce je razsirjen izvoz ALI je skrcen izvoz IN ni klasicna tabela $tex .= "& ".$this->getAnswerSymbol($export_format, $fillablePdf, $vodoravniOdgovoriTip[$j-1], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]); - $test = "& ".$this->getAnswerSymbol($export_format, $fillablePdf, $vodoravniOdgovoriTip[$j-1], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]); + //$test = "& ".$this->getAnswerSymbol($export_format, $fillablePdf, $vodoravniOdgovoriTip[$j-1], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]); //echo "testna koda $test z enoto $enota
    "; //echo "tip exp: ".$export_data_type."
    "; //echo $vodoravniOdgovoriTip[$j-1]."
    "; diff --git a/admin/survey/script/vprasanje.js b/admin/survey/script/vprasanje.js index 62699571d..33def94b1 100644 --- a/admin/survey/script/vprasanje.js +++ b/admin/survey/script/vprasanje.js @@ -1605,7 +1605,10 @@ function textSubtypeToggle (what, value){ $('select[name=upload]').prop('disabled', false); $('input[name=signature]').prop('disabled', false); $('input[name=captcha]').prop('disabled', false); - $('input[name=emailVerify]').prop('disabled', false); + $('input[name=emailVerify]').prop('disabled', false); + + $('.kategorije_odgovorov').show(); + $('.upload_info').hide(); } // Disable else{ @@ -1616,7 +1619,13 @@ function textSubtypeToggle (what, value){ if(what != 'captcha') $('input[name=captcha]').prop('disabled', true); if(what != 'emailVerify') - $('input[name=emailVerify]').prop('disabled', true); + $('input[name=emailVerify]').prop('disabled', true); + + if(what == 'upload' || what == 'signature' || what == 'captcha') + $('.kategorije_odgovorov').hide(); + + if(what == 'upload') + $('.upload_info').show(); } } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 12251f820..000000000 --- a/composer.lock +++ /dev/null @@ -1,2318 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "hash": "f48f2e76d23925213a1c248388654ed4", - "content-hash": "4faadcc7d5b72636e2d9ac9a18b062a2", - "packages": [ - { - "name": "composer/ca-bundle", - "version": "1.2.8", - "source": { - "type": "git", - "url": "https://github.com/composer/ca-bundle.git", - "reference": "8a7ecad675253e4654ea05505233285377405215" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8a7ecad675253e4654ea05505233285377405215", - "reference": "8a7ecad675253e4654ea05505233285377405215", - "shasum": "" - }, - "require": { - "ext-openssl": "*", - "ext-pcre": "*", - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8", - "psr/log": "^1.0", - "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\CaBundle\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", - "keywords": [ - "cabundle", - "cacert", - "certificate", - "ssl", - "tls" - ], - "time": "2020-08-23 12:54:47" - }, - { - "name": "fgrosse/phpasn1", - "version": "v2.1.1", - "source": { - "type": "git", - "url": "https://github.com/fgrosse/PHPASN1.git", - "reference": "7ebf2a09084a7bbdb7b879c66fdf7ad80461bbe8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fgrosse/PHPASN1/zipball/7ebf2a09084a7bbdb7b879c66fdf7ad80461bbe8", - "reference": "7ebf2a09084a7bbdb7b879c66fdf7ad80461bbe8", - "shasum": "" - }, - "require": { - "php": ">=7.0.0" - }, - "require-dev": { - "phpunit/phpunit": "~6.3", - "satooshi/php-coveralls": "~2.0" - }, - "suggest": { - "ext-gmp": "GMP is the preferred extension for big integer calculations", - "php-curl": "For loading OID information from the web if they have not bee defined statically" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "FG\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Friedrich Große", - "email": "friedrich.grosse@gmail.com", - "homepage": "https://github.com/FGrosse", - "role": "Author" - }, - { - "name": "All contributors", - "homepage": "https://github.com/FGrosse/PHPASN1/contributors" - } - ], - "description": "A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.", - "homepage": "https://github.com/FGrosse/PHPASN1", - "keywords": [ - "DER", - "asn.1", - "asn1", - "ber", - "binary", - "decoding", - "encoding", - "x.509", - "x.690", - "x509", - "x690" - ], - "time": "2018-12-02 01:34:34" - }, - { - "name": "geoip2/geoip2", - "version": "v2.10.0", - "source": { - "type": "git", - "url": "https://github.com/maxmind/GeoIP2-php.git", - "reference": "419557cd21d9fe039721a83490701a58c8ce784a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/419557cd21d9fe039721a83490701a58c8ce784a", - "reference": "419557cd21d9fe039721a83490701a58c8ce784a", - "shasum": "" - }, - "require": { - "ext-json": "*", - "maxmind-db/reader": "~1.5", - "maxmind/web-service-common": "~0.6", - "php": ">=5.6" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "2.*", - "phpunit/phpunit": "5.*", - "squizlabs/php_codesniffer": "3.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "GeoIp2\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Gregory J. Oschwald", - "email": "goschwald@maxmind.com", - "homepage": "https://www.maxmind.com/" - } - ], - "description": "MaxMind GeoIP2 PHP API", - "homepage": "https://github.com/maxmind/GeoIP2-php", - "keywords": [ - "IP", - "geoip", - "geoip2", - "geolocation", - "maxmind" - ], - "time": "2019-12-12 18:48:39" - }, - { - "name": "guzzlehttp/guzzle", - "version": "6.5.5", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", - "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", - "shasum": "" - }, - "require": { - "ext-json": "*", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.6.1", - "php": ">=5.5", - "symfony/polyfill-intl-idn": "^1.17.0" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.1" - }, - "suggest": { - "psr/log": "Required for using the Log middleware" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.5-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "time": "2020-06-16 21:01:06" - }, - { - "name": "guzzlehttp/promises", - "version": "v1.3.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "shasum": "" - }, - "require": { - "php": ">=5.5.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "time": "2016-12-20 10:07:11" - }, - { - "name": "guzzlehttp/psr7", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" - }, - "suggest": { - "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Schultze", - "homepage": "https://github.com/Tobion" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "psr-7", - "request", - "response", - "stream", - "uri", - "url" - ], - "time": "2019-07-01 23:21:34" - }, - { - "name": "maxmind-db/reader", - "version": "v1.7.0", - "source": { - "type": "git", - "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git", - "reference": "942553da239f12051275f9c666538b5dd09e2908" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/942553da239f12051275f9c666538b5dd09e2908", - "reference": "942553da239f12051275f9c666538b5dd09e2908", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "conflict": { - "ext-maxminddb": "<1.7.0,>=2.0.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "2.*", - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpcov": ">=6.0.0", - "phpunit/phpunit": ">=8.0.0,<10.0.0", - "squizlabs/php_codesniffer": "3.*" - }, - "suggest": { - "ext-bcmath": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder", - "ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder", - "ext-maxminddb": "A C-based database decoder that provides significantly faster lookups" - }, - "type": "library", - "autoload": { - "psr-4": { - "MaxMind\\Db\\": "src/MaxMind/Db" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Gregory J. Oschwald", - "email": "goschwald@maxmind.com", - "homepage": "https://www.maxmind.com/" - } - ], - "description": "MaxMind DB Reader API", - "homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php", - "keywords": [ - "database", - "geoip", - "geoip2", - "geolocation", - "maxmind" - ], - "time": "2020-08-07 22:10:05" - }, - { - "name": "maxmind/web-service-common", - "version": "v0.7.0", - "source": { - "type": "git", - "url": "https://github.com/maxmind/web-service-common-php.git", - "reference": "74c996c218ada5c639c8c2f076756e059f5552fc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/74c996c218ada5c639c8c2f076756e059f5552fc", - "reference": "74c996c218ada5c639c8c2f076756e059f5552fc", - "shasum": "" - }, - "require": { - "composer/ca-bundle": "^1.0.3", - "ext-curl": "*", - "ext-json": "*", - "php": ">=5.6" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "2.*", - "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0", - "squizlabs/php_codesniffer": "3.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "MaxMind\\Exception\\": "src/Exception", - "MaxMind\\WebService\\": "src/WebService" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Gregory Oschwald", - "email": "goschwald@maxmind.com" - } - ], - "description": "Internal MaxMind Web Service API", - "homepage": "https://github.com/maxmind/web-service-common-php", - "time": "2020-05-06 14:07:26" - }, - { - "name": "minishlink/web-push", - "version": "v5.2.5", - "source": { - "type": "git", - "url": "https://github.com/web-push-libs/web-push-php.git", - "reference": "0e75af425126435794ed42d7aa92119fd563e503" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/web-push-libs/web-push-php/zipball/0e75af425126435794ed42d7aa92119fd563e503", - "reference": "0e75af425126435794ed42d7aa92119fd563e503", - "shasum": "" - }, - "require": { - "ext-gmp": "*", - "ext-json": "*", - "guzzlehttp/guzzle": "^6.2", - "lib-openssl": "*", - "php": "^7.1", - "web-token/jwt-key-mgmt": "^1.0", - "web-token/jwt-signature": "^1.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.14", - "phpstan/phpstan": "0.11.2", - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Minishlink\\WebPush\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Louis Lagrange", - "email": "lagrange.louis@gmail.com", - "homepage": "https://github.com/Minishlink" - } - ], - "description": "Web Push library for PHP", - "homepage": "https://github.com/web-push-libs/web-push-php", - "keywords": [ - "Push API", - "WebPush", - "notifications", - "push", - "web" - ], - "time": "2020-08-02 08:58:01" - }, - { - "name": "paragonie/random_compat", - "version": "v9.99.99", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "shasum": "" - }, - "require": { - "php": "^7" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" - ], - "time": "2018-07-02 15:55:56" - }, - { - "name": "paragonie/sodium_compat", - "version": "v1.13.0", - "source": { - "type": "git", - "url": "https://github.com/paragonie/sodium_compat.git", - "reference": "bbade402cbe84c69b718120911506a3aa2bae653" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/bbade402cbe84c69b718120911506a3aa2bae653", - "reference": "bbade402cbe84c69b718120911506a3aa2bae653", - "shasum": "" - }, - "require": { - "paragonie/random_compat": ">=1", - "php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7|^8" - }, - "require-dev": { - "phpunit/phpunit": "^3|^4|^5|^6|^7" - }, - "suggest": { - "ext-libsodium": "PHP < 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security.", - "ext-sodium": "PHP >= 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security." - }, - "type": "library", - "autoload": { - "files": [ - "autoload.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com" - }, - { - "name": "Frank Denis", - "email": "jedisct1@pureftpd.org" - } - ], - "description": "Pure PHP implementation of libsodium; uses the PHP extension if it exists", - "keywords": [ - "Authentication", - "BLAKE2b", - "ChaCha20", - "ChaCha20-Poly1305", - "Chapoly", - "Curve25519", - "Ed25519", - "EdDSA", - "Edwards-curve Digital Signature Algorithm", - "Elliptic Curve Diffie-Hellman", - "Poly1305", - "Pure-PHP cryptography", - "RFC 7748", - "RFC 8032", - "Salpoly", - "Salsa20", - "X25519", - "XChaCha20-Poly1305", - "XSalsa20-Poly1305", - "Xchacha20", - "Xsalsa20", - "aead", - "cryptography", - "ecdh", - "elliptic curve", - "elliptic curve cryptography", - "encryption", - "libsodium", - "php", - "public-key cryptography", - "secret-key cryptography", - "side-channel resistant" - ], - "time": "2020-03-20 21:48:09" - }, - { - "name": "phpmailer/phpmailer", - "version": "v6.1.7", - "source": { - "type": "git", - "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0", - "reference": "2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "ext-filter": "*", - "php": ">=5.5.0" - }, - "require-dev": { - "doctrine/annotations": "^1.2", - "friendsofphp/php-cs-fixer": "^2.2", - "phpunit/phpunit": "^4.8 || ^5.7" - }, - "suggest": { - "ext-mbstring": "Needed to send email in multibyte encoding charset", - "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", - "league/oauth2-google": "Needed for Google XOAUTH2 authentication", - "psr/log": "For optional PSR-3 debug logging", - "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", - "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" - }, - "type": "library", - "autoload": { - "psr-4": { - "PHPMailer\\PHPMailer\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1-only" - ], - "authors": [ - { - "name": "Marcus Bointon", - "email": "phpmailer@synchromedia.co.uk" - }, - { - "name": "Jim Jagielski", - "email": "jimjag@gmail.com" - }, - { - "name": "Andy Prevost", - "email": "codeworxtech@users.sourceforge.net" - }, - { - "name": "Brent R. Matzelle" - } - ], - "description": "PHPMailer is a full-featured email creation and transfer class for PHP", - "time": "2020-07-14 18:50:27" - }, - { - "name": "psr/http-message", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "time": "2016-08-06 14:39:51" - }, - { - "name": "ralouphie/getallheaders", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "120b605dfeb996808c31b6477290a714d356e822" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", - "reference": "120b605dfeb996808c31b6477290a714d356e822", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^5 || ^6.5" - }, - "type": "library", - "autoload": { - "files": [ - "src/getallheaders.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" - } - ], - "description": "A polyfill for getallheaders.", - "time": "2019-03-08 08:55:37" - }, - { - "name": "sonata-project/google-authenticator", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/sonata-project/GoogleAuthenticator.git", - "reference": "feda53899b26af24e3db2fe7a3e5f053ca483762" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sonata-project/GoogleAuthenticator/zipball/feda53899b26af24e3db2fe7a3e5f053ca483762", - "reference": "feda53899b26af24e3db2fe7a3e5f053ca483762", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "symfony/phpunit-bridge": "^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Google\\Authenticator\\": "src/", - "Sonata\\GoogleAuthenticator\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Christian Stocker", - "email": "me@chregu.tv" - }, - { - "name": "Andre DeMarre", - "homepage": "http://www.devnetwork.net/viewtopic.php?f=50&t=94989" - }, - { - "name": "Thomas Rabaix", - "email": "thomas.rabaix@gmail.com" - } - ], - "description": "Library to integrate Google Authenticator into a PHP project", - "homepage": "https://github.com/sonata-project/GoogleAuthenticator", - "keywords": [ - "google authenticator" - ], - "time": "2018-07-18 22:08:02" - }, - { - "name": "spomky-labs/base64url", - "version": "v2.0.2", - "source": { - "type": "git", - "url": "https://github.com/Spomky-Labs/base64url.git", - "reference": "69e77e7d7c5407a253dacdd7bfe6b8978b7a4fb2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Spomky-Labs/base64url/zipball/69e77e7d7c5407a253dacdd7bfe6b8978b7a4fb2", - "reference": "69e77e7d7c5407a253dacdd7bfe6b8978b7a4fb2", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.0", - "phpstan/phpstan": "^0.11", - "phpstan/phpstan-beberlei-assert": "^0.11.0", - "phpstan/phpstan-deprecation-rules": "^0.11", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-strict-rules": "^0.11", - "phpunit/phpunit": "^7.0|^8.0|^9.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Base64Url\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky-Labs/base64url/contributors" - } - ], - "description": "Base 64 URL Safe Encoding/Decoding PHP Library", - "homepage": "https://github.com/Spomky-Labs/base64url", - "keywords": [ - "base64", - "rfc4648", - "safe", - "url" - ], - "time": "2020-08-01 14:15:43" - }, - { - "name": "stripe/stripe-php", - "version": "v7.49.0", - "source": { - "type": "git", - "url": "https://github.com/stripe/stripe-php.git", - "reference": "db6229bff448f7f3bf7f6aee112d5d9ba34ca4ba" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/stripe/stripe-php/zipball/db6229bff448f7f3bf7f6aee112d5d9ba34ca4ba", - "reference": "db6229bff448f7f3bf7f6aee112d5d9ba34ca4ba", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "php": ">=5.6.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "2.16.1", - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^5.7", - "squizlabs/php_codesniffer": "^3.3", - "symfony/process": "~3.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-4": { - "Stripe\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Stripe and contributors", - "homepage": "https://github.com/stripe/stripe-php/contributors" - } - ], - "description": "Stripe PHP Library", - "homepage": "https://stripe.com/", - "keywords": [ - "api", - "payment processing", - "stripe" - ], - "time": "2020-08-19 22:48:20" - }, - { - "name": "symfony/polyfill-intl-idn", - "version": "v1.18.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "5dcab1bc7146cf8c1beaa4502a3d9be344334251" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/5dcab1bc7146cf8c1beaa4502a3d9be344334251", - "reference": "5dcab1bc7146cf8c1beaa4502a3d9be344334251", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "symfony/polyfill-intl-normalizer": "^1.10", - "symfony/polyfill-php70": "^1.10", - "symfony/polyfill-php72": "^1.10" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Idn\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Laurent Bassin", - "email": "laurent@bassin.info" - }, - { - "name": "Trevor Rowbotham", - "email": "trevor.rowbotham@pm.me" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "idn", - "intl", - "polyfill", - "portable", - "shim" - ], - "time": "2020-08-04 06:02:08" - }, - { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.18.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e", - "reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's Normalizer class and related functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "intl", - "normalizer", - "polyfill", - "portable", - "shim" - ], - "time": "2020-07-14 12:35:20" - }, - { - "name": "symfony/polyfill-php70", - "version": "v1.18.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "0dd93f2c578bdc9c72697eaa5f1dd25644e618d3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0dd93f2c578bdc9c72697eaa5f1dd25644e618d3", - "reference": "0dd93f2c578bdc9c72697eaa5f1dd25644e618d3", - "shasum": "" - }, - "require": { - "paragonie/random_compat": "~1.0|~2.0|~9.99", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php70\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2020-07-14 12:35:20" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.18.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "639447d008615574653fb3bc60d1986d7172eaae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/639447d008615574653fb3bc60d1986d7172eaae", - "reference": "639447d008615574653fb3bc60d1986d7172eaae", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2020-07-14 12:35:20" - }, - { - "name": "web-token/jwt-core", - "version": "v1.3.10", - "source": { - "type": "git", - "url": "https://github.com/web-token/jwt-core.git", - "reference": "30e9df9e040d933043b16237f9dba7a3be746566" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/web-token/jwt-core/zipball/30e9df9e040d933043b16237f9dba7a3be746566", - "reference": "30e9df9e040d933043b16237f9dba7a3be746566", - "shasum": "" - }, - "require": { - "ext-gmp": "*", - "ext-mbstring": "*", - "fgrosse/phpasn1": "^2.0", - "php": "^7.1", - "spomky-labs/base64url": "^1.0|^2.0", - "web-token/jwt-util-ecc": "^1.3" - }, - "conflict": { - "spomky-labs/jose": "*" - }, - "require-dev": { - "phpunit/phpunit": "^6.0|^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jose\\Component\\Core\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky" - }, - { - "name": "All contributors", - "homepage": "https://github.com/web-token/jwt-core/contributors" - } - ], - "description": "Core component of the JWT Framework.", - "homepage": "https://github.com/web-token", - "keywords": [ - "JOSE", - "JWE", - "JWK", - "JWKSet", - "JWS", - "Jot", - "RFC7515", - "RFC7516", - "RFC7517", - "RFC7518", - "RFC7519", - "RFC7520", - "bundle", - "jwa", - "jwt", - "symfony" - ], - "time": "2020-03-20 13:29:04" - }, - { - "name": "web-token/jwt-key-mgmt", - "version": "v1.3.10", - "source": { - "type": "git", - "url": "https://github.com/web-token/jwt-key-mgmt.git", - "reference": "65b1e908e50b0e5be6b28135085d3c1097b81801" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/web-token/jwt-key-mgmt/zipball/65b1e908e50b0e5be6b28135085d3c1097b81801", - "reference": "65b1e908e50b0e5be6b28135085d3c1097b81801", - "shasum": "" - }, - "require": { - "lib-openssl": "*", - "paragonie/sodium_compat": "^1.2", - "web-token/jwt-core": "^1.3", - "web-token/jwt-util-ecc": "^1.3" - }, - "require-dev": { - "php-http/httplug": "^1.1", - "php-http/message-factory": "^1.0", - "php-http/mock-client": "^1.0", - "phpunit/phpunit": "^6.0|^7.0" - }, - "suggest": { - "php-http/httplug": "To enable JKU/X5U support.", - "php-http/message-factory": "To enable JKU/X5U support." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jose\\Component\\KeyManagement\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky" - }, - { - "name": "All contributors", - "homepage": "https://github.com/web-token/jwt-key-mgmt/contributors" - } - ], - "description": "Key Management component of the JWT Framework.", - "homepage": "https://github.com/web-token", - "keywords": [ - "JOSE", - "JWE", - "JWK", - "JWKSet", - "JWS", - "Jot", - "RFC7515", - "RFC7516", - "RFC7517", - "RFC7518", - "RFC7519", - "RFC7520", - "bundle", - "jwa", - "jwt", - "symfony" - ], - "time": "2020-03-20 13:29:04" - }, - { - "name": "web-token/jwt-signature", - "version": "v1.3.10", - "source": { - "type": "git", - "url": "https://github.com/web-token/jwt-signature.git", - "reference": "00f23e997c9032536444f819bc3338ab475d69f9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/web-token/jwt-signature/zipball/00f23e997c9032536444f819bc3338ab475d69f9", - "reference": "00f23e997c9032536444f819bc3338ab475d69f9", - "shasum": "" - }, - "require": { - "web-token/jwt-core": "^1.3", - "web-token/jwt-signature-algorithm-ecdsa": "^1.3", - "web-token/jwt-signature-algorithm-eddsa": "^1.3", - "web-token/jwt-signature-algorithm-hmac": "^1.3", - "web-token/jwt-signature-algorithm-none": "^1.3", - "web-token/jwt-signature-algorithm-rsa": "^1.3" - }, - "require-dev": { - "phpunit/phpunit": "^6.0|^7.0" - }, - "suggest": { - "web-token/jwt-signature-algorithm-ecdsa": "ECDSA Based Signature Algorithms", - "web-token/jwt-signature-algorithm-eddsa": "EdDSA Based Signature Algorithms", - "web-token/jwt-signature-algorithm-experimental": "Experimental Signature Algorithms", - "web-token/jwt-signature-algorithm-hmac": "HMAC Based Signature Algorithms", - "web-token/jwt-signature-algorithm-none": "None Signature Algorithm", - "web-token/jwt-signature-algorithm-rsa": "RSA Based Signature Algorithms" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jose\\Component\\Signature\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky" - }, - { - "name": "All contributors", - "homepage": "https://github.com/web-token/jwt-signature/contributors" - } - ], - "description": "Signature component of the JWT Framework.", - "homepage": "https://github.com/web-token", - "keywords": [ - "JOSE", - "JWE", - "JWK", - "JWKSet", - "JWS", - "Jot", - "RFC7515", - "RFC7516", - "RFC7517", - "RFC7518", - "RFC7519", - "RFC7520", - "bundle", - "jwa", - "jwt", - "symfony" - ], - "time": "2020-03-20 13:29:04" - }, - { - "name": "web-token/jwt-signature-algorithm-ecdsa", - "version": "v1.3.10", - "source": { - "type": "git", - "url": "https://github.com/web-token/jwt-signature-algorithm-ecdsa.git", - "reference": "a3babd3b82c29c739d426271ccb9dc1a56222e36" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/web-token/jwt-signature-algorithm-ecdsa/zipball/a3babd3b82c29c739d426271ccb9dc1a56222e36", - "reference": "a3babd3b82c29c739d426271ccb9dc1a56222e36", - "shasum": "" - }, - "require": { - "web-token/jwt-signature": "^1.3" - }, - "require-dev": { - "phpunit/phpunit": "^6.0|^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jose\\Component\\Signature\\Algorithm\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky" - }, - { - "name": "All contributors", - "homepage": "https://github.com/web-token/jwt-core/contributors" - } - ], - "description": "ECDSA Based Signature Algorithms the JWT Framework.", - "homepage": "https://github.com/web-token", - "keywords": [ - "JOSE", - "JWE", - "JWK", - "JWKSet", - "JWS", - "Jot", - "RFC7515", - "RFC7516", - "RFC7517", - "RFC7518", - "RFC7519", - "RFC7520", - "bundle", - "jwa", - "jwt", - "symfony" - ], - "time": "2020-03-20 13:29:04" - }, - { - "name": "web-token/jwt-signature-algorithm-eddsa", - "version": "v1.3.10", - "source": { - "type": "git", - "url": "https://github.com/web-token/jwt-signature-algorithm-eddsa.git", - "reference": "b0dad134313b14b3ba077b63a7afcc2b38e5f793" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/web-token/jwt-signature-algorithm-eddsa/zipball/b0dad134313b14b3ba077b63a7afcc2b38e5f793", - "reference": "b0dad134313b14b3ba077b63a7afcc2b38e5f793", - "shasum": "" - }, - "require": { - "web-token/jwt-signature": "^1.3" - }, - "require-dev": { - "phpunit/phpunit": "^6.0|^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jose\\Component\\Signature\\Algorithm\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky" - }, - { - "name": "All contributors", - "homepage": "https://github.com/web-token/jwt-core/contributors" - } - ], - "description": "EdDSA Signature Algorithm the JWT Framework.", - "homepage": "https://github.com/web-token", - "keywords": [ - "JOSE", - "JWE", - "JWK", - "JWKSet", - "JWS", - "Jot", - "RFC7515", - "RFC7516", - "RFC7517", - "RFC7518", - "RFC7519", - "RFC7520", - "bundle", - "jwa", - "jwt", - "symfony" - ], - "time": "2020-03-20 13:29:04" - }, - { - "name": "web-token/jwt-signature-algorithm-hmac", - "version": "v1.3.10", - "source": { - "type": "git", - "url": "https://github.com/web-token/jwt-signature-algorithm-hmac.git", - "reference": "3bc85e1d13804902a8d81a11f58c28c9a471b5e2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/web-token/jwt-signature-algorithm-hmac/zipball/3bc85e1d13804902a8d81a11f58c28c9a471b5e2", - "reference": "3bc85e1d13804902a8d81a11f58c28c9a471b5e2", - "shasum": "" - }, - "require": { - "web-token/jwt-signature": "^1.3" - }, - "require-dev": { - "phpunit/phpunit": "^6.0|^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jose\\Component\\Signature\\Algorithm\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky" - }, - { - "name": "All contributors", - "homepage": "https://github.com/web-token/jwt-core/contributors" - } - ], - "description": "HMAC Based Signature Algorithms the JWT Framework.", - "homepage": "https://github.com/web-token", - "keywords": [ - "JOSE", - "JWE", - "JWK", - "JWKSet", - "JWS", - "Jot", - "RFC7515", - "RFC7516", - "RFC7517", - "RFC7518", - "RFC7519", - "RFC7520", - "bundle", - "jwa", - "jwt", - "symfony" - ], - "time": "2020-03-20 13:29:04" - }, - { - "name": "web-token/jwt-signature-algorithm-none", - "version": "v1.3.10", - "source": { - "type": "git", - "url": "https://github.com/web-token/jwt-signature-algorithm-none.git", - "reference": "0391e160367e85846736e63ea6026e2dab667b6e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/web-token/jwt-signature-algorithm-none/zipball/0391e160367e85846736e63ea6026e2dab667b6e", - "reference": "0391e160367e85846736e63ea6026e2dab667b6e", - "shasum": "" - }, - "require": { - "web-token/jwt-signature": "^1.3" - }, - "require-dev": { - "phpunit/phpunit": "^6.0|^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jose\\Component\\Signature\\Algorithm\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky" - }, - { - "name": "All contributors", - "homepage": "https://github.com/web-token/jwt-core/contributors" - } - ], - "description": "None Signature Algorithm the JWT Framework.", - "homepage": "https://github.com/web-token", - "keywords": [ - "JOSE", - "JWE", - "JWK", - "JWKSet", - "JWS", - "Jot", - "RFC7515", - "RFC7516", - "RFC7517", - "RFC7518", - "RFC7519", - "RFC7520", - "bundle", - "jwa", - "jwt", - "symfony" - ], - "time": "2020-03-20 13:29:04" - }, - { - "name": "web-token/jwt-signature-algorithm-rsa", - "version": "v1.3.10", - "source": { - "type": "git", - "url": "https://github.com/web-token/jwt-signature-algorithm-rsa.git", - "reference": "344181ef6cdd3aca77f7ff7defc9fb502eb33ec0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/web-token/jwt-signature-algorithm-rsa/zipball/344181ef6cdd3aca77f7ff7defc9fb502eb33ec0", - "reference": "344181ef6cdd3aca77f7ff7defc9fb502eb33ec0", - "shasum": "" - }, - "require": { - "web-token/jwt-signature": "^1.3" - }, - "require-dev": { - "phpunit/phpunit": "^6.0|^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jose\\Component\\Signature\\Algorithm\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky" - }, - { - "name": "All contributors", - "homepage": "https://github.com/web-token/jwt-core/contributors" - } - ], - "description": "RSA Based Signature Algorithms the JWT Framework.", - "homepage": "https://github.com/web-token", - "keywords": [ - "JOSE", - "JWE", - "JWK", - "JWKSet", - "JWS", - "Jot", - "RFC7515", - "RFC7516", - "RFC7517", - "RFC7518", - "RFC7519", - "RFC7520", - "bundle", - "jwa", - "jwt", - "symfony" - ], - "time": "2020-03-20 13:29:04" - }, - { - "name": "web-token/jwt-util-ecc", - "version": "v1.3.10", - "source": { - "type": "git", - "url": "https://github.com/web-token/jwt-util-ecc.git", - "reference": "2011af8454561ebce06a77fcd681c29a252e0068" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/web-token/jwt-util-ecc/zipball/2011af8454561ebce06a77fcd681c29a252e0068", - "reference": "2011af8454561ebce06a77fcd681c29a252e0068", - "shasum": "" - }, - "require": { - "ext-gmp": "*", - "ext-mbstring": "*", - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^6.0|^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jose\\Component\\Core\\Util\\Ecc\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky" - }, - { - "name": "All contributors", - "homepage": "https://github.com/web-token/jwt-core/contributors" - } - ], - "description": "ECC Tools for the JWT Framework.", - "homepage": "https://github.com/web-token", - "keywords": [ - "JOSE", - "JWE", - "JWK", - "JWKSet", - "JWS", - "Jot", - "RFC7515", - "RFC7516", - "RFC7517", - "RFC7518", - "RFC7519", - "RFC7520", - "bundle", - "jwa", - "jwt", - "symfony" - ], - "time": "2020-03-20 13:29:04" - } - ], - "packages-dev": [ - { - "name": "filp/whoops", - "version": "2.7.3", - "source": { - "type": "git", - "url": "https://github.com/filp/whoops.git", - "reference": "5d5fe9bb3d656b514d455645b3addc5f7ba7714d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/5d5fe9bb3d656b514d455645b3addc5f7ba7714d", - "reference": "5d5fe9bb3d656b514d455645b3addc5f7ba7714d", - "shasum": "" - }, - "require": { - "php": "^5.5.9 || ^7.0", - "psr/log": "^1.0.1" - }, - "require-dev": { - "mockery/mockery": "^0.9 || ^1.0", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0", - "symfony/var-dumper": "^2.6 || ^3.0 || ^4.0 || ^5.0" - }, - "suggest": { - "symfony/var-dumper": "Pretty print complex values better with var-dumper available", - "whoops/soap": "Formats errors as SOAP responses" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-4": { - "Whoops\\": "src/Whoops/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Filipe Dobreira", - "homepage": "https://github.com/filp", - "role": "Developer" - } - ], - "description": "php error handling for cool kids", - "homepage": "https://filp.github.io/whoops/", - "keywords": [ - "error", - "exception", - "handling", - "library", - "throwable", - "whoops" - ], - "time": "2020-06-14 09:00:00" - }, - { - "name": "kint-php/kint", - "version": "1.1", - "source": { - "type": "git", - "url": "https://github.com/kint-php/kint.git", - "reference": "a8549198558560b24e2879c6bac2875de5371483" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/kint-php/kint/zipball/a8549198558560b24e2879c6bac2875de5371483", - "reference": "a8549198558560b24e2879c6bac2875de5371483", - "shasum": "" - }, - "require": { - "php": ">=5.1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "files": [ - "Kint.class.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Rokas Šleinius", - "homepage": "https://github.com/kint-php" - }, - { - "name": "Contributors", - "homepage": "https://github.com/kint-php/kint/contributors" - } - ], - "description": "Kint - debugging helper for PHP developers", - "homepage": "https://github.com/kint-php/kint", - "keywords": [ - "debug", - "kint", - "php" - ], - "time": "2017-01-15 14:23:43" - }, - { - "name": "maximebf/debugbar", - "version": "v1.16.3", - "source": { - "type": "git", - "url": "https://github.com/maximebf/php-debugbar.git", - "reference": "1a1605b8e9bacb34cc0c6278206d699772e1d372" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/1a1605b8e9bacb34cc0c6278206d699772e1d372", - "reference": "1a1605b8e9bacb34cc0c6278206d699772e1d372", - "shasum": "" - }, - "require": { - "php": "^7.1", - "psr/log": "^1.0", - "symfony/var-dumper": "^2.6|^3|^4|^5" - }, - "require-dev": { - "phpunit/phpunit": "^5" - }, - "suggest": { - "kriswallsmith/assetic": "The best way to manage assets", - "monolog/monolog": "Log using Monolog", - "predis/predis": "Redis storage" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.16-dev" - } - }, - "autoload": { - "psr-4": { - "DebugBar\\": "src/DebugBar/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Maxime Bouroumeau-Fuseau", - "email": "maxime.bouroumeau@gmail.com", - "homepage": "http://maximebf.com" - }, - { - "name": "Barry vd. Heuvel", - "email": "barryvdh@gmail.com" - } - ], - "description": "Debug bar in the browser for php application", - "homepage": "https://github.com/maximebf/php-debugbar", - "keywords": [ - "debug", - "debugbar" - ], - "time": "2020-05-06 07:06:27" - }, - { - "name": "psr/log", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2020-03-23 09:12:05" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.18.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a", - "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2020-07-14 12:35:20" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.18.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/d87d5766cbf48d72388a9f6b85f280c8ad51f981", - "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981", - "shasum": "" - }, - "require": { - "php": ">=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2020-07-14 12:35:20" - }, - { - "name": "symfony/var-dumper", - "version": "v4.4.11", - "source": { - "type": "git", - "url": "https://github.com/symfony/var-dumper.git", - "reference": "2125805a1a4e57f2340bc566c3013ca94d2722dc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/2125805a1a4e57f2340bc566c3013ca94d2722dc", - "reference": "2125805a1a4e57f2340bc566c3013ca94d2722dc", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php72": "~1.5", - "symfony/polyfill-php80": "^1.15" - }, - "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/console": "<3.4" - }, - "require-dev": { - "ext-iconv": "*", - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/process": "^4.4|^5.0", - "twig/twig": "^1.34|^2.4|^3.0" - }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, - "bin": [ - "Resources/bin/var-dump-server" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, - "autoload": { - "files": [ - "Resources/functions/dump.php" - ], - "psr-4": { - "Symfony\\Component\\VarDumper\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony mechanism for exploring and dumping PHP variables", - "homepage": "https://symfony.com", - "keywords": [ - "debug", - "dump" - ], - "time": "2020-06-24 13:34:53" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": "^5.5|^7.0" - }, - "platform-dev": [] -} diff --git a/frontend/payments/classes/class.UserAccess.php b/frontend/payments/classes/class.UserAccess.php index 9bfe82bd4..abbf4fec9 100644 --- a/frontend/payments/classes/class.UserAccess.php +++ b/frontend/payments/classes/class.UserAccess.php @@ -333,12 +333,15 @@ class UserAccess{ $package_required = (isset($this->functionality_package[$what])) ? $this->functionality_package[$what] : 3; $package_required_name = $this->packages[$package_required]['name']; - $drupal_url = ($lang['id'] == '2') ? $site_url.'d/en/' : $site_url.'d/'; + if($lang['id'] == '2') + $drupal_url = $site_url.'d/en/purchase/'.$package_required.'/package'; + else + $drupal_url = $site_url.'d/izvedi-nakup/'.$package_required.'/podatki'; echo '
    '; echo '

    '.$lang['srv_access_no_access'].' "'.$package_required_name.'".

    '; - echo ''; + echo ''; echo '
    '; } @@ -352,10 +355,13 @@ class UserAccess{ $package_required = (isset($this->functionality_package[$what])) ? $this->functionality_package[$what] : 3; $package_required_name = $this->packages[$package_required]['name']; - $drupal_url = ($lang['id'] == '2') ? $site_url.'d/en/' : $site_url.'d/'; + if($lang['id'] == '2') + $drupal_url = $site_url.'d/en/purchase/'.$package_required.'/package'; + else + $drupal_url = $site_url.'d/izvedi-nakup/'.$package_required.'/podatki'; echo '

    '.$lang['srv_access_no_access'].' "'.$package_required_name.'".

    '; - echo ''; + echo ''; echo ''; } diff --git a/frontend/payments/classes/class.UserNarocila.php b/frontend/payments/classes/class.UserNarocila.php index 23719fc87..1b939bae9 100644 --- a/frontend/payments/classes/class.UserNarocila.php +++ b/frontend/payments/classes/class.UserNarocila.php @@ -328,6 +328,7 @@ class UserNarocila{ echo ' '.$lang['srv_narocilo_ddv'].''; echo ' '.$lang['srv_narocilo_cena'].''; echo ' '.$lang['srv_narocilo_status'].''; + echo ' '.$lang['srv_narocilo_podjetje_eracun'].''; echo ' '.$lang['srv_narocilo_pdf'].''; echo ' '.$lang['edit2'].''; echo ' '; @@ -378,6 +379,8 @@ class UserNarocila{ echo ''; + // Eračun + echo ''.($data_row['podjetje_eracun'] == '1' ? $lang['yes'] : $lang['no']).''; echo ''; // Ce je bila cena 0 je bil avtomatsko "placan" in nima racuna oz. predracuna @@ -390,7 +393,7 @@ class UserNarocila{ echo ' | '.$lang['srv_narocilo_pdf_racun'].''; } } - echo ''; + echo ''; echo ''; echo ''; @@ -598,6 +601,14 @@ class UserNarocila{ echo ''; echo '
    '; + echo '
    '; + echo ''.$lang['srv_narocilo_podjetje_eracun'].': '; + echo ''; + echo '
    '; + echo '
    '; } @@ -642,6 +653,7 @@ class UserNarocila{ $podjetje_drzava = isset($narocilo_data['podjetje_drzava']) ? $narocilo_data['podjetje_drzava'] : ''; $podjetje_davcna = isset($narocilo_data['podjetje_davcna']) ? $narocilo_data['podjetje_davcna'] : ''; $podjetje_zavezanec = isset($narocilo_data['podjetje_ddv']) ? $narocilo_data['podjetje_ddv'] : ''; + $podjetje_eracun = isset($narocilo_data['podjetje_eracun']) ? $narocilo_data['podjetje_eracun'] : '0'; $language = isset($narocilo_data['lang']) ? $narocilo_data['lang'] : 'sl'; @@ -678,9 +690,9 @@ class UserNarocila{ } $sqlNarocilo = sisplet_query("INSERT INTO user_access_narocilo - (usr_id, status, time, package_id, ime, payment_method, discount, trajanje, phone, podjetje_ime, podjetje_naslov, podjetje_postna, podjetje_posta, podjetje_drzava, podjetje_davcna, podjetje_zavezanec, language) + (usr_id, status, time, package_id, ime, payment_method, discount, trajanje, phone, podjetje_ime, podjetje_naslov, podjetje_postna, podjetje_posta, podjetje_drzava, podjetje_davcna, podjetje_zavezanec, podjetje_eracun, language) VALUES - ('".$usr_id."', '".$status."', NOW(), '".$package_id."', '".$ime_na_racunu."', '".$payment_method."', '".$discount."', '".$trajanje."', '".$phone."', '".$podjetje_ime."', '".$podjetje_naslov."', '".$podjetje_postna."', '".$podjetje_posta."', '".$podjetje_drzava."', '".$podjetje_davcna."', '".$podjetje_zavezanec."', '".$language."') + ('".$usr_id."', '".$status."', NOW(), '".$package_id."', '".$ime_na_racunu."', '".$payment_method."', '".$discount."', '".$trajanje."', '".$phone."', '".$podjetje_ime."', '".$podjetje_naslov."', '".$podjetje_postna."', '".$podjetje_posta."', '".$podjetje_drzava."', '".$podjetje_davcna."', '".$podjetje_zavezanec."', '".$podjetje_eracun."', '".$language."') "); if (!$sqlNarocilo){ $response['error'] = 'ERROR! '.mysqli_error($GLOBALS['connect_db']); @@ -843,6 +855,7 @@ class UserNarocila{ $update .= isset($narocilo_data['podjetje_drzava']) ? ', podjetje_drzava='.$narocilo_data['podjetje_drzava'] : ''; $update .= isset($narocilo_data['podjetje_davcna']) ? ', podjetje_davcna='.$narocilo_data['podjetje_davcna'] : ''; $update .= isset($narocilo_data['podjetje_ddv']) ? ', podjetje_zavezanec='.$narocilo_data['podjetje_ddv'] : ''; + $update .= isset($narocilo_data['podjetje_eracun']) ? ', podjetje_eracun='.$narocilo_data['podjetje_eracun'] : ''; $update = substr($update, 1); @@ -1173,6 +1186,7 @@ class UserNarocila{ $update .= (isset($_POST['podjetje_drzava'])) ? " podjetje_drzava='".$_POST['podjetje_drzava']."'," : ""; $update .= (isset($_POST['podjetje_davcna'])) ? " podjetje_davcna='".$_POST['podjetje_davcna']."'," : ""; $update .= (isset($_POST['podjetje_zavezanec'])) ? " podjetje_zavezanec='".$_POST['podjetje_zavezanec']."'," : ""; + $update .= (isset($_POST['podjetje_eracun'])) ? " podjetje_eracun='".$_POST['podjetje_eracun']."'," : ""; if($update != ''){ diff --git a/lang/1.php b/lang/1.php index 6a791f55b..8f5348dba 100644 --- a/lang/1.php +++ b/lang/1.php @@ -2026,6 +2026,7 @@ $lang = array ( "srv_alert_show_missing_97" => "Prikaži opcijo \"Neustrezno\" ob opozorilu", "srv_alert_upload_size" => "Naložena datoteka je prevelika! Največja dovoljena velikost je 16 MB.", "srv_alert_upload_ext" => "Naložen tip datoteke ni dovoljen!", + "srv_alert_upload_remove" => "Odstrani datoteko", "srv_dostop" => "Anketo lahko ureja avtor in vsi", "srv_izpolnjujejo" => "Anketo lahko izpolnjujejo", "srv_dostop_users" => "Uporabniki, ki lahko urejajo anketo", @@ -6253,6 +6254,9 @@ $lang = array ( 'srv_vprasanje_upload_no' => 'Brez', 'srv_vprasanje_upload_yes' => 'Upload', 'srv_vprasanje_upload_fotografija' => 'Fotografiranje', + 'srv_vprasanje_upload_limit_title' => 'Omejitve uploada datoteke', + 'srv_vprasanje_upload_limit' => 'Omejitev velikosti datoteke je 16 MB', + 'srv_vprasanje_upload_limit_type' => 'Uporabnik lahko naloži datoteke tipa:
    "jpeg", "jpg", "png", "gif", "pdf", "doc", "docx", "xls", "xlsx"', 'srv_vprasanje_delete_line_map' => 'Izbriši linijo', 'srv_vprasanje_delete_point_map' => 'Izbriši', 'srv_vprasanje_delete_line_confirm_map' => 'Ste prepričani, da želite izbrisati to linijo?', @@ -6504,6 +6508,7 @@ $lang = array ( 'srv_export_hover_comments' => 'Dodaj komentarje', 'srv_data_settings_checkboxes' => 'Nastavitve prikaza podatkov', 'srv_data_settings_checkboxes2' => 'Zapri nastavitve prikaza podatkov', + 'srv_data_settings_identifier_notice' => 'Respondenti z identifikatorji so prikazani v naključnem vrstnem redu (ki je različen od vrstnega reda v prikazu podatkov).', 'srv_status_settings' => 'Nastavitve statusov', 'srv_spremenljivke_settings' => 'Nastavitve spremenljivk', 'srv_condition_settings' => 'Nastavitve pogojev', @@ -7395,6 +7400,7 @@ $lang = array ( 'srv_narocilo_podjetje_postna' => "Poštna št.", 'srv_narocilo_podjetje_drzava' => "Država", 'srv_narocilo_podjetje_zavezanec' => "Zavezanec za DDV", + 'srv_narocilo_podjetje_eracun' => "E-račun", 'srv_narocilo_placaj' => "Plačaj", 'srv_narocilo_status_0' => "Neplačano", diff --git a/lang/2.php b/lang/2.php index 54f846ba1..7ab1585d3 100644 --- a/lang/2.php +++ b/lang/2.php @@ -2013,6 +2013,7 @@ $lang = array ( "srv_alert_show_missing_97" => "Show option \"Invalid\" on alert", "srv_alert_upload_size" => "Uploaded file is too large! Maximum file size is 16 MB.", "srv_alert_upload_ext" => "Uploaded file type is not allowed!", + "srv_alert_upload_remove" => "Remove file", "srv_dostop" => "Survey can be edited by", "srv_izpolnjujejo" => "Survey can be answered by", "srv_dostop_users" => "Users who can edit survey", @@ -6135,7 +6136,10 @@ $lang = array ( "srv_vprasanje_upload_type" => "File upload type", 'srv_vprasanje_upload_no' => 'Without', 'srv_vprasanje_upload_yes' => 'Upload', - 'srv_vprasanje_upload_fotografija' => 'Take a picture', + 'srv_vprasanje_upload_fotografija' => 'Take a picture', + 'srv_vprasanje_upload_limit_title' => 'File upload limits', + 'srv_vprasanje_upload_limit' => 'Filesize limit is 16 MB', + 'srv_vprasanje_upload_limit_type' => 'Respondent can upload file types: "jpeg", "jpg", "png", "gif", "pdf", "doc", "docx", "xls", "xlsx"', 'srv_vprasanje_delete_line_map' => 'Delete line', 'srv_vprasanje_delete_point_map' => 'Delete', 'srv_vprasanje_delete_line_confirm_map' => 'Are you sure you want to delete this line?', @@ -6386,7 +6390,8 @@ $lang = array ( 'srv_export_hover_public2' => 'Public link to data', 'srv_export_hover_comments' => 'Add comments', 'srv_data_settings_checkboxes' => 'Data table settings', - 'srv_data_settings_checkboxes2' => 'Close data table settings', + 'srv_data_settings_checkboxes2' => 'Close data table settings', + 'srv_data_settings_identifier_notice' => 'Respondents with identifiers are displayed in a random order (which is different from the order in the data display).', 'srv_status_settings' => 'Status settings', 'srv_spremenljivke_settings' => 'Variable settings', 'srv_condition_settings' => 'Condition settings', @@ -7278,6 +7283,7 @@ $lang = array ( 'srv_narocilo_podjetje_postna' => "Postcode", 'srv_narocilo_podjetje_drzava' => "Country", 'srv_narocilo_podjetje_zavezanec' => "VAT", + 'srv_narocilo_podjetje_eracun' => "E-invoice", 'srv_narocilo_placaj' => "Pay", 'srv_narocilo_status_0' => "Unpaid", diff --git a/main/survey/app/Controllers/Vprasanja/TextController.php b/main/survey/app/Controllers/Vprasanja/TextController.php index ca4b26600..46bae6283 100644 --- a/main/survey/app/Controllers/Vprasanja/TextController.php +++ b/main/survey/app/Controllers/Vprasanja/TextController.php @@ -780,13 +780,22 @@ class TextController extends Controller type="file" id="spremenljivka_' . $spremenljivka . '_vrednost_' . $i . '" ' . (!$missing ? '' : ' disabled') . ' - onChange="checkUpload(this);" + class="pointer" + onChange="checkUpload(this, \''.$spremenljivka.'_vrednost_'.$i.'\');" >'; + + // Remove file button + echo ''; } //Fotografiranje elseif ($row['upload'] == 2) { - //$imginput = ' '; $inpname = 'vrednost_' . $spremenljivka . '_kos_' . $row1['id']; $inpid = 'spremenljivka_' . $spremenljivka . '_vrednost_' . $i; diff --git a/main/survey/js/script.js b/main/survey/js/script.js index 211ffce2d..1e9dfbda4 100644 --- a/main/survey/js/script.js +++ b/main/survey/js/script.js @@ -1896,7 +1896,7 @@ function gridRepeatHeader(repeat_every, spr_id){ // Preverimo upload file omejitve -function checkUpload(upload){ +function checkUpload(upload, id){ // Max file size (mb) let maxSize = 16; @@ -1908,6 +1908,8 @@ function checkUpload(upload){ if(fileSize > maxSize){ $(upload).val(null); alert(lang["srv_alert_upload_size"]); + + return; } @@ -1925,5 +1927,15 @@ function checkUpload(upload){ if(!extAllowed.includes(fileExt)){ $(upload).val(null); alert(lang["srv_alert_upload_ext"]); + + return; } + + + // Add/remove "remove file" button + $('#remove_file_' + id).show(); +} + +function removeUpload(id){ + $('#' + id).val(null); } diff --git a/public/css/main.css b/public/css/main.css index 399e5c1a5..57ccda6cf 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -5257,6 +5257,19 @@ input[type=radio]:checked + span.enka-checkbox-radio:before { content: ""; } +/* File upload */ +.remove_file { + margin: 10px 0 0 0; + width: 150px; + color: #1e88e5; + text-decoration: none; + cursor: pointer; +} +.remove_file:hover { + color: #ffa608; + text-decoration: none; +} + /******* CUSTOM IKONE ZA SLIKOVNI TIP **********/ input[type=radio] + span.enka-custom-radio { font-size: 20px; @@ -5483,29 +5496,6 @@ span.enka-custom-radio:before, color: #ffa608; } -div.qtip-content { - font-size: 9px; -} - -.qtip-wrapper, .qtip-contentWrapper { - border: 0 !important; -} - -.qtip-borderTop, .qtip-borderBottom { - display: none !important; -} - -.qtip-title { - color: #0C377A !important; - background-color: #D8DFEA !important; -} - -.qtip-content { - padding: 12px 9px !important; - background-color: #EFF2F7 !important; - border: 1px #D8DFEA solid; -} - #cookie_alert, #test_alert { display: none; position: fixed; diff --git a/resources/sass/main/main/input.scss b/resources/sass/main/main/input.scss index 340c199d5..4e7542e07 100644 --- a/resources/sass/main/main/input.scss +++ b/resources/sass/main/main/input.scss @@ -95,6 +95,21 @@ input[type="radio"]:checked + span.enka-checkbox-radio:before { } +/* File upload */ +.remove_file{ + margin: 10px 0 0 0; + width: 150px; + + color: #1e88e5; + text-decoration: none; + cursor: pointer; + + &:hover { + color: #ffa608; + text-decoration: none; + } +} + /******* CUSTOM IKONE ZA SLIKOVNI TIP **********/ input[type="radio"] + span.enka-custom-radio{ diff --git a/sql/update2.sql b/sql/update2.sql index ff8c8823e..dfd01e28e 100644 --- a/sql/update2.sql +++ b/sql/update2.sql @@ -9286,3 +9286,11 @@ UPDATE misc SET value='20.08.10' WHERE what="version"; ALTER TABLE user_access_placilo ADD COLUMN canceled ENUM('0', '1') NOT NULL DEFAULT '0'; UPDATE misc SET value='20.09.11' WHERE what="version"; + +ALTER TABLE user_access_narocilo ADD COLUMN podjetje_eracun ENUM('0', '1') NOT NULL DEFAULT '0' AFTER podjetje_zavezanec; + +UPDATE misc SET value='20.09.16' WHERE what="version"; + +INSERT INTO srv_help (help, what) VALUES ('Upload omejitev', 'srv_upload_limit'); + +UPDATE misc SET value='20.09.18' WHERE what="version";