\x7C * ` -> \x60 * ' -> \x27 * " -> \x22 */ define("EXPORT_FOLDER", "admin/survey/SurveyData"); define('DATE_FORMAT', 'Y-m-d'); define("ALLOW_HIDE_ZERRO_REGULAR", false); # omogočimo delovanje prikazovanja/skrivanja ničelnih vrednosti za navadne odgovore define("ALLOW_HIDE_ZERRO_MISSING", true); # omogočimo delovanje prikazovanja/skrivanja ničelnih vrednosti za missinge define("AUTO_HIDE_ZERRO_VALUE", 20); # nad koliko kategorij skrivamo ničelne vrednosti # mejne vrednosti za barvanje residualov define("RESIDUAL_COLOR_LIMIT1", 1.00); define("RESIDUAL_COLOR_LIMIT2", 2.00); define("RESIDUAL_COLOR_LIMIT3", 3.00); DEFINE (STR_DLMT, '|'); DEFINE (NEW_LINE, "\n"); DEFINE (TMP_EXT, '.tmp'); DEFINE (DAT_EXT, '.dat'); class SurveyAnalysis { static public $inited = false; # ali smo razred inicializirali static public $sid; # id ankete static public $folder = ''; # pot do folderja static private $headFileName = null; # pot do header fajla static private $dataFileName = null; # pot do data fajla static private $dataFileStatus = null; # status data datoteke static private $dataFileUpdated = null; # kdaj je bilo updejtano static private $noHeader = false; # errorchecking - če header datoteka ne obstaja static private $survey = null; # podatki ankete static public $podstran; # podstran static public $db_table; # katere tabele uporabljamo static public $_CURRENT_STATUS_FILTER = ''; # filter po statusih, privzeto izvažamo 6 in 5 static public $_FILTRED_VARIABLES = array(); # filter po spremenljivkah static public $_FILTRED_TYPES = array(); # filter po tipih spremenljivk static public $_FILTRED_OTHER = array(); # filter za polja drugo static public $_SHOW_LEGENDA = false; # ali izrisujemo legendo static public $_LOOPS = array(); # array z loopi static public $_CURRENT_LOOP = null; # v kateri zanki smo static public $_tmp_file_prefix = null; # predpona začasnih datotek za analizo static public $_tmp_file_ext = '.tmp'; # končnicazačasnih datotek za analizo static public $appropriateStatus = array(6,5); # Statusi anket katere štejemo kot ustrezne static public $unAppropriateStatus = array(4,3,2,1,0); # Statusi anket katere štejemo kot neustrezne static public $unKnownStatus = array('null'); # Statusi anket katere štejemo kot neustrezne static public $currentMissingProfile = 1; # Kateri Missing profil je izbran static public $missingProfileData = null; # Nastavitve trenutno izbranega manjkajočega profila //static public $currentZankaProfile = 0; # Kateri zanka profil je izbran static public $currentFilterProfile = 1; # Kateri IF profil je izbran static public $_PROFILE_ID_STATUS = null; static public $_PROFILE_ID_VARIABLE = null; static public $_PROFILE_ID_CONDITION = null; static public $printPreview = false; # ali prikazujemo podatke kot print preview; static public $_HEADERS = array(); # shranimo podatke vseh variabel static public $_FREQUENCYS = array(); # v to variablo shranemo frekvence static public $_DESCRIPTIVES = array(); # v to variablo shranemo opisne statistike static public $_HAS_TEST_DATA = false; # ali anketa vsebuje testne podatke static public $show_spid_div = true; # ali prikazuje spremenljivke v posameznem divu ( pride prav pri ajaxu, ko loadamo v star div static public $setUpJSAnaliza = true; # ali nastavimo __analiza = 1 v JS static public $crossTabClass = null; # razred za crostabulacije static public $returnAsHtml = false; # ali vrne rezultat analiz kot html ali ga izpiše static public $isArchive = false; # nastavimo na true če smo v arhivu static public $enableInspect = true; # checkbox enableInspect static public $frequencyAddInvalid = true; # ali pri frekvencah dodajamo neveljavne static public $_forceShowEmpty = false; # vsili prikaz spremenljivke tudi če je prazna static public $hideEmptyValue = false; # Ali skrivamo prazne enote če je več kot 20 kategorij static public $publicAnalyse = false; # Ali je javna analaiza # CSS STILI static public $cssColors = array ( '0_0' => 'anl_bck_0_0', '0_1' => 'anl_bck_0_1', '1_0' => 'anl_bck_1_0', '1_1' => 'anl_bck_1_1', '2_0' => 'anl_bck_2_0', '2_1' => 'anl_bck_2_1', 'text_0' => 'anl_bck_text_0', 'text_1' => 'anl_bck_text_1' ); static public $textAnswersMore = array('0'=>'10','10'=>'30','30'=>'300','300'=>'600','600'=>'900','900'=>'100000'); /** * Inicializacija * * @param int $anketa */ static function Init( $anketa = null ) { global $surveySkin, $global_user_id, $site_path, $lang; self::$folder = $site_path . EXPORT_FOLDER.'/'; if ((int)$anketa > 0) { # če je poadan anketa ID session_start(); self::$sid = $anketa; if (self::$inited == false){ SurveyAnalysisHelper::getInstance()->Init(self::$sid); Common::deletePreviewData($anketa); // Poskrbimo za datoteko s podatki $SDF = SurveyDataFile::get_instance(); $SDF->init($anketa); $SDF->prepareFiles(); self::$headFileName = $SDF->getHeaderFileName(); self::$dataFileName = $SDF->getDataFileName(); self::$dataFileStatus = $SDF->getStatus(); self::$dataFileUpdated = $SDF->getFileUpdated(); if (isset($_GET['podstran'])) { self::$podstran = $_GET['podstran']; } else if (isset($_POST['podstran'])) { self::$podstran = $_POST['podstran']; } else if (isset($_GET['m'])) { self::$podstran = $_GET['m']; } else { self::$podstran = M_ANALYSIS_SUMMARY; } # če smo v crostabih, jih incializiramo if (self::$podstran == M_ANALYSIS_CROSSTAB) { self::$crossTabClass = new SurveyCrosstabs(); self::$crossTabClass->Init(self::$sid); } self::$_CURRENT_STATUS_FILTER = STATUS_FIELD.' ~ /6|5/'; # začasni folder kamor se shranjujejo začasni podatki self::$_tmp_file_prefix = 'analysis_'.self::$sid.'_'.self::$podstran.'_'; # Inicializiramo in polovimo nastavitve missing profila SurveyStatusProfiles :: Init(self::$sid,$global_user_id); SurveyMissingProfiles :: Init(self::$sid,$global_user_id); SurveyVariablesProfiles :: Init(self::$sid); SurveyUserSetting :: getInstance()->Init(self::$sid, $global_user_id); SurveyConditionProfiles :: Init(self::$sid, $global_user_id); SurveyZankaProfiles :: Init(self::$sid, $global_user_id); SurveyTimeProfiles :: Init(self::$sid, $global_user_id); SurveyDataSettingProfiles :: Init(self::$sid); $smv = new SurveyMissingValues(self::$sid); $zs = new SurveyZoom(self::$sid); if ( self::$dataFileStatus == FILE_STATUS_NO_DATA || self::$dataFileStatus == FILE_STATUS_SRV_DELETED) { if (self::$podstran != M_ANALYSIS_ARCHIVE) Common::noDataAlert(); return false; } SurveyInfo :: getInstance()->SurveyInit(self::$sid); self::$survey = SurveyInfo::getInstance()->getSurveyRow(); UserSetting :: getInstance()->Init($global_user_id); if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { self::$db_table = '_active'; } # nastavimo vse filtre self::setUpFilter(); self::$inited = true; } } else { die("Napaka!"); } } /** Funkcija ki nastavi vse filtre * */ static public function setUpFilter($pid=null) { if (self::$dataFileStatus == FILE_STATUS_SRV_DELETED) { return false; } if (self::$headFileName !== null && self::$headFileName != '' && file_exists(self::$headFileName)) { self::$_HEADERS = unserialize(file_get_contents(self::$headFileName)); # odstranimo sistemske variable tipa email, ime, priimek, geslo self::removeSystemVariables(); # # poiščemo kater profil uporablja uporabnik $_currentMissingProfile = SurveyUserSetting :: getInstance()->getSettings('default_missing_profile'); self::$currentMissingProfile = (isset($_currentMissingProfile) ? $_currentMissingProfile : 1); # poiščemo kateri profil variabel imamo $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; # filtriranje po statusih self::$_CURRENT_STATUS_FILTER = SurveyStatusProfiles :: getStatusAsAWKString($pid); # filtriranje po časih $_time_profile_awk = SurveyTimeProfiles :: getFilterForAWK(self::$_HEADERS['unx_ins_date']['grids']['0']['variables']['0']['sequence']); # dodamo še ife SurveyConditionProfiles :: setHeader(self::$_HEADERS); $_condition_profile_AWK = SurveyConditionProfiles:: getAwkConditionString(); # dodamo dodatne pogoje za GORENJE FILTRIRANJE if(Common::checkModule('gorenje')){ $SAG = new SurveyAnalysisGorenje(self::$sid); $_gorenje_filter_AWK = $SAG->getAWKString(self::$_HEADERS); if($_gorenje_filter_AWK != ''){ // Ce imamo oba samo pripnemo dodatne filtre if($_gorenje_filter_AWK != '' && $_condition_profile_AWK != '') $_condition_profile_AWK .= '&&'.$SAG->getAWKString(self::$_HEADERS); else $_condition_profile_AWK = $SAG->getAWKString(self::$_HEADERS); } } # dodamo še ife za inspect $SI = new SurveyInspect(self::$sid); $_inspect_condition_awk = $SI->generateAwkCondition(); # dodamo še zoom $_zoom_condition = SurveyZoom::generateAwkCondition(); # ali imamo filter na testne podatke #$filter_testdata = isset($_SESSION['testData'][self::$sid]['includeTestData']) && $_SESSION['testData'][self::$sid]['includeTestData'] == 'false'; 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); } # 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); } if (($_condition_profile_AWK != "" && $_condition_profile_AWK != null ) || ($_inspect_condition_awk != "" && $_inspect_condition_awk != null) || ($_time_profile_awk != "" && $_time_profile_awk != null) || ($_zoom_condition != "" && $_zoom_condition != 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 ($_zoom_condition != "" && $_zoom_condition != null) { self::$_CURRENT_STATUS_FILTER .= ' && '.$_zoom_condition; } if ($filter_testdata != null ) { self::$_CURRENT_STATUS_FILTER .= '&&('.$filter_testdata.')'; /* $test_data_sequence = self::$_HEADERS['testdata']['grids'][0]['variables'][0]['sequence']; if ((int)$test_data_sequence > 0) { self::$_CURRENT_STATUS_FILTER .= '&&($'.$filter_testdata.')'; } */ } if ($filter_usability != null ) { self::$_CURRENT_STATUS_FILTER .= '&&('.$filter_usability.')'; } self::$_CURRENT_STATUS_FILTER .= ')'; } # filtriranje po spremenljivkah self::$_FILTRED_VARIABLES = null; self::$_FILTRED_VARIABLES = SurveyVariablesProfiles :: getProfileVariables(null); # upoštevamo tudi filtriranje po tipu : kategorija, števila, besedilo self::$_FILTRED_TYPES = SurveyDataSettingProfiles :: getSetting('spr_types'); self::$_FILTRED_OTHER = SurveyDataSettingProfiles :: getSetting('showOther'); # če smo radio enableInspect $SI = new SurveyInspect(self::$sid); self::$enableInspect = $SI->isInspectEnabled(); # ali izrisujemo legendo self::$_SHOW_LEGENDA = (SurveyDataSettingProfiles :: getSetting('analiza_legenda') == true) ? true : false; if (self::$dataFileStatus >= 0) { if (isset(self::$_HEADERS['testdata'])) { self::$_HAS_TEST_DATA = true; } } } else { self::$noHeader = true; } } /** Prikazuje filtre * */ static function DisplayFilters($hq=1) { global $lang; if (self::$dataFileStatus == FILE_STATUS_NO_DATA || self::$noHeader == true) { return false; } if (self::$dataFileStatus != FILE_STATUS_SRV_DELETED) { if (self::$setUpJSAnaliza == true) { echo ''; } echo ''; # ali imamo testne podatke if (self::$_HAS_TEST_DATA) { # izrišemo bar za testne podatke $SSH = new SurveyStaticHtml(self::$sid); $SSH -> displayTestDataBar(true); } if (self::$podstran == M_ANALYSIS_DESCRIPTOR || self::$podstran == M_ANALYSIS_FREQUENCY || self::$podstran == M_ANALYSIS_SUMMARY || self::$podstran == M_ANALYSIS_CHARTS || self::$podstran == M_ANALYSIS_LINKS || self::$podstran == M_ANALYSIS_CREPORT) { echo '
'; # če ne uporabljamo privzetega časovnega profila izpišemo opozorilo SurveyZoom :: displayZoomConditions(); echo '
'; # id="globalSetingsHolder" // Posebni filtri za Gorenje if(Common::checkModule('gorenje')){ $SAG = new SurveyAnalysisGorenje(self::$sid); if($SAG->hasSpremenljivke()){ echo '
'; $SAG->displayFilters(); echo '
'; } } } } else { echo "Anketa je bila izbrisana! Prikaz podatkov ni mogoč!"; } } /** Prikazuje podatke analize * */ static function Display() { global $lang; if (self::$dataFileStatus == FILE_STATUS_NO_DATA || self::$dataFileStatus == -3 || self::$noHeader == true) { if (self::$podstran != M_ANALYSIS_ARCHIVE) return false; } # zakeširamo vsebino, in jo nato po potrebi zapišpemo v html ob_start(); # če nismo v crostabih if (self::$podstran != M_ANALYSIS_CROSSTAB) { # v arhivih ne izpisujemo if (self::$isArchive == false) { echo '
'; # če imamo filter zoom ga izpišemo SurveyZoom::getConditionString(); # č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 ne uporabljamo privzetega časovnega profila izpišemo opozorilo SurveyTimeProfiles :: printIsDefaultProfile(); # če imamo filter spremenljivk ga izpišemo SurveyVariablesProfiles:: getProfileString(); # če imamo rekodiranje $SR = new SurveyRecoding(self::$sid); $SR -> getProfileString(); SurveyDataSettingProfiles::getVariableTypeNote(); echo '
'; } } if (self::$dataFileStatus == FILE_STATUS_OLD && self::$podstran != M_ANALYSIS_ARCHIVE) { echo "Posodobljeno: ".date("d.m.Y, H:i:s", strtotime(self::$dataFileUpdated)); } # krostabe naredimo if(self::$podstran == M_ANALYSIS_CROSSTAB ) { self::$crossTabClass->Display(); } else { # polovimo nastavtve missing profila self::$missingProfileData = SurveyMissingProfiles::getProfile(self::$currentMissingProfile); if (self::$podstran != M_ANALYSIS_ARCHIVE) { self::$_LOOPS = SurveyZankaProfiles::getFiltersForLoops(); } if (!is_countable(self::$_LOOPS) || count(self::$_LOOPS) == 0) { # če nimamo zank switch (self::$podstran) { case M_ANALYSIS_SUMMARY : self::displaySums(); break; case M_ANALYSIS_DESCRIPTOR : self::displayDescriptives(); break; case M_ANALYSIS_FREQUENCY : self::displayFrequency(); break; case M_ANALYSIS_ARCHIVE : self::displayAnalysisArchive(); break; default : self::$podstran = M_ANALYSIS_SUMMARY; self::Display(); break; } } else { $loop_cnt = 0; # če mamo zanke foreach ( self::$_LOOPS AS $loop) { $loop_cnt++; $loop['cnt'] = $loop_cnt; self::$_CURRENT_LOOP = $loop; echo '

'.$lang['srv_zanka_note'].$loop['text'].'

'; switch (self::$podstran) { case M_ANALYSIS_SUMMARY : self::displaySums(); break; case M_ANALYSIS_DESCRIPTOR : self::displayDescriptives(); break; case M_ANALYSIS_FREQUENCY : self::displayFrequency(); break; case M_ANALYSIS_ARCHIVE : self::displayAnalysisArchive(); break; default : self::$podstran = M_ANALYSIS_SUMMARY; self::Display(); break; } } } } #ob_flush(); flush(); if (self::$returnAsHtml == false) { ob_flush(); flush(); return; } else { $result = ob_get_clean(); ob_flush(); flush(); return $result; } } /** Izrišemo opisne * */ static function displayDescriptives($_spid = null) { global $site_path, $lang; # preberemo header if (self::$headFileName !== null ) { #preberemo HEADERS iz datoteke self::$_HEADERS = unserialize(file_get_contents(self::$headFileName)); # odstranimo sistemske variable tipa email, ime, priimek, geslo self::removeSystemVariables(); # polovimo frekvence self::getDescriptives(); # izpišemo opisne statistike $vars_count = count(self::$_FILTRED_VARIABLES); $line_break = ''; # dodamo še kontrolo če kličemo iz displaySingleVar if (isset($_spid) && $_spid !== null) { self::$_HEADERS = array($_spid => self::$_HEADERS[$_spid]); } # ali prikazujemo spremenljivke brez veljavnih odgovorov $show_spid = array(); foreach (self::$_HEADERS AS $spid => $spremenljivka) { # preverjamo ali je meta if ($spremenljivka['tip'] != 'm' && ( count(self::$_FILTRED_VARIABLES) == 0 || (count(self::$_FILTRED_VARIABLES) > 0 && isset(self::$_FILTRED_VARIABLES[$spid]) )) && in_array($spremenljivka['tip'], self::$_FILTRED_TYPES) ){ $only_valid = 0; $show_enota = false; # preverimo ali imamo samo eno variablo in če iammo enoto if ((int)$spremenljivka['enota'] != 0 || $spremenljivka['cnt_all'] > 1 ) { $show_enota = true; } # izpišemo glavno vrstico z podatki $_sequence = null; # za enodimenzijske tipe izpišemo podatke kar v osnovni vrstici if (!$show_enota) { $variable = $spremenljivka['grids'][0]['variables'][0]; $_sequence = $variable['sequence']; # id kolone z podatki $only_valid += (int)self::$_DESCRIPTIVES[$_sequence]['validCnt']; } else { if ($spremenljivka['tip'] == 1 || $spremenljivka['tip'] == 3) { $variable = $spremenljivka['grids'][0]['variables'][0]; $_sequence = $variable['sequence']; # id kolone z podatki $show_enota = false; } #zloopamo skozi variable $_sequence = null; $grd_cnt=0; 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 ){ # dodamo ostale vrstice $do_show = ($variable['other'] !=1 && ($spremenljivka['tip'] == 1 || $spremenljivka['tip'] == 3 || $spremenljivka['tip'] == 5 || $spremenljivka['tip'] == 8 )) ? false : true; if ($do_show) { $only_valid += (int)self::$_DESCRIPTIVES[$variable['sequence']]['validCnt']; } } } } //else: if (!$show_enota) if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { $show_spid[$spid] = false; } else { $show_spid[$spid] = true; } } } echo ''; echo ''; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA) { echo ''; echo ''; echo ''; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach (self::$_HEADERS AS $spid => $spremenljivka) { # dajemo v bufer, da da ne prikazujemo vprašanj brez veljavnih odgovorov če imamo tako nastavljeno # preverjamo ali je meta if ($show_spid[$spid] && $spremenljivka['tip'] != 'm' && ( count(self::$_FILTRED_VARIABLES) == 0 || (count(self::$_FILTRED_VARIABLES) > 0 && isset(self::$_FILTRED_VARIABLES[$spid]) )) && in_array($spremenljivka['tip'], self::$_FILTRED_TYPES) ){ $show_enota = false; # preverimo ali imamo samo eno variablo in če iammo enoto if ((int)$spremenljivka['enota'] != 0 || $spremenljivka['cnt_all'] > 1 ) { $show_enota = true; } # izpišemo glavno vrstico z podatki $_sequence = null; # za enodimenzijske tipe izpišemo podatke kar v osnovni vrstici if (!$show_enota) { // if ($spremenljivka['tip'] == 1 || $spremenljivka['tip'] == 3 // || $spremenljivka['tip'] == 4 || $spremenljivka['tip'] == 7 || $spremenljivka['tip'] == 8) { $variable = $spremenljivka['grids'][0]['variables'][0]; $_sequence = $variable['sequence']; # id kolone z podatki self::displayDescriptivesSpremenljivkaRow($spid, $spremenljivka,$show_enota,$_sequence); } else { if ($spremenljivka['tip'] == 1 || $spremenljivka['tip'] == 3) { $variable = $spremenljivka['grids'][0]['variables'][0]; $_sequence = $variable['sequence']; # id kolone z podatki $show_enota = false; } self::displayDescriptivesSpremenljivkaRow($spid, $spremenljivka,$show_enota,$_sequence); #zloopamo skozi variable $_sequence = null; $grd_cnt=0; if (count($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] AS $gid => $grid) { if (count($spremenljivka['grids']) > 1 && $grd_cnt !== 0 && $spremenljivka['tip'] != 6) { $grid['new_grid'] = true; } $grd_cnt++; $var_cnt=0; # dodamo dodatne vrstice z albelami grida if (count ($grid['variables']) > 0) foreach ($grid['variables'] AS $vid => $variable ){ # dodamo ostale vrstice $do_show = ($variable['other'] !=1 && ($spremenljivka['tip'] == 1 || $spremenljivka['tip'] == 3 || $spremenljivka['tip'] == 5 || $spremenljivka['tip'] == 8 )) ? false : true; if ($do_show) { $variable['var_cnt'] = $var_cnt; self::displayDescriptivesVariablaRow($spremenljivka,$grid,$variable,$_css); } $grid['new_grid'] = false; $var_cnt++; } } } //else: if (!$show_enota) } // end if $spremenljivka['tip'] != 'm' } // end foreach self::$_HEADERS echo '
 '.'' . $lang['srv_analiza_opisne_variable'] .''.'' . $lang['srv_analiza_opisne_variable_text'] .''.'' . $lang['srv_analiza_opisne_variable_type'] .''.'' . $lang['srv_analiza_opisne_variable_expression'] .''.'' . $lang['srv_analiza_opisne_variable_skala'] .''.'' . $lang['srv_analiza_opisne_m'] .''.'' . $lang['srv_analiza_num_units'] .''.'' . $lang['srv_analiza_opisne_povprecje_odstotek'] .''.'' . $lang['srv_analiza_opisne_odklon'] .''.'' . $lang['srv_analiza_opisne_min'] .''.'' . $lang['srv_analiza_opisne_max'] .''.'
'; // Izrisemo ikone na dnu if ( (!isset($_spid) || $_spid == null) && (count(self::$_LOOPS) == 0 || self::$_CURRENT_LOOP['cnt'] == count(self::$_LOOPS)) && ($_GET['m'] != 'analysis_creport') ) self::displayBottomSettings('desc'); } // end if else ($_headFileName == null) } /** Izriše vrstico z opisnimi * * @param unknown_type $spremenljivka * @param unknown_type $variable */ static function displayDescriptivesVariablaRow($spremenljivka,$grid,$variable=null) { global $lang; $cssBack = $variable['other'] != 1 ? ' anl_bck_desc_2' : ' anl_bck_desc_3'; $cssMove = $variable['other'] != 1 ? ' anl_tin' : ' anl_tin1'; $cssBack .= (int)$grid['new_grid'] == 1 ? ' anl_bt ' : ' anl_bt_dot '; $_sequence = $variable['sequence']; # id kolone z podatki if ($_sequence != null) { $_desc = self::$_DESCRIPTIVES[$_sequence]; } # pokličemo objekt SpremenljivkaSkala $objectSkala = new SpremenljivkaSkala($spremenljivka['spr_id']); # če smo na začetku grida dodamo podatke podvprašanja if ($variable['var_cnt'] == 0 && in_array($spremenljivka['tip'],array(16,19,20) ) ) { echo ''; echo ' '; echo ''; echo $grid['variable']; echo ''; echo ''; echo $grid['naslov']; echo ''; /* if (self::$_SHOW_LEGENDA) { echo ' '; echo ' '; echo ' '; } echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; */ echo ''; } echo ''; echo ''; echo ' '; echo ''; echo ''; echo $variable['variable']; echo ''; echo ''; //echo $grid['naslov'] . ' - ' .$variable['naslov']; echo $variable['naslov']; echo ($spremenljivka['enota'] == 1) ? ' - '.$variable['naslov2'] : ''; echo ''; if (self::$_SHOW_LEGENDA) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } echo ''.' '.''; echo ''.$_tip.''; echo '' .$_oblika. ''; } #veljavno echo ''.(int)$_desc['validCnt'].''; #ustrezno echo ''.(int)$_desc['allCnt'].''; echo ''; if ( isset($_desc['avg']) && (int)$objectSkala->getSkala() !== 1 ) { echo self::formatNumber($_desc['avg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); } else if (isset($_desc['avg']) && $spremenljivka['tip'] == 2 && (int)$objectSkala->getSkala() == 1 ) { echo self::formatNumber($_desc['avg']*100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),' %'); } echo ''; echo ''; if (isset($_desc['div']) && (int)$objectSkala->getSkala() !== 1) { echo self::formatNumber($_desc['div'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),''); } echo ''; echo ''.((int)$objectSkala->getSkala() !== 1 ? $_desc['min'] : '').''; echo ''.((int)$objectSkala->getSkala() !== 1 ? $_desc['max'] : '').''; echo ''; } /** Izriše vrstico z opisnimi * * @param unknown_type $spremenljivka * @param unknown_type $variable */ static function displayDescriptivesSpremenljivkaRow($spid,$spremenljivka,$show_enota,$_sequence = null) { global $lang; $cssBack = " anl_bck_desc_1"; if ($_sequence != null) { $_desc = self::$_DESCRIPTIVES[$_sequence]; } # pokličemo objekt SpremenljivkaSkala $objectSkala = new SpremenljivkaSkala($spremenljivka['spr_id']); echo ''; echo ''; self::showIcons($spid,$spremenljivka,'desc'); echo ''; echo ''; self::showVariable($spid,$spremenljivka['variable']); echo ''; echo ''; echo ($spremenljivka['naslov']) . ''; if (self::$_SHOW_LEGENDA) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } echo ''. self::getSpremenljivkaLegenda($spremenljivka,'tip') .''; echo ''.(!$show_enota ? $_tip : ' ').''; echo ''.(!$show_enota ? $_oblika : ' '). ''; } #veljavno echo ''.(!$show_enota ? (int)$_desc['validCnt'] : ' ') .''; #ustrezno echo ''.(!$show_enota ? (int)$_desc['allCnt'] : ' ').''; echo ''; if (isset($_desc['avg']) && (int)$objectSkala->getSkala() !== 1) { echo self::formatNumber($_desc['avg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); } echo ''; echo ''; if (isset($_desc['div']) && (int)$objectSkala->getSkala() !== 1) { echo self::formatNumber($_desc['div'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),''); } echo ''; echo ''.((int)$objectSkala->getSkala() !== 1 ? $_desc['min'] : '').''; echo ''.((int)$objectSkala->getSkala() !== 1 ? $_desc['max'] : '').''; echo ''; } /** Izrišemo fekvence * */ static function displayFrequency($_spid = null) { global $site_path, $lang; # preberemo header if (self::$headFileName !== null ) { #preberemo HEADERS iz datoteke self::$_HEADERS = unserialize(file_get_contents(self::$headFileName)); # odstranimo sistemske variable tipa email, ime, priimek, geslo self::removeSystemVariables(); # polovimo frekvence self::getFrequencys(); $vars_count = count(self::$_FILTRED_VARIABLES); $line_break = ''; foreach (self::$_HEADERS AS $spid => $spremenljivka) { # preverjamo ali je meta if (($spremenljivka['tip'] != 'm' && in_array($spremenljivka['tip'], self::$_FILTRED_TYPES )) && (!isset($_spid) || (isset($_spid) && $_spid == $spid))) { # ali imamo sfiltrirano spremenljivko if ($vars_count == 0 || ($vars_count > 0 && isset(self::$_FILTRED_VARIABLES[$spid]) ) ) { # prikazujemo v odvisnosti od kategorije spremenljivke switch ($spremenljivka['tip']) { case 1: # radio - prikjaže navpično case 2: #checkbox če je dihotomna: case 3: # dropdown - prikjaže navpično case 6: # multigrid case 4: # text case 7:# variabla tipa »število« case 8: # datum case 16: #multicheckbox če je dihotomna: case 17: #razvrščanje če je ordinalna case 18: # vsota case 19: # multitext case 20: # multi number case 21: # besedilo* case 22: # kalkulacija case 25: # kvota case 26: # lokacija self::frequencyVertical($spid); break; case 5: # nagovor self::sumNagovor($spid,'freq'); break; } } } // end if $spremenljivka['tip'] != 'm' } // end foreach self::$_HEADERS // Izrisemo ikone na dnu if ( (!isset($_spid) || $_spid == null) && (count(self::$_LOOPS) == 0 || self::$_CURRENT_LOOP['cnt'] == count(self::$_LOOPS)) && ($_GET['m'] != 'analysis_creport') ) self::displayBottomSettings('freq'); } // end if else ($_headFileName == null) } /** Izriše frekvence v vertikalni obliki * * @param unknown_type $spid */ static function frequencyVertical($spid) { global $lang; $spremenljivka = self::$_HEADERS[$spid]; # preverimo ali prikazujemo spremenljivko, glede na veljavne odgovore in nastavitev $only_valid = 0; 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 $only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; } } } # odstranimo še možne nepotrebne zapise za multigride if ($spremenljivka['tip'] == 6 || $spremenljivka['tip'] == 16 ) { $allGrids = count($spremenljivka['grids']); if ($allGrids > 0) { foreach ($spremenljivka['grids'] AS $gid => $grid) { $cntValidInGrid = 0; # dodamo dodatne vrstice z labelami grida if (count($grid['variables']) > 0 ) { foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki $cntValidInGrid+= (int)self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; } } # preverjamo ali lahko prikazujemo podkategorije if ($allGrids < AUTO_HIDE_ZERRO_VALUE || (int)$cntValidInGrid > 0) { $gidsCanShow[$gid] = true; } else { $gidsCanShow[$gid] = false; } } } } if (self::$hideEmptyValue == true || (is_countable(self::$_FREQUENCYS[$_sequence]['valid']) && count(self::$_FREQUENCYS[$_sequence]['valid']) > AUTO_HIDE_ZERRO_VALUE)) { foreach (self::$_FREQUENCYS[$_sequence]['valid'] AS $key => $valid) { if ((int)$valid['cnt'] == 0) { unset (self::$_FREQUENCYS[$_sequence]['valid'][$key]); } } } if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { return; } # če je besedilo * in je samo ena kategorija je inline legenda false $inline_legenda = (self::$_HEADERS[$spid]['cnt_all'] == 1 || in_array($spremenljivka['tip'],array(1,8) ) ) ? false: true; # koliko zapisov prikažemo naenkrat $num_show_records = self::getNumRecords(); echo '
'; self::displaySpremenljivkaIcons($spid); # tekst vprašanja echo ''; # naslovna vrstica echo ''; #variabla echo ''; #odgovori echo ''; echo ''; echo ''; #variabla echo ''; #odgovori echo ''; if (self::$_SHOW_LEGENDA && $inline_legenda){ echo ''; echo ''; } echo ''; echo ''; if (self::$_HEADERS[$spid]['show_valid_percent'] == true) { echo ''; } echo ''; echo ''; // konec naslovne vrstice // zeleno vrstico prikažemo samo skupaj z legendo if (self::$_SHOW_LEGENDA && $inline_legenda && in_array($spremenljivka['tip'],array(1,4,8)) ) { $css_bck = 'anl_bck_0_0 '; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; if (self::$_HEADERS[$spid]['show_valid_percent'] == true) { echo ''; } echo ''; echo ''; } $_answersOther = array(); # dodamo opcijo kje izrisujemo legendo $options=array('inline_legenda' => $inline_legenda, 'isTextAnswer' => false, 'isOtherAnswer' => false, 'num_show_records' => $num_show_records); # izpišemo vlejavne odgovore $_current_grid = null; if (count($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] AS $gid => $grid) { $_variables_count = count($grid['variables']); # indikator da smo na prvi variabli $first_variable = true; # dodamo še kontrolo za prikaz mgridov in mcheckov za več kot 20 vrednosti if ((!is_array($gidsCanShow) && !isset($gidsCanShow[$gid])) || (is_array($gidsCanShow) && isset($gidsCanShow[$gid]) && $gidsCanShow[$gid]== true)) # dodamo dodatne vrstice z albelami grida if ($_variables_count > 0 ) foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki $only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; if (($variable['text'] != true && $variable['other'] != true) || (in_array($spremenljivka['tip'],array(4,8,21,22,25,26,27)))){ # dodamo ime podvariable //if ($_variables_count > 1 && in_array($spremenljivka['tip'],array(2,6,7,16,17,18,19,20,21))) { if ($inline_legenda) { # ali rišemo dvojno črto med grupami if ( $_current_grid != $gid && $_current_grid !== null && $spremenljivka['tip'] != 6&& $spremenljivka['tip'] != 16) { $options['doubleTop'] = true; } else { $options['doubleTop'] = false; } if ($first_variable == true && $spremenljivka['tip'] == 16) { if ($_current_grid !== null) { $options['doubleTop'] = true; } self::outputSubGridVertical($spremenljivka,$variable,$grid,$spid,$options); $options['doubleTop'] = false; } $_current_grid = $gid; self::outputSubVariablaVertical($spremenljivka,$variable,$grid,$spid,$options); } $counter = 0; $_kumulativa = 0; #po potrebi posortiramo podatke if ($spremenljivka['tip'] == 7 && is_array(self::$_FREQUENCYS[$_sequence]['valid'])) { ksort(self::$_FREQUENCYS[$_sequence]['valid']); } //self::$_FREQUENCYS[$_sequence] if (count(self::$_FREQUENCYS[$_sequence]['valid'])> 0 ) { # tekstovne odgovore posortiramo kronološko if ($spremenljivka['tip'] == 21 || $spremenljivka['tip'] == 4) { $_valid_answers = self :: sortTextValidAnswers($spid,$variable,self::$_FREQUENCYS[$_sequence]['valid']); } else { $_valid_answers = self::$_FREQUENCYS[$_sequence]['valid']; } foreach ($_valid_answers AS $vkey => $vAnswer) { if ($counter < $num_show_records) { if ($vAnswer['cnt'] > 0 || true) { # izpisujemo samo tiste ki nisno 0 if (in_array($spremenljivka['tip'],array(4,7,8,19,20,21,26,27))) { // text, number, datum, mtext, mnumber, text*, lokacija,heatmap $options['isTextAnswer'] = true; } else { $options['isTextAnswer'] = false; } $counter = self::outputValidAnswerVertical($counter,$vkey,$vAnswer,$_sequence,$spid,$_kumulativa,$options); } } } # izpišemo sumo veljavnih $counter = self::outputSumaValidAnswerVertical($counter,$_sequence,$spid,$options); } if (count(self::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { foreach (self::$_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); } $first_variable = false; } } echo '
'; self::showVariable($spid,$spremenljivka['variable']); echo ''.$spremenljivka['naslov'].''; if($spremenljivka['tip'] == 2){ echo ' ('.$lang['srv_info_checkbox'].')'; } if (self::$_SHOW_LEGENDA) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } if (!$inline_legenda) { echo '
 ('.$_tip.')'.'
'; # .' / '.$_oblika } echo '
'.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } echo'
'; self::showIcons($spid,$spremenljivka,'freq'); echo ''.$lang['srv_analiza_frekvence_titleAnswers'] . ''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].''. $lang['srv_analiza_frekvence_titleFrekvenca'] .''. $lang['srv_analiza_frekvence_titleOdstotek'] .''. $lang['srv_analiza_frekvence_titleVeljavni'] .''. $lang['srv_analiza_frekvence_titleKumulativa'] .'
 '.$_tip.''.$_oblika.'    
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && self::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { echo '
'; self::outputOtherAnswers($oAnswers); echo '
'; } } echo '
'; echo '
'; } static function outputSubGridVertical($spremenljivka,$variable,$grid,$spid,$_options = array()) { global $lang; # 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 'doubleTop' =>false, # ali imamo novo grupa in nardimo dvojni rob ); foreach ($_options as $_oKey => $_option) { $options[$_oKey] = $_option; } $css_bck = 'anl_bck_freq_2 '; echo ''; echo ''; echo $grid['variable']; #echo $variable['variable']; echo ''; echo ''; // echo $grid['naslov'] . ' - ' .$variable['naslov']; echo $grid['naslov']; #echo $variable['naslov']; echo ''; if (self::$_SHOW_LEGENDA && $options['isOtherAnswer'] == false && $options['inline_legenda'] == true) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } echo ''.$_tip.''; echo ''.$_oblika.''; } echo ' '; echo ' '; if (self::$_HEADERS[$spid]['show_valid_percent'] == true) { echo ' '; } echo ' '; echo ''; } static function outputSubVariablaVertical($spremenljivka,$variable,$grid,$spid,$_options = array()) { global $lang; # 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 'doubleTop' =>false, # ali imamo novo grupa in nardimo dvojni rob ); foreach ($_options as $_oKey => $_option) { $options[$_oKey] = $_option; } $css_bck = 'anl_bck_freq_2 '; echo ''; echo ''; echo $variable['variable']; echo ''; echo ''; // echo $grid['naslov'] . ' - ' .$variable['naslov']; echo $variable['naslov']; echo ($spremenljivka['enota'] == 1) ? ' - '.$variable['naslov2'] : ''; echo ''; if (self::$_SHOW_LEGENDA && $options['isOtherAnswer'] == false && $options['inline_legenda'] == true) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } echo ''.$_tip.''; echo ''.$_oblika.''; } echo ' '; echo ' '; if (self::$_HEADERS[$spid]['show_valid_percent'] == true) { echo ' '; } echo ' '; echo ''; } /** izrišemo arhive analiz * */ static function displayAnalysisArchive() { global $lang; if (self::$dataFileStatus != FILE_STATUS_NO_DATA && self::$dataFileStatus != -3 && self::$noHeader != true) { echo '
'; SurveyAnalysisArchive :: Init(self::$sid); SurveyAnalysisArchive :: ListArchive(); echo '
'; echo '
'; } else{ echo '
'; echo '
'; echo ''.$lang['srv_archive_analysis'].''; Common::noDataAlert(); echo '
'; echo '
'; echo '
'; } } /** Izrišemo sumarnik * */ static function displaySums($_spid = null) { global $site_path; # preberemo header if (self::$headFileName === null ) { // die ('
NAPAKA!!! Manjkajo datoteke s podatki. Kreiraj datoteke s podatki!
'); } else { #preberemo HEADERS iz datoteke if (self::$headFileName == null) { echo "
Napaka"; die(); } self::$_HEADERS = unserialize(file_get_contents(self::$headFileName)); # odstranimo sistemske variable tipa email, ime, priimek, geslo self::removeSystemVariables(); #print_r("
");
		#print_r(self::$_HEADERS);
		#print_r("
"); # polovimo frekvence self::getFrequencys(); $vars_count = count(self::$_FILTRED_VARIABLES); $line_break = ''; if (!empty(self::$_HEADERS)) foreach (self::$_HEADERS AS $spid => $spremenljivka) { # preverjamo ali je meta if ( ($spremenljivka['tip'] != 'm' && in_array($spremenljivka['tip'], self::$_FILTRED_TYPES ) ) && (!isset($_spid) || (isset($_spid) && $_spid == $spid)) ) { # ali imamo sfiltrirano spremenljivko if ($vars_count == 0 || ($vars_count > 0 && isset(self::$_FILTRED_VARIABLES[$spid]) ) ) { echo $line_break; #print_r($spremenljivka['tip']); # 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::sumHorizontalCheckbox($spid); 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: case 25: # kalkulacija self::sumNumberVertical($spid,'sums'); break; case 26: # lokacija self::sumMultiText($spid,'sums'); break; case 27: # heatmap self::sumMultiTextHeatMap($spid,'sums',true, true); break; case 5: # nagovor self::sumNagovor($spid,'sums'); break; default: print_r("TODO: Sums for type:".$spremenljivka['tip']); break; } } } // end if $spremenljivka['tip'] != 'm' } // end foreach self::$_HEADERS // Izrisemo ikone na dnu if ( (!isset($_spid) || $_spid == null) && (!is_countable(self::$_LOOPS) || count(self::$_LOOPS) == 0 || self::$_CURRENT_LOOP['cnt'] == count(self::$_LOOPS)) && ($_GET['m'] != 'analysis_creport') ) self::displayBottomSettings('sums'); } // end if else ($_headFileName == null) } /** Izrišemo nov sumarnik za določene spremenljivke * */ static function displaySumsNew($_spid = null) { global $site_path; # preberemo header if (self::$headFileName === null ) { // die ('
NAPAKA!!! Manjkajo datoteke s podatki. Kreiraj datoteke s podatki!
'); } else { #preberemo HEADERS iz datoteke self::$_HEADERS = unserialize(file_get_contents(self::$headFileName)); # odstranimo sistemske variable tipa email, ime, priimek, geslo self::removeSystemVariables(); # polovimo frekvence self::getFrequencys(); $vars_count = count(self::$_FILTRED_VARIABLES); $line_break = ''; foreach (self::$_HEADERS AS $spid => $spremenljivka) { # preverjamo ali je meta if (($spremenljivka['tip'] != 'm' && in_array($spremenljivka['tip'], self::$_FILTRED_TYPES )) && (!isset($_spid) || (isset($_spid) && $_spid == $spid))) { # ali imamo sfiltrirano spremenljivko if ($vars_count == 0 || ($vars_count > 0 && isset(self::$_FILTRED_VARIABLES[$spid]) ) ) { echo $line_break; if (self :: $show_spid_div == true) { echo '
'; } self::displaySpremenljivkaIcons($spid); # prikazujemo v odvisnosti od kategorije spremenljivke switch ($spremenljivka['tip']) { case 1: # radio - prikjaže navpično self::sumHorizontal($spid,'sums*'); break; case 2: #checkbox če je dihotomna: #self::sumVerticalCheckbox($spid,'sums*'); self::sumHorizontalCheckbox($spid,'sums*'); break; case 3: # dropdown - prikjaže navpično self::sumVertical($spid,'sums*'); break; case 6: # multigrid self::sumHorizontal($spid,'sums'); /* 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::sumVerticalCheckbox($spid,'sums*'); break; case 17: #razvrščanje če je ordinalna self::sumHorizontal($spid,'sums*'); break; case 4: # text case 8: # datum case 19: # multitext case 21: # besedilo* # varabla tipa »besedilo« je v sumarniku IDENTIČNA kot v FREKVENCAH. self::sumTextVertical($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: self::sumMultiNumberVertical($spid,'sums*'); /* # Č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 26: # lokacija self::sumMultiText($spid,'sums'); break; case 27: # heatmap self::sumMultiTextHeatMap($spid,'sums',true, true); break; case 5: # nagovor self::sumNagovor($spid,'sums*'); break; } if (self :: $show_spid_div == true) { echo '
'; // id="sum_'.$keyGrupe.'">'; } $line_break = "
"; } } // end if $spremenljivka['tip'] != 'm' } // end foreach self::$_HEADERS } // end if else ($_headFileName == null) } /** Izriše sumarnik v vertikalni obliki * * @param unknown_type $spid */ static function sumVertical($spid,$_from) { global $lang; $spremenljivka = self::$_HEADERS[$spid]; # preverimo ali prikazujemo spremenljivko, glede na veljavne odgovore in nastavitev $only_valid = 0; 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 $only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; } } } if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { return; } # dodamo opcijo kje izrisujemo legendo $inline_legenda = false; # koliko zapisov prikažemo naenkrat $num_show_records = self::getNumRecords(); $options=array('inline_legenda' => $inline_legenda, 'isTextAnswer' => false, 'isOtherAnswer' => false, 'num_show_records' => $num_show_records); if (self :: $show_spid_div == true) { echo '
'; } self::displaySpremenljivkaIcons($spid); if (self::$hideEmptyValue == true || (is_countable(self::$_FREQUENCYS[$_sequence]['valid']) && count(self::$_FREQUENCYS[$_sequence]['valid']) > AUTO_HIDE_ZERRO_VALUE)) { foreach (self::$_FREQUENCYS[$_sequence]['valid'] AS $key => $valid) { if ((int)$valid['cnt'] == 0) { unset (self::$_FREQUENCYS[$_sequence]['valid'][$key]); } } } # tekst vprašanja echo ''; # naslovna vrstica echo ''; #variabla echo ''; #odgovori $show_valid_percent = (self::$_HEADERS[$spid]['show_valid_percent'] == true) ? 1 : 0; echo ''; echo ''; echo ''; #variabla echo ''; #odgovori echo ''; if (self::$_SHOW_LEGENDA && $inline_legenda){ echo ''; echo ''; } echo ''; echo ''; if (self::$_HEADERS[$spid]['show_valid_percent'] == true) { echo ''; } echo ''; echo ''; // konec naslovne vrstice // zeleno vrstico prikažemo samo skupaj z legendo if (self::$_SHOW_LEGENDA && false) { $css_bck = 'anl_bck_0_0 '; echo ''; echo ''; echo ''; if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } echo ''; echo ''; echo ''; echo ''; if (self::$_HEADERS[$spid]['show_valid_percent'] == true) { echo ''; } echo ''; echo ''; } $_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) { $counter = 0; $_kumulativa = 0; //self::$_FREQUENCYS[$_sequence] if (count(self::$_FREQUENCYS[$_sequence]['valid'])> 0 ) { foreach (self::$_FREQUENCYS[$_sequence]['valid'] AS $vkey => $vAnswer) { // za povprečje $xi = (int)$vkey; $fi = (int)$vAnswer['cnt']; $sum_xi_fi += $xi * $fi; $N += $fi; if ($counter < $num_show_records) { 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(self::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { foreach (self::$_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 = (int)$_tmp_div_data['xi']; $fi = (int)$_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 && self::$_HEADERS[$spid]['skala'] != 1) { $css_bck = 'anl_bck'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''.$spremenljivka['naslov'].''; if (self::$_SHOW_LEGENDA) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } echo '
 ('.$_tip.')'.'
'; } if (self::$_SHOW_LEGENDA) { echo '
'.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } echo '
'; self::showIcons($spid,$spremenljivka,$_from); echo ''.$lang['srv_analiza_frekvence_titleAnswers'] . ''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].''. $lang['srv_analiza_frekvence_titleFrekvenca'] .''. $lang['srv_analiza_frekvence_titleOdstotek'] .''. $lang['srv_analiza_frekvence_titleVeljavni'] .''. $lang['srv_analiza_frekvence_titleKumulativa'] .'
 '.$_tip.''.$_oblika.'    
 
 '.$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 && self::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { echo '
'; self::outputOtherAnswers($oAnswers); echo '
'; } } if (self :: $show_spid_div == true) { echo '
'; echo '
'; } } /** Izriše sumarnik v horizontalni obliki za multi checbox * * @param unknown_type $spid - spremenljivka ID */ static function sumMultiHorizontalCheckbox($spid,$_from) { global $lang; $spremenljivka = self::$_HEADERS[$spid]; # preverimo ali prikazujemo spremenljivko, glede na veljavne odgovore in nastavitev $only_valid = 0; $gidsCanShow=array(); $allGrids = count($spremenljivka['grids']); if ($allGrids > 0) { foreach ($spremenljivka['grids'] AS $gid => $grid) { $cntValidInGrid = 0; # dodamo dodatne vrstice z labelami grida if (count($grid['variables']) > 0 ) { foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki #$only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; $only_valid += (int)self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; $cntValidInGrid+= (int)self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; } } # preverjamo ali lahko prikazujemo podkategorije if ($allGrids < AUTO_HIDE_ZERRO_VALUE || (int)$cntValidInGrid > 0) { $gidsCanShow[$gid] = true; } else { $gidsCanShow[$gid] = false; } } } if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { return; } $_answersOther = array(); # ugotovimo koliko imamo kolon $gid=0; $_clmn_cnt = self::$_HEADERS[$spid]['grids'][$gid]['cnt_vars']-self::$_HEADERS[$spid]['grids'][$gid]['cnt_other']; # tekst vprašanja $css_hide_enote = isset($_POST['navedbe']) && $_POST['navedbe'] == '1' ? ' displayNone' : ''; $css_hide_navedbe = isset($_POST['navedbe']) && $_POST['navedbe'] == '1' ? '' : ' displayNone'; if (self :: $show_spid_div == true) { echo '
'; } self::displaySpremenljivkaIcons($spid); # odgovori echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA) { echo ''; echo ''; } echo ''; echo ''; echo ''; echo ''; $bck_css = ' anl_bck_0_0'; $_variables = self::$_HEADERS[$spid]['grids'][$gid]['variables']; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA) { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); echo ''; //'.$_tip.' echo ''; // '.$_oblika.' } if (count($_variables) > 0) { foreach ($_variables AS $vkey => $variable) { if ($variable['other'] != true) { echo ''; } } } //echo ''; echo ''; echo ''; echo ''; foreach (self::$_HEADERS[$spid]['grids'] AS $gid => $grids) { if ($gidsCanShow[$gid]) { $_cnt = 0; # vodoravna vrstice s podatki $css_back = ' anl_bck_desc_2'; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA) { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); echo ''; echo ''; } $_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 = self::$_FREQUENCYS[$_sequence]['validCnt']; $_cnt = self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; $_arguments += $_cnt; $_max_appropriate = max($_max_appropriate, (int)self::$_FREQUENCYS[$_sequence]['allCnt']); $_max_cnt = max ($_max_cnt, ((int)(self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']+(int)self::$_FREQUENCYS[$_sequence]['valid']['0']['cnt']))); if ($variable['other'] == true) { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vkey,'sequence'=>$_sequence); } if ($variable['other'] != true) { echo ''; } } # veljavno echo ''; #ustrezno echo ''; echo ''; } } echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''; echo ''.$spremenljivka['naslov'].''; if (self::$_SHOW_LEGENDA) { echo '
  '.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } // echo ' ('.$lang['srv_analiza_opisne_answers'].' / '.$lang['srv_analiza_opisne_arguments'].')'; echo ' ('.$lang['srv_analiza_opisne_units'].' / '.$lang['srv_analiza_opisne_arguments'].')'; echo ' ('.$lang['srv_analiza_opisne_units'].' / '.$lang['srv_analiza_opisne_arguments'].')'; echo '
'; self::showIcons($spid,$spremenljivka,$_from, array('navedbe'=>false)); echo ''; echo $lang['srv_analiza_opisne_subquestion']; echo ''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].''; echo $lang['srv_analiza_opisne_answers'].' '; echo ' (/ %)'; echo ' (/ %)'; echo ' (f / %)'; echo ''.$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'].''.$_tip.''.$_oblika.''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
0 ? ' vkey="1"' : '') .'" style="padding:5px 0px;">'.$_cnt.'
'; $_percent = ($_valid > 0 ) ? $_cnt * 100 / $_valid : 0; echo self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); echo '
'; echo '
'.$_max_cnt.''.$_max_appropriate.'
'; echo '
'; # navedbe echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA) { echo ''; echo ''; } echo ''; echo ''; $bck_css = ' anl_bck_0_0'; $_variables = self::$_HEADERS[$spid]['grids'][$gid]['variables']; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA) { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); echo ''; //'.$_tip.' echo ''; // '.$_oblika.' } foreach ($_variables AS $vkey => $variable) { if ($variable['other'] != true) { echo ''; } } echo ''; echo ''; foreach (self::$_HEADERS[$spid]['grids'] AS $gid => $grids) { $_cnt = 0; # vodoravna vrstice s podatki $css_back = ' anl_bck_desc_2'; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA) { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); echo ''; echo ''; } $_arguments = 0; $_max_appropriate = 0; $_max_cnt = 0; // prikaz frekvenc foreach ($grids['variables'] AS $vkey => $variable) { $_sequence = $variable['sequence']; $_valid = self::$_FREQUENCYS[$_sequence]['validCnt']; $_cnt = self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; $_arguments += $_cnt; $_max_appropriate = max($_max_appropriate, (int)self::$_FREQUENCYS[$_sequence]['allCnt']); $_max_cnt = max ($_max_cnt, ((int)(self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']+(int)self::$_FREQUENCYS[$_sequence]['valid']['0']['cnt']))); if ($variable['other'] == true) { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vkey,'sequence'=>$_sequence); } if ($variable['other'] != true) { $_percent = ($_valid > 0 ) ? $_cnt * 100 / $_valid : 0; } } foreach ($grids['variables'] AS $vkey => $variable) { if ($variable['other'] != true) { $_sequence = $variable['sequence']; $_cnt = self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; echo ''; } } echo ''; echo ''; } echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''; echo ''.$spremenljivka['naslov'].''; if (self::$_SHOW_LEGENDA) { echo '
  '.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } // echo ' ('.$lang['srv_analiza_opisne_units'].' / '.$lang['srv_analiza_opisne_arguments'].')'; echo ' ('.$lang['srv_analiza_opisne_units'].' / '.$lang['srv_analiza_opisne_arguments'].')'; echo ' ('.$lang['srv_analiza_opisne_units'].' / '.$lang['srv_analiza_opisne_arguments'].')'; echo '
'; self::showIcons($spid,$spremenljivka,$_from, array('navedbe'=>true)); echo ''; echo $lang['srv_analiza_opisne_subquestion']; echo ''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].''; echo $lang['srv_analiza_opisne_arguments'].' '; echo ' (/ %)'; echo ' (/ %)'; echo ' (f / %)'; echo '
    ' . $variable['naslov'].' ('.$variable['gr_id']. ') ' . $lang['srv_anl_suma1'] . '
'.$grids['variable'].''.$grids['naslov'].''.$_tip.''.$_oblika.''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
0 ? ' vkey="1"' : '') .' style="padding:5px 0px;">'.$_cnt.'
'; $_percent = ($_arguments > 0 ) ? $_cnt * 100 / $_arguments : 0; echo self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'.$_arguments.'
'; $_percent = ($_arguments > 0 ) ? $_arguments * 100 / $_arguments : 0; echo self::formatNumber('100',SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); echo '
'; echo '
'; echo '
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && self::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { echo '
'; self::outputOtherAnswers($oAnswers); echo '
'; } } if (self :: $show_spid_div == true) { echo '
'; echo '
'; } } /** Izriše sumarnik v horizontalni obliki za checbox * * @param unknown_type $spid - spremenljivka ID */ static function sumHorizontalCheckbox($spid,$_from) { global $lang; $spremenljivka = self::$_HEADERS[$spid]; # preverimo ali prikazujemo spremenljivko, glede na veljavne odgovore in nastavitev $only_valid = 0; 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 $only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; } } } if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { return; } $_answersOther = array(); # ugotovimo koliko imamo kolon $gid=0; $_clmn_cnt = self::$_HEADERS[$spid]['grids'][$gid]['cnt_vars']-self::$_HEADERS[$spid]['grids'][$gid]['cnt_other']; foreach (self::$_HEADERS[$spid]['grids'][$gid]['variables'] AS $vid => $variable) { $_sequence = $variable['sequence']; $_valid_cnt = max($_valid_cnt, self::$_FREQUENCYS[$_sequence]['validCnt']); $_approp_cnt = max($_approp_cnt, self::$_FREQUENCYS[$_sequence]['allCnt']); if ($variable['other'] == true) { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } } if (self :: $show_spid_div == true) { echo '
'; } self::displaySpremenljivkaIcons($spid); # tekst vprašanja echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA) { echo ''; echo ''; } echo ''; echo ''; echo ''; echo ''; $bck_css = ' anl_bck_desc_2'; $_variables = self::$_HEADERS[$spid]['grids'][$gid]['variables']; echo ''; echo ''; if (self::$_SHOW_LEGENDA) { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); echo ''; echo ''; } foreach ($_variables AS $vkey => $variable) { if ($variable['other'] != true) { echo ''; } } echo ''; echo ''; echo ''; # vodoravna vrstice s podatki echo ''; echo ''; // prikaz frekvenc foreach ($_variables AS $vkey => $variable) { if ($variable['other'] != true) { $_sequence = $variable['sequence']; $cnt = self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; echo ''; } } echo ''; echo ''; echo ''; // dodamo še veljavne procente echo ''; echo ''; foreach ($_variables AS $vkey => $variable) { if ($variable['other'] != true) { $_sequence = $variable['sequence']; $cnt = self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; $percent = ( $_valid_cnt > 0) ? 100*$cnt / $_valid_cnt : 0; echo ''; } } echo ''; echo ''; echo ''; // dodamo še procente echo ''; echo ''; foreach ($_variables AS $vkey => $variable) { if ($variable['other'] != true) { $_sequence = $variable['sequence']; $cnt = self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; $percent = ( $_approp_cnt > 0) ? 100*$cnt / $_approp_cnt : 0; echo ''; } } echo ''; echo ''; echo ''; echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''; echo ''.$spremenljivka['naslov'].''; if (self::$_SHOW_LEGENDA) { echo '
'.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } echo '
'; self::showIcons($spid,$spremenljivka,$_from); echo ''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].''.$lang['srv_analiza_opisne_answers']; echo ' (/ %)'; echo ' (/ %)'; echo ' (f / %)'; echo ''.$lang['srv_analiza_opisne_valid'].''.$lang['srv_analiza_num_units'].'
 '.$_tip.''.$_oblika.'' . $variable['naslov'] . '  
'.$lang['srv_analiza_frekvence_titleFrekvenca'].''.$cnt.''.$_valid_cnt.''.$_approp_cnt.'
'.$lang['srv_analiza_frekvence_titleOdstotekVeljavni'].''.self::formatNumber($percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%').'  
'.$lang['srv_analiza_frekvence_titleOdstotekEnote'].''.self::formatNumber($percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%').'  
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && self::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { echo '
'; self::outputOtherAnswers($oAnswers); echo '
'; } } if (self :: $show_spid_div == true) { echo '
'; echo '
'; } } static function sumVerticalCheckbox($spid,$_from) { global $lang; $spremenljivka = self::$_HEADERS[$spid]; # preverimo ali prikazujemo spremenljivko, glede na veljavne odgovore in nastavitev $all_categories_cnt = 0; $only_valid = 0; 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 ){ $all_categories_cnt++; $_sequence = $variable['sequence']; # id kolone z podatki $only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; } } } } if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { return; } $_answersOther = array(); $inline_legenda = count ($spremenljivka['grids']) > 1; if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::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], self::$_FREQUENCYS[$_sequence]['validCnt']); $_approp_cnt[$gid] = max($_approp_cnt[$gid], self::$_FREQUENCYS[$_sequence]['allCnt']); if ($variable['other'] == true) { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } $_valid[$gid][$vid] = self::$_FREQUENCYS[$_sequence]['valid']; $_navedbe[$gid] += self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; } } $veljavni_percent = ($spremenljivka['tip'] == 2 || $spremenljivka['tip'] == 16) ? true : false; $css_txt = 'anl_variabla_line'; if (self :: $show_spid_div == true) { echo '
'; } self::displaySpremenljivkaIcons($spid); echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; $css_txt = 'anl_variabla_line'; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA && $inline_legenda) { echo ''; echo ''; } echo ''; echo ''; echo ''; echo ''; if ($veljavni_percent) { echo ''; } echo ''; $cssBack = "anl_bck anl_variabla_line "; $_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) { $_sequence = $variable['sequence']; #po potrebi prikažemo samo tiste ki imajo vrednosti if (($all_categories_cnt <= AUTO_HIDE_ZERRO_VALUE) || (int)self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt'] > 0 ) if ($variable['other'] != 1) { # dodamo labele podvprašanja if ($spremenljivka['tip'] == 16 && (($vid == 0 && $gid != 0) || ($vid == 0 && $gid == 0))) { $cssBack = "anl_bck_desc_2 ".($vid == 0 && $gid != 0 ? 'anl_double_bt ' : ''); echo ''; echo ''; echo ''; echo ''; } $cssBack = "anl_bck_desc_2 "; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA && $inline_legenda) { echo ''; echo ''; } echo ''; $_max_appropriate = max($_max_appropriate, (int)self::$_FREQUENCYS[$_sequence]['allCnt']); $_max_valid = max ($_max_valid, ((int)(self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']+(int)self::$_FREQUENCYS[$_sequence]['valid']['0']['cnt']))); # veljavno echo ''; echo ''; #ustrezno echo ''; # veljavno % if ($veljavni_percent) { $valid = (int)(self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']+(int)self::$_FREQUENCYS[$_sequence]['valid']['0']['cnt']); $valid = (int)self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; $_percent = ($_max_appropriate > 0 ) ? 100*$valid / $_max_appropriate : 0; echo ''; } echo ''; } else { # drugo } } $cssBack = " anl_bck_2 red"; echo ''; echo ''; echo ''; echo ''; //.$_approp_cnt[$gid]. echo ''; echo ''; //.self::formatNumber('100',SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%') echo ''; //$lang['srv_anl_suma_entries'] if ($veljavni_percent) { $_percent = ($_max_appropriate > 0 ) ? 100*$_max_valid / $_max_appropriate : 0; echo ''; } echo ''; } echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''.$spremenljivka['naslov'].' ('.$lang['srv_info_checkbox'].')'; if (self::$_SHOW_LEGENDA && !$inline_legenda) { echo '
 ('.$_tip.')'.'
'; } if (self::$_SHOW_LEGENDA) { echo '
  '.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } echo ' ('.$lang['srv_analiza_opisne_units'].' / '.$lang['srv_analiza_opisne_arguments'].')'; echo ' ('.$lang['srv_analiza_opisne_units'].' / '.$lang['srv_analiza_opisne_arguments'].')'; echo '
'; self::showIcons($spid,$spremenljivka,$_from, array('navedbe'=>false)); echo ''.$lang['srv_analiza_opisne_subquestion'].''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].''.$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'].'
'.$grid['variable'].''.$grid['naslov'].'
'.$variable['variable'].''.$variable['naslov'].''.$_tip.''.$_oblika.''; echo (int)self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; echo ''; echo (int)(self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']+(int)self::$_FREQUENCYS[$_sequence]['valid']['0']['cnt']); echo ''; $_percent = (self::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ) ? 100*self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt'] / self::$_FREQUENCYS[$_sequence]['validCnt'] : 0; echo self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); echo ''; echo (int)self::$_FREQUENCYS[$_sequence]['allCnt']; echo ''; echo self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); echo '
 '.$lang['srv_anl_suma_valid'].' '.$_max_valid.' '.$_max_appropriate.''; echo self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); echo '
'; echo '
'; // div_navedbe_1_'.$spid.' # še navedbe echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; $css_txt = 'anl_variabla_line'; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA && $inline_legenda) { echo ''; echo ''; } echo ''; echo ''; echo ''; echo ''; $cssBack = "anl_bck anl_variabla_line "; if (count ($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] as $gid => $grid) { if (count ($grid['variables']) > 0) foreach ($grid['variables'] AS $vid => $variable) { $_sequence = $variable['sequence']; #po potrebi prikažemo samo tiste ki imajo vrednosti if (($all_categories_cnt <= AUTO_HIDE_ZERRO_VALUE) || (int)self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt'] > 0 ) if ($variable['other'] != 1) { # dodamo labele podvprašanja if ($spremenljivka['tip'] == 16 && (($vid == 0 && $gid != 0) || ($vid == 0 && $gid == 0))) { $cssBack = 'anl_bck_desc_2'.($vid == 0 && $gid != 0 ? ' anl_double_bt ' : ''); echo ''; echo ''; echo ''; echo ''; } $cssBack = "anl_bck_desc_2 "; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA && $inline_legenda) { echo ''; echo ''; } echo ''; echo ''; echo ''; } else { # drugo } } $cssBack = " anl_bck_2 red"; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''.$spremenljivka['naslov'].''; if (self::$_SHOW_LEGENDA && !$inline_legenda) { echo '
 ('.$_tip.')'.'
'; } if (self::$_SHOW_LEGENDA) { echo '
  '.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } echo ' ('.$lang['srv_analiza_opisne_units'].' / '.$lang['srv_analiza_opisne_arguments'].')'; echo ' ('.$lang['srv_analiza_opisne_units'].' / '.$lang['srv_analiza_opisne_arguments'].')'; echo '
'; self::showIcons($spid,$spremenljivka,$_from, array('navedbe'=>true)); echo ''.$lang['srv_analiza_opisne_subquestion'].''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].''.$lang['srv_analiza_opisne_frequency'].'%
'.$grid['variable'].''.$grid['naslov'].'
'.$variable['variable'].''.$variable['naslov'].''.$_tip.''.$_oblika.''. self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt'].''; $_percent = ($_navedbe[$gid] > 0 ) ? 100*self::$_FREQUENCYS[$_sequence]['valid']['1']['cnt'] / $_navedbe[$gid] : 0; echo self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); echo '
 '.$lang['srv_anl_suma_valid'].''.$_navedbe[$gid].''.self::formatNumber('100',SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%').'
'; echo '
'; // Konec div_navedbe_2_$spid # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && self::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { echo '
'; self::outputOtherAnswers($oAnswers); echo '
'; } } if (self :: $show_spid_div == true) { echo '
'; echo '
'; } } /** Izriše sumarnik v horizontalni obliki za multigrid * * @param unknown_type $spid - spremenljivka ID */ static function sumHorizontal($spid,$_from) { global $lang; $spremenljivka = self::$_HEADERS[$spid]; # preverimo ali prikazujemo spremenljivko, glede na veljavne odgovore in nastavitev $only_valid = 0; 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 $only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; } } } if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { return; } #$_invalidAnswers = self :: getInvalidAnswers (MISSING_TYPE_FREQUENCY); $_invalidAnswers = self :: getInvalidAnswers (MISSING_TYPE_DESCRIPTOR); #$_allMissing_answers = SurveyMissingValues::GetMissingValuesForSurvey(array(1,2,3)); # opcije nareedimo posebej, da po potrebi zajamemo tudi misinge $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='".$spid."' ORDER BY vrstni_red"; $qry = sisplet_query($str_qry); while ($row = mysqli_fetch_assoc($qry)) { if ($row['other'] != 0 && !isset($_invalidAnswers[$row['other']])) { # če prikazujemo misinge dodamo -99 kot mising $spremenljivka['options'][$row['other']] = $row['naslov']; } } $_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; } if (self :: $show_spid_div == true) { echo '
'; } self::displaySpremenljivkaIcons($spid); echo ''; echo ''; echo ''; echo ''; echo ''; $css_txt = 'anl_variabla_line'; echo ''; echo ''; if ($_sub_question_col) { echo ''; } if (self::$_SHOW_LEGENDA) { echo ''; echo ''; } echo ''; echo ''; echo ''; if ($additional_field) { echo ''; echo ''; } echo ''; $cssBack = "anl_bck_0_0 "; $_variables = $grid['variables']; echo ''; echo ''; if ( $_sub_question_col ) { echo ''; } if (self::$_SHOW_LEGENDA) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } echo ''; //$_tip echo ''; // $_oblika } //nastavitve iz baze za ureditev pravilnega izrisa analize za tabelo s trakom $row = Cache::srv_spremenljivka($spid); $spremenljivkaParams = new enkaParameters($row['params']); $diferencial_trak = ($spremenljivkaParams->get('diferencial_trak') ? $spremenljivkaParams->get('diferencial_trak') : 0); $diferencial_trak_starting_num = ($spremenljivkaParams->get('diferencial_trak_starting_num') ? $spremenljivkaParams->get('diferencial_trak_starting_num') : 0); //nastavitve iz baze za ureditev pravilnega izrisa analize za tabelo s trakom if (count($spremenljivka['options']) > 0) { foreach ( $spremenljivka['options'] as $key => $kategorija) { if($diferencial_trak){ //ce je trak, je potrebno naslove stolpcev spremeniti v vrednosti na traku $_label = $diferencial_trak_starting_num; $diferencial_trak_starting_num++; }else{ // misinge imamo zdruzene $_label = $kategorija; } echo ''; } } echo ''; echo ''; echo ''; if ($additional_field) { echo ''; echo ''; } echo ''; $part=null; #zlopamo skozi gride if (count($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] AS $gid => $grid) { # za dvojne gride if ((int)$grid['part'] > 0) { if ($part == null || $part == $grid['part'] ) { $part_css = ''; } else { $part_css = ' anl_double_bt '; } $part = $grid['part']; } else { $part_css = ''; } $cssBack = "anl_bck_desc_2 "; # zloopamo skozi variable if (count($grid['variables']) > 0) foreach ($grid['variables'] AS $vid => $variable ) { $_sequence = $variable['sequence']; #popotrebi izpisujemo samo veljavne if ((count($spremenljivka['grids']) <= AUTO_HIDE_ZERRO_VALUE || (self::$_FREQUENCYS[$_sequence]['allCnt'] - self::$_FREQUENCYS[$_sequence]['invalidCnt']) > 0)) if ($variable['other'] != true) { echo ''; if ($_sub_question_col) { echo ''; } else { echo ''; } if (self::$_SHOW_LEGENDA) { echo ''; echo ''; } # 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 = self::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt']; $sum_xi_fi += $xi * $fi ; $N += $fi; } echo ''; } } // suma echo ''; // zamenjano veljavni ustrezni echo ''; echo ''; 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 = self::$_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; echo ''; echo ''; } echo ''; } else { # immamo polje drugo $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } } } echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''; echo ''.$spremenljivka['naslov'].''; if (self::$_SHOW_LEGENDA) { echo '
'.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } echo '
'; self::showIcons($spid,$spremenljivka,$_from); echo ''.$lang['srv_analiza_opisne_subquestion'].''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].''.$lang['srv_analiza_opisne_answers']; echo ' (/ %)'; echo ' (/ %)'; echo ' (f / %)'; echo ''.$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'].'    
'; echo $variable['variable']; echo ''; echo $variable['naslov']; // dodatek desne strani sem. diferenciala echo ($spremenljivka['enota'] == 1) ? ' - '.$variable['naslov2'] : ''; echo ' '.$_tip.''.$_oblika.''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
0 ? ' vkey="'.$key.'"' : '') .' style="padding:5px 0px;">'.self::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt'].'
'; $_percent = (self::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ) ? self::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt'] * 100 / self::$_FREQUENCYS[$_sequence]['validCnt'] : 0; echo self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'.((int)self::$_FREQUENCYS[$_sequence]['validCnt']).'
'.self::formatNumber(100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%').'
'; echo '
'; echo (int)self::$_FREQUENCYS[$_sequence]['validCnt']; echo ''.(int)self::$_FREQUENCYS[$_sequence]['allCnt'].''; echo self::formatNumber($avg,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; echo self::formatNumber($div,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),''); echo '
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && self::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { echo '
'; self::outputOtherAnswers($oAnswers); echo '
'; } } if (self :: $show_spid_div == true) { echo '
'; echo '
'; } } /** Izriše sumarnik v horizontalni obliki za dvojni multigrid * * @param unknown_type $spid - spremenljivka ID */ static function sumDoubleHorizontal($spid,$_from) { global $lang; $spremenljivka = self::$_HEADERS[$spid]; # preverimo ali prikazujemo spremenljivko, glede na veljavne odgovore in nastavitev $only_valid = 0; 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 $only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; } } } if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { return; } $_answersOther = array(); $_clmn_cnt = count($spremenljivka['options'])*2; # pri radiu in dropdown ne prikazujemo podvprašanj $_sub_question_col = 6; if (self :: $show_spid_div == true) { echo '
'; } self::displaySpremenljivkaIcons($spid); echo ''; echo ''; echo ''; echo ''; echo ''; $css_txt = 'anl_variabla_line'; echo ''; echo ''; if ($_sub_question_col) { echo ''; } if (self::$_SHOW_LEGENDA) { echo ''; echo ''; } echo ''; #št. enot echo ''; echo ''; #naslovi podskupin $cssBack = "anl_bck_0_0 "; $_variables = $grid['variables']; echo ''; echo ''; if ( $_sub_question_col ) { echo ''; } if (self::$_SHOW_LEGENDA) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } echo ''; //$_tip echo ''; // $_oblika } echo ''; echo ''; #št. enot echo ''; echo ''; # naslovi variabel $cssBack = "anl_bck_0_0 "; $_variables = $grid['variables']; echo ''; echo ''; if ( $_sub_question_col ) { echo ''; } if (self::$_SHOW_LEGENDA) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } echo ''; //$_tip echo ''; // $_oblika } if (count($spremenljivka['options']) > 0) { foreach ( $spremenljivka['options'] as $key => $kategorija) { // misinge imamo zdruzene $_label = $kategorija; echo ''; } } echo ''; echo ''; echo ''; if (count($spremenljivka['options']) > 0) { foreach ( $spremenljivka['options'] as $key => $kategorija) { // misinge imamo zdruzene $_label = $kategorija; echo ''; } } echo ''; echo ''; echo ''; # št enot echo ''; echo ''; #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 = self::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt']; $sum_xi_fi += $xi * $fi ; $N += $fi; $_percent = (self::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ) ? self::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt'] * 100 / self::$_FREQUENCYS[$_sequence]['validCnt'] : 0; $_tmp_table[$grid['part']][$cnt]['variables'][] = array('key'=>$key, 'freq'=>self::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt'],'percent'=>$_percent); } } $_tmp_table[$grid['part']][$cnt]['seq'] = $variable['seq']; $_tmp_table[$grid['part']][$cnt]['vr_id'] = $variable['vr_id']; $_tmp_table[$grid['part']][$cnt]['variable'] = substr($variable['variable'], 0, strrpos($variable['variable'], "_")); $_tmp_table[$grid['part']][$cnt]['naslov'] = $variable['naslov']; $_tmp_table[$grid['part']][$cnt]['suma'] = self::$_FREQUENCYS[$_sequence]['validCnt']; $_tmp_table[$grid['part']][$cnt]['allCnt'] = (int)self::$_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 = self::$_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 "; echo ''; if ($_sub_question_col) { echo ''; echo ''; } else { echo ''; } if (self::$_SHOW_LEGENDA) { echo ''; echo ''; } # zloopamo skozi variable if (count($grid['variables']) > 0) { foreach ($grid['variables'] AS $vid => $variable ) { #mg_inspectž echo ''; } // end foreach variables } // end if (count($grid['variables']) > 0) // suma echo ''; // povpreje echo ''; // odklon echo ''; # dodamo desni del grida $_right_grid = $_tmp_table[2][$tkey]; if (count($_right_grid['variables']) > 0) { foreach ($_right_grid['variables'] AS $vid => $variable ) { echo ''; } // end foreach variables } // end if (count($grid['variables']) > 0) // suma echo ''; // povpreje echo ''; # odklon echo ''; # št enot echo ''; echo ''; } // end foreach ($_tmp_table[1] AS $tkey => $grid) } echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''; echo ''.$spremenljivka['naslov'].''; if (self::$_SHOW_LEGENDA) { echo '
'.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } echo '
'; self::showIcons($spid,$spremenljivka,$_from); echo ''.$lang['srv_analiza_opisne_subquestion'].''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].''.$lang['srv_analiza_opisne_answers']; echo ' (/ %)'; echo ' (/ %)'; echo ' (f / %)'; echo ' 
    '.($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'].' '.$_tip.''.$_oblika.''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
0 ? ' gid="'.$variable['key'].'_1"' : '').'>'.$variable['freq'].'
'; echo self::formatNumber($variable['percent'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'.(int)$grid['suma'].'
'.self::formatNumber(100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%').'
'; echo '
'; echo self::formatNumber($grid['avg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; echo self::formatNumber($grid['div'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; #mg_inspect echo ''; echo ''; echo ''; echo ''; echo ''; echo '
0 ? ' gid="'.$variable['key'].'_2"' : '').'>'.$variable['freq'].'
'; echo self::formatNumber($variable['percent'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'.(int)$_right_grid['suma'].'
'.self::formatNumber(100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%').'
'; echo '
'; echo self::formatNumber($_right_grid['avg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; echo self::formatNumber($_right_grid['div'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; echo $grid['allCnt']; echo '
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && self::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { echo '
'; self::outputOtherAnswers($oAnswers); echo '
'; } } if (self :: $show_spid_div == true) { echo '
'; echo '
'; } } /** Izriše multi number odgovore. izpiše samo povprečja * * @param unknown_type $spid */ static function sumMultiNumber($spid,$_from) { global $lang; $spremenljivka = self::$_HEADERS[$spid]; # preverimo ali prikazujemo spremenljivko, glede na veljavne odgovore in nastavitev $only_valid = 0; 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 $only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; } } } if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { return; } # dodamo opcijo kje izrisujemo legendo # če je besedilo * in je samo ena kategorija je inline legenda false $_cols = $spremenljivka['cnt_all'] / $spremenljivka['cnt_grids']; if (self :: $show_spid_div == true) { echo '
'; } self::displaySpremenljivkaIcons($spid); # tekst vprašanja echo ''; # naslovna vrstica echo ''; #variabla echo ''; #odgovori echo ''; echo ''; echo ''; #variabla echo ''; #odgovori echo ''; if (self::$_SHOW_LEGENDA){ echo ''; echo ''; } echo ''; echo ''; // konec naslovne vrstice $_answersOther = array(); $_grids_count = count($spremenljivka['grids']); if ($_grids_count > 0) { # naslovna vrstica $_row = $spremenljivka['grids'][0]; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA){ echo ''; echo ''; } if (count($_row['variables']) > 0 ) foreach ($_row['variables'] AS $rid => $_col ){ $_sequence = $_col['sequence']; # id kolone z podatki if ($_col['other'] != true) { echo ''; } else { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } } echo ''; $_css_bck = 'anl_bck_desc_2 anl_ac anl_bt_dot '; $last = 0; //anl_bck_desc_2 anl_bl anl_br anl_variabla_sub foreach ($spremenljivka['grids'] AS $gid => $grid) { $_variables_count = count($grid['variables']); echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA){ echo ''; echo ''; } if ($_variables_count > 0) { foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki if ($variable['other'] != true) { # tabela z navedbami echo ''; } } } echo ''; } } echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''.$spremenljivka['naslov'].''; if (self::$_SHOW_LEGENDA) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } echo '
'.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } echo '
'; self::showIcons($spid,$spremenljivka,$_from); echo ''.$lang['srv_analiza_opisne_subquestion'] . ''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].''. $lang['srv_analiza_sums_average'] .'
    '; // echo $_col['variable']; echo $_col['naslov']; echo '
'; echo $grid['variable']; echo ''; echo $grid['naslov']; echo ''.$_tip.''.$_oblika.''; echo self::formatNumber(self::$_FREQUENCYS[$_sequence]['average'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo '
'; if (self :: $show_spid_div == true) { echo '
'; echo '
'; } } /** Izriše multi number odgovore. v Navpični obliki (podobno kot opisne) * * @param unknown_type $spid */ static function sumMultiNumberVertical($spid,$_from) { global $lang; $spremenljivka = self::$_HEADERS[$spid]; # preverimo ali prikazujemo spremenljivko, glede na veljavne odgovore in nastavitev $only_valid = 0; 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 $only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; } } } if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { return; } # dodamo opcijo kje izrisujemo legendo # če je besedilo * in je samo ena kategorija je inline legenda false $inline_legenda = (self::$_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 && self::$_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], self::$_FREQUENCYS[$_sequence]['allCnt']); # za povprečje $sum_xi_fi=0; $N = 0; $div=0; $min = null; $max = null; if (count(self::$_FREQUENCYS[$_sequence]['valid']) > 0 ) { foreach (self::$_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; self::$_FREQUENCYS[$_sequence]['validAvg'] = $avg; self::$_FREQUENCYS[$_sequence]['validMin'] = $min; self::$_FREQUENCYS[$_sequence]['validMax'] = $max; #standardna diviacija $div = 0; $sum_pow_xi_fi_avg = 0; if (count(self::$_FREQUENCYS[$_sequence]['valid']) > 0 ) { foreach (self::$_FREQUENCYS[$_sequence]['valid'] AS $xi => $_validFreq) { $fi = $_validFreq['cnt']; $sum_pow_xi_fi_avg += pow(($xi - $avg),2) * $fi; } } self::$_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); } } } $isSingleGrid = ($spremenljivka['cnt_all'] == $spremenljivka['cnt_grids']) ? true : false; # če je cnt_all == cnt_grids pomeni da imamo samo 1 grid if (self :: $show_spid_div == true) { echo '
'; } self::displaySpremenljivkaIcons($spid); # tekst vprašanja echo ''; # naslovna vrstica echo ''; #variabla echo ''; #odgovori echo ''; echo ''; echo ''; #variabla echo ''; if ($show_enota) { echo ''; } else { # če mamo number brez labele izrisujemo drugače echo ''; } if (self::$_SHOW_LEGENDA && $inline_legenda){ echo ''; echo ''; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; $_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 && $isSingleGrid == false? ' anl_double_bt' : ' anl_bt_dot'; echo ''; if (!$show_enota && $spremenljivka['tip'] == 7) { echo '' ; if (!$show_enota && $spremenljivka['tip'] == 7) { echo '' ; if (self::$_SHOW_LEGENDA && $inline_legenda) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } echo ''; echo ''; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } else { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } $grid['new_grid'] = false; } } } echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''.$spremenljivka['naslov'].''; if (self::$_SHOW_LEGENDA) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } if (!$inline_legenda) { echo '
 ('.$_tip.')'.'
'; } echo '
'.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } echo '
'; self::showIcons($spid,$spremenljivka,$_from); echo ''; if ($spremenljivka['tip'] == 20 || $spremenljivka['tip'] == 7) { echo $lang['srv_analiza_opisne_subquestion']; } else { echo $lang['srv_analiza_opisne_variable_text']; } echo''; echo ' '; echo''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].'' . $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 { echo '' ; } echo $_css_double_line; # za number (7) ne prikazujemo variable if ($spremenljivka['tip'] != 7 ) { echo $variable['variable']; } echo '' ; } else { echo '' ; } if ($show_enota) { # če ni enojni grid if ($isSingleGrid == false) { echo (count($grid['variables']) > 1 && $spremenljivka['tip'] == 20 ? $grid['naslov'] . ' - ' : '' ).$variable['naslov']; } else { # če je enojni, izpišemo labele variable echo $grid['naslov']; } } else { echo ' '; } echo ''.$_tip.'' .$_oblika. ''; echo (int)self::$_FREQUENCYS[$_sequence]['validCnt']; echo ''; echo (int)$_approp_cnt[$gid]; echo ''; echo self::formatNumber(self::$_FREQUENCYS[$_sequence]['validAvg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; echo self::formatNumber(self::$_FREQUENCYS[$_sequence]['validDiv'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),''); echo ''; echo (int)self::$_FREQUENCYS[$_sequence]['validMin']; echo ''; echo (int)self::$_FREQUENCYS[$_sequence]['validMax'];; echo '
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && self::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { echo '
'; self::outputOtherAnswers($oAnswers); echo '
'; } } if (self :: $show_spid_div == true) { echo '
'; echo '
'; } } /** Izriše number odgovore v vertikalni obliki * * @param unknown_type $spid */ static function sumNumberVertical($spid,$_from) { global $lang; $spremenljivka = self::$_HEADERS[$spid]; # preverimo ali prikazujemo spremenljivko, glede na veljavne odgovore in nastavitev $only_valid = 0; 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 $only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; } } } if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { return; } # dodamo opcijo kje izrisujemo legendo # če je besedilo * in je samo ena kategorija je inline legenda false $inline_legenda = (self::$_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 && self::$_HEADERS[$spid]['cnt_all'] == 1) || $spremenljivka['tip'] == 22 || $spremenljivka['tip'] == 25) { $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], self::$_FREQUENCYS[$_sequence]['allCnt']); # za povprečje $sum_xi_fi=0; $N = 0; $div=0; $min = null; $max = null; if (count(self::$_FREQUENCYS[$_sequence]['valid']) > 0 ) { foreach (self::$_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; self::$_FREQUENCYS[$_sequence]['validAvg'] = $avg; self::$_FREQUENCYS[$_sequence]['validMin'] = $min; self::$_FREQUENCYS[$_sequence]['validMax'] = $max; #standardna diviacija $div = 0; $sum_pow_xi_fi_avg = 0; if (count(self::$_FREQUENCYS[$_sequence]['valid']) > 0 ) { foreach (self::$_FREQUENCYS[$_sequence]['valid'] AS $xi => $_validFreq) { $fi = $_validFreq['cnt']; $sum_pow_xi_fi_avg += pow(($xi - $avg),2) * $fi; } } self::$_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); } } } if (self :: $show_spid_div == true) { echo '
'; } self::displaySpremenljivkaIcons($spid); # tekst vprašanja echo ''; # naslovna vrstica echo ''; #variabla echo ''; $num_cols = 7 + ($spremenljivka['tip'] == 18 ? 1 : 0); #odgovori echo ''; echo ''; echo ''; #variabla echo ''; if ($show_enota == true) { echo ''; } else { # če mamo number brez labele izrisujemo drugače echo ''; } if (self::$_SHOW_LEGENDA && $inline_legenda){ echo ''; echo ''; } echo ''; echo ''; echo ''; if ($spremenljivka['tip'] == 18) { echo ''; } echo ''; echo ''; echo ''; echo ''; $_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'; echo ''; if (!$show_enota && $spremenljivka['tip'] == 7) { echo '' ; if ((!$show_enota && $spremenljivka['tip'] == 7 ) || $spremenljivka['tip'] == 22 || $spremenljivka['tip'] == 25) { echo '' ; if (self::$_SHOW_LEGENDA && $inline_legenda) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } echo ''; echo ''; } echo ''; echo ''; echo ''; if ($spremenljivka['tip'] == 18) { $_percent = ($sum_avg > 0 ) ? 100 * self::$_FREQUENCYS[$_sequence]['validAvg'] / $sum_avg : 0; echo ''; } echo ''; echo ''; echo ''; } 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'; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA && $inline_legenda){ echo ''; echo ''; } echo ''; echo ''; echo ''; # skupna suma echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''.$spremenljivka['naslov'].''; if (self::$_SHOW_LEGENDA) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } if (!$inline_legenda) { echo '
 ('.$_tip.')'.'
'; } echo '
'.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } echo '
'; self::showIcons($spid,$spremenljivka,$_from); echo ''; if ($spremenljivka['tip'] == 20 || $spremenljivka['tip'] == 7) { echo $lang['srv_analiza_opisne_subquestion']; } else { echo $lang['srv_analiza_opisne_variable_text']; } echo''; echo ' '; echo''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].'' . $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 { echo '' ; } echo $_css_double_line; # za number (7) ne prikazujemo variable if ($spremenljivka['tip'] != 7 || ($show_enota == true && $spremenljivka['tip'] == 7 )) { if ($variable['variable'] == $spremenljivka['variable']) { echo $variable['variable'].'_1'; } else { echo $variable['variable']; } } echo '' ; } else { echo '' ; } if ($show_enota) { echo (count($grid['variables']) > 1 && $spremenljivka['tip'] == 20 ? $grid['naslov'] . ' - ' : '' ).$variable['naslov']; } else { echo ' '; } echo ''.$_tip.'' .$_oblika. ''; echo (int)self::$_FREQUENCYS[$_sequence]['validCnt']; echo ''; echo (int)$_approp_cnt[$gid]; echo ''; echo self::formatNumber(self::$_FREQUENCYS[$_sequence]['validAvg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; echo self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),'%'); echo ''; echo self::formatNumber(self::$_FREQUENCYS[$_sequence]['validDiv'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),''); echo ''; echo (int)self::$_FREQUENCYS[$_sequence]['validMin']; echo ''; echo (int)self::$_FREQUENCYS[$_sequence]['validMax'];; echo '
'; echo $lang['srv_anl_suma1']; echo '     '; echo self::formatNumber($sum_avg,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),''); echo '100%   
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && self::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { echo '
'; self::outputOtherAnswers($oAnswers); echo '
'; } } if (self :: $show_spid_div == true) { echo '
'; echo '
'; } } /** Izriše nagovor * */ static function sumNagovor($spid,$_from) { global $lang; $spremenljivka = self::$_HEADERS[$spid]; $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); $cssBack = "anl_bck_freq_1 "; if (self :: $show_spid_div == true) { echo '
'; } self::displaySpremenljivkaIcons($spid); echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''.$spremenljivka['naslov'].''; if (self::$_SHOW_LEGENDA) { echo '
'.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } echo '
'; if (self :: $show_spid_div == true) { echo '
'; echo '
'; } } /** Izriše tekstovne odgovore kot tabelo z navedbami * * @param unknown_type $spid */ //static function sumMultiText($spid,$_from, $lokacija=false) { static function sumMultiText($spid,$_from) { global $lang; $spremenljivka = self::$_HEADERS[$spid]; $lokacija=false; $heatmap=false; if($spremenljivka['tip'] == 26) $lokacija=true; else if ($spremenljivka['tip'] == 27) $heatmap=true; $anketa = self::$sid; # preverimo ali prikazujemo spremenljivko, glede na veljavne odgovore in nastavitev $only_valid = 0; 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 $only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; } } } if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { return; } # 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 $num_show_records = self::getNumRecords(); // $num_show_records = $_max_answers_cnt <= (int)$num_show_records ? $_max_answers_cnt : $num_show_records; //za tip lokacija (ne enota 3) se rabi user_id, ker se kasneje delajo linki $need_user_id = !($spremenljivka['tip'] != 26 || ($spremenljivka['tip'] == 26 && $spremenljivka['enota'] == 3)); $_answers = self::getAnswers($spremenljivka, $num_show_records, $need_user_id); $_all_valid_answers_cnt = $_answers['validCnt']; $_valid_answers = $_answers['valid']; if (self :: $show_spid_div == true) { echo '
'; } self::displaySpremenljivkaIcons($spid); # tekst vprašanja echo ''; # naslovna vrstica echo ''; #variabla echo ''; #odgovori echo ''; echo ''; echo ''; #variabla echo ''; #odgovori if(!$lokacija) echo ''; if (self::$_SHOW_LEGENDA){ echo ''; echo ''; } if(!$lokacija){ echo ''; echo ''; } // konec naslovne vrstice $_answersOther = array(); $_grids_count = count($spremenljivka['grids']); if ($_grids_count > 0) { # naslovna vrstica $_row = $spremenljivka['grids'][0]; if(!$lokacija){ echo ''; echo ''; echo ''; } if (self::$_SHOW_LEGENDA){ echo ''; echo ''; } if (count($_row['variables'])>0) foreach ($_row['variables'] AS $rid => $_col ){ $_sequence = $_col['sequence']; # id kolone z podatki if ($_col['other'] != true) { echo ''; } else { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } } echo ''; $_css_bck = 'anl_bck_desc_2 anl_ac anl_bt_dot '; $last = 0; //anl_bck_desc_2 anl_bl anl_br anl_variabla_sub foreach ($spremenljivka['grids'] AS $gid => $grid) { $_variables_count = count($grid['variables']); echo ''; echo ''; if(!$lokacija){ echo ''; } if (self::$_SHOW_LEGENDA){ echo ''; echo ''; } 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,self::$_FREQUENCYS[$_sequence]['validCnt'])); } # za barvanje $last = ($last & 1) ? 0 : 1 ; $moreBound = 3; foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki if ($variable['other'] != true) { # tabela z navedbami echo ''; } } $last = $_max_i; } echo ''; } } echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''.$spremenljivka['naslov'].''; if (self::$_SHOW_LEGENDA) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } echo '
'.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } echo '
'; self::showIcons($spid,$spremenljivka,$_from); echo ''.$lang['srv_analiza_opisne_subquestion'] . ''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].''. $lang['srv_analiza_opisne_arguments'] .'
    '; // echo $_col['variable']; echo $_col['naslov']; echo '
'; if(!$lokacija) echo $grid['variable']; //else{ else if ($lokacija && $heatmap == false){ //echo $grid['naslov'].'
';//ni potrebno, ker je ze v glavi? $sprid = explode('_',$spid); $loopid = $sprid[1]; $sprid = $sprid[0]; self::displayMapDataAll($spid); } elseif($heatmap){ //echo $grid['naslov'].'
';//ni potrebno, ker je ze v glavi? $sprid = explode('_',$spid); $loopid = $sprid[1]; $sprid = $sprid[0]; SurveyUserSession::Init($anketa); $heatmapId = 'heatmap'.$sprid; //echo $heatmapId; //SurveyChart::displayExportIcons($sprid); echo ''; echo 'Heatmap'; echo ''; } echo '
'; echo $grid['naslov']; echo ''.$_tip.''.$_oblika.''; echo ''; #$_valid_cnt = count(self::$_FREQUENCYS[$_sequence]['valid']); $index=0; if (count($_valid_answers) > 0) { foreach ($_valid_answers AS $key => $answer) { $index++; $cssBck = ' '.self::$cssColors['0_' . ($index & 1)]; $_ans = $answer[$_sequence]; if($index <= $moreBound){ //if($index < $moreBound){ echo ''; echo ''; echo ''; } else { echo ''; echo ''; echo ''; } } } if ($_all_valid_answers_cnt > $index) { $index++; $cssBck = ' '.self::$cssColors['0_' . ($index & 1)]; echo ''; echo ''; echo ''; } echo '
'; # narišemo printereček za izpis posameznih textovnih odgovorov if ($index == 1) { //echo ''; //TODO! zakomentiral, ker nima funkcije, ikona pa pokvarjena /*echo ''; echo ' '; echo '';*/ } if ($_ans != null && $_ans != '') { if(!($need_user_id && $lokacija)) echo $_ans; else echo ''.$_ans.''; } else { echo ' '; } if($index == $moreBound){ #more - več echo '
'; echo ' '; echo ''; #more - več - konec } echo '
'; # narišemo printereček za izpis posameznih textovnih odgovorov if ($index == 1) { //echo ''; //TODO! zakomentiral, ker nima funkcije, ikona pa pokvarjena /*echo ''; echo ' '; echo '';*/ } if ($_ans != null && $_ans != '') { if(!($need_user_id && $lokacija)) echo $_ans; else echo ''.$_ans.''; } else { echo ' '; } if($index == $_max_i){ #less - manj echo '
'; echo ' '; echo ''; } echo '
'; // Pri javni povezavi drugace izpisemo if(self::$printPreview == false) echo '
'.$lang['srv_anl_more'].'
'; else echo '
'.$lang['srv_anl_more'].'
'; echo '
'; echo '
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && self::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { echo '
'; self::outputOtherAnswers($oAnswers); echo '
'; } } if (self :: $show_spid_div == true) { echo '
'; echo '
'; } } /** * * @global type $lang * @param string $spid - [spremenljivka_id]_[loop_id] */ private static function displayMapDataAll($spid){ global $lang; $sprid = explode('_',$spid); $loopid = $sprid[1]; $sprid = $sprid[0]; $spremenljivka = Cache::srv_spremenljivka($sprid); $enota = $spremenljivka["enota"]; //za choose location naredi isto, kot za vsak userja posebej - dobi direkt iz baze ne glede na filterje if($enota == 3){ echo ''; echo ''; echo ''; } //prikaz glede na filterje else{ echo ''; echo ''; echo ''; } } /** Izriše tekstovne odgovore v vertikalni obliki * * @param unknown_type $spid */ static function sumTextVertical($spid,$_from) { global $lang; # dajemo v bufer, da da ne prikazujemo vprašanj brez veljavnih odgovorov če imamo tako nastavljeno $spremenljivka = self::$_HEADERS[$spid]; # preverimo ali prikazujemo spremenljivko, glede na veljavne odgovore in nastavitev $only_valid = 0; 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 $only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; } } } if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { return; } # dodamo opcijo kje izrisujemo legendo # če je besedilo * in je samo ena kategorija je inline legenda false $inline_legenda = (self::$_HEADERS[$spid]['cnt_all'] == 1 || in_array($spremenljivka['tip'],array(1,8) ) ) ? false: true; # koliko zapisov prikažemo naenkrat $num_show_records = self::getNumRecords(); $options=array('inline_legenda' => $inline_legenda, 'isTextAnswer' => false, 'isOtherAnswer' => false, 'num_show_records' => $num_show_records); if (self :: $show_spid_div == true) { echo '
'; } self::displaySpremenljivkaIcons($spid); # tekst vprašanja echo ''; # naslovna vrstica echo ''; #variabla echo ''; #odgovori echo ''; echo ''; echo ''; #variabla echo ''; #odgovori echo ''; if (self::$_SHOW_LEGENDA && $inline_legenda){ echo ''; echo ''; } echo ''; echo ''; if (self::$_HEADERS[$spid]['show_valid_percent'] == true) { echo ''; } echo ''; echo ''; // 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) { self::outputGridLabelVertical($gid,$grid,$vid,$variable,$spid,$options); } $counter = 0; $_kumulativa = 0; //self::$_FREQUENCYS[$_sequence] if (count(self::$_FREQUENCYS[$_sequence]['valid'])> 0 ) { $_valid_answers = self :: sortTextValidAnswers($spid,$variable,self::$_FREQUENCYS[$_sequence]['valid']); foreach ($_valid_answers AS $vkey => $vAnswer) { if ($counter < $num_show_records || self::$isArchive) { 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(self::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { foreach (self::$_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); } } } echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''.$spremenljivka['naslov'].''; if (self::$_SHOW_LEGENDA) { if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } if (!$inline_legenda) { echo '
 ('.$_tip.')'.'
'; } echo '
'.$lang['srv_analiza_opisne_variable_type'].': '.self::getSpremenljivkaLegenda($spremenljivka,'tip').'
'; } echo '
'; self::showIcons($spid,$spremenljivka,$_from); echo ''.$lang['srv_analiza_frekvence_titleAnswers'] . ''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].''. $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 && self::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { echo '
'; self::outputOtherAnswers($oAnswers); echo '
'; } } if (self :: $show_spid_div == true) { echo '
'; echo '
'; } } /** za multi grid tekstovne vrstice doda vrstico z labeliami grida * * @param $gkey * @param $gAnswer * @param $spid * @param $_options */ static function outputGridLabelVertical($gid,$grid,$vid,$variable,$spid,$_options=array()) { echo ''; echo ''; echo $variable['variable']; echo ''; echo ''; //echo ($grid['naslov'] != '' ? $grid['naslov']. ' - ' : '').$variable['naslov']; echo $variable['naslov']; echo ''; if (self::$_SHOW_LEGENDA) { $spremenljivka = self::$_HEADERS[$spid]; if ($variable['other'] != '1' && $variable['text'] != '1') { $_tip = self::getSpremenljivkaLegenda($spremenljivka,'izrazanje'); $_oblika = self::getSpremenljivkaLegenda($spremenljivka,'skala'); } else { global $lang; $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; } echo ''.$_tip.''; echo ''.$_oblika.''; } echo ' '; if (self::$_HEADERS[$spid]['show_valid_percent']) { echo ' '; } echo ' '; echo ' '; echo ''; $counter++; return $counter; } static function outputValidAnswerVertical($counter,$vkey,$vAnswer,$_sequence,$spid,&$_kumulativa,$_options=array()) { global $lang; # 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; } $cssBck = ' '.self::$cssColors['0_' . ($counter & 1)]; $_valid = (self::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ) ? 100*$vAnswer['cnt'] / self::$_FREQUENCYS[$_sequence]['validCnt'] : 0; $_percent = (self::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*$vAnswer['cnt'] / self::$_FREQUENCYS[$_sequence]['allCnt'] : 0; $_kumulativa += $_valid; # če smo v arhivih dodamovse odgovore vendar so nekateri skriti if ($counter >= $options['num_show_records'] && self::$isArchive) { $cssHide=' class="displayNone"'; } echo ' 0 ? ' vkey="'.$vkey.'"' : '').$cssHide.'>'; echo ' '; echo ''; echo '
'.$vkey.'
'; echo (($options['isTextAnswer'] == false && (string)$vkey != $vAnswer['text']) ? ' ('.$vAnswer['text'] .')' : ''); echo ''; if (self::$_SHOW_LEGENDA && $options['isOtherAnswer'] == false && $options['inline_legenda'] == true ) { echo ' '; echo ' '; } echo ''; echo (int)$vAnswer['cnt']; echo ''; echo ''; echo self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); echo ''; if (self::$_HEADERS[$spid]['show_valid_percent']) { echo ''; echo self::formatNumber($_valid, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); echo ''; } echo ''; echo self::formatNumber($_kumulativa, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); echo ''; echo ''; # če mamo več if ( $counter+1 == $options['num_show_records'] && $options['num_show_records'] < count(self::$_FREQUENCYS[$_sequence]['valid'])) { if (self::$isArchive == false ) { echo ''; echo ' '; echo ''; // Pri javni povezavi drugace izpisemo if(self::$printPreview == false){ echo '
'.$lang['srv_anl_more'].'
'; echo '
'.$lang['srv_anl_more'].'
'; } else{ echo '
'.$lang['srv_anl_more'].'
'; echo '
'.$lang['srv_anl_more'].'
'; } echo ''; if (self::$_SHOW_LEGENDA && $options['isOtherAnswer'] == false && $options['inline_legenda'] == true ) { echo ' '; echo ' '; } echo ''.''; echo ''.''; if (self::$_HEADERS[$spid]['show_valid_percent']) { echo ''.''; } echo ''.''; echo ''; } else { #v arhivie dodamo vse odgovore vendar so skriti echo ''; echo ' '; echo ''; echo '
'.$lang['srv_anl_all'].'
'; echo '
'.$lang['srv_anl_all'].'
'; echo ''; if (self::$_SHOW_LEGENDA && $options['isOtherAnswer'] == false && $options['inline_legenda'] == true ) { echo ' '; echo ' '; } echo ''.''; echo ''.''; if (self::$_HEADERS[$spid]['show_valid_percent']) { echo ''.''; } echo ''.''; echo ''; } } $counter++; return $counter; } static function outputSumaValidAnswerVertical($counter,$_sequence,$spid,$_options=array()) { global $lang; # 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; } // $cssBck = ' '.self::$cssColors['0_' . ($counter & 1)]; $_percent = (self::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*self::$_FREQUENCYS[$_sequence]['validCnt'] / self::$_FREQUENCYS[$_sequence]['allCnt'] : 0; $cssBck = ' '.self::$cssColors['text_1']; $_brez_MV = ((int)self::$missingProfileData['display_mv_type'] === 0 ) ? TRUE : FALSE; $_hide_minus = ((int)self::$missingProfileData['display_mv_type'] === 2 ) ? TRUE : FALSE; $value =((int)self::$missingProfileData['display_mv_type'] === 0 ) ? 0 : 1; $_sufix = (self::$podstran == M_ANALYSIS_SUMMARY_NEW ? '_NEW' : ''); # da deluje razpiranje manjkajočih tudi kadar imamo skupine if (isset(self::$_CURRENT_LOOP['cnt'])) { $_sufix = '_loop'.self::$_CURRENT_LOOP['cnt'].$_sufix; } echo ''; echo ''.$lang['srv_anl_valid']; echo '  '; echo '  '; echo ''; echo ''.$lang['srv_anl_suma1'].''; if (self::$_SHOW_LEGENDA && $options['isOtherAnswer'] == false && $options['inline_legenda'] == true) { echo ' '; echo ' '; } echo ''; echo self::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ? self::$_FREQUENCYS[$_sequence]['validCnt'] : 0; echo ''; $_percent = self::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ? 100 * self::$_FREQUENCYS[$_sequence]['validCnt'] / self::$_FREQUENCYS[$_sequence]['allCnt'] : 0; echo '' . self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%') . ''; if (self::$_HEADERS[$spid]['show_valid_percent'] == true) { echo '' . self::formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%') . ''; } echo ' '; echo ''; // $counter++; return $counter; } static function outputInvalidAnswerVertical($counter,$vkey,$vAnswer,$_sequence,$spid,$_options=array()) { global $lang; # 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; } //$cssBck = ' '.self::$cssColors['text_' . ($counter & 1)]; $cssBck = ' '.self::$cssColors['0_' . ($counter & 1)]; $_percent = (self::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*$vAnswer['cnt'] / self::$_FREQUENCYS[$_sequence]['allCnt'] : 0; $_invalid = (self::$_FREQUENCYS[$_sequence]['invalidCnt'] > 0 ) ? 100*$vAnswer['cnt'] / self::$_FREQUENCYS[$_sequence]['invalidCnt'] : 0; $_sufix = (self::$podstran == M_ANALYSIS_SUMMARY_NEW ? '_NEW' : ''); # da deluje razpiranje manjkajočih tudi kadar imamo skupine if (isset(self::$_CURRENT_LOOP['cnt'])) { $_sufix = '_loop'.self::$_CURRENT_LOOP['cnt'].$_sufix; } $_Z_MV = ((int)self::$missingProfileData['display_mv_type'] === 2) ? TRUE : FALSE; echo ''; echo ' '; echo ''; echo '
'.'' . $vkey . '' . ' (' . $vAnswer['text'].')'.'
'; echo '
'.self::formatNumber($_invalid, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%').'
'; echo '
'.$vAnswer['cnt'].'
'; echo ''; if (self::$_SHOW_LEGENDA && $options['isOtherAnswer'] == false && $options['inline_legenda'] == true) { echo ' '; echo ' '; } echo ''; echo (int)$vAnswer['cnt']; echo ''; echo ''; echo self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); echo ''; if (self::$_HEADERS[$spid]['show_valid_percent']) { echo ''; echo ' '; echo ''; } echo ''; echo ' '; echo ''; echo ''; $counter++; return $counter; } static function outputSumaInvalidAnswerVertical($counter,$_sequence,$spid,$_options = array()) { global $lang; # 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; } //$cssBck = ' '.self::$cssColors['text_' . ($counter & 1)]; $cssBck = ' '.self::$cssColors['text_1']; $_percent = (self::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*self::$_FREQUENCYS[$_sequence]['invalidCnt'] / self::$_FREQUENCYS[$_sequence]['allCnt'] : 0; $_brez_MV = ((int)self::$missingProfileData['display_mv_type'] === 0) ? TRUE : FALSE; $_hide_minus = ((int)self::$missingProfileData['display_mv_type'] === 1 || (int)self::$missingProfileData['display_mv_type'] === 0) ? TRUE : FALSE; $_sufix = (self::$podstran == M_ANALYSIS_SUMMARY_NEW ? '_NEW' : ''); # da deluje razpiranje manjkajočih tudi kadar imamo skupine if (isset(self::$_CURRENT_LOOP['cnt'])) { $_sufix = '_loop'.self::$_CURRENT_LOOP['cnt'].$_sufix; } echo ''; echo ''; echo $lang['srv_anl_missing']; echo ''; echo ''; echo $lang['srv_analiza_manjkajocevrednosti']; // podrobno za missinge echo '  '; echo ' ' ; //echo $lang['srv_analiza_missingSpremenljivke'] ; echo ' '; echo ''; echo '  '; echo ' ' ; // echo $lang['srv_analiza_missingSpremenljivke'] ; echo ' '; echo ''; echo '
100.0%
'; echo '
'.self::$_FREQUENCYS[$_sequence]['invalidCnt'].'
'; echo ''; if (self::$_SHOW_LEGENDA && $options['isOtherAnswer'] == false && $options['inline_legenda'] == true) { echo ' '; echo ' '; } echo ''; $answer['cnt'] = self::$_FREQUENCYS[$_sequence]['invalidCnt'] > 0 ? self::$_FREQUENCYS[$_sequence]['invalidCnt'] : 0; echo (int)$answer['cnt']; echo ''; echo ''; echo self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); echo ''; if (self::$_HEADERS[$spid]['show_valid_percent']) { echo ''; echo ' '; echo ''; } echo ' '; echo ''; $counter++; return $counter; } static function outputSumaVertical($counter,$_sequence,$spid, $_options = array()) { global $lang; # 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; } // $cssBck = ' '.self::$cssColors['0_' .($counter & 1)]; $cssBck = ' anl_bck_text_0'; $_brez_MV = ((int)self::$missingProfileData['display_mv_type'] === 0) ? TRUE : FALSE; $_sufix = (self::$podstran == M_ANALYSIS_SUMMARY_NEW ? '_NEW' : ''); # da deluje razpiranje manjkajočih tudi kadar imamo skupine if (isset(self::$_CURRENT_LOOP['cnt'])) { $_sufix = '_loop'.self::$_CURRENT_LOOP['cnt'].$_sufix; } echo ''; //echo ' '; // $lang['srv_anl_appropriate'] //echo ''.$lang['srv_anl_suma2'].''; echo ''.$lang['srv_anl_suma2'].''; echo ' '; if (self::$_SHOW_LEGENDA && $options['isOtherAnswer'] == false && $options['inline_legenda'] == true) { echo ' '; echo ' '; } echo '' . (self::$_FREQUENCYS[$_sequence]['allCnt'] ? self::$_FREQUENCYS[$_sequence]['allCnt'] : 0) . ''; echo '' . self::formatNumber('100', SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%') . ''; if (self::$_HEADERS[$spid]['show_valid_percent']) { echo ' '; } echo ' '; echo ''; } static function outputSumaValidAnswerHeatmap($counter,$_sequence,$spid,$_options=array(), $validHeatmapRegion) { global $lang; # 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; } $cssBck = ' '.self::$cssColors['text_1']; $_brez_MV = ((int)self::$missingProfileData['display_mv_type'] === 0 ) ? TRUE : FALSE; $_hide_minus = ((int)self::$missingProfileData['display_mv_type'] === 2 ) ? TRUE : FALSE; $value =((int)self::$missingProfileData['display_mv_type'] === 0 ) ? 0 : 1; $_sufix = (self::$podstran == M_ANALYSIS_SUMMARY_NEW ? '_NEW' : ''); # da deluje razpiranje manjkajočih tudi kadar imamo skupine if (isset(self::$_CURRENT_LOOP['cnt'])) { $_sufix = '_loop'.self::$_CURRENT_LOOP['cnt'].$_sufix; } echo ''; echo ''.$lang['srv_anl_valid']; echo '  '; echo '  '; echo ''; echo ''.$lang['srv_anl_suma1'].''; if (self::$_SHOW_LEGENDA && $options['isOtherAnswer'] == false && $options['inline_legenda'] == true) { echo ' '; echo ' '; } //Veljavni - Skupaj echo ''; echo $validHeatmapRegion; //echo self::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ? self::$_FREQUENCYS[$_sequence]['validCnt'] : 0; echo ''; /* $_percent = self::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ? 100 * self::$_FREQUENCYS[$_sequence]['validCnt'] / self::$_FREQUENCYS[$_sequence]['allCnt'] : 0; echo '' . self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%') . ''; if (self::$_HEADERS[$spid]['show_valid_percent'] == true) { echo '' . self::formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%') . ''; } echo ' '; */ echo ''; // $counter++; return $counter; } static function outputInvalidAnswerHeatmap($counter,$vkey,$vAnswer,$_sequence,$spid,$_options=array(), $manjkajoci) { global $lang; # 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; } //$cssBck = ' '.self::$cssColors['text_' . ($counter & 1)]; $cssBck = ' '.self::$cssColors['0_' . ($counter & 1)]; $_percent = (self::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*$vAnswer['cnt'] / self::$_FREQUENCYS[$_sequence]['allCnt'] : 0; $_invalid = (self::$_FREQUENCYS[$_sequence]['invalidCnt'] > 0 ) ? 100*$vAnswer['cnt'] / self::$_FREQUENCYS[$_sequence]['invalidCnt'] : 0; $_sufix = (self::$podstran == M_ANALYSIS_SUMMARY_NEW ? '_NEW' : ''); # da deluje razpiranje manjkajočih tudi kadar imamo skupine if (isset(self::$_CURRENT_LOOP['cnt'])) { $_sufix = '_loop'.self::$_CURRENT_LOOP['cnt'].$_sufix; } $_Z_MV = ((int)self::$missingProfileData['display_mv_type'] === 2) ? TRUE : FALSE; echo ''; echo ' '; echo ''; echo '
'.'' . $vkey . '' . ' (' . $vAnswer['text'].')'.'
'; echo '
'.self::formatNumber($_invalid, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%').'
'; echo '
'.$vAnswer['cnt'].'
'; echo ''; if (self::$_SHOW_LEGENDA && $options['isOtherAnswer'] == false && $options['inline_legenda'] == true) { echo ' '; echo ' '; } echo ''; echo (int)$vAnswer['cnt']; echo ''; echo ''; echo self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); echo ''; if (self::$_HEADERS[$spid]['show_valid_percent']) { echo ''; echo ' '; echo ''; } echo ''; echo ' '; echo ''; echo ''; $counter++; return $counter; } static function outputSumaInvalidAnswerHeatmap($counter,$_sequence,$spid,$_options = array(), $manjkajoci) { global $lang; # 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; } //$cssBck = ' '.self::$cssColors['text_' . ($counter & 1)]; $cssBck = ' '.self::$cssColors['text_1']; $_percent = (self::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*self::$_FREQUENCYS[$_sequence]['invalidCnt'] / self::$_FREQUENCYS[$_sequence]['allCnt'] : 0; $_brez_MV = ((int)self::$missingProfileData['display_mv_type'] === 0) ? TRUE : FALSE; $_hide_minus = ((int)self::$missingProfileData['display_mv_type'] === 1 || (int)self::$missingProfileData['display_mv_type'] === 0) ? TRUE : FALSE; $_sufix = (self::$podstran == M_ANALYSIS_SUMMARY_NEW ? '_NEW' : ''); # da deluje razpiranje manjkajočih tudi kadar imamo skupine if (isset(self::$_CURRENT_LOOP['cnt'])) { $_sufix = '_loop'.self::$_CURRENT_LOOP['cnt'].$_sufix; } echo ''; echo ''; echo $lang['srv_anl_missing']; echo ''; echo ''; echo $lang['srv_analiza_manjkajocevrednosti']; // podrobno za missinge echo '  '; echo ' ' ; //echo $lang['srv_analiza_missingSpremenljivke'] ; echo ' '; echo ''; echo '  '; echo ' ' ; // echo $lang['srv_analiza_missingSpremenljivke'] ; echo ' '; echo ''; echo '
100.0%
'; //echo '
'.self::$_FREQUENCYS[$_sequence]['invalidCnt'].'
'; echo '
'.$manjkajoci.'
'; echo ''; if (self::$_SHOW_LEGENDA && $options['isOtherAnswer'] == false && $options['inline_legenda'] == true) { echo ' '; echo ' '; } //Mankajoci - Skupaj echo ''; echo $manjkajoci; //$answer['cnt'] = self::$_FREQUENCYS[$_sequence]['invalidCnt'] > 0 ? self::$_FREQUENCYS[$_sequence]['invalidCnt'] : 0; //echo (int)$answer['cnt']; echo ''; //stolpec "Veljavni kliki" /* echo ''; echo self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); echo ''; */ /* if (self::$_HEADERS[$spid]['show_valid_percent']) { echo ''; echo ' '; echo ''; } */ echo ' '; echo ''; $counter++; return $counter; } static function outputSumaHeatmap($counter,$_sequence,$spid, $_options = array(), $ustrezniHeatmapRegion) { global $lang; # 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; } // $cssBck = ' '.self::$cssColors['0_' .($counter & 1)]; $cssBck = ' anl_bck_text_0'; $_brez_MV = ((int)self::$missingProfileData['display_mv_type'] === 0) ? TRUE : FALSE; $_sufix = (self::$podstran == M_ANALYSIS_SUMMARY_NEW ? '_NEW' : ''); # da deluje razpiranje manjkajočih tudi kadar imamo skupine if (isset(self::$_CURRENT_LOOP['cnt'])) { $_sufix = '_loop'.self::$_CURRENT_LOOP['cnt'].$_sufix; } echo ''; //echo ' '; // $lang['srv_anl_appropriate'] //echo ''.$lang['srv_anl_suma2'].''; echo ''.$lang['srv_anl_suma2'].''; echo ' '; if (self::$_SHOW_LEGENDA && $options['isOtherAnswer'] == false && $options['inline_legenda'] == true) { echo ' '; echo ' '; } //SKUPAJ echo '' .$ustrezniHeatmapRegion. ''; //echo '' . (self::$_FREQUENCYS[$_sequence]['allCnt'] ? self::$_FREQUENCYS[$_sequence]['allCnt'] : 0) . ''; //echo '' . self::formatNumber('100', SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%') . ''; /*if (self::$_HEADERS[$spid]['show_valid_percent']) { echo ' '; } */ //echo ' '; echo ''; } /** izpišemo tabelo z tekstovnimi odgovori drugo * * @param $skey * @param $oAnswers * @param $spid */ static function outputOtherAnswers($oAnswers) { global $lang; # koliko zapisov prikažemo naenkrat $num_show_records = self::getNumRecords(); $spid = $oAnswers['spid']; $_variable = self::$_HEADERS[$spid]['grids'][$oAnswers['gid']]['variables'][$oAnswers['vid']]; $_sequence = $_variable['sequence']; $_frekvence = self::$_FREQUENCYS[$_variable['sequence']]; echo ''; echo ''; echo ''; echo ''; echo ''; $css_txt = 'anl_variabla_line'; echo ''; echo ''; echo ''; if (self::$_SHOW_LEGENDA && false){ echo ''; echo ''; } echo ''; echo ''; echo ''; echo ''; echo ''; // konec naslovne vrstice if (self::$_SHOW_LEGENDA && false){ $cssBck = 'anl_bck '; echo ''; echo ''; echo ''; $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } $counter = 1; $_kumulativa = 0; if ( is_countable(self::$_FREQUENCYS[$_sequence]['valid']) && count(self::$_FREQUENCYS[$_sequence]['valid']) > 0 ) { foreach (self::$_FREQUENCYS[$_sequence]['valid'] AS $vkey => $vAnswer) { if ($vAnswer['cnt'] > 0 ) { # izpisujemo samo tiste ki nisno 0 if ($counter < $num_show_records) { $counter = self::outputValidAnswerVertical($counter,$vkey,$vAnswer,$_sequence,$spid,$_kumulativa,array('isOtherAnswer'=>true,'num_show_records' => $num_show_records)); } } } # izpišemo sumo veljavnih $counter = self::outputSumaValidAnswerVertical($counter,$_sequence,$spid,array('isOtherAnswer'=>true)); } if (count(self::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { foreach (self::$_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)); echo '
'. $_variable['variable'] . ''; echo ''.self::$_HEADERS[$oAnswers['spid']]['variable'].' ('.$_variable['naslov'].' )'; if (self::$_SHOW_LEGENDA) { $_tip = $lang['srv_analiza_vrsta_bese']; $_oblika = $lang['srv_analiza_oblika_nomi']; echo '
 ('.$_tip.')'.'
'; } if (self::$_SHOW_LEGENDA) { echo self::getSpremenljivkaLegenda(0,'tip'); } echo '
'; //self::showIcons($spid,$spremenljivka,$_from); echo ''. $lang['srv_analiza_frekvence_titleAnswers'] .''.$lang['srv_analiza_opisne_variable_expression'].''.$lang['srv_analiza_opisne_variable_skala'].''. $lang['srv_analiza_frekvence_titleFrekvenca'] .''. $lang['srv_analiza_frekvence_titleOdstotek'] .''. $lang['srv_analiza_frekvence_titleVeljavni'] .''. $lang['srv_analiza_frekvence_titleKumulativa'] .'
'.''.$_tip.''.$_oblika.'    
'; } static public function showVariable($spid,$variable,$_options= array()) { global $lang; # globalne nastavitve funkcije $options = array('prev'=>true,'align'=>'center'); #ponastavimo uporabniške funkcije if (count($_options) > 0) { foreach ($_options as $okey => $option) { $options[$okey] = $option; } } $sccFloat = ($options['align'] == 'center') ? '' : ( $options['align'] == 'left' ? ' floatLeft' : ' floatRight'); echo ''; if (self::$isArchive == false && self::$printPreview == false){ echo ''; #echo '' echo $variable; echo ''; } else{ echo $variable; } echo ''; } static public function showIcons($spid, $spremenljivka, $_from = 'freq', $additional=array()) { global $lang; $sccFloat = 'taCenter '; #kateri skin $skin = 0; $options = array('sums'=>true,'sums*'=>true,'desc'=>true,'freq'=>true,'sums_spec'=>false); $from_navedbe = (isset($additional['navedbe']) && $additional['navedbe'] == true) ? true : false; $showReport = (isset($additional['noReport']) && $additional['noReport'] == true) ? false: true; $showChart = (isset($additional['showChart']) && $additional['showChart'] == false) ? false: true; $printIcon = (isset($additional['printIcon']) && $additional['printIcon'] == true) ? true: false; if ($_from == 'para') { $showReport = false; } switch ($_from) { case 'freq': case 'para': case 'charts': switch ($spremenljivka['tip']) { case 1: # radio - prikjaže navpično if ($spremenljivka['show_valid_percent'] == true && $spremenljivka['skala'] != 1) { # če za ordinalno prikazujemo povprečje in st. oddklon $options['sums'] = true; $options['sums*'] = true; } else { # za nominalno ne prikazujemo povprečje in st. oddklon, zato je F == F* $options['sums'] = false; $options['sums*'] = false; } break; case 2: #checkbox če je dihotomna: break; case 3: # dropdown - prikjaže navpično break; case 6: # multigrid $options['sums*'] = false; if ( $spremenljivka['enota'] == 3 ) { $options['sums_spec'] = true; } break; case 7: # variabla tipa »število« $options['sums*'] = false; break; case 8: # datum $options['sums'] = false; $options['sums*'] = false; break; case 16: #multicheckbox če je dihotomna: break; case 17: #razvrščanje če je ordinalna $options['sums'] = false; break; case 18: # vsota $options['sums*'] = false; break; case 19: # multitext $options['sums*'] = false; break; case 20: # multi number break; case 4: # text case 21: # besedilo* if ($spremenljivka['cnt_all'] == 1) { // če je enodimenzionalna prikažemo kot frekvence // predvsem zaradi vprašanj tipa: language, email... $options['sums'] = false; } $options['sums*'] = false; break; case 26: # lokacija if ($spremenljivka['cnt_all'] == 1) { $options['sums'] = false; } $options['sums*'] = false; break; case 27: # heatmap if ($spremenljivka['cnt_all'] == 1) { $options['sums'] = false; } $options['sums*'] = false; break; case 22: # kalkulacija case 25: # kvota $options['sums*'] = false; break; # kalkulacija } $export = ($_from == 'charts') ? 'charts' : 'frequency'; break; case 'desc': switch ($spremenljivka['tip']) { case 1: # radio - prikjaže navpično if ($spremenljivka['skala'] == 1) { $options['sums'] = false; $options['sums*'] = false; } break; case 2: #checkbox če je dihotomna: break; case 3: # dropdown - prikjaže navpično break; case 6: # multigrid $options['sums*'] = false; if ( $spremenljivka['enota'] == 3 ) { $options['sums_spec'] = true; } break; case 7: # variabla tipa »število« $options['sums*'] = false; break; case 8: # datum $options['sums'] = false; $options['sums*'] = false; break; case 16: #multicheckbox če je dihotomna: break; case 17: #razvrščanje če je ordinalna $options['sums'] = false; break; case 18: # vsota $options['sums*'] = false; break; case 19: # multitext $options['sums*'] = false; break; case 20: # multi number break; case 4: # text case 21: # besedilo* if ($spremenljivka['cnt_all'] == 1) { // če je enodimenzionalna prikažemo kot frekvence // predvsem zaradi vprašanj tipa: language, email... $options['sums'] = false; } $options['sums*'] = false; break; case 26: # Lokacija if ($spremenljivka['cnt_all'] == 1) { $options['sums'] = false; } $options['sums*'] = false; break; case 27: # heatmap if ($spremenljivka['cnt_all'] == 1) { $options['sums'] = false; } $options['sums*'] = false; break; case 22: # kalkulacija case 25: # kvota $options['sums*'] = false; break; # kalkulacija } $export = 'statistics'; break; case 'sums': switch ($spremenljivka['tip']) { case 1: # radio - prikjaže navpično if ($spremenljivka['skala'] == 1) { $options['sums'] = false; $options['sums*'] = false; $_from = 'freq'; } else { $_from = 'sums*'; } break; case 2: #checkbox če je dihotomna $_from = 'sums*'; break; case 3: # dropdown - prikjaže navpično break; case 6: # multigrid $options['sums*'] = false; if ( $spremenljivka['enota'] == 3 ) { $options['sums_spec'] = true; $_from = 'sums*'; } break; case 7: # variabla tipa »število« $options['sums*'] = false; break; case 8: # datum $options['sums'] = false; $options['sums*'] = false; $_from = 'freq'; break; case 16: #multicheckbox če je dihotomna break; case 17: #razvrščanje če je ordinalna $options['sums'] = false; $_from = 'sums*'; break; case 18: # vsota $options['sums*'] = false; break; case 19: # multitext $options['sums*'] = false; break; case 20: # multi number break; case 21: # besedilo* $_from = 'sums'; if ($spremenljivka['cnt_all'] == 1) { // če je enodimenzionalna prikažemo kot frekvence // predvsem zaradi vprašanj tipa: language, email... $options['sums'] = false; $_from = 'freq'; } $options['sums*'] = false; break; case 26: # lokacija $_from = 'sums'; if ($spremenljivka['cnt_all'] == 1) { $options['sums'] = false; $_from = 'freq'; } $options['sums*'] = false; break; case 27: # heatmap $_from = 'sums'; if ($spremenljivka['cnt_all'] == 1) { $options['sums'] = false; $_from = 'freq'; } $options['sums*'] = false; break; case 4: # text $options['sums'] = false; $options['sums*'] = false; $_from = 'freq'; break; case 22: # kalkulacija case 25: # kvota $options['sums*'] = false; break; # kalkulacija } $export = 'sums'; break; case 'sums*': switch ($spremenljivka['tip']) { case 1: # radio - prikjaže navpično if ($spremenljivka['skala'] == 1) { $options['sums'] = false; $options['sums*'] = false; $_from = 'freq'; } else { $_from = 'sums'; } break; case 2: #checkbox če je dihotomna: $_from = 'sums'; break; case 3: # dropdown - prikjaže navpično break; case 6: # multigrid $options['sums*'] = false; if ( $spremenljivka['enota'] == 3 ) { $options['sums_spec'] = true; $_from = 'sums'; } break; case 7: # variabla tipa »število« $options['sums*'] = false; $_from = 'sums'; break; case 8: # datum $options['sums'] = false; $options['sums*'] = false; break; case 16: #multicheckbox če je dihotomna: break; case 17: #razvrščanje če je ordinalna $options['sums'] = false; break; case 18: # vsota $options['sums*'] = false; $_from = 'sums'; break; case 19: # multitext $options['sums*'] = false; break; case 20: # multi number break; case 4: # text $options['sums'] = false; $options['sums*'] = false; $_from = 'freq'; break; case 21: # besedilo* if ($spremenljivka['cnt_all'] == 1) { // če je enodimenzionalna prikažemo kot frekvence // predvsem zaradi vprašanj tipa: language, email... $options['sums'] = false; } $options['sums*'] = false; $_from = 'freq'; break; case 26: # lokacija if ($spremenljivka['cnt_all'] == 1) { $options['sums'] = false; } $options['sums*'] = false; $_from = 'freq'; break; case 27: # heatmap if ($spremenljivka['cnt_all'] == 1) { $options['sums'] = false; } $options['sums*'] = false; $_from = 'freq'; break; case 22: # kalkulacija case 25: # kvota $options['sums*'] = false; $_from = 'sums'; break; # kalkulacija } $export = 'sums'; break; case 'none': break; } // Javna povezava nima teh ikon if ($printIcon == false && self::$printPreview == false) { echo ''; if ($options['sums'] == true) { if ($spremenljivka['tip'] == 1 || $spremenljivka['tip'] == 2 || $spremenljivka['tip'] == 3 ) { echo ''; } else { echo ''; } echo ' '; echo ''; } if ($options['sums_spec'] == true) { echo ''; echo ' '; echo ''; } if ($options['sums*'] == true) { if ($spremenljivka['tip'] == 1 || $spremenljivka['tip'] == 2 || $spremenljivka['tip'] == 3) { echo ''; }else { echo ''; } echo ' '; echo ''; } if ($options['desc'] == true) { echo ''; echo ' '; echo ''; } if ($options['freq'] == true) { echo ''; echo ' '; echo ''; } // Ikona za prikaz grafa if($showChart == true && in_array($spremenljivka['tip'],array(1,2,3,6,7,8,16,17,18,20,22)) && $_from != 'charts'){ echo ''; echo ' '; echo ''; } // Ikona za vkljucitev v porocilo switch ($_from) { case 'sums': case 'sums*': $type=1; break; case 'freq': $type=2; break; case 'desc': $type=3; break; case 'charts': $type=4; break; } if ($showReport == true) { SurveyAnalysisHelper::getInstance()->addCustomReportElement($type, $sub_type=0, $spid); } echo ''; } else { } } /** polovi opisne za vse spremenljivke * */ static public function getDescriptives() { global $site_path; $folder = $site_path . EXPORT_FOLDER.'/'; #array za imeni tmp fajlov, ki jih nato izbrišemo $tmp_files = array( 'filtred'=>$folder . 'tmp_export_'.self::$sid.'_filtred'.TMP_EXT, 'filtred1'=>$folder . 'tmp_export_'.self::$sid.'_filtred1'.TMP_EXT, 'frequency'=>$folder . 'tmp_export_'.self::$sid.'_freqency'.'.php', 'frequency1'=>$folder . 'tmp_export_'.self::$sid.'_freqency1'.'.php'); # naredimo datoteko z frekvencami # za windows sisteme in za linux sisteme # dodamo filter za loop-e if (isset(self::$_CURRENT_LOOP['filter']) && self::$_CURRENT_LOOP['filter'] != '') { $status_filter = self::$_CURRENT_STATUS_FILTER.' && '.self::$_CURRENT_LOOP['filter']; } else { $status_filter = self::$_CURRENT_STATUS_FILTER; } # s katero sekvenco se začnejo podatki, da ne delamo po nepotrebnem za ostala polja $start_sequence = (isset(self::$_HEADERS['_settings']['dataSequence']) && (int)self::$_HEADERS['_settings']['dataSequence'] > 0 ) ? (int)self::$_HEADERS['_settings']['dataSequence'] : 8; if (IS_WINDOWS) { # sfiltriramo statuse # $cmdLn1 = 'awk -F"|" "BEGIN {{OFS=\"\x7C\"} {ORS=\"\n\"} {FS=\"\x7C\"} {SUBSEP=\"\x7C\"}} '.$status_filter.' {for (i=4;i<=NF;i++) { arr[i,$i]++}} END {{for (n in arr) { print n,arr[n]}}}" '.self::$dataFileName. ' > '.$tmp_files['filtred']; # odstranimo ' # $cmdLn2 = 'sed "s*\x27*`*g" '.$tmp_files['filtred'].' > '.$tmp_files['filtred1']; # v loopu naredimo frekvence za vsa polja razen za prva 3 ki so tako unikatna # $cmdLn3 = 'awk -F"|" "BEGIN {{OFS=\"\"} {ORS=\"\n\"}} { print \"$frequency[\",$1,\"]\",\"[\x27\",$2,\"\x27]\",\"=\x27\",$3,\"\x27;\"}" '.$tmp_files['filtred1'].' >> '.$tmp_files['frequency']; # združimo v eno vrstico da bo strežnik bol srečen $command = 'awk -F"|" "BEGIN {{OFS=\"\x7C\"} {ORS=\"\n\"} {FS=\"\x7C\"} {SUBSEP=\"\x7C\"}} '.$status_filter.' {for (i='.$start_sequence.';i<=NF;i++) { arr[i,$i]++}} END {{for (n in arr) { print n,arr[n]}}}" '.self::$dataFileName; $command .= ' | sed "s*\x27*`*g"'; $command .= ' | awk -F"|" "BEGIN {{OFS=\"\"} {ORS=\"\n\"}} { print \"$frequency[\",$1,\"]\",\"[\x27\",$2,\"\x27]\",\"=\x27\",$3,\"\x27;\"}" >> '.$tmp_files['frequency']; } else { #$cmdLn1 = 'awk -F"|" \'BEGIN {{OFS="|"} {ORS="\n"} {FS="|"} {SUBSEP="|"}} '.$status_filter.' {for (i=4;i<=NF;i++) { arr[i,$i]++}} END {{for (n in arr) { print n,arr[n]}}}\' '.self::$dataFileName. ' > '.$tmp_files['filtred']; #$cmdLn2 = 'sed \'s*\x27*`*g\' '.$tmp_files['filtred'].' > '.$tmp_files['filtred1']; #$cmdLn3 = 'awk -F"|" \'BEGIN {{OFS=""} {ORS="\n"}} { print "$frequency[",$1,"]","[\x27",$2,"\x27]","=\x27",$3,"\x27;"}\' '.$tmp_files['filtred1'].' >> '.$tmp_files['frequency']; # združimo v eno vrstico da bo strežnik bol srečen $command = 'awk -F"|" \'BEGIN {{OFS="|"} {ORS="\n"} {FS="|"} {SUBSEP="|"}} '.$status_filter.' {for (i='.$start_sequence.';i<=NF;i++) { arr[i,$i]++}} END {{for (n in arr) { print n,arr[n]}}}\' '.self::$dataFileName; $command .= ' | sed \'s*\x27*`*g\''; $command .= ' | awk -F"|" \'BEGIN {{OFS=""} {ORS="\n"}} { print "$frequency[",$1,"]","[\x27",$2,"\x27]","=\x27",$3,"\x27;"}\' >> '.$tmp_files['frequency']; } #$out1 = shell_exec($cmdLn1); #$out2 = shell_exec($cmdLn2); $file_handler = fopen($tmp_files['frequency'],"w"); fwrite($file_handler,"'); fclose($file_handler); include($tmp_files['frequency']); if (file_exists($tmp_files['frequency'])) { unlink($tmp_files['frequency']); } if ($_GET['debug'] == 1) { print_r("
");
			print_r("cl:".$command);
			print_r("
Out".$out); print_r("
"); } # inicializiramo self::$_DESCRIPTIVES = array(); # kateri odgovori so z profilom nastavljeni kot manjkajoči # se dodelijo k missing values in se ne upoštevajo pri povprečju $_invalidAnswers = self :: getInvalidAnswers (MISSING_TYPE_DESCRIPTOR); $_allMissing_answers = SurveyMissingValues::GetMissingValuesForSurvey(array(1,2,3)); # izračunamo vse kar rabimo pri opisnih foreach (self::$_HEADERS AS $spid => $spremenljivka) { # kadar imamo pri spremenljvki missinge, tudi prikazujemmo veljavne procente najprej damo na false # preverjamo da ni meta variabla $vars_count = count(self::$_FILTRED_VARIABLES); # frekvence delamo samo za izbrane variable if ($spremenljivka['tip'] != 'm' # filter po id spremenljivki && ($vars_count == 0 || ($vars_count > 0 && isset(self::$_FILTRED_VARIABLES[$spid]) ) ) # filter po tipu (kategorije, besedila, number, drugo) && in_array($spremenljivka['tip'], self::$_FILTRED_TYPES ) ) { // if != m if (count($spremenljivka['grids'])>0) { foreach ($spremenljivka['grids'] AS $gid => $grid) { if (count($grid['variables']) > 0) { foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki $_freq = $frequency[$_sequence]; $min = null; $max = null; $_tmp_div = array(); self::$_DESCRIPTIVES[$_sequence]['sum_xi_fi'] = null; #najprej odstranimo neveljavne, vse kaj ostane je veljavno foreach ($_invalidAnswers AS $ikey =>$iAnswer) { if (isset($_freq[$ikey])) { self::$_DESCRIPTIVES[$_sequence]['invalidCnt'] += $_freq[$ikey]; self::$_DESCRIPTIVES[$_sequence]['allCnt'] += $_freq[$ikey]; unset($_freq[$ikey]); } } # poiščemo minimum in maximum in povprečje # opcijske odgovore dodamo samo vprašanjem ki niso tipa other in text # zloopamo skozi vse opcije in jih dodamo k veljavnim if ($variable['text'] != true && $variable['other'] != true && count($spremenljivka['options']) > 0) { if (count($_freq) > 0) { foreach($_freq AS $fKey => $fCnt) { $flKey = (float)$fKey; if (is_numeric($flKey) && trim($flkey) != '' ) { self::$_DESCRIPTIVES[$_sequence]['validCnt'] += $fCnt; self::$_DESCRIPTIVES[$_sequence]['allCnt'] += $fCnt; $min = $min === null ? $flKey : min($min,$flKey) ; $max = $max === null ? $flKey : max($max,$flKey) ; self::$_DESCRIPTIVES[$_sequence]['sum_xi_fi'] += $flKey * $fCnt; #vrednosti si shranimo za računanje divergence $_tmp_div[$flKey] = $fCnt; unset($_freq[$fKey]); } else if (is_numeric($fKey) ) { self::$_DESCRIPTIVES[$_sequence]['validCnt'] += $fCnt; self::$_DESCRIPTIVES[$_sequence]['allCnt'] += $fCnt; $min = $min === null ? $fKey : min($min,$fKey) ; $max = $max === null ? $fKey : max($max,$fKey) ; self::$_DESCRIPTIVES[$_sequence]['sum_xi_fi'] += $fKey * $fCnt; #vrednosti si shranimo za računanje divergence $_tmp_div[$fKey] = $fCnt; unset($_freq[$fKey]); } } } } #porihtamo še numerične in datumske spremenljivke if (($spremenljivka['tip'] == 7 || $spremenljivka['tip'] == 8 || $spremenljivka['tip'] == 20 || $spremenljivka['tip'] == 18) && ($variable['text'] != true && $variable['other'] != true)) { if (count($_freq) > 0) { foreach ($_freq AS $nkey => $nCnt) { $fnkey = (float)$nkey; # popravimo morebitne . if (is_numeric($nkey) && is_numeric($fnkey) && trim($fnkey) != '') { self::$_DESCRIPTIVES[$_sequence]['validCnt'] += $nCnt; self::$_DESCRIPTIVES[$_sequence]['allCnt'] += $nCnt; $min = $min != null ? min($min,$fnkey) : $fnkey; $max = $max != null ? max($max,$fnkey) : $fnkey; self::$_DESCRIPTIVES[$_sequence]['sum_xi_fi'] += $fnkey * $nCnt; #vrednosti si shranimo za računanje divergence $_tmp_div[$fnkey] = $nCnt; unset($_freq[$nkey]); } } } } # lahko bi še za datum # vse kaj ostane so textovni odgovori ali pa opcijski z nenumeričnim ključem if (count($_freq) > 0) { foreach ($_freq AS $tkey => $tCnt) { if (isset($_allMissing_answers[$tkey])) { $text = $_allMissing_answers[$tkey]; } else { $text = $tkey; } self::$_DESCRIPTIVES[$_sequence]['valid'][$tkey] = array('text'=>$text,'cnt'=>$tCnt); # samo prištejemo veljavne self::$_DESCRIPTIVES[$_sequence]['validCnt'] += $tCnt; self::$_DESCRIPTIVES[$_sequence]['allCnt'] += $tCnt; unset($_freq[$tkey]); } } # minimum in maximum self::$_DESCRIPTIVES[$_sequence]['min'] = $min; self::$_DESCRIPTIVES[$_sequence]['max'] = $max; # povprečje if (isset(self::$_DESCRIPTIVES[$_sequence]['sum_xi_fi'])) { self::$_DESCRIPTIVES[$_sequence]['avg'] = self::$_DESCRIPTIVES[$_sequence]['validCnt'] > 0 ? self::$_DESCRIPTIVES[$_sequence]['sum_xi_fi'] / self::$_DESCRIPTIVES[$_sequence]['validCnt'] : 0; } #standardna diviacija if (isset (self::$_DESCRIPTIVES[$_sequence]['avg'])) { $N = self::$_DESCRIPTIVES[$_sequence]['validCnt']; $avg = self::$_DESCRIPTIVES[$_sequence]['avg']; $div = 0; $sum_pow_xi_fi_avg = 0; foreach ($_tmp_div as $xi => $fi) { $sum_pow_xi_fi_avg += pow(($xi - $avg),2) * $fi; } self::$_DESCRIPTIVES[$_sequence]['div'] = (($N -1) > 0) ? sqrt($sum_pow_xi_fi_avg / ($N -1)) : 0; } } } } } } // end if tip != m } // end foreach } /** polovi frekvence za vse spremenljivke * */ static public function getFrequencys($awk_filter = null) { global $site_path; $folder = $site_path . EXPORT_FOLDER.'/'; # pobrišemo morebitne stare vrednosti self::$_FREQUENCYS = array(); #array za imeni tmp fajlov, ki jih nato izbrišemo $tmp_files = array( 'frequency'=>$folder . 'tmp_export_'.self::$sid.'_freqency'.'.php'); # dodamo filter za loop-e if (isset(self::$_CURRENT_LOOP['filter']) && self::$_CURRENT_LOOP['filter'] != '') { $status_filter = self::$_CURRENT_STATUS_FILTER.' && '.self::$_CURRENT_LOOP['filter']; } else { $status_filter = self::$_CURRENT_STATUS_FILTER; } # dodamo še dodaten awk filter če je nastavljen - (za break) if ($awk_filter != null) { $status_filter = '('.$status_filter.'&&'.$awk_filter.')'; } # s katero sekvenco se začnejo podatki, da ne delamo po nepotrebnem za ostala polja $start_sequence = (isset(self::$_HEADERS['_settings']['dataSequence']) && (int)self::$_HEADERS['_settings']['dataSequence'] > 0 ) ? (int)self::$_HEADERS['_settings']['dataSequence'] : 8; # s katero sekvenco se končajo podatki da ne delamo po nepotrebnem za ostala polja $end_sequence = $start_sequence; if (!empty(self::$_HEADERS)) { foreach (self::$_HEADERS AS $skey => $spremenljivka) { $tip = $spremenljivka['tip']; if (is_numeric($tip)) { if (count($spremenljivka['grids'] ) > 0) { foreach ($spremenljivka['grids'] as $gid => $grid ){ if (is_countable($grid['variables']) && count($grid['variables']) > 0) { foreach ($grid['variables'] as $vid => $variable ){ $end_sequence = max($end_sequence, (int)$variable['sequence']); } } } } } } } # naredimo datoteko z frekvencami # za windows sisteme in za linux sisteme if (IS_WINDOWS ) { # TEST z LINUX načinom # združimo v eno vrstico da bo strežnik bol srečen $command = 'awk -F"|" "BEGIN {{OFS=\"\x7C\"} {ORS=\"\n\"} {FS=\"\x7C\"} {SUBSEP=\"\x7C\"}} '.$status_filter.' {for (i='.$start_sequence.';i<='.$end_sequence.';i++) { arr[i,$i]++}} END {{for (n in arr) { print n,arr[n]}}}" '.self::$dataFileName; $command .= ' | sed "s*\x27*`*g" '; $command .= ' | awk -F"|" "BEGIN {{OFS=\"\"} {ORS=\"\n\"}} { print \"$frequency[\",$1,\"]\",\"[\x27\",$2,\"\x27]\",\"=\x27\",$3,\"\x27;\"}" >> '.$tmp_files['frequency']; } else { # združimo v eno vrstico da bo strežnik bol srečen $command = 'awk -F"|" \'BEGIN {{OFS="|"} {ORS="\n"} {FS="|"} {SUBSEP="|"}} '.$status_filter.' {for (i='.$start_sequence.';i<='.$end_sequence.';i++) { arr[i,$i]++}} END {{for (n in arr) { print n,arr[n]}}}\' '.self::$dataFileName; $command .= ' | sed \'s*\x27*`*g\' '; $command .= ' | awk -F"|" \'BEGIN {{OFS=""} {ORS="\n"}} { print "$frequency[",$1,"]","[\x27",$2,"\x27]","=\x27",$3,"\x27;"}\' >> '.$tmp_files['frequency']; } $file_handler = fopen($tmp_files['frequency'],"w"); fwrite($file_handler,"'); fclose($file_handler); include($tmp_files['frequency']); # pobrišemo sfiltrirane podatke, ker jih več ne rabimo if (file_exists($tmp_files['frequency'])) { unlink($tmp_files['frequency']); } # kateri odgovori so z profilom nastavljeni kot manjkajoči # se dodelijo k missing values in se ne upoštevajo pri povprečju # dodano se za break, ker drugace so bila v breaku negativna povprecja. Mozno da to ne bo ok za nekatere primere breaka?? if (self::$podstran == M_ANALYSIS_BREAK || self::$podstran == M_ANALYSIS_SUMMARY || self::$podstran == M_ANALYSIS_SUMMARY_NEW || self::$podstran == 'sums' || self::$podstran == 'sums_rtf' || self::$podstran == 'sums_xls') { $_invalidAnswers = self :: getInvalidAnswers (MISSING_TYPE_DESCRIPTOR); } else { $_invalidAnswers = self :: getInvalidAnswers (MISSING_TYPE_FREQUENCY); } $_allMissing_answers = SurveyMissingValues::GetMissingValuesForSurvey(array(1,2,3)); # izračunamo vse frekvence oziroma vse kar rabimo pri analizah if(!empty(self::$_HEADERS)) foreach (self::$_HEADERS AS $spid => $spremenljivka) { # kadar imamo pri spremenljvki missinge, tudi prikazujemmo veljavne procente najprej damo na false self::$_HEADERS[$spid]['show_valid_percent'] = false; # preverjamo da ni meta variabla $vars_count = count(self::$_FILTRED_VARIABLES); # frekvence delamo samo za izbrane variable if ($spremenljivka['tip'] != 'm' # filter po id spremenljivki && ($vars_count == 0 || ($vars_count > 0 && isset(self::$_FILTRED_VARIABLES[$spid]) ) ) # filter po tipu (kategorije, besedila, number, drugo) && in_array($spremenljivka['tip'], self::$_FILTRED_TYPES ) ) { if ($spremenljivka['tip'] == 1 || $spremenljivka['tip'] == 3) { self::$_HEADERS[$spid]['show_valid_percent'] = true; } if (count ($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] AS $gid => $grid) { if (count ($grid['variables']) > 0) foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki $_freq = $frequency[$_sequence]; #najprej dodamo neveljavne, vse kaj ostane je veljavno foreach ($_invalidAnswers AS $ikey =>$iAnswer) { if (self::$frequencyAddInvalid) { self::$_FREQUENCYS[$_sequence]['invalid'][$ikey] = $iAnswer; } if (isset($_freq[$ikey])) { if (self::$frequencyAddInvalid) { self::$_FREQUENCYS[$_sequence]['invalid'][$ikey]['cnt'] = $_freq[$ikey]; self::$_FREQUENCYS[$_sequence]['invalidCnt'] += $_freq[$ikey]; self::$_FREQUENCYS[$_sequence]['allCnt'] += $_freq[$ikey]; } unset($_freq[$ikey]); # kadar imamo pri spremenljvki missinge, tudi prikazujemmo veljavne procente self::$_HEADERS[$spid]['show_valid_percent'] = true; } } # opcijske odgovore dodamo samo vprašanjem ki niso tipa other in text # zloopamo skozi vse opcije in jih dodamo k veljavnim if ($variable['text'] != true && $variable['other'] != true && is_countable($spremenljivka['options']) && count($spremenljivka['options']) > 0) { foreach ($spremenljivka['options'] AS $okey => $oAnswer) { self::$_FREQUENCYS[$_sequence]['valid'][$okey]['text'] = $oAnswer; self::$_FREQUENCYS[$_sequence]['valid'][$okey]['text_graf'] = $spremenljivka['options_graf'][$okey]; self::$_FREQUENCYS[$_sequence]['valid'][$okey]['cnt'] = 0; if (isset($_freq[$okey])) { self::$_FREQUENCYS[$_sequence]['valid'][$okey]['cnt'] = $_freq[$okey]; self::$_FREQUENCYS[$_sequence]['validCnt'] += $_freq[$okey]; self::$_FREQUENCYS[$_sequence]['allCnt'] += $_freq[$okey]; unset($_freq[$okey]); } } } # vse kaj ostane so textovni ali numerični odgovori if (is_countable($_freq) && count($_freq) > 0) { $_ifreq = array(); # nardimo case-insensitive foreach ($_freq AS $tkey => $tCnt) { //if($spremenljivka['tip'] != 26) if($spremenljivka['tip'] != 26 && $spremenljivka['tip'] != 27) $tkey = mb_strtolower($tkey,'UTF-8'); $_ifreq[$tkey] += $tCnt; } $_average = array(); if(is_countable($spremenljivka['options'])) $i = count($spremenljivka['options']) + 1; else $i = 0; foreach ($_ifreq AS $tkey => $tCnt) { # preverimo ali je slučanjo odgovor missing vendar je določen kot veljavni odgovor if (isset($_allMissing_answers[$tkey])) { $text = $tkey . ' '.$_allMissing_answers[$tkey]; } else { $text = $tkey; } self::$_FREQUENCYS[$_sequence]['valid'][$tkey] = array('text'=>$text,'cnt'=>$tCnt,'text_graf'=>$spremenljivka['options_graf'][$i]); self::$_FREQUENCYS[$_sequence]['validCnt'] += $tCnt; self::$_FREQUENCYS[$_sequence]['allCnt'] += $tCnt; //Uros dodal, ker se drugace pri radio ne ve, kaksen je text opcije drugo if($variable['other']) self::$_FREQUENCYS[$_sequence]['valid'][$tkey]['other'] = $variable['naslov']; # povprečje if (is_numeric($tkey)) { $_average['product'] = $_average['product'] + ($tkey * $tCnt); $_average['cnt'] = $_average['cnt'] + $tCnt; } unset($_freq[$tkey]); $i++; } self::$_FREQUENCYS[$_sequence]['average'] = ($_average['cnt'] > 0) ? $_average['product'] / $_average['cnt'] : $_average['cnt']; } unset($frequency[$_sequence]); } } } // end if tip != m } unset($frequency); return self::$_FREQUENCYS; } static function frequencyAddInvalid($doAdd = true) { self::$frequencyAddInvalid = $doAdd; } /** polovi dejanske odgovore za spremenljivko * @param $need_user_id - ali se rabi tudi vrniti user_id? */ static public function getAnswers($spremenljivka, $limit=10, $need_user_id = false) { global $site_path; $folder = $site_path . EXPORT_FOLDER.'/'; $result = array(); $sequences = array(); $sequenc_filter = array(); if (count($spremenljivka['grids']) > 0) { foreach ($spremenljivka['grids'] AS $gid => $grid) { if (count ($grid['variables']) > 0) { foreach ($grid['variables'] AS $vid => $variable ) { $sequences[] = '$'.$variable['sequence']; if (IS_WINDOWS ) { $sequenc_filter[] = '\''.$variable['sequence'].'\'=\x3E\",\"\x27\",$'.$variable['sequence'].',\"\x27'; } else { $sequenc_filter[] = '\''.$variable['sequence'].'\'=\x3E","\x27",$'.$variable['sequence'].',"\x27'; } } } } } # pobrišemo morebitne stare vrednosti #array za imeni tmp fajlov, ki jih nato izbrišemo $tmp_files = array( 'filtred'=>$folder . 'tmp_export_'.self::$sid.'_filtred'.TMP_EXT, 'filtred1'=>$folder . 'tmp_export_'.self::$sid.'_filtred1'.TMP_EXT, 'filtred_pagination'=>$folder . 'tmp_export_'.self::$sid.'_pagination'.TMP_EXT, 'answers'=>$folder . 'tmp_export_'.self::$sid.'_answers'.'.php'); # dodamo filter za loop-e if (isset(self::$_CURRENT_LOOP['filter']) && self::$_CURRENT_LOOP['filter'] != '') { $status_filter = self::$_CURRENT_STATUS_FILTER.' && '.self::$_CURRENT_LOOP['filter']; } else { $status_filter = self::$_CURRENT_STATUS_FILTER; } // Limit po novem omejimo z filtriranjem array-a //$_REC_LIMIT = ' NR==1,NR=='.$limit; //za tip lokacija (ne enota 3) se rabi user_id, ker se kasneje delajo linki $array_key = $need_user_id ? '{x=$1}' : '{x++}'; # naredimo datoteko z frekvencami # za windows sisteme in za linux sisteme if (IS_WINDOWS ) { # TEST z LINUX načinom # $cmdLn1 = 'awk -F"|" "BEGIN {{OFS=\"\x7C\"} {ORS=\"\n\"} {FS=\"\x7C\"} {SUBSEP=\"\x7C\"}} '.$status_filter.' { print $0}" '.self::$dataFileName. ' > '.$tmp_files['filtred']; # $cmdLn2 = 'sed "s*\x27*`*g" '.$tmp_files['filtred'].' > '.$tmp_files['filtred1']; # $cmdLn4 = 'awk -F"|" "BEGIN {{OFS=\"\"} {ORS=\"\n\"}} {x++} { print \"$answers[\",x,\"]=array('.implode(',',$sequenc_filter).');\"}" '.$tmp_files['filtred1'].' >> '.$tmp_files['answers']; $command = 'awk -F"|" "BEGIN {{OFS=\"\x7C\"} {ORS=\"\n\"} {FS=\"\x7C\"} {SUBSEP=\"\x7C\"}} '.$status_filter.' { print $0}" '.self::$dataFileName; $command .= ' | sed "s*\x27*`*g"'; $command .= ' | awk -F"|" "BEGIN {{OFS=\"\"} {ORS=\"\n\"}} '.$array_key.' { print \"$answers[\",x,\"]=array('.implode(',',$sequenc_filter).');\"}" >> '.$tmp_files['answers']; } else { # $cmdLn1 = 'awk -F"|" \'BEGIN {{OFS="|"} {ORS="\n"} {FS="|"} {SUBSEP="|"}} '.$status_filter.' {print $0}\' '.self::$dataFileName. ' > '.$tmp_files['filtred']; # $cmdLn2 = 'sed \'s*\x27*`*g\' '.$tmp_files['filtred'].' > '.$tmp_files['filtred1']; # $cmdLn4 = 'awk -F"|" \'BEGIN {{OFS=""} {ORS="\n"}} {x++} { print "$answers[",x,"]=array('.implode(',',$sequenc_filter).');"}\' '.$tmp_files['filtred1'].' >> '.$tmp_files['answers']; $command = 'awk -F"|" \'BEGIN {{OFS="|"} {ORS="\n"} {FS="|"} {SUBSEP="|"}} '.$status_filter.' {print $0}\' '.self::$dataFileName; $command .= ' | sed \'s*\x27*`*g\''; $command .= ' | awk -F"|" \'BEGIN {{OFS=""} {ORS="\n"}} '.$array_key.' { print "$answers[",x,"]=array('.implode(',',$sequenc_filter).');"}\' >> '.$tmp_files['answers']; } #$out1 = shell_exec($cmdLn1); #$out2 = shell_exec($cmdLn2); $file_handler = fopen($tmp_files['answers'],"w"); fwrite($file_handler,"'); fclose($file_handler); include($tmp_files['answers']);//tukaj se deklarira spremenljivka $answers if (file_exists($tmp_files['answers'])) { unlink($tmp_files['answers']); } # PREFILTRIRAMO PODATKE PO POTREBI ODSTRANIMO MANJKAJOČE VREDNOSTI # zloopamo skozi celotne odgovore in odstranimo tiste ki so missingi # kateri odgovori so z profilom nastavljeni kot manjkajoči # se dodelijo k missing values in se ne upoštevajo pri povprečju $_invalidAnswers = self :: getInvalidAnswers (MISSING_TYPE_FREQUENCY); $_allMissing_answers = SurveyMissingValues::GetMissingValuesForSurvey(array(1,2,3)); $_result_answers = array(); $_result_answers['validCnt'] = 0; if (count($answers) > 0) { foreach ($answers AS $akey => $answer) { $cnt++; $all_invalid = true; # ali je vse neveljavno foreach ($answer AS $seq => $value) { # preverimo ali je kateri odgovor od userja vlejaven if (!isset($_allMissing_answers[$value]) && !isset($_invalidAnswers[$value])) { $all_invalid = false; } # ločimo odgovore na veljavne in nevlejavne } if ($all_invalid == FALSE) { # imamo vsaj en veljaven odgovor if ($limit == -1 || $_result_answers['validCnt'] < $limit) { //ce smo nastavili $need_user_id, vkljucimo user_id kot key odgovorov v valid array if(!$need_user_id) $_result_answers['valid'][] = $answer; else $_result_answers['valid'][$akey] = $answer; } # koliko je vseh veljavnih $_result_answers['validCnt']++; } else { # vsi odgovori so neveljavni $_result_answers['invalid'][] = $answer; $_result_answers['invalidCnt']++; } $_result_answers['allCnt']++; } } return $_result_answers; } public static function showspremenljivkaSingleVarPopup($id) { global $lang; self::$_forceShowEmpty = true; header('Cache-Control: no-cache'); header('Pragma: no-cache'); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); $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 ''; # vse elemente forem echo ""; echo ''; echo ''; echo ''; echo ''; $id = $_POST['id']; $spremenljivka = self::$_HEADERS[$id]; $_tip = self::getSpremenljivkaLegenda($spremenljivka,'tip'); $zaPodstran = $_POST['zaPodstran']; $legend = Cache::spremenljivkaLegenda($id); echo ''; self::showIcons($id,$spremenljivka,'desc'); echo ''; echo ''.$lang['srv_analiza_opisne_variable_type'].': '; echo $_tip.' '; echo '('.$legend['izrazanje'].' - '.$legend['lestvica'].')'; echo ' '; echo '
'; echo '
'; echo '
'; self:: showPreviewSpremenljivka($id); echo '
'; echo ''; echo ''; echo ''; } public static function showSpremenljivkaTextAnswersPopup($id,$seq) { global $lang; self::$_forceShowEmpty = true; header('Cache-Control: no-cache'); header('Pragma: no-cache'); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); $anketa = $_REQUEST['anketa']; #izpišemo HTML echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; $id = $_POST['id']; $seq = $_POST['seq']; $zaPodstran = $_POST['zaPodstran']; $spremenljivka = self::$_HEADERS[$id]; # koliko zapisov prikažemo naenkrat $num_show_records = self::getNumRecords(); $num_show_records = 9999999; # poiščemo navedbe textovne spremenljivke tako kot v grafih $_answers = self::getAnswers($spremenljivka,$num_show_records); if (count($_answers['valid']) > 0) { echo ''; foreach ($_answers['valid'] AS $vkey => $valid) { $_valid = $valid[$seq]; echo ''; } echo '
'; echo $_valid; echo '
'; echo '
'; } echo '
'; echo ''; echo ''; echo ''; } /** Prikaže opsine, frekvence, sumarnik, za samo eno variablo * * @param unknown_type $id */ public static function DisplaySingleVarPopup ($id,$zaPodstran) { global $site_url, $lang; self::$_forceShowEmpty = true; header('Cache-Control: no-cache'); header('Pragma: no-cache'); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); $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 ''; echo '
'; $id = $_POST['id']; $zaPodstran = $_POST['zaPodstran']; # polovimo nastavtve missing profila self::$missingProfileData = SurveyMissingProfiles::getProfile(self::$currentMissingProfile); if (self::$podstran != M_ANALYSIS_ARCHIVE) { self::$_LOOPS = SurveyZankaProfiles::getFiltersForLoops(); } if (!is_array(self::$_LOOPS)) { self::$_LOOPS[] = array('filter'=>null,'text'=>null); } $loop_cnt = 0; # ce mamo zanke foreach ( self::$_LOOPS AS $loop) { if ($loop['filter'] != null) { $loop_cnt++; $loop['cnt'] = $loop_cnt; self::$_CURRENT_LOOP = $loop; if ((int)$loop_cnt == (int)$_POST['loop']) { echo '

'.$lang['srv_zanka_note'].$loop['text'].'

'; } } if ((int)$loop_cnt == (int)$_POST['loop']) { switch ($zaPodstran) { case M_ANALYSIS_SUMMARY_NEW : self::displaySumsNew($id); $export = 'sums'; break; case M_ANALYSIS_SUMMARY : self::displaySums($id); $export = 'sums'; break; case M_ANALYSIS_DESCRIPTOR : self::displayDescriptives($id); $export = 'statistics'; break; case M_ANALYSIS_FREQUENCY : self::displayFrequency($id); $export = 'frequency'; break; case M_ANALYSIS_CHARTS : $chartClass = new SurveyChart(); $chartClass->Init($anketa); $chartClass->displaySingle($id); $export = 'charts'; break; } //Izvoz v PDF/RTF $loop_exp = (isset(self::$_CURRENT_LOOP)) ? self::$_CURRENT_LOOP['cnt'] : 'undefined'; $_url1 = $site_url.'admin/survey/izvoz.php?dc='.base64_encode( serialize( array( 'b'=>'export', 'm'=>$export, 'anketa'=>$anketa, 'sprID'=>$id, 'loop'=>$loop_exp))); $_url2 = $site_url.'admin/survey/izvoz.php?dc='.base64_encode( serialize( array( 'b'=>'export', 'm'=>$export.'_rtf', 'anketa'=>$anketa, 'sprID'=>$id, 'loop'=>$loop_exp))); $_url3 = $site_url.'admin/survey/izvoz.php?dc='.base64_encode( serialize( array( 'b'=>'export', 'm'=>$export.'_xls', 'anketa'=>$anketa, 'sprID'=>$id, 'loop'=>$loop_exp))); echo '
'; echo ''; echo '   '; //if($export == 'frequency') if($zaPodstran != M_ANALYSIS_CHARTS ) { echo '   '; } } } echo '
'; echo '
'; echo ''; echo ''; echo ''; } /** Sestavi array nepravilnih odgovorov * */ static function getInvalidAnswers($type) { $result = array(); $missingValuesForAnalysis = SurveyMissingProfiles :: GetMissingValuesForAnalysis($type); foreach ($missingValuesForAnalysis AS $k => $answer) { $result[$k] = array('text'=>$answer,'cnt'=>0); } return $result; } static function formatNumber ($value, $digit = 0, $sufix = "") { if ($value <> 0 && $value != null) $result = round($value, $digit); else $result = "0"; # polovimo decimalna mesta in vejice za tisočice $decimal_point = SurveyDataSettingProfiles :: getSetting('decimal_point'); $thousands = SurveyDataSettingProfiles :: getSetting('thousands'); $result = number_format($result, $digit, $decimal_point, $thousands) . $sufix; return $result; } static function getSpremenljivkaLegenda ($spremenljivka, $what='') { $legenda = Cache::spremenljivkaLegenda($spremenljivka['spr_id']); return $legenda[$what]; } /** razdelek za Ajax klice * */ public function ajax() { if (isset ($_POST['corssVar1'])) $corssVar1 = $_POST['corssVar1']; if (isset ($_POST['corssVar2'])) $corssVar2 = $_POST['corssVar2']; if (isset ($_POST['corssZanka'])) $corssZanka = $_POST['corssZanka']; if (isset ($_POST['crossChk0'])) $crossChk0 = $_POST['crossChk0']; if (isset ($_POST['crossChk1'])) $crossChk1 = $_POST['crossChk1']; if (isset ($_POST['crossChk2'])) $crossChk2 = $_POST['crossChk2']; if (isset ($_POST['crossChk3'])) $crossChk3 = $_POST['crossChk3']; if (isset ($_POST['crossChkEC'])) $crossChkEC = $_POST['crossChkEC']; if (isset ($_POST['crossChkRE'])) $crossChkRE = $_POST['crossChkRE']; if (isset ($_POST['crossChkSR'])) $crossChkSR = $_POST['crossChkSR']; if (isset ($_POST['crossChkAR'])) $crossChkAR = $_POST['crossChkAR']; if (isset ($_POST['doColor'])) $doColor = $_POST['doColor']; switch ($_GET['a']) { case 'loadMissingProfile' : self :: loadMissingProfile(); break; case 'reloadData' : self :: Display(); break; case 'showAnalizaSingleVarPopup' : self :: DisplaySingleVarPopup($_POST['id'],$_POST['zaPodstran']); break; case 'showspremenljivkaSingleVarPopup' : self :: showspremenljivkaSingleVarPopup($_POST['id']); break; case 'showSpremenljivkaTextAnswersPopup' : self :: showSpremenljivkaTextAnswersPopup($_POST['id'],$_POST['seq']); break; case 'show_crostabs_dropdowns' : self :: displayDropdowns($corssVar1, $corssVar2, $corssZanka); break; case 'show_crostabs_table' : self :: displayCrosstabsTable($corssVar1, $corssVar2, $corssZanka, $crossChk0, $crossChk1, $crossChk2, $crossChk3, $crossChkEC, $crossChkRE, $crossChkSR, $crossChkAR, $doColor); break; case 'preview_spremenljivka' : self:: showPreviewSpremenljivka($_POST['spremenljivka']); break; case 'printPreview_spremenljivka' : self:: printPreviewSpremenljivka($_POST['id']); break; case 'toggleAnalysisAdvanced' : self:: toggleAnalysisAdvanced(); break; case 'changeAnalizaPreview' : self:: changeAnalizaPreview(); break; case 'show_spid_more_table' : self:: show_sum_more_table(); break; case 'changeSpremenljivkaLestvica' : self:: changeSpremenljivkaLestvica(); break; default: echo 'Error! (class: SurveyAnalysis->ajax() - missing action)'; break; } } /** izpiše linke - povezave do pdf ,rtf datotek vprašalnika in analiz * */ public static function DisplayReportsLinks() { global $lang, $global_user_id; if (self::$dataFileStatus == FILE_STATUS_NO_DATA || self::$dataFileStatus == -3 || self::$noHeader == true) { return false; } SurveyUserSetting :: getInstance()->Init(self::$sid, $global_user_id); SurveyAnalysis::DisplayFilters(); /* // Link na navadna porocila echo ''; // Link na porocilo po meri echo ''; */ echo ''; // ANALIZE echo ''; echo '
'; echo '
'; echo ''.$lang['srv_analiza'].''; # linki - analize sumarnik echo '' . $lang['srv_sumarnik'] . ''; echo '' . ' PDF - (Adobe Acrobat)'; echo '
'; echo '' . ' DOC - (Microsoft Word)'; echo '
'; echo '' . ' XLS - (Microsoft Excel)'; # linki - analize opisne statistike echo '' . $lang['srv_descriptor'] . ''; echo '' . ' PDF - (Adobe Acrobat)'; echo '
'; echo '' . ' DOC - (Microsoft Word)'; echo '
'; echo '' . ' XLS - (Microsoft Excel)'; # linki - analize frekvence echo '' . $lang['srv_frequency'] . ''; echo '' . ' PDF - (Adobe Acrobat)'; echo '
'; echo '' . ' DOC - (Microsoft Word)'; echo '
'; echo '' . ' XLS - (Microsoft Excel)'; echo '
'; // VPRASALNIK echo '
'; echo '
'; echo ''.$lang['srv_analysis_links_survey'].''; # linki - vprašalnik echo '' . ' PDF - (Adobe Acrobat)'; echo '
'; echo '' . ' DOC - (Microsoft Word)'; echo '
'; // IZPIS echo '
'; echo '
'; echo ''.$lang['srv_statistic'].''; # linki - vpogled echo '' . $lang['srv_analysis_links_vpogled'] . ''; echo '' . '' . $lang['srv_link_data_view'] . ''; # linki - izpis vseh odgovorov echo '' . $lang['srv_analysis_links_allAnswers'] . ''; echo '' . $lang['srv_analysis_links_allAnswers_note'] . '
'; echo '' . ' PDF - (Adobe Acrobat)'; echo '
'; echo '' . ' DOC - (Microsoft Word)'; echo '
'; echo '
'; } private static function printAnalizaSingleVar() { global $lang; 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 '
'; $id = $_POST['id']; $zaPodstran = $_POST['zaPodstran']; switch ($zaPodstran) { case M_ANALYSIS_SUMMARY_NEW : self::displaySumsNew($id); break; case M_ANALYSIS_SUMMARY : self::displaySums($id); break; case M_ANALYSIS_DESCRIPTOR : self::displayDescriptives($id); break; case M_ANALYSIS_FREQUENCY : self::displayFrequency($id); break; } echo '
'; echo ''; echo ''; echo ''; } function showPreviewSpremenljivka($spremenljivka) { global $lang, $site_path; SurveyInfo :: getInstance()->SurveyInit($anketa); $offset = 0; $zaporedna = 0; $count_type = SurveyInfo :: getInstance()->getSurveyCountType(); if ($count_type) { // Preštejemo koliko vprašanj je bilo do sedaj $sqlg = sisplet_query("SELECT vrstni_red FROM srv_grupa WHERE id = (SELECT gru_id FROM srv_spremenljivka WHERE id = '" . $spremenljivka . "')"); $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='" . self :: $sid . "' 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=(SELECT gru_id FROM srv_spremenljivka WHERE id = '" . $spremenljivka . "') AND visible='1' ORDER BY vrstni_red ASC"); while ($row = mysqli_fetch_array($sql)) { if ($row['id'] == $spremenljivka) { $zaporedna++; break; } } } echo '
'; include_once('../../main/survey/app/global_function.php'); new \App\Controllers\SurveyController(true); if (isset($_POST['lang_id'])) { save('lang_id', (int)$_POST['lang_id']); } echo '
'; if ( $spremenljivka == -1 ) { \App\Controllers\BodyController::getInstance()->displayIntroduction(); } elseif ( $spremenljivka == -2 ) { \App\Controllers\BodyController::getInstance()->displayKonec(); } elseif ( $spremenljivka == -3 ) { \App\Controllers\StatisticController::displayStatistika(); } else { save('forceShowSpremenljivka', true); \App\Controllers\Vprasanja\VprasanjaController::getInstance()->displaySpremenljivka($spremenljivka, $offset, $zaporedna); } echo '
'; echo '
'; echo '
'; } function printPreviewSpremenljivka($spremenljivka) { global $lang; header('Cache-Control: no-cache'); header('Pragma: no-cache'); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); $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 ''; global $lang, $site_path; SurveyInfo :: getInstance()->SurveyInit($anketa); $offset = 0; $zaporedna = 0; $count_type = SurveyInfo :: getInstance()->getSurveyCountType(); if ($count_type) { // Preštejemo koliko vprašanj je bilo do sedaj $sqlg = sisplet_query("SELECT vrstni_red FROM srv_grupa WHERE id = (SELECT gru_id FROM srv_spremenljivka WHERE id = '" . $spremenljivka . "')"); $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='" . self :: $sid . "' 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=(SELECT gru_id FROM srv_spremenljivka WHERE id = '" . $spremenljivka . "') AND visible='1' ORDER BY vrstni_red ASC"); while ($row = mysqli_fetch_array($sql)) { if ($row['id'] == $spremenljivka) { $zaporedna++; break; } } } include_once('../../main/survey/app/global_function.php'); new \App\Controllers\SurveyController(true); if (isset($_POST['lang_id'])) { save('lang_id', (int)$_POST['lang_id']); } echo '
'; if ( $spremenljivka == -1 ) { \App\Controllers\BodyController::getInstance()->displayIntroduction(); } elseif ( $spremenljivka == -2 ) { \App\Controllers\BodyController::getInstance()->displayKonec(); } elseif ( $spremenljivka == -3 ) { \App\Controllers\StatisticController::displayStatistika(); } else { save('forceShowSpremenljivka', true); \App\Controllers\Vprasanja\VprasanjaController::getInstance()->displaySpremenljivka($_GET['spremenljivka']); } echo '
';// id="spremenljivka_preview" echo ''; echo ''; echo ''; } static function show_sum_more_table() { self :: $show_spid_div = false; self::$_LOOPS = SurveyZankaProfiles::getFiltersForLoops(); if (count(self::$_LOOPS) == 0 ) { if ($_POST['podstran'] == M_ANALYSIS_SUMMARY) { self :: displaySums($_POST['spid']); } else if ($_POST['podstran'] == M_ANALYSIS_SUMMARY_NEW) { self :: displaySumsNew($_POST['spid']); } else if ($_POST['podstran'] == M_ANALYSIS_FREQUENCY) { self :: displayFrequency($_POST['spid']); } } else { # če mamo zanke $loop_cnt = 0; foreach ( self::$_LOOPS AS $loop) { $loop_cnt++; $loop['cnt'] = $loop_cnt; self::$_CURRENT_LOOP = $loop; if ($loop['cnt'] == $_POST['loop_id']) { if ($_POST['podstran'] == M_ANALYSIS_SUMMARY) { self :: displaySums($_POST['spid']); } else if ($_POST['podstran'] == M_ANALYSIS_SUMMARY_NEW) { self :: displaySumsNew($_POST['spid']); } else if ($_POST['podstran'] == M_ANALYSIS_FREQUENCY) { self :: displayFrequency($_POST['spid']); } } } } echo ''; } static function getNumRecords() { if (isset($_POST['num_records']) && (int)$_POST['num_records'] > 0) { $result = (int)self::$textAnswersMore[$_POST['num_records']]; } else { $result = (int)SurveyDataSettingProfiles :: getSetting('numOpenAnswers'); } return $result; } /** @desc: Prikaže vsebino diva za izbiro filtriranja * */ function showFilterProfiles ($pid = -1) { global $lang; // profili za filtriranje echo '
'; echo ''.$lang['srv_analiza_filter'].'
'; SurveyFilterProfiles::Init(self::$sid, $global_user_id); $current_filter_profiles = SurveyFilterProfiles::getCurrentProfile(); $available_filter_profiles = SurveyFilterProfiles::getAvailableProfiles(); echo ''; echo ''; echo ''; echo '
'; } /** * * # odstranimo sistemske variable tipa email, ime, priimek, geslo oz. ce imamo vklopljeno nastavitev da skrivamo vse sistemske skrijemo vse sistem == 1 */ static function removeSystemVariables() { if (!empty(self::$_HEADERS)) { foreach (self::$_HEADERS AS $skey => $spremenljivka) { if ((int)$spremenljivka['hide_system'] == 1 && in_array($spremenljivka['variable'],array('email','ime','priimek','telefon','naziv','drugo'))) { unset(self::$_HEADERS[$skey]); } else if ((int)$spremenljivka['sistem'] == 1 && SurveyDataSettingProfiles :: getSetting('hideAllSystem') == 1) { unset(self::$_HEADERS[$skey]); } } } } /* * posortiramo veljavne odgovore kronološko, po datumu * */ static function sortTextValidAnswers($_spid,$variable,$answers) { if (is_string($answers)) { $answers = mb_strtolower($answers,'UTF-8'); } # Polovimo kronološki potek odgovorov $spid = explode('_',$_spid); $spid = $spid[0]; $result = array(); $string = "SELECT distinct TRIM(REPLACE(REPLACE(REPLACE(sdt.text,'\n',' '),'\r',' '),'|',' ')) as text FROM srv_data_text".self::$db_table." AS sdt JOIN srv_user AS u ON sdt.usr_id = u.id WHERE sdt.spr_id = '".$spid."' AND sdt.vre_id = '".$variable['vr_id']."' ORDER BY u.time_insert ASC"; $sql = sisplet_query($string); while ( list($text) = mysqli_fetch_row($sql) ) { $text = mb_strtolower($text,'UTF-8'); $text = str_replace('\'','`',addslashes(strip_tags($text))); if (isset($answers[$text])) { $result[$text] = $answers[$text]; } } return $result; } static function setUpReturnAsHtml($returnAsHtml = false) { self::$returnAsHtml = $returnAsHtml; # ali vrne rezultat analiz kot html ali ga izpiše } static function setUpIsForArchive($isArchive = false) { self::$isArchive = $isArchive; # nastavimo da smo v arhivu } static function setForceShowEmpty($_forceShowEmpty = false) { self::$_forceShowEmpty = $_forceShowEmpty; } function showChartColorProfiles(){ global $lang; $skin = SurveyUserSetting :: getInstance()->getSettings('default_chart_profile_skin'); echo ''.$lang['srv_chart_skin_long'].'
'; echo ''.$lang['srv_chart_skin_info'].'
'; echo ''; echo ''; } function toggleAnalysisAdvanced() { session_start(); $_SESSION['AnalysisAdvancedLinks'][self::$sid] = ($_POST['what'] == 1) ? true : false; $SSH = new SurveyStaticHtml(self::$sid); # izrišemo desne linke do posameznih nastavitev $SSH -> displayAnalizaRightOptions($_POST['podstran'],true); } function changeAnalizaPreview() { global $global_user_id; UserSetting :: getInstance()->Init($global_user_id); UserSetting:: getInstance()->setUserSetting('showAnalizaPreview', (int)$_POST['value'] ); UserSetting:: getInstance()->saveUserSetting(); $SSH = new SurveyStaticHtml(self::$sid); $SSH -> displayAnalizaSubNavigation(false); } static function addCustomReportElement($type, $sub_type, $spr1, $spr2=''){ SurveyAnalysisHelper::getInstance()->addCustomReportElement($type, $sub_type=0, $spid); } // Nastavitve na dnu static function displayBottomSettings($page){ global $site_path; global $lang; global $global_user_id; // Preverimo, ce je funkcionalnost v paketu, ki ga ima uporabnik $userAccess = UserAccess::getInstance($global_user_id); $lan_print = ' title="'.$lang['PRN_Izpis'].'"'; $lan_pdf = ' title="'.$lang['PDF_Izpis'].'"'; $lan_rtf = ' title="'.$lang['RTF_Izpis'].'"'; $lan_xls = ' title="'.$lang['XLS_Izpis'].'"'; echo '
'; // Pri javni povezavi nimamo tega if(self::$printPreview == false){ // Nastavitve na dnu pri sumarniku if($page == 'sums'){ echo ''.$lang['srv_custom_report_comments_add'].''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } // Nastavitve na dnu pri frekvencah elseif($page == 'freq'){ echo ''.$lang['srv_custom_report_comments_add'].''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } // Nastavitve na dnu pri opisnih statistikah else{ echo ''.$lang['srv_custom_report_comments_add'].''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } } echo '
'; // Javascript s katerim povozimo urlje za izvoze, ki niso na voljo v paketu global $app_settings; if($app_settings['commercial_packages'] == true){ echo ''; } } static function displayQuickIcons($id) { global $site_url; global $global_user_id; $return = ''; $anketa = self::$sid; switch (self::$podstran) { case M_ANALYSIS_SUMMARY_NEW : $export = 'sums'; break; case M_ANALYSIS_SUMMARY : $export = 'sums'; break; case M_ANALYSIS_DESCRIPTOR : $export = 'statistics'; break; case M_ANALYSIS_FREQUENCY : $export = 'frequency'; break; case M_ANALYSIS_CHARTS : $export = 'charts'; break; } $loop = (isset(self::$_CURRENT_LOOP)) ? self::$_CURRENT_LOOP['cnt'] : 'undefined'; //Izvoz v PDF/RTF $_url1 = $site_url.'admin/survey/izvoz.php?dc='.base64_encode( serialize( array( 'b'=>'export', 'm'=>$export, 'anketa'=>$anketa, 'sprID'=>$id, 'loop'=>$loop))); $_url2 = $site_url.'admin/survey/izvoz.php?dc='.base64_encode( serialize( array( 'b'=>'export', 'm'=>$export.'_rtf', 'anketa'=>$anketa, 'sprID'=>$id, 'loop'=>$loop))); $_url3 = $site_url.'admin/survey/izvoz.php?dc='.base64_encode( serialize( array( 'b'=>'export', 'm'=>$export.'_xls', 'anketa'=>$anketa, 'sprID'=>$id, 'loop'=>$loop))); $return = '  '; $userAccess = UserAccess::getInstance($global_user_id); if($userAccess->checkUserAccess($what='data_export')){ $return .= ''; $return .= '  '; if(self::$podstran != M_ANALYSIS_CHARTS ) { $return .= '  '; } } else{ $return .= ''; $return .= '  '; if(self::$podstran != M_ANALYSIS_CHARTS ) { $return .= '  '; } } $return .= ''; return $return; } function changeSpremenljivkaLestvica() { #shranimo nastavitve $spremenljivka = $_POST['spid']; $skala = $_POST['skala']; # popravimo skalo spremenljivke # skala - 0 Ordinalna # skala - 1 Nominalna if ( isset($skala) && (int)$spremenljivka) { $sql = sisplet_query("UPDATE srv_spremenljivka SET skala='".$skala."' WHERE id='$spremenljivka'"); #Common::updateEditStamp(); # popravimo v header datoteki self::$_HEADERS[$spremenljivka]['skala'] = $skala; file_put_contents(self::$headFileName, serialize(self::$_HEADERS)); } } static function displaySpremenljivkaIcons($spid) { if (self::$isArchive == false){ echo '
'.self::displayQuickIcons($spid).'
'; // Javna povezava nima js preklopov if(self::$printPreview == false) self::displayQuickScale($spid); } } static function displayQuickScale($spid) { global $lang; $spr_id = self::$_HEADERS[$spid]['spr_id']; # pokličemo objekt SpremenljivkaSkala $objectSkala = new SpremenljivkaSkala($spr_id); if ($objectSkala->canChangeSkala()) { echo ''; } else { echo '
'; echo ''; echo $lang['srv_skala_'.$objectSkala->getSkala()]; echo ''; echo '
'; } } static function displayPublicAnalysis($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']; } self::Init($anketa); #izpišemo HTML echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '

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

'; echo ''; echo '
'; 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; # ponastavimo nastavitve- filter self::Display(); echo '
'; echo ''; echo ''; echo ''; } static function heatmapGraph($spid,$_from, $lokacija=false, $heatmap=false) { global $lang; $spremenljivka = self::$_HEADERS[$spid]; $anketa = self::$sid; # preverimo ali prikazujemo spremenljivko, glede na veljavne odgovore in nastavitev $only_valid = 0; 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 $only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; } } } if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { return; } # 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 $num_show_records = self::getNumRecords(); // $num_show_records = $_max_answers_cnt <= (int)$num_show_records ? $_max_answers_cnt : $num_show_records; $_answers = self::getAnswers($spremenljivka,$num_show_records); $_all_valid_answers_cnt = $_answers['validCnt']; $_valid_answers = $_answers['valid']; if (self :: $show_spid_div == true) { echo '
'; //self::displaySpremenljivkaIcons($spid); } //echo '
'; echo '
'; # tekst vprašanja echo ''; # naslovna vrstica echo ''; #variabla echo ''; echo ''; echo ''; #variabla // konec naslovne vrstice $_answersOther = array(); $_grids_count = count($spremenljivka['grids']); if ($_grids_count > 0) { $_css_bck = 'anl_bck_desc_2 anl_ac anl_bt_dot '; $last = 0; //anl_bck_desc_2 anl_bl anl_br anl_variabla_sub foreach ($spremenljivka['grids'] AS $gid => $grid) { $_variables_count = count($grid['variables']); echo ''; echo ''; echo ''; } } echo '
'; //echo self::showVariable($spid, $spremenljivka['variable']); echo $spremenljivka['variable'].' - '.$spremenljivka['naslov']; echo '
'; if($heatmap){ //echo $grid['naslov'].'
';//ni potrebno, ker je ze v glavi? $sprid = explode('_',$spid); $loopid = $sprid[1]; $sprid = $sprid[0]; SurveyUserSession::Init($anketa); $heatmapId = 'heatmap'.$sprid; //echo $heatmapId; echo ''; //echo 'Smiley face'; echo 'Heatmap'; echo ''; } echo '
'; echo '
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && self::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { echo '
'; self::outputOtherAnswers($oAnswers); echo '
'; } } if (self :: $show_spid_div == true) { echo '
'; echo '
'; } } // ikone za izvoz za heatmap porocila static function displayExportIcons4Heatmap($spid, $anketa){ global $site_path; global $lang; $spremenljivka = self::$_HEADERS[$spid]; $loop = (isset(self::$_CURRENT_LOOP)) ? self::$_CURRENT_LOOP['cnt'] : 'undefined'; // linki echo ''; } /** Izriše tekstovne odgovore kot tabelo za heatmap * * @param unknown_type $spid */ static function sumMultiTextHeatMap($spid,$_from, $lokacija=false, $heatmap=false) { global $lang; $RegionPresent = true; $spremenljivka = self::$_HEADERS[$spid]; $anketa = self::$sid; # preverimo ali prikazujemo spremenljivko, glede na veljavne odgovore in nastavitev $only_valid = 0; 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 $only_valid += (int)self::$_FREQUENCYS[$_sequence]['validCnt']; } } } if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && self::$_forceShowEmpty == false) { return; } # 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 $num_show_records = self::getNumRecords(); // $num_show_records = $_max_answers_cnt <= (int)$num_show_records ? $_max_answers_cnt : $num_show_records; $_answers = self::getAnswers($spremenljivka,$num_show_records); $_all_valid_answers_cnt = $_answers['validCnt']; $_valid_answers = $_answers['valid']; if (self :: $show_spid_div == true) { echo '
'; } self::displaySpremenljivkaIcons($spid); # tekst vprašanja echo ''; //zacetek tabele # 1. vrstica - naslovna vrstica echo ''; #variabla echo ''; #odgovori //echo ''; echo ''; //konec 1. vrstice //2. vrstica - prikazovanje povezave do heatmap echo ''; #variabla echo ''; echo ''; echo ''; //konec - 2. vrstice //Koordinate //naslovna vrstica za koordinate echo ''; echo ''; echo ''; //naslovna vrstica za koordinate - konec //vrstica s podnaslovi celic echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; //vrstica s podnaslovi celic - konec //vrstica za x echo ''; //1. stolpcev z imenom koordinate echo ''; //1. stolpcev z imenom koordinate - konec //2. stolpec - Veljavni $validHeatmapRegion = self::validHeatmapRegion($spremenljivka['grids'], $spid, $_valid_answers); echo ''; //2. stolpec - Veljavni - konec //3. stolpec - Ustrezni $ustrezniHeatmapRegion = self::ustrezniHeatmapRegion($spid, $_valid_answers, $_sequence); //vsi mozni kliki echo ''; //3. stolpec - Ustrezni - konec //4. stolpec - Povprecje $povprecjeHeatmapClicksX = self::formatNumber(self::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'x', $validHeatmapRegion, 'povprecje'),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; //4. stolpec - Povprecje - konec //5. stolpec - Standardni odklon $stdevHeatmapClicksX = self::formatNumber(self::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'x', $validHeatmapRegion, 'stdev'),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; //5. stolpec - Standardni odklon - konec //6. stolpec - Minimum $minHeatmapClicksX = self::formatNumber(self::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'x', $validHeatmapRegion, 'min'),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; //6. stolpec - Minimum - konec //7. stolpec - Max $maxHeatmapClicksX = self::formatNumber(self::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'x', $validHeatmapRegion, 'max'),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; //7. stolpec - Max - konec echo ''; //vrstica za x - konec //vrstica za y echo ''; //1. stolpcev z imenom koordinate echo ''; //1. stolpcev z imenom koordinate - konec //2. stolpec - Veljavni echo ''; //2. stolpec - Veljavni - konec //3. stolpec - Ustrezni echo ''; //3. stolpec - Ustrezni - konec //4. stolpec - Povprecje $povprecjeHeatmapClicksY = self::formatNumber(self::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'y', $validHeatmapRegion, 'povprecje'),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; //4. stolpec - Povprecje - konec //5. stolpec - Standardni odklon $stdevHeatmapClicksY = self::formatNumber(self::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'y', $validHeatmapRegion, 'stdev'),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; //5. stolpec - Standardni odklon - konec //6. stolpec - Minimum $minHeatmapClicksY = self::formatNumber(self::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'y', $validHeatmapRegion, 'min'),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; //6. stolpec - Minimum - konec //7. stolpec - Max $maxHeatmapClicksY = self::formatNumber(self::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'y', $validHeatmapRegion, 'max'),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); echo ''; //7. stolpec - Max - konec echo ''; //vrstica za y - konec //Koordinate - konec //preveri, ali je prisotno kaksno obmocje, nadaljuj izris tabele $RegionPresent = self::HeatmapRegionPresence($spremenljivka['grids'], $spid, $_valid_answers); //preveri, ali je prisotno kaksno obmocje, nadaljuj izris tabele - konec if($RegionPresent){ //ce imamo obmocja //3. vrstica - naslovna za obmocja echo ''; echo ''; echo ''; //konec - 3. vrstice $_answersOther = array(); $_grids_count = count($spremenljivka['grids']); $_css_bck = 'anl_bck_desc_2 anl_ac anl_bt_dot '; $last = 0; if ($_grids_count > 0) { $_row = $spremenljivka['grids'][0]; $indeks = 0; //$veljavnaSkupnaFreq = 0; if (count($_row['variables'])>0) foreach ($_row['variables'] AS $rid => $_col ){ $_sequence = $_col['sequence']; # id kolone z podatki if ($_col['other'] != true) { echo ''; if($indeks == 0) //4. vrstica, naslovna vrstica { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; }else //od 5. vrstice dalje, kjer so po vrsticah obmocja in njihovi podatki { //1. stolpcev z imenom obmocja echo ''; //1. stolpcev z imenom obmocja - konec //2. stolpec - Frekvenca $freqHeatmapRegion = self::freqHeatmapRegion($spremenljivka['grids'], $spid, $_valid_answers, $indeks); $veljavnaSkupnaFreq = $veljavnaSkupnaFreq + $freqHeatmapRegion; echo ''; //2. stolpec - Frekvenca - konec //3. stolpec - Veljavni //$validHeatmapRegion = self::validHeatmapRegion($spremenljivka['grids'], $spid, $_valid_answers); echo ''; //3. stolpec - Veljavni - konec //4. stolpec - % Veljavni $_procentValidHeatmapRegion = ($validHeatmapRegion > 0 ) ? 100*$freqHeatmapRegion / $validHeatmapRegion : 0; $_procentValidHeatmapRegion = self::formatNumber($_procentValidHeatmapRegion, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); echo ''; //4. stolpec - % Veljavni - konec //5. stolpec - Ustrezni $ustrezniHeatmapRegion = self::ustrezniHeatmapRegion($spid, $_valid_answers, $_sequence); //vsi mozni kliki echo ''; //5. stolpec - Ustrezni - konec //6. stolpec - % Ustrezni $_procentUstrezniHeatmapRegion = ($ustrezniHeatmapRegion > 0 ) ? 100*$freqHeatmapRegion / $ustrezniHeatmapRegion : 0; $_procentUstrezniHeatmapRegion = self::formatNumber($_procentUstrezniHeatmapRegion, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); echo ''; //6. stolpec - % Ustrezni - konec } //echo ''; echo ''; //*********** Izris veljavnih in manjkajocih vrednosti if($indeks != 0) //ce ni naslovna vrsticam je potrebno dodati se dodatne poglede veljavnih in manjkajocih vrednosti { echo ''; $counter = 0; $options['isTextAnswer'] = false; $manjkajoci = $ustrezniHeatmapRegion - $validHeatmapRegion; $counter = self::outputSumaValidAnswerHeatmap($counter,$_sequence,$spid,$options, $validHeatmapRegion); if (count(self::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { foreach (self::$_FREQUENCYS[$_sequence]['invalid'] AS $ikey => $iAnswer) { if ($iAnswer['cnt'] > 0 ) { # izpisujemo samo tiste ki niso 0 $counter = self::outputInvalidAnswerHeatmap($counter,$ikey,$iAnswer,$_sequence,$spid,$options, $manjkajoci); } } # izpišemo sumo veljavnih $counter = self::outputSumaInvalidAnswerHeatmap($counter,$_sequence,$spid,$options, $manjkajoci); } #izpišemo še skupno sumo $counter = self::outputSumaHeatmap($counter,$_sequence,$spid,$options, $ustrezniHeatmapRegion); echo ''; $veljavnaSkupnaFreq = 0; } //*********** Izris veljavnih in manjkajocih vrednosti - konec } else { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } $indeks++; } } } echo '
'; echo self::showVariable($spid, $spremenljivka['variable']); echo ''.$spremenljivka['naslov'].''; echo ''.$spremenljivka['naslov'].''; echo '
'; //self::showIcons($spid,$spremenljivka,$_from); //za enkrat skrijem ikone za izvoze in druge moznosti echo ''; //echo $grid['naslov'].'
';//ni potrebno, ker je ze v glavi? $sprid = explode('_',$spid); $loopid = $sprid[1]; $sprid = $sprid[0]; SurveyUserSession::Init($anketa); $heatmapId = 'heatmap'.$sprid; //echo $heatmapId; //SurveyChart::displayExportIcons($sprid); echo ''; //echo 'Smiley face'; echo 'Heatmap '; echo ''; echo '
'; echo ''.$lang['srv_analiza_heatmap_clicked_coords'].''; echo '
'; echo $lang['coordinates']; echo ''; echo $lang['srv_analiza_opisne_valid_heatmap']; echo ''; echo $lang['srv_analiza_num_units_valid_heatmap']; echo ''; echo $lang['srv_means_label']; echo ''; echo $lang['srv_analiza_opisne_odklon']; echo ''; echo $lang['srv_analiza_opisne_min']; echo ''; echo $lang['srv_analiza_opisne_max']; echo '
'; echo 'x'; echo ''.$validHeatmapRegion.''.$ustrezniHeatmapRegion.''.$povprecjeHeatmapClicksX.''.$stdevHeatmapClicksX.''.$minHeatmapClicksX.''.$maxHeatmapClicksX.'
'; echo 'y'; echo ''.$validHeatmapRegion.''.$ustrezniHeatmapRegion.''.$povprecjeHeatmapClicksY.''.$stdevHeatmapClicksY.''.$minHeatmapClicksY.''.$maxHeatmapClicksY.'
'; echo ''.$lang['srv_analiza_heatmap_clicked_regions'].''; echo '
'; echo $lang['srv_hot_spot_regions_menu']; echo ''; echo $lang['srv_analiza_opisne_frequency_heatmap']; echo ''; echo $lang['srv_analiza_opisne_valid_heatmap']; echo ''; echo '% - '.$lang['srv_analiza_opisne_valid_heatmap']; echo ''; echo $lang['srv_analiza_num_units_valid_heatmap']; echo ''; echo '% - '.$lang['srv_analiza_num_units_valid_heatmap']; echo ''; echo $_col['naslov']; echo ''.$freqHeatmapRegion.''.$validHeatmapRegion.''.$_procentValidHeatmapRegion.''.$ustrezniHeatmapRegion.''.$_procentUstrezniHeatmapRegion.'
'; # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && self::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { echo '
'; self::outputOtherAnswers($oAnswers); echo '
'; } } if (self :: $show_spid_div == true) { echo '
'; echo '
'; } } static function freqHeatmapRegion($spremenljivkaGrids, $spid, $_valid_answers, $indeks, $export=0){ $steviloPodatkov = count($_valid_answers); $freqHeatMapRegion = 0; foreach ($spremenljivkaGrids AS $gid => $grid) { $_variables_count = count($grid['variables']); if ($_variables_count > 0) { # preštejemo max vrstic na grupo $_max_i = 0; //$numObmocij = 0; foreach ($grid['variables'] AS $vid => $variable ) { $_sequence = $variable['sequence']; # id kolone z podatki $_max_i = max($_max_i,min($num_show_records,self::$_FREQUENCYS[$_sequence]['validCnt'])); //$numObmocij++; } $indeksZaObmocja = 0; foreach ($grid['variables'] AS $vid => $variable ) { $_sequence = $variable['sequence']; # id kolone z podatki if ($variable['other'] != true) { #$_valid_cnt = count(self::$_FREQUENCYS[$_sequence]['valid']); if (count($_valid_answers) > 0) { foreach ($_valid_answers AS $answer) { $_ans = $answer[$_sequence]; //if ($_ans != null && $_ans != '' && $indeksZaObmocja == count($_valid_answers)+$indeks) { if ($_ans != null && $_ans != '' && $indeksZaObmocja >= count($_valid_answers)*$indeks && $steviloPodatkov != 0) { $freqHeatMapRegion = $freqHeatMapRegion + $_ans; $steviloPodatkov--; } else { if($export==0){ echo ' '; } } $indeksZaObmocja++; } } } } } } return $freqHeatMapRegion; } static function validHeatmapRegion($spremenljivkaGrids, $spid, $_valid_answers, $export=0){ $validHeatmapRegion = 0; foreach ($spremenljivkaGrids AS $gid => $grid) { $_variables_count = count($grid['variables']); if ($_variables_count > 0) { //$numObmocij = 0; $brs = 0; foreach ($grid['variables'] AS $vid => $variable ) { $_sequence = $variable['sequence']; # id kolone z podatki if ($variable['other'] != true) { #$_valid_cnt = count(self::$_FREQUENCYS[$_sequence]['valid']); if (count($_valid_answers) > 0) { //echo ''; //$brs = 0; foreach ($_valid_answers AS $answer) { $_ans = $answer[$_sequence]; $vejice = substr_count($_ans, ","); if ($_ans != null && $_ans != '' && $vejice != 0) { //echo ''; $brs = $brs + substr_count($_ans, "
"); //echo ''; } else { if($export == 0){ echo ' '; } } } } } } } } $validHeatmapRegion = $brs; //echo ''; return $validHeatmapRegion; } static function ustrezniHeatmapRegion($spid, $_valid_answers, $_sequence){ $row = Cache::srv_spremenljivka($spid); $spremenljivkaParams = new enkaParameters($row['params']); $heatmap_num_clicks = ($spremenljivkaParams->get('heatmap_num_clicks') ? $spremenljivkaParams->get('heatmap_num_clicks') : 1); return self::$_FREQUENCYS[$_sequence]['validCnt'] * $heatmap_num_clicks; //vrni vse mozne klike = stev. odgovorov * stev. moznih klikov } static function HeatmapRegionPresence($spremenljivkaGrids, $spid, $_valid_answers){ $HeatmapRegionPresence = false; foreach ($spremenljivkaGrids AS $gid => $grid) { $_variables_count = count($grid['variables']); if ($_variables_count > 0) { # preštejemo max vrstic na grupo $_max_i = 0; //$numObmocij = 0; foreach ($grid['variables'] AS $vid => $variable ) { $_sequence = $variable['sequence']; # id kolone z podatki $_max_i = max($_max_i,min($num_show_records,self::$_FREQUENCYS[$_sequence]['validCnt'])); //$numObmocij++; } $indeksZaObmocja = 0; foreach ($grid['variables'] AS $vid => $variable ) { $_sequence = $variable['sequence']; # id kolone z podatki if ($variable['other'] != true) { if (count($_valid_answers) > 0) { foreach ($_valid_answers AS $answer) { $_ans = $answer[$_sequence]; if ($_ans != null && $_ans != '' && $indeksZaObmocja >= count($_valid_answers)) { $HeatmapRegionPresence = true; } $indeksZaObmocja++; } } } } } } return $HeatmapRegionPresence; } static function heatmapClicksCalc($spremenljivkaGrids, $spid, $_valid_answers, $coords, $veljavnikliki, $what, $export=0){ $heatmapClicksCalc = 0; $stdevCoordsArray = array(); $minCoords = 0; $maxCoords = 0; foreach ($spremenljivkaGrids AS $gid => $grid) { $_variables_count = count($grid['variables']); if ($_variables_count > 0) { # preštejemo max vrstic na grupo $_max_i = 0; //$numObmocij = 0; foreach ($grid['variables'] AS $vid => $variable ) { $_sequence = $variable['sequence']; # id kolone z podatki $_max_i = max($_max_i,min($num_show_records,self::$_FREQUENCYS[$_sequence]['validCnt'])); //$numObmocij++; } $indeksZaObmocja = 0; foreach ($grid['variables'] AS $vid => $variable ) { $_sequence = $variable['sequence']; # id kolone z podatki if ($variable['other'] != true) { #$_valid_cnt = count(self::$_FREQUENCYS[$_sequence]['valid']); if (count($_valid_answers) > 0) { foreach ($_valid_answers AS $answer) { $_ans = $answer[$_sequence]; if ($_ans != null && $_ans != '' && $_ans >= 0 && $indeksZaObmocja < count($_valid_answers)) { //$validHeatmapRegion = $validHeatmapRegion + $_ans; //echo ''.$_ans.''; $_ans = substr($_ans, 4); //odstrani
iz zacetka koordinat $coordinates = explode('
',$_ans); foreach($coordinates AS $key => $coordinate){ $coordinate = explode(',',$coordinate); foreach($coordinate AS $coordskey => $subcoords) { if($coords == 'x' && ($coordskey == 0 || $coordskey%2 == 0) ) { array_push($stdevCoordsArray, $subcoords); }else if($coords == 'y' && ($coordskey != 0 || $coordskey%2 != 0) ) { array_push($stdevCoordsArray, $subcoords); } } } } else { if($export == 0){ echo ' '; } } $indeksZaObmocja++; } } } } } } if($what == 'povprecje') { $heatmapClicksCalc = array_sum($stdevCoordsArray) / count($stdevCoordsArray); }else if($what == 'stdev') { if(is_array($stdevCoordsArray)){ $mean = array_sum($stdevCoordsArray) / count($stdevCoordsArray); foreach($stdevCoordsArray as $key => $num) $devs[$key] = pow($num - $mean, 2); if(count($devs) != 1) $heatmapClicksCalc = sqrt(array_sum($devs) / (count($devs) - 1)); } }else if($what == 'min') { $heatmapClicksCalc = min($stdevCoordsArray); }else if($what == 'max') { $heatmapClicksCalc = max($stdevCoordsArray); } return $heatmapClicksCalc; } } ?>