From 2a8b61c07fe60d031d0af852c045b52dbbfbeac7 Mon Sep 17 00:00:00 2001 From: Paolo Date: Wed, 11 May 2022 18:29:10 +0200 Subject: [PATCH 001/131] - Added new library application/libraries/SignatureLib.php - Changed configs for the signature server in config/vilesci.config-default.inc.php - Changed include/dokument_export.class.php to make use of the new configs --- application/libraries/SignatureLib.php | 76 ++++++++++++++++++++++++++ config/vilesci.config-default.inc.php | 11 +++- include/dokument_export.class.php | 2 +- 3 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 application/libraries/SignatureLib.php diff --git a/application/libraries/SignatureLib.php b/application/libraries/SignatureLib.php new file mode 100644 index 000000000..b8c4374a3 --- /dev/null +++ b/application/libraries/SignatureLib.php @@ -0,0 +1,76 @@ +sendsJson() + ->authenticateWith(SIGNATUR_USER, SIGNATUR_PASSWORD) + ->body('{"filename": "'.basename($inputFileName).'", "content": "'.base64_encode($inputFileContent).'"}') + ->expectsJson() + ->send(); + } + } + catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception + { + $resultList = $cee->getMessage(); + } + catch (Exception $e) // any other exception + { + $resultList = $e->getMessage(); + } + + // If the response is fine + if (isset($resultPost->body) && is_object($resultPost->body) && isset($resultPost->body->retval)) + { + return $resultPost->body->retval; + } + + return $resultList; + } +} + diff --git a/config/vilesci.config-default.inc.php b/config/vilesci.config-default.inc.php index 5285eef3b..a3e4cbece 100644 --- a/config/vilesci.config-default.inc.php +++ b/config/vilesci.config-default.inc.php @@ -186,11 +186,16 @@ define('FHC_REST_PASSWORD', 'password'); * Signatur * DEFAULT: https://signatur.example.com/api/sign */ -define('SIGNATUR_URL', 'https://signatur.example.com/api/sign'); +// Generic URL +define('SIGNATUR_URL', 'https://signatur.dev.technikum-wien.at/api'); +// Sign API +define('SIGNATUR_SIGN_API', 'sign'); +// List API +define('SIGNATUR_LIST_API', 'list'); // User für Zugriff auf Signaturserver -define('SIGNATUR_USER', 'username'); +define('SIGNATUR_USER', 'fhcomplete'); // Passwort für Zugriff auf Signaturserver -define('SIGNATUR_PASSWORD', 'password'); +define('SIGNATUR_PASSWORD', 'Fhcomplet3Signature!'); // Signaturprofil das verwendet werden soll define('SIGNATUR_DEFAULT_PROFILE', 'FHC_AMT_GROSS_DE'); diff --git a/include/dokument_export.class.php b/include/dokument_export.class.php index 4f23a7dcd..3a6e57657 100644 --- a/include/dokument_export.class.php +++ b/include/dokument_export.class.php @@ -527,7 +527,7 @@ class dokument_export $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, SIGNATUR_URL); + curl_setopt($ch, CURLOPT_URL, SIGNATUR_URL.'/'.SIGNATUR_SIGN_API); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 7); curl_setopt($ch, CURLOPT_USERAGENT, "FH-Complete"); From d4042228d9114502fd0151510df15effa43b21e2 Mon Sep 17 00:00:00 2001 From: Paolo Date: Fri, 13 May 2022 20:11:31 +0200 Subject: [PATCH 002/131] - Better code and comments in application/libraries/SignatureLib->list - cis/private/lehre/abgabe_lektor_details.php and cis/private/lehre/abgabe_student_details.php check if the uploaded document contains digital signares and display a phrase - Added new phrase to locale/de-AT/abgabetool.php and locale/en-US/abgabetool.php --- application/libraries/SignatureLib.php | 15 +++--- cis/private/lehre/abgabe_lektor_details.php | 25 +++++++++- cis/private/lehre/abgabe_student_details.php | 49 ++++++++++++++++---- locale/de-AT/abgabetool.php | 1 + locale/en-US/abgabetool.php | 1 + 5 files changed, 73 insertions(+), 18 deletions(-) diff --git a/application/libraries/SignatureLib.php b/application/libraries/SignatureLib.php index b8c4374a3..132545219 100644 --- a/application/libraries/SignatureLib.php +++ b/application/libraries/SignatureLib.php @@ -33,16 +33,13 @@ class SignatureLib */ public static function list($inputFileName) { - // Generic error occurred - $resultList = 'Generic error occurred'; - try { // Get the content of the given file $inputFileContent = file_get_contents($inputFileName); if ($inputFileContent === false) // if failed { - $resultList = 'An error occurred while getting the content from: '.$inputFileName; + error_log('An error occurred while getting the content from: '.$inputFileName); } else { @@ -57,20 +54,22 @@ class SignatureLib } catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception { - $resultList = $cee->getMessage(); + error_log($cee->getMessage()); } catch (Exception $e) // any other exception { - $resultList = $e->getMessage(); + error_log($e->getMessage()); } // If the response is fine - if (isset($resultPost->body) && is_object($resultPost->body) && isset($resultPost->body->retval)) + if (isset($resultPost->body) && is_object($resultPost->body) + && isset($resultPost->body->retval) && is_array($resultPost->body->retval)) { return $resultPost->body->retval; } - return $resultList; + // Otherwise return a null as error + return null; } } diff --git a/cis/private/lehre/abgabe_lektor_details.php b/cis/private/lehre/abgabe_lektor_details.php index a508de098..e1b47369d 100644 --- a/cis/private/lehre/abgabe_lektor_details.php +++ b/cis/private/lehre/abgabe_lektor_details.php @@ -37,6 +37,7 @@ require_once('../../../include/phrasen.class.php'); require_once('../../../include/projektarbeit.class.php'); require_once('../../../include/projektbetreuer.class.php'); require_once('../../../include/sancho.inc.php'); +require_once('../../../application/libraries/SignatureLib.php'); if (!$db = new basis_db()) $db=false; @@ -642,7 +643,29 @@ $result=@$db->db_query($qry); } if(file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) { - $htmlstr .= " PDF"; + $uploadedDocumentSigned = null; + + // Check if the document is signed + $signList = SignatureLib::list(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf'); + if (is_array($signList) && count($signList) > 0) + { + // The document is signed + } + elseif ($signList === null) + { + $uploadedDocumentSigned = 'WARNING: signature server error'; + } + else + { + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + } + + $htmlstr .= " + + PDF + + ".$uploadedDocumentSigned." + "; } else { diff --git a/cis/private/lehre/abgabe_student_details.php b/cis/private/lehre/abgabe_student_details.php index 29d74ab66..b8a8f158e 100644 --- a/cis/private/lehre/abgabe_student_details.php +++ b/cis/private/lehre/abgabe_student_details.php @@ -36,6 +36,7 @@ require_once('../../../include/phrasen.class.php'); require_once('../../../include/projektarbeit.class.php'); require_once('../../../include/projektbetreuer.class.php'); require_once('../../../include/sancho.inc.php'); +require_once('../../../application/libraries/SignatureLib.php'); $anzeigesprache = getSprache(); $p = new phrasen($anzeigesprache); @@ -111,6 +112,7 @@ $titel = $projektarbeit_obj->titel; $person = new person(); $person->load($bid); $betreuer = $person->titelpre.' '.$person->vorname.' '.$person->nachname.' '.$person->titelpost; +$uploadedDocumentSigned = null; if($uid!=$user) { @@ -286,15 +288,20 @@ if($command=="update" && $error!=true) move_uploaded_file($_FILES['datei']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) { - exec('chmod 640 "'.PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'.'"'); - - $qry="UPDATE campus.tbl_paabgabe SET - abgabedatum = now(), - updatevon = ".$db->db_add_param($user).", - updateamum = now() - WHERE paabgabe_id=".$db->db_add_param($paabgabe_id, FHC_INTEGER); - $result=$db->db_query($qry); - echo $p->t('global/dateiErfolgreichHochgeladen'); + // Check if the document is signed + $signList = SignatureLib::list(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); + if (is_array($signList) && count($signList) > 0) + { + // The document is signed + } + elseif ($signList === null) + { + $uploadedDocumentSigned = 'WARNING: signature server error'; + } + else + { + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + } } else { @@ -311,6 +318,21 @@ if($command=="update" && $error!=true) } if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) { + // Check if the document is signed + $signList = SignatureLib::list(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); + if (is_array($signList) && count($signList) > 0) + { + // The document is signed + } + elseif ($signList === null) + { + $uploadedDocumentSigned = 'WARNING: signature server error'; + } + else + { + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + } + /*$qry="UPDATE campus.tbl_paabgabe SET abgabedatum = now(), updatevon = '".$user."', @@ -339,6 +361,15 @@ if($command=="update" && $error!=true) $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; + + // If there are info about the signed document + if ($uploadedDocumentSigned != null) + { + $htmlstr .= "\n"; + $htmlstr .= "".$uploadedDocumentSigned.""; + $htmlstr .= "\n"; + } + $htmlstr .= "\n"; $htmlstr .= "".$p->t('abgabetool/spracheDerArbeit').":"; $sprache = @$db->db_query("SELECT sprache FROM public.tbl_sprache"); diff --git a/locale/de-AT/abgabetool.php b/locale/de-AT/abgabetool.php index c4b17318b..6d1eb923f 100644 --- a/locale/de-AT/abgabetool.php +++ b/locale/de-AT/abgabetool.php @@ -91,4 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Projektbeurteilung heru $this->phrasen['abgabetool/projektbeurteilungErstDownload']='Erst-/Begutachter'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Zweitbegutachter'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Fehler beim Ermitteln des Enduplaods der Projektarbeit'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='The uploaded document is not signed DE'; ?> diff --git a/locale/en-US/abgabetool.php b/locale/en-US/abgabetool.php index b05456faa..c782dedcc 100644 --- a/locale/en-US/abgabetool.php +++ b/locale/en-US/abgabetool.php @@ -91,4 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Thesis-Assessment downl $this->phrasen['abgabetool/projektbeurteilungErstDownload']='First-/Assessor'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Second Assessor'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Error when getting endupload of project work'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='The uploaded document is not signed EN'; ?> From 22bba685ffcacdbb0ee1b2847cea3eab8b3c8a65 Mon Sep 17 00:00:00 2001 From: Paolo Date: Mon, 16 May 2022 16:15:48 +0200 Subject: [PATCH 003/131] Added new style to the warning --- cis/private/lehre/abgabe_lektor_details.php | 27 ++++++++++++-------- cis/private/lehre/abgabe_student_details.php | 24 ++++++++++------- locale/de-AT/abgabetool.php | 2 +- locale/en-US/abgabetool.php | 2 +- 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/cis/private/lehre/abgabe_lektor_details.php b/cis/private/lehre/abgabe_lektor_details.php index e1b47369d..29a1221af 100644 --- a/cis/private/lehre/abgabe_lektor_details.php +++ b/cis/private/lehre/abgabe_lektor_details.php @@ -641,6 +641,14 @@ $result=@$db->db_query($qry); { $htmlstr .= "               "; } + if($row->abgabedatum && $row->paabgabetyp_kurzbz=="end") + { + $htmlstr .= " zusätzliche Daten"; + } + else + { + $htmlstr .= "     "; + } if(file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) { $uploadedDocumentSigned = null; @@ -663,17 +671,14 @@ $result=@$db->db_query($qry); $htmlstr .= " PDF - - ".$uploadedDocumentSigned." - "; - } - else - { - $htmlstr .= "     "; - } - if($row->abgabedatum && $row->paabgabetyp_kurzbz=="end") - { - $htmlstr .= " zusätzliche Daten"; + "; + if ($uploadedDocumentSigned != null) + { + $htmlstr .= '
+ '.$uploadedDocumentSigned.' +
'; + } + $htmlstr .= ""; } else { diff --git a/cis/private/lehre/abgabe_student_details.php b/cis/private/lehre/abgabe_student_details.php index b8a8f158e..949749a3b 100644 --- a/cis/private/lehre/abgabe_student_details.php +++ b/cis/private/lehre/abgabe_student_details.php @@ -361,15 +361,6 @@ if($command=="update" && $error!=true) $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; $htmlstr .= ''."\n"; - - // If there are info about the signed document - if ($uploadedDocumentSigned != null) - { - $htmlstr .= "\n"; - $htmlstr .= "".$uploadedDocumentSigned.""; - $htmlstr .= "\n"; - } - $htmlstr .= "\n"; $htmlstr .= "".$p->t('abgabetool/spracheDerArbeit').":"; $sprache = @$db->db_query("SELECT sprache FROM public.tbl_sprache"); @@ -403,6 +394,21 @@ if($command=="update" && $error!=true) $htmlstr .= ''.$p->t('abgabetool/seitenanzahl').':* '."\n"; $htmlstr .=" \n"; + + // If there are info about the signed document + if ($uploadedDocumentSigned != null) + { + $htmlstr .= "\n"; + $htmlstr .= ""; + $htmlstr .= '
+ + '.$uploadedDocumentSigned.' +
'; + $htmlstr .= ""; + $htmlstr .= "\n"; + } + + $htmlstr .=" \n"; $htmlstr .="

