false); // za shrambo parametrov in sporocil private $headFileName = null; # pot do header fajla private $dataFileName = null; # pot do data fajla private $dataFileStatus = null; # status data datoteke /** * @desc konstruktor */ function __construct ($anketa = null, $sprID = null){ global $site_path; global $global_user_id; global $output; // preverimo ali imamo stevilko ankete if ( is_numeric($anketa) ){ $this->anketa['id'] = $anketa; $this->spremenljivka = $sprID; 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(); $_POST['podstran'] = 'usable_resp'; } else{ $this->pi['msg'] = "Anketa ni izbrana!"; $this->pi['canCreate'] = false; return false; } if (SurveyInfo::getInstance()->SurveyInit($this->anketa['id'])){ $this->anketa['uid'] = $global_user_id; SurveyUserSetting::getInstance()->Init($this->anketa['id'], $this->anketa['uid']); } else return false; // ce smo prisli do tu je vse ok $this->pi['canCreate'] = true; return true; } function getAnketa(){ return $this->anketa['id']; } function checkCreate(){ return $this->pi['canCreate']; } function getFile($fileName){ $output = $this->createXls(); $this->xls->display($fileName, $output); } 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['srv_usable_respondents'].' |
Recnum | '; $output .= ''.$lang['srv_usableResp_qcount'].' | '; $output .= ''.$lang['srv_usableResp_exposed'].' | '; $output .= ''.$lang['srv_usableResp_breakoff'].' | '; $output .= ''.$lang['srv_usableResp_usability'].' | '; // ali odstranimo vse stolpce s podrobnimi vrednostmi (-1, -2...) if ($SUR->showDetails() == true) { foreach ($_missings AS $value => $text){ $cnt_miss++; $output .= "{$value} (".$lang['srv_usableResp_'.$text].") | ";
}
foreach ($_unsets AS $value => $text){
$cnt_undefined++;
$output .= "{$value} (".$lang['srv_usableResp_'.$text].") | ";
}
}
// ali prikazemo podrobne izracune
if ($SUR->showCalculations() == true) {
$output .= 'UNL | '; $output .= 'UML | '; $output .= 'UCL | '; $output .= 'UIL | '; $output .= 'UAQ | '; } $output .= '||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
'.$lang['srv_anl_valid'].' | '; $output .= ''.$lang['srv_usableResp_nonsubstantive'].' | '; $output .= ''.$lang['srv_usableResp_nonresponse'].' | '; $output .= ''.$lang['srv_anl_suma1'].' | '; $output .= '% | '; $output .= 'Status | '; $output .= '||||||||||
'.$user['recnum'].' | '; // Vsi $output .= ''.$user['all'].' | '; // Ustrezni $output .= ''.$user['valid'].' | '; // Non-substantive $output .= ''.$user['nonsubstantive'].' | '; // Non-response $output .= ''.$user['nonresponse'].' | '; // Skupaj $output .= ''.($user['valid']+$user['nonsubstantive']+$user['nonresponse']+$user['breakoff']).' | '; // Breakoffs $output .= ''.$user['breakoff'].' | '; // Uporabni $output .= ''.$user['usable'].' | '; $output .= ''.$user['status'].' | '; // ali odstranimo vse stolpce s podrobnimi vrednostmi (-1, -2...) if ($SUR->showDetails() == true) { foreach ($_missings AS $value => $text){ $output .= ''.$user[$value].' | '; } foreach ($_unsets AS $value => $text){ $output .= ''.$user[$value].' | '; } } // ali prikazemo podrobne izracune if ($SUR->showCalculations() == true) { $output .= ''.common::formatNumber($user['UNL']*100, 0, null, '%').' | '; $output .= ''.common::formatNumber($user['UML']*100, 0, null, '%').' | '; $output .= ''.common::formatNumber($user['UCL']*100, 0, null, '%').' | '; $output .= ''.common::formatNumber($user['UIL']*100, 0, null, '%').' | '; $output .= ''.common::formatNumber($user['UAQ']*100, 0, null, '%').' | '; } $output .= '
'.common::formatNumber($user['validPercent'], 0, null, '%').' | '; // Non-substantive $output .= ''.common::formatNumber($user['nonsubstantivePercent'], 0, null, '%').' | '; // Non-response $output .= ''.common::formatNumber($user['nonresponsePercent'], 0, null, '%').' | '; // Skupaj $output .= ''.common::formatNumber(100, 0, null, '%').' | '; // Breakoffs $output .= ''.common::formatNumber($user['breakoffPercent'], 0, null, '%').' | '; // Uporabni $output .= ''.common::formatNumber($user['usablePercent'], 0, null, '%').' | '; // ali odstranimo vse stolpce s podrobnimi vrednostmi (-1, -2...) if ($SUR->showDetails() == true) { foreach ($_missings AS $value => $text){ $val = $user[$value]; $val = ($all > 0) ? ($val / $all * 100) : 0; $output .= ''.common::formatNumber($val, 0, null, '%').' | '; } foreach ($_unsets AS $value => $text){ $val = $user[$value]; $val = ($all > 0) ? ($val / $all * 100) : 0; $output .= ''.common::formatNumber($val, 0, null, '%').' | '; } } $output .= '