mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-12 15:04:04 +00:00
externe ueberwachung v1
This commit is contained in:
@@ -0,0 +1,35 @@
|
|||||||
|
(function () {
|
||||||
|
/*
|
||||||
|
|
||||||
|
const params = new URLSearchParams(location.search);
|
||||||
|
let expectedOrigin = params.get("examus-client-origin");
|
||||||
|
|
||||||
|
if (!expectedOrigin)
|
||||||
|
{
|
||||||
|
window.top.location.href = 'resetconnection.php';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
let proctoringOK = false;
|
||||||
|
|
||||||
|
window.addEventListener("message", function (e) {
|
||||||
|
/*if (e.origin !== expectedOrigin) {
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
const data = e.data || {};
|
||||||
|
|
||||||
|
if (data.proctoringIsActive)
|
||||||
|
{
|
||||||
|
proctoringOK = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
if (!proctoringOK)
|
||||||
|
{
|
||||||
|
console.warn("Constructor nicht aktiv!")
|
||||||
|
//window.location.href='resetconnection.php';
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
})();
|
||||||
@@ -45,7 +45,7 @@ if (!$db = new basis_db())
|
|||||||
$PHP_SELF=$_SERVER["PHP_SELF"];
|
$PHP_SELF=$_SERVER["PHP_SELF"];
|
||||||
|
|
||||||
// Start session
|
// Start session
|
||||||
session_start();
|
require_once './session_init.php';
|
||||||
|
|
||||||
// If language is changed by language select menu, reset language variables
|
// If language is changed by language select menu, reset language variables
|
||||||
if (isset($_GET['sprache_user']) && !empty($_GET['sprache_user']))
|
if (isset($_GET['sprache_user']) && !empty($_GET['sprache_user']))
|
||||||
@@ -182,6 +182,10 @@ echo '
|
|||||||
if(!isset($_SESSION['pruefling_id']))
|
if(!isset($_SESSION['pruefling_id']))
|
||||||
die($p->t('testtool/bitteZuerstAnmelden'));
|
die($p->t('testtool/bitteZuerstAnmelden'));
|
||||||
|
|
||||||
|
if (!empty($_SESSION['externe_ueberwachung']) && isset($_SESSION['externe_ueberwachung_verified'])): ?>
|
||||||
|
<script type="text/javascript" src="externeueberwachung.js"></script>
|
||||||
|
<?php endif;
|
||||||
|
|
||||||
$pruefling = new pruefling();
|
$pruefling = new pruefling();
|
||||||
$pruefling->load($_SESSION['pruefling_id']);
|
$pruefling->load($_SESSION['pruefling_id']);
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,78 @@
|
|||||||
<?php
|
<?php
|
||||||
$contentpage = 'login.php';
|
$contentpage = 'login.php';
|
||||||
|
|
||||||
|
require_once './session_init.php';
|
||||||
|
|
||||||
if(isset($_GET['prestudent']) && is_numeric($_GET['prestudent']))
|
if(isset($_GET['prestudent']) && is_numeric($_GET['prestudent']))
|
||||||
{
|
{
|
||||||
$contentpage = 'login.php?prestudent='.$_GET['prestudent'];
|
$contentpage = 'login.php?prestudent='.$_GET['prestudent'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((isset($_SESSION['externe_ueberwachung']) && $_SESSION['externe_ueberwachung'] === true) &&
|
||||||
|
isset($_SESSION['externe_ueberwachung_verified']) && $_SESSION['externe_ueberwachung_verified'] === false)
|
||||||
|
{
|
||||||
|
header("Location: resetconnection.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>TestTool - FH Technikum Wien</title>
|
<title>TestTool - FH Technikum Wien</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link href="../../skin/style.css.php" rel="stylesheet" type="text/css">
|
<link href="../../skin/style.css.php" rel="stylesheet" type="text/css">
|
||||||
|
<?php
|
||||||
|
if (!empty($_SESSION['externe_ueberwachung'])) : ?>
|
||||||
|
<script>
|
||||||
|
function loadInContent(url)
|
||||||
|
{
|
||||||
|
if (url.includes('logout=true'))
|
||||||
|
{
|
||||||
|
return doLogout(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
let frame = document.getElementById('content_testtool');
|
||||||
|
if (frame)
|
||||||
|
{
|
||||||
|
frame.src = url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function doLogout(url)
|
||||||
|
{
|
||||||
|
fetch(url)
|
||||||
|
let topbarFrame = window.frames['topbar'];
|
||||||
|
let menuFrame = window.frames['menu'];
|
||||||
|
let contentFrame = window.frames['content'];
|
||||||
|
|
||||||
|
if (contentFrame)
|
||||||
|
contentFrame.location.href = 'logout.html';
|
||||||
|
|
||||||
|
if (menuFrame)
|
||||||
|
menuFrame.location.href = menuFrame.location.pathname;
|
||||||
|
|
||||||
|
if (topbarFrame)
|
||||||
|
topbarFrame.location.href = topbarFrame.location.pathname;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeSprache(content_params, sprache)
|
||||||
|
{
|
||||||
|
let topbarFrame = window.frames['topbar'];
|
||||||
|
let menuFrame = window.frames['menu'];
|
||||||
|
let contentFrame = window.frames['content'];
|
||||||
|
|
||||||
|
if (topbarFrame)
|
||||||
|
topbarFrame.location.href = topbarFrame.location.pathname + '?sprache_user=' + sprache;
|
||||||
|
|
||||||
|
if (menuFrame)
|
||||||
|
menuFrame.location.href = menuFrame.location.pathname + '?sprache_user=' + sprache;
|
||||||
|
|
||||||
|
if (contentFrame)
|
||||||
|
contentFrame.location.href = contentFrame.location.pathname + '?' + content_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<?php endif; ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<frameset rows="13%,*" cols="*" frameborder="NO" border="0" framespacing="0">
|
<frameset rows="13%,*" cols="*" frameborder="NO" border="0" framespacing="0">
|
||||||
@@ -26,3 +88,4 @@ if(isset($_GET['prestudent']) && is_numeric($_GET['prestudent']))
|
|||||||
</noframes>
|
</noframes>
|
||||||
</frameset>
|
</frameset>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
+16
-3
@@ -40,8 +40,7 @@ if (!$db = new basis_db())
|
|||||||
die('Fehler beim Oeffnen der Datenbankverbindung');
|
die('Fehler beim Oeffnen der Datenbankverbindung');
|
||||||
|
|
||||||
// Start session
|
// Start session
|
||||||
session_start();
|
require_once './session_init.php';
|
||||||
|
|
||||||
// Logout (triggered by logout button in menu.php)
|
// Logout (triggered by logout button in menu.php)
|
||||||
if (isset($_GET['logout']) && $_GET['logout'] == true)
|
if (isset($_GET['logout']) && $_GET['logout'] == true)
|
||||||
{
|
{
|
||||||
@@ -173,6 +172,12 @@ if (isset($_REQUEST['prestudent']))
|
|||||||
else
|
else
|
||||||
$reload_menu = true;
|
$reload_menu = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($rt->externe_ueberwachung)
|
||||||
|
{
|
||||||
|
$_SESSION['externe_ueberwachung'] = true;
|
||||||
|
$_SESSION['externe_ueberwachung_verified'] = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$pruefling = new pruefling();
|
$pruefling = new pruefling();
|
||||||
@@ -339,6 +344,8 @@ if ((isset($_SESSION['prestudent_id']) && !isset($_SESSION['pruefling_id']) &&
|
|||||||
!isset($_SESSION['confirmation_needed']) && !isset($_SESSION['confirmed_code'])) ||
|
!isset($_SESSION['confirmation_needed']) && !isset($_SESSION['confirmed_code'])) ||
|
||||||
(isset($_SESSION['confirmation_needed']) && $_SESSION['confirmation_needed'] === true &&
|
(isset($_SESSION['confirmation_needed']) && $_SESSION['confirmation_needed'] === true &&
|
||||||
isset($_SESSION['confirmed_code']) && $_SESSION['confirmed_code'] === true &&
|
isset($_SESSION['confirmed_code']) && $_SESSION['confirmed_code'] === true &&
|
||||||
|
isset($_SESSION['externe_ueberwachung']) && $_SESSION['externe_ueberwachung'] === true &&
|
||||||
|
isset($_SESSION['externe_ueberwachung_verified']) && $_SESSION['externe_ueberwachung_verified'] === true &&
|
||||||
isset($_SESSION['prestudent_id']) && !isset($_SESSION['pruefling_id'])))
|
isset($_SESSION['prestudent_id']) && !isset($_SESSION['pruefling_id'])))
|
||||||
{
|
{
|
||||||
$pruefling = new pruefling();
|
$pruefling = new pruefling();
|
||||||
@@ -468,7 +475,13 @@ if (isset($_POST['save']) && isset($_SESSION['prestudent_id']))
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (isset($_SESSION['confirmation_needed']) && $_SESSION['confirmation_needed'] === true &&
|
if ((isset($_SESSION['externe_ueberwachung']) && $_SESSION['externe_ueberwachung'] === true) &&
|
||||||
|
isset($_SESSION['externe_ueberwachung_verified']) && $_SESSION['externe_ueberwachung_verified'] === false)
|
||||||
|
{
|
||||||
|
echo "<script> top.location.href = 'resetconnection.php';</script>";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else if (isset($_SESSION['confirmation_needed']) && $_SESSION['confirmation_needed'] === true &&
|
||||||
isset($_SESSION['confirmed_code']) && $_SESSION['confirmed_code'] === false)
|
isset($_SESSION['confirmed_code']) && $_SESSION['confirmed_code'] === false)
|
||||||
{
|
{
|
||||||
echo '
|
echo '
|
||||||
|
|||||||
+25
-5
@@ -34,7 +34,7 @@ if (!$db = new basis_db())
|
|||||||
die('Fehler beim Oeffnen der Datenbankverbindung');
|
die('Fehler beim Oeffnen der Datenbankverbindung');
|
||||||
|
|
||||||
// Start session
|
// Start session
|
||||||
session_start();
|
require_once './session_init.php';
|
||||||
|
|
||||||
// If language is changed by language select menu, reset language and session variables
|
// If language is changed by language select menu, reset language and session variables
|
||||||
if(isset($_GET['sprache_user']) && !empty($_GET['sprache_user']))
|
if(isset($_GET['sprache_user']) && !empty($_GET['sprache_user']))
|
||||||
@@ -73,7 +73,7 @@ if (isset($_SESSION['pruefling_id']))
|
|||||||
|
|
||||||
// Link zur Startseite
|
// Link zur Startseite
|
||||||
echo '<tr><td class="ItemTesttool" style="margin-left: 20px;" nowrap>
|
echo '<tr><td class="ItemTesttool" style="margin-left: 20px;" nowrap>
|
||||||
<a class="ItemTesttool navButton" href="login.php" target="content">'.$p->t('testtool/startseite').'</a>
|
<a class="ItemTesttool navButton" href="login.php" onclick="return loadContent(this.href);">'.$p->t('testtool/startseite').'</a>
|
||||||
</td></tr>';
|
</td></tr>';
|
||||||
|
|
||||||
// Link zur Einleitung
|
// Link zur Einleitung
|
||||||
@@ -83,7 +83,7 @@ if (isset($_SESSION['pruefling_id']))
|
|||||||
{
|
{
|
||||||
echo '
|
echo '
|
||||||
<tr id="tr-einleitung"><td class="ItemTesttool" style="margin-left: 20px;" nowrap>
|
<tr id="tr-einleitung"><td class="ItemTesttool" style="margin-left: 20px;" nowrap>
|
||||||
<a class="ItemTesttool navButton" href="../../cms/content.php?content_id='.$content_id->content_id.'&sprache='.$sprache_user.'" target="content">'.$p->t('testtool/einleitung').'</a>
|
<a class="ItemTesttool navButton" href="../../cms/content.php?content_id='.$content_id->content_id.'&sprache='.$sprache_user.'" onclick="return loadContent(this.href);">'.$p->t('testtool/einleitung').'</a>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
';
|
';
|
||||||
}
|
}
|
||||||
@@ -379,10 +379,13 @@ if (isset($_SESSION['pruefling_id']))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo '<tr>
|
echo '<tr>
|
||||||
<!--<td width="10" class="ItemTesttoolLeft" nowrap> </td>-->
|
<!--<td width="10" class="ItemTesttoolLeft" nowrap> </td>-->
|
||||||
|
|
||||||
<td class="'.$class.'">
|
<td class="'.$class.'">
|
||||||
<a class="'.$class.'" href="frage.php?gebiet_id='.$row->gebiet_id.'" onclick="document.location.reload()" target="content" style="'.$style.'">'.$gebietbezeichnung.'</a>
|
<a class="'.$class.'" href="frage.php?gebiet_id='.$row->gebiet_id.'" onclick="return loadContent(this.href);" style="'.$style.'">'.$gebietbezeichnung.'</a>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<!--<td width="10" class="ItemTesttoolRight" nowrap> </td>-->
|
<!--<td width="10" class="ItemTesttoolRight" nowrap> </td>-->
|
||||||
</tr>';
|
</tr>';
|
||||||
@@ -401,7 +404,7 @@ if (isset($_SESSION['pruefling_id']))
|
|||||||
// Link zum Logout
|
// Link zum Logout
|
||||||
|
|
||||||
echo '<tr><td class="ItemTesttool" style="margin-left: 20px;" nowrap>
|
echo '<tr><td class="ItemTesttool" style="margin-left: 20px;" nowrap>
|
||||||
<a class="ItemTesttool navButton" href="login.php?logout=true" target="content">Logout</a>
|
<a class="ItemTesttool navButton" href="login.php?logout=true" onclick="return loadContent(this.href);">Logout</a>
|
||||||
</td></tr>';
|
</td></tr>';
|
||||||
|
|
||||||
echo '</td></tr></table>';
|
echo '</td></tr></table>';
|
||||||
@@ -461,5 +464,22 @@ else
|
|||||||
'</td></tr>');
|
'</td></tr>');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function loadContent(url)
|
||||||
|
{
|
||||||
|
if (parent && typeof parent.loadInContent === 'function')
|
||||||
|
{
|
||||||
|
parent.loadInContent(url);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let frame = parent?.frames?.["content"];
|
||||||
|
if (frame)
|
||||||
|
{
|
||||||
|
frame.location.href = url;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
require_once './session_init.php';
|
||||||
|
|
||||||
|
require_once('../../config/cis.config.inc.php');
|
||||||
|
require_once('../../config/global.config.inc.php');
|
||||||
|
require_once '../../include/externe_ueberwachung.class.php';
|
||||||
|
if (!$db = new basis_db())
|
||||||
|
die('Fehler beim Oeffnen der Datenbankverbindung');
|
||||||
|
|
||||||
|
if (isset($_SESSION['externe_ueberwachung']) && $_SESSION['externe_ueberwachung'] === true)
|
||||||
|
{
|
||||||
|
$ueberwachung = new externeUeberwachung();
|
||||||
|
$url = $ueberwachung->start($_SESSION['prestudent_id'], $_SESSION['reihungstestID']);
|
||||||
|
$urlSafe = htmlspecialchars($url, ENT_QUOTES);
|
||||||
|
|
||||||
|
|
||||||
|
//var_dump($urlSafe);
|
||||||
|
|
||||||
|
header("Location: $urlSafe");
|
||||||
|
//echo "<script>window.open('{$urlSafe}');</script>";
|
||||||
|
$_SESSION['externe_ueberwachung_verified'] = true;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
if (session_status() === PHP_SESSION_NONE) {
|
||||||
|
session_set_cookie_params(
|
||||||
|
0,
|
||||||
|
'/; samesite=None',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
@@ -67,10 +67,18 @@ function changeSprache(sprache)
|
|||||||
content_params.set('sprache_user', sprache); // add or replace sprache_user
|
content_params.set('sprache_user', sprache); // add or replace sprache_user
|
||||||
|
|
||||||
// Pass GET-param sprache_user to topbar.php, menu.php and content (login.php or frage.php) and refresh the frames.
|
// Pass GET-param sprache_user to topbar.php, menu.php and content (login.php or frage.php) and refresh the frames.
|
||||||
|
if (parent && typeof parent.changeSprache === 'function')
|
||||||
|
{
|
||||||
|
parent.changeSprache(content_params, sprache);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
location.href = location.pathname + '?sprache_user=' + sprache; // refreshes topbar.php
|
location.href = location.pathname + '?sprache_user=' + sprache; // refreshes topbar.php
|
||||||
parent.menu.location.href = parent.menu.location.pathname + '?sprache_user=' + sprache; // refreshes menu.php
|
parent.menu.location.href = parent.menu.location.pathname + '?sprache_user=' + sprache; // refreshes menu.php
|
||||||
parent.content.location.href = parent.content.location.pathname + '?' + content_params; // refreshes login.php or frage.php
|
parent.content.location.href = parent.content.location.pathname + '?' + content_params; // refreshes login.php or frage.php
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(document).on("keydown", function (e) {
|
$(document).on("keydown", function (e) {
|
||||||
if (((e.ctrlKey || e.metaKey) && e.keyCode === 85) || e.keyCode === 123)
|
if (((e.ctrlKey || e.metaKey) && e.keyCode === 85) || e.keyCode === 123)
|
||||||
|
|||||||
+2
-1
@@ -517,6 +517,7 @@
|
|||||||
"phpmd/phpmd": "2.*",
|
"phpmd/phpmd": "2.*",
|
||||||
"phpmetrics/phpmetrics": "2.*",
|
"phpmetrics/phpmetrics": "2.*",
|
||||||
"sebastian/phpcpd": "3.*",
|
"sebastian/phpcpd": "3.*",
|
||||||
"phpunit/phpunit": "^6"
|
"phpunit/phpunit": "^6",
|
||||||
|
"firebase/php-jwt": "^6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -301,4 +301,10 @@ define ('DEFAULT_ECHTER_DIENSTVERTRAG',[103,111]);
|
|||||||
|
|
||||||
// Weiterleiten zu CIS neu (wenn Rechte vorhanden)
|
// Weiterleiten zu CIS neu (wenn Rechte vorhanden)
|
||||||
define('CIS_REDIRECT_TO_CIS4', false);
|
define('CIS_REDIRECT_TO_CIS4', false);
|
||||||
|
|
||||||
|
//Externe Ueberwachung
|
||||||
|
define('EXTERNE_UEBERWACHUNG_PROTOCOL_URL', 'https://example.com');
|
||||||
|
define('EXTERNE_UEBERWACHUNG_SECRET_KEY', null);
|
||||||
|
define('EXTERNE_UEBERWACHUNG_INTEGRATION_NAME', 'example');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -0,0 +1,203 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||||
|
require_once(dirname(__FILE__).'/prestudent.class.php');
|
||||||
|
require_once(dirname(__FILE__).'/person.class.php');
|
||||||
|
require_once(dirname(__FILE__).'/reihungstest.class.php');
|
||||||
|
|
||||||
|
require_once(dirname(__FILE__).'/../vendor/autoload.php');
|
||||||
|
use Firebase\JWT\JWT;
|
||||||
|
|
||||||
|
class externeUeberwachung extends basis_db
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatusByPrestudent($prestudent_id)
|
||||||
|
{
|
||||||
|
$session_id = $this->getSessionByPrestudent($prestudent_id);
|
||||||
|
return $this->getSessionStatus($session_id);
|
||||||
|
}
|
||||||
|
public function start($prestudent_id, $reihungstest_id)
|
||||||
|
{
|
||||||
|
$session_id = $this->getSessionByPrestudent($prestudent_id);
|
||||||
|
|
||||||
|
if (!$session_id)
|
||||||
|
{
|
||||||
|
$session_id = $this->createSession($prestudent_id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$status = $this->getSessionStatus($session_id);
|
||||||
|
|
||||||
|
if (in_array($status, array('late_to_start', 'finished')))
|
||||||
|
{
|
||||||
|
$session_id = $this->createSession($prestudent_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$payload = $this->getPayload($session_id, $prestudent_id, $reihungstest_id);
|
||||||
|
return $this->getStartUrl($payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function createSession($prestudent_id)
|
||||||
|
{
|
||||||
|
if (is_null($prestudent_id))
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Falsche Parameterübergabe';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$uuid = $this->genereateUUID();
|
||||||
|
|
||||||
|
$qry = "INSERT INTO testtool.tbl_externe_ueberwachung (prestudent_id, session_id, insertvon)
|
||||||
|
VALUES (".
|
||||||
|
$this->db_add_param($prestudent_id).",".
|
||||||
|
$this->db_add_param($uuid).",".
|
||||||
|
$this->db_add_param(get_uid()).")";
|
||||||
|
|
||||||
|
if($this->db_query($qry))
|
||||||
|
{
|
||||||
|
return $uuid;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Fehler beim Speichern der Antwort';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function getSessionByPrestudent($prestudent_id)
|
||||||
|
{
|
||||||
|
if (is_null($prestudent_id))
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Falsche Parameterübergabe';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$qry = "SELECT session_id
|
||||||
|
FROM testtool.tbl_externe_ueberwachung
|
||||||
|
ORDER BY insertamum DESC
|
||||||
|
LIMIT 1";
|
||||||
|
|
||||||
|
if($result = $this->db_query($qry))
|
||||||
|
{
|
||||||
|
if ($row = $this->db_fetch_object($result))
|
||||||
|
{
|
||||||
|
return $row->session_id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Daten konnten nicht geladen werden';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Fehler bei einer Abfrage';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSessionStatus($session_id)
|
||||||
|
{
|
||||||
|
$payload = $this->getSessionPayload($session_id);
|
||||||
|
$jwt = $this->createToken($payload);
|
||||||
|
|
||||||
|
$url = $this->getSessionUrl($session_id);
|
||||||
|
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
"Authorization: JWT {$jwt}",
|
||||||
|
"Content-Type: application/json",
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
$data = json_decode($response, true);
|
||||||
|
return isset($data['status']) ? $data['status'] : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getSessionPayload($session_id)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
"session_id" => $session_id,
|
||||||
|
"iat" => time(),
|
||||||
|
"exp" => time() + 120,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getPayload($session_id, $prestudent_id, $reihungstest_id)
|
||||||
|
{
|
||||||
|
$prestudent = new prestudent($prestudent_id);
|
||||||
|
$person = new Person($prestudent->person_id);
|
||||||
|
|
||||||
|
$reihungstest = new Reihungstest($reihungstest_id);
|
||||||
|
|
||||||
|
$datetime = new DateTime();
|
||||||
|
$today = $datetime->format('Y-m-d');
|
||||||
|
|
||||||
|
$payload = [
|
||||||
|
"userId"=> $prestudent_id,
|
||||||
|
"lastName"=> $person->nachname,
|
||||||
|
"firstName"=> $person->vorname,
|
||||||
|
"language"=> $person->sprache,
|
||||||
|
"accountName"=> "technikum_wien",
|
||||||
|
"accountId"=> "technikum_wien",
|
||||||
|
"examId" => !is_null(trim($reihungstest->anmerkung)) ? $reihungstest->anmerkung : ($today . " RT Test"),
|
||||||
|
"examName" => !is_null(trim($reihungstest->anmerkung)) ? $reihungstest->anmerkung : ($today . " RT Test"),
|
||||||
|
"allowMultipleDisplays" => true,
|
||||||
|
"allowMakingRoomScanSecondCamera" => false,
|
||||||
|
"duration"=> 120,
|
||||||
|
"schedule"=> false,
|
||||||
|
"trial"=> true,
|
||||||
|
"proctoring"=> "offline",
|
||||||
|
"identification"=> "skip",
|
||||||
|
"startDate"=> "2018-03-27T00:00:00Z", //TODO anpassen
|
||||||
|
"endDate"=> "2027-03-30T12:55:00Z", // TODO anpassen
|
||||||
|
"sessionId"=> $session_id,
|
||||||
|
"sessionUrl"=> "https://demo.dev.technikum-wien.at/cis/testtool/index.php"
|
||||||
|
];
|
||||||
|
return $payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getSessionUrl($session_id)
|
||||||
|
{
|
||||||
|
return EXTERNE_UEBERWACHUNG_PROTOCOL_URL . "/api/v2/integration/simple/". EXTERNE_UEBERWACHUNG_INTEGRATION_NAME . "/sessions/". urlencode($session_id) ."/status/";
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getStartUrl($payload)
|
||||||
|
{
|
||||||
|
$token = $this->createToken($payload);
|
||||||
|
$query = http_build_query(['token' => $token]);
|
||||||
|
|
||||||
|
return EXTERNE_UEBERWACHUNG_PROTOCOL_URL . '/integration/simple/'. EXTERNE_UEBERWACHUNG_INTEGRATION_NAME .'/start?' . $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function createToken($payload)
|
||||||
|
{
|
||||||
|
return JWT::encode($payload, EXTERNE_UEBERWACHUNG_SECRET_KEY, 'HS256');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function genereateUUID()
|
||||||
|
{
|
||||||
|
$data = openssl_random_pseudo_bytes(16);
|
||||||
|
|
||||||
|
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
|
||||||
|
$data[8] = chr(ord($data[8]) & 0x3f | 0x80);
|
||||||
|
|
||||||
|
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -63,6 +63,7 @@ class reihungstest extends basis_db
|
|||||||
|
|
||||||
public $zugangs_ueberpruefung = false; //boolean
|
public $zugangs_ueberpruefung = false; //boolean
|
||||||
public $zugangscode; //smallint
|
public $zugangscode; //smallint
|
||||||
|
public $externe_ueberwachung = false; //boolean
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,6 +120,7 @@ class reihungstest extends basis_db
|
|||||||
$this->aufnahmegruppe_kurzbz = $row->aufnahmegruppe_kurzbz;
|
$this->aufnahmegruppe_kurzbz = $row->aufnahmegruppe_kurzbz;
|
||||||
$this->zugangs_ueberpruefung = $this->db_parse_bool($row->zugangs_ueberpruefung);
|
$this->zugangs_ueberpruefung = $this->db_parse_bool($row->zugangs_ueberpruefung);
|
||||||
$this->zugangscode = $row->zugangscode;
|
$this->zugangscode = $row->zugangscode;
|
||||||
|
$this->externe_ueberwachung = $this->db_parse_bool($row->externe_ueberwachung);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -234,7 +236,7 @@ class reihungstest extends basis_db
|
|||||||
|
|
||||||
$qry = 'BEGIN; INSERT INTO public.tbl_reihungstest (studiengang_kz, ort_kurzbz, anmerkung, datum, uhrzeit,
|
$qry = 'BEGIN; INSERT INTO public.tbl_reihungstest (studiengang_kz, ort_kurzbz, anmerkung, datum, uhrzeit,
|
||||||
insertamum, insertvon, updateamum, updatevon, max_teilnehmer, oeffentlich, freigeschaltet,
|
insertamum, insertvon, updateamum, updatevon, max_teilnehmer, oeffentlich, freigeschaltet,
|
||||||
studiensemester_kurzbz, stufe, anmeldefrist, aufnahmegruppe_kurzbz, zugangs_ueberpruefung, zugangscode) VALUES('.
|
studiensemester_kurzbz, stufe, anmeldefrist, aufnahmegruppe_kurzbz, zugangs_ueberpruefung, zugangscode, externe_ueberwachung) VALUES('.
|
||||||
$this->db_add_param($this->studiengang_kz, FHC_INTEGER).', '.
|
$this->db_add_param($this->studiengang_kz, FHC_INTEGER).', '.
|
||||||
$this->db_add_param($this->ort_kurzbz).', '.
|
$this->db_add_param($this->ort_kurzbz).', '.
|
||||||
$this->db_add_param($this->anmerkung).', '.
|
$this->db_add_param($this->anmerkung).', '.
|
||||||
@@ -250,7 +252,8 @@ class reihungstest extends basis_db
|
|||||||
$this->db_add_param($this->anmeldefrist).','.
|
$this->db_add_param($this->anmeldefrist).','.
|
||||||
$this->db_add_param($this->aufnahmegruppe_kurzbz). ',' .
|
$this->db_add_param($this->aufnahmegruppe_kurzbz). ',' .
|
||||||
$this->db_add_param($this->zugangs_ueberpruefung, FHC_BOOLEAN).','.
|
$this->db_add_param($this->zugangs_ueberpruefung, FHC_BOOLEAN).','.
|
||||||
$this->db_add_param($this->zugangscode) . ');';
|
$this->db_add_param($this->zugangscode) . ','.
|
||||||
|
$this->db_add_param($this->externe_ueberwachung, FHC_BOOLEAN) . ');';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -270,7 +273,8 @@ class reihungstest extends basis_db
|
|||||||
'anmeldefrist='.$this->db_add_param($this->anmeldefrist).', '.
|
'anmeldefrist='.$this->db_add_param($this->anmeldefrist).', '.
|
||||||
'aufnahmegruppe_kurzbz='.$this->db_add_param($this->aufnahmegruppe_kurzbz).', '.
|
'aufnahmegruppe_kurzbz='.$this->db_add_param($this->aufnahmegruppe_kurzbz).', '.
|
||||||
'zugangs_ueberpruefung='.$this->db_add_param($this->zugangs_ueberpruefung, FHC_BOOLEAN).', '.
|
'zugangs_ueberpruefung='.$this->db_add_param($this->zugangs_ueberpruefung, FHC_BOOLEAN).', '.
|
||||||
'zugangscode='.$this->db_add_param($this->zugangscode).' '.
|
'zugangscode='.$this->db_add_param($this->zugangscode).', '.
|
||||||
|
'externe_ueberwachung='.$this->db_add_param($this->externe_ueberwachung, FHC_BOOLEAN).' '.
|
||||||
'WHERE reihungstest_id='.$this->db_add_param($this->reihungstest_id, FHC_INTEGER, false).';';
|
'WHERE reihungstest_id='.$this->db_add_param($this->reihungstest_id, FHC_INTEGER, false).';';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ require_once('dbupdate_3.4/40314_electronic_onboarding_anbindung_ida.php');
|
|||||||
require_once('dbupdate_3.4/47972_pruefungsverwaltung_ects_angabe.php');
|
require_once('dbupdate_3.4/47972_pruefungsverwaltung_ects_angabe.php');
|
||||||
require_once('dbupdate_3.4/67490_studstatus_suche_abort_controller_haengt.php');
|
require_once('dbupdate_3.4/67490_studstatus_suche_abort_controller_haengt.php');
|
||||||
require_once('dbupdate_3.4/68744_StV_settings.php');
|
require_once('dbupdate_3.4/68744_StV_settings.php');
|
||||||
|
require_once('dbupdate_3.4/62889_reihungstest_ueberwachung_mit_constructor.php');
|
||||||
|
|
||||||
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
|
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
|
||||||
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
|
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
|
||||||
@@ -358,7 +359,7 @@ $tabellen=array(
|
|||||||
"public.tbl_profil_update_status" => array("status_kurzbz","beschreibung","bezeichnung_mehrsprachig"),
|
"public.tbl_profil_update_status" => array("status_kurzbz","beschreibung","bezeichnung_mehrsprachig"),
|
||||||
"public.tbl_profil_update_topic" => array("topic_kurzbz","beschreibung","bezeichnung_mehrsprachig"),
|
"public.tbl_profil_update_topic" => array("topic_kurzbz","beschreibung","bezeichnung_mehrsprachig"),
|
||||||
"public.tbl_raumtyp" => array("raumtyp_kurzbz","beschreibung","kosten","aktiv"),
|
"public.tbl_raumtyp" => array("raumtyp_kurzbz","beschreibung","kosten","aktiv"),
|
||||||
"public.tbl_reihungstest" => array("reihungstest_id","studiengang_kz","ort_kurzbz","anmerkung","datum","uhrzeit","updateamum","updatevon","insertamum","insertvon","ext_id","freigeschaltet","max_teilnehmer","oeffentlich","studiensemester_kurzbz","aufnahmegruppe_kurzbz","stufe","anmeldefrist","zugangs_ueberpruefung","zugangscode"),
|
"public.tbl_reihungstest" => array("reihungstest_id","studiengang_kz","ort_kurzbz","anmerkung","datum","uhrzeit","updateamum","updatevon","insertamum","insertvon","ext_id","freigeschaltet","max_teilnehmer","oeffentlich","studiensemester_kurzbz","aufnahmegruppe_kurzbz","stufe","anmeldefrist","zugangs_ueberpruefung","zugangscode", "externe_ueberwachung"),
|
||||||
"public.tbl_rueckstellung" => array("rueckstellung_id","person_id","status_kurzbz","datum_bis","insertamum","insertvon"),
|
"public.tbl_rueckstellung" => array("rueckstellung_id","person_id","status_kurzbz","datum_bis","insertamum","insertvon"),
|
||||||
"public.tbl_rueckstellung_status" => array("status_kurzbz", "bezeichnung_mehrsprachig", "sort", "aktiv"),
|
"public.tbl_rueckstellung_status" => array("status_kurzbz", "bezeichnung_mehrsprachig", "sort", "aktiv"),
|
||||||
"public.tbl_rt_ort" => array("rt_id","ort_kurzbz","uid"),
|
"public.tbl_rt_ort" => array("rt_id","ort_kurzbz","uid"),
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('DB_NAME')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
if(!$result = @$db->db_query("SELECT externe_ueberwachung FROM public.tbl_reihungstest LIMIT 1"))
|
||||||
|
{
|
||||||
|
$qry = "ALTER TABLE public.tbl_reihungstest ADD COLUMN externe_ueberwachung boolean NOT NULL DEFAULT false;";
|
||||||
|
|
||||||
|
if(!$db->db_query($qry))
|
||||||
|
echo '<strong>public.tbl_reihungstest: '.$db->db_last_error().'</strong><br>';
|
||||||
|
else
|
||||||
|
echo '<br>public.tbl_reihungstest: Spalte externe_ueberwachung hinzugefuegt';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$result = @$db->db_query("SELECT 1 FROM testtool.tbl_externe_ueberwachung LIMIT 1"))
|
||||||
|
{
|
||||||
|
$qry = "CREATE TABLE testtool.tbl_externe_ueberwachung (
|
||||||
|
externe_ueberwachung_id INTEGER NOT NULL,
|
||||||
|
prestudent_id INTEGER NOT NULL,
|
||||||
|
session_id UUID NOT NULL,
|
||||||
|
insertamum TIMESTAMP DEFAULT NOW(),
|
||||||
|
insertvon VARCHAR(32) NOT NULL,
|
||||||
|
CONSTRAINT tbl_externe_ueberwachung_pk PRIMARY KEY(externe_ueberwachung_id)
|
||||||
|
);
|
||||||
|
CREATE SEQUENCE testtool.tbl_externe_ueberwachungg_id_seq
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MAXVALUE
|
||||||
|
NO MINVALUE
|
||||||
|
CACHE 1;
|
||||||
|
ALTER TABLE testtool.tbl_externe_ueberwachung ALTER COLUMN externe_ueberwachung_id SET DEFAULT nextval('testtool.tbl_externe_ueberwachungg_id_seq');
|
||||||
|
ALTER TABLE testtool.tbl_externe_ueberwachung ADD CONSTRAINT fk_prestudent_externe_ueberwachung FOREIGN KEY (prestudent_id) REFERENCES public.tbl_prestudent (prestudent_id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||||
|
ALTER TABLE testtool.tbl_externe_ueberwachung ADD CONSTRAINT unique_externe_ueberwachung_session_id UNIQUE (session_id);
|
||||||
|
GRANT SELECT, INSERT ON testtool.tbl_externe_ueberwachung TO vilesci;
|
||||||
|
GRANT SELECT, INSERT ON testtool.tbl_externe_ueberwachung TO web;
|
||||||
|
GRANT SELECT, UPDATE ON testtool.tbl_externe_ueberwachungg_id_seq TO vilesci;
|
||||||
|
GRANT SELECT, UPDATE ON testtool.tbl_externe_ueberwachungg_id_seq TO web;";
|
||||||
|
|
||||||
|
if(!$db->db_query($qry))
|
||||||
|
echo '<strong>testtool.tbl_externe_ueberwachung: '.$db->db_last_error().'</strong><br>';
|
||||||
|
else
|
||||||
|
echo '<br>testtool.tbl_externe_ueberwachung: table created';
|
||||||
|
}
|
||||||
@@ -1458,6 +1458,7 @@ if(isset($_POST['speichern']) || isset($_POST['kopieren']))
|
|||||||
$reihungstest->anmeldefrist = $datum_obj->formatDatum($_POST['anmeldefrist']);
|
$reihungstest->anmeldefrist = $datum_obj->formatDatum($_POST['anmeldefrist']);
|
||||||
$reihungstest->zugangs_ueberpruefung = false;
|
$reihungstest->zugangs_ueberpruefung = false;
|
||||||
$reihungstest->zugangscode = null;
|
$reihungstest->zugangscode = null;
|
||||||
|
$reihungstest->externe_ueberwachung = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1474,6 +1475,7 @@ if(isset($_POST['speichern']) || isset($_POST['kopieren']))
|
|||||||
$reihungstest->updatevon = $user;
|
$reihungstest->updatevon = $user;
|
||||||
$reihungstest->zugangs_ueberpruefung = isset($_POST['zugangs_ueberpruefung']);
|
$reihungstest->zugangs_ueberpruefung = isset($_POST['zugangs_ueberpruefung']);
|
||||||
$reihungstest->zugangscode = ($_POST['zugangcode'] === '' ? null : $_POST['zugangcode']);
|
$reihungstest->zugangscode = ($_POST['zugangcode'] === '' ? null : $_POST['zugangcode']);
|
||||||
|
$reihungstest->externe_ueberwachung = isset($_POST['externe_ueberwachung']);
|
||||||
}
|
}
|
||||||
$reihungstest->studiengang_kz = $_POST['studiengang_kz'];
|
$reihungstest->studiengang_kz = $_POST['studiengang_kz'];
|
||||||
//$reihungstest->ort_kurzbz = $_POST['ort_kurzbz'];
|
//$reihungstest->ort_kurzbz = $_POST['ort_kurzbz'];
|
||||||
@@ -2571,6 +2573,12 @@ $studienplaene_list = implode(',', array_keys($studienplaene_arr));
|
|||||||
<input type="number" class="input" id="zugangcode" name="zugangcode" value="<?php echo $db->convert_html_chars($reihungstest->zugangscode) ?>"> (Verpflichtend, wenn die Zugangsüberprüfung aktiviert ist)
|
<input type="number" class="input" id="zugangcode" name="zugangcode" value="<?php echo $db->convert_html_chars($reihungstest->zugangscode) ?>"> (Verpflichtend, wenn die Zugangsüberprüfung aktiviert ist)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="feldtitel">Externe Überwachnung</td>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" id="externe_ueberwachung" name="externe_ueberwachung"<?php echo $reihungstest->externe_ueberwachung ? 'checked="checked"' : '' ?>>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user