".$p->t('abgabetool/eidesstattlicheErklaerung')."

\n"; $htmlstr .= "".$p->t('abgabetool/gelesenUndAkzeptiert').":* "; $htmlstr .=" * ".$p->t('abgabetool/pflichtfeld')." diff --git a/locale/de-AT/abgabetool.php b/locale/de-AT/abgabetool.php index 6d1eb923f..093b56255 100644 --- a/locale/de-AT/abgabetool.php +++ b/locale/de-AT/abgabetool.php @@ -91,5 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Projektbeurteilung heru $this->phrasen['abgabetool/projektbeurteilungErstDownload']='Erst-/Begutachter'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Zweitbegutachter'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Fehler beim Ermitteln des Enduplaods der Projektarbeit'; -$this->phrasen['abgabetool/uploadedDocumentNotSigned']='The uploaded document is not signed DE'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='Warning! The uploaded document is not signed DE'; ?> diff --git a/locale/en-US/abgabetool.php b/locale/en-US/abgabetool.php index c782dedcc..333e21272 100644 --- a/locale/en-US/abgabetool.php +++ b/locale/en-US/abgabetool.php @@ -91,5 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Thesis-Assessment downl $this->phrasen['abgabetool/projektbeurteilungErstDownload']='First-/Assessor'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Second Assessor'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Error when getting endupload of project work'; -$this->phrasen['abgabetool/uploadedDocumentNotSigned']='The uploaded document is not signed EN'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='Warning! The uploaded document is not signed'; ?> From 2d2383639617fe349f8263927d607556afb7d6e7 Mon Sep 17 00:00:00 2001 From: Paolo Date: Mon, 16 May 2022 16:23:15 +0200 Subject: [PATCH 004/131] Translated german phrase --- locale/de-AT/abgabetool.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/de-AT/abgabetool.php b/locale/de-AT/abgabetool.php index 093b56255..378544811 100644 --- a/locale/de-AT/abgabetool.php +++ b/locale/de-AT/abgabetool.php @@ -91,5 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Projektbeurteilung heru $this->phrasen['abgabetool/projektbeurteilungErstDownload']='Erst-/Begutachter'; $this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Zweitbegutachter'; $this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Fehler beim Ermitteln des Enduplaods der Projektarbeit'; -$this->phrasen['abgabetool/uploadedDocumentNotSigned']='Warning! The uploaded document is not signed DE'; +$this->phrasen['abgabetool/uploadedDocumentNotSigned']='Warnung! Das hochgeladene Dokument ist nicht signiert'; ?> From 94a1534c14e3ec3781adef1be5db921b0e29c68e Mon Sep 17 00:00:00 2001 From: Paolo Date: Mon, 23 May 2022 14:42:59 +0200 Subject: [PATCH 005/131] - Warning Wrap on small Screens in Leturer side - Perform Signatur Check only on Files from Type Endupload --- cis/private/lehre/abgabe_lektor_details.php | 57 ++++++++++++-------- cis/private/lehre/abgabe_student_details.php | 28 +++------- 2 files changed, 40 insertions(+), 45 deletions(-) diff --git a/cis/private/lehre/abgabe_lektor_details.php b/cis/private/lehre/abgabe_lektor_details.php index 29a1221af..f0a19c89a 100644 --- a/cis/private/lehre/abgabe_lektor_details.php +++ b/cis/private/lehre/abgabe_lektor_details.php @@ -548,6 +548,8 @@ $htmlstr .= " $result=@$db->db_query($qry); while ($row=@$db->db_fetch_object($result)) { + $uploadedDocumentSigned = null; + $htmlstr .= "
\n"; $htmlstr .= "\n"; $htmlstr .= "\n"; @@ -649,43 +651,52 @@ $result=@$db->db_query($qry); { $htmlstr .= "     "; } - if(file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) - { - $uploadedDocumentSigned = null; - // Check if the document is signed - $signList = SignatureLib::list(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf'); - if (is_array($signList) && count($signList) > 0) + if (file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf')) + { + if ($row->paabgabetyp_kurzbz == 'end') { - // The document is signed - } - elseif ($signList === null) - { - $uploadedDocumentSigned = 'WARNING: signature server error'; - } - else - { - $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + // Check if the document is signed + $signList = SignatureLib::list(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf'); + if (is_array($signList) && count($signList) > 0) + { + // The document is signed + } + elseif ($signList === null) + { + $uploadedDocumentSigned = 'WARNING: signature server error'; + } + else + { + $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); + } } $htmlstr .= " PDF - "; - if ($uploadedDocumentSigned != null) - { - $htmlstr .= '
- '.$uploadedDocumentSigned.' -
'; - } - $htmlstr .= ""; + + "; } else { $htmlstr .= "     "; } + $htmlstr .= " \n"; + if ($uploadedDocumentSigned != null) + { + $htmlstr .= ' + + + +
+ '.$uploadedDocumentSigned.' +
+ + '; + } $htmlstr .= "
\n"; } diff --git a/cis/private/lehre/abgabe_student_details.php b/cis/private/lehre/abgabe_student_details.php index 949749a3b..ed29519ff 100644 --- a/cis/private/lehre/abgabe_student_details.php +++ b/cis/private/lehre/abgabe_student_details.php @@ -282,41 +282,25 @@ if($command=="update" && $error!=true) $extensions = explode(".", $_FILES['datei']['name']); if(strtoupper(end($extensions))=='PDF') { - if($paabgabetyp_kurzbz!='end') + if ($paabgabetyp_kurzbz != 'end') { //"normaler" Upload move_uploaded_file($_FILES['datei']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); - if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) - { - // Check if the document is signed - $signList = SignatureLib::list(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); - if (is_array($signList) && count($signList) > 0) - { - // The document is signed - } - elseif ($signList === null) - { - $uploadedDocumentSigned = 'WARNING: signature server error'; - } - else - { - $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned'); - } - } - else + if (!file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) { echo $p->t('global/dateiNichtErfolgreichHochgeladen'); } } - else + else // endupload type { //Upload der Endabgabe - Eingabe der Zusatzdaten $command='add'; - if(!$error) + if (!$error) { move_uploaded_file($_FILES['datei']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); } - if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) + + if (file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) { // Check if the document is signed $signList = SignatureLib::list(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); From c354c69e212be33093bf27000ca9efa54a891e44 Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 24 May 2022 11:23:48 +0200 Subject: [PATCH 006/131] Fixed Zwischenabgabe file upload --- cis/private/lehre/abgabe_student_details.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cis/private/lehre/abgabe_student_details.php b/cis/private/lehre/abgabe_student_details.php index ed29519ff..f91f410ab 100644 --- a/cis/private/lehre/abgabe_student_details.php +++ b/cis/private/lehre/abgabe_student_details.php @@ -286,7 +286,19 @@ if($command=="update" && $error!=true) { //"normaler" Upload move_uploaded_file($_FILES['datei']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'); - if (!file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) + if (file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf')) + { + exec('chmod 640 "'.PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'.'"'); + + $qry="UPDATE campus.tbl_paabgabe SET + abgabedatum = now(), + updatevon = ".$db->db_add_param($user).", + updateamum = now() + WHERE paabgabe_id=".$db->db_add_param($paabgabe_id, FHC_INTEGER); + $result=$db->db_query($qry); + echo $p->t('global/dateiErfolgreichHochgeladen'); + } + else { echo $p->t('global/dateiNichtErfolgreichHochgeladen'); } From 7f2025c41405f261fa103ea4a242730c056f1c0f Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 24 May 2022 11:27:24 +0200 Subject: [PATCH 007/131] Added signature config entries to config/cis.config-default.inc.php --- config/cis.config-default.inc.php | 17 +++++++++++++++++ config/vilesci.config-default.inc.php | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/config/cis.config-default.inc.php b/config/cis.config-default.inc.php index 9d31548f6..d6f920259 100644 --- a/config/cis.config-default.inc.php +++ b/config/cis.config-default.inc.php @@ -204,6 +204,23 @@ define('TABLE_ID','_id'); define('TABLE_BEGIN','tbl_'); define('VIEW_BEGIN','vw_'); +/** + * Signatur + * DEFAULT: https://signatur.example.com/api/sign + */ +// Generic URL +define('SIGNATUR_URL', 'https://signatur.dev.technikum-wien.at/api'); +// Sign API +define('SIGNATUR_SIGN_API', 'sign'); +// List API +define('SIGNATUR_LIST_API', 'list'); +// User für Zugriff auf Signaturserver +define('SIGNATUR_USER', 'fhcomplete'); +// Passwort für Zugriff auf Signaturserver +define('SIGNATUR_PASSWORD', 'supersecretpassword'); +// Signaturprofil das verwendet werden soll +define('SIGNATUR_DEFAULT_PROFILE', 'FHC_AMT_GROSS_DE'); + //Gibt an, ob das Studienbuchblatt im CIS gedruckt werden kann define('CIS_DOKUMENTE_STUDIENBUCHLBATT_DRUCKEN',true); diff --git a/config/vilesci.config-default.inc.php b/config/vilesci.config-default.inc.php index a3e4cbece..c4232b020 100644 --- a/config/vilesci.config-default.inc.php +++ b/config/vilesci.config-default.inc.php @@ -195,7 +195,7 @@ define('SIGNATUR_LIST_API', 'list'); // User für Zugriff auf Signaturserver define('SIGNATUR_USER', 'fhcomplete'); // Passwort für Zugriff auf Signaturserver -define('SIGNATUR_PASSWORD', 'Fhcomplet3Signature!'); +define('SIGNATUR_PASSWORD', 'supersecretpassword'); // Signaturprofil das verwendet werden soll define('SIGNATUR_DEFAULT_PROFILE', 'FHC_AMT_GROSS_DE'); From 8880e07bf20d1332455a4a598e5cd44a4d42be8d Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 24 May 2022 12:22:30 +0200 Subject: [PATCH 008/131] include/dokument_export.class.php now checks the new signature server response structure --- include/dokument_export.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/dokument_export.class.php b/include/dokument_export.class.php index 3a6e57657..7d797cb21 100644 --- a/include/dokument_export.class.php +++ b/include/dokument_export.class.php @@ -559,18 +559,19 @@ class dokument_export curl_close($ch); $resultdata = json_decode($result); - if (isset($resultdata->success) && $resultdata->success == 'true') + // If it is success + if (isset($resultdata->error) && $resultdata->error == 0) { $this->signed_filename = $this->temp_folder .'/signed.pdf'; - file_put_contents($this->signed_filename, base64_decode($resultdata->document)); + file_put_contents($this->signed_filename, base64_decode($resultdata->retval)); return true; } - else + else // otherwise if it is an error { - if(isset($resultdata->errormsg)) - $this->errormsg = $resultdata->errormsg; + if(isset($resultdata->retval)) + $this->errormsg = $resultdata->retval; else - $this->errormsg = 'Unknown Error:'.print_r($resultdata,true); + $this->errormsg = 'Unknown Error:'.print_r($resultdata, true); return false; } } From 9b3b571bd9127dc5e18dcc806574107e53f7218b Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 6 Oct 2022 08:55:11 +0200 Subject: [PATCH 009/131] Erweiterung Phrasen --- locale/de-AT/benotungstool.php | 1 + locale/en-US/benotungstool.php | 1 + 2 files changed, 2 insertions(+) diff --git a/locale/de-AT/benotungstool.php b/locale/de-AT/benotungstool.php index 3c8063936..a38aa31f3 100644 --- a/locale/de-AT/benotungstool.php +++ b/locale/de-AT/benotungstool.php @@ -171,6 +171,7 @@ $this->phrasen['benotungstool/zeunis']='Zeugnis'; $this->phrasen['benotungstool/handbuch']='Handbuch'; $this->phrasen['benotungstool/punkte']='Punkte'; $this->phrasen['benotungstool/importAnweisung']='Kopieren Sie die Spalten Personenkennzeichen und Note aus der Notenliste (bzw. StudentenUid und Note aus dem MoodleExport) und fügen Sie diese in folgendes Feld ein'; +$this->phrasen['benotungstool/importAnweisungNachp']='Kopieren Sie die Spalten Personenkennzeichen, Datum und Note aus der Notenliste (bzw. StudentenUid, Datum und Note aus dem MoodleExport) und fügen Sie diese in folgendes Feld ein'; $this->phrasen['benotungstool/pruefung']='Prüfung'; $this->phrasen['benotungstool/notenlisteImport']='Notenliste für den LV-Noten-Import (Excel)'; $this->phrasen['benotungstool/bearbeitetvon']='Bearbeitet von'; diff --git a/locale/en-US/benotungstool.php b/locale/en-US/benotungstool.php index 17f78d2ba..72f29256e 100644 --- a/locale/en-US/benotungstool.php +++ b/locale/en-US/benotungstool.php @@ -170,6 +170,7 @@ $this->phrasen['benotungstool/zeunis']='Transcript'; $this->phrasen['benotungstool/handbuch']='Handbook'; $this->phrasen['benotungstool/punkte']='Points'; $this->phrasen['benotungstool/importAnweisung']='Copy the columns "personal identifier" and "grade" from the grade list (or "student ID number" and "grade" from the moodle export file) and insert them in the following field'; +$this->phrasen['benotungstool/importAnweisungNachp']='Copy the columns "personal identifier", "date" and "grade" from the grade list (or "student ID number", "date" and "grade" from the moodle export file) and insert them in the following field'; $this->phrasen['benotungstool/pruefung']='Examination'; $this->phrasen['benotungstool/notenlisteImport']='Grade list for the subject grade import (Excel)'; $this->phrasen['benotungstool/geaenderteNotenVorhanden']='There are changed grades. Please send the changes to the assistant by clicking "Approval"'; From 54411f4de776fe238e6bd78d5b570f5f1e371bfb Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 12 Oct 2022 15:06:07 +0200 Subject: [PATCH 010/131] Benotungstool: Importfunktion Termin2 --- .../benotungstool/lvgesamtnoteverwalten.php | 144 ++++++- .../benotungstool/nachpruefungeintragen.php | 390 +++++++++++------- 2 files changed, 392 insertions(+), 142 deletions(-) diff --git a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php index 916f2b4e3..6a160c646 100644 --- a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php +++ b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php @@ -402,6 +402,7 @@ foreach ($noten_obj->result as $row) url += '&typ='+typ; url += '&'+ts; + $.ajax({ type:"GET", url: url, @@ -602,6 +603,42 @@ foreach ($noten_obj->result as $row) $('#noteimporttextarea').focus(); } + // **** + // * Oeffnet ein Fenster fuer den Import von Noten für die Nachprüfung aus dem Excel + // **** + function GradeImportNachp() + { + var str = "
"; + str += ""; + var anlegendiv = document.getElementById("nachpruefung_div"); + var y = getOffset('y'); y = y+50; anlegendiv.style.top = y+"px"; + str += ''; + str += ''; + str += "
X
t('benotungstool/importAnweisungNachp');?>:
' onclick='saveGradeBulkNachp(\"Termin2\");'>"; + str += "
"; + anlegendiv.innerHTML = str; + anlegendiv.style.visibility = "visible"; + $('#noteimporttextareaNachp').focus(); + } + + // **** + // * Oeffnet ein Fenster fuer den Import von Noten für Termin3 aus dem Excel + // **** + function GradeImportTermin3() + { + var str = "
"; + str += ""; + var anlegendiv = document.getElementById("nachpruefung_div"); + var y = getOffset('y'); y = y+50; anlegendiv.style.top = y+"px"; + str += ''; + str += ''; + str += "
X
t('benotungstool/importAnweisungNachp');?>:
' onclick='saveGradeBulkNachp(\"Termin3\");'>"; + str += "
"; + anlegendiv.innerHTML = str; + anlegendiv.style.visibility = "visible"; + $('#noteimporttextareaTermin3').focus(); + } + // Speichert die Noten ueber den Import function saveGradeBulk() { @@ -698,6 +735,105 @@ foreach ($noten_obj->result as $row) } } + // Speichert die Noten der Nachprüfung ueber den Import + function saveGradeBulkNachp(typ) + { + data = $('#noteimporttextareaNachp').val(); + closeDiv(); + + //Reihen ermitteln + var rows = data.split("\n"); + var i=0; + var params=''; + alertMsg = ''; + + var gradedata = {}; + var validGrades = ''; + + result as $row_note) + { + if ($row_note->lehre && $row_note->aktiv) + $gradesArray[] = '"' . $row_note->anmerkung . '"'; + } + // Output JS variable with valid grades + echo 'var validGrades = [' . implode(',', $gradesArray) . '];'; + } + ?> + + for(row in rows) + { + zeile = rows[row].split(" "); + + + + if (zeile[0]!='' && zeile[1]!='' && zeile[2]!='') + { + gradedata['student_uid_'+i]=zeile[0]; + gradedata['datumNachp_'+i]=zeile[1]; + + + i++; + } + } + + if (alertMsg != "") + alert(alertMsg); + + if (i>0) + { + + var jetzt = new Date(); + var ts = jetzt.getTime(); + var url= ''; + url += '&sammel=1'; + url += '&typ=' + typ; + url += '&submit=1&'+ts; + $.ajax({ + type:"POST", + url: url, + data: gradedata, + success:function(result) + { + var resp = result; + if (resp!='') + { + alert(resp); + } + window.location.reload(); + }, + error:function(result) + { + alert('Request Nachprüfung fehlgeschlagen'); + } + }); + + } + else + { + alert('t('benotungstool/hilfeImport');?>'); + } + } + //--> @@ -1052,11 +1188,15 @@ $htmlstring .= "" . $p->t('benotungstool/punkte') . ' / ' . $p->t('benotungs if (defined('CIS_GESAMTNOTE_PRUEFUNG_TERMIN2') && CIS_GESAMTNOTE_PRUEFUNG_TERMIN2) { - $htmlstring .= "" . $p->t('benotungstool/nachpruefung') . ""; + $htmlstring .= "
" . $p->t('benotungstool/nachpruefung') . "
+ + "; } if (defined('CIS_GESAMTNOTE_PRUEFUNG_TERMIN3') && CIS_GESAMTNOTE_PRUEFUNG_TERMIN3) { - $htmlstring .= "" . $p->t('benotungstool/nachpruefung2') . ""; + $htmlstring .= "
" . $p->t('benotungstool/nachpruefung') . "
+ + "; } if (defined('CIS_GESAMTNOTE_PRUEFUNG_KOMMPRUEF') && CIS_GESAMTNOTE_PRUEFUNG_KOMMPRUEF) { diff --git a/cis/private/lehre/benotungstool/nachpruefungeintragen.php b/cis/private/lehre/benotungstool/nachpruefungeintragen.php index 0ad985e76..81545a7f6 100644 --- a/cis/private/lehre/benotungstool/nachpruefungeintragen.php +++ b/cis/private/lehre/benotungstool/nachpruefungeintragen.php @@ -41,10 +41,15 @@ require_once('../../../../include/benutzerfunktion.class.php'); require_once('../../../../include/benutzer.class.php'); require_once('../../../../include/student.class.php'); require_once('../../../../include/notenschluessel.class.php'); +require_once('../../../../include/phrasen.class.php'); + if (!$db = new basis_db()) die('Fehler beim Herstellen der Datenbankverbindung'); +$sprache = getSprache(); +$p = new phrasen($sprache); + $user = get_uid(); if(!check_lektor($user)) @@ -52,6 +57,7 @@ if(!check_lektor($user)) $lehreinheit_id=''; +$lehreinheit_id_pr=''; if(isset($_GET['lvid']) && is_numeric($_GET['lvid'])) //Lehrveranstaltung_id $lvid = $_GET['lvid']; @@ -62,60 +68,17 @@ if(isset($_GET['lehreinheit_id']) && is_numeric($_GET['lehreinheit_id'])) //Lehr $lehreinheit_id = $_GET['lehreinheit_id']; if(isset($_GET['lehreinheit_id_pr']) && is_numeric($_GET['lehreinheit_id_pr'])) //Lehreinheit_id der pruefung - $lehreinheit_id = $_GET['lehreinheit_id_pr']; - -if(isset($_GET['datum'])) -{ - $datum = $_GET['datum']; - $datum_obj = new datum(); - $datum = $datum_obj->checkformatDatum($datum, 'Y-m-d', true) OR die('Invalid date format'); -} -else - die('Fehlerhafte Parameteruebergabe'); - -//Laden der Lehrveranstaltung -$lv_obj = new lehrveranstaltung(); -if(!$lv_obj->load($lvid)) - die($lv_obj->errormsg); - -//Studiengang laden -$stg_obj = new studiengang($lv_obj->studiengang_kz); + $lehreinheit_id_pr = $_GET['lehreinheit_id_pr']; if(isset($_GET['stsem'])) $stsem = $_GET['stsem']; else $stsem = ''; - -$uebung_id = (isset($_GET['uebung_id'])?$_GET['uebung_id']:''); -$uid = (isset($_GET['uid'])?$_GET['uid']:''); - //Studiensemester laden $stsem_obj = new studiensemester(); if($stsem=='') $stsem = $stsem_obj->getaktorNext(); -$student_uid = $_REQUEST["student_uid"]; - -$note = $_REQUEST["note"]; -if(isset($_REQUEST['punkte'])) - $punkte = $_REQUEST['punkte']; -else - $punkte = ''; - -$punkte = str_replace(',','.',$punkte); - -if($punkte!='') -{ - // Bei Punkteeingabe wird die Note nochmals geprueft und ggf korrigiert - $notenschluessel = new notenschluessel(); - $note_pruef = $notenschluessel->getNote($punkte, $lvid, $stsem); - if($note_pruef!=$note) - { - $note = $note_pruef; - $note_dirty=true; - } -} - if(!isset($_GET['typ'])) { $typ='Termin2'; @@ -128,16 +91,151 @@ else die('Typ ist ungueltig'); } -if($note=='') - $note = 9; - -$old_note = $note; - -// lvgesamtnote für studenten speichern -if (isset($_REQUEST["submit"]) && ($_REQUEST["student_uid"] != '') ) +if (isset($_REQUEST['sammel']) && $_REQUEST["sammel"] == 1) +{ + foreach ($_POST as $row=>$val) + { + if(mb_strstr(mb_strtolower($row), 'student_uid_')) + { + $id=mb_substr($row, mb_strlen('student_uid_')); + + $student_uid = $_POST['student_uid_'.$id]; + $note = null; + $punkte = null; + $datum = null; + if(isset($_POST['note_'.$id])) + $note = $_POST['note_'.$id]; + elseif(isset($_POST['punkte_'.$id])) + $punkte = $_POST['punkte_'.$id]; + else + { + $response.="\nNote oder Punkte fehlen"; + continue; + } + $punkte=str_replace(',','.', $punkte); + + $datum = $_POST['datumNachp_'.$id]; + + // //check ob Matrikelnummer anstelle der student_uid übergeben wurde + // + // + // $student = new student(); + // + // + // $response2 = true; + // if (!$student->checkIfValidStudentUID($student_uid)) + // { + // //UID ermitteln + // if(!$student_uid = $student->getUidFromMatrikelnummer($student_uid)) + // { + // $response2 = false; + // $response2.="\n".$p->t('benotungstool/studentMitMatrikelnummerExistiertNicht',array($student_uid)); + // continue; + // } + // } + + + $lehreinheit_id = getLehreinheit($db, $lvid, $student_uid, $stsem); + + if(isset($_POST['student_uid_'.$id]) && (isset($_POST['note_'.$id]) || isset($_POST['punkte_'.$id])) && isset($_POST['datumNachp_'.$id])) + { + // echo "\ndb " . " lvid ". $lvid . " note " . $note . " student_uid " . $student_uid . " datum " . $datum . " studiensem " . + // $stsem . " lehreinheit_id_pr " . $lehreinheit_id . " typ " . $typ . "\n"; + + $response = savePruefung($lvid, $student_uid, $stsem, $lehreinheit_id, $datum, $typ, $note, $punkte); + + echo "\ndb " . " lvid ". $lvid . " note " . $note . " student_uid " . $student_uid . " datum " . $datum . " studiensem " . + $stsem . " lehreinheit_id_pr " . $lehreinheit_id . " typ " . $typ . " response" . $response . "\n"; + // echo $response; + + } + else + { + echo "\n fehlende oder fehlerhafte Inputparameter"; + } + } + } + +} +else +{ + // Einzelupdate + + if(isset($_GET['datum']) ) + { + $datum = $_GET['datum']; + $datum_obj = new datum(); + $datum = $datum_obj->checkformatDatum($datum, 'Y-m-d', true) OR die('Invalid date format'); + } + + // echo "Variante Einzel"; + else + die('Fehlerhafte Parameteruebergabe'); + + $student_uid = $_REQUEST["student_uid"]; + + $note = $_REQUEST["note"]; + if(isset($_REQUEST['punkte'])) + $punkte = $_REQUEST['punkte']; + else + $punkte = ''; + + $punkte = str_replace(',','.',$punkte); + + if($punkte!='') + { + // Bei Punkteeingabe wird die Note nochmals geprueft und ggf korrigiert + $notenschluessel = new notenschluessel(); + $note_pruef = $notenschluessel->getNote($punkte, $lvid, $stsem); + if($note_pruef!=$note) + { + $note = $note_pruef; + $note_dirty=true; + } + } + + if($note=='') + $note = 9; + + $old_note = $note; + + //Laden der Lehrveranstaltung + $lv_obj = new lehrveranstaltung(); + if(!$lv_obj->load($lvid)) + die($lv_obj->errormsg); + + //Studiengang laden + $stg_obj = new studiengang($lv_obj->studiengang_kz); + + $uebung_id = (isset($_GET['uebung_id'])?$_GET['uebung_id']:''); + $uid = (isset($_GET['uid'])?$_GET['uid']:''); + + // lvgesamtnote für studenten speichern + if (isset($_REQUEST["submit"]) && ($_REQUEST["student_uid"] != '') ) + { + // Die Pruefung muss einer Lehreinheit zugeordnet werden + // deshalb wird hier versucht eine passende Lehreinheit zu ermitteln. + + $lehreinheit_id = getLehreinheit($db, $lvid, $student_uid, $stsem); + + $response = savePruefung($lvid, $student_uid, $stsem, $lehreinheit_id, $datum, $typ, $note); + echo $response; + } + else + echo "Fehler beim Eintragen der Prüfungen"; + +} + +/** + * Berechnet Lehreinheit auf Basis LV-Daten + * @param string $db Datenbankvariable + * @param string $student_uid student_uid + * @param int $lvid Lehrveranstaltungsid + * @param string $stsem Studiensemester im Format 'WSYYYY' + * @return String LehreinheitId + */ +function getLehreinheit($db, $lvid, $student_uid, $stsem) { - // Die Pruefung muss einer Lehreinheit zugeordnet werden - // deshalb wird hier versucht eine passende Lehreinheit zu ermitteln. $le_arr = array(); $qry_stud = "SELECT lehreinheit_id, lehrform_kurzbz FROM @@ -158,104 +256,117 @@ if (isset($_REQUEST["submit"]) && ($_REQUEST["student_uid"] != '') ) } } - if (!in_array($lehreinheit_id,$le_arr)) + //if (!in_array($lehreinheit_id,$le_arr)) $lehreinheit_id = $le_arr[0]; + return $lehreinheit_id; +} + +/** + * Prüfung speichern + */ +function savePruefung($lvid, $student_uid, $stsem, $lehreinheit_id, $datum, $typ, $note, $punkte=null) +{ $jetzt = date("Y-m-d H:i:s"); + global $user; //, $note, $punkte, $datum; - $pr = new Pruefung(); - - // Wenn eine Pruefung angelegt wird, wird zuerst eine Pruefung mit 1. Termin angelegt - // und dort die Zeugnisnote gespeichert - if($pr->getPruefungen($student_uid, "Termin1", $lvid, $stsem)) + if ($typ == "Termin2") { - if ($pr->result) + $pr = new Pruefung(); + // Wenn eine Pruefung angelegt wird, wird zuerst eine Pruefung mit 1. Termin angelegt + // und dort die Zeugnisnote gespeichert + if($pr->getPruefungen($student_uid, "Termin1", $lvid, $stsem)) { - $termin1 = 1; - } - else - { - $lvnote = new lvgesamtnote(); - if ($lvnote->load($lvid, $student_uid, $stsem)) + if ($pr->result) { - $pr_note = $lvnote->note; - $pr_punkte = $lvnote->punkte; - $benotungsdatum = $lvnote->benotungsdatum; + $termin1 = 1; } else { - $pr_note = 9; - $pr_punkte = ''; - $benotungsdatum = $jetzt; + $lvnote = new lvgesamtnote(); + if ($lvnote->load($lvid, $student_uid, $stsem)) + { + $pr_note = $lvnote->note; + $pr_punkte = $lvnote->punkte; + $benotungsdatum = $lvnote->benotungsdatum; + } + else + { + $pr_note = 9; + $pr_punkte = ''; + $benotungsdatum = $jetzt; + } + + $pr_1 = new Pruefung(); + $pr_1->lehreinheit_id = $lehreinheit_id; + $pr_1->student_uid = $student_uid; + $pr_1->mitarbeiter_uid = $user; + $pr_1->note = $pr_note; + $pr_1->punkte = $pr_punkte; + $pr_1->pruefungstyp_kurzbz = "Termin1"; + $pr_1->datum = $benotungsdatum; + $pr_1->anmerkung = ""; + $pr_1->insertamum = $jetzt; + $pr_1->insertvon = $user; + $pr_1->updateamum = null; + $pr_1->updatevon = null; + $pr_1->ext_id = null; + $pr_1->new = true; + $pr_1->save(); + $response = "neu T1"; } - $pr_1 = new Pruefung(); - $pr_1->lehreinheit_id = $lehreinheit_id; - $pr_1->student_uid = $student_uid; - $pr_1->mitarbeiter_uid = $user; - $pr_1->note = $pr_note; - $pr_1->punkte = $pr_punkte; - $pr_1->pruefungstyp_kurzbz = "Termin1"; - $pr_1->datum = $benotungsdatum; - $pr_1->anmerkung = ""; - $pr_1->insertamum = $jetzt; - $pr_1->insertvon = $user; - $pr_1->updateamum = null; - $pr_1->updatevon = null; - $pr_1->ext_id = null; - $pr_1->new = true; - $pr_1->save(); + $prTermin2 = new Pruefung(); + $pr_2 = new Pruefung(); + + // Die Pruefung wird als Termin2 eingetragen + if ($prTermin2->getPruefungen($student_uid, 'Termin2', $lvid, $stsem)) + { + if ($prTermin2->result) + { + $pr_2->load($prTermin2->result[0]->pruefung_id); + $pr_2->new = null; + $pr_2->updateamum = $jetzt; + $pr_2->updatevon = $user; + $old_note = $pr_2->note; + $pr_2->note = $note; + $pr_2->punkte = $punkte; + $pr_2->datum = $datum; + $pr_2->anmerkung = ""; + $response = "update T2"; + } + else + { + $pr_2->lehreinheit_id = $lehreinheit_id; + $pr_2->student_uid = $student_uid; + $pr_2->mitarbeiter_uid = $user; + $pr_2->note = $note; + $pr_2->punkte = $punkte; + $pr_2->pruefungstyp_kurzbz = $typ; + $pr_2->datum = $datum; + $pr_2->anmerkung = ""; + $pr_2->insertamum = $jetzt; + $pr_2->insertvon = $user; + $pr_2->updateamum = null; + $pr_2->updatevon = null; + $pr_2->ext_id = null; + $pr_2->new = true; + $old_note = -1; + $response = "new T2"; + } + $pr_2->save(); + } } } - - - $prTermin2 = new Pruefung(); - $pr_2 = new Pruefung(); - - // Die Pruefung wird als Termin2 eingetragen - if ($prTermin2->getPruefungen($student_uid, $typ, $lvid, $stsem)) + else { - if ($prTermin2->result) - { - $pr_2->load($prTermin2->result[0]->pruefung_id); - $pr_2->new = null; - $pr_2->updateamum = $jetzt; - $pr_2->updatevon = $user; - $old_note = $pr_2->note; - $pr_2->note = $note; - $pr_2->punkte = $punkte; - $pr_2->datum = $datum; - $pr_2->anmerkung = ""; - } - else - { - $pr_2->lehreinheit_id = $lehreinheit_id; - $pr_2->student_uid = $student_uid; - $pr_2->mitarbeiter_uid = $user; - $pr_2->note = $note; - $pr_2->punkte = $punkte; - $pr_2->pruefungstyp_kurzbz = $typ; - $pr_2->datum = $datum; - $pr_2->anmerkung = ""; - $pr_2->insertamum = $jetzt; - $pr_2->insertvon = $user; - $pr_2->updateamum = null; - $pr_2->updatevon = null; - $pr_2->ext_id = null; - $pr_2->new = true; - $old_note = -1; - } - $pr_2->save(); + $response = "no existing T3"; } - - // Wenn eine Pruefung eingetragen wird, wird danach die LV-Note korrigiert - $jetzt = date("Y-m-d H:i:s"); - - $lvid = $_REQUEST["lvid"]; + //Gesamtnote updaten $lvgesamtnote = new lvgesamtnote(); - if (!$lvgesamtnote->load($lvid, $student_uid, $stsem)) - { + if (!$lvgesamtnote->load($lvid, $student_uid, $stsem)) + { $lvgesamtnote->student_uid = $student_uid; $lvgesamtnote->lehrveranstaltung_id = $lvid; $lvgesamtnote->studiensemester_kurzbz = $stsem; @@ -272,9 +383,9 @@ if (isset($_REQUEST["submit"]) && ($_REQUEST["student_uid"] != '') ) $lvgesamtnote->insertvon = $user; $new = true; $response = "neu"; - } - else - { + } + else + { $lvgesamtnote->note = $note; $lvgesamtnote->punkte = $punkte; $lvgesamtnote->benotungsdatum = $jetzt; @@ -286,12 +397,11 @@ if (isset($_REQUEST["submit"]) && ($_REQUEST["student_uid"] != '') ) else $response = "update"; } + if (!$lvgesamtnote->save($new)) - echo "".$lvgesamtnote->errormsg.""; + return $lvgesamtnote->errormsg; else - echo $response; + return $response; } -else - echo "Fehler beim Eintragen der Prüfungen"; ?> From 035d196ae5cb45b44a4f2f863e7bf5fd0ddbe872 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 13 Oct 2022 08:04:10 +0200 Subject: [PATCH 011/131] Logik Matrikelnummer StudentenId --- .../benotungstool/nachpruefungeintragen.php | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/cis/private/lehre/benotungstool/nachpruefungeintragen.php b/cis/private/lehre/benotungstool/nachpruefungeintragen.php index 81545a7f6..d1a7e2326 100644 --- a/cis/private/lehre/benotungstool/nachpruefungeintragen.php +++ b/cis/private/lehre/benotungstool/nachpruefungeintragen.php @@ -99,6 +99,8 @@ if (isset($_REQUEST['sammel']) && $_REQUEST["sammel"] == 1) { $id=mb_substr($row, mb_strlen('student_uid_')); + $response2 = ''; + $student_uid = $_POST['student_uid_'.$id]; $note = null; $punkte = null; @@ -115,24 +117,21 @@ if (isset($_REQUEST['sammel']) && $_REQUEST["sammel"] == 1) $punkte=str_replace(',','.', $punkte); $datum = $_POST['datumNachp_'.$id]; + $datum_obj = new datum(); + $datum = $datum_obj->checkformatDatum($datum, 'Y-m-d', true) OR die('Invalid date format'); // //check ob Matrikelnummer anstelle der student_uid übergeben wurde - // - // - // $student = new student(); - // - // - // $response2 = true; - // if (!$student->checkIfValidStudentUID($student_uid)) - // { - // //UID ermitteln - // if(!$student_uid = $student->getUidFromMatrikelnummer($student_uid)) - // { - // $response2 = false; - // $response2.="\n".$p->t('benotungstool/studentMitMatrikelnummerExistiertNicht',array($student_uid)); - // continue; - // } - // } + + $student = new student(); + if (!$student->checkIfValidStudentUID($student_uid)) + { + //UID ermitteln + if(!$student_uid = $student->getUidFromMatrikelnummer($student_uid)) + { + $response2.="\n".$p->t('benotungstool/studentMitMatrikelnummerExistiertNicht',array($student_uid)); + continue; + } + } $lehreinheit_id = getLehreinheit($db, $lvid, $student_uid, $stsem); @@ -146,7 +145,7 @@ if (isset($_REQUEST['sammel']) && $_REQUEST["sammel"] == 1) echo "\ndb " . " lvid ". $lvid . " note " . $note . " student_uid " . $student_uid . " datum " . $datum . " studiensem " . $stsem . " lehreinheit_id_pr " . $lehreinheit_id . " typ " . $typ . " response" . $response . "\n"; - // echo $response; + echo $response2; } else @@ -168,7 +167,6 @@ else $datum = $datum_obj->checkformatDatum($datum, 'Y-m-d', true) OR die('Invalid date format'); } - // echo "Variante Einzel"; else die('Fehlerhafte Parameteruebergabe'); From 29fc5181bf237ba65337de647f1180c4d9420b9d Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 13 Oct 2022 10:16:26 +0200 Subject: [PATCH 012/131] Importfunktion Termin3 --- .../benotungstool/lvgesamtnoteverwalten.php | 2 +- .../benotungstool/nachpruefungeintragen.php | 48 +++++++++++++++++-- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php index 6a160c646..80bb7c5a5 100644 --- a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php +++ b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php @@ -1194,7 +1194,7 @@ if (defined('CIS_GESAMTNOTE_PRUEFUNG_TERMIN2') && CIS_GESAMTNOTE_PRUEFUNG_TERMIN } if (defined('CIS_GESAMTNOTE_PRUEFUNG_TERMIN3') && CIS_GESAMTNOTE_PRUEFUNG_TERMIN3) { - $htmlstring .= "
" . $p->t('benotungstool/nachpruefung') . "
+ $htmlstring .= "
" . $p->t('benotungstool/nachpruefung2') . "
"; } diff --git a/cis/private/lehre/benotungstool/nachpruefungeintragen.php b/cis/private/lehre/benotungstool/nachpruefungeintragen.php index d1a7e2326..e8553ce7b 100644 --- a/cis/private/lehre/benotungstool/nachpruefungeintragen.php +++ b/cis/private/lehre/benotungstool/nachpruefungeintragen.php @@ -120,8 +120,7 @@ if (isset($_REQUEST['sammel']) && $_REQUEST["sammel"] == 1) $datum_obj = new datum(); $datum = $datum_obj->checkformatDatum($datum, 'Y-m-d', true) OR die('Invalid date format'); - // //check ob Matrikelnummer anstelle der student_uid übergeben wurde - + //check ob Matrikelnummer anstelle der student_uid übergeben wurde $student = new student(); if (!$student->checkIfValidStudentUID($student_uid)) { @@ -138,9 +137,6 @@ if (isset($_REQUEST['sammel']) && $_REQUEST["sammel"] == 1) if(isset($_POST['student_uid_'.$id]) && (isset($_POST['note_'.$id]) || isset($_POST['punkte_'.$id])) && isset($_POST['datumNachp_'.$id])) { - // echo "\ndb " . " lvid ". $lvid . " note " . $note . " student_uid " . $student_uid . " datum " . $datum . " studiensem " . - // $stsem . " lehreinheit_id_pr " . $lehreinheit_id . " typ " . $typ . "\n"; - $response = savePruefung($lvid, $student_uid, $stsem, $lehreinheit_id, $datum, $typ, $note, $punkte); echo "\ndb " . " lvid ". $lvid . " note " . $note . " student_uid " . $student_uid . " datum " . $datum . " studiensem " . @@ -356,6 +352,48 @@ function savePruefung($lvid, $student_uid, $stsem, $lehreinheit_id, $datum, $typ } } } + elseif ($typ == "Termin3") + { + $prTermin3 = new Pruefung(); + $pr_3 = new Pruefung(); + + if ($prTermin3->getPruefungen($student_uid, 'Termin3', $lvid, $stsem)) + { + if ($prTermin3->result) + { + $pr_3->load($prTermin3->result[0]->pruefung_id); + $pr_3->new = null; + $pr_3->updateamum = $jetzt; + $pr_3->updatevon = $user; + $old_note = $pr_3->note; + $pr_3->note = $note; + $pr_3->punkte = $punkte; + $pr_3->datum = $datum; + $pr_3->anmerkung = ""; + $response = "Prüfung Termin3 aktualisiert"; + } + else + { + $pr_3->lehreinheit_id = $lehreinheit_id; + $pr_3->student_uid = $student_uid; + $pr_3->mitarbeiter_uid = $user; + $pr_3->note = $note; + $pr_3->punkte = $punkte; + $pr_3->pruefungstyp_kurzbz = $typ; + $pr_3->datum = $datum; + $pr_3->anmerkung = ""; + $pr_3->insertamum = $jetzt; + $pr_3->insertvon = $user; + $pr_3->updateamum = null; + $pr_3->updatevon = null; + $pr_3->ext_id = null; + $pr_3->new = true; + $old_note = -1; + $response = "neue Prüfung Termin3"; + } + $pr_3->save(); + } + } else { $response = "no existing T3"; From ce3cea5515721e933b621cf9f2902ddca5aecf21 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 13 Oct 2022 15:36:08 +0200 Subject: [PATCH 013/131] Validierungen Format Datum, Matrikelnr, StudentId, Note --- .../benotungstool/lvgesamtnoteverwalten.php | 61 +++++++++---------- .../benotungstool/nachpruefungeintragen.php | 51 +++++++--------- locale/de-AT/benotungstool.php | 4 +- locale/en-US/benotungstool.php | 1 + 4 files changed, 56 insertions(+), 61 deletions(-) diff --git a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php index 80bb7c5a5..8a428ff2a 100644 --- a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php +++ b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php @@ -20,33 +20,33 @@ * Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > * Manuela Thamer */ -require_once ('../../../../config/cis.config.inc.php'); -require_once ('../../../../config/global.config.inc.php'); -require_once ('../../../../include/functions.inc.php'); -require_once ('../../../../include/lehrveranstaltung.class.php'); -require_once ('../../../../include/studiengang.class.php'); -require_once ('../../../../include/studiensemester.class.php'); -require_once ('../../../../include/lehreinheit.class.php'); -require_once ('../../../../include/benutzerberechtigung.class.php'); -require_once ('../../../../include/uebung.class.php'); -require_once ('../../../../include/beispiel.class.php'); -require_once ('../../../../include/studentnote.class.php'); -require_once ('../../../../include/datum.class.php'); -require_once ('../../../../include/legesamtnote.class.php'); -require_once ('../../../../include/lvgesamtnote.class.php'); -require_once ('../../../../include/zeugnisnote.class.php'); -require_once ('../../../../include/pruefung.class.php'); -require_once ('../../../../include/person.class.php'); -require_once ('../../../../include/benutzer.class.php'); -require_once ('../../../../include/mitarbeiter.class.php'); -require_once ('../../../../include/mail.class.php'); -require_once ('../../../../include/phrasen.class.php'); -require_once ('../../../../include/note.class.php'); -require_once ('../../../../include/notenschluessel.class.php'); -require_once ('../../../../include/studienplan.class.php'); -require_once ('../../../../include/addon.class.php'); -require_once ('../../../../include/mobilitaet.class.php'); -require_once ('../../../../include/student.class.php'); +require_once('../../../../config/cis.config.inc.php'); +require_once('../../../../config/global.config.inc.php'); +require_once('../../../../include/functions.inc.php'); +require_once('../../../../include/lehrveranstaltung.class.php'); +require_once('../../../../include/studiengang.class.php'); +require_once('../../../../include/studiensemester.class.php'); +require_once('../../../../include/lehreinheit.class.php'); +require_once('../../../../include/benutzerberechtigung.class.php'); +require_once('../../../../include/uebung.class.php'); +require_once('../../../../include/beispiel.class.php'); +require_once('../../../../include/studentnote.class.php'); +require_once('../../../../include/datum.class.php'); +require_once('../../../../include/legesamtnote.class.php'); +require_once('../../../../include/lvgesamtnote.class.php'); +require_once('../../../../include/zeugnisnote.class.php'); +require_once('../../../../include/pruefung.class.php'); +require_once('../../../../include/person.class.php'); +require_once('../../../../include/benutzer.class.php'); +require_once('../../../../include/mitarbeiter.class.php'); +require_once('../../../../include/mail.class.php'); +require_once('../../../../include/phrasen.class.php'); +require_once('../../../../include/note.class.php'); +require_once('../../../../include/notenschluessel.class.php'); +require_once('../../../../include/studienplan.class.php'); +require_once('../../../../include/addon.class.php'); +require_once('../../../../include/mobilitaet.class.php'); +require_once('../../../../include/student.class.php'); $summe_stud = 0; $summe_t2 = 0; @@ -190,7 +190,7 @@ foreach ($noten_obj->result as $row) $noten_array[$row->note]['lehre'] = $row->lehre; $noten_array[$row->note]['lkt_ueberschreibbar'] = $row->lkt_ueberschreibbar; $noten_array[$row->note]['anmerkung'] = $row->anmerkung; - foreach ($sprachen->result AS $s) + foreach ($sprachen->result as $s) $noten_array[$row->note]['bezeichnung_mehrsprachig'][$s->sprache] = $row->bezeichnung_mehrsprachig[$s->sprache]; } @@ -376,7 +376,7 @@ foreach ($noten_obj->result as $row) var datum_test = datum.split("."); if (datum_test[0].length != 2 || datum_test[1].length != 2 || datum_test[2].length!=4 || isNaN(datum_test[2]) || datum_test[1]>12 || datum_test[1]<1 || datum_test[0]>31 || datum_test[0]<1) - alert("Invalid Date Format: DD.MM.YYYY"); + alert("Das Datum entspricht nicht dem Format TT.MM.JJJJ!"); else { var anlegendiv = document.getElementById("nachpruefung_div"); @@ -939,7 +939,6 @@ if (defined('CIS_ANWESENHEITSLISTE_NOTENLISTE_ANZEIGEN') && CIS_ANWESENHEITSLIST { $hrefpath = "../notenliste.xls.php?stg=$stg_obj->studiengang_kz&lvid=$lvid&stsem=$stsem"; echo "
" . $p->t('benotungstool/notenlisteImport') . ""; - } // eingetragene lv-gesamtnoten freigeben @@ -1333,7 +1332,6 @@ if (defined("CIS_GESAMTNOTE_PRUEFUNG_MOODLE_LE_NOTE") && CIS_GESAMTNOTE_PRUEFUNG foreach ($grades as $uid => $data) //Ausgabe Array { - $htmlstring .= ' ' . $db->convert_html_chars($uid) . ' @@ -1465,7 +1463,6 @@ if (defined("CIS_GESAMTNOTE_PRUEFUNG_MOODLE_LE_NOTE") && CIS_GESAMTNOTE_PRUEFUNG // Punkte if (CIS_GESAMTNOTE_PUNKTE) { - $htmlstring .= ' $val) + $errorMatrnr = ''; + $errorDatum = ''; + foreach ($_POST as $row => $val) { if(mb_strstr(mb_strtolower($row), 'student_uid_')) { $id=mb_substr($row, mb_strlen('student_uid_')); - $response2 = ''; - $student_uid = $_POST['student_uid_'.$id]; $note = null; $punkte = null; @@ -114,35 +114,36 @@ if (isset($_REQUEST['sammel']) && $_REQUEST["sammel"] == 1) $response.="\nNote oder Punkte fehlen"; continue; } - $punkte=str_replace(',','.', $punkte); + $punkte=str_replace(',', '.', $punkte); $datum = $_POST['datumNachp_'.$id]; + //check Datumsformat + $checkedDatum = $datum; $datum_obj = new datum(); - $datum = $datum_obj->checkformatDatum($datum, 'Y-m-d', true) OR die('Invalid date format'); + if(!$datum = $datum_obj->checkformatDatum($datum, 'Y-m-d', true)) + { + $errorDatum .="\n".$p->t('benotungstool/datumsformatUnzulaessig', array($checkedDatum)); + continue; + } //check ob Matrikelnummer anstelle der student_uid übergeben wurde $student = new student(); if (!$student->checkIfValidStudentUID($student_uid)) { + $checkedMatrnr = $student_uid; //UID ermitteln if(!$student_uid = $student->getUidFromMatrikelnummer($student_uid)) { - $response2.="\n".$p->t('benotungstool/studentMitMatrikelnummerExistiertNicht',array($student_uid)); + $errorMatrnr.="\n".$p->t('benotungstool/studentMitMatrikelnummerExistiertNicht', array($checkedMatrnr)); continue; } } - $lehreinheit_id = getLehreinheit($db, $lvid, $student_uid, $stsem); if(isset($_POST['student_uid_'.$id]) && (isset($_POST['note_'.$id]) || isset($_POST['punkte_'.$id])) && isset($_POST['datumNachp_'.$id])) { $response = savePruefung($lvid, $student_uid, $stsem, $lehreinheit_id, $datum, $typ, $note, $punkte); - - echo "\ndb " . " lvid ". $lvid . " note " . $note . " student_uid " . $student_uid . " datum " . $datum . " studiensem " . - $stsem . " lehreinheit_id_pr " . $lehreinheit_id . " typ " . $typ . " response" . $response . "\n"; - echo $response2; - } else { @@ -150,22 +151,18 @@ if (isset($_REQUEST['sammel']) && $_REQUEST["sammel"] == 1) } } } - + echo $errorMatrnr . $errorDatum; } else { // Einzelupdate - if(isset($_GET['datum']) ) + if(isset($_GET['datum'])) { $datum = $_GET['datum']; $datum_obj = new datum(); - $datum = $datum_obj->checkformatDatum($datum, 'Y-m-d', true) OR die('Invalid date format'); + $datum = $datum_obj->checkformatDatum($datum, 'Y-m-d', true) or die($p->t('benotungstool/datumsformatUnzulaessig', array($checkedDatum))); } - - else - die('Fehlerhafte Parameteruebergabe'); - $student_uid = $_REQUEST["student_uid"]; $note = $_REQUEST["note"]; @@ -174,7 +171,7 @@ else else $punkte = ''; - $punkte = str_replace(',','.',$punkte); + $punkte = str_replace(',', '.', $punkte); if($punkte!='') { @@ -205,11 +202,10 @@ else $uid = (isset($_GET['uid'])?$_GET['uid']:''); // lvgesamtnote für studenten speichern - if (isset($_REQUEST["submit"]) && ($_REQUEST["student_uid"] != '') ) + if (isset($_REQUEST["submit"]) && ($_REQUEST["student_uid"] != '')) { // Die Pruefung muss einer Lehreinheit zugeordnet werden // deshalb wird hier versucht eine passende Lehreinheit zu ermitteln. - $lehreinheit_id = getLehreinheit($db, $lvid, $student_uid, $stsem); $response = savePruefung($lvid, $student_uid, $stsem, $lehreinheit_id, $datum, $typ, $note); @@ -217,7 +213,6 @@ else } else echo "Fehler beim Eintragen der Prüfungen"; - } /** @@ -259,7 +254,7 @@ function getLehreinheit($db, $lvid, $student_uid, $stsem) /** * Prüfung speichern */ -function savePruefung($lvid, $student_uid, $stsem, $lehreinheit_id, $datum, $typ, $note, $punkte=null) +function savePruefung($lvid, $student_uid, $stsem, $lehreinheit_id, $datum, $typ, $note, $punkte = null) { $jetzt = date("Y-m-d H:i:s"); global $user; //, $note, $punkte, $datum; @@ -370,7 +365,7 @@ function savePruefung($lvid, $student_uid, $stsem, $lehreinheit_id, $datum, $typ $pr_3->punkte = $punkte; $pr_3->datum = $datum; $pr_3->anmerkung = ""; - $response = "Prüfung Termin3 aktualisiert"; + $response = "update T3"; } else { @@ -389,14 +384,14 @@ function savePruefung($lvid, $student_uid, $stsem, $lehreinheit_id, $datum, $typ $pr_3->ext_id = null; $pr_3->new = true; $old_note = -1; - $response = "neue Prüfung Termin3"; + $response = "new T3"; } $pr_3->save(); } } else { - $response = "no existing T3"; + $response = "fehlende oder fehlerhafte Inputparameter"; } //Gesamtnote updaten diff --git a/locale/de-AT/benotungstool.php b/locale/de-AT/benotungstool.php index a38aa31f3..b7c2af638 100644 --- a/locale/de-AT/benotungstool.php +++ b/locale/de-AT/benotungstool.php @@ -148,7 +148,9 @@ $this->phrasen['benotungstool/anzahlKommisionellePruefungen']='Anzahl kommission $this->phrasen['benotungstool/pruefungAnlegenFuer']='Prüfung anlegen für'; $this->phrasen['benotungstool/kreuzerltool']='Kreuzerltool'; $this->phrasen['benotungstool/studentIstLvNichtZugeordnet']='Der Student %s %s (%s) ist dieser Lehrveranstaltung nicht zugeordnet. Die Note wird nicht uebernommen!'; -$this->phrasen['benotungstool/studentMitMatrikelnummerExistiertNicht']='Student mit Matrikelnummer %s existiert nicht.'; +$this->phrasen['benotungstool/studentMitMatrikelnummerExistiertNicht']='Student*in mit Matrikelnummer %s existiert nicht.'; +$this->phrasen['benotungstool/datumsformatUnzulaessig']='Das Datum %s entspricht nicht dem Format TT.MM.JJJJ!'; +$this->phrasen['benotungstool/noteUnzulaessig']='Die Note %s ist nicht zulaessig. Die Zeile wurde uebersprungen.'; $this->phrasen['benotungstool/noteNichtUeberschreibbar']='Für Student mit Matrikelnummer %s eingetragene Zeugnisote %s ist nicht überschreibbar'; $this->phrasen['benotungstool/fehlerhafteNoteBeiStudent']='Fehlerhafte Note bei Student %s %s'; $this->phrasen['benotungstool/keineKreuzerllistenFuerDieseLehrveranstaltung']='Derzeit gibt es keine Kreuzerllisten für diese Lehrveranstaltung'; diff --git a/locale/en-US/benotungstool.php b/locale/en-US/benotungstool.php index 72f29256e..1f1dc89c6 100644 --- a/locale/en-US/benotungstool.php +++ b/locale/en-US/benotungstool.php @@ -148,6 +148,7 @@ $this->phrasen['benotungstool/pruefungAnlegenFuer']='Create an examination for ' $this->phrasen['benotungstool/kreuzerltool']='"Kreuzerl" tool'; $this->phrasen['benotungstool/studentIstLvNichtZugeordnet']='Student is not assigned to this course. The grade was not accepted!'; $this->phrasen['benotungstool/studentMitMatrikelnummerExistiertNicht']='Student with student ID number %s does not exist.'; +$this->phrasen['benotungstool/datumsformatUnzulaessig']='The date %s is not in valid format TT.MM.JJJJ.'; $this->phrasen['benotungstool/noteNichtUeberschreibbar']='Transcript grade %2$s for student with Personal identifier %1$s is not rewritable'; $this->phrasen['benotungstool/fehlerhafteNoteBeiStudent']='Incorrect grade for student %s %s'; $this->phrasen['benotungstool/keineKreuzerllistenFuerDieseLehrveranstaltung']='There are currently no checklists for this course'; From 8754c46575f53bccffdcb1ec2dd6d51923fd0b48 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 17 Oct 2022 14:34:11 +0200 Subject: [PATCH 014/131] Refactor Import Termin2 und Termin3 --- .../benotungstool/lvgesamtnoteverwalten.php | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php index 8a428ff2a..b7bb74d54 100644 --- a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php +++ b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php @@ -606,7 +606,7 @@ foreach ($noten_obj->result as $row) // **** // * Oeffnet ein Fenster fuer den Import von Noten für die Nachprüfung aus dem Excel // **** - function GradeImportNachp() + function GradeImportNachp(termin) { var str = "
"; str += ""; @@ -614,31 +614,14 @@ foreach ($noten_obj->result as $row) var y = getOffset('y'); y = y+50; anlegendiv.style.top = y+"px"; str += ''; str += ''; - str += "
X
t('benotungstool/importAnweisungNachp');?>:
' onclick='saveGradeBulkNachp(\"Termin2\");'>"; + + str += "
' onclick='saveGradeBulkNachp(\""+ termin +"\");'>"; str += "
"; anlegendiv.innerHTML = str; anlegendiv.style.visibility = "visible"; $('#noteimporttextareaNachp').focus(); } - // **** - // * Oeffnet ein Fenster fuer den Import von Noten für Termin3 aus dem Excel - // **** - function GradeImportTermin3() - { - var str = "
"; - str += ""; - var anlegendiv = document.getElementById("nachpruefung_div"); - var y = getOffset('y'); y = y+50; anlegendiv.style.top = y+"px"; - str += ''; - str += ''; - str += "
X
t('benotungstool/importAnweisungNachp');?>:
' onclick='saveGradeBulkNachp(\"Termin3\");'>"; - str += "
"; - anlegendiv.innerHTML = str; - anlegendiv.style.visibility = "visible"; - $('#noteimporttextareaTermin3').focus(); - } - // Speichert die Noten ueber den Import function saveGradeBulk() { @@ -1188,13 +1171,13 @@ $htmlstring .= "" . $p->t('benotungstool/punkte') . ' / ' . $p->t('benotungs if (defined('CIS_GESAMTNOTE_PRUEFUNG_TERMIN2') && CIS_GESAMTNOTE_PRUEFUNG_TERMIN2) { $htmlstring .= "
" . $p->t('benotungstool/nachpruefung') . "
- + "; } if (defined('CIS_GESAMTNOTE_PRUEFUNG_TERMIN3') && CIS_GESAMTNOTE_PRUEFUNG_TERMIN3) { $htmlstring .= "
" . $p->t('benotungstool/nachpruefung2') . "
- + "; } if (defined('CIS_GESAMTNOTE_PRUEFUNG_KOMMPRUEF') && CIS_GESAMTNOTE_PRUEFUNG_KOMMPRUEF) From 47d3ab33e78d0fbb68f5e484494a518c7e35033c Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 18 Oct 2022 09:17:07 +0200 Subject: [PATCH 015/131] =?UTF-8?q?Adaptierung=20Vorlage=20Notenliste.xls?= =?UTF-8?q?=20um=20Nachpr=C3=BCfung=20und=20Termin3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../benotungstool/lvgesamtnoteeintragen.php | 21 +++--- .../benotungstool/lvgesamtnoteverwalten.php | 4 +- .../benotungstool/nachpruefungeintragen.php | 1 + cis/private/lehre/notenliste.xls.php | 67 +++++++++++++++++++ locale/de-AT/benotungstool.php | 4 +- locale/en-US/benotungstool.php | 2 +- 6 files changed, 84 insertions(+), 15 deletions(-) diff --git a/cis/private/lehre/benotungstool/lvgesamtnoteeintragen.php b/cis/private/lehre/benotungstool/lvgesamtnoteeintragen.php index 73d0e6fca..8337b7c36 100644 --- a/cis/private/lehre/benotungstool/lvgesamtnoteeintragen.php +++ b/cis/private/lehre/benotungstool/lvgesamtnoteeintragen.php @@ -98,9 +98,9 @@ if($stsem=='') //$note = $_REQUEST["note"]; -if(!$rechte->isBerechtigt('admin',0) && - !$rechte->isBerechtigt('admin',$lv_obj->studiengang_kz) && - !$rechte->isBerechtigt('lehre',$lv_obj->studiengang_kz)) +if(!$rechte->isBerechtigt('admin', 0) && + !$rechte->isBerechtigt('admin', $lv_obj->studiengang_kz) && + !$rechte->isBerechtigt('lehre', $lv_obj->studiengang_kz)) { $qry = "SELECT lehreinheit_id FROM lehre.tbl_lehrveranstaltung JOIN lehre.tbl_lehreinheit USING(lehrveranstaltung_id) JOIN lehre.tbl_lehreinheitmitarbeiter USING(lehreinheit_id) @@ -117,11 +117,11 @@ if(!$rechte->isBerechtigt('admin',0) && } } -function savenote($db,$lvid, $student_uid, $note, $punkte=null) +function savenote($db, $lvid, $student_uid, $note, $punkte = null) { global $stsem, $user, $p, $noten_anmerkung; $jetzt = date("Y-m-d H:i:s"); - $punkte = str_replace(',','.',$punkte); + $punkte = str_replace(',', '.', $punkte); //Ermitteln ob der Student diesem Kurs zugeteilt ist $qry = "SELECT 1 FROM campus.vw_student_lehrveranstaltung WHERE uid=".$db->db_add_param($student_uid)." AND lehrveranstaltung_id=".$db->db_add_param($lvid, FHC_INTEGER); if($result = $db->db_query($qry)) @@ -207,13 +207,12 @@ if (isset($_REQUEST["submit"])) $note = $_REQUEST["note"]; $punkte = (isset($_REQUEST["punkte"])?$_REQUEST["punkte"]:''); - $response = savenote($db,$lvid, $student_uid, $note, $punkte); + $response = savenote($db, $lvid, $student_uid, $note, $punkte); echo $response; } else { - - foreach ($_POST as $row=>$val) + foreach ($_POST as $row => $val) { if(mb_strstr(mb_strtolower($row), 'matrikelnr_')) { @@ -232,7 +231,7 @@ if (isset($_REQUEST["submit"])) $response.="\nNote oder Punkte fehlen"; continue; } - $punkte=str_replace(',','.', $punkte); + $punkte=str_replace(',', '.', $punkte); //check ob statt Matrikelnummer nicht bereits student_uid (Moodle Grade Import) vorliegt.. $student = new student(); @@ -241,7 +240,7 @@ if (isset($_REQUEST["submit"])) //UID ermitteln if(!$student_uid = $student->getUidFromMatrikelnummer($matrikelnummer)) { - $response.="\n".$p->t('benotungstool/studentMitMatrikelnummerExistiertNicht',array($matrikelnummer)); + $response.="\n".$p->t('benotungstool/studentMitMatrikelnummerExistiertNicht', array($matrikelnummer)); continue; } } @@ -268,7 +267,7 @@ if (isset($_REQUEST["submit"])) } } - $val=savenote($db,$lvid, $student_uid, $note, $punkte); + $val=savenote($db, $lvid, $student_uid, $note, $punkte); if($val!='neu' && $val!='update' && $val!='update_f') $response.=$val; } diff --git a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php index b7bb74d54..64179a3e9 100644 --- a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php +++ b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php @@ -749,6 +749,7 @@ foreach ($noten_obj->result as $row) } ?> + for(row in rows) { zeile = rows[row].split(" "); @@ -779,6 +780,7 @@ foreach ($noten_obj->result as $row) } } + if (alertMsg != "") alert(alertMsg); @@ -1306,7 +1308,7 @@ if (defined("CIS_GESAMTNOTE_PRUEFUNG_MOODLE_LE_NOTE") && CIS_GESAMTNOTE_PRUEFUNG foreach ($addon_obj->result as $row) { if (file_exists('../../../../addons/' . $row->kurzbz . '/cis/grades.inc.php')) - include ('../../../../addons/' . $row->kurzbz . '/cis/grades.inc.php'); + include('../../../../addons/' . $row->kurzbz . '/cis/grades.inc.php'); } } } diff --git a/cis/private/lehre/benotungstool/nachpruefungeintragen.php b/cis/private/lehre/benotungstool/nachpruefungeintragen.php index 307c0ca30..290113179 100644 --- a/cis/private/lehre/benotungstool/nachpruefungeintragen.php +++ b/cis/private/lehre/benotungstool/nachpruefungeintragen.php @@ -105,6 +105,7 @@ if (isset($_REQUEST['sammel']) && $_REQUEST["sammel"] == 1) $note = null; $punkte = null; $datum = null; + $response = ''; if(isset($_POST['note_'.$id])) $note = $_POST['note_'.$id]; elseif(isset($_POST['punkte_'.$id])) diff --git a/cis/private/lehre/notenliste.xls.php b/cis/private/lehre/notenliste.xls.php index 74cb7e7c1..4a6817a36 100644 --- a/cis/private/lehre/notenliste.xls.php +++ b/cis/private/lehre/notenliste.xls.php @@ -35,6 +35,7 @@ require_once('../../../include/note.class.php'); require_once('../../../include/notenschluessel.class.php'); require_once('../../../include/Excel/excel.php'); require_once('../../../include/phrasen.class.php'); +require_once('../../../include/pruefung.class.php'); $uid = get_uid(); @@ -191,6 +192,19 @@ else } //Studenten holen + + //Spaltengruppe für Nachprüfung + if (defined('CIS_GESAMTNOTE_PRUEFUNG_TERMIN2') && CIS_GESAMTNOTE_PRUEFUNG_TERMIN2) + { + $worksheet->write($lines,8,$p->t('benotungstool/nachpruefung'),$format_bold); + } + + //Spaltengruppe für 2.Nebensprüfungstermin + if (defined('CIS_GESAMTNOTE_PRUEFUNG_TERMIN3') && CIS_GESAMTNOTE_PRUEFUNG_TERMIN3) + { + $worksheet->write($lines,12,$p->t('benotungstool/nachpruefung2'),$format_bold); + } + $lines++; $worksheet->write($lines,1,$p->t('global/uid'),$format_border_bottom); $worksheet->write($lines,2,$p->t('global/nachname'),$format_border_bottom); @@ -203,6 +217,26 @@ else else $worksheet->write($lines,6,$p->t('benotungstool/note'),$format_border_bottom); + if (defined('CIS_GESAMTNOTE_PRUEFUNG_TERMIN2') && CIS_GESAMTNOTE_PRUEFUNG_TERMIN2) + { + $worksheet->write($lines,8,$p->t('global/uid'),$format_border_bottom); + $worksheet->write($lines,9,$p->t('global/datum'),$format_border_bottom); + if(defined('CIS_GESAMTNOTE_PUNKTE') && CIS_GESAMTNOTE_PUNKTE) + $worksheet->write($lines,10,$p->t('benotungstool/punkte'),$format_border_bottom); + else + $worksheet->write($lines,10,$p->t('benotungstool/note'),$format_border_bottom); + } + + if (defined('CIS_GESAMTNOTE_PRUEFUNG_TERMIN3') && CIS_GESAMTNOTE_PRUEFUNG_TERMIN3) +{ + $worksheet->write($lines,12,$p->t('global/uid'),$format_border_bottom); + $worksheet->write($lines,13,$p->t('global/uid'),$format_border_bottom); + if(defined('CIS_GESAMTNOTE_PUNKTE') && CIS_GESAMTNOTE_PUNKTE) + $worksheet->write($lines,14,$p->t('benotungstool/punkte'),$format_border_bottom); + else + $worksheet->write($lines,14,$p->t('benotungstool/note'),$format_border_bottom); +} + $stsem_obj = new studiensemester(); $stsem_obj->load($stsem); $stsemdatumvon = $stsem_obj->start; @@ -282,6 +316,39 @@ else $worksheet->write($lines,4,'="'.$elem->semester.$elem->verband.$elem->gruppe.'"'); $worksheet->write($lines,5,'="'.trim($elem->matrikelnr).'"',$format_highlight); $worksheet->write($lines,6, $note, $format_highlightright); + + // Nachprüfung + if (defined('CIS_GESAMTNOTE_PRUEFUNG_TERMIN2') && CIS_GESAMTNOTE_PRUEFUNG_TERMIN2) + { + $worksheet->write($lines,8, $elem->uid, $format_highlightright); + $pr = new Pruefung(); + $pr->getPruefungen($elem->uid, "Termin2", $lvid, $sem); + $output2 = $pr->result; + + if ($output2) + { + $resultPr = $output2[0]; + $worksheet->write($lines,9, date('d.m.Y', strtotime($resultPr->datum)), $format_highlightright); + $worksheet->write($lines,10, $resultPr->note, $format_highlightright); + } + } + + // Nachprüfung + if (defined('CIS_GESAMTNOTE_PRUEFUNG_TERMIN3') && CIS_GESAMTNOTE_PRUEFUNG_TERMIN3) + { + $worksheet->write($lines,12, $elem->uid, $format_highlightright); + $pr = new Pruefung(); + $pr->getPruefungen($elem->uid, "Termin3", $lvid, $sem); + $output3 = $pr->result; + + if ($output3) + { + $resultPr = $output3[0]; + $worksheet->write($lines,13, date('d.m.Y', strtotime($resultPr->datum)), $format_highlightright); + $worksheet->write($lines,14, $resultPr->note, $format_highlightright); + } + } + $i++; $lines++; } diff --git a/locale/de-AT/benotungstool.php b/locale/de-AT/benotungstool.php index b7c2af638..feac092f6 100644 --- a/locale/de-AT/benotungstool.php +++ b/locale/de-AT/benotungstool.php @@ -172,8 +172,8 @@ $this->phrasen['benotungstool/eingetrageneNoten']='Eingetragene Noten'; $this->phrasen['benotungstool/zeunis']='Zeugnis'; $this->phrasen['benotungstool/handbuch']='Handbuch'; $this->phrasen['benotungstool/punkte']='Punkte'; -$this->phrasen['benotungstool/importAnweisung']='Kopieren Sie die Spalten Personenkennzeichen und Note aus der Notenliste (bzw. StudentenUid und Note aus dem MoodleExport) und fügen Sie diese in folgendes Feld ein'; -$this->phrasen['benotungstool/importAnweisungNachp']='Kopieren Sie die Spalten Personenkennzeichen, Datum und Note aus der Notenliste (bzw. StudentenUid, Datum und Note aus dem MoodleExport) und fügen Sie diese in folgendes Feld ein'; +$this->phrasen['benotungstool/importAnweisung']='Kopieren Sie die Spalten StudentenUid und Note aus der Notenliste (bzw. StudentenUid und Note aus dem MoodleExport) und fügen Sie diese in folgendes Feld ein'; +$this->phrasen['benotungstool/importAnweisungNachp']='Kopieren Sie die Spalten StudentenUid (bzw. Personenkennzeichen), Datum und Note aus der Notenliste bzw. dem Moodle Export File und fügen Sie diese in folgendes Feld ein'; $this->phrasen['benotungstool/pruefung']='Prüfung'; $this->phrasen['benotungstool/notenlisteImport']='Notenliste für den LV-Noten-Import (Excel)'; $this->phrasen['benotungstool/bearbeitetvon']='Bearbeitet von'; diff --git a/locale/en-US/benotungstool.php b/locale/en-US/benotungstool.php index 1f1dc89c6..f482409d8 100644 --- a/locale/en-US/benotungstool.php +++ b/locale/en-US/benotungstool.php @@ -171,7 +171,7 @@ $this->phrasen['benotungstool/zeunis']='Transcript'; $this->phrasen['benotungstool/handbuch']='Handbook'; $this->phrasen['benotungstool/punkte']='Points'; $this->phrasen['benotungstool/importAnweisung']='Copy the columns "personal identifier" and "grade" from the grade list (or "student ID number" and "grade" from the moodle export file) and insert them in the following field'; -$this->phrasen['benotungstool/importAnweisungNachp']='Copy the columns "personal identifier", "date" and "grade" from the grade list (or "student ID number", "date" and "grade" from the moodle export file) and insert them in the following field'; +$this->phrasen['benotungstool/importAnweisungNachp']='Copy the columns "student ID number" (or "personal identifier"), "date" and "grade" from the grade list or from the moodle export file and insert them in the following field'; $this->phrasen['benotungstool/pruefung']='Examination'; $this->phrasen['benotungstool/notenlisteImport']='Grade list for the subject grade import (Excel)'; $this->phrasen['benotungstool/geaenderteNotenVorhanden']='There are changed grades. Please send the changes to the assistant by clicking "Approval"'; From c7f477555c4e1aada684fde19b6068fbadd1daf7 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 27 Oct 2022 15:17:29 +0200 Subject: [PATCH 016/131] Adaptierungen DB und Dropdowns Fas Lehrveranstaltungen --- .../lehrveranstaltungdetailoverlay.xul.php | 50 +++++++++++++------ include/raumtyp.class.php | 8 ++- rdf/raumtyp.rdf.php | 3 +- system/dbupdate_3.3.php | 16 +++++- 4 files changed, 58 insertions(+), 19 deletions(-) diff --git a/content/lvplanung/lehrveranstaltungdetailoverlay.xul.php b/content/lvplanung/lehrveranstaltungdetailoverlay.xul.php index e18407e72..ed13e1e63 100644 --- a/content/lvplanung/lehrveranstaltungdetailoverlay.xul.php +++ b/content/lvplanung/lehrveranstaltungdetailoverlay.xul.php @@ -199,26 +199,46 @@ $p = new phrasen($sprache);