diff options
Diffstat (limited to 'admin/survey/public.php')
-rw-r--r-- | admin/survey/public.php | 112 |
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'){
|