diff options
Diffstat (limited to 'admin/survey/R/class.SurveyAnalysisR.php')
-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;
|