summaryrefslogtreecommitdiffstats
path: root/admin/survey/public.php
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-05-27 13:08:29 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2024-05-27 13:08:29 +0200
commit75160b12821f7f4299cce7f0b69c83c1502ae071 (patch)
tree27e25e4ccaef45f0c58b22831164050d1af1d4db /admin/survey/public.php
parentprvi-commit (diff)
download1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.gz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.bz2
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.lz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.xz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.zst
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.zip
Diffstat (limited to 'admin/survey/public.php')
-rw-r--r--admin/survey/public.php112
1 files changed, 66 insertions, 46 deletions
diff --git a/admin/survey/public.php b/admin/survey/public.php
index 9db2e6e..06aced8 100644
--- a/admin/survey/public.php
+++ b/admin/survey/public.php
@@ -1,16 +1,15 @@
<?php
+
/** Za hendlanje "javnih" povezav do podatkov...
*
*/
+
ob_start();
header('Cache-Control: no-cache');
header('Pragma: no-cache');
include_once 'definition.php';
-
include_once '../../function.php';
-
-
include_once('../../vendor/autoload.php');
@@ -66,42 +65,58 @@ if ((int)$anketa > 0){
$hashUrl = new HashUrl($anketa);
if ($hashUrl->hashExists($hash)) {
- $properties = $hashUrl -> getProperties($hash);
- $anketa = $properties['anketa'];
+ $properties = $hashUrl -> getProperties($hash);
+ $anketa = $properties['anketa'];
- //refresh every 15s if set
- if($hashUrl -> IsHashRefresh($hash)){
- header('Refresh: 15; URL="'.$site_url.'podatki/'.$anketa.'/'.$hash.'/' );
- }
+ //refresh every 15s if set
+ if($hashUrl -> IsHashRefresh($hash)){
+ header('Refresh: 15; URL="'.$site_url.'podatki/'.$anketa.'/'.$hash.'/' );
+ }
+
+ //check if access password is set and set session values
+ if($hashUrl -> IsHashAccessPass($hash)){
+ session_start();
+ $hashUrl -> checkHashlinkAccessSessionValues($hash);
+ }
+
+ //access password not needed or access already granted
+ if(!$hashUrl -> IsHashAccessPass($hash) || ($hashUrl -> IsHashAccessPass($hash) && isset($_SESSION['hashlink_access'][$hash]) && $_SESSION['hashlink_access'][$hash] == '1')){
- //check if access password is set and set session values
- if($hashUrl -> IsHashAccessPass($hash)){
- session_start();
- $hashUrl -> checkHashlinkAccessSessionValues($hash);
+ if (isset($properties['a'])) {
+ $_GET['a'] = $properties['a'];
}
-
- //access password not needed or access already granted
- if(!$hashUrl -> IsHashAccessPass($hash) || ($hashUrl -> IsHashAccessPass($hash) && isset($_SESSION['hashlink_access'][$hash]) && $_SESSION['hashlink_access'][$hash] == '1')){
- if (isset($properties['a'])) {
- $_GET['a'] = $properties['a'];
- }
- $action = $properties['a'];
- if (isset($properties['m'])) {
- $_GET['m'] = $properties['m'];
+ $action = $properties['a'];
+ if (isset($properties['m'])) {
+ $_GET['m'] = $properties['m'];
- if ($_GET['m'] == M_ANALYSIS_CHARTS) {
- $action = M_ANALYSIS_CHARTS;
- }
+ if ($_GET['m'] == M_ANALYSIS_CHARTS) {
+ $action = M_ANALYSIS_CHARTS;
+ }
- if ($_GET['m'] == M_ANALYSIS_CREPORT) {
- $action = M_ANALYSIS_CREPORT;
- }
+ if ($_GET['m'] == M_ANALYSIS_CREPORT) {
+ $action = M_ANALYSIS_CREPORT;
}
+ }
- $podstran = $properties['m'];
+ $podstran = $properties['m'];
- switch ($action) {
+
+ // Preverimo, ce imamo podatke
+ $SDF = SurveyDataFile::get_instance();
+ $SDF->init($anketa);
+ $SDF->prepareFiles();
+ $dataFileStatus = $SDF->getStatus();
+
+ // Opozorilo, da se ni podatkov
+ if ( $dataFileStatus == FILE_STATUS_NO_DATA || $dataFileStatus == FILE_STATUS_SRV_DELETED) {
+ Common::Init($anketa);
+ Common::noDataAlertPublic($action);
+ die();
+ }
+
+
+ switch ($action) {
case 'data':
$sd = new SurveyDataDisplay($anketa);
$sd::displayPublicData($properties);
@@ -114,29 +129,34 @@ if ((int)$anketa > 0){
$sc::displayPublicChart($properties);
break;
- case M_ANALYSIS_CREPORT:
+ case M_ANALYSIS_CREPORT:
$scr = new SurveyCustomReport($anketa);
$scr->setUpIsForPublic(true);
$scr->displayPublicCReport($properties);
break;
- case 'analysis':
- $sda = new SurveyAnalysis();
- $sda::Init($anketa);
- $sda::$publicAnalyse = true;
- $sda::displayPublicAnalysis($properties);
- break;
-
- default:
- echo 'Error!';
- break;
- }
- }
- //access password needed
- else {
- $hashUrl -> HashlinkAccessPasswordForm($hash);
+ case 'analysis':
+ $sda = new SurveyAnalysis();
+ $sda::Init($anketa);
+ $sda::$publicAnalyse = true;
+ $sda::displayPublicAnalysis($properties);
+ break;
+
+ case 'data_nijz':
+ $nijz = new SurveyNIJZPublic($anketa);
+ $nijz->displayPublicData();
+ break;
+
+ default:
+ echo 'Error!';
+ break;
}
}
+ //access password needed
+ else {
+ $hashUrl -> HashlinkAccessPasswordForm($hash);
+ }
+ }
// Ajax - moramo nastavit userja kot avtorja, drugace ne izvede ajaxa
elseif($_GET['a'] == 'get_variable_labels' || $_GET['a'] == 'getDataStatusTitles'){