0) ? round(162 / $count): 162;
//$height = ($this->getCellHeight($answers[$j][$i], $singleWidth) > $height) ? $this->getCellHeight($answers[$j][$i], $singleWidth) : $height;
$height = 1;
$row[$j] = $answers[$j][$i];
}
//$tex .= " & ".$this->dynamicCells($text, $count); //izpis celic z izracuni odgovorov v stolpcih (npr. Sploh ne velja, ...)
$tex .= $this->sumLokacijaRowOutput($row, $count, $height, $variable['variable']);
$tex .= $this->texNewLine; //nova vrstica
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*horizontalna crta*/
}
}
}
else{
// Testiramo visino vrstice glede na najdaljsi text
foreach ($text AS $string){
$singleWidth = ($count > 0) ? round(162 / $count): 162;
//$height = ($this->getCellHeight($string, $singleWidth) > $height) ? $this->getCellHeight($string, $singleWidth) : $height;
$height = 1;
}
//$tex .= " & ".$this->dynamicCells($text, $count); //izpis celic z izracuni odgovorov v stolpcih (npr. Sploh ne velja, ...)
$tex .= $this->sumLokacijaRowOutput($text, $count, $height, $variable['variable']);
}
/*zakljucek vrstice s podatki*/
/* $tex .= $this->texNewLine; //nova vrstica
$tex .= $this->horizontalLineTex; //horizontalna crta */
}
/*izpis vrstic s podatki - konec*/
//zaljucek latex tabele z obrobo
$tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}");
//zaljucek latex tabele z obrobo - konec
}
//echo "tex: ".$tex."";
return $tex;
}
/**
* Izrise vrstico prilagojeno za lokacijo
*
* @param type $text - array odgovorov
* @param type $count - st variabel/stolpcev
* @param type $height - izracunana najvisja visina celice v vrstici
* @param type $variable - array variabel/stolpcev
*/
function sumLokacijaRowOutput($text='', $count=null, $height=null, $variable='') {
$texSumLokacijaRowOutput = '';
$texSumLokacijaRowOutput .= " & ".LatexDocument::encodeText($variable);
/* $this->pdf->MultiCell(18, $height, LatexDocument::encodeText($variable), 1, 'C', 0, 0, 0 ,0, true);
$this->dynamicCells($text, $count, 162, $height);
$this->pdf->ln($height); */
$texSumLokacijaRowOutput .= $this->dynamicCells($text, $count);
return $texSumLokacijaRowOutput;
}
/** Izriše tekstovne odgovore kot tabelo z navedbami z Latex
*
* @param unknown_type $spid
*/
function sumMultiText($spid=null, $_from=null, $export_format='') {
//echo "sumMultiText ";
global $lang;
$tex = '';
$spremenljivka = SurveyAnalysis::$_HEADERS[$spid];
# dodamo opcijo kje izrisujemo legendo
# če je besedilo * in je samo ena kategorija je inline legenda false
$_cols = $spremenljivka['cnt_all'] / $spremenljivka['cnt_grids'];
# pogledamo koliko je max št odgovorov pri posameznem podvprašanju
/* $_max_answers = array();
$_max_answers_cnt = 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
$_max_answers[$gid][$vid] = count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']);
$_max_answers_cnt = max( $_max_answers_cnt, count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']) );
}
}
}
*/
# koliko zapisov prikažemo naenkrat
$num_show_records = SurveyAnalysis::getNumRecords();
//$num_show_records = $_max_answers_cnt <= (int)$num_show_records ? $_max_answers_cnt : $num_show_records;
$_answers = SurveyAnalysis::getAnswers($spremenljivka,$num_show_records);
$_all_valid_answers_cnt = $_answers['validCnt'];
$_valid_answers = $_answers['valid'];
$_answersOther = array();
$_grids_count = count($spremenljivka['grids']);
/*Priprava parametrov za tabelo in ostala polja za nadaljnji izpis*/
if ($_grids_count > 0) {
# naslovna vrstica
$_row = $spremenljivka['grids'][0];
$count = 0;
$text = array();
foreach ($_row['variables'] AS $rid => $_col ){
$_sequence = $_col['sequence']; # id kolone z podatki
if ($_col['other'] != true) {
$text[] = $_col['naslov'];
}
else {
$_answersOther[] = array('spid'=>$spid,'gid'=>isset($gid)?$gid:0,'vid'=>isset($vid)?$vid:0,'sequence'=>$_sequence);
}
$count++;
}
}
$steviloStolpcevParameterTabular = 2 + $count;
$steviloOstalihStolpcev = $steviloStolpcevParameterTabular - 1; /*stevilo stolpcev brez prvega stolpca, ki ima fiksno sirino*/
$sirinaOstalihStolpcev = 0.9/$steviloOstalihStolpcev;
$parameterTabular = '|';
for($i = 0; $i < $steviloStolpcevParameterTabular; $i++){
//ce je prvi stolpec
if($i == 0){
$parameterTabular .= ($export_format == 'pdf' ? 'P|' : 'l|');
//$parameterTabular .= ($export_format == 'pdf' ? 'X|' : 'l|');
}else{
$parameterTabular .= ($export_format == 'pdf' ? '>{\hsize='.$sirinaOstalihStolpcev.'\hsize \centering\arraybackslash}X|' : 'c|'); /*sirina ostalih je odvisna od njihovega stevila, da se sirine razporedijo po celotni sirini tabele*/
//$parameterTabular .= ($export_format == 'pdf' ? 'X|' : 'c|'); /*sirina ostalih je odvisna od njihovega stevila, da se sirine razporedijo po celotni sirini tabele*/
}
}
/*Priprava parametrov za tabelo in ostala polja za nadaljnji izpis - konec*/
//zacetek latex tabele z obrobo za prvo tabelo
$pdfTable = 'xltabular';
$rtfTable = 'tabular';
$pdfTableWidth = 1;
$rtfTableWidth = 1;
$tex .= $this->StartLatexTable($export_format, $parameterTabular, $pdfTable, $rtfTable, $pdfTableWidth, $rtfTableWidth); /*zacetek tabele*/
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
//zacetek latex tabele z obrobo za prvo tabelo - konec
/*Naslovni vrstici tabele*/
//prva vrstica tabele
$steviloPodStolpcev1 = $steviloStolpcevParameterTabular - 1;
//$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
//$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
//$tex .= LatexDocument::encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($spremenljivka['naslov']).'} '.$this->texNewLine;
$dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov']));
//echo $dolzinaVprasanja."";
if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli
$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
//$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{p{16cm}|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
}else{
$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
}
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
//druga vrstica
$tex .= " & ".LatexDocument::encodeText($lang['srv_analiza_opisne_subquestion1'])." & \multicolumn{".$count."}{c|}{".LatexDocument::encodeText($lang['srv_analiza_opisne_arguments'])."} ".$this->texNewLine;
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
//konec naslovnih vrstic
if ($_grids_count > 0) {
/*$height = 0;*/
// Testiramo visino vrstice glede na najdaljsi text
/* foreach ($text AS $string){
$singleWidth = ($count > 0) ? round(108 / $count): 108;
//$height = ($this->getCellHeight($string, $singleWidth) > $height) ? $this->getCellHeight($string, $singleWidth) : $height;
$height = 1;
} */
/*tretja vrstica*/
$brezHline3 = 1;
$brezNoveVrstice3 = 1;
$nadaljevanjeVrstice3 = 1;
/*prva prazna stolpca v 3. vrstici*/
$textPrazniStolpci = array();
$steviloPraznihStolpcev = 2;
for($i=0;$i<$steviloPraznihStolpcev;$i++){
$textPrazniStolpci[$i] = '';
}
$tex .= $this->tableRow($textPrazniStolpci, $brezHline3, $brezNoveVrstice3, $nadaljevanjeVrstice3); //izpis ostalega dela vrstice
$tex .= $this->dynamicCells($text, $count); //izpis celic z odgovori v stolpcih (npr. Sploh ne velja, ...)
$tex .= $this->texNewLine;
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
/*prva prazna stolpca v 3. vrstici - konec*/
$last = 0;
/*izpis vrstic s podatki*/
foreach ($spremenljivka['grids'] AS $gid => $grid) {
$_variables_count = count($grid['variables']);
$height = 0;
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,(isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']:null)));
}
# za barvanje
$last = ($last & 1) ? 0 : 1 ;
$count = 0;
$text = array();
foreach ($grid['variables'] AS $vid => $variable ){
$_sequence = $variable['sequence']; # id kolone z podatki
if ($variable['other'] != true) {
# tabela z navedbami
$index=0;
# odvisno ali imamo odgovor
if (count($_valid_answers) > 0) {
$text2 = '';
foreach ($_valid_answers AS $answer) {
$index++;
$_ans = $answer[$_sequence];
if ($_ans != null && $_ans != '') {
$text2 .= $_ans.', ';
}
}
$text[] = substr($text2, 0, -2);
}
else {
$text[] = ' ';
}
$count++;
}
}
$last = $_max_i;
}
// Testiramo visino vrstice glede na najdaljsi text
foreach ($text AS $string){
$singleWidth = ($count > 0) ? round(108 / $count): 108;
//$height = ($this->getCellHeight($string, $singleWidth) > $height) ? $this->getCellHeight($string, $singleWidth) : $height;
$height = 1;
}
$tex .= LatexDocument::encodeText(isset($grid['variable'])?$grid['variable']:'');
$tex .= " & ".LatexDocument::encodeText($grid['naslov']);
$tex .= " & ".$this->dynamicCells($text, $count); //izpis celic z izracuni odgovorov v stolpcih (npr. Sploh ne velja, ...)
/*zakljucek vrstice s podatki*/
$tex .= $this->texNewLine; //nova vrstica
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*horizontalna crta*/
}
}
/*izpis vrstic s podatki - konec*/
//zaljucek latex tabele z obrobo za drugo tabelo
$tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}");
//zaljucek latex tabele z obrobo za drugo tabelo - konec
}
# izpišemo še tekstovne odgovore za polja drugo
if (count($_answersOther) > 0 && SurveyAnalysis::$_FILTRED_OTHER) {
foreach ($_answersOther AS $oAnswers) {
$tex .= self::outputOtherAnswers($oAnswers, $parameterTabular, $export_format);
}
}
return $tex;
}
/** Izriše multi number odgovore. izpiše samo povprečja z Latex
*
* @param unknown_type $spid
*/
function sumMultiNumber($spid=null, $_from=null, $export_format='') {
//echo "sumMultiNumber ";
global $lang;
$tex = '';
$spremenljivka = SurveyAnalysis::$_HEADERS[$spid];
$_cols = $spremenljivka['cnt_all'] / $spremenljivka['cnt_grids'];
$_answersOther = array();
$_grids_count = count($spremenljivka['grids']);
/*Priprava parametrov za tabelo in ostala polja za nadaljnji izpis*/
if ($_grids_count > 0) {
# naslovna vrstica
$_row = $spremenljivka['grids'][0];
$count = 0;
$text = array();
foreach ($_row['variables'] AS $rid => $_col ){
$_sequence = $_col['sequence']; # id kolone z podatki
if ($_col['other'] != true) {
$text[] = $_col['naslov'];
}
else {
$_answersOther[] = array('spid'=>$spid,'gid'=>isset($gid)?$gid:0,'vid'=>isset($vid)?$vid:0,'sequence'=>$_sequence);
}
$count++;
}
}
$steviloStolpcevParameterTabular = 2 + $count;
$steviloOstalihStolpcev = $steviloStolpcevParameterTabular - 1; /*stevilo stolpcev brez prvega stolpca, ki ima fiksno sirino*/
$sirinaOstalihStolpcev = 0.9/$steviloOstalihStolpcev;
$parameterTabular = '|';
for($i = 0; $i < $steviloStolpcevParameterTabular; $i++){
//ce je prvi stolpec
if($i == 0){
$parameterTabular .= ($export_format == 'pdf' ? 'P|' : 'l|');
//$parameterTabular .= ($export_format == 'pdf' ? 'X|' : 'l|');
}else{
$parameterTabular .= ($export_format == 'pdf' ? '>{\hsize='.$sirinaOstalihStolpcev.'\hsize \centering\arraybackslash}X|' : 'c|'); /*sirina ostalih je odvisna od njihovega stevila, da se sirine razporedijo po celotni sirini tabele*/
//$parameterTabular .= ($export_format == 'pdf' ? 'X|' : 'c|'); /*sirina ostalih je odvisna od njihovega stevila, da se sirine razporedijo po celotni sirini tabele*/
}
}
/*Priprava parametrov za tabelo in ostala polja za nadaljnji izpis - konec*/
//zacetek latex tabele z obrobo za prvo tabelo
$pdfTable = 'xltabular';
$rtfTable = 'tabular';
$pdfTableWidth = 1;
$rtfTableWidth = 1;
$tex .= $this->StartLatexTable($export_format, $parameterTabular, $pdfTable, $rtfTable, $pdfTableWidth, $rtfTableWidth); /*zacetek tabele*/
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
//zacetek latex tabele z obrobo za prvo tabelo - konec
/*Naslovni vrstici tabele*/
//prva vrstica tabele
$steviloPodStolpcev1 = $steviloStolpcevParameterTabular - 1;
//$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
//$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
//$tex .= LatexDocument::encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($spremenljivka['naslov']).'} '.$this->texNewLine;
$dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov']));
//echo $dolzinaVprasanja."";
if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli
$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
}else{
$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
}
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
//druga vrstica
$tex .= " & ".LatexDocument::encodeText($lang['srv_analiza_opisne_subquestion1'])." & \multicolumn{".$count."}{c|}{".LatexDocument::encodeText($lang['srv_analiza_sums_average'])."} ".$this->texNewLine;
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
/*Konec naslovnih vrstic*/
if ($_grids_count > 0) {
/*tretja vrstica*/
$brezHline3 = 1;
$brezNoveVrstice3 = 1;
$nadaljevanjeVrstice3 = 1;
/*prva prazna stolpca v 3. vrstici*/
$textPrazniStolpci = array();
$steviloPraznihStolpcev = 2;
for($i=0;$i<$steviloPraznihStolpcev;$i++){
$textPrazniStolpci[$i] = '';
}
$tex .= $this->tableRow($textPrazniStolpci, $brezHline3, $brezNoveVrstice3, $nadaljevanjeVrstice3); //izpis ostalega dela vrstice
$tex .= $this->dynamicCells($text, $count); //izpis celic z odgovori v stolpcih (npr. Sploh ne velja, ...)
$tex .= $this->texNewLine;
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
/*prva prazna stolpca v 3. vrstici - konec*/
$last = 0;
/*izpis vrstic s podatki*/
foreach ($spremenljivka['grids'] AS $gid => $grid) {
$_variables_count = count($grid['variables']);
$tex .= LatexDocument::encodeText($grid['variable']);
$tex .= " & ".LatexDocument::encodeText($grid['naslov']);
if ($_variables_count > 0) {
$count = 0;
$text = array();
foreach ($grid['variables'] AS $vid => $variable ){
$_sequence = $variable['sequence']; # id kolone z podatki
if ($variable['other'] != true) {
# tabela z navedbami
$text[] = self::formatNumber((isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['average'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['average']:null),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'');
$count++;
}
//$count++;
}
$tex .= " & ".$this->dynamicCells($text, $count); //izpis celic z izracuni odgovorov v stolpcih (npr. Sploh ne velja, ...)
}
/*zakljucek vrstice s podatki*/
$tex .= $this->texNewLine; //nova vrstica
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*horizontalna linija*/
}
}
/*izpis vrstic s podatki - konec*/
//zaljucek latex tabele z obrobo za drugo tabelo
$tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}");
//zaljucek latex tabele z obrobo za drugo tabelo - konec
}
/*echo "Latex tabele: ".$tex."";*/
return $tex;
}
/** Izriše sumarnik v horizontalni obliki za multi checkbox z Latex
*
* @param unknown_type $spid - spremenljivka ID
*/
function sumMultiHorizontalCheckbox($spid=null, $_from=null, $export_format='') {
//echo "sumMultiHorizontalCheckbox ";
global $lang;
$tex = '';
$spremenljivka = SurveyAnalysis::$_HEADERS[$spid];
$_answersOther = array();
# ugotovimo koliko imamo kolon
$gid=0;
$_clmn_cnt = SurveyAnalysis::$_HEADERS[$spid]['grids'][$gid]['cnt_vars']-(isset(SurveyAnalysis::$_HEADERS[$spid]['grids'][$gid]['cnt_other'])?SurveyAnalysis::$_HEADERS[$spid]['grids'][$gid]['cnt_other']:null);
# tekst vprašanja
/*Priprava parametrov za tabelo in polja za 3. vrstico */
$_variables = SurveyAnalysis::$_HEADERS[$spid]['grids'][$gid]['variables'];
$count = 0;
$height = 0;
$textVrstica3 = array();
foreach ($_variables AS $vkey => $variable) {
if ($variable['other'] != true) {
$textVrstica3[] = $variable['naslov'].' ('.$variable['gr_id']. ')';
/*$singleWidth = round(54 / (count($_variables) + 1));
$height = 1; //$height = ($height < $this->getCellHeight($variable['naslov'].' ('.$variable['gr_id']. ')', $singleWidth)) ? $this->getCellHeight($variable['naslov'].' ('.$variable['gr_id']. ')', $singleWidth) : $height; */
}
$count++;
}
$steviloStolpcevParameterTabular = 5 + 2*$count;
$parameterTabular = '|';
for($i = 0; $i < $steviloStolpcevParameterTabular; $i++){
//ce je prvi stolpec
if($i == 0){
//$parameterTabular .= ($export_format == 'pdf' ? 'b|' : 'l|');
$parameterTabular .= ($export_format == 'pdf' ? 's|' : 'c|');
//$parameterTabular .= ($export_format == 'pdf' ? 'X|' : 'c|');
}else if($i == 1){
$parameterTabular .= ($export_format == 'pdf' ? 'B|' : 'l|');
//$parameterTabular .= ($export_format == 'pdf' ? 'X|' : 'l|');
}
else{
$parameterTabular .= ($export_format == 'pdf' ? 's|' : 'c|');
//$parameterTabular .= ($export_format == 'pdf' ? 'X|' : 'c|');
}
}
/*Priprava parametrov za tabelo in polja za 3. vrstico - konec*/
//zacetek latex tabele z obrobo za prvo tabelo
$pdfTable = 'xltabular';
$rtfTable = 'tabular';
$pdfTableWidth = 1;
$rtfTableWidth = 1;
$tex .= $this->StartLatexTable($export_format, $parameterTabular, $pdfTable, $rtfTable, $pdfTableWidth, $rtfTableWidth); /*zacetek tabele*/
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
//zacetek latex tabele z obrobo za prvo tabelo - konec
/* prva vrstica */
$steviloPodStolpcev1 = $steviloStolpcevParameterTabular - 1;
//$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
//$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
//$tex .= LatexDocument::encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($spremenljivka['naslov']).'} '.$this->texNewLine;
$dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov']));
//echo $dolzinaVprasanja."";
if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli
$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
}else{
$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
}
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
/* prva vrstica - konec */
/* druga vrstica*/
//$steviloPodStolpcev2 = count($spremenljivka['options']) + 1;
$steviloPodStolpcev2 = $count;
$tex .= " & ".LatexDocument::encodeText($lang['srv_analiza_opisne_subquestion1'])." & \multicolumn{".$steviloPodStolpcev2."}{c|}{".LatexDocument::encodeText($lang['srv_analiza_opisne_answers'])."} ";
$tex .= " & ".LatexDocument::encodeText($lang['srv_analiza_opisne_valid']);
$tex .= " & ".LatexDocument::encodeText($lang['srv_analiza_num_units']);
$steviloPodStolpcev3 = $count+1;
$tex .= " & \multicolumn{".$steviloPodStolpcev3."}{c|}{".LatexDocument::encodeText($lang['srv_analiza_opisne_arguments'])."} ";
$tex .= $this->texNewLine; //nova vrstica
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
/* druga vrstica - konec*/
/*tretja vrstica*/
$brezHline3 = 1;
$brezNoveVrstice3 = 1;
$nadaljevanjeVrstice3 = 1;
/*prva prazna stolpca 3. vrstice*/
$textPrazniStolpci = array();
$steviloPraznihStolpcev = 2;
for($i=0;$i<$steviloPraznihStolpcev;$i++){
$textPrazniStolpci[$i] = '';
}
$tex .= $this->tableRow($textPrazniStolpci, $brezHline3, $brezNoveVrstice3, $nadaljevanjeVrstice3); //izpis ostalega dela vrstice
/*prva prazna stolpca 3. vrstice - konec*/
$tex .= $this->dynamicCells($textVrstica3, $count); //izpis celic z odgovori v stolpcih (npr. Sploh ne velja, ...)
/*se dva prazna stolpca 3. vrstice*/
$textPrazniStolpci = array();
$steviloPraznihStolpcev = 2;
for($i=0;$i<$steviloPraznihStolpcev;$i++){
$textPrazniStolpci[$i] = '';
}
$tex .= $this->tableRow($textPrazniStolpci, $brezHline3, $brezNoveVrstice3, $nadaljevanjeVrstice3); //izpis ostalega dela vrstice
/*se dva prazna stolpca 3. vrstice - konec*/
$tex .= " & ".$this->dynamicCells($textVrstica3, $count); //izpis celic z odgovori v stolpcih (npr. Sploh ne velja, ...)
/* $count = 0;
$text = array();
foreach ($_variables AS $vkey => $variable) {
if ($variable['other'] != true) {
$text[] = $variable['naslov'].' ('.$variable['gr_id']. ')';
}
$count++;
}
$this->dynamicCells($text, $count, 44, $height); */
$tex .= " & ".LatexDocument::encodeText($lang['srv_anl_suma1']); //Skupaj
$tex .= $this->texNewLine;
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
} //horizontalna crta
/*tretja vrstica - konec*/
/*vrstice s podatki*/
foreach (SurveyAnalysis::$_HEADERS[$spid]['grids'] AS $gid => $grids) {
$_cnt = 0;
$height = 1;//$height = $this->getCellHeight(LatexDocument::encodeText($grids['naslov']), 18);
$height = ($height < 8 ? 8 : $height);
# vodoravna vrstice s podatki
$tex .= LatexDocument::encodeText($grids['variable']);
$tex .= " & ".LatexDocument::encodeText($grids['naslov']);
$_arguments = 0;
$_max_appropriate = 0;
$_max_cnt = 0;
// prikaz frekvenc
$count = 0;
$text = array();
foreach ($grids['variables'] AS $vkey => $variable) {
$_sequence = $variable['sequence'];
$_valid = SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'];
$_cnt = SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt'];
$_arguments += $_cnt;
$_max_appropriate = max($_max_appropriate, (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']);
$_max_cnt = max ($_max_cnt, ((int)(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']+(int)SurveyAnalysis::$_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;
$text[] = $_cnt . ' (' . self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%') . ')';
$count++;
}
}
$tex .= " & ".$this->dynamicCells($text, $count); //izpis celic z izracuni odgovorov v stolpcih (npr. Sploh ne velja, ...)
# veljavno
$tex .= " & ".$_max_cnt;
#ustrezno
$tex .= " & ".$_max_appropriate;
$count = 0;
$text = array();
foreach ($grids['variables'] AS $vkey => $variable) {
if ($variable['other'] != true) {
$_sequence = $variable['sequence'];
$_cnt = SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt'];
$_percent = ($_arguments > 0 ) ? $_cnt * 100 / $_arguments : 0;
$text[] = $_cnt . ' (' . self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%') . ')';
$count++;
}
}
$tex .= " & ".$this->dynamicCells($text, $count); //izpis celic z izracuni odgovorov v stolpcih (npr. Sploh ne velja, ...)
$tex .= " & ".$_arguments;
/*zakljucek vrstice*/
$tex .= $this->texNewLine; //nova vrstica
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
} //horizontalna crta
}
/*vrstice s podatki - konec*/
/*zaljucek latex tabele z obrobo za prvo tabelo*/
$tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}");
/*zaljucek latex tabele z obrobo za prvo tabelo - konec*/
# izpišemo še tekstovne odgovore za polja drugo
if (count($_answersOther) > 0 && SurveyAnalysis::$_FILTRED_OTHER) {
foreach ($_answersOther AS $oAnswers) {
$tex .= self::outputOtherAnswers($oAnswers, $parameterTabular, $export_format);
}
}
//echo "tex: ".$tex."";
return $tex;
}
/** za multi grid tekstovne vrstice doda vrstico z labeliami grida
*
* @param $gkey
* @param $gAnswer
* @param $spid
* @param $_options
*/
function outputGridLabelVertical($gid=null, $grid=null, $vid=null, $variable=null, $spid=null, $_options=array()) {
//echo "outputGridLabelVertical ";
$counter = 0;
$text = array();
$text[] = LatexDocument::encodeText($variable['variable']);
$text[] = LatexDocument::encodeText(($grid['naslov'] != '' ? $grid['naslov']. ' - ' : '').$variable['naslov']);
$text[] = '';
$text[] = '';
$text[] = '';
$text[] = '';
$this->tableRow($text);
$counter++;
return $counter;
}
function setUserId($usrId=null) {$this->anketa['uid'] = $usrId;}
function getUserId() {return ($this->anketa['uid'])?$this->anketa['uid']:false;}
function formatNumber($value=null, $digit=0, $sufix=""){
if ( $value <> 0 && $value != null )
$result = round($value,$digit);
else
$result = "0";
$result = number_format($result, $digit, ',', '.').$sufix;
return $result;
}
/** Izriše heatmap odgovore.
*
* @param unknown_type $spid
*/
function sumHeatmap($spid=null, $_from=null, $export_format='') {
//echo "sumHeatmap ";
global $lang;
global $site_url;
global $site_path;
$tex = '';
$spremenljivka = SurveyAnalysis::$_HEADERS[$spid];
//Priprava podatkov za tabelo
# 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)(isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']:null);
}
}
}
if (SurveyDataSettingProfiles :: getSetting('hideEmpty') == 1 && $only_valid == 0 && SurveyAnalysis::$_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 = SurveyAnalysis::getNumRecords();
$_answers = SurveyAnalysis::getAnswers($spremenljivka,$num_show_records);
$_all_valid_answers_cnt = $_answers['validCnt'];
$_valid_answers = $_answers['valid'];
$export = 1;
//2. stolpec - Veljavni za x in y koordinati
$validHeatmapRegion = SurveyAnalysis::validHeatmapRegion($spremenljivka['grids'], $spid, $_valid_answers, $export);
//3. stolpec - Ustrezni za x in y koordinati
$ustrezniHeatmapRegion = SurveyAnalysis::ustrezniHeatmapRegion($spid, $_valid_answers, $_sequence); //vsi mozni kliki
//4. stolpec - Povprecje za x in y koordinati
$povprecjeHeatmapClicksX = self::formatNumber(SurveyAnalysis::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'x', $validHeatmapRegion, 'povprecje', $export),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'');
$povprecjeHeatmapClicksY = self::formatNumber(SurveyAnalysis::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'y', $validHeatmapRegion, 'povprecje', $export),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'');
//5. stolpec - Standardni odklon za x in y koordinati
$stdevHeatmapClicksX = self::formatNumber(SurveyAnalysis::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'x', $validHeatmapRegion, 'stdev', $export),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'');
$stdevHeatmapClicksY = self::formatNumber(SurveyAnalysis::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'y', $validHeatmapRegion, 'stdev', $export),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'');
//6. stolpec - Minimum za x in y koordinati
$minHeatmapClicksX = self::formatNumber(SurveyAnalysis::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'x', $validHeatmapRegion, 'min', $export),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'');
$minHeatmapClicksY = self::formatNumber(SurveyAnalysis::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'y', $validHeatmapRegion, 'min', $export),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'');
//7. stolpec - Max za x in y koordinati
$maxHeatmapClicksX = self::formatNumber(SurveyAnalysis::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'x', $validHeatmapRegion, 'max', $export),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'');
$maxHeatmapClicksY = self::formatNumber(SurveyAnalysis::heatmapClicksCalc($spremenljivka['grids'], $spid, $_valid_answers, 'y', $validHeatmapRegion, 'max', $export),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'');
//Priprava podatkov za tabelo - konec
/*Priprava parametrov za tabelo in ostala polja za nadaljnji izpis*/
$steviloStolpcevParameterTabular = 7;
$steviloOstalihStolpcev = $steviloStolpcevParameterTabular - 1; /*stevilo stolpcev brez prvega stolpca, ki ima fiksno sirino*/
$sirinaOstalihStolpcev = 0.9/$steviloOstalihStolpcev;
$parameterTabular = '|';
for($i = 0; $i < $steviloStolpcevParameterTabular; $i++){
//ce je prvi stolpec
if($i == 0){
$parameterTabular .= ($export_format == 'pdf' ? 'P|' : 'l|');
//$parameterTabular .= ($export_format == 'pdf' ? 'X|' : 'l|');
}else{
$parameterTabular .= ($export_format == 'pdf' ? '>{\hsize='.$sirinaOstalihStolpcev.'\hsize \centering\arraybackslash}X|' : 'c|'); /*sirina ostalih je odvisna od njihovega stevila, da se sirine razporedijo po celotni sirini tabele*/
}
}
/*Priprava parametrov za tabelo in ostala polja za nadaljnji izpis - konec*/
//zacetek latex tabele z obrobo za prvo tabelo
$pdfTable = 'xltabular';
$rtfTable = 'tabular';
$pdfTableWidth = 1;
$rtfTableWidth = 1;
$tex .= $this->StartLatexTable($export_format, $parameterTabular, $pdfTable, $rtfTable, $pdfTableWidth, $rtfTableWidth); /*zacetek tabele*/
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
//zacetek latex tabele z obrobo za prvo tabelo - konec
/*Naslovni vrstici tabele*/
//prva vrstica tabele
$steviloPodStolpcev1 = $steviloStolpcevParameterTabular - 1;
$dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov']));
if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli
$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
}else{
$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine;
}
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
//druga vrstica
$spr_id = $this->GetSprId($spid);
$heatmapImageFileName = 'heatmap'.$spr_id;
$heatmapImageSrc = $site_path.'main/survey/uploads/'.$heatmapImageFileName.'.png';
$heatmapImageFileNamePresent = file_exists($heatmapImageSrc);
if($heatmapImageFileNamePresent){ //ce je prisotna datoteka heatmap slike
$heatmapImage = '\includegraphics[scale=0.5]{'.$heatmapImageFileName.'}';
}else{ //ce ni
//$heatmapImage = 'Pred izvozom, zgenerirajte heatmap';
$heatmapImage = $lang['export_analysis_heatmap_msg'];
}
$tex .= " & \multicolumn{".$steviloPodStolpcev1."}{c|}{".$heatmapImage."} ".$this->texNewLine;
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
/*Konec naslovnih vrstic*/
//tretja vrstica
$tex .= " \multicolumn{".$steviloStolpcevParameterTabular."}{|c|}{".LatexDocument::encodeText($lang['srv_analiza_heatmap_clicked_coords'])."} ".$this->texNewLine;
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
//tretja vrstica - konec
$brezHline = $this->getBrezHline($export_format);
//cetrta vrstica
$cetrtaVrstica = array();
$cetrtaVrstica[] = LatexDocument::encodeText($lang['coordinates']);
$cetrtaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_opisne_valid_heatmap']);
$cetrtaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_num_units_valid_heatmap']);
$cetrtaVrstica[] = LatexDocument::encodeText($lang['srv_means_label']);
$cetrtaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_opisne_odklon']);
$cetrtaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_opisne_min']);
$cetrtaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_opisne_max']);
$tex .= $this->tableRow($cetrtaVrstica, $brezHline);
//cetrta vrstica - konec
//vrstici s podatki za x in y koordinati
//peta vrstica x
$petaVrstica = array();
$petaVrstica[] = 'x';
$petaVrstica[] = LatexDocument::encodeText($validHeatmapRegion);
$petaVrstica[] = LatexDocument::encodeText($ustrezniHeatmapRegion);
$petaVrstica[] = LatexDocument::encodeText($povprecjeHeatmapClicksX);
$petaVrstica[] = LatexDocument::encodeText($stdevHeatmapClicksX);
$petaVrstica[] = LatexDocument::encodeText($minHeatmapClicksX);
$petaVrstica[] = LatexDocument::encodeText($maxHeatmapClicksX);
$tex .= $this->tableRow($petaVrstica, $brezHline);
//peta vrstica x - konec
//sesta vrstica y
$sestaVrstica = array();
$sestaVrstica[] = 'y';
$sestaVrstica[] = LatexDocument::encodeText($validHeatmapRegion);
$sestaVrstica[] = LatexDocument::encodeText($ustrezniHeatmapRegion);
$sestaVrstica[] = LatexDocument::encodeText($povprecjeHeatmapClicksY);
$sestaVrstica[] = LatexDocument::encodeText($stdevHeatmapClicksY);
$sestaVrstica[] = LatexDocument::encodeText($minHeatmapClicksY);
$sestaVrstica[] = LatexDocument::encodeText($maxHeatmapClicksY);
$tex .= $this->tableRow($sestaVrstica, $brezHline);
//sesta vrstica y - konec
//vrstici s podatki za x in y koordinati - 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
//7. vrstica - naslovna za obmocja
$tex .= " \multicolumn{".$steviloStolpcevParameterTabular."}{|c|}{".LatexDocument::encodeText($lang['srv_analiza_heatmap_clicked_regions'])."} ".$this->texNewLine;
if($export_format != 'xls'){
$tex .= $this->horizontalLineTex; /*obroba*/
}
//konec - 7. vrstice
//8. vrstica
$osmaVrstica = array();
$osmaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_opisne_frequency_heatmap']);//od tretjega stolpca dalje, ker prva dva sta za naslov Obmocja kot multicolumn
$osmaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_opisne_valid_heatmap']);
$osmaVrstica[] = LatexDocument::encodeText('% - '.$lang['srv_analiza_opisne_valid_heatmap']);
$osmaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_num_units_valid_heatmap']);
$osmaVrstica[] = LatexDocument::encodeText('% - '.$lang['srv_analiza_num_units_valid_heatmap']);
$tex .= " \multicolumn{2}{|c|}{".LatexDocument::encodeText($lang['srv_hot_spot_regions_menu'])."} ";
$tex .= $this->tableRow($osmaVrstica, 0, 0, 1);
//echo $tex;
//8. vrstica - konec
$_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;
if (count($_row['variables'])>0){
foreach ($_row['variables'] AS $rid => $_col ){
$_sequence = $_col['sequence']; # id kolone z podatki
if ($_col['other'] != true) {
if($indeks != 0){
//od 9. vrstice dalje, kjer so po vrsticah obmocja in njihovi podatki
$devetaVrstica = array();
//1. stolpcev z imenom obmocja
$devetaVrstica[] = " \multicolumn{2}{|c|}{".LatexDocument::encodeText($_col['naslov'])."} ";
//1. stolpcev z imenom obmocja - konec
//2. stolpec - Frekvenca
$freqHeatmapRegion = SurveyAnalysis::freqHeatmapRegion($spremenljivka['grids'], $spid, $_valid_answers, $indeks, $export);
$veljavnaSkupnaFreq = isset($veljavnaSkupnaFreq)?$veljavnaSkupnaFreq:0 + $freqHeatmapRegion;
$devetaVrstica[] = $freqHeatmapRegion;
//2. stolpec - Frekvenca - konec
//3. stolpec - Veljavni
$devetaVrstica[] = LatexDocument::encodeText($validHeatmapRegion);
//3. stolpec - Veljavni - konec
//4. stolpec - % Veljavni
$_procentValidHeatmapRegion = ($validHeatmapRegion > 0 ) ? 100*$freqHeatmapRegion / $validHeatmapRegion : 0;
$_procentValidHeatmapRegion = self::formatNumber($_procentValidHeatmapRegion, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%');
$devetaVrstica[] = LatexDocument::encodeText($_procentValidHeatmapRegion);
//4. stolpec - % Veljavni - konec
//5. stolpec - Ustrezni
$ustrezniHeatmapRegion = SurveyAnalysis::ustrezniHeatmapRegion($spid, $_valid_answers, $_sequence); //vsi mozni kliki
$devetaVrstica[] = LatexDocument::encodeText($ustrezniHeatmapRegion);
//5. stolpec - Ustrezni - konec
//6. stolpec - % Ustrezni
$_procentUstrezniHeatmapRegion = ($ustrezniHeatmapRegion > 0 ) ? 100*$freqHeatmapRegion / $ustrezniHeatmapRegion : 0;
$_procentUstrezniHeatmapRegion = self::formatNumber($_procentUstrezniHeatmapRegion, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%');
$devetaVrstica[] = LatexDocument::encodeText($_procentUstrezniHeatmapRegion);
//6. stolpec - % Ustrezni - konec
$tex .= $this->tableRow($devetaVrstica, $brezHline);
//od 9. vrstice dalje, kjer so po vrsticah obmocja in njihovi podatki - konec
//*********** Izris veljavnih in manjkajocih vrednosti
$counter = 0;
$options['isTextAnswer'] = false;
$manjkajoci = $ustrezniHeatmapRegion - $validHeatmapRegion;
//10. vrstica
$desetaVrstica = array();
$desetaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_opisne_valid']);
$desetaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_manjkajocevrednosti']);
$desetaVrstica[] = $validHeatmapRegion;
$desetaVrstica[] = " \multicolumn{4}{|c|}{ } ";
$tex .= $this->tableRow($desetaVrstica, $brezHline);
//10. vrstica - konec
//11. vrstica
$enajstaVrstica = array();
$enajstaVrstica[] = LatexDocument::encodeText($lang['srv_anl_missing1']);
$enajstaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_manjkajocevrednosti']);
$enajstaVrstica[] = $manjkajoci;
$enajstaVrstica[] = " \multicolumn{4}{|c|}{ } ";
$tex .= $this->tableRow($enajstaVrstica, $brezHline);
//11. vrstica - konec
//12. vrstica
$dvanajstaVrstica = array();
$dvanajstaVrstica[] = " \multicolumn{2}{|c|}{".LatexDocument::encodeText($lang['srv_anl_suma_valid'])." } ";
$dvanajstaVrstica[] = $ustrezniHeatmapRegion;
$dvanajstaVrstica[] = " \multicolumn{4}{|c|}{ } ";
$tex .= $this->tableRow($dvanajstaVrstica, $brezHline);
//12. vrstica - konec
$veljavnaSkupnaFreq = 0;
}
//*********** Izris veljavnih in manjkajocih vrednosti - konec
} else {
$_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence);
}
$indeks++;
}
}
}
}
# izpišemo še tekstovne odgovore za polja drugo
/* if (count($_answersOther) > 0 && self::$_FILTRED_OTHER) {
foreach ($_answersOther AS $oAnswers) {
echo '';
self::outputOtherAnswers($oAnswers);
echo '
';
}
} */
//zaljucek latex tabele z obrobo za drugo tabelo
$tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}");
//zaljucek latex tabele z obrobo za drugo tabelo - konec
/* if (count($spremenljivka['grids']) > 0) {
} */
//echo "Latex tabele: ".$tex."";
return $tex;
}
//izrisemo dinamicne celice (podamo sirino, stevilo celic in vsebino)
//function dynamicCells($arrayText, $count, $width, $height, $arrayParams=array()){
//izrisemo dinamicne celice (podamo stevilo celic in vsebino)
function dynamicCells($arrayText=null, $count=null){
$texDynamicCells = '';
if($arrayText[0] == '')
$arrayText[0] = '';
/*$linecount = $this->pdf->getNumLines(LatexDocument::encodeText($arrayText[1]), 30);
$linecount == 1 ? $height = 1 : $height = 4.7 + ($linecount-1)*3.3;*/
$text = array();
for($i=0; $i<$count-1; $i++){
//for($i=0; $i<$count; $i++){
if($arrayText[$i] == '')
$arrayText[$i] = '';
/*$this->pdf->MultiCell($singleWidth, $height, LatexDocument::encodeText($arrayText[$i]), 1, 'C', 0, 0, 0 ,0, true);*/
/*$texDynamicCells .= LatexDocument::encodeText($arrayText[$i]);*/
$text[$i] = LatexDocument::encodeText($arrayText[$i]);
}
//zadnje polje izrisemo druge sirine ker se drugace zaradi zaokrozevanja tabela porusi
/*$lastWidth = ($lastWidth < 4) ? 4 : $lastWidth;*/
if($count > 0){
/*$this->pdf->MultiCell($lastWidth, $height, LatexDocument::encodeText($arrayText[$count-1]), 1, 'C', 0, 0, 0 ,0, true);*/
/*$texDynamicCells .= LatexDocument::encodeText($arrayText[$count-1]);*/
$text[$count-1] = LatexDocument::encodeText($arrayText[$count-1]);
}else{
/*$this->pdf->MultiCell($lastWidth, $height, LatexDocument::encodeText(''), 1, 'C', 0, 0, 0 ,0, true);*/
/*$texDynamicCells .= LatexDocument::encodeText('');*/
$text[$count-1] = LatexDocument::encodeText('');
}
$brezHline = 1;
$brezNoveVrstice = 1;
$texDynamicCells .= $this->tableRow($text, $brezHline, $brezNoveVrstice);
//echo "texDynamicCells: ".$texDynamicCells."";
return $texDynamicCells;
}
function getCellHeight($string='', $width=null){
// Star nacin
//$linecount = $this->pdf->getNumLines(LatexDocument::encodeText($string), $width);
//$height = ( $linecount == 1 ? 4.7 : (4.7 + ($linecount-1)*3.5) );
$this->pdf->startTransaction();
// get the number of lines calling you method
$linecount = $this->pdf->MultiCell($width, 0, $string, 0, 'L', 0, 0, '', '', true, 0, false, true, 0);
// restore previous object
$this->pdf = $this->pdf->rollbackTransaction();
$height = ($linecount <= 1) ? 4.7 : $linecount * ($this->pdf->getFontSize() * $this->pdf->getCellHeightRatio()) + 2;
return $height;
}
static function HeatmapRegionPresence($spremenljivkaGrids=null, $spid=null, $_valid_answers=null){
$HeatmapRegionPresence = false;
$num_show_records = SurveyAnalysis::getNumRecords();
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,SurveyAnalysis::$_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;
}
}
?>