Popravki pri prikazu podatkov, ce so vklopljeni identifikatorji, odstranjeni stari razredi za prikaz in generiranje podatkov
This commit is contained in:
parent
1cd65e73d5
commit
f52cfae43f
@ -155,9 +155,11 @@ class SurveyDataDisplay{
|
||||
SurveySession::sessionStart(self::$sid);
|
||||
|
||||
# nastavimo limite
|
||||
self::setVars();
|
||||
self::setVars();
|
||||
|
||||
# podakcija
|
||||
self::$subAction = isset($_GET['m']) && $_GET['m'] != '' ? $_GET['m'] : M_COLLECT_DATA_VIEW;
|
||||
self::$subAction = isset($_GET['m']) && $_GET['m'] != '' ? $_GET['m'] : M_COLLECT_DATA_VIEW;
|
||||
|
||||
# informacije ankete
|
||||
SurveyInfo::getInstance()->SurveyInit($sid);
|
||||
self::$survey = SurveyInfo::getInstance()->getSurveyRow();
|
||||
@ -167,7 +169,12 @@ class SurveyDataDisplay{
|
||||
self::$db_table = '_active';
|
||||
|
||||
# ali je anketa tipa SN - social network
|
||||
self::$is_social_network = (SurveyInfo::getInstance()->checkSurveyModule('social_network')) ? true : false;
|
||||
self::$is_social_network = (SurveyInfo::getInstance()->checkSurveyModule('social_network')) ? true : false;
|
||||
|
||||
# Ce imamo vklopljeno povezovanje z identifikatorji, potem prikaz identifikatorjev izklopimo
|
||||
if(self::$survey['show_email'] == '1'){
|
||||
self::$_VARS[VAR_SHOW_SYSTEM] = false;
|
||||
}
|
||||
|
||||
# ali prikazujemo datum na začetku ankete (Če smo v identifikatorjih ne smemo zaradi povezovanja)
|
||||
if ( (self::$_VARS[VAR_SHOW_DATE] == true || (int)SurveyInfo :: getInstance()->getSurveyColumn('showItime') == 1) && self::$_VARS[VAR_SHOW_SYSTEM] == false ) {
|
||||
@ -1068,11 +1075,11 @@ class SurveyDataDisplay{
|
||||
|
||||
echo '<li>';
|
||||
|
||||
if (self::$_VARS[VAR_SHOW_SYSTEM] != true ) {
|
||||
if (self::$_VARS[VAR_SHOW_SYSTEM] != true) {
|
||||
echo '<label for="var_relevance"><input type="checkbox" onchange="setDataView(\''. VAR_RELEVANCE.'\',$(this).is(\':checked\'))" '.( self::$_VARS[VAR_RELEVANCE] ? ' checked="checked"' : '').' id="var_relevance" />'.$lang['srv_displaydata_relevance'].'</label>';
|
||||
}
|
||||
else {
|
||||
echo '<label for="var_relevance"><input type="checkbox" disabled="disabled" />'.$lang['srv_displaydata_relevance'].'</label>';
|
||||
echo '<label for="var_relevance" class="gray"><input type="checkbox" disabled="disabled" />'.$lang['srv_displaydata_relevance'].'</label>';
|
||||
}
|
||||
|
||||
echo '</li>';
|
||||
@ -1087,7 +1094,7 @@ class SurveyDataDisplay{
|
||||
echo '<label for="var_email"><input type="checkbox" onchange="setDataView(\''. VAR_EMAIL.'\',$(this).is(\':checked\'))" '.( self::$_VARS[VAR_EMAIL] ? ' checked="checked"' : '').' id="var_email" />'.$lang['srv_displaydata_invitation'].'</label>';
|
||||
}
|
||||
else {
|
||||
echo '<label for="var_email"><input type="checkbox" disabled="disabled" id="var_email" />'.$lang['srv_displaydata_invitation'].'</label>';
|
||||
echo '<label for="var_email" class="gray"><input type="checkbox" disabled="disabled" id="var_email" />'.$lang['srv_displaydata_invitation'].'</label>';
|
||||
}
|
||||
|
||||
echo '</li>';
|
||||
@ -1095,12 +1102,12 @@ class SurveyDataDisplay{
|
||||
|
||||
// podatki
|
||||
echo '<li>';
|
||||
echo ' <input type="checkbox" onclick="setDataView(\''.VAR_DATA.'\',$(this).is(\':checked\'))" '.( self::$_VARS[VAR_DATA] ? ' checked="checked"' : '').(self::$_VARS[VAR_SHOW_SYSTEM] ? ' disabled' : '').' id="data" /><label for="data">'.$lang['srv_displaydata_data'].'</label>';
|
||||
echo ' <input type="checkbox" onclick="setDataView(\''.VAR_DATA.'\',$(this).is(\':checked\'))" '.( self::$_VARS[VAR_DATA] ? ' checked="checked"' : '').(self::$_VARS[VAR_SHOW_SYSTEM] ? ' disabled' : '').' id="data" /><label for="data" '.(self::$_VARS[VAR_SHOW_SYSTEM] ? ' class="gray"' : '').'>'.$lang['srv_displaydata_data'].'</label>';
|
||||
echo '</li>';
|
||||
|
||||
// meta
|
||||
echo '<li>';
|
||||
echo ' <input type="checkbox" onclick="setDataView(\''.VAR_METAFULL.'\',$(this).is(\':checked\'))" '.( self::$_VARS[VAR_METAFULL] ? ' checked="checked"' : '').(self::$_VARS[VAR_SHOW_SYSTEM] ? ' disabled' : '').' id="fullmeta" /><label for="fullmeta">'.$lang['srv_displaydata_meta'].'</label>';
|
||||
echo ' <input type="checkbox" onclick="setDataView(\''.VAR_METAFULL.'\',$(this).is(\':checked\'))" '.( self::$_VARS[VAR_METAFULL] ? ' checked="checked"' : '').(self::$_VARS[VAR_SHOW_SYSTEM] ? ' disabled' : '').' id="fullmeta" /><label for="fullmeta" '.(self::$_VARS[VAR_SHOW_SYSTEM] ? ' class="gray"' : '').'>'.$lang['srv_displaydata_meta'].'</label>';
|
||||
echo '</li>';
|
||||
|
||||
// če imamo sistemske podatke katere moramo prikazovati ločeno - IDENTIFIKATORJI
|
||||
@ -1113,18 +1120,18 @@ class SurveyDataDisplay{
|
||||
// Po novem vedno prikazemo checkbox identifikatorji - samo je odkljukan in disablan
|
||||
else{
|
||||
echo '<li>';
|
||||
echo ' <label><input type="checkbox" checked="checked" disabled="disabled" id="showsystem" />'.$lang['srv_displaydata_system_data'].'</label>';
|
||||
echo ' <label class="gray"><input type="checkbox" checked="checked" disabled="disabled" id="showsystem" />'.$lang['srv_displaydata_system_data'].'</label>';
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
// datum
|
||||
echo '<li>';
|
||||
echo '<label><input type="checkbox" onclick="setDataView(\''.VAR_SHOW_DATE.'\',$(this).is(\':checked\'))" '.( self::$_VARS[VAR_SHOW_DATE] ? ' checked="checked"' : '').(self::$_VARS[VAR_SHOW_SYSTEM] ? ' disabled' : '').' id="showdate" />'.$lang['srv_data_date'].'</label>';
|
||||
echo '<label '.(self::$_VARS[VAR_SHOW_SYSTEM] ? ' class="gray"' : '').'><input type="checkbox" onclick="setDataView(\''.VAR_SHOW_DATE.'\',$(this).is(\':checked\'))" '.( self::$_VARS[VAR_SHOW_DATE] ? ' checked="checked"' : '').(self::$_VARS[VAR_SHOW_SYSTEM] ? ' disabled' : '').' id="showdate" />'.$lang['srv_data_date'].'</label>';
|
||||
echo '</li>';
|
||||
|
||||
// zaporedna številka
|
||||
echo '<li>';
|
||||
echo '<label><input type="checkbox" onclick="setDataView(\''.VAR_SHOW_NO.'\',$(this).is(\':checked\'))" '.( self::$_VARS[VAR_SHOW_NO] ? ' checked="checked"' : '').' id="showno" />'.$lang['srv_recnum'].'</label>';
|
||||
echo '<label '.(self::$_VARS[VAR_SHOW_SYSTEM] ? ' class="gray"' : '').'><input type="checkbox" onclick="setDataView(\''.VAR_SHOW_NO.'\',$(this).is(\':checked\'))" '.( self::$_VARS[VAR_SHOW_NO] ? ' checked="checked"' : '').(self::$_VARS[VAR_SHOW_SYSTEM] ? ' disabled' : '').' id="showno" />'.$lang['srv_recnum'].'</label>';
|
||||
echo '</li>';
|
||||
|
||||
// pomoč - ?
|
||||
@ -1225,8 +1232,11 @@ class SurveyDataDisplay{
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '<br class="clr" />';
|
||||
echo '<div id="displayFilterNotes">';
|
||||
echo '<br class="clr" />';
|
||||
|
||||
|
||||
echo '<div id="displayFilterNotes">';
|
||||
|
||||
# če ne uporabljamo privzetega časovnega profila izpišemo opozorilo
|
||||
SurveyTimeProfiles :: printIsDefaultProfile();
|
||||
|
||||
@ -1241,13 +1251,21 @@ class SurveyDataDisplay{
|
||||
|
||||
# če imamo filter spremenljivk ga izpišemo
|
||||
SurveyVariablesProfiles:: getProfileString();
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo '<p>'.$lang['srv_data_settings_identifier_notice'].'</p>';
|
||||
}
|
||||
# če imamo rekodiranje
|
||||
$SR = new SurveyRecoding(self::$sid);
|
||||
$SR -> getProfileString();
|
||||
$SR -> getProfileString();
|
||||
|
||||
echo '</div>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$folder = $site_path . EXPORT_FOLDER.'/';
|
||||
|
||||
echo '<div id="div_vnosi_data">';
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,610 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created on Dec.2010
|
||||
*
|
||||
* @author: Gorazd Vesleič
|
||||
*
|
||||
* @desc: za kreacijo datoteke s podatki za SN (Alterji)
|
||||
* Datoteko z alterji skreira iz obstoječe datoteke s podatki
|
||||
*
|
||||
* funkcije:
|
||||
* - Init() - inicializacija
|
||||
*
|
||||
* CHANGELOG:
|
||||
* - 9.12.2011
|
||||
* Po novem bo potrebno ločit tabele za vsak SN loop. Zato se bo kreiralo tudi več datotek (koliko je pač glavnih loopov)
|
||||
* Hkrati je potrebno navest za kateri krog atunučuja gre :)
|
||||
* zato je na začetek dodana funkcija ki prešteje loope
|
||||
*/
|
||||
|
||||
#KONSTANTE
|
||||
define(EXPORT_FOLDER, "admin/survey/SurveyData", true);
|
||||
DEFINE (STR_DLMT, "|", true);
|
||||
|
||||
class SurveySNDataFile {
|
||||
|
||||
private $surveyId = null; # Id ankete
|
||||
private $folder = null; # pot do datotek s podatki
|
||||
private $_HEADERS = null; # Header podatki
|
||||
|
||||
private $headFileName = null; # pot do header fajla
|
||||
private $dataFileName = null; # pot do data fajla
|
||||
private $dataFileStatus = null; # status data datoteke
|
||||
private $SDF = null; # class za inkrementalno dodajanje fajlov
|
||||
|
||||
private $sn_loop_parents = null; #glavni loopi
|
||||
private $sn_loop_spremenljivke = null; # loopi po spremenljivkah
|
||||
private $sn_loop_data = null; # ime loop variable, antonucci...
|
||||
private $snCreateFullTable = true; # Ali prikazujemo celotno tabelo
|
||||
|
||||
|
||||
private $_VARS = array();
|
||||
|
||||
function __construct ($sid) {
|
||||
# nastavimo privzeto pot do folderjev
|
||||
global $site_path, $global_user_id;
|
||||
|
||||
$this->surveyId = $sid;
|
||||
$this->folder = $site_path . EXPORT_FOLDER.'/';
|
||||
|
||||
#inicializiramo class za datoteke
|
||||
$this->SDF = SurveyDataFile::get_instance();
|
||||
$this->SDF->init($sid);
|
||||
$this->headFileName = $this->SDF->getHeaderFileName();
|
||||
$this->dataFileName = $this->SDF->getDataFileName();
|
||||
$this->dataFileStatus = $this->SDF->getStatus();
|
||||
|
||||
session_start();
|
||||
|
||||
$this->snCreateFullTable = $_SESSION['sid_'.$sid]['snCreateFullTable'];
|
||||
if ( $this->dataFileStatus == FILE_STATUS_NO_DATA
|
||||
|| $this->dataFileStatus == FILE_STATUS_SRV_DELETED) {
|
||||
Common::noDataAlert();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function setVars($_VARS) {
|
||||
$this->_VARS = $_VARS;
|
||||
}
|
||||
public function setParameter($parameter,$value) {
|
||||
$this->{$parameter} = $value;
|
||||
}
|
||||
/** Preštejemo loope
|
||||
*
|
||||
*/
|
||||
function countLoops() {
|
||||
if ($this->dataFileStatus >= 0 && $this->headFileName != '') {
|
||||
$this -> _HEADERS = unserialize(file_get_contents($this->headFileName)) ;
|
||||
# poiščemo skevence za vse variable loopa
|
||||
#$_headers = $this -> _HEADERS;
|
||||
$_headers = $this->getCleanHeader();
|
||||
|
||||
#preštejemo koliko loopov imamo
|
||||
$this->sn_loop_parents = array();
|
||||
$this->sn_loop_spremenljivke = array();
|
||||
|
||||
if (count($_headers) > 0) {
|
||||
foreach ($_headers as $spr => $spremenljivka) {
|
||||
if ($spremenljivka['loop_parent'] > 0) {
|
||||
$this->sn_loop_data[$spremenljivka['loop_parent']]['antonucci'] = $spremenljivka['antonucci'];
|
||||
$this->sn_loop_data[$spremenljivka['loop_parent']]['spr'] = $spr;
|
||||
$this->sn_loop_data[$spremenljivka['loop_parent']]['variable'] = $spremenljivka['variable'];
|
||||
$this->sn_loop_data[$spremenljivka['loop_parent']]['naslov'] = $spremenljivka['naslov'];
|
||||
}
|
||||
# spremenljivka je parent za loop, preštejemo variable
|
||||
if (count($spremenljivka['grids']) > 0) {
|
||||
foreach($spremenljivka['grids'] AS $gid => $grid) {
|
||||
if (count($grid['variables']) > 0) {
|
||||
foreach($grid['variables'] AS $vid => $variable) {
|
||||
# če smo v loop parent
|
||||
if ($spremenljivka['loop_parent'] > 0) {
|
||||
$this->sn_loop_parents[$spremenljivka['loop_parent']][$variable['sequence']] = $variable['sequence'];
|
||||
|
||||
}
|
||||
# če smo v loop spremenljivki
|
||||
if ($spremenljivka['parent_loop_id'] > 0) {
|
||||
$this->sn_loop_spremenljivke[$spremenljivka['parent_loop_id']][$spremenljivka['loop_id']][$variable['sequence']] = $variable['sequence'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Skreira datoteko z alterji iz obstoječe datoteke s podatki
|
||||
*
|
||||
*/
|
||||
function createSNDataFile($lpid, $sn_loop_parent,$_SN_head_file_name,$_sn_filename) {
|
||||
if ($this->dataFileStatus >= 0 && $this->headFileName != '') {
|
||||
# če kreiramo nove, pobrišemo morebitne obstoječe datoteke
|
||||
$this->deleteOldSnFiles();
|
||||
|
||||
|
||||
#popucamo headers
|
||||
$_headers = $this->getCleanHeader();
|
||||
|
||||
$sn_loop_spremenljivke = $this->sn_loop_spremenljivke;
|
||||
|
||||
# resetiramo array za SN_HEADER
|
||||
$_empty_name_filter = array();
|
||||
$SN_HEADER = array();
|
||||
|
||||
$sequences = array(); # kam shranimo sequence
|
||||
$loop_header_cnt = 0;
|
||||
|
||||
if (count($sn_loop_parent) > 0 ) {
|
||||
foreach ($sn_loop_parent as $lsid => $loop_sequence) {
|
||||
$loop_header_cnt ++;
|
||||
$_new_sequence = 1;
|
||||
|
||||
# poiščemo variable loopa
|
||||
if (isset($sn_loop_spremenljivke[$lpid]) && count($sn_loop_spremenljivke[$lpid]) > 0) {
|
||||
$_loop_cnt = array_shift($sn_loop_spremenljivke[$lpid]);
|
||||
} else {
|
||||
$_loop_cnt = array();
|
||||
}
|
||||
|
||||
$sequences[$lpid.'_'.$lsid] = array();
|
||||
|
||||
# Zloopamo skozi vse spremenljivke in dodamo v primerno skupino
|
||||
if (count($_headers) > 0) {
|
||||
foreach ($_headers as $spr => $spremenljivka) {
|
||||
|
||||
if ($loop_header_cnt === 1 ) {
|
||||
$tmp_spremenljivka = $spremenljivka;
|
||||
}
|
||||
# odvisno ali smo v loopu ali ne dodamo primerne spremnljivke
|
||||
if ((int)$spremenljivka['loop_parent'] > 0 || (int)$spremenljivka['parent_loop_id']) {
|
||||
# ali smo v parent spremenljivki ali v loop spremenljivkah
|
||||
if ((int)$spremenljivka['loop_parent'] > 0 && $lpid == (int)$spremenljivka['loop_parent']){
|
||||
|
||||
$_first_parent_variable = 0;
|
||||
|
||||
#smo v parent splemenljivki, dodamo samo variablo z primerno sekvenco
|
||||
if (count($spremenljivka['grids']) > 0) {
|
||||
foreach($spremenljivka['grids'] AS $gid => $grid) {
|
||||
if (count($grid['variables']) > 0) {
|
||||
foreach($grid['variables'] AS $vid => $variable) {
|
||||
|
||||
if ($variable['sequence'] == $loop_sequence) {
|
||||
#$sequences[$lpid.'_'.$lsid][$spr] = $variable['sequence'];
|
||||
$sequences[$lpid.'_'.$lsid][] = $variable['sequence'];
|
||||
# v sn imenih imamo samo 1 variablo
|
||||
if ($loop_header_cnt === 1 && $_first_parent_variable === 0) {
|
||||
$_empty_name_filter[] = '($'.$_new_sequence .' != -1 && $'.$_new_sequence .' != -2 && $'.$_new_sequence .' != -3 && $'.$_new_sequence .' != -4 && $'.$_new_sequence .' != -5)';
|
||||
$tmp_spremenljivka['grids'][$gid]['variables'][$vid]['sequence'] = $_new_sequence;
|
||||
$tmp_spremenljivka['sequences'] = $_new_sequence;
|
||||
$tmp_spremenljivka['cnt_grids'] = 1;
|
||||
$tmp_spremenljivka['cnt_all'] = 1;
|
||||
$tmp_spremenljivka['grids']['0']['cnt_vars'] = 1;
|
||||
|
||||
$_new_sequence++;
|
||||
$_first_parent_variable ++;
|
||||
|
||||
}
|
||||
}
|
||||
# odstranimo ostale variable
|
||||
if ( $gid == 0 && $vid > 0) {
|
||||
unset($tmp_spremenljivka['grids'][$gid]['variables'][$vid]);
|
||||
} else if ( $gid > 0) {
|
||||
unset($tmp_spremenljivka['grids'][$gid]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# dodamo spremenljivko v nov header
|
||||
if ($loop_header_cnt === 1) {
|
||||
$SN_HEADER[$spr] = $tmp_spremenljivka;
|
||||
}
|
||||
}
|
||||
# ali smo v spremenljivki v loopu
|
||||
if ((int)$spremenljivka['parent_loop_id'] > 0) {
|
||||
$add_this_spr = false;
|
||||
$sequenceses = array();
|
||||
# smo v loop spremenljivkah, dodamo variable s pravo frekvenco
|
||||
if (count($spremenljivka['grids']) > 0) {
|
||||
foreach($spremenljivka['grids'] AS $gid => $grid) {
|
||||
if (count($grid['variables']) > 0) {
|
||||
foreach($grid['variables'] AS $vid => $variable) {
|
||||
if (isset($_loop_cnt[$variable['sequence']])) {
|
||||
$add_this_spr = true;
|
||||
#$sequences[$lpid.'_'.$lsid][$spr] = $variable['sequence'];
|
||||
$sequences[$lpid.'_'.$lsid][] = $variable['sequence'];
|
||||
if ($loop_header_cnt === 1) {
|
||||
$tmp_spremenljivka['grids'][$gid]['variables'][$vid]['sequence'] = $_new_sequence;
|
||||
$sequenceses[] = $_new_sequence;
|
||||
$_new_sequence++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# dodamo spremenljivko v nov header
|
||||
if ($loop_header_cnt === 1 && $add_this_spr == true) {
|
||||
$SN_HEADER[$spr] = $tmp_spremenljivka;
|
||||
$SN_HEADER[$spr]['sequences'] = implode('_',$sequenceses);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (true) {
|
||||
|
||||
# nismo v loopu
|
||||
$sequenceses = array();
|
||||
if (count($spremenljivka['grids']) > 0) {
|
||||
foreach($spremenljivka['grids'] AS $gid => $grid) {
|
||||
if (count($grid['variables']) > 0) {
|
||||
foreach($grid['variables'] AS $vid => $variable) {
|
||||
#$sequences[$lpid.'_'.$lsid][$spr] = $variable['sequence'];
|
||||
$sequences[$lpid.'_'.$lsid][] = $variable['sequence'];
|
||||
if ($loop_header_cnt === 1) {
|
||||
$tmp_spremenljivka['grids'][$gid]['variables'][$vid]['sequence'] = $_new_sequence;
|
||||
$sequenceses[] = $_new_sequence;
|
||||
$_new_sequence++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# dodamo spremenljivko v nov header
|
||||
if ($loop_header_cnt === 1) {
|
||||
$SN_HEADER[$spr] = $tmp_spremenljivka;
|
||||
$SN_HEADER[$spr]['sequences'] = implode('_',$sequenceses);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# zapišemo header za SN datoteko
|
||||
if (is_array($SN_HEADER) && count($SN_HEADER) > 0) {
|
||||
#zapišemo SN header datoteko
|
||||
file_put_contents($_SN_head_file_name, serialize($SN_HEADER));
|
||||
|
||||
}
|
||||
# KREACIJA DATA DATOTEKE
|
||||
# skreiramo fajle z potrebnimi skevencami
|
||||
if (count($sequences) > 0) {
|
||||
$_original_data_file = $this->dataFileName;
|
||||
$_paste_files = '';
|
||||
foreach ($sequences AS $skey => $sequence) {
|
||||
|
||||
if (is_array($sequence) && count($sequence)>0) {
|
||||
$_sequence = implode(",",$sequence);
|
||||
|
||||
if (IS_WINDOWS) {
|
||||
$cmdLn1 = 'cut -d "|" -f '.$_sequence.' '.$_original_data_file.' > '.$this->folder.'export_sn_data_'.$this->surveyId.'_'.$lpid.'_'.$skey.'.dat';
|
||||
} else {
|
||||
$cmdLn1 = 'cut -d \'|\' -f '.$_sequence.' '.$_original_data_file.' > '.$this->folder.'export_sn_data_'.$this->surveyId.'_'.$lpid.'_'.$skey.'.dat';
|
||||
}
|
||||
$out1 = shell_exec($cmdLn1);
|
||||
$_paste_files .= $this->folder.'export_sn_data_'.$this->surveyId.'_'.$lpid.'_'.$skey.'.dat ';
|
||||
}
|
||||
}
|
||||
# združimo datoteke v eno
|
||||
$_orig_date = explode("_",$_original_data_file);
|
||||
$_orig_date = explode(".",$_orig_date[3]);
|
||||
|
||||
#$_merged_file_name = $this->folder.'export_sn_data_'.$this->surveyId.'_'.$_orig_date[0].'.dat';
|
||||
$_merged_file_name = $_sn_filename;
|
||||
$tmp_merged_file_name = $this->folder.'tmp_export_sn_data_'.$this->surveyId.'_'.$lpid.'_'.$_orig_date[0].'.dat';
|
||||
if (IS_WINDOWS) {
|
||||
$cmdLn2 = 'paste -d "\n" '.$_paste_files .'> '.$tmp_merged_file_name;
|
||||
} else {
|
||||
$cmdLn2 = 'paste -d \'\n\' '.$_paste_files. '>' .$tmp_merged_file_name;
|
||||
}
|
||||
$out2 = shell_exec($cmdLn2);
|
||||
|
||||
# pripravimo filtre, za data datoteko, da odstranimo zapise ki nimajo imen ( če je nekdo dodal samo 2 imena nekdo pa 5)
|
||||
$_empty_name_filter = implode(' && ',$_empty_name_filter);
|
||||
|
||||
# sfiltriramo zapise ki nimajo imen
|
||||
if (IS_WINDOWS) {
|
||||
$cmdLn3 = 'awk -F"'.STR_DLMT.'" "BEGIN {OFS=\"\x7C\"} '.$_empty_name_filter.' { print $0 }" ' . $tmp_merged_file_name .' > ' . $_merged_file_name;
|
||||
} else {
|
||||
$cmdLn3 = 'awk -F"'.STR_DLMT.'" \'BEGIN {OFS="\x7C"} '.$_empty_name_filter.' { print $0 }\' ' . $tmp_merged_file_name . ' > ' . $_merged_file_name;
|
||||
}
|
||||
$out3 = shell_exec($cmdLn3);
|
||||
|
||||
# pobrišemo odvečne datoteke
|
||||
foreach (explode(" ",$_paste_files) as $filename_to_delete) {
|
||||
if (trim($filename_to_delete) != '') {
|
||||
$this->SDF->deleteFile($filename_to_delete);
|
||||
}
|
||||
}
|
||||
if (trim($tmp_merged_file_name) != '') {
|
||||
$this->SDF->deleteFile($tmp_merged_file_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function displayFullTableCheckbox() {
|
||||
global $lang;
|
||||
session_start();
|
||||
echo '<label><input id="snCreateFullTable" name="snCreateFullTable" onclick="setSnDisplayFullTableCheckbox();" type="checkbox"'.($this->snCreateFullTable==true?' checked="checked"':'').'>Prikaži razširjeno tabelo</label>';
|
||||
}
|
||||
|
||||
|
||||
function outputSNDataFile() {
|
||||
global $lang;
|
||||
$this->countLoops();
|
||||
|
||||
# forsamo novo kreiranje! malo slaba rešitev - mogoče dodat enako kontrolao na zadnjega userja v SN fajlih
|
||||
$this->deleteOldSnFiles();
|
||||
|
||||
$_original_head_file = $this->headFileName;
|
||||
$_original_data_file = $this->dataFileName;
|
||||
|
||||
# timestam head datoteke
|
||||
$_orig_date_h = explode("_",$_original_head_file);
|
||||
$_orig_date_h = explode(".",$_orig_date_h[3]);
|
||||
# združimo datoteke v eno
|
||||
$_orig_date_d = explode("_",$_original_data_file);
|
||||
$_orig_date_d = explode(".",$_orig_date_d[3]);
|
||||
|
||||
|
||||
$this-> displayFullTableCheckbox();
|
||||
|
||||
# Tukaj začnemo loopat po glavnih loopih in nardimo ločene tabele za vsak loop
|
||||
|
||||
# zloopamo tolikokrat koliko imamo variabel za loop ( v loop_parent)
|
||||
if (count($this->sn_loop_parents) > 0) {
|
||||
foreach ($this->sn_loop_parents as $lpid => $sn_loop_parent) {
|
||||
|
||||
# head ime datoteke za loop
|
||||
$_SN_head_file_name = $this->folder.'export_sn_header_'.$this->surveyId.'_'.$lpid.'_'.$_orig_date_h[0].'.dat';
|
||||
# data ime datoteke za loop
|
||||
$_sn_filename = $this->folder.'export_sn_data_'.$this->surveyId.'_'.$lpid.'_'.$_orig_date_d[0].'.dat';
|
||||
# začasno ime datoteke za loop
|
||||
$_sn_tmp1 = $this->folder.'tmp_1_export_sn_data_'.$this->surveyId.'_'.$lpid.'_'.$_orig_date_d[0].'.dat';
|
||||
# če SN header in SN data datoteka obstaja
|
||||
if (!file_exists($_SN_head_file_name) || !file_exists($_sn_filename)) {
|
||||
$this->createSNDataFile($lpid, $sn_loop_parent,$_SN_head_file_name,$_sn_filename);
|
||||
}
|
||||
|
||||
# če SN header in SN data datoteka obstaja
|
||||
if (file_exists($_SN_head_file_name) && file_exists($_sn_filename)) {
|
||||
|
||||
# naložimo header
|
||||
$SN_HEADER = unserialize(file_get_contents($_SN_head_file_name));
|
||||
echo '<div id="tableContainer" class="tableContainer">';
|
||||
echo '<h3>'.$lang['srv_loop_for_variable'].' <b>['. $this->sn_loop_data[$lpid]['variable']. '] - '. $this->sn_loop_data[$lpid]['naslov']. '</b> ('.$lang['srv_loop_antonucci_circle'].' '.$this->sn_loop_data[$lpid]['antonucci'].')</h3>';
|
||||
echo '<table id="dataTable" border="0" cellpadding="0" cellspacing="0" width="100%" class="scrollTable no_wrap_td social_network">';
|
||||
echo '<thead class="fixedHeader">';
|
||||
echo '<tr>';
|
||||
|
||||
# dodamo skrit stolpec uid
|
||||
echo '<th class="data_uid"> </th>';
|
||||
|
||||
$spr_cont = 0;
|
||||
foreach ($SN_HEADER AS $spid => $spremenljivka) {
|
||||
# if (isset(self::$_SVP_PV[$spid]) ) {
|
||||
## paginacija spremenljivk
|
||||
# if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) {
|
||||
if ($spr_cont > 0 && $spid != 'uid') {
|
||||
echo '<th colspan="'.$spremenljivka['cnt_all'].'" title="'.$spremenljivka['naslov'].'">';
|
||||
echo '<div class="headerCell">'.$spremenljivka['naslov'].'</div>';
|
||||
echo '</th>';
|
||||
#}
|
||||
}
|
||||
$spr_cont++;
|
||||
#}
|
||||
} #end foreach $SN_HEADER AS $spid => $spremenljivka
|
||||
# nova vrstica
|
||||
echo '</tr><tr>';
|
||||
|
||||
# dodamo skrit stolpec uid
|
||||
echo '<th class="data_uid"> </th>';
|
||||
|
||||
$spr_cont = 0;
|
||||
foreach ($SN_HEADER AS $spid => $spremenljivka) {
|
||||
if ($spr_cont > 0 && $spid != 'uid') {
|
||||
# if (isset(self::$_SVP_PV[$spid]) && (count($spremenljivka['grids']) > 0 )) {
|
||||
## paginacija spremenljivk
|
||||
# if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) {
|
||||
if (count($spremenljivka['grids']) > 0) {
|
||||
foreach ($spremenljivka['grids'] AS $gid => $grid) {
|
||||
echo '<th colspan="'.$grid['cnt_vars'].'" title="'.$grid['naslov'].'">';
|
||||
echo '<div class="headerCell">'.$grid['naslov'].'</div>';
|
||||
echo '</th>';
|
||||
}
|
||||
}
|
||||
#}
|
||||
}
|
||||
$spr_cont++;
|
||||
#}
|
||||
}
|
||||
|
||||
# nova vrstica
|
||||
echo '</tr><tr>';
|
||||
|
||||
## dodamo skrit stolpec uid
|
||||
echo '<th class="data_uid"> </th>';
|
||||
|
||||
$spr_cont = 0;
|
||||
foreach ($SN_HEADER AS $spid => $spremenljivka) {
|
||||
if ($spr_cont > 0 && $spid != 'uid') {
|
||||
# if (isset(self::$_SVP_PV[$spid]) && count($spremenljivka['grids']) > 0) {
|
||||
## paginacija spremenljivk
|
||||
# if (self::$_VARS['spr_limit'] == 'all' || ($spr_cont >= $_spr_on_pages_start && $spr_cont < $_spr_on_pages_stop)) {
|
||||
if (count($spremenljivka['grids']) > 0){
|
||||
foreach ($spremenljivka['grids'] AS $gid => $grid) {
|
||||
if (count ($grid['variables']) > 0) {
|
||||
foreach ($grid['variables'] AS $vid => $variable ){
|
||||
echo '<th title="'.$variable['naslov'].($variable['other'] ? ' (text)' : '').'">';
|
||||
echo '<div class="dataCell">'.$variable['naslov'];
|
||||
if ($variable['other'] == 1) {
|
||||
echo ' (text)';
|
||||
}
|
||||
/*// urejanje kalkulacije -- izracunane vrednosti v podatkih
|
||||
if ($spremenljivka['tip'] == 22) {
|
||||
echo ' <a href="" onclick="calculation_editing(\'-'.substr($spid, 0, strpos($spid, '_')).'\'); return false;">('.$lang['edit3'].')</a>';
|
||||
}*/
|
||||
echo '</div>';
|
||||
|
||||
echo '</th>';
|
||||
}
|
||||
}
|
||||
} # end foreach
|
||||
} #end if
|
||||
# }
|
||||
}
|
||||
$spr_cont++;
|
||||
#}
|
||||
}
|
||||
echo'</tr>';
|
||||
echo '</thead>';
|
||||
echo '</div>';
|
||||
|
||||
# dodamo podatke
|
||||
if (file_exists($_sn_filename)) {
|
||||
|
||||
// zamenjamo | z </td><td>
|
||||
if (IS_WINDOWS) {
|
||||
$cmdLn3 = 'sed "s*'.STR_DLMT.'*</td><td>*g" '.$_sn_filename.' > '.$_sn_tmp1;
|
||||
} else {
|
||||
$cmdLn3 = 'sed \'s*'.STR_DLMT.'*</td><td>*g\' '.$_sn_filename.' > '.$_sn_tmp1;
|
||||
}
|
||||
$out3 = shell_exec($cmdLn3);
|
||||
|
||||
echo '<tbody class="scrollContent">';
|
||||
$file_handler = fopen ($_sn_tmp1, 'r');
|
||||
while ($line= fgets ($file_handler)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="data_uid">'.$line.'</td></tr>';
|
||||
}
|
||||
echo '</tbody>';
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
if ($file_handler) {
|
||||
fclose($file_handler);
|
||||
}
|
||||
|
||||
# pobrišemo tmp falj
|
||||
if (trim($_sn_tmp1) != '') {
|
||||
$this->SDF->deleteFile($_sn_tmp1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/** Pobriše morebitne stare SN daoteke
|
||||
*
|
||||
*/
|
||||
function deleteOldSnFiles() {
|
||||
if ($this->surveyId > 0) {
|
||||
|
||||
# odstranimo morebitne SN datoteke - header
|
||||
$files = glob($this->folder.'export_sn_header_'.$this->surveyId.'_*.dat');
|
||||
if(count($files ) > 0) {
|
||||
foreach ($files AS $file) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
# odstranimo morebitne SN datoteke - data
|
||||
$files = glob($this->folder.'export_sn_data_'.$this->surveyId.'_*.dat');
|
||||
if(count($files ) > 0) {
|
||||
foreach ($files AS $file) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Tukaj pripravimo redosled in prikaz glavnih spremenljivk
|
||||
*
|
||||
*/
|
||||
function getCleanHeader() {
|
||||
# poiščemo skevence za vse variable loopa
|
||||
$header = $this -> _HEADERS;
|
||||
$cleanHeader = array();
|
||||
if (count($header) > 0) {
|
||||
foreach ($header AS $spr_id => $spremenljivka) {
|
||||
|
||||
if ($this->_VARS[VAR_DATA] == '1') {
|
||||
$add_data = true;
|
||||
} else {
|
||||
$add_data = false;
|
||||
}
|
||||
|
||||
# preverimo ali delamo kompleksno tabelo al samo simpl
|
||||
if ($this->snCreateFullTable == false) {
|
||||
$add_data = $add_data && ((int)$spremenljivka['loop_parent'] > 0 || (int)$spremenljivka['parent_loop_id'] > 0);
|
||||
}
|
||||
if ( $spremenljivka['tip'] == 'm' || $spremenljivka['tip'] == 'sm') {
|
||||
$add_data = false;
|
||||
switch ($spremenljivka['variable']) {
|
||||
case 'uid':
|
||||
case 'recnum':
|
||||
$add_data = true;
|
||||
break;
|
||||
case 'code':
|
||||
# ce prikazujemo sistemske ne prikazujemo recnumber
|
||||
if (!$this->_VARS[VAR_SHOW_SYSTEM] && $this->_VARS[VAR_META] && $this->_VARS[VAR_METAFULL]) {
|
||||
$add_data = true;
|
||||
}
|
||||
break;
|
||||
case 'status':
|
||||
case 'lurker':
|
||||
if ($this->_VARS[VAR_META] && $this->_VARS[VAR_METAFULL]) {
|
||||
$add_data = true;
|
||||
}
|
||||
break;
|
||||
case 'relevance':
|
||||
if ($this->_VARS[VAR_RELEVANCE] && $this->canDisplayRelevance) {
|
||||
$add_data = true;
|
||||
}
|
||||
break;
|
||||
case 'invitation':
|
||||
if ($this->_VARS[VAR_EMAIL]) {
|
||||
$add_data = true;
|
||||
}
|
||||
break;
|
||||
case 'testdata':
|
||||
$header = $this->SDF->getHeader();
|
||||
if (isset($header['testdata'])) {
|
||||
$add_data = true;
|
||||
}
|
||||
break;
|
||||
case 'smeta':
|
||||
case 'meta':
|
||||
if ($this->_VARS[VAR_METAFULL]) {
|
||||
$add_data = true;
|
||||
}
|
||||
break;
|
||||
case 'itime':
|
||||
if ($this->showItime == true) {
|
||||
$add_data = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($spremenljivka['hide_system'] == '1') {
|
||||
$add_data = false;
|
||||
}
|
||||
if ($add_data == true ) {
|
||||
$cleanHeader[$spr_id] = $spremenljivka;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $cleanHeader;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
class SurveyTrackIncremental {
|
||||
|
||||
static public function write($anketa, $msg) {
|
||||
if(!empty($msg)){
|
||||
$date = date("Y-m-d h:m:s");
|
||||
|
||||
$s = sisplet_query("INSERT INTO srv_tracking_incremental (anketa, datetime, message) "
|
||||
." VALUES ('$anketa', NOW(), '$msg')");
|
||||
if (!$s) echo mysqli_error($GLOBALS['connect_db']);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
ob_start();
|
||||
|
||||
header('Cache-Control: no-cache');
|
||||
header('Pragma: no-cache');
|
||||
|
||||
include_once($_SERVER['DOCUMENT_ROOT'].'/function.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'].'/admin/survey/definition.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php');
|
||||
|
||||
|
||||
$action = $_GET['action'];
|
||||
$anketa = (int)$_GET['anketa'];
|
||||
|
||||
if($action == 'doIncremental' && (int)$anketa > 0) {
|
||||
# pokličemo inkrementalno dodajanje za anketo
|
||||
$CID = new CollectIncrementalData($anketa);
|
||||
}
|
||||
|
||||
print_r($_POST);
|
||||
print_r($_GET);
|
||||
|
||||
ob_flush();
|
@ -1,110 +0,0 @@
|
||||
<?php
|
||||
|
||||
// nov, poenoten nacin progress bara
|
||||
if (isset($_GET['getProgress']) && $_GET['getProgress'] == 'true') {
|
||||
|
||||
$anketa = $_REQUEST['anketa'];
|
||||
|
||||
$return = array();
|
||||
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION['progressBar'][$anketa])) {
|
||||
|
||||
$return['status'] = $_SESSION['progressBar'][$anketa]['status'];
|
||||
$return['total'] = $_SESSION['progressBar'][$anketa]['total'];
|
||||
$return['current'] = $_SESSION['progressBar'][$anketa]['current'];
|
||||
|
||||
if ($_SESSION['progressBar'][$anketa]['status'] == 'end') {
|
||||
unset($_SESSION['progressBar'][$anketa]);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$return['status'] = 'null';
|
||||
|
||||
}
|
||||
|
||||
session_commit();
|
||||
|
||||
echo json_encode($return);
|
||||
|
||||
// star nacin progresbara v podatkih in analizah
|
||||
} else {
|
||||
# izrisujemo progress bar z ajax-om
|
||||
if (isset($_GET['ajaxTimer']) && $_GET['ajaxTimer'] == 'true') {
|
||||
/*
|
||||
$actions = array(
|
||||
1=>'Inicializacija...',
|
||||
2=>'Obdelujem datoteke s strukturo...',
|
||||
3=>'Obdelujem datoteke s podatki...',
|
||||
9=>'Končano...',
|
||||
-1=>'Napaka...',
|
||||
);
|
||||
*/
|
||||
session_start();
|
||||
#time
|
||||
$return['t'] = ($_SESSION['PMD']['start_time'] != null && (strtotime("now") - $_SESSION['PMD']['start_time']) > 0 )
|
||||
? date('i:s', (strtotime("now") - $_SESSION['PMD']['start_time']))
|
||||
: '00:00' ;
|
||||
#id
|
||||
$return['id'] = $_SESSION['PMD']['actID'];
|
||||
# skupni procenti
|
||||
$return['pa'] = ($_SESSION['PMD']['all'] == 0)
|
||||
? number_format(100, 0, '', '')
|
||||
: number_format((($_SESSION['PMD']['current'] / $_SESSION['PMD']['all']) * 100), 0, '', '');
|
||||
# procenti headerja
|
||||
if ($_SESSION['PMD']['actID'] == 2) {
|
||||
$return['ph'] = ($_SESSION['PMD']['allHead'] == 0 || $_SESSION['PMD']['current'] >= $_SESSION['PMD']['allHead'])
|
||||
? number_format(100, 0, '', '')
|
||||
: number_format((($_SESSION['PMD']['current'] / $_SESSION['PMD']['allHead']) * 100), 0, '', '');
|
||||
# trenutni zapis
|
||||
$return['nr'] = $_SESSION['PMD']['nrRow'];
|
||||
$return['cr'] = $_SESSION['PMD']['current'] .'/'. $_SESSION['PMD']['allHead'];
|
||||
}
|
||||
if ($_SESSION['PMD']['actID'] == 3) {
|
||||
$curent_data = $_SESSION['PMD']['current']-$_SESSION['PMD']['allHead'] < 0 ? 0 : $_SESSION['PMD']['current']-$_SESSION['PMD']['allHead'];
|
||||
# procenti data
|
||||
$return['pd'] = ($_SESSION['PMD']['all'] == 0)
|
||||
? number_format(100, 0, '', '')
|
||||
: number_format((($_SESSION['PMD']['all'] > 0) ? ( $curent_data / $_SESSION['PMD']['all']) * 100 : 100), 0, '', '');
|
||||
$return['cd'] = $curent_data .' / ' .$_SESSION['PMD']['all'];
|
||||
}
|
||||
# procent trenutnega zapisa
|
||||
if ($_SESSION['PMD']['actID'] == 3) {
|
||||
# prikazuejemo samo za status 3
|
||||
$return['pr'] = number_format($_SESSION['PMD']['percentRow'], 0, '', ''); # procent trenutnega zapisa
|
||||
$return['nr'] = $_SESSION['PMD']['nrRow']; # trenutni zapis
|
||||
|
||||
}
|
||||
echo json_encode($return);
|
||||
|
||||
} else { # star način za podatke
|
||||
|
||||
define('EXPORT_FOLDER', 'tmp', true);
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/function.php');
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/admin/survey/definition.php';
|
||||
|
||||
$folder = $site_path . EXPORT_FOLDER.'/';
|
||||
|
||||
$anketa = $_POST['anketa'];
|
||||
|
||||
$_qry_all = sisplet_query('SELECT count(*) FROM srv_user AS u WHERE u.ank_id = \''.$anketa.'\'');
|
||||
$_allCount = mysqli_fetch_row($_qry_all);
|
||||
$allCount = $_allCount[0];
|
||||
|
||||
$str_qry_users = 'SELECT IF(UNIX_TIMESTAMP(MAX(time_edit)) = 0,UNIX_TIMESTAMP(MAX(time_insert)),UNIX_TIMESTAMP(MAX(time_edit))) AS DATE FROM srv_user WHERE ank_id = \''.$anketa.'\'';
|
||||
$qry_users = sisplet_query($str_qry_users) or die(mysqli_error($GLOBALS['connect_db']));
|
||||
if (mysqli_num_rows($qry_users)) {
|
||||
$row_users = mysqli_fetch_row($qry_users);
|
||||
$timestamp = $row_users[0];
|
||||
}
|
||||
$_dataFileName = $folder.'export_data_'.$anketa.'_'.$timestamp.'.dat';
|
||||
|
||||
#preberemo št vrstic v fajlu
|
||||
$recCount = exec('wc -l '.$_dataFileName)+1;
|
||||
echo '<div class="anl_red_ba body_anketa anl_ac"><br/>Obdelujemo zapis '.(int)$recCount.' od '.(int)$allCount.'!<br/><br/></div>';
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
# statusi
|
||||
# 0 : končano
|
||||
# 1 : teče inkrementalno kreiranje
|
||||
|
||||
$anketa = $_REQUEST['anketa'];
|
||||
$return = array();
|
||||
if (isset($_SESSION['incrementalProgressBar'][$anketa])) {
|
||||
$return = $_SESSION['incrementalProgressBar'][$anketa];
|
||||
} else {
|
||||
$return['status'] = -1;
|
||||
}
|
||||
|
||||
session_commit();
|
||||
|
||||
echo json_encode($return);
|
||||
?>
|
@ -1,101 +0,0 @@
|
||||
<?php
|
||||
|
||||
ob_start();
|
||||
session_start();
|
||||
set_time_limit(2400); # 30 minut
|
||||
|
||||
header('Cache-Control: no-cache');
|
||||
header('Pragma: no-cache');
|
||||
|
||||
# očitno ta klic ne deluje vredu
|
||||
include_once($_SERVER['DOCUMENT_ROOT'].'/function.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'].'/admin/survey/definition.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php');
|
||||
|
||||
$anketa = (int)$_REQUEST['anketa'];
|
||||
|
||||
if ($_GET['action'] == 'createSingle') {
|
||||
if ($anketa > 0) {
|
||||
|
||||
session_start();
|
||||
|
||||
// nastavimo jezik
|
||||
$lang_admin = (isset($_REQUEST['lang_admin'])) ? $_REQUEST['lang_admin'] : 1;
|
||||
$file = $site_path.'/lang/'.$lang_admin.'.php';
|
||||
include($file);
|
||||
|
||||
unset($_SESSION['incrementalProgressBar'][$anketa]);
|
||||
list($usec, $sec) = explode(" ", microtime());
|
||||
# če
|
||||
if ($_SESSION['incrementalProgressBar'][$anketa]['status'] != 1
|
||||
# ali smo začeli pred 30 min ali več, potem dovolimo ponoven start
|
||||
# || ($_SESSION['incrementalProgressBar'][$anketa]['status'] == 1
|
||||
# && isset($_SESSION['incrementalProgressBar'][$anketa]['started'])
|
||||
# && ($sec - (int)$_SESSION['incrementalProgressBar'][$anketa]['started']) > 1800
|
||||
# )
|
||||
|
||||
){
|
||||
SurveyTrackIncremental::write($anketa,'Progress bar -> Ajax started for survey: '.$anketa);
|
||||
# pobrišemo staro sejo
|
||||
unset($_SESSION['incrementalProgressBar'][$anketa]);
|
||||
|
||||
# nastavimo čas kdaj smo startali
|
||||
$_SESSION['incrementalProgressBar'][$anketa]['started'] = $sec;
|
||||
# nastavimo status da smo štartali
|
||||
$_SESSION['incrementalProgressBar'][$anketa]['status'] = 1;
|
||||
$_SESSION['incrementalProgressBar'][$anketa]['current'] = 0;
|
||||
session_commit();
|
||||
|
||||
// Get the start time in microseconds, as a float value
|
||||
$starttime = microtime(true);
|
||||
|
||||
$lock = new ExclusiveLock( "survey_lock_".$anketa, FALSE);
|
||||
if( $lock->lock( ) == FALSE ) {
|
||||
SurveyTrackIncremental::write($anketa,'LOCK: alreadyLocked for survey: '.$anketa);
|
||||
#error("Locking failed");
|
||||
} else {
|
||||
|
||||
# pozenemo generiranje datoteke
|
||||
$CID = new CollectIncrementalData($anketa);
|
||||
$CH = (int)$CID->createHeadFile();
|
||||
// Get the difference between start and end in microseconds, as a float value
|
||||
$diff = microtime(true) - $starttime;
|
||||
|
||||
// Break the difference into seconds and microseconds
|
||||
$sec = intval($diff);
|
||||
$micro = $diff - $sec;
|
||||
|
||||
// Format the result as you want it
|
||||
// $final will contain something like "00:00:02.452"
|
||||
$final = strftime('%T', mktime(0, 0, $sec)) . str_replace('0.', '.', sprintf('%.3f', $micro));
|
||||
echo '<hr>1:'.$final;
|
||||
$CD = (int)$CID->createDataFile();
|
||||
|
||||
}
|
||||
$lock->unlock();
|
||||
// Get the difference between start and end in microseconds, as a float value
|
||||
$diff = microtime(true) - $starttime;
|
||||
// Break the difference into seconds and microseconds
|
||||
$sec = intval($diff);
|
||||
$micro = $diff - $sec;
|
||||
|
||||
// Format the result as you want it
|
||||
// $final will contain something like "00:00:02.452"
|
||||
$final = strftime('%T', mktime(0, 0, $sec)) . str_replace('0.', '.', sprintf('%.3f', $micro));
|
||||
echo '<hr>2:'.$final;
|
||||
} else {
|
||||
SurveyTrackIncremental::write($anketa,'Progress bar -> Ajax skiped for survey: '.$anketa);
|
||||
}
|
||||
}
|
||||
|
||||
} else if ($_GET['action'] == 'clear') {
|
||||
if ($anketa > 0) {
|
||||
session_start();
|
||||
unset($_SESSION['incrementalProgressBar'][$anketa]);
|
||||
session_commit();
|
||||
}
|
||||
}
|
||||
|
||||
ob_flush();
|
||||
|
||||
?>
|
@ -6504,6 +6504,7 @@ $lang = array (
|
||||
'srv_export_hover_comments' => 'Dodaj komentarje',
|
||||
'srv_data_settings_checkboxes' => 'Nastavitve prikaza podatkov',
|
||||
'srv_data_settings_checkboxes2' => 'Zapri nastavitve prikaza podatkov',
|
||||
'srv_data_settings_identifier_notice' => 'Respondenti z identifikatorji so prikazani v naključnem vrstnem redu (ki je različen od vrstnega reda v prikazu podatkov).',
|
||||
'srv_status_settings' => 'Nastavitve statusov',
|
||||
'srv_spremenljivke_settings' => 'Nastavitve spremenljivk',
|
||||
'srv_condition_settings' => 'Nastavitve pogojev',
|
||||
|
@ -6386,7 +6386,8 @@ $lang = array (
|
||||
'srv_export_hover_public2' => 'Public link to data',
|
||||
'srv_export_hover_comments' => 'Add comments',
|
||||
'srv_data_settings_checkboxes' => 'Data table settings',
|
||||
'srv_data_settings_checkboxes2' => 'Close data table settings',
|
||||
'srv_data_settings_checkboxes2' => 'Close data table settings',
|
||||
'srv_data_settings_identifier_notice' => 'Respondents with identifiers are displayed in a random order (which is different from the order in the data display).',
|
||||
'srv_status_settings' => 'Status settings',
|
||||
'srv_spremenljivke_settings' => 'Variable settings',
|
||||
'srv_condition_settings' => 'Condition settings',
|
||||
|
Loading…
x
Reference in New Issue
Block a user