<?php

	if (!$disable_question) {
//  	$vprasanje = strip_tags($vprasanje);
//  	$odgovori = strip_tags($odgovori);
//  	$legenda = strip_tags($legenda);
  
  	$vprasanje = remove_variables_str($vprasanje);
  	$odgovori = remove_variables_str($odgovori);
  	$legenda = remove_variables_str($legenda);
  
  
  	if ($tip == 1) {
  		echo "TABLES\n";
  		echo "$spaceChar$spaceChar/FORMAT ZERO MISSING('.')$lineBreak";
  		echo "$spaceChar$spaceChar/GBASE=CASES$lineBreak";
  		echo "$spaceChar$spaceChar/FTOTAL= \$t000001 \"Total\"$lineBreak";
  		echo "$spaceChar$spaceChar/TABLE=$VAR + \$t000001  BY (STATISTICS)$lineBreak";
  		echo "$spaceChar$spaceChar/STATISTICS$lineBreak";
  		echo "$spaceChar$spaceCharcount( $VAR( F5.0 ) 'Count')$lineBreak";
  		echo "$spaceChar$spaceCharcpct( $VAR( F5.1 ) 'Col %').$lineBreak";
  		echo "$lineBreak";
  	} elseif ($tip == 2) {
  		unset( $all_variables_type2 );
  		$var_list=explode("<*>", $odgovori);
  		$n_all=count($var_list);
  		$legenda_lab = explode("<*>", $legenda);
  		$legenda_count = count($legenda_lab);
  		if ($scale_typ == 4) {
  									
  			for ($n=1;$n<=$legenda_count;$n++) {
  				unset($freq_vars_set);
  				for ($k=1;$k<=$n_all;$k++) {
  					$freq_vars_set .= " ".$VAR."_".$k."_".$n;
  				}
  				$legenda_array = explode(" ",$legenda_lab[$n-1],2);
      		echo "TABLES\n";
      		echo "$spaceChar$spaceChar/FORMAT ZERO MISSING('.')$lineBreak";
      		echo "$spaceChar$spaceChar/MRGROUP \$".$VAR."_".$n." '$vprasanje - ".$legenda_array[1]."'$lineBreak";
      		echo "$spaceChar$spaceChar$spaceChar$spaceChar$spaceChar$spaceChar$spaceChar$spaceChar$spaceChar$spaceChar$spaceChar".$freq_vars_set."$lineBreak";
      		echo "$spaceChar$spaceChar/GBASE=CASES$lineBreak";
      		echo "$spaceChar$spaceChar/FTOTAL= \$t000002 \"Total\"$lineBreak";
      		echo "$spaceChar$spaceChar/TABLE=\$".$VAR."_".$n." + \$t000002  BY (STATISTICS)$lineBreak";
      		echo "$spaceChar$spaceChar/STATISTICS$lineBreak";
      		echo "$spaceChar$spaceCharcount( \$".$VAR."_".$n."( F5.0 ) 'Count')$lineBreak";
      		echo "$spaceChar$spaceCharrpct( \$".$VAR."_".$n."( F5.1 ) 'Col %').$lineBreak";
      		echo "$lineBreak";
  			}
  		} else  {
    		for ( $i = 1; $i<=$n_all; $i++) {
    			if ( $i>1 ) $all_variables_type2 .= " ";
    			$all_variables_type2 .= $VAR."_".$i;
    		}
				if ($mean_missing_values AND $multi_nogo_answers) echo "MISSING VALUES $all_variables_type2 (".$multi_nogo_answers.").$lineBreak";
    		echo "DESCRIPTIVES$lineBreak";
    		echo "$spaceChar$spaceCharVARIABLES=$all_variables_type2$lineBreak";
    		echo "$spaceChar$spaceChar/STATISTICS=MEAN STDDEV MIN MAX.$lineBreak";
				if ($mean_missing_values AND $multi_nogo_answers) echo "MISSING VALUES $all_variables_type2 ().$lineBreak";
    		echo "$lineBreak";
    		for ( $i = 1; $i<=$n_all; $i++) {
    			$VAR_part = $VAR."_".$i;
    			echo "TABLES\n";
    			echo "$spaceChar$spaceChar/FORMAT ZERO MISSING('.')$lineBreak";
    			echo "$spaceChar$spaceChar/GBASE=CASES$lineBreak";
    			echo "$spaceChar$spaceChar/FTOTAL= \$t000001 \"Total\"$lineBreak";
    			echo "$spaceChar$spaceChar/TABLE=$VAR_part + \$t000001  BY (STATISTICS)$lineBreak";
    			echo "$spaceChar$spaceChar/STATISTICS$lineBreak";
    			echo "$spaceChar$spaceCharcount( $VAR_part( F5.0 ) 'Count')$lineBreak";
    			echo "$spaceChar$spaceCharcpct( $VAR_part( F5.1 ) 'Col %').$lineBreak";
    			echo "$lineBreak";
    		}
  		}
  	} elseif ($tip == 3) {
  		$var_list=explode("<*>", $odgovori);
  		$n_all=count($var_list);
  		if ( $answer_num > 0 ) $n_all = $answer_num;   
  		echo "TABLES\n";
  		echo "$spaceChar$spaceChar/FORMAT ZERO MISSING('.')$lineBreak";
  		echo "$spaceChar$spaceChar/MRGROUP \$".$VAR." '$vprasanje'$lineBreak";
  		echo "$spaceChar$spaceChar$spaceChar$spaceChar$spaceChar$spaceChar$spaceChar$spaceChar$spaceChar$spaceChar$spaceChar".$VAR."_1 TO ".$VAR."_".$n_all."$lineBreak";
  		echo "$spaceChar$spaceChar/GBASE=CASES$lineBreak";
  		echo "$spaceChar$spaceChar/FTOTAL= \$t000002 \"Total\"$lineBreak";
  		echo "$spaceChar$spaceChar/TABLE=\$".$VAR." + \$t000002  BY (STATISTICS)$lineBreak";
  		echo "$spaceChar$spaceChar/STATISTICS$lineBreak";
  		echo "$spaceChar$spaceCharcount( \$".$VAR."( F5.0 ) 'Count')$lineBreak";
  		echo "$spaceChar$spaceCharrpct( \$".$VAR."( F5.1 ) 'Col %').$lineBreak";
  		echo "$lineBreak";
  	}
  
	}

?>