diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:08:29 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:08:29 +0200 |
commit | 75160b12821f7f4299cce7f0b69c83c1502ae071 (patch) | |
tree | 27e25e4ccaef45f0c58b22831164050d1af1d4db /admin/survey/R | |
parent | prvi-commit (diff) | |
download | 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.gz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.bz2 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.lz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.xz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.zst 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.zip |
Diffstat (limited to 'admin/survey/R')
-rw-r--r-- | admin/survey/R/class.SurveyAnalysisR.php | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/admin/survey/R/class.SurveyAnalysisR.php b/admin/survey/R/class.SurveyAnalysisR.php index 8a594af..53d5c09 100644 --- a/admin/survey/R/class.SurveyAnalysisR.php +++ b/admin/survey/R/class.SurveyAnalysisR.php @@ -52,7 +52,7 @@ class SurveyAnalysisR { // variable pri katerih upostevamo delez
$delezVar = 0;
- if(count($delezVars) > 0){
+ if(isset($delezVars)&&count($delezVars) > 0){
// Gre za checkbox
if($delezVars == -1){
@@ -88,12 +88,12 @@ class SurveyAnalysisR { }
// Napolnimo podatke iz vrnjenega rezultata
- function parseMultiCrosstabResults($out, $avgVar=0, $delezVar=0){
+ function parseMultiCrosstabResults($out='', $avgVar=0, $delezVar=0){
$results = array();
// Razbijemo na variable, podatke in vsote
- $strings = explode("--", $out);
+ $strings = explode("--", isset($out)?$out:'');
// VARIABLE shranimo v array
@@ -106,9 +106,10 @@ class SurveyAnalysisR { // PODATKE shranimo v array
- $tempData = explode("_", $strings[1]);
- $tempAvgData = explode("_", $strings[6]);
- $tempDelezData = ($avgVar == 1) ? explode("_", $strings[7]) : explode("_", $strings[6]);
+ $tempData = isset($strings[1])?explode("_", $strings[1]):array("");
+ $tempAvgData = isset($strings[6])?explode("_", $strings[6]):array("");
+ $tempDelezData = ($avgVar == 1 && isset($strings[7])) ? explode("_", $strings[7]) : $tempAvgData;
+
$data = array();
$avgData = array();
$delezData = array();
@@ -261,7 +262,7 @@ class SurveyAnalysisR { // X^2
- $x2 = $strings[5];
+ $x2 = isset($strings[5])?$strings[5]:'';
$results['hi2'] = (float)$x2;
@@ -304,38 +305,39 @@ class SurveyAnalysisR { $results = array();
-
- // Razbijemo na variable, podatke in vsote
- $strings = explode("--", $out);
+ if($out!=null){
+ // Razbijemo na variable, podatke in vsote
+ $strings = explode("--", $out);
- // Vrednosti prve variable
- $vals1 = explode("_", $strings[0]);
- $results['1'] = array(
- 'n' => (int)$vals1[0],
- 'x' => (float)$vals1[1],
- 's2' => (float)$vals1[2],
- 'se' => (float)$vals1[3],
- 'se2' => (float)$vals1[4],
- 'margin' => (float)$vals1[5]
- );
-
- // Vrednosti druge variable
- $vals2 = explode("_", $strings[1]);
- $results['2'] = array(
- 'n' => (int)$vals2[0],
- 'x' => (float)$vals2[1],
- 's2' => (float)$vals2[2],
- 'se' => (float)$vals2[3],
- 'se2' => (float)$vals2[4],
- 'margin' => (float)$vals2[5]
- );
+ // Vrednosti prve variable
+ $vals1 = explode("_", $strings[0]);
+ $results['1'] = array(
+ 'n' => (int)$vals1[0],
+ 'x' => (float)$vals1[1],
+ 's2' => (float)$vals1[2],
+ 'se' => (float)$vals1[3],
+ 'se2' => (float)$vals1[4],
+ 'margin' => (float)$vals1[5]
+ );
+
+ // Vrednosti druge variable
+ $vals2 = explode("_", $strings[1]);
+ $results['2'] = array(
+ 'n' => (int)$vals2[0],
+ 'x' => (float)$vals2[1],
+ 's2' => (float)$vals2[2],
+ 'se' => (float)$vals2[3],
+ 'se2' => (float)$vals2[4],
+ 'margin' => (float)$vals2[5]
+ );
- // Skupne vrednosti
- $vals = explode("_", $strings[2]);
- $results['d'] = (float)$vals[0];
- $results['sed'] = (float)$vals[1];
- $results['t'] = (float)$vals[2];
- $results['sig'] = (float)$vals[3];
+ // Skupne vrednosti
+ $vals = explode("_", $strings[2]);
+ $results['d'] = (float)$vals[0];
+ $results['sed'] = (float)$vals[1];
+ $results['t'] = (float)$vals[2];
+ $results['sig'] = (float)$vals[3];
+ }
return $results;
|