anketa['id'] = $anketa; SurveyAnalysis::Init($this->anketa['id']); SurveyAnalysis::$setUpJSAnaliza = false; // create new XLS document $this->xls = new xls(); // Poskrbimo za datoteko s podatki $SDF = SurveyDataFile::get_instance(); $SDF->init($this->anketa['id']); $SDF->prepareFiles(); $this->headFileName = $SDF->getHeaderFileName(); $this->dataFileName = $SDF->getDataFileName(); $this->dataFileStatus = $SDF->getStatus(); $_GET['a'] = A_ANALYSIS; // preberemo nastavitve iz baze (prej v sessionu) SurveyUserSession::Init($this->anketa['id']); $this->sessionData = SurveyUserSession::getData('ttest'); // ustvarimo ttest objekt $this->ttestClass = new SurveyTTest($this->anketa['id']); if ( SurveyInfo::getInstance()->SurveyInit($this->anketa['id']) && $this->init()){ $this->anketa['uid'] = $global_user_id; SurveyUserSetting::getInstance()->Init($this->anketa['id'], $this->anketa['uid']); } else return false; return true; } else{ return false; } } // SETTERS && GETTERS function getFile($fileName) { //Close and output rtf document $output = $this->createXls(); $this->xls->display($fileName, $output); } function init() { return true; } function encodeText($text) { // popravimo sumnike ce je potrebno $text = html_entity_decode($text, ENT_NOQUOTES, 'UTF-8'); $text = str_replace(array("š","š","č"),array("š","š","č"),$text); return strip_tags($text); } function createXls() { global $site_path; global $lang; global $output; $convertTypes = array('charSet' => "windows-1250", 'delimit' => ";", 'newLine' => "\n", 'BOMchar' => "\xEF\xBB\xBF"); $output = $convertTypes['BOMchar']; $output .= '
'.$lang['export_analisys_ttest'].'
'; if (count($this->sessionData['sub_conditions']) > 1 ) { $variables1 = $this->ttestClass->getSelectedVariables(); if (count($variables1) > 0) { foreach ($variables1 AS $v_first) { $ttest = null; $ttest = $this->ttestClass->createTTest($v_first, $this->sessionData['sub_conditions']); $output .= '
'; $this->displayTTestTable($ttest); } } } return $output; } public function displayTTestTable($ttest) { global $lang; global $output; # preverimo ali imamo izbrano odvisno spremenljivko $spid1 = $this->sessionData['variabla'][0]['spr']; $seq1 = $this->sessionData['variabla'][0]['seq']; $grid1 = $this->sessionData['variabla'][0]['grd']; if (is_array($ttest) && count($ttest) > 0 && (int)$seq1 > 0) { $spr_data_1 = $this->ttestClass->_HEADERS[$spid1]; if ($grid1 == 'undefined') { # imamp lahko več variabel $seq = $seq1; foreach ($spr_data_1['grids'] as $gkey => $grid ) { foreach ($grid['variables'] as $vkey => $variable) { $sequence = $variable['sequence']; if ($sequence == $seq) { $sprLabel1 = '('.$variable['variable'].') '. $variable['naslov']; } } } } else { # imamo subgrid $sprLabel1 = '('.$spr_data_1['grids'][$grid1]['variable'].') '. $spr_data_1['grids'][$grid1]['naslov']; } # polovio labele $spid2 = $this->sessionData['spr2']; $sprLabel2 = trim(str_replace(' ','',$this->sessionData['label2'])); $label1 = $this->ttestClass->getVariableLabels($this->sessionData['sub_conditions'][0]); $label2 = $this->ttestClass->getVariableLabels($this->sessionData['sub_conditions'][1]); $output .= ''; $output .= ''; #labele $output .= ''; $output .= ''; $output .= ''; $output .= ''; #$output .= ''; #frekvenca $output .= ''; #povprečje $output .= ''; #varianca $output .= ''; #standardna napaka $output .= ''; #margini $output .= ''; #d $output .= ''; #sed $output .= ''; #signifikanca $output .= ''; #ttest $output .= ''; $output .= ''; $output .= ''; #labele $output .= ''; #frekvenca $output .= ''; #povprečje $output .= ''; #varianca $output .= ''; #standardna napaka $output .= ''; #margini $output .= ''; #d $output .= ''; #sed $output .= ''; #signifikanca $output .= ''; #ttest $output .= ''; $output .= ''; $output .= ''; #labele $output .= ''; #frekvenca $output .= ''; #povprečje $output .= ''; #varianca $output .= ''; #standardna napaka $output .= ''; #margini $output .= ''; $output .= ''; $output .= '
'; $output .= ''.$sprLabel2.''; $output .= ''; $output .= ''.$sprLabel1.''; $output .= '
 nxse(x)±1,96×se(x)dse(d)Sig.t
'.$label1.''.$this->ttestClass->formatNumber($ttest[1]['n'],0).''.$this->ttestClass->formatNumber($ttest[1]['x'],3).''.$this->ttestClass->formatNumber($ttest[1]['s2'],3).''.$this->ttestClass->formatNumber($ttest[1]['se'],3).''.$this->ttestClass->formatNumber($ttest[1]['margin'],3).''.$this->ttestClass->formatNumber($ttest['d'],3).''.$this->ttestClass->formatNumber($ttest['sed'],3).''.$this->ttestClass->formatNumber($ttest['sig'],3).''.$this->ttestClass->formatNumber($ttest['t'],3).'
'.$label2.''.$this->ttestClass->formatNumber($ttest[2]['n'],0).''.$this->ttestClass->formatNumber($ttest[2]['x'],3).''.$this->ttestClass->formatNumber($ttest[2]['s2'],3).''.$this->ttestClass->formatNumber($ttest[2]['se'],3).''.$this->ttestClass->formatNumber($ttest[2]['margin'],3).'
'; } } /*Skrajsa tekst in doda '...' na koncu*/ function snippet($text,$length=64,$tail="...") { $text = trim($text); $txtl = strlen($text); if($txtl > $length) { for($i=1;$text[$length-$i]!=" ";$i++) { if($i == $length) { return substr($text,0,$length) . $tail; } } $text = substr($text,0,$length-$i+1) . $tail; } return $text; } function setUserId($usrId) {$this->anketa['uid'] = $usrId;} function getUserId() {return ($this->anketa['uid'])?$this->anketa['uid']:false;} function formatNumber($value,$digit=0,$sufix="") { if ( $value <> 0 && $value != null ) $result = round($value,$digit); else $result = "0"; //$result = number_format($result, $digit, ',', '.').$sufix; $result = number_format($result, $digit, ',', '') . $sufix; // Preprecimo da bi se stevilo z decimalko pretvorilo v datum //$result = '="'. $result.'"'; return $result; } } ?>