false); // za shrambo parametrov in sporocil private $headFileName = null; # pot do head fajla private $dataFileName = null; # pot do data fajla private $dataFileStatus = null; # status data datoteke var $current_loop = 'undefined'; /** * @desc konstruktor */ function __construct ($anketa = null, $sprID = null, $loop = null){ global $site_path; global $global_user_id; global $output; // preverimo ali imamo stevilko ankete if ( is_numeric($anketa) ){ $this->anketa['id'] = $anketa; $this->spremenljivka = $sprID; SurveyAnalysis::Init($this->anketa['id']); SurveyAnalysis::$setUpJSAnaliza = false; // create new XLS document $this->xls = new xls(); // Poskrbimo za datoteko s podatki $SDF = SurveyDataFile::get_instance(); $SDF->init($this->anketa['id']); $SDF->prepareFiles(); $this->headFileName = $SDF->getHeaderFileName(); $this->dataFileName = $SDF->getDataFileName(); $this->dataFileStatus = $SDF->getStatus(); SurveyZankaProfiles :: Init($this->anketa['id'], $global_user_id); $this->current_loop = ($loop != null) ? $loop : $this->current_loop; } else{ $this->pi['msg'] = "Anketa ni izbrana!"; $this->pi['canCreate'] = false; return false; } if ( SurveyInfo::getInstance()->SurveyInit($this->anketa['id']) && $this->init()){ $this->anketa['uid'] = $global_user_id; SurveyUserSetting::getInstance()->Init($this->anketa['id'], $this->anketa['uid']); } else return false; // ce smo prisli do tu je vse ok $this->pi['canCreate'] = true; return true; } function getAnketa() { return $this->anketa['id']; } function checkCreate() { return $this->pi['canCreate']; } function getFile($fileName) { //Close and output rtf document // $this->rtf->Output($fileName, 'I'); $output = $this->createXls(); $this->xls->display($fileName, $output); } function init() { return true; } function createXls(){ global $site_path; global $lang; global $output; $convertTypes = array('charSet' => "windows-1250", 'delimit' => ";", 'newLine' => "\n", 'BOMchar' => "\xEF\xBB\xBF"); $output = $convertTypes['BOMchar']; $output .= '
'.$lang['export_analisys_sums'].'
'; # preberemo header if ($this->headFileName !== null) { // Preverimo ce imamo zanke (po skupinah) SurveyAnalysis::$_LOOPS = SurveyZankaProfiles::getFiltersForLoops(); # če nimamo zank if(count(SurveyAnalysis::$_LOOPS) == 0){ $this->displayTables(); } else{ // izrisemo samo eno tabelo iz enega loopa if($this->current_loop > 0){ $loop = SurveyAnalysis::$_LOOPS[(int)$this->current_loop-1]; $loop['cnt'] = $this->current_loop; SurveyAnalysis::$_CURRENT_LOOP = $loop; // Izpisemo naslov zanke za skupino $output .= '
'; $output .= '
'.$lang['srv_zanka_note'].$loop['text'].'
'; $this->displayTables(); } // Izrisemo vse tabele spremenljivka (iz vseh loopov) else{ $loop_cnt = 0; # če mamo zanke foreach(SurveyAnalysis::$_LOOPS AS $loop) { $loop_cnt++; $loop['cnt'] = $loop_cnt; SurveyAnalysis::$_CURRENT_LOOP = $loop; // Izpisemo naslov zanke za skupino $output .= '
'; $output .= '
'.$lang['srv_zanka_note'].$loop['text'].'
'; $this->displayTables(); } } } } // end if else ($_headFileName == null) return $output; } function displayTables(){ global $site_path; global $lang; global $global_user_id; global $output; SurveyAnalysis::$_HEADERS = unserialize(file_get_contents($this->headFileName)); # odstranimo sistemske variable tipa email, ime, priimek, geslo SurveyAnalysis::removeSystemVariables(); SurveyAnalysis::$missingProfileData = SurveyMissingProfiles::getProfile(SurveyAnalysis::$currentMissingProfile); # polovimo frekvence SurveyAnalysis::getFrequencys(); $vars_count = count(SurveyAnalysis::$_FILTRED_VARIABLES); $line_break = ''; foreach (SurveyAnalysis::$_HEADERS AS $spid => $spremenljivka) { # preverjamo ali je meta if (($spremenljivka['tip'] != 'm' && in_array($spremenljivka['tip'], SurveyAnalysis::$_FILTRED_TYPES )) && (!isset($_spid) || (isset($_spid) && $_spid == $spid)) && ($this->spremenljivka == $spid || $this->spremenljivka == null) ) { # ali imamo sfiltrirano spremenljivko if ($vars_count == 0 || ($vars_count > 0 && isset(SurveyAnalysis::$_FILTRED_VARIABLES[$spid]) ) ) { $output .= '
'; # prikazujemo v odvisnosti od kategorije spremenljivke switch ($spremenljivka['tip']) { case 1: # radio - prikjaže navpično self::sumVertical($spid,'sums'); break; case 2: #checkbox če je dihotomna: self::sumVerticalCheckbox($spid,'sums'); break; case 3: # dropdown - prikjaže navpično self::sumVertical($spid,'sums'); break; case 6: if ($spremenljivka['enota'] != 3) { # multigrid self::sumHorizontal($spid,'sums'); } else { #imamo dvojni mgrid self::sumDoubleHorizontal($spid,'sums*'); } break; case 16: #multicheckbox če je dihotomna: self::sumMultiHorizontalCheckbox($spid,'sums'); break; case 17: #razvrščanje če je ordinalna self::sumHorizontal($spid,'sums'); break; case 4: # text case 8: # datum # varabla tipa »besedilo« je v sumarniku IDENTIČNA kot v FREKVENCAH. self::sumTextVertical($spid,'sums'); break; case 21: # besedilo* # varabla tipa »besedilo« je v sumarniku IDENTIČNA kot v FREKVENCAH. if ($spremenljivka['cnt_all'] == 1) { // če je enodimenzionalna prikažemo kot frekvence // predvsem zaradi vprašanj tipa: language, email... self::sumTextVertical($spid,'sums'); } else { self::sumMultiText($spid,'sums'); } break; case 19: # multitext self::sumMultiText($spid,'sums'); break; case 7: case 18: # variabla tipa »število« je v sumarniku identična kot v DESCRIPTIVES. self::sumNumberVertical($spid,'sums'); break; case 20: # Če je v gridu le ene variabla naj bo default prikazan f* in ne SUMA if ($spremenljivka['grids'][0]['cnt_vars'] == 1) { # variabla tipa »število« je v sumarniku identična kot v DESCRIPTIVES. self::sumMultiNumberVertical($spid,'sums'); } else { # variabla tipa »število« je v sumarniku identična kot v DESCRIPTIVES. self::sumMultiNumber($spid,'sums'); } break; case 22: # kalkulacija self::sumNumberVertical($spid,'sums'); break; case 5: # nagovor //self::sumNagovor($spid,'sums'); break; case 26: //lokacija self::sumLokacija($spid,'sums'); break; } } } // end if $spremenljivka['tip'] != 'm' #ob_flush(); flush(); } // end foreach self::$_HEADERS } /** Izriše sumarnik v vertikalni obliki * * @param unknown_type $spid */ function sumVertical($spid,$_from) { global $lang; global $output; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; # dodamo opcijo kje izrisujemo legendo $inline_legenda = false; $options=array('inline_legenda' => $inline_legenda, 'isTextAnswer' => false, 'isOtherAnswer' => false, 'num_show_records' => $num_show_records); # tekst vprašanja $output .= ''; # naslovna vrstica $output .= ''; #variabla $output .= ''; #odgovori $show_valid_percent = (SurveyAnalysis::$_HEADERS[$spid]['show_valid_percent'] == true) ? 1 : 0; $output .= ''; $output .= ''; $output .= ''; #variabla $output .= ''; #odgovori $output .= ''; $output .= ''; $output .= ''; if (SurveyAnalysis::$_HEADERS[$spid]['show_valid_percent'] == true) { $output .= ''; } $output .= ''; $output .= ''; // konec naslovne vrstice $_answersOther = array(); $sum_xi_fi=0; $N = 0; $_tmp_for_div = array(); # izpišemo vlejavne odgovore if (count($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] AS $gid => $grid) { # dodamo dodatne vrstice z albelami grida if (count($grid['variables']) > 0 ) foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki if ($variable['text'] != true && $variable['other'] != true) { $maxAnswer = (SurveyDataSettingProfiles :: getSetting('numOpenAnswers') > 0) ? SurveyDataSettingProfiles :: getSetting('numOpenAnswers') : 30; $counter = 0; $_kumulativa = 0; //SurveyAnalysis::$_FREQUENCYS[$_sequence] if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'])> 0 ) { foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'] AS $vkey => $vAnswer) { // za povprečje $xi = $vkey; $fi = $vAnswer['cnt']; $sum_xi_fi += $xi * $fi ; $N += $fi; //if ($counter < $maxAnswer) { if ($vAnswer['cnt'] > 0 || true) { # izpisujemo samo tiste ki nisno 0 $counter = self::outputValidAnswerVertical($counter,$vkey,$vAnswer,$_sequence,$spid,$_kumulativa,$options); } //} # za poznejše računannje odklona $_tmp_for_div[] = array('xi'=>$xi, 'fi'=>$fi, 'sequence'=>$_sequence); } # izpišemo sumo veljavnih $counter = self::outputSumaValidAnswerVertical($counter,$_sequence,$spid,$options); } if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'] AS $ikey => $iAnswer) { if ($iAnswer['cnt'] > 0 ) { # izpisujemo samo tiste ki nisno 0 $counter = self::outputInvalidAnswerVertical($counter,$ikey,$iAnswer,$_sequence,$spid,$options); } } # izpišemo sumo veljavnih $counter = self::outputSumaInvalidAnswerVertical($counter,$_sequence,$spid,$options); } #izpišemo še skupno sumo $counter = self::outputSumaVertical($counter,$_sequence,$spid,$options); } else { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } } } # odklon $avg = ($N > 0) ? $sum_xi_fi / $N : 0; #standardna diviacija $div = 0; $sum_pow_xi_fi_avg = 0; foreach ( $_tmp_for_div as $tkey => $_tmp_div_data) { $xi = $_tmp_div_data['xi']; $fi = $_tmp_div_data['fi']; $sum_pow_xi_fi_avg += pow(($xi - $avg),2) * $fi; } $div = (($N -1) > 0) ? sqrt($sum_pow_xi_fi_avg / ($N -1)) : 0; # izpišemo še odklon in povprečje if ($show_valid_percent == 1 && SurveyAnalysis::$_HEADERS[$spid]['skala'] != 1) { $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; } $output .= '
'; $output .= ''.$spremenljivka['variable'].''; $output .= ''.$spremenljivka['naslov'].''; $output .= '
'; $output .= ''.$lang['srv_analiza_frekvence_titleAnswers'] . ''. $lang['srv_analiza_frekvence_titleFrekvenca'] .''. $lang['srv_analiza_frekvence_titleOdstotek'] .''. $lang['srv_analiza_frekvence_titleVeljavni'] .''. $lang['srv_analiza_frekvence_titleKumulativa'] .'
'.$lang['srv_analiza_opisne_povprecje'].''. self::formatNumber($avg,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'').''.$lang['srv_analiza_opisne_odklon'].''.self::formatNumber($div,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'').'
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && SurveyAnalysis::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { self::outputOtherAnswers($oAnswers); } } } /** Izriše sumarnik v horizontalni obliki za multi checbox * * @param unknown_type $spid - spremenljivka ID */ function sumMultiHorizontalCheckbox($spid,$_from) { global $lang; global $output; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; $_answersOther = array(); # ugotovimo koliko imamo kolon $gid=0; $_clmn_cnt = SurveyAnalysis::$_HEADERS[$spid]['grids'][$gid]['cnt_vars']-SurveyAnalysis::$_HEADERS[$spid]['grids'][$gid]['cnt_other']; # tekst vprašanja $css_hide_enote = isset($_POST['navedbe']) && $_POST['navedbe'] == '1' ? ' hidden' : ''; $css_hide_navedbe = isset($_POST['navedbe']) && $_POST['navedbe'] == '1' ? '' : ' hidden'; # odgovori $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $_variables = SurveyAnalysis::$_HEADERS[$spid]['grids'][$gid]['variables']; $output .= ''; $output .= ''; $output .= ''; if (count($_variables) > 0) { foreach ($_variables AS $vkey => $variable) { if ($variable['other'] != true) { $output .= ''; } } } //$output .= ''; $output .= ''; $output .= ''; $output .= ''; foreach (SurveyAnalysis::$_HEADERS[$spid]['grids'] AS $gid => $grids) { $_cnt = 0; # vodoravna vrstice s podatki $css_back = ' anl_bck_desc_2'; $output .= ''; $output .= ''; $output .= ''; $_arguments = 0; $_max_appropriate = 0; $_max_cnt = 0; // prikaz frekvenc if (count($grids['variables']) > 0) foreach ($grids['variables'] AS $vkey => $variable) { $_sequence = $variable['sequence']; $_valid = SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']; $_cnt = SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; $_arguments += $_cnt; $_max_appropriate = max($_max_appropriate, (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); $_max_cnt = max ($_max_cnt, ((int)(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']+(int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['0']['cnt']))); if ($variable['other'] == true) { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vkey,'sequence'=>$_sequence); } if ($variable['other'] != true) { $output .= ''; } } # veljavno $output .= ''; #ustrezno $output .= ''; $output .= ''; } $output .= '
'; $output .= ''.$spremenljivka['variable'].''; $output .= ''; $output .= ''.$spremenljivka['naslov'].''; // $output .= ' ('.$lang['srv_analiza_opisne_answers'].' / '.$lang['srv_analiza_opisne_arguments'].')'; // $output .= ' ('.$lang['srv_analiza_opisne_units'].' / '.$lang['srv_analiza_opisne_arguments'].')'; // $output .= ' ('.$lang['srv_analiza_opisne_units'].' / '.$lang['srv_analiza_opisne_arguments'].')'; $output .= '
'; $output .= ''; $output .= $lang['srv_analiza_opisne_subquestion']; $output .= ''; $output .= $lang['srv_analiza_opisne_answers']; $output .= ''.$lang['srv_analiza_opisne_valid'].''.$lang['srv_analiza_num_units'].'
' . $variable['naslov'].' ('.$variable['gr_id']. ') ' . $lang['srv_anl_suma1'] . ''. $_valid_cnt .''.$_approp_cnt. '
'.$grids['variable'].''.$grids['naslov'].''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= '
'.$_cnt.'
'; $_percent = ($_valid > 0 ) ? $_cnt * 100 / $_valid : 0; $output .= self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); $output .= '
'; $output .= '
'.$_max_cnt.''.$_max_appropriate.'
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && SurveyAnalysis::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { self::outputOtherAnswers($oAnswers); } } } function sumVerticalCheckbox($spid,$_from) { global $lang; global $output; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; $_answersOther = array(); $inline_legenda = count ($spremenljivka['grids']) > 1; if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = SurveyAnalysis::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = SurveyAnalysis::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } # ugotovimo koliko imamo kolon if (count($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] AS $gid => $grid) { $_clmn_cnt[$gid] = $grid['cnt_vars']-$grid['cnt_other']; if (count ($grid['variables']) > 0) foreach ($grid['variables'] AS $vid => $variable) { $_sequence = $variable['sequence']; $_valid_cnt[$gid] = max($_valid_cnt[$gid], SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']); $_approp_cnt[$gid] = max($_approp_cnt[$gid], SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); if ($variable['other'] == true) { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } $_valid[$gid][$vid] = SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']; $_navedbe[$gid] += SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; } } $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $_max_valid = 0; $_max_appropriate = 0; if (count ($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] as $gid => $grid) { $_max_valid = 0; $_max_appropriate = 0; if (count ($grid['variables']) > 0) foreach ($grid['variables'] AS $vid => $variable) { if ($variable['other'] != 1) { $_sequence = $variable['sequence']; $output .= ''; $output .= ''; $output .= ''; // Frekvence $output .= ''; // Veljavni $output .= ''; // Veljavni procent $output .= ''; $_max_appropriate = max($_max_appropriate, (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); $_max_valid = max ($_max_valid, ((int)(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']+(int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['0']['cnt']))); // Ustrezni $output .= ''; // Navedbe $output .= ''; $output .= ''; $output .= ''; } else { # drugo } } $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; } $output .= '
'; $output .= ''.$spremenljivka['variable'].''; $output .= ''.$spremenljivka['naslov'].''; //$output .= ' ('.$lang['srv_analiza_opisne_units'].' / '.$lang['srv_analiza_opisne_arguments'].')'; //$output .= ''; $output .= '
'; $output .= ''.$lang['srv_analiza_opisne_subquestion'].''.$lang['srv_analiza_opisne_units'].''.$lang['srv_analiza_opisne_arguments'].'
'.$lang['srv_analiza_opisne_frequency'].''.$lang['srv_analiza_opisne_valid'].'% - '.$lang['srv_analiza_opisne_valid'].''.$lang['srv_analiza_num_units_valid'].'% - '.$lang['srv_analiza_num_units_valid'].''.$lang['srv_analiza_opisne_frequency'].'%
'.$variable['variable'].''.$variable['naslov'].''; $output .= (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; $output .= ''; $output .= (int)(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']+(int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['0']['cnt']); $output .= ''; $_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ) ? 100*SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] : 0; $output .= self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); $output .= ''; $output .= (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']; // % Ustrezni $output .= ''; $valid = (int)(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']+(int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['0']['cnt']); $valid = (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; $_percent = ($_max_appropriate > 0 ) ? 100*$valid / $_max_appropriate : 0; $output .= self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); $output .= ''; $output .= SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; $output .= ''; $_percent = ($_navedbe[$gid] > 0 ) ? 100*SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt'] / $_navedbe[$gid] : 0; $output .= self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); $output .= '
'.$lang['srv_anl_suma_valid'].''.$_max_valid.''.$_max_appropriate.''.$_navedbe[$gid].''.SurveyAnalysis::formatNumber('100',SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%').'
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && SurveyAnalysis::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { self::outputOtherAnswers($oAnswers); } } } /** Izriše sumarnik v horizontalni obliki za multigrid * * @param unknown_type $spid - spremenljivka ID */ function sumHorizontal($spid,$_from) { global $lang; global $output; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; $_answersOther = array(); $_clmn_cnt = count($spremenljivka['options']); # pri razvrščanju dodamo dva polja za povprečje in odklon $additional_field = false; $add_fld = 0; if ($spremenljivka['tip'] == 17 || $spremenljivka['tip'] == 1 || $spremenljivka['tip'] == 3 || ($spremenljivka['tip'] == 6 && $spremenljivka['skala'] != 1)) { $additional_field = true; $add_fld = 2; } # pri radiu in dropdown ne prikazujemo podvprašanj $_sub_question_col = 1; if ($spremenljivka['tip'] == 1 || $spremenljivka['tip'] == 3) { $_sub_question_col = 0; } $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; if ($_sub_question_col) { $output .= ''; } $output .= ''; $output .= ''; $output .= ''; if ($additional_field) { $output .= ''; $output .= ''; } $output .= ''; $_variables = $grid['variables']; $output .= ''; $output .= ''; if ( $_sub_question_col ) { $output .= ''; } if (count($spremenljivka['options']) > 0) { foreach ( $spremenljivka['options'] as $key => $kategorija) { // misinge imamo zdruzene $_label = $kategorija; $output .= ''; } } $output .= ''; $output .= ''; $output .= ''; if ($additional_field) { $output .= ''; $output .= ''; } $output .= ''; if (count($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] AS $gid => $grid) { # zloopamo skozi variable if (count($grid['variables']) > 0) foreach ($grid['variables'] AS $vid => $variable ) { $_sequence = $variable['sequence']; if ($variable['other'] != true) { $output .= ''; if ($_sub_question_col) { $output .= ''; $output .= ''; } else { $output .= ''; } # za odklon in povprečje $sum_xi_fi=0; $N = 0; $div=0; if (count($spremenljivka['options']) > 0) { foreach ( $spremenljivka['options'] as $key => $kategorija) { if ($additional_field) { # za odklon in povprečje $xi = $key; $fi = SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt']; $sum_xi_fi += $xi * $fi ; $N += $fi; } $output .= ''; } } // suma $output .= ''; // zamenjano veljavni ustrezni $output .= ''; $output .= ''; if ($additional_field) { # za odklon in povprečje # povprečje $avg = ($N > 0) ? $sum_xi_fi / $N : 0; #standardna diviacija $div = 0; $sum_pow_xi_fi_avg = 0; if (count($spremenljivka['options']) > 0) { foreach ( $spremenljivka['options'] as $xi => $kategorija) { $fi = SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'][$xi]['cnt']; $sum_pow_xi_fi_avg += pow(($xi - $avg),2) * $fi; } } $div = (($N -1) > 0) ? sqrt($sum_pow_xi_fi_avg / ($N -1)) : 0; $output .= ''; $output .= ''; } $output .= ''; } else { # immamo polje drugo $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } } } $output .= '
'; $output .= ''.$spremenljivka['variable'].''; $output .= ''; $output .= ''.$spremenljivka['naslov'].''; $output .= '
'; $output .= ''.$lang['srv_analiza_opisne_subquestion'].''.$lang['srv_analiza_opisne_answers']; //$output .= ' (/ %)'; //$output .= ''; //$output .= ''; $output .= ''.$lang['srv_analiza_opisne_valid'].''.$lang['srv_analiza_num_units'].''.$lang['srv_analiza_opisne_povprecje'].''.$lang['srv_analiza_opisne_odklon'].'
'.$_label.''.$lang['srv_anl_suma1'].'
'; $output .= $variable['variable'].''; $output .= $variable['naslov'].''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= '
'.SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt'].'
'; $_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ) ? SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt'] * 100 / SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] : 0; $output .= self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); $output .= '
'; $output .= '
'; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= '
'.(int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'].'
'.self::formatNumber(100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%').'
'; $output .= '
'; $output .= SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']; $output .= ''.SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'].''; $output .= self::formatNumber($avg,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); $output .= ''; $output .= self::formatNumber($div,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),''); $output .= '
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && SurveyAnalysis::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { self::outputOtherAnswers($oAnswers); } } } /** Izriše sumarnik v horizontalni obliki za multigrid * * @param unknown_type $spid - spremenljivka ID */ function sumDoubleHorizontal($spid,$_from) { global $lang; global $output; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; $_answersOther = array(); $_clmn_cnt = count($spremenljivka['options'])*2; # pri radiu in dropdown ne prikazujemo podvprašanj $_sub_question_col = 6; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; #naslovi podskupin $_variables = $grid['variables']; $output .= ''; $output .= ''; #št. enot $output .= ''; $output .= ''; # naslovi variabel $_variables = $grid['variables']; $output .= ''; $output .= ''; $output .= ''; if (count($spremenljivka['options']) > 0) { foreach ( $spremenljivka['options'] as $key => $kategorija) { // misinge imamo zdruzene $_label = $kategorija; $output .= ''; } } $output .= ''; $output .= ''; $output .= ''; if (count($spremenljivka['options']) > 0) { foreach ( $spremenljivka['options'] as $key => $kategorija) { // misinge imamo zdruzene $_label = $kategorija; $output .= ''; } } $output .= ''; $output .= ''; $output .= ''; # št enot $output .= ''; $output .= ''; #zloopamo skozi gride in nardimo $_tmp_table = array(); $_part = 1; $cnt = 0; if (count($spremenljivka['grids']) > 0) { foreach ($spremenljivka['grids'] AS $gid => $grid) { if ( $_part == $grid['part'] ) { $cnt++; } else { $_part = $grid['part']; $cnt = 1; } # zloopamo skozi variable if (count($grid['variables']) > 0) { foreach ($grid['variables'] AS $vid => $variable ) { $_sequence = $variable['sequence']; if ($variable['other'] != true) { # za odklon in povprečje $sum_xi_fi=0; $N = 0; $div=0; if (count($spremenljivka['options']) > 0) { foreach ( $spremenljivka['options'] as $key => $kategorija) { $xi = $key; $fi = SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt']; $sum_xi_fi += $xi * $fi ; $N += $fi; $_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ) ? SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt'] * 100 / SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] : 0; $_tmp_table[$grid['part']][$cnt]['variables'][] = array('freq'=>SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt'],'percent'=>$_percent); } } $_tmp_table[$grid['part']][$cnt]['variable'] = $variable['variable']; $_tmp_table[$grid['part']][$cnt]['naslov'] = $variable['naslov']; $_tmp_table[$grid['part']][$cnt]['suma'] = SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']; $_tmp_table[$grid['part']][$cnt]['allCnt'] = (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']; # odklon $avg = ($N > 0) ? $sum_xi_fi / $N : 0; #standardna diviacija $div = 0; $sum_pow_xi_fi_avg = 0; if (count($spremenljivka['options']) > 0) { foreach ( $spremenljivka['options'] as $xi => $kategorija) { $fi = SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'][$xi]['cnt']; $sum_pow_xi_fi_avg += pow(($xi - $avg),2) * $fi; } } $div = (($N -1) > 0) ? sqrt($sum_pow_xi_fi_avg / ($N -1)) : 0; $_tmp_table[$grid['part']][$cnt]['avg'] = $avg; $_tmp_table[$grid['part']][$cnt]['div'] = $div; } //end if ($variable['other'] != true) } // end foreach variables } } } #zlopamo skozi gride if (count($_tmp_table[1]) > 0) { foreach ($_tmp_table[1] AS $tkey => $grid) { $cssBack = "anl_bck_desc_2 "; $output .= ''; $output .= ''; $output .= ''; # zloopamo skozi variable if (count($grid['variables']) > 0) { foreach ($grid['variables'] AS $vid => $variable ) { $output .= ''; } // end foreach variables } // end if (count($grid['variables']) > 0) // suma $output .= ''; // povpreje $output .= ''; // odklon $output .= ''; # dodamo desni del grida $_right_grid = $_tmp_table[2][$tkey]; if (count($_right_grid['variables']) > 0) { foreach ($_right_grid['variables'] AS $vid => $variable ) { $output .= ''; } // end foreach variables } // end if (count($grid['variables']) > 0) // suma $output .= ''; // povpreje $output .= ''; # odklon $output .= ''; # št enot $output .= ''; $output .= ''; } // end foreach ($_tmp_table[1] AS $tkey => $grid) } $output .= '
'; $output .= ''.$spremenljivka['variable'].''; $output .= ''; $output .= ''.$spremenljivka['naslov'].''; $output .= '
'; $output .= ''.$lang['srv_analiza_opisne_subquestion'].''.($spremenljivka['double'][1]['subtitle'] == '' ? $lang['srv_grid_subtitle_def'].' 1' : $spremenljivka['double'][1]['subtitle']).''.($spremenljivka['double'][2]['subtitle'] == '' ? $lang['srv_grid_subtitle_def'].' 2' : $spremenljivka['double'][2]['subtitle']).'
'.$_label.''.$lang['srv_anl_suma1'].''.$lang['srv_analiza_opisne_povprecje'].''.$lang['srv_analiza_opisne_odklon'].''.$_label.''.$lang['srv_anl_suma1'].''.$lang['srv_analiza_opisne_povprecje'].''.$lang['srv_analiza_opisne_odklon'].''.$lang['srv_analiza_num_units'].'
'.$grid['variable'].''.$grid['naslov'].''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= '
'.$variable['freq'].'
'; $output .= self::formatNumber($variable['percent'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); $output .= '
'; $output .= '
'; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= '
'.(int)$grid['suma'].'
'.self::formatNumber(100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%').'
'; $output .= '
'; $output .= self::formatNumber($grid['avg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); $output .= ''; $output .= self::formatNumber($grid['div'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= '
'.$variable['freq'].'
'; $output .= self::formatNumber($variable['percent'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); $output .= '
'; $output .= '
'; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= '
'.(int)$_right_grid['suma'].'
'.self::formatNumber(100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%').'
'; $output .= '
'; $output .= self::formatNumber($_right_grid['avg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); $output .= ''; $output .= self::formatNumber($_right_grid['div'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); $output .= ''; $output .= $grid['allCnt']; $output .= '
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && SurveyAnalysis::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { self::outputOtherAnswers($oAnswers); } } } /** Izriše multi number odgovore. izpiše samo povprečja * * @param unknown_type $spid */ function sumMultiNumber($spid,$_from) { global $lang; global $output; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; # dodamo opcijo kje izrisujemo legendo # če je besedilo * in je samo ena kategorija je inline legenda false $_cols = $spremenljivka['cnt_all'] / $spremenljivka['cnt_grids']; # tekst vprašanja $output .= ''; # naslovna vrstica $output .= ''; #variabla $output .= ''; #odgovori $output .= ''; $output .= ''; $output .= ''; #variabla $output .= ''; #odgovori $output .= ''; $output .= ''; $output .= ''; // konec naslovne vrstice $_answersOther = array(); $_grids_count = count($spremenljivka['grids']); if ($_grids_count > 0) { # naslovna vrstica $_row = $spremenljivka['grids'][0]; $output .= ''; $output .= ''; $output .= ''; if (count($_row['variables']) > 0 ) foreach ($_row['variables'] AS $rid => $_col ){ $_sequence = $_col['sequence']; # id kolone z podatki if ($_col['other'] != true) { $output .= ''; } else { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } } $output .= ''; $last = 0; //anl_bck_desc_2 anl_bl anl_br anl_variabla_sub foreach ($spremenljivka['grids'] AS $gid => $grid) { $_variables_count = count($grid['variables']); $output .= ''; $output .= ''; $output .= ''; if ($_variables_count > 0) { foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki if ($variable['other'] != true) { # tabela z navedbami $output .= ''; } } } $output .= ''; } } $output .= '
'; $output .= ''.$spremenljivka['variable'].''; $output .= ''.$spremenljivka['naslov'].''; $output .= '
'; $output .= ''.$lang['srv_analiza_opisne_subquestion'] . ''. $lang['srv_analiza_sums_average'] .'
'; // $output .= $_col['variable']; $output .= $_col['naslov']; $output .= '
'; $output .= $grid['variable']; $output .= ''; $output .= $grid['naslov']; $output .= ''; $output .= self::formatNumber(SurveyAnalysis::$_FREQUENCYS[$_sequence]['average'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); $output .= '
'; } /** Izriše multi number odgovore. v Navpični obliki (podobno kot opisne) * * @param unknown_type $spid */ function sumMultiNumberVertical($spid,$_from) { global $lang; global $output; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; # dodamo opcijo kje izrisujemo legendo # če je besedilo * in je samo ena kategorija je inline legenda false $inline_legenda = (SurveyAnalysis::$_HEADERS[$spid]['cnt_all'] == 1 || in_array($spremenljivka['tip'],array(1,8) ) ) ? false: true; $options=array('inline_legenda' => $inline_legenda, 'isTextAnswer' => false, 'isOtherAnswer' => false); # ali izpisujemo enoto: $show_enota = true; if ((int)$spremenljivka['enota'] == 0 && SurveyAnalysis::$_HEADERS[$spid]['cnt_all'] == 1) { $show_enota = false; } # ugotovimo koliko imamo kolon if (count($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] AS $gid => $grid) { $_clmn_cnt[$gid] = $grid['cnt_vars']-$grid['cnt_other']; if (count($grid['variables']) > 0) foreach ($grid['variables'] AS $vid => $variable) { $_sequence = $variable['sequence']; $_approp_cnt[$gid] = max($_approp_cnt[$gid], SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); # za povprečje $sum_xi_fi=0; $N = 0; $div=0; $min = null; $max = null; if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']) > 0 ) { foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'] AS $xi => $_validFreq) { # popravimo morebitne . in - $fnkey = (float)$xi; if (is_numeric($xi) && is_numeric($fnkey) && trim($fnkey) != '') { $fi = $_validFreq['cnt']; $sum_xi_fi += $xi * $fi ; $N += $fi; $min = $min != null ? min($min,$fnkey) : $fnkey; $max = $max != null ? max($max,$fnkey) : $fnkey; } } } # povprešje $avg = ($N > 0) ? $sum_xi_fi / $N : 0; SurveyAnalysis::$_FREQUENCYS[$_sequence]['validAvg'] = $avg; SurveyAnalysis::$_FREQUENCYS[$_sequence]['validMin'] = $min; SurveyAnalysis::$_FREQUENCYS[$_sequence]['validMax'] = $max; #standardna diviacija $div = 0; $sum_pow_xi_fi_avg = 0; if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']) > 0 ) { foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'] AS $xi => $_validFreq) { $fi = $_validFreq['cnt']; $sum_pow_xi_fi_avg += pow(($xi - $avg),2) * $fi; } } SurveyAnalysis::$_FREQUENCYS[$_sequence]['validDiv'] = (($N -1) > 0) ? sqrt($sum_pow_xi_fi_avg / ($N -1)) : 0; #določimo še polja drugo za kasnejši prikaz if ($variable['other'] == true) { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } } } # tekst vprašanja $output .= ''; # naslovna vrstica $output .= ''; #variabla $output .= ''; #odgovori $output .= ''; $output .= ''; $output .= ''; #variabla $output .= ''; if ($show_enota) { $output .= ''; } else { # če mamo number brez labele izrisujemo drugače $output .= ''; } $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $_answersOther = array(); $_grupa_cnt = 0; if (count($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] AS $gid => $grid) { if (count($spremenljivka['grids']) > 1 && $_grupa_cnt !== 0 && $spremenljivka['tip'] != 6) { $grid['new_grid'] = true; } $_grupa_cnt ++; if (count($grid['variables']) > 0) { foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki if ($variable['other'] != true) { $_sequence = $variable['sequence']; $cssBrdr = (int)$grid['new_grid'] == 1 ? ' anl_double_bt' : ' anl_bt_dot'; $output .= ''; if (!$show_enota && $spremenljivka['tip'] == 7) { $output .= '' ; if (!$show_enota && $spremenljivka['tip'] == 7) { $output .= '' ; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; } else { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } $grid['new_grid'] = false; } } } $output .= '
'; $output .= ''.$spremenljivka['variable'].''; $output .= ''.$spremenljivka['naslov'].''; $output .= '
'; $output .= ''; if ($spremenljivka['tip'] == 20 || $spremenljivka['tip'] == 7) { $output .= $lang['srv_analiza_opisne_subquestion']; } else { $output .= $lang['srv_analiza_opisne_variable_text']; } $output .=''; $output .='' . $lang['srv_analiza_opisne_m'] . '' . $lang['srv_analiza_num_units'] . '' . $lang['srv_analiza_opisne_povprecje'] . '' . $lang['srv_analiza_opisne_odklon'].'' . $lang['srv_analiza_opisne_min'] . '' . $lang['srv_analiza_opisne_max'] . '
' ; } else { $output .= '' ; } $output .= $_css_double_line; # za number (7) ne prikazujemo variable if ($spremenljivka['tip'] != 7 ) { $output .= $variable['variable']; } $output .= '' ; } else { $output .= '' ; } if ($show_enota) { $output .= (count($grid['variables']) > 1 && $spremenljivka['tip'] == 20 ? $grid['naslov'] . ' - ' : '' ).$variable['naslov']; } $output .= ''; $output .= (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']; $output .= ''; $output .= (int)$_approp_cnt[$gid]; $output .= ''; $output .= self::formatNumber(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validAvg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); $output .= ''; $output .= self::formatNumber(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validDiv'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),''); $output .= ''; $output .= (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['validMin']; $output .= ''; $output .= (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['validMax'];; $output .= '
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && SurveyAnalysis::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { self::outputOtherAnswers($oAnswers); } } } /** Izriše number odgovore v vertikalni obliki * * @param unknown_type $spid */ function sumNumberVertical($spid,$_from) { global $lang; global $output; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; # dodamo opcijo kje izrisujemo legendo # če je besedilo * in je samo ena kategorija je inline legenda false $inline_legenda = (SurveyAnalysis::$_HEADERS[$spid]['cnt_all'] == 1 || in_array($spremenljivka['tip'],array(1,8) ) ) ? false: true; $options=array('inline_legenda' => $inline_legenda, 'isTextAnswer' => false, 'isOtherAnswer' => false); # ali izpisujemo enoto: $show_enota = true; if (((int)$spremenljivka['enota'] == 0 && SurveyAnalysis::$_HEADERS[$spid]['cnt_all'] == 1) || $spremenljivka['tip'] == 22) { $show_enota = false; } $sum_avg = 0; # ugotovimo koliko imamo kolon if (count($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] AS $gid => $grid) { $_clmn_cnt[$gid] = $grid['cnt_vars']-$grid['cnt_other']; if (count($grid['variables']) > 0) foreach ($grid['variables'] AS $vid => $variable) { $_sequence = $variable['sequence']; $_approp_cnt[$gid] = max($_approp_cnt[$gid], SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); # za povprečje $sum_xi_fi=0; $N = 0; $div=0; $min = null; $max = null; if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']) > 0 ) { foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'] AS $xi => $_validFreq) { # popravimo morebitne . in - $fnkey = (float)$xi; if (is_numeric($xi) && is_numeric($fnkey) && trim($fnkey) != '') { $fi = $_validFreq['cnt']; $sum_xi_fi += $xi * $fi ; $N += $fi; $min = $min != null ? min($min,$fnkey) : $fnkey; $max = $max != null ? max($max,$fnkey) : $fnkey; } } } #povprečje $avg = ($N > 0) ? $sum_xi_fi / $N : 0; $sum_avg += $avg; SurveyAnalysis::$_FREQUENCYS[$_sequence]['validAvg'] = $avg; SurveyAnalysis::$_FREQUENCYS[$_sequence]['validMin'] = $min; SurveyAnalysis::$_FREQUENCYS[$_sequence]['validMax'] = $max; #standardna diviacija $div = 0; $sum_pow_xi_fi_avg = 0; if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']) > 0 ) { foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'] AS $xi => $_validFreq) { $fi = $_validFreq['cnt']; $sum_pow_xi_fi_avg += pow(($xi - $avg),2) * $fi; } } SurveyAnalysis::$_FREQUENCYS[$_sequence]['validDiv'] = (($N -1) > 0) ? sqrt($sum_pow_xi_fi_avg / ($N -1)) : 0; #določimo še polja drugo za kasnejši prikaz if ($variable['other'] == true) { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } } } # tekst vprašanja $output .= ''; # naslovna vrstica $output .= ''; #variabla $output .= ''; $num_cols = 7 + ($spremenljivka['tip'] == 18 ? 1 : 0); #odgovori $output .= ''; $output .= ''; $output .= ''; #variabla $output .= ''; if ($show_enota == true) { $output .= ''; } else { # če mamo number brez labele izrisujemo drugače $output .= ''; } $output .= ''; $output .= ''; $output .= ''; if ($spremenljivka['tip'] == 18) { $output .= ''; } $output .= ''; $output .= ''; $output .= ''; $output .= ''; $_answersOther = array(); $_grupa_cnt = 0; if (count($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] AS $gid => $grid) { if (count($spremenljivka['grids']) > 1 && $_grupa_cnt !== 0 && $spremenljivka['tip'] != 6) { $grid['new_grid'] = true; } $_grupa_cnt ++; if (count($grid['variables']) > 0) { foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki if ($variable['other'] != true) { $_sequence = $variable['sequence']; $cssBrdr = (int)$grid['new_grid'] == 1 ? ' anl_double_bt' : ' anl_bt_dot'; $output .= ''; $output .= '' ; $output .= '' ; $output .= ''; $output .= ''; $output .= ''; if ($spremenljivka['tip'] == 18) { $_percent = ($sum_avg > 0 ) ? 100 * SurveyAnalysis::$_FREQUENCYS[$_sequence]['validAvg'] / $sum_avg : 0; $output .= ''; } $output .= ''; $output .= ''; $output .= ''; } else { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } $grid['new_grid'] = false; } } } if ($spremenljivka['tip'] == 18) { $css_back = 'anl_bck_text_1 anl_bt'; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; # skupna suma $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; } $output .= '
'; $output .= ''.$spremenljivka['variable'].''; $output .= ''.$spremenljivka['naslov'].''; $output .= '
'; $output .= ''; if ($spremenljivka['tip'] == 20 || $spremenljivka['tip'] == 7) { $output .= $lang['srv_analiza_opisne_subquestion']; } else { $output .= $lang['srv_analiza_opisne_variable_text']; } $output .=''; $output .='' . $lang['srv_analiza_opisne_m'] . '' . $lang['srv_analiza_num_units'] . '' . $lang['srv_analiza_opisne_povprecje'] . '%' . $lang['srv_analiza_opisne_odklon'].'' . $lang['srv_analiza_opisne_min'] . '' . $lang['srv_analiza_opisne_max'] . '
' ; $output .= $_css_double_line; # za number (7) ne prikazujemo variable if ($spremenljivka['tip'] != 7 || ($show_enota == true && $spremenljivka['tip'] == 7 )) { if ($variable['variable'] == $spremenljivka['variable']) { $output .= $variable['variable'].'_1'; } else { $output .= $variable['variable']; } } $output .= '' ; if ($show_enota) { $output .= (count($grid['variables']) > 1 && $spremenljivka['tip'] == 20 ? $grid['naslov'] . ' - ' : '' ).$variable['naslov']; } $output .= ''; $output .= (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']; $output .= ''; $output .= (int)$_approp_cnt[$gid]; $output .= ''; $output .= self::formatNumber(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validAvg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); $output .= ''; $output .= self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),'%'); $output .= ''; $output .= self::formatNumber(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validDiv'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),''); $output .= ''; $output .= (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['validMin']; $output .= ''; $output .= (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['validMax'];; $output .= '
'; $output .= $lang['srv_anl_suma1']; $output .= '   '; $output .= self::formatNumber($sum_avg,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),''); $output .= '100%
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && SurveyAnalysis::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { self::outputOtherAnswers($oAnswers); } } } /** Izriše nagovor * */ function sumNagovor($spid,$_from) { global $lang; global $output; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; $_tip = SurveyAnalysis::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = SurveyAnalysis::getSpremenljivkaLegenda($spremenljivka,'skala'); $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= '
'; $output .= ''.$spremenljivka['variable'].''; $output .= ''.$spremenljivka['naslov'].''; $output .= '
'; } /** Izriše tekstovne odgovore kot tabelo z navedbami * * @param unknown_type $spid */ function sumMultiText($spid,$_from) { global $lang; global $output; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; # dodamo opcijo kje izrisujemo legendo # če je besedilo * in je samo ena kategorija je inline legenda false $_cols = $spremenljivka['cnt_all'] / $spremenljivka['cnt_grids']; # koliko zapisov prikažemo naenkrat $maxAnswer = (SurveyDataSettingProfiles :: getSetting('numOpenAnswers') > 0) ? SurveyDataSettingProfiles :: getSetting('numOpenAnswers') : 30; $_answers = SurveyAnalysis::getAnswers($spremenljivka,$maxAnswer); $_all_valid_answers_cnt = $_answers['validCnt']; $_valid_answers = $_answers['valid']; # tekst vprašanja $output .= ''; # naslovna vrstica $output .= ''; #variabla $output .= ''; #odgovori $output .= ''; $output .= ''; $output .= ''; #variabla $output .= ''; #odgovori $output .= ''; $output .= ''; $output .= ''; // konec naslovne vrstice $_answersOther = array(); $_grids_count = count($spremenljivka['grids']); if ($_grids_count > 0) { # naslovna vrstica $_row = $spremenljivka['grids'][0]; $output .= ''; $output .= ''; $output .= ''; if (count($_row['variables'])>0) foreach ($_row['variables'] AS $rid => $_col ){ $_sequence = $_col['sequence']; # id kolone z podatki if ($_col['other'] != true) { $output .= ''; } else { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } } $output .= ''; foreach ($spremenljivka['grids'] AS $gid => $grid) { $_variables_count = count($grid['variables']); $output .= ''; $output .= ''; $output .= ''; if ($_variables_count > 0) { # preštejemo max vrstic na grupo $_max_i = 0; foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki $_max_i = max($_max_i,min($num_show_records,SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])); } foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki if ($variable['other'] != true) { # tabela z navedbami $output .= ''; } } } $output .= ''; } } $output .= '
'; $output .= ''.$spremenljivka['variable'].''; $output .= ''.$spremenljivka['naslov'].''; $output .= '
'; $output .= ''.$lang['srv_analiza_opisne_subquestion'] . ''. $lang['srv_analiza_opisne_arguments'] .'
'; // $output .= $_col['variable']; $output .= $_col['naslov']; $output .= '
'; $output .= $grid['variable']; $output .= ''; $output .= $grid['naslov']; $output .= ''; $output .= ''; #$_valid_cnt = count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']); $index=0; if (count($_valid_answers) > 0) { foreach ($_valid_answers AS $answer) { $index++; $_ans = $answer[$_sequence]; $output .= ''; $output .= ''; $output .= ''; } } $output .= '
'; if ($_ans != null && $_ans != '') { $output .= $_ans; } $output .= '
'; $output .= '
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && SurveyAnalysis::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { self::outputOtherAnswers($oAnswers); } } } /** Izriše lookacijske odgovore kot tabelo z navedbami * * @param unknown_type $spid */ function sumLokacija($spid,$_from) { global $lang; global $output; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; $enota = $spremenljivka['enota']; # dodamo opcijo kje izrisujemo legendo # če je besedilo * in je samo ena kategorija je inline legenda false $_cols = $spremenljivka['cnt_all'] / $spremenljivka['cnt_grids']; # koliko zapisov prikažemo naenkrat $maxAnswer = (SurveyDataSettingProfiles :: getSetting('numOpenAnswers') > 0) ? SurveyDataSettingProfiles :: getSetting('numOpenAnswers') : 30; $_answers = SurveyAnalysis::getAnswers($spremenljivka,$maxAnswer); $_all_valid_answers_cnt = $_answers['validCnt']; $_valid_answers = $_answers['valid']; # tekst vprašanja $output .= ''; # naslovna vrstica $output .= ''; #variabla $output .= ''; #odgovori $output .= ''; $output .= ''; // konec naslovne vrstice $_answersOther = array(); $_grids_count = count($spremenljivka['grids']); if ($_grids_count > 0) { # naslovna vrstica $_row = $spremenljivka['grids'][0]; $output .= ''; $output .= ''; if (count($_row['variables'])>0) foreach ($_row['variables'] AS $rid => $_col ){ $_sequence = $_col['sequence']; # id kolone z podatki if ($_col['other'] != true) { $output .= ''; } else { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } } $output .= ''; foreach ($spremenljivka['grids'] AS $gid => $grid) { $_variables_count = count($grid['variables']); $output .= ''; $output .= ''; if ($_variables_count > 0) { # preštejemo max vrstic na grupo $_max_i = 0; foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki $_max_i = max($_max_i,min($num_show_records,SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])); } foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki if ($variable['other'] != true) { # tabela z navedbami $output .= ''; } } } $output .= ''; } } $output .= '
'; $output .= ''.$spremenljivka['variable'].''; $output .= ''.$spremenljivka['naslov'].''; $output .= '
'; $output .= $_col['naslov']; $output .= '
'; $output .= ''; $output .= ''; #$_valid_cnt = count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']); $index=0; if (count($_valid_answers) > 0) { foreach ($_valid_answers AS $answer) { $index++; $_ans = $answer[$_sequence]; $output .= ''; $output .= ''; $output .= ''; } } $output .= '
'; if ($_ans != null && $_ans != '') { $_ans = html_entity_decode($_ans, ENT_NOQUOTES, 'UTF-8'); $_ans = str_replace(array("š","š","č"),array("š","š","č"),$_ans); $output .= strip_tags($_ans, "
"); } $output .= '
'; $output .= '
'; } /** Izriše tekstovne odgovore v vertikalni obliki * * @param unknown_type $spid */ function sumTextVertical($spid,$_from) { global $lang; global $output; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; # dodamo opcijo kje izrisujemo legendo # če je besedilo * in je samo ena kategorija je inline legenda false $inline_legenda = (SurveyAnalysis::$_HEADERS[$spid]['cnt_all'] == 1 || in_array($spremenljivka['tip'],array(1,8) ) ) ? false: true; $options=array('inline_legenda' => $inline_legenda, 'isTextAnswer' => false, 'isOtherAnswer' => false, 'num_show_records' => $num_show_records); # tekst vprašanja $output .= ''; # naslovna vrstica $output .= ''; #variabla $output .= ''; #odgovori $show_valid_percent = (SurveyAnalysis::$_HEADERS[$spid]['show_valid_percent'] == true) ? 1 : 0; $output .= ''; $output .= ''; $output .= ''; #variabla $output .= ''; #odgovori $output .= ''; $output .= ''; $output .= ''; if (SurveyAnalysis::$_HEADERS[$spid]['show_valid_percent'] == true) { $output .= ''; } $output .= ''; $output .= ''; // konec naslovne vrstice $_answersOther = array(); $_grids_count = count($spremenljivka['grids']); if ($_grids_count > 0) foreach ($spremenljivka['grids'] AS $gid => $grid) { $_variables_count = count($grid['variables']); if ($_variables_count > 0) foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki if ($variable['other'] != true) { # dodamo dodatne vrstice z labelami grida if ($_variables_count > 1) { SurveyAnalysis::outputGridLabelVertical($gid,$grid,$vid,$variable,$spid,$options); } $maxAnswer = (SurveyDataSettingProfiles :: getSetting('numOpenAnswers') > 0) ? SurveyDataSettingProfiles :: getSetting('numOpenAnswers') : 30; $counter = 0; $_kumulativa = 0; //SurveyAnalysis::$_FREQUENCYS[$_sequence] if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'])> 0 ) { $_valid_answers = SurveyAnalysis :: sortTextValidAnswers($spid,$variable,SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']); foreach ($_valid_answers AS $vkey => $vAnswer) { if ($counter < $maxAnswer) { if ($vAnswer['cnt'] > 0 || true) { # izpisujemo samo tiste ki nisno 0 $options['isTextAnswer']=true; $counter = self::outputValidAnswerVertical($counter,$vkey,$vAnswer,$_sequence,$spid,$_kumulativa,$options); } } } # izpišemo sumo veljavnih $counter = self::outputSumaValidAnswerVertical($counter,$_sequence,$spid,$options); } if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'] AS $ikey => $iAnswer) { if ($iAnswer['cnt'] > 0 ) { # izpisujemo samo tiste ki nisno 0 $counter = self::outputInvalidAnswerVertical($counter,$ikey,$iAnswer,$_sequence,$spid,$options); } } # izpišemo sumo veljavnih $counter = self::outputSumaInvalidAnswerVertical($counter,$_sequence,$spid,$options); } #izpišemo še skupno sumo $counter = self::outputSumaVertical($counter,$_sequence,$spid,$options); } else { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } } } $output .= '
'; $output .= ''.$spremenljivka['variable'].''; $output .= ''.$spremenljivka['naslov'].''; $output .= '
'; $output .= ''.$lang['srv_analiza_frekvence_titleAnswers'] . ''. $lang['srv_analiza_frekvence_titleFrekvenca'] .''. $lang['srv_analiza_frekvence_titleOdstotek'] .''. $lang['srv_analiza_frekvence_titleVeljavni'] .''. $lang['srv_analiza_frekvence_titleKumulativa'] .'
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && SurveyAnalysis::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { self::outputOtherAnswers($oAnswers); } } } function outputValidAnswerVertical($counter,$vkey,$vAnswer,$_sequence,$spid,&$_kumulativa,$_options=array()) { global $lang; global $output; # opcije $options = array( 'isTextAnswer' => false, # ali je tekstovni odgovor 'isOtherAnswer' => false, # ali je odgovor Drugo 'inline_legenda' => true, # ali je legenda inline ali v headerju ); foreach ($_options as $_oKey => $_option) { $options[$_oKey] = $_option; } $_valid = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ) ? 100*$vAnswer['cnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] : 0; $_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*$vAnswer['cnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] : 0; $_kumulativa += $_valid; $output .= ''; $output .= ''; $output .= ''.$vkey; $output .= (($options['isTextAnswer'] == false && (string)$vkey != $vAnswer['text']) ? ' ('.$vAnswer['text'] .')' : ''); $output .= ''; $output .= ''; $output .= (int)$vAnswer['cnt']; $output .= ''; $output .= ''; $output .= self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); $output .= ''; if (SurveyAnalysis::$_HEADERS[$spid]['show_valid_percent']) { $output .= ''; $output .= self::formatNumber($_valid, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); $output .= ''; } $output .= ''; $output .= self::formatNumber($_kumulativa, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); $output .= ''; $output .= ''; $counter++; return $counter; } function outputSumaValidAnswerVertical($counter,$_sequence,$spid,$_options=array()) { global $lang; global $output; # opcije $options = array( 'isTextAnswer' => false, # ali je tekstovni odgovor 'isOtherAnswer' => false, # ali je odgovor Drugo 'inline_legenda' => true, # ali je legenda inline ali v headerju ); foreach ($_options as $_oKey => $_option) { $options[$_oKey] = $_option; } $output .= ''; $output .= ''.$lang['srv_anl_valid'].''; $output .= ''.$lang['srv_anl_suma1'].''; $output .= ''; $output .= SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ? SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] : 0; $output .= ''; $_percent = SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ? 100 * SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] : 0; $output .= '' . self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%') . ''; if (SurveyAnalysis::$_HEADERS[$spid]['show_valid_percent'] == true) { $output .= '' . self::formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%') . ''; } $output .= ''; $output .= ''; // $counter++; return $counter; } function outputInvalidAnswerVertical($counter,$vkey,$vAnswer,$_sequence,$spid,$_options=array()) { global $lang; global $output; # opcije $options = array( 'isTextAnswer' => false, # ali je tekstovni odgovor 'isOtherAnswer' => false, # ali je odgovor Drugo 'inline_legenda' => true, # ali je legenda inline ali v headerju ); foreach ($_options as $_oKey => $_option) { $options[$_oKey] = $_option; } $_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*$vAnswer['cnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] : 0; $_invalid = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt'] > 0 ) ? 100*$vAnswer['cnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt'] : 0; $_Z_MV = ((int)SurveyAnalysis::$missingProfileData['display_mv_type'] === 2) ? TRUE : FALSE; if($_Z_MV){ $output .= ''; $output .= ''; $output .= ''; $output .= $vkey . ' (' . $vAnswer['text'].')'; //$output .= self::formatNumber($_invalid, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); //$output .= $vAnswer['cnt']; $output .= ''; $output .= ''; $output .= (int)$vAnswer['cnt']; $output .= ''; $output .= ''; $output .= self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); $output .= ''; if (SurveyAnalysis::$_HEADERS[$spid]['show_valid_percent']) { $output .= ''; $output .= ''; } $output .= ''; $output .= ''; $output .= ''; } $counter++; return $counter; } function outputSumaInvalidAnswerVertical($counter,$_sequence,$spid,$_options = array()) { global $lang; global $output; # opcije $options = array( 'isTextAnswer' => false, # ali je tekstovni odgovor 'isOtherAnswer' => false, # ali je odgovor Drugo 'inline_legenda' => true, # ali je legenda inline ali v headerju ); foreach ($_options as $_oKey => $_option) { $options[$_oKey] = $_option; } $_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] : 0; $_brez_MV = ((int)SurveyAnalysis::$missingProfileData['display_mv_type'] === 0) ? TRUE : FALSE; $_sufix = (SurveyAnalysis::$podstran == M_ANALYSIS_SUMMARY_NEW ? '_NEW' : ''); # da deluje razpiranje manjkajočih tudi kadar imamo skupine if (isset(SurveyAnalysis::$_CURRENT_LOOP['cnt'])) { $_sufix = '_loop'.SurveyAnalysis::$_CURRENT_LOOP['cnt'].$_sufix; } if(!$_brez_MV){ $output .= ''; $output .= ''.$lang['srv_anl_missing'].''; $output .= ''; $output .= $lang['srv_analiza_manjkajocevrednosti']; //$output .= '100.0%'; //$output .= SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt']; $output .= ''; $output .= ''; $answer['cnt'] = SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt'] > 0 ? SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt'] : 0; $output .= (int)$answer['cnt']; $output .= ''; $output .= ''; $output .= self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); $output .= ''; if (SurveyAnalysis::$_HEADERS[$spid]['show_valid_percent']) { $output .= ''; $output .= ''; } $output .= ''; $output .= ''; } $counter++; return $counter; } function outputSumaVertical($counter,$_sequence,$spid, $_options = array()) { global $lang; global $output; # opcije $options = array( 'isTextAnswer' => false, # ali je tekstovni odgovor 'isOtherAnswer' => false, # ali je odgovor Drugo 'inline_legenda' => true, # ali je legenda inline ali v headerju ); foreach ($_options as $_oKey => $_option) { $options[$_oKey] = $_option; } $_brez_MV = ((int)SurveyAnalysis::$missingProfileData['display_mv_type'] === 0) ? TRUE : FALSE; if(!$_brez_MV){ $output .= ''; //$output .= ' '; // $lang['srv_anl_appropriate'] //$output .= ''.$lang['srv_anl_suma2'].''; $output .= ''.$lang['srv_anl_suma2'].''; $output .= ''; $output .= '' . (SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] ? SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] : 0) . ''; $output .= '' . SurveyAnalysis::formatNumber('100', SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%') . ''; if (SurveyAnalysis::$_HEADERS[$spid]['show_valid_percent']) { $output .= ''; } $output .= ''; $output .= ''; } } /** izpišemo tabelo z tekstovnimi odgovori drugo * * @param $skey * @param $oAnswers * @param $spid */ function outputOtherAnswers($oAnswers) { global $lang; global $output; $output .= '
'; $spid = $oAnswers['spid']; $_variable = SurveyAnalysis::$_HEADERS[$spid]['grids'][$oAnswers['gid']]['variables'][$oAnswers['vid']]; $_sequence = $_variable['sequence']; $_frekvence = SurveyAnalysis::$_FREQUENCYS[$_variable['sequence']]; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; // konec naslovne vrstice $counter = 1; $_kumulativa = 0; if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'])> 0 ) { foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'] AS $vkey => $vAnswer) { if ($vAnswer['cnt'] > 0 ) { # izpisujemo samo tiste ki nisno 0 $counter = self::outputValidAnswerVertical($counter,$vkey,$vAnswer,$_sequence,$spid,$_kumulativa,array('isOtherAnswer'=>true)); } } # izpišemo sumo veljavnih $counter = self::outputSumaValidAnswerVertical($counter,$_sequence,$spid,array('isOtherAnswer'=>true)); } if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'] AS $ikey => $iAnswer) { if ($iAnswer['cnt'] > 0 ) { # izpisujemo samo tiste ki nisno 0 $counter = self::outputInvalidAnswerVertical($counter,$ikey,$iAnswer,$_sequence,$spid,array('isOtherAnswer'=>true)); } } # izpišemo sumo veljavnih $counter = self::outputSumaInvalidAnswerVertical($counter,$_sequence,$spid,array('isOtherAnswer'=>true)); } #izpišemo še skupno sumo $counter = self::outputSumaVertical($counter,$_sequence,$spid,array('isOtherAnswer'=>true)); $output .= '
'. $_variable['variable'] . ''; $output .= ''.SurveyAnalysis::$_HEADERS[$oAnswers['spid']]['variable'].' ('.$_variable['naslov'].' )'; $output .= '
'; $output .= ''. $lang['srv_analiza_frekvence_titleAnswers'] .''. $lang['srv_analiza_frekvence_titleFrekvenca'] .''. $lang['srv_analiza_frekvence_titleOdstotek'] .''. $lang['srv_analiza_frekvence_titleVeljavni'] .''. $lang['srv_analiza_frekvence_titleKumulativa'] .'
'; } function encodeText($text) { // popravimo sumnike ce je potrebno $stringIn = array("č","š","đ","ć","ž","Č","Š","Đ","Ć","Ž"," "); $stringOut = array("č","š","đ","ć","ž","Č","Š","Đ","Ć","Ž"," "); //$text = html_entity_decode($text, ENT_NOQUOTES, 'UTF-8'); $text = str_replace($stringIn, $stringOut, $text); return $text; } function enkaEncode($text) { // popravimo sumnike ce je potrebno $text = html_entity_decode($text, ENT_NOQUOTES, 'UTF-8'); return strip_tags($text); } function formatNumber ($value, $digit = 0, $sufix = "") { if ($value <> 0 && $value != null) $result = round($value, $digit); else $result = "0"; //$result = number_format($result, $digit, '.', ',') . $sufix; $result = number_format($result, $digit, ',', '') . $sufix; // Preprecimo da bi se stevilo z decimalko pretvorilo v datum //$result = '="'. $result.'"'; return $result; } } ?>