0){
$this->anketa = $anketa;
}
}
// Izvozimo ustrezno tabelo v csv
public function exportTable($table_name='srv_advanced_paradata_page'){
global $site_path;
ini_set('memory_limit', '4048M');
// Dobimo naslove stolpcev
$header = $this->getHeader($table_name);
// Pripravimo datoteko za izvoz
$file = $site_path.'admin/survey/modules/mod_advanced_paradata/temp/'.$table_name.'_'.$this->anketa.'.csv';
$fd = fopen($file, "w");
$convertTypes = array('charSet' => 'windows-1250',
'delimit' => ',',
'newLine' => "\n",
'BOMchar' => "\xEF\xBB\xBF");
# dodamo boomchar za utf-8
fwrite($fd, $convertTypes['BOMchar']);
// Zapisemo header row
$header_line = '';
foreach($header as $col){
$header_line .= $col.',';
}
$header_line = substr($header_line, 0, -1);
fwrite($fd, $header_line."\r\n");
// Zapisemo vsako vrstico posebej
// Dobimo vrstice s podatki
switch($table_name){
case 'srv_advanced_paradata_question':
$data = $this->writeQuestionParadata($fd, $header);
break;
case 'srv_advanced_paradata_vrednost':
$data = $this->writeVrednostParadata($fd, $header);
break;
case 'srv_advanced_paradata_other':
$data = $this->writeOtherParadata($fd, $header);
break;
case 'srv_advanced_paradata_movement':
$data = $this->writeMovementParadata($fd, $header);
break;
case 'srv_advanced_paradata_alert':
$data = $this->writeAlertParadata($fd, $header);
break;
default:
$data = $this->writePageParadata($fd, $header);
break;
}
fclose($fd);
// Pripravimo file za download
if(file_exists($file)){
header('Content-Description: File Transfer');
//header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename(''.$table_name.'_'.$this->anketa.'.csv'.''));
header("Content-type: text/x-csv; charset=utf-8");
//header("Content-type: text/csv");
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
}
// Na koncu pobrisemo zacasne datoteke
if (file_exists($file)) {
unlink($file);
}
// Ugasnemo skripto:)
die();
}
// Izpisemo tabelo parapodatkov vezanih na strani
public function displayPageTable(){
global $lang;
$data = $this->getPageParadata();
echo '
';
echo '';
echo 'ID | ';
echo 'User ID | ';
echo 'Page ID | ';
echo 'Recnum | ';
echo 'Load time | ';
echo 'Post time | ';
echo 'User Agent | ';
echo 'Device pixel ratio | ';
echo 'width x height | ';
echo 'availWidth x availHeight | ';
echo 'jQuery windowWidth x windowHeight | ';
echo 'jQuery documentWidth x documentHeight | ';
echo 'Language | ';
echo '
';
foreach($data as $row){
echo '';
echo ''.$row['id'].' | ';
echo ''.$row['usr_id'].' | ';
echo ''.$row['gru_id'].' | ';
echo ''.$row['recnum'].' | ';
echo ''.$row['load_time'].' | ';
echo ''.$row['post_time'].' | ';
echo ''.$row['user_agent'].' | ';
echo ''.$row['devicePixelRatio'].' | ';
echo ''.$row['width'].'px X '.$row['height'].'px | ';
echo ''.$row['availWidth'].'px X '.$row['availHeight'].'px | ';
echo ''.$row['jquery_windowW'].'px X '.$row['jquery_windowH'].'px | ';
echo ''.$row['jquery_documentW'].'px X '.$row['jquery_documentH'].'px | ';
echo ''.$row['language'].' | ';
echo '
';
}
echo '
';
}
// Izpisemo tabelo parapodatkov vezanih na vprasanja
public function displayQuestionTable(){
$data = $this->getQuestionParadata();
echo '