diff --git a/application/libraries/DocsboxLib.php b/application/libraries/DocsboxLib.php new file mode 100644 index 000000000..f9167c379 --- /dev/null +++ b/application/libraries/DocsboxLib.php @@ -0,0 +1,304 @@ +attach(array('file' => $inputFileName)) + ->expectsJson() + ->send(); + + // Checks that: + // - the response is not empty + // - the reponse body has the property id + // - the property id is a valid string + // - the reponse body has the property status + // - docsbox queued the conversion of the posted file + if (is_object($postFileResponse) + && isset($postFileResponse->body) + && isset($postFileResponse->body->id) + && $postFileResponse->body->id != '' && $postFileResponse->body->id != null + && isset($postFileResponse->body->status) + && $postFileResponse->body->status == self::STATUS_QUEUED) + { + $queueId = $postFileResponse->body->id; + } + else + { + // If docsbox refused to convert the posted file + if (isset($postFileResponse->body->status) + && $postFileResponse->body->status != self::STATUS_QUEUED) + { + error_log( + 'Docsbox did not queue the posted file. Returned status: '. + $postFileResponse->body->status + ); + } + else // any other generic error + { + error_log( + 'An error occurred while posting to docsbox. Response: '. + print_r($postFileResponse, 1) + ); + } + } + } + catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception + { + error_log($cee->getMessage()); + } + catch (Exception $e) // any other exception + { + error_log($e->getMessage()); + } + + return $queueId; + } + + /** + * Check the status of the file convertion identified by the given queue element id + * A URL is returned with the path where it is possible to download the converted file + * If an error occurred then a null value is returned + */ + private static function _checkConvertion($queueId) + { + $resultUrl = null; + $startConvertionsTime = time(); // time when the file conversion has started + + // Until a timeout has occurred + while (time() - $startConvertionsTime <= DOCSBOX_CONVERSION_TIMEOUT) + { + sleep(DOCSBOX_WAITING_SLEEP_TIME); // takes a nap on every round + + try + { + // Calls the docsbox server to check the status of the + // file conversion using the provided queue id + // it expects a response in JSON format + $getStatusResponse = \Httpful\Request::get(DOCSBOX_SERVER.DOCSBOX_PATH_API.$queueId) + ->expectsJson() + ->send(); + + // Checks that: + // - the response is not empty + // - the reponse body has the property id + // - the property id is a valid string + // - the reponse body has the property status + // - docsbox is working the conversion of the posted file + if (is_object($getStatusResponse) + && isset($getStatusResponse->body->id) + && $getStatusResponse->body->id != '' && $getStatusResponse->body->id != null + && isset($getStatusResponse->body->status)) + { + // Checks that docsbox has finished working on the file conversion + // and that there is a valid resultUrl property + if ($getStatusResponse->body->status == self::STATUS_FINISHED + && isset($getStatusResponse->body->result_url) + && $getStatusResponse->body->result_url != '' + && $getStatusResponse->body->result_url != null) + { + $resultUrl = $getStatusResponse->body->result_url; + break; + } + // Just started or still working on it + elseif ($getStatusResponse->body->status == self::STATUS_WORKING + || $getStatusResponse->body->status == self::STATUS_STARTED) + { + // go on! + } + else // any other status is abnormal + { + error_log( + 'Not valid status for queue element: '.$queueId.'. Response: '. + print_r($getStatusResponse, 1) + ); + break; // interrupt the loop on error + } + } + else // if the response from the docsbox server is not valid + { + error_log( + 'An error occurred while checking the docsbox activity. Response: '. + print_r($getStatusResponse, 1) + ); + break; // interrupt the loop on error + } + } + catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception + { + error_log($cee->getMessage()); + break; // interrupt the loop on error + } + catch (Exception $e) // any other exception + { + error_log($e->getMessage()); + break; // interrupt the loop on error + } + } + + return $resultUrl; + } + + /** + * Download the converted file using the provided URL, unzip it, and renames it into the provided file name + */ + private static function _downloadFile($resultUrl, $outputFileName) + { + $downloaded = false; // pessimistic assumption + + try + { + // Download the file + $getFileResponse = \Httpful\Request::get(DOCSBOX_SERVER.$resultUrl)->send(); + + // If the downloaded file content is valid and not empty + if (isset($getFileResponse->body) + && $getFileResponse->body != null + && $getFileResponse->body != '') + { + // Output directory where to unzip the downloaded zip file + $outputDirectory = dirname($outputFileName); + // The path and name of the downloaded zip file + $temporaryDownloadedZip = sys_get_temp_dir().'/'.basename($resultUrl); + + // Write the file content into a temporary directory and file + if (file_put_contents($temporaryDownloadedZip, $getFileResponse->body) != false) + { + $zipArchive = new ZipArchive; + + // Open and extract the dowloaded zip file into the directory of the output file + if ($zipArchive->open($temporaryDownloadedZip) === true + && $zipArchive->extractTo($outputDirectory) === true + && $zipArchive->close() === true) + { + // Opened, extracted and closed! + + // Rename the extracted file to the given output file name + if (rename($outputDirectory.'/'.self::OUTPUT_FILENAME, $outputFileName)) + { + $downloaded = true; + } + else + { + error_log( + 'An error occurred while renaming the extracted file: '. + $outputDirectory.'/'.self::OUTPUT_FILENAME.' into: '. + $outputFileName + ); + } + } + else + { + error_log( + 'An error occurred while working the dowloaded zip file: '. + $temporaryDownloadedZip + ); + } + } + else // if an error occurred while writing + { + error_log( + 'An error occurred while writing the file content to: '. + $temporaryDownloadedZip + ); + } + } + else // if the downloaded file is not valid + { + error_log( + 'An error occurred while downloading the file from the docsbox server: '. + print_r($getFileResponse, 1) + ); + } + } + catch(\Httpful\Exception\ConnectionErrorException $cee) + { + error_log($cee->getMessage()); + } + catch (Exception $e) + { + error_log($e->getMessage()); + } + + return $downloaded; + } +} + diff --git a/application/libraries/DocumentLib.php b/application/libraries/DocumentLib.php index 98e546b4e..c1dd21c29 100644 --- a/application/libraries/DocumentLib.php +++ b/application/libraries/DocumentLib.php @@ -14,20 +14,28 @@ class DocumentLib // Gets CI instance $this->ci =& get_instance(); - exec('unoconv --version', $ret_arr); - - if(isset($ret_arr[0])) + // Which document converter has to be used + if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true) { - $hlp = explode(' ', $ret_arr[0]); - if(isset($hlp[1])) - { - $this->unoconv_version = $hlp[1]; - } - else - show_error('Could not get Unoconv Version'); + // Use docsbox!! } else - show_error('Unoconv not found - Please install Unoconv'); + { + exec('unoconv --version', $ret_arr); + + if(isset($ret_arr[0])) + { + $hlp = explode(' ', $ret_arr[0]); + if(isset($hlp[1])) + { + $this->unoconv_version = $hlp[1]; + } + else + show_error('Could not get Unoconv Version'); + } + else + show_error('Unoconv not found - Please install Unoconv'); + } } /** @@ -57,9 +65,16 @@ class DocumentLib case 'application/vnd.ms-word': case 'application/vnd.oasis.opendocument.text': case 'text/plain': - // Unoconv Version 0.6 seems to fail on converting TXT Files - if ($this->unoconv_version == '0.6') - return error(); + if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true) + { + // Use docsbox + } + else + { + // Unoconv Version 0.6 seems to fail on converting TXT Files + if ($this->unoconv_version == '0.6') + return error(); + } $ret = $this->convert($filename, $outFile, 'pdf'); if(isSuccess($ret)) @@ -105,6 +120,7 @@ class DocumentLib finfo_close($finfo); + $out = null; exec($cmd, $out, $ret); if ($ret != 0) { @@ -123,13 +139,26 @@ class DocumentLib */ public function convert($inFile, $outFile, $format) { - if ($this->unoconv_version == '0.6') - $command = 'unoconv -f %1$s %3$s > %2$s'; - else - $command = 'unoconv -f %s --output %s %s 2>&1'; - $command = sprintf($command, $format, $outFile, $inFile); + $ret = 0; - exec($command, $out, $ret); + // If it is set to use docsbox + if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true) + { + require_once(dirname(__FILE__).'/../application/libraries/DocsboxLib.php'); + + $ret = DocsboxLib::convert($inFile, $outFile, $format); + } + else // otherwise use unoconv + { + if ($this->unoconv_version == '0.6') + $command = 'unoconv -f %1$s %3$s > %2$s'; + else + $command = 'unoconv -f %s --output %s %s 2>&1'; + $command = sprintf($command, $format, $outFile, $inFile); + + $out = null; + exec($command, $out, $ret); + } if ($ret != 0) { @@ -191,6 +220,7 @@ class DocumentLib $cmd .= '/countspaces { [ exch { dup 32 ne { pop } if } forall ] length } bind def >> '; $cmd .= 'setpagedevice viewJPEG"'; + $out = null; exec($cmd, $out, $ret); if ($ret != 0) { diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index b987102dd..04192a7b4 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -128,8 +128,8 @@ class Messages_model extends CI_Model { $ouOptions .= sprintf( "\n".'', - is_numeric($ou->prestudent_id) ? $ou->oe_kurzbz : self::ALT_OE, - $ou->bezeichnung . (is_numeric($ou->prestudent_id) ? '' : ' *') + ($ou->typ === 'l' ? $ou->oe_kurzbz : (is_numeric($ou->prestudent_id) ? $ou->oe_kurzbz : self::ALT_OE)), + $ou->bezeichnung . ((is_numeric($ou->prestudent_id) || $ou->typ === 'l' ) ? '' : ' *') ); } } diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php index d05b63303..7b24b8769 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -586,9 +586,10 @@ class Prestudent_model extends DB_Model o.bezeichnung, (CASE WHEN sg.typ = \'b\' THEN ps.prestudent_id - WHEN sg.typ = \'m\' THEN ps.prestudent_id + WHEN sg.typ = \'m\' THEN mps.prestudent_id ELSE NULL - END) AS prestudent_id + END) AS prestudent_id, + sg.typ FROM public.tbl_prestudent p JOIN public.tbl_studiengang sg USING(studiengang_kz) JOIN public.tbl_organisationseinheit o USING(oe_kurzbz) @@ -597,11 +598,17 @@ class Prestudent_model extends DB_Model FROM public.tbl_prestudentstatus WHERE status_kurzbz = \'Bewerber\' ) ps USING(prestudent_id) + LEFT JOIN ( + SELECT prestudent_id + FROM public.tbl_prestudentstatus + WHERE status_kurzbz = \'Interessent\' AND bestaetigtam IS NOT NULL + ) mps ON p.prestudent_id = mps.prestudent_id WHERE p.person_id = ? GROUP BY o.oe_kurzbz, o.bezeichnung, sg.typ, ps.prestudent_id, + mps.prestudent_id, p.prestudent_id ORDER BY o.bezeichnung'; diff --git a/application/models/education/Paabgabe_model.php b/application/models/education/Paabgabe_model.php index 087c27663..b876030a6 100644 --- a/application/models/education/Paabgabe_model.php +++ b/application/models/education/Paabgabe_model.php @@ -1,7 +1,6 @@ dbTable = 'campus.tbl_paabgabe'; $this->pk = 'paabgabe_id'; } + + /** + * Gets last Endabgabe of a Projektarbeit, including filename. + * @param int $projektarbeit_id + * @return object + */ + public function getEndabgabe($projektarbeit_id) + { + $qry = "SELECT paabgabe_id, student_uid, paabg.datum, paabg.abgabedatum, projekttyp_kurzbz, titel, titel_english, + paabgabe_id || '_' || student_uid || '.pdf' AS filename + FROM campus.tbl_paabgabe paabg + JOIN lehre.tbl_projektarbeit USING (projektarbeit_id) + WHERE projektarbeit_id = ? + AND paabgabetyp_kurzbz = 'end' + AND paabg.abgabedatum IS NOT NULL + ORDER BY paabg.abgabedatum, paabg.datum DESC + LIMIT 1"; + + return $this->execQuery($qry, array($projektarbeit_id)); + } } diff --git a/application/models/education/Projektbetreuer_model.php b/application/models/education/Projektbetreuer_model.php index 0200f6468..95950bf95 100644 --- a/application/models/education/Projektbetreuer_model.php +++ b/application/models/education/Projektbetreuer_model.php @@ -54,18 +54,28 @@ class Projektbetreuer_model extends DB_Model $qry = "SELECT DISTINCT ON (pers.person_id) pers.person_id, betreuerart_kurzbz, vorname, nachname, trim(COALESCE(titelpre,'')||' '||COALESCE(vorname,'')||' '||COALESCE(nachname,'')||' '||COALESCE(titelpost,'')) as voller_name, anrede, titelpre, titelpost, gebdatum, geschlecht, pa.projekttyp_kurzbz, - ben.uid, ben.alias, ma.personalnummer, mitarbeiter_uid, student_uid - FROM lehre.tbl_projektarbeit pa - JOIN lehre.tbl_projektbetreuer USING (projektarbeit_id) - JOIN public.tbl_person pers USING (person_id) - LEFT JOIN public.tbl_benutzer ben USING (person_id) - LEFT JOIN public.tbl_mitarbeiter ma ON ben.uid = ma.mitarbeiter_uid - WHERE ben.aktiv - AND projektarbeit_id = ? - AND betreuerart_kurzbz = ? - ORDER BY pers.person_id, CASE WHEN ma.mitarbeiter_uid IS NULL THEN 1 ELSE 0 END, /*Mitarbeiter account first*/ - CASE WHEN ben.uid IS NULL THEN 1 ELSE 0 END, /*user with account first*/ - ben.insertamum"; + ben.uid, ben.alias, ma.personalnummer, mitarbeiter_uid, student_uid, + ( + SELECT kontakt + FROM public.tbl_kontakt + WHERE kontakttyp = 'email' + AND person_id = pers.person_id + ORDER BY + CASE WHEN zustellung THEN 0 ELSE 1 END, + insertamum DESC NULLS LAST + LIMIT 1 + ) AS private_email + FROM lehre.tbl_projektarbeit pa + JOIN lehre.tbl_projektbetreuer USING (projektarbeit_id) + JOIN public.tbl_person pers USING (person_id) + LEFT JOIN public.tbl_benutzer ben USING (person_id) + LEFT JOIN public.tbl_mitarbeiter ma ON ben.uid = ma.mitarbeiter_uid + WHERE (ben.aktiv OR ben.aktiv IS NULL) + AND projektarbeit_id = ? + AND betreuerart_kurzbz = ? + ORDER BY pers.person_id, CASE WHEN ma.mitarbeiter_uid IS NULL THEN 1 ELSE 0 END, /*Mitarbeiter account first*/ + CASE WHEN ben.uid IS NULL THEN 1 ELSE 0 END, /*user with account first*/ + ben.insertamum"; return $this->execQuery($qry, array($projektarbeit_id, $betreuerart_kurzbz)); } @@ -77,14 +87,14 @@ class Projektbetreuer_model extends DB_Model */ public function getBetreuerByToken($zugangstoken) { - $qry = ' + $qry = " SELECT tbl_projektbetreuer.person_id, tbl_projektbetreuer.projektarbeit_id, student_uid FROM lehre.tbl_projektbetreuer JOIN lehre.tbl_projektarbeit USING (projektarbeit_id) WHERE zugangstoken = ? AND zugangstoken_gueltigbis >= NOW() ORDER BY tbl_projektbetreuer.insertamum DESC, projektarbeit_id DESC LIMIT 1 - '; + "; return $this->execQuery($qry, array($zugangstoken)); } @@ -96,31 +106,60 @@ class Projektbetreuer_model extends DB_Model * @param $student_uid string uid des Studenten der Arbeit abgibt * @return object | bool */ - public function getZweitbegutachterWithToken($erstbegutachter_person_id, $projektarbeit_id, $student_uid) + public function getZweitbegutachterWithToken($erstbegutachter_person_id, $projektarbeit_id, $student_uid, $zweitbegutachter_person_id = null) { - $qry_betr = "SELECT betr.person_id, betr.projektarbeit_id, pers.anrede, betr.zugangstoken, betr.zugangstoken_gueltigbis, tbl_benutzer.uid, kontakt, - trim(COALESCE(titelpre,'')||' '||COALESCE(vorname,'')||' '||COALESCE(nachname,'')||' '||COALESCE(titelpost,'')) as voller_name, - CASE WHEN tbl_benutzer.uid IS NULL THEN kontakt ELSE tbl_benutzer.uid || '@".DOMAIN."' END AS email, abg.abgabedatum - FROM lehre.tbl_projektbetreuer betr - JOIN lehre.tbl_projektarbeit parb ON betr.projektarbeit_id = parb.projektarbeit_id - JOIN public.tbl_person pers ON betr.person_id = pers.person_id - LEFT JOIN public.tbl_kontakt ON pers.person_id = tbl_kontakt.person_id AND kontakttyp = 'email' AND zustellung = true - LEFT JOIN public.tbl_benutzer ON pers.person_id = tbl_benutzer.person_id - LEFT JOIN campus.tbl_paabgabe abg ON betr.projektarbeit_id = abg.projektarbeit_id AND abg.paabgabetyp_kurzbz = 'end' - WHERE betr.betreuerart_kurzbz = 'Zweitbegutachter' - AND betr.projektarbeit_id = ? - AND parb.student_uid = ? - AND EXISTS ( - SELECT 1 FROM lehre.tbl_projektbetreuer - WHERE person_id = ? - AND betreuerart_kurzbz = 'Erstbegutachter' - AND projektarbeit_id = betr.projektarbeit_id - ) - AND (tbl_benutzer.aktiv OR tbl_benutzer.aktiv IS NULL) - ORDER BY betr.insertamum DESC - LIMIT 1"; + $params = array($erstbegutachter_person_id, $erstbegutachter_person_id, $projektarbeit_id, $student_uid); - return $this->execQuery($qry_betr, array($projektarbeit_id, $student_uid, $erstbegutachter_person_id)); + $qry_betr = "SELECT betr.person_id, betr.projektarbeit_id, pers.anrede, betr.zugangstoken, betr.zugangstoken_gueltigbis, tbl_benutzer.uid, + trim(COALESCE(titelpre,'')||' '||COALESCE(vorname,'')||' '||COALESCE(nachname,'')||' '||COALESCE(titelpost,'')) as voller_name, + CASE WHEN tbl_benutzer.uid IS NULL THEN kontakt ELSE tbl_benutzer.uid || '@".DOMAIN."' END AS email, kontakt, + abg.abgabedatum, betr.betreuerart_kurzbz + FROM lehre.tbl_projektbetreuer betr + JOIN lehre.tbl_projektarbeit parb ON betr.projektarbeit_id = parb.projektarbeit_id + JOIN public.tbl_person pers ON betr.person_id = pers.person_id + LEFT JOIN public.tbl_kontakt ON pers.person_id = tbl_kontakt.person_id AND kontakttyp = 'email' AND zustellung = true + LEFT JOIN public.tbl_benutzer ON pers.person_id = tbl_benutzer.person_id + LEFT JOIN campus.tbl_paabgabe abg ON betr.projektarbeit_id = abg.projektarbeit_id AND abg.paabgabetyp_kurzbz = 'end' + WHERE + ( + ( + betr.betreuerart_kurzbz = 'Zweitbegutachter' + AND EXISTS ( + SELECT 1 FROM lehre.tbl_projektbetreuer + WHERE person_id = ? + AND betreuerart_kurzbz = 'Erstbegutachter' + AND projektarbeit_id = betr.projektarbeit_id + ) + ) + OR /* either Zweitbegutachter of masterarbeit, or Kommissionsprüfer if Kommission */ + ( + betr.betreuerart_kurzbz = 'Senatsmitglied' + AND EXISTS ( + SELECT 1 FROM lehre.tbl_projektbetreuer + WHERE person_id = ? + AND betreuerart_kurzbz = 'Senatsvorsitz' + AND projektarbeit_id = betr.projektarbeit_id + ) + ) + ) + AND betr.projektarbeit_id = ? + AND parb.student_uid = ? + AND (tbl_benutzer.aktiv OR tbl_benutzer.aktiv IS NULL)"; + + if (isset($zweitbegutachter_person_id)) + { + $qry_betr .= " AND betr.person_id = ?"; + $params[] = $zweitbegutachter_person_id; + } + + $qry_betr .= " ORDER BY betr.person_id DESC, + (CASE WHEN EXISTS ( /* if multiple accounts, prioritize mitarbeiter */ + SELECT 1 FROM public.tbl_mitarbeiter ma + WHERE ma.mitarbeiter_uid = tbl_benutzer.uid + ) THEN 0 ELSE 1 END), betr.insertamum DESC + LIMIT 1"; + + return $this->execQuery($qry_betr, $params); } /** @@ -131,23 +170,23 @@ class Projektbetreuer_model extends DB_Model */ public function generateZweitbegutachterToken($zweitbegutachter_person_id, $projektarbeit_id) { - $betreuerUidQry = "SELECT uid, zugangstoken, zugangstoken_gueltigbis, tbl_projektbetreuer.person_id + $betreuerUidQry = "SELECT uid, zugangstoken, zugangstoken_gueltigbis, tbl_projektbetreuer.person_id, betreuerart_kurzbz FROM lehre.tbl_projektbetreuer JOIN public.tbl_person USING(person_id) LEFT JOIN public.tbl_benutzer USING(person_id) WHERE projektarbeit_id = ? AND tbl_projektbetreuer.person_id = ? - AND betreuerart_kurzbz = 'Zweitbegutachter' + AND betreuerart_kurzbz IN ('Zweitbegutachter', 'Senatsmitglied') LIMIT 1"; - $betreueruidres = $this->execQuery($betreuerUidQry, array($projektarbeit_id, $zweitbegutachter_person_id)); + $betreueruidRes = $this->execQuery($betreuerUidQry, array($projektarbeit_id, $zweitbegutachter_person_id)); - if (!hasData($betreueruidres)) + if (!hasData($betreueruidRes)) return error('Zweitbegutachter nicht gefunden'); - $row_betr = getData($betreueruidres)[0]; + $zweitbetreuer = getData($betreueruidRes)[0]; - if (!isset($row_betr->uid)) + if (!isset($zweitbetreuer->uid)) { do { $token = generateToken(16); @@ -156,8 +195,8 @@ class Projektbetreuer_model extends DB_Model $result = $this->update( array('projektarbeit_id' => $projektarbeit_id, - 'person_id' => $row_betr->person_id, - 'betreuerart_kurzbz' => 'Zweitbegutachter'), + 'person_id' => $zweitbetreuer->person_id, + 'betreuerart_kurzbz' => $zweitbetreuer->betreuerart_kurzbz), array('zugangstoken' => $token, 'zugangstoken_gueltigbis' => date('Y-m-d', strtotime('+1 year'))) ); @@ -167,4 +206,29 @@ class Projektbetreuer_model extends DB_Model else return success("Account vorhanden, kein Token benötigt"); } + + /** + * Gets betreuerart of a Betreuer for a Projektarbeit. + * Main Betreuer are prioritized (normally one Betreuer should be assigned to a Projektarbeit another time with a different Betreuerart). + * @param int projektarbeit_id + * @param int betreuer_person_id + * @return object success or error + */ + public function getBetreuerart($projektarbeit_id, $betreuer_person_id) + { + $qry = "SELECT betreuerart_kurzbz + FROM lehre.tbl_projektbetreuer + WHERE projektarbeit_id = ? + AND person_id = ? + ORDER BY CASE WHEN betreuerart_kurzbz = 'Senatsvorsitz' THEN 1 /*Senatsvorsitz has priority*/ + WHEN betreuerart_kurzbz = 'Begutachter' THEN 2 + WHEN betreuerart_kurzbz = 'Erstbegutachter' THEN 3 + WHEN betreuerart_kurzbz = 'Zweitbegutachter' THEN 4 + WHEN betreuerart_kurzbz = 'Senatsmitglied' THEN 5 + ELSE 5 + END, insertamum DESC + LIMIT 1"; + + return $this->execQuery($qry, array($projektarbeit_id, $betreuer_person_id)); + } } diff --git a/cis/private/lehre/abgabe_lektor.php b/cis/private/lehre/abgabe_lektor.php index 70f80f7ba..3d20c8a7e 100644 --- a/cis/private/lehre/abgabe_lektor.php +++ b/cis/private/lehre/abgabe_lektor.php @@ -61,8 +61,10 @@ $sql_query = "SELECT FROM (SELECT tbl_person.vorname, tbl_person.nachname, tbl_studiengang.typ, tbl_studiengang.kurzbz, tbl_projektarbeit.projekttyp_kurzbz, tbl_projekttyp.bezeichnung, tbl_projektarbeit.titel, tbl_projektarbeit.projektarbeit_id, - tbl_projektbetreuer.betreuerart_kurzbz, tbl_benutzer.uid, tbl_student.matrikelnr, tbl_lehreinheit.studiensemester_kurzbz - FROM lehre.tbl_projektarbeit LEFT JOIN lehre.tbl_projektbetreuer using(projektarbeit_id) + tbl_projektbetreuer.betreuerart_kurzbz, tbl_betreuerart.beschreibung AS betreuerart_beschreibung, tbl_benutzer.uid, tbl_student.matrikelnr, tbl_lehreinheit.studiensemester_kurzbz + FROM lehre.tbl_projektarbeit + LEFT JOIN lehre.tbl_projektbetreuer using(projektarbeit_id) + LEFT JOIN lehre.tbl_betreuerart using(betreuerart_kurzbz) LEFT JOIN public.tbl_benutzer on(uid=student_uid) LEFT JOIN public.tbl_student on(public.tbl_benutzer.uid=public.tbl_student.student_uid) LEFT JOIN public.tbl_person on(tbl_benutzer.person_id=tbl_person.person_id) @@ -75,8 +77,7 @@ $sql_query = "SELECT WHERE public.tbl_benutzer.person_id=lehre.tbl_projektbetreuer.person_id AND public.tbl_benutzer.uid=".$db->db_add_param($getuid).") ".($showall?'':' AND public.tbl_benutzer.aktiv AND lehre.tbl_projektarbeit.note IS NULL ')." - AND (betreuerart_kurzbz='Betreuer' OR betreuerart_kurzbz='Begutachter' OR betreuerart_kurzbz='Erstbegutachter' - OR betreuerart_kurzbz='Zweitbegutachter' OR betreuerart_kurzbz='Erstbetreuer') + AND betreuerart_kurzbz IN ('Betreuer', 'Begutachter', 'Erstbegutachter', 'Zweitbegutachter', 'Erstbetreuer', 'Senatsvorsitz', 'Senatsmitglied') ORDER BY tbl_projektarbeit.projektarbeit_id, betreuerart_kurzbz desc) as xy ORDER BY nachname"; @@ -112,7 +113,7 @@ else $htmlstr .= " ".strtoupper($row->typ.$row->kurzbz)."\n"; $htmlstr .= " ".$db->convert_html_chars($row->studiensemester_kurzbz)."\n"; $htmlstr .= " ".$db->convert_html_chars($row->titel)."\n"; - $htmlstr .= " ".$db->convert_html_chars($row->betreuerart_kurzbz)."\n"; + $htmlstr .= " ".($row->betreuerart_beschreibung == null ? $db->convert_html_chars($row->betreuerart_kurzbz) : $db->convert_html_chars($row->betreuerart_beschreibung))."\n"; $htmlstr .= " \n"; $i++; } @@ -127,11 +128,11 @@ echo ' '.$p->t('abgabetool/abgabetool').' - - - - - + + + + + - - - - - - - - -'; - - echo '

'.$p->t('abgabetool/ueberschrift'); - if(trim($uid)!='') - echo " ($uid $vorname $nachname)
Anleitung ".$p->t('global/handbuch')."
"; - echo '

'; - echo $htmlstr; - echo ' -'; -?> + + * Andreas Oesterreicher < andreas.oesterreicher@technikum-wien.at > + * Rudolf Hangl < rudolf.hangl@technikum-wien.at > + * Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > + */ + +require_once('../../../config/cis.config.inc.php'); +require_once('../../../include/functions.inc.php'); +require_once('../../../include/datum.class.php'); +require_once('../../../include/person.class.php'); +require_once('../../../include/benutzer.class.php'); +require_once('../../../include/student.class.php'); +require_once('../../../include/studiengang.class.php'); +require_once('../../../include/projektbetreuer.class.php'); +require_once('../../../include/benutzerberechtigung.class.php'); +require_once('../../../include/phrasen.class.php'); + +$sprache = getSprache(); +$p = new phrasen($sprache); + +if (!$db = new basis_db()) + die($p->t('global/fehlerBeimOeffnenDerDatenbankverbindung')); + +$getuid=get_uid(); +$uid=$getuid; + +if(isset($_GET['uid'])) +{ + //Studentenansicht + $uid = $_GET['uid']; + //Rechte Pruefen + $allowed=false; + + $student = new student(); + if(!$student->load($uid)) + die($p->t('global/fehlerBeimErmittelnDerUID')); + + $stg_obj = new studiengang(); + if(!$stg_obj->load($student->studiengang_kz)) + die($p->t('global/fehlerBeimLesenAusDatenbank')); + + //Berechtigung ueber das Berechtigungssystem + $rechte = new benutzerberechtigung(); + $rechte->getBerechtigungen($getuid); + if($rechte->isBerechtigt('lehre/abgabetool',$stg_obj->oe_kurzbz,'s')) + $allowed=true; + + //oder Lektor mit Betreuung dieses Studenten + $qry = "SELECT 1 + FROM + lehre.tbl_projektarbeit + JOIN lehre.tbl_projektbetreuer USING(projektarbeit_id) + JOIN campus.vw_benutzer on(vw_benutzer.person_id=tbl_projektbetreuer.person_id) + WHERE + tbl_projektarbeit.student_uid=".$db->db_add_param($uid)." AND + vw_benutzer.uid=".$db->db_add_param($getuid).";"; + + if($result = $db->db_query($qry)) + { + if($db->db_num_rows($result)>0) + { + $allowed=true; + } + } + + if(!$allowed) + { + die($p->t('abgabetool/keineBerechtigungStudentenansicht')); + } +} +$htmlstr = ''; +$htmlstr1 = ''; +$vorname=''; +$nachname=''; +$zweitbetreuer = ''; +$senatsmitglied = ''; + +$sql_query = "SELECT (SELECT nachname FROM public.tbl_person WHERE person_id=tbl_projektbetreuer.person_id) AS bnachname, + (SELECT vorname FROM public.tbl_person WHERE person_id=tbl_projektbetreuer.person_id) AS bvorname, + (SELECT titelpre FROM public.tbl_person WHERE person_id=tbl_projektbetreuer.person_id) AS btitelpre, + (SELECT titelpost FROM public.tbl_person WHERE person_id=tbl_projektbetreuer.person_id) AS btitelpost, + tbl_betreuerart.beschreibung AS betreuerart_beschreibung, + (SELECT person_id FROM lehre.tbl_projektbetreuer WHERE projektarbeit_id=tbl_projektarbeit.projektarbeit_id + AND betreuerart_kurzbz IN ('Zweitbetreuer', 'Zweitbegutachter') LIMIT 1) AS zweitbetreuer_person_id, + (SELECT betreuerart_kurzbz FROM lehre.tbl_projektbetreuer WHERE projektarbeit_id=tbl_projektarbeit.projektarbeit_id + AND betreuerart_kurzbz IN ('Zweitbetreuer', 'Zweitbegutachter') LIMIT 1) AS zweitbetreuer_betreuerart_kurzbz, + (SELECT tbl_betreuerart.beschreibung FROM lehre.tbl_projektbetreuer JOIN lehre.tbl_betreuerart USING(betreuerart_kurzbz) WHERE projektarbeit_id=tbl_projektarbeit.projektarbeit_id + AND betreuerart_kurzbz IN ('Zweitbetreuer', 'Zweitbegutachter', 'Senatsmitglied') LIMIT 1) AS zweitbetreuer_betreuerart_beschreibung, + tbl_projektbetreuer.person_id AS betreuer_person_id, + tbl_projekttyp.bezeichnung AS prjbez, *, + lehre.tbl_projektbetreuer.note as note, + public.tbl_benutzer.aktiv as aktiv, + (SELECT abgeschicktvon FROM extension.tbl_projektarbeitsbeurteilung WHERE projektarbeit_id = tbl_projektarbeit.projektarbeit_id AND betreuer_person_id = tbl_projektbetreuer.person_id) AS babgeschickt, + (SELECT abgeschicktvon FROM extension.tbl_projektarbeitsbeurteilung WHERE projektarbeit_id = tbl_projektarbeit.projektarbeit_id AND betreuerart_kurzbz IN ('Zweitbetreuer', 'Zweitbegutachter') LIMIT 1) AS zweitbetreuer_abgeschickt + FROM lehre.tbl_projektarbeit + LEFT JOIN lehre.tbl_projektbetreuer USING(projektarbeit_id) + LEFT JOIN public.tbl_benutzer ON(uid=student_uid) + LEFT JOIN public.tbl_person ON(tbl_benutzer.person_id=tbl_person.person_id) + LEFT JOIN lehre.tbl_lehreinheit USING(lehreinheit_id) + LEFT JOIN lehre.tbl_lehrveranstaltung USING(lehrveranstaltung_id) + LEFT JOIN public.tbl_studiengang USING(studiengang_kz) + LEFT JOIN lehre.tbl_projekttyp USING (projekttyp_kurzbz) + LEFT JOIN lehre.tbl_betreuerart USING(betreuerart_kurzbz) + WHERE (projekttyp_kurzbz='Bachelor' OR projekttyp_kurzbz='Diplom') + AND betreuerart_kurzbz IN ('Betreuer', 'Begutachter', 'Erstbegutachter', 'Senatsvorsitz') + AND tbl_projektarbeit.student_uid=".$db->db_add_param($uid)." + ORDER BY studiensemester_kurzbz desc, tbl_lehrveranstaltung.kurzbz"; + +//AND tbl_projektarbeit.student_uid='$getuid' 'ie07m102'; +if(!$erg=$db->db_query($sql_query)) +{ + $errormsg=$p->t('global/fehlerBeimLesenAusDatenbank'); +} +else +{ + $htmlstr .= "
\n"; + $htmlstr .= "\n"; + $htmlstr .= " + + + + + + + + "; + $htmlstr .= "\n"; + $i = 0; + while($row=$db->db_fetch_object($erg)) + { + // get zweitbetreuer, if any + $htmlstr1 = ''; + $zweitbetreuer_obj = new person(); + if ($zweitbetreuer_obj->load($row->zweitbetreuer_person_id)) + { + $zweitbetreuer = ', '.$db->convert_html_chars($row->zweitbetreuer_betreuerart_kurzbz).': '.$zweitbetreuer_obj->titelpre.' '.$zweitbetreuer_obj->vorname.' '.$zweitbetreuer_obj->nachname.' '.$zweitbetreuer_obj->titelpost; + } + + // get senatsmitglied, if any + if ($row->betreuerart_kurzbz == 'Senatsvorsitz') + { + // write beschreibung of Betreuerart for Senatsvorsitz + $htmlstr1 = ''.$db->convert_html_chars($row->betreuerart_beschreibung).': '; + + $senatsmitglied_obj = new projektbetreuer(); + $senatsmitgliedRes = $senatsmitglied_obj->getZweitbegutachterWithToken($row->betreuer_person_id, $row->projektarbeit_id, $row->uid); + if ($senatsmitgliedRes) + { + $senatsmitglied .= ', '.$db->convert_html_chars($row->zweitbetreuer_betreuerart_beschreibung).': '; + $first = true; + foreach($senatsmitglied_obj->result as $spr) + { + if (!$first) + $senatsmitglied .= ', '; + $senatsmitglied .= $spr->voller_name; + $first = false; + } + } + } + else + $htmlstr1 = ''.$db->convert_html_chars($row->betreuerart_kurzbz).': '; + + $vorname=$row->vorname; + $nachname=$row->nachname; + $uid=$row->uid; + + ($row->btitelpre!=''?$htmlstr1 .= $row->btitelpre.' ':$htmlstr1 .= ''); + $htmlstr1 .= $row->bvorname.' '.$row->bnachname; + ($row->btitelpost!=''?$htmlstr1 .= ' '.$row->btitelpost:$htmlstr1 .= ''); + $htmlstr1 .= $zweitbetreuer; + $htmlstr1 .= $senatsmitglied; + $htmlstr .= " \n"; //class='liste".($i%2)."' + + if (is_null($row->note) && $row->aktiv === 't') + $htmlstr .= " \n"; + elseif (!is_null($row->babgeschickt) || !is_null($row->zweitbetreuer_abgeschickt)) + { + $htmlstr .= ""; + } else + { + $htmlstr .= ""; + } + + + $htmlstr .= " \n"; + $htmlstr .= " \n"; + $htmlstr .= " "; + $htmlstr .= " \n"; + $htmlstr .= " \n"; + $htmlstr .= " \n"; +// $htmlstr .= " \n"; + $htmlstr .= " \n"; + $i++; + } + $htmlstr .= "
".$p->t('abgabetool/details')."".$p->t('lvplan/sem')."".$p->t('lvplan/stg')."".$p->t('global/mail')."".$p->t('abgabetool/betreuer')."".$p->t('abgabetool/typ')."".$p->t('abgabetool/titel')."
".$p->t('abgabetool/upload').""; + + if (!is_null($row->babgeschickt)) + $htmlstr .= "".$p->t('abgabetool/projektbeurteilungErstDownload').""; + + if (!is_null($row->babgeschickt) && !is_null($row->zweitbetreuer_abgeschickt)) + $htmlstr .= "/"; + + if (!is_null($row->zweitbetreuer_abgeschickt)) + $htmlstr .= "".$p->t('abgabetool/projektbeurteilungZweitDownload').""; + + $htmlstr .= "".$row->note."".$row->studiensemester_kurzbz."".strtoupper($row->typ.$row->kurzbz).""; + + $qry_betr="SELECT mitarbeiter_uid FROM public.tbl_person + JOIN public.tbl_benutzer USING(person_id) + JOIN public.tbl_mitarbeiter ON(uid=mitarbeiter_uid) + WHERE person_id=".$db->db_add_param($row->betreuer_person_id, FHC_INTEGER).";"; + if($result_betr=$db->db_query($qry_betr)) + { + if($row_betr=$db->db_fetch_object($result_betr)) + { + $htmlstr.="email"; + } + else + { + $htmlstr.="UID unknown!"; + } + } + $htmlstr .= " ".$htmlstr1." ".$db->convert_html_chars($row->prjbez)."".$db->convert_html_chars($row->titel)."".$db->convert_html_chars($row->betreuerart_kurzbz)."
\n"; +} +echo ' + + + + Abgabesystem_Studentensicht + + + + + + + + + + + + +'; + + echo '

'.$p->t('abgabetool/ueberschrift'); + if(trim($uid)!='') + echo " ($uid $vorname $nachname)
Anleitung ".$p->t('global/handbuch')."
"; + echo '

'; + echo $htmlstr; + echo ' +'; +?> diff --git a/cis/private/lehre/abgabe_student_details.php b/cis/private/lehre/abgabe_student_details.php index 29d74ab66..522e89dd3 100644 --- a/cis/private/lehre/abgabe_student_details.php +++ b/cis/private/lehre/abgabe_student_details.php @@ -433,8 +433,10 @@ if($command=="update" && $error!=true) $row_std=$db->db_fetch_object($result_std); // 1. Begutachter mail ohne Token - $mail_baselink = APP_ROOT."index.ci.php/extensions/FHC-Core-Projektarbeitsbeurteilung/Projektarbeitsbeurteilung"; + $mail_baselink = APP_ROOT."index.ci.php/extensions/FHC-Core-Projektarbeitsbeurteilung/ProjektarbeitsbeurteilungErstbegutachter"; $mail_fulllink = "$mail_baselink?projektarbeit_id=".$projektarbeit_id."&uid=".$row_std->uid; + $projekttyp_kurzbz = $projektarbeit_obj->projekttyp_kurzbz; + $subject = $projektarbeit_obj->projekttyp_kurzbz == 'Diplom' ? 'Masterarbeitsbetreuung' : 'Bachelorarbeitsbetreuung'; $abgabetyp = $paabgabetyp_kurzbz == 'end' ? 'Endabgabe' : 'Zwischenabgabe'; $maildata = array(); @@ -452,7 +454,7 @@ if($command=="update" && $error!=true) 'ParbeitsbeurteilungEndupload', $maildata, $row_betr->mitarbeiter_uid."@".DOMAIN, - "Bachelor-/Masterarbeitsbetreuung", + $subject, 'sancho_header_min_bw.jpg', 'sancho_footer_min_bw.jpg', $user."@".DOMAIN); @@ -465,48 +467,66 @@ if($command=="update" && $error!=true) // 2. Begutachter mail, wenn Endabgabe, mit Token wenn extern if ($paabgabetyp_kurzbz == 'end') { - $projektbetreuer = new projektbetreuer(); - $zweitbetr = $projektbetreuer->getZweitbegutachterWithToken($bid, $projektarbeit_id, $row_std->uid); + // Zweitbegutachter holen + $zweitbegutachter = new projektbetreuer(); + $zweitbegutachterRes = $zweitbegutachter->getZweitbegutachterWithToken($bid, $projektarbeit_id, $row_std->uid); - if ($zweitbetr) + if ($zweitbegutachterRes) { - $tokenGenRes = $projektbetreuer->generateZweitbegutachterToken($zweitbetr->person_id, $projektarbeit_id); + $zweitbegutachterResults = $zweitbegutachter->result; - if (!$tokenGenRes) - echo "" . $p->t('abgabetool/fehlerMailZweitBegutachter') . "
 "; - - $zweitbetr = $projektbetreuer->getZweitbegutachterWithToken($bid, $projektarbeit_id, $row_std->uid); - - if (!$zweitbetr) - echo "" . $p->t('abgabetool/fehlerMailZweitBegutachter') . "
 "; - - $intern = isset($zweitbetr->uid); - $mail_link = $intern ? $mail_fulllink : $mail_baselink; - - $zweitbetmaildata = array(); - $zweitbetmaildata['geehrt'] = "geehrte" . ($zweitbetr->anrede == "Herr" ? "r" : ""); - $zweitbetmaildata['anrede'] = $zweitbetr->anrede; - $zweitbetmaildata['betreuer_voller_name'] = $zweitbetr->voller_name; - $zweitbetmaildata['student_anrede'] = $maildata['student_anrede']; - $zweitbetmaildata['student_voller_name'] = $maildata['student_voller_name']; - $zweitbetmaildata['abgabetyp'] = $abgabetyp; - $zweitbetmaildata['parbeituebersichtlink'] = $intern ? $maildata['parbeituebersichtlink'] : ""; - $zweitbetmaildata['bewertunglink'] = $num_rows_sem >= 1 ? "

Zur Beurteilung der Arbeit

" : ""; - $zweitbetmaildata['token'] = $num_rows_sem >= 1 && isset($zweitbetr->zugangstoken) && !$intern ? "

Zugangstoken: " . $zweitbetr->zugangstoken . "

" : ""; - - $mailres = sendSanchoMail( - 'ParbeitsbeurteilungEndupload', - $zweitbetmaildata, - $zweitbetr->email, - "Masterarbeitsbetreuung", - 'sancho_header_min_bw.jpg', - 'sancho_footer_min_bw.jpg', - $user . "@" . DOMAIN - ); - - if (!$mailres) + foreach ($zweitbegutachterResults as $begutachter) { - echo "" . $p->t('abgabetool/fehlerMailZweitBegutachter') . "
 "; + // token generieren, wenn noch nicht vorhanden und notwendig (wird in methode überprüft) + $tokenGenRes = $zweitbegutachter->generateZweitbegutachterToken($begutachter->person_id, $projektarbeit_id); + + if (!$tokenGenRes) + echo "" . $p->t('abgabetool/fehlerMailZweitBegutachter') . "
 "; + + // Zweitbegutachter (evtl. mit Token) holen + $zweitbegutachterMitToken = new projektbetreuer(); + $begutachterMitTokenRes = $zweitbegutachterMitToken->getZweitbegutachterWithToken($bid, $projektarbeit_id, $row_std->uid, $begutachter->person_id); + + if (!$begutachterMitTokenRes) + echo "" . $p->t('abgabetool/fehlerMailZweitBegutachter') . "
 "; + + // Email an Zweitbegutachter senden + if (isset($zweitbegutachterMitToken->result[0])) + { + $begutachterMitToken = $zweitbegutachterMitToken->result[0]; + + $path = $begutachterMitToken->betreuerart_kurzbz == 'Zweitbegutachter' ? 'ProjektarbeitsbeurteilungZweitbegutachter' : 'ProjektarbeitsbeurteilungErstbegutachter'; + $mail_baselink = APP_ROOT."index.ci.php/extensions/FHC-Core-Projektarbeitsbeurteilung/$path"; + $mail_fulllink = "$mail_baselink?projektarbeit_id=".$projektarbeit_id."&uid=".$row_std->uid; + $intern = isset($begutachterMitToken->uid); + $mail_link = $intern ? $mail_fulllink : $mail_baselink; + + $zweitbetmaildata = array(); + $zweitbetmaildata['geehrt'] = "geehrte" . ($begutachterMitToken->anrede == "Herr" ? "r" : ""); + $zweitbetmaildata['anrede'] = $begutachterMitToken->anrede; + $zweitbetmaildata['betreuer_voller_name'] = $begutachterMitToken->voller_name; + $zweitbetmaildata['student_anrede'] = $maildata['student_anrede']; + $zweitbetmaildata['student_voller_name'] = $maildata['student_voller_name']; + $zweitbetmaildata['abgabetyp'] = $abgabetyp; + $zweitbetmaildata['parbeituebersichtlink'] = $intern ? $maildata['parbeituebersichtlink'] : ""; + $zweitbetmaildata['bewertunglink'] = $num_rows_sem >= 1 ? "

Zur Beurteilung der Arbeit

" : ""; + $zweitbetmaildata['token'] = $num_rows_sem >= 1 && isset($begutachterMitToken->zugangstoken) && !$intern ? "

Zugangstoken: " . $begutachterMitToken->zugangstoken . "

" : ""; + + $mailres = sendSanchoMail( + 'ParbeitsbeurteilungEndupload', + $zweitbetmaildata, + $begutachterMitToken->email, + $subject, + 'sancho_header_min_bw.jpg', + 'sancho_footer_min_bw.jpg', + $user . "@" . DOMAIN + ); + + if (!$mailres) + { + echo "" . $p->t('abgabetool/fehlerMailZweitBegutachter') . "
 "; + } + } } } } diff --git a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php index 1cfa4a4e2..ddf3c54e4 100644 --- a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php +++ b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php @@ -922,7 +922,7 @@ if (isset($_REQUEST["freigabe"]) && ($_REQUEST["freigabe"] == 1)) $name = $mit->anrede.' '.$mit->vorname.' '.$mit->nachname.' ('.$mit->kurzbz.')'; $betreff = 'Notenfreigabe ' . $lv->bezeichnung . ' ' . $lv->orgform_kurzbz . ' - ' . $studienplan_bezeichnung; - $mail = new mail($adressen, 'vilesci@' . DOMAIN, $betreff, ''); + $mail = new mail($adressen, 'no-reply@' . DOMAIN, $betreff, ''); $htmlcontent = " $name hat neue Noten für die Lehrveranstaltung\n\n
@@ -931,10 +931,10 @@ if (isset($_REQUEST["freigabe"]) && ($_REQUEST["freigabe"] == 1))
eingetragen.\n

Die Noten können jetzt ins Zeugnis übernommen werden.\n"; - $htmlcontent .= $studlist; + $htmlcontent .= $studlist; $htmlcontent.= " -
Anzahl der Noten:" . $neuenoten . " +
Anzahl der Noten: " . $neuenoten . "

" . $p->t('abgabetool/mailVerschicktAn') . ": " . $adressen . " "; $mail->setHTMLContent($htmlcontent); diff --git a/cis/private/lehre/fotoliste.pdf.php b/cis/private/lehre/fotoliste.pdf.php index 881649ddf..475905e45 100644 --- a/cis/private/lehre/fotoliste.pdf.php +++ b/cis/private/lehre/fotoliste.pdf.php @@ -290,7 +290,7 @@ if ($result = $db->db_query($qry)) { 'personenkennzeichen' => trim($row->matrikelnr), 'geschlecht' => $row->geschlecht, 'foto_gesperrt' => $row->foto_sperre, // f/t - 'foto_url' => $foto_url, + 'foto_url' => 'Pictures/' . trim($row->person_id) . '.jpg', 'studiengruppe' => $student_studiengruppe, 'verband' => trim($row->verband), 'gruppe' => trim($row->gruppe), diff --git a/cis/private/pdfExport.php b/cis/private/pdfExport.php index 99b5c94f0..2743205d1 100644 --- a/cis/private/pdfExport.php +++ b/cis/private/pdfExport.php @@ -150,14 +150,14 @@ if (isset($_GET['betreuerart_kurzbz'])) if (isset($_GET['xsl']) && $_GET['xsl'] == 'Zahlung') { $requestdata = $_SERVER['QUERY_STRING']; - + $log = new Webservicelog(); $log->webservicetyp_kurzbz = 'content'; $log->request_id = isset($_GET['buchungsnummern']) && !empty($_GET['buchungsnummern']) ? $_GET['buchungsnummern'] : NULL; $log->beschreibung = 'Zahlungsbestaetigungsdownload'; $log->request_data = $requestdata; $log->execute_user = get_uid(); - + $log->save(true); } @@ -207,6 +207,7 @@ if (isset($_GET['xsl']) && ($_GET['xsl'] === 'Projektbeurteilung')) switch ($_GET['betreuerart_kurzbz']) { case 'Begutachter' : + case 'Senatsvorsitz' : $xsl = 'ProjektBeurteilungBA'; break; case 'Erstbegutachter' : diff --git a/cis/testtool/admin/uebersichtFragen.php b/cis/testtool/admin/uebersichtFragen.php index 0342abd05..f0e286698 100644 --- a/cis/testtool/admin/uebersichtFragen.php +++ b/cis/testtool/admin/uebersichtFragen.php @@ -1,339 +1,343 @@ -, - */ -require_once("../../../config/cis.config.inc.php"); -require_once('../../../include/basis_db.class.php'); -require_once("../../../include/gebiet.class.php"); -require_once("../../../include/frage.class.php"); -require_once("../../../include/vorschlag.class.php"); -require_once('../../../include/functions.inc.php'); -require_once("../../../include/benutzerberechtigung.class.php"); -require_once('../../../include/studiengang.class.php'); -require_once('../../../include/ablauf.class.php'); - -if (!$db = new basis_db()) - die('Fehler beim Oeffnen der Datenbankverbindung'); -?> - - - - - Testool Fragen Übersicht - - - -getBerechtigungen($user); - -if(!$rechte->isBerechtigt('basis/testtool', null, 's')) - die('Sie haben keine Berechtigung für diese Seite'); - -$gebiet = new gebiet(); -$gebiet->getAll(); -$sprache = (isset($_REQUEST['Sprache'])?$_REQUEST['Sprache']:'German'); -$Auswahlgebiet = (isset($_REQUEST['AuswahlGebiet'])?$_REQUEST['AuswahlGebiet']:''); -$loesungen = (isset($_REQUEST['loesungen']) && $_REQUEST['loesungen'] != '' ? true:false); - -$studiengang = new studiengang(); -$studiengang->getAll('typ, kurzbz', false); -$stg_kz = (isset($_GET['stg_kz'])?$_GET['stg_kz']:'-1'); -$gebiet_id = (isset($_GET['gebiet_id'])?$_GET['gebiet_id']:''); - -echo '
- - - - - -'; -/*echo '';*/ -echo ' - - - - - - - - - - -
Studiengang:'; -//Liste der Studiengänge -echo ''; -echo '
Gebiet:'; -//Liste der Gebiete -$qry = "SELECT * FROM testtool.tbl_ablauf WHERE studiengang_kz=".$db->db_add_param($stg_kz); -$anzahl = $db->db_num_rows($db->db_query($qry)); - -if ($stg_kz !== "-1" && $anzahl !== 0) -{ - $qry = "SELECT * FROM testtool.tbl_gebiet LEFT JOIN testtool.tbl_ablauf USING (gebiet_id) - WHERE studiengang_kz=".$db->db_add_param($stg_kz)." ORDER BY semester,reihung"; -} -else - $qry = "SELECT * FROM testtool.tbl_gebiet ORDER BY bezeichnung"; - -if (($anzahl !== 0) || ($stg_kz == '-1') && ($stg_kz !== '')) -{ - if ($result = $db->db_query($qry)) - { - echo ' '; - } -} -elseif (($anzahl == 0)) -{ - echo 'Keine Gebiete für diesen Studiengang'; -} -echo '
Sprache: -
-Mit Lösungen -

'; - - -if(isset($_REQUEST['AuswahlGebiet'])) -{ - $gebiet_id = $_REQUEST['AuswahlGebiet']; - - $gebietdetails = new gebiet(); - $gebietdetails->load($gebiet_id); - - $qry = "SELECT DISTINCT UPPER(typ||kurzbz) AS studiengang - FROM testtool.tbl_ablauf JOIN public.tbl_studiengang USING (studiengang_kz) - WHERE gebiet_id=".$db->db_add_param($gebiet_id)." - ORDER BY studiengang"; - $result = $db->db_query($qry); - - if ($gebietdetails) - { - echo ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Gebiet:'.$gebietdetails->bezeichnung.'
Verwendet in den Studiengängen:'; - $i=1; - while ($row = $db->db_fetch_object($result)) - { - echo $row->studiengang.($db->db_num_rows($result)>1 && $db->db_num_rows($result)>$i?', ':''); - $i++; - if ($i % 10 == 0) - echo '
'; - } - echo '
  
Beschreibung:'.($gebietdetails->beschreibung!=''?$gebietdetails->beschreibung:'-').'
Zeit:'.$gebietdetails->zeit.'
Multipleresponse:'.($gebietdetails->multipleresponse==true?'Ja':'Nein').'
Gestellte Fragen:'.$gebietdetails->maxfragen.'
Zufallsfrage:'.($gebietdetails->zufallfrage==true?'Ja':'Nein').'
Zufallsvorschlag:'.($gebietdetails->zufallvorschlag==true?'Ja':'Nein').'
Startlevel:'.($gebietdetails->level_start!=''?$gebietdetails->level_start:'Keines').'
Höheres Level nach:'.($gebietdetails->level_sprung_auf!=''?$gebietdetails->level_sprung_auf.' richtigen Antwort(en)':'-').'
Niedrigeres Level nach:'.($gebietdetails->level_sprung_ab!=''?$gebietdetails->level_sprung_ab.' falschen Antwort(en)':'-').'
Levelgleichverteilung:'.($gebietdetails->levelgleichverteilung==true?'Ja':'Nein').'
Maximalpunkte:'.$gebietdetails->maxpunkte.'
Antworten pro Zeile:'.$gebietdetails->antwortenprozeile.'


'; - } - - $frage = new frage(); - $frage->getFragenGebiet($gebiet_id); - - foreach($frage->result as $fragen) - { - $sprachevorschlag = new vorschlag(); - $spracheFrage = new frage(); - $spracheFrage->getFrageSprache($fragen->frage_id, $sprache); - - echo "<NR:".$fragen->nummer.($fragen->level!=""?"  Level: ".$fragen->level."":"").($fragen->demo=="t"?"  Demo":"").">
"; - //Sound einbinden - if($spracheFrage->audio!='') - { - echo ' '; - } - // FRAGE anzeigen - echo "$spracheFrage->text

\n"; - - // Bild einbinden wenn vorhanden - if($spracheFrage->bild!='') - echo "

\n"; - - echo"
"; - - // ANTWORTEN anzeigen - $sprachevorschlag->getVorschlag($fragen->frage_id, $sprache, $random=false); - $anzahlBild = 0; - foreach($sprachevorschlag->result as $vor) - { - $vorschlag = new vorschlag(); - $vorschlag->loadVorschlagSprache($vor->vorschlag_id, $sprache); - - if($vorschlag->bild == '') - { - if ($loesungen) - { - echo ''; - } - else - { - echo ''; - } - } - if($vorschlag->bild!='') - { - // zeilenumbruch nach 4 bilder - if($anzahlBild%4==0) - echo ""; - echo ""; - } - else - { - echo ""; - } - - $anzahlBild++; - } - if($vorschlag->audio!='') - { - echo ' '; - } - - } - echo "
'.$vor->nummer.''.$vor->punkte.' '.$vorschlag->text.'
'.$vor->nummer.' '.$vorschlag->text.'
"; - echo "
"; - if ($loesungen) - { - echo "
".$vor->punkte."


"; - } -} -?> - +, + */ +require_once("../../../config/cis.config.inc.php"); +require_once('../../../include/basis_db.class.php'); +require_once("../../../include/gebiet.class.php"); +require_once("../../../include/frage.class.php"); +require_once("../../../include/vorschlag.class.php"); +require_once('../../../include/functions.inc.php'); +require_once("../../../include/benutzerberechtigung.class.php"); +require_once('../../../include/studiengang.class.php'); +require_once('../../../include/ablauf.class.php'); + +if (!$db = new basis_db()) + die('Fehler beim Oeffnen der Datenbankverbindung'); +?> + + + + + Testool Fragen Übersicht + + + +getBerechtigungen($user); + +if(!$rechte->isBerechtigt('basis/testtool', null, 's')) + die('Sie haben keine Berechtigung für diese Seite'); + +$gebiet = new gebiet(); +$gebiet->getAll(); +$sprache = (isset($_REQUEST['Sprache'])?$_REQUEST['Sprache']:'German'); +$Auswahlgebiet = (isset($_REQUEST['AuswahlGebiet'])?$_REQUEST['AuswahlGebiet']:''); +$loesungen = (isset($_REQUEST['loesungen']) && $_REQUEST['loesungen'] != '' ? true:false); + +$studiengang = new studiengang(); +$studiengang->getAll('typ, kurzbz', false); +$stg_kz = (isset($_GET['stg_kz'])?$_GET['stg_kz']:'-1'); +$gebiet_id = (isset($_GET['gebiet_id'])?$_GET['gebiet_id']:''); + +echo ' + + + + + +'; +/*echo '';*/ +echo ' + + + + + + + + + + +
Studiengang:'; +//Liste der Studiengänge +echo ''; +echo '
Gebiet:'; +//Liste der Gebiete +$qry = "SELECT * FROM testtool.tbl_ablauf WHERE studiengang_kz=".$db->db_add_param($stg_kz); +$anzahl = $db->db_num_rows($db->db_query($qry)); + +if ($stg_kz !== "-1" && $anzahl !== 0) +{ + $qry = "SELECT * FROM testtool.tbl_gebiet LEFT JOIN testtool.tbl_ablauf USING (gebiet_id) + WHERE studiengang_kz=".$db->db_add_param($stg_kz)." ORDER BY semester,reihung"; +} +else + $qry = "SELECT * FROM testtool.tbl_gebiet ORDER BY bezeichnung"; + +if (($anzahl !== 0) || ($stg_kz == '-1') && ($stg_kz !== '')) +{ + if ($result = $db->db_query($qry)) + { + echo ' '; + } +} +elseif (($anzahl == 0)) +{ + echo 'Keine Gebiete für diesen Studiengang'; +} +echo '
Sprache: +
+Mit Lösungen +

'; + + +if(isset($_REQUEST['AuswahlGebiet'])) +{ + $gebiet_id = $_REQUEST['AuswahlGebiet']; + + $gebietdetails = new gebiet(); + $gebietdetails->load($gebiet_id); + + $qry = "SELECT DISTINCT UPPER(typ||kurzbz) AS studiengang + FROM testtool.tbl_ablauf JOIN public.tbl_studiengang USING (studiengang_kz) + WHERE gebiet_id=".$db->db_add_param($gebiet_id)." + ORDER BY studiengang"; + $result = $db->db_query($qry); + + if ($gebietdetails) + { + echo ' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Gebiet:'.$gebietdetails->bezeichnung.'
Verwendet in den Studiengängen:'; + $i=1; + while ($row = $db->db_fetch_object($result)) + { + echo $row->studiengang.($db->db_num_rows($result)>1 && $db->db_num_rows($result)>$i?', ':''); + $i++; + if ($i % 10 == 0) + echo '
'; + } + echo '
  
Beschreibung:'.($gebietdetails->beschreibung!=''?$gebietdetails->beschreibung:'-').'
Zeit:'.$gebietdetails->zeit.'
Multipleresponse:'.($gebietdetails->multipleresponse==true?'Ja':'Nein').'
Gestellte Fragen:'.$gebietdetails->maxfragen.'
Zufallsfrage:'.($gebietdetails->zufallfrage==true?'Ja':'Nein').'
Zufallsvorschlag:'.($gebietdetails->zufallvorschlag==true?'Ja':'Nein').'
Startlevel:'.($gebietdetails->level_start!=''?$gebietdetails->level_start:'Keines').'
Höheres Level nach:'.($gebietdetails->level_sprung_auf!=''?$gebietdetails->level_sprung_auf.' richtigen Antwort(en)':'-').'
Niedrigeres Level nach:'.($gebietdetails->level_sprung_ab!=''?$gebietdetails->level_sprung_ab.' falschen Antwort(en)':'-').'
Levelgleichverteilung:'.($gebietdetails->levelgleichverteilung==true?'Ja':'Nein').'
Maximalpunkte:'.$gebietdetails->maxpunkte.'
Offsetpunkte:'.$gebietdetails->offsetpunkte.'
Antworten pro Zeile:'.$gebietdetails->antwortenprozeile.'


'; + } + + $frage = new frage(); + $frage->getFragenGebiet($gebiet_id); + + foreach($frage->result as $fragen) + { + $sprachevorschlag = new vorschlag(); + $spracheFrage = new frage(); + $spracheFrage->getFrageSprache($fragen->frage_id, $sprache); + + echo "<NR:".$fragen->nummer.($fragen->level!=""?"  Level: ".$fragen->level."":"").($fragen->demo=="t"?"  Demo":"").">
"; + //Sound einbinden + if($spracheFrage->audio!='') + { + echo ' '; + } + // FRAGE anzeigen + echo "$spracheFrage->text

\n"; + + // Bild einbinden wenn vorhanden + if($spracheFrage->bild!='') + echo "

\n"; + + echo"
"; + + // ANTWORTEN anzeigen + $sprachevorschlag->getVorschlag($fragen->frage_id, $sprache, $random=false); + $anzahlBild = 0; + foreach($sprachevorschlag->result as $vor) + { + $vorschlag = new vorschlag(); + $vorschlag->loadVorschlagSprache($vor->vorschlag_id, $sprache); + + if($vorschlag->bild == '') + { + if ($loesungen) + { + echo ''; + } + else + { + echo ''; + } + } + if($vorschlag->bild!='') + { + // zeilenumbruch nach 4 bilder + if($anzahlBild%4==0) + echo ""; + echo ""; + } + else + { + echo ""; + } + + $anzahlBild++; + } + if($vorschlag->audio!='') + { + echo ' '; + } + + } + echo "
'.$vor->nummer.''.$vor->punkte.' '.$vorschlag->text.'
'.$vor->nummer.' '.$vorschlag->text.'
"; + echo "
"; + if ($loesungen) + { + echo "
".$vor->punkte."


"; + } +} +?> + \ No newline at end of file diff --git a/config/cis.config-default.inc.php b/config/cis.config-default.inc.php index 027af9504..cb670b5dd 100644 --- a/config/cis.config-default.inc.php +++ b/config/cis.config-default.inc.php @@ -260,10 +260,17 @@ define('CIS_ZEITWUNSCH_GD', false); // Covid-Status anzeigen define('CIS_SHOW_COVID_STATUS', false); +// Docsbox configs +define('DOCSBOX_SERVER', 'http://docconverter.technikum-wien.at/'); +define('DOCSBOX_PATH_API', 'api/v1/'); +define('DOCSBOX_CONVERSION_TIMEOUT', 30); // seconds +define('DOCSBOX_WAITING_SLEEP_TIME', 1); + //Vertrag Allin define ('DEFAULT_ALLIN_DIENSTVERTRAG',[111]); //Echter Dienstvertrag define ('DEFAULT_ECHTER_DIENSTVERTRAG',[103,111]); + ?> diff --git a/config/global.config-default.inc.php b/config/global.config-default.inc.php index 0380ea8d5..8990bbd81 100644 --- a/config/global.config-default.inc.php +++ b/config/global.config-default.inc.php @@ -316,4 +316,7 @@ define ('ZAHLUNGSBESTAETIGUNG_ANZEIGEN_FUER_LEHRGAENGE', true); // Gibt an, ob im CIS die Zahlungsreferenz angezeigt wird define ('ZAHLUNGSBESTAETIGUNG_ZAHLUNGSREFERENZ_ANZEIGEN', false); + +define('DOCSBOX_ENABLED', false); + ?> diff --git a/config/vilesci.config-default.inc.php b/config/vilesci.config-default.inc.php index 17f668b90..e98de9ce0 100644 --- a/config/vilesci.config-default.inc.php +++ b/config/vilesci.config-default.inc.php @@ -257,6 +257,12 @@ define('BIS_FUNKTIONSCODE_6_ARR', array( // bPk Abfrage define('BPK_FUER_ALLE_BENUTZER_ABFRAGEN', false); +// Docsbox configs +define('DOCSBOX_SERVER', 'http://docconverter.technikum-wien.at/'); +define('DOCSBOX_PATH_API', 'api/v1/'); +define('DOCSBOX_CONVERSION_TIMEOUT', 30); // seconds +define('DOCSBOX_WAITING_SLEEP_TIME', 1); + // Bei folgenden Buchungstypen wird ein Anlegen geprüft ob bereits ein Eintrag für diesen Typ vorhanden ist im selben // Semester und ggf ein Hinweis ausgegeben define('FAS_DOPPELTE_BUCHUNGSTYPEN_CHECK', serialize( @@ -269,6 +275,8 @@ define('ZEUGNISNOTE_NICHT_ANZEIGEN',serialize(array('iar', 'nz'))); //Default Lehrmodus define ('DEFAULT_LEHRMODUS','regulaer'); + //Echter Dienstvertrag define ('DEFAULT_ECHTER_DIENSTVERTRAG',[103,110]); + ?> diff --git a/include/dokument_export.class.php b/include/dokument_export.class.php index 4f23a7dcd..0d4f2c660 100644 --- a/include/dokument_export.class.php +++ b/include/dokument_export.class.php @@ -50,17 +50,24 @@ class dokument_export if(!isset($vorlage)) return; - exec('unoconv --version',$ret_arr); - if(isset($ret_arr[0])) + if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true) { - $hlp = explode(' ',$ret_arr[0]); - if(isset($hlp[1])) - $this->unoconv_version = $hlp[1]; - else - die('Could not get Unoconv Version'); + // Use docsbox!! } else - die('Unoconv not found'); + { + exec('unoconv --version',$ret_arr); + if(isset($ret_arr[0])) + { + $hlp = explode(' ',$ret_arr[0]); + if(isset($hlp[1])) + $this->unoconv_version = $hlp[1]; + else + die('Could not get Unoconv Version'); + } + else + die('Unoconv not found'); + } //Vorlage aus der Datenbank holen $this->vorlage = new vorlage(); @@ -276,21 +283,32 @@ class dokument_export { case 'pdf': case 'doc': + $ret = 0; $this->temp_filename = $this->temp_folder . '/out.' . $this->outputformat; - // Unoconv Version 0.6 hat eine Bug wodurch die Berechtigungen des PDF/Doc nicht korrekt gesetzt - // werden. Deshalb wird dies hier speziell behandelt. - // Die 2. Variante hat den Vorteil dass hier eine bessere Fehlerbehandlung moeglich ist - if($this->unoconv_version=='0.6') - $command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' %2$s > %1$s'; - else - $command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' --output %s %s 2>&1'; + // If it is set to use docsbox + if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true) + { + require_once(dirname(__FILE__).'/../application/libraries/DocsboxLib.php'); - $command = sprintf($command, $this->temp_filename, $tempname_zip); + $ret = DocsboxLib::convert($tempname_zip, $this->temp_filename, $this->outputformat); + } + else // otherwise use unoconv + { + // Unoconv Version 0.6 hat eine Bug wodurch die Berechtigungen des PDF/Doc nicht korrekt gesetzt + // werden. Deshalb wird dies hier speziell behandelt. + // Die 2. Variante hat den Vorteil dass hier eine bessere Fehlerbehandlung moeglich ist + if ($this->unoconv_version == '0.6') + $command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' %2$s > %1$s'; + else + $command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' --output %s %s 2>&1'; - exec($command, $out, $ret); + $command = sprintf($command, $this->temp_filename, $tempname_zip); - if($ret!=0) + exec($command, $out, $ret); + } + + if ($ret != 0) { $this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator'; return false; @@ -455,15 +473,27 @@ class dokument_export */ public function convert($inFile, $outFile, $format = "pdf") { - if($this->unoconv_version=='0.6') - $command = 'unoconv -f %1$s %3$s > %2$s'; - else - $command = 'unoconv -f %s --output %s %s 2>&1'; - $command = sprintf($command, $format, $outFile, $inFile); + $ret = 0; - exec($command, $out, $ret); + // If it is set to use DOCSBOX + if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true) + { + require_once(dirname(__FILE__).'/../application/libraries/DocsboxLib.php'); - if($ret!=0) + $ret = DocsboxLib::convert($inFile, $outFile, $format); + } + else // fallback to unoconv + { + if($this->unoconv_version=='0.6') + $command = 'unoconv -f %1$s %3$s > %2$s'; + else + $command = 'unoconv -f %s --output %s %s 2>&1'; + $command = sprintf($command, $format, $outFile, $inFile); + + exec($command, $out, $ret); + } + + if ($ret != 0) { $this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator'; return false; diff --git a/include/lehreinheit.class.php b/include/lehreinheit.class.php index 5c4854966..6bf1f7282 100644 --- a/include/lehreinheit.class.php +++ b/include/lehreinheit.class.php @@ -663,10 +663,10 @@ class lehreinheit extends basis_db $sql_lkt=mb_substr($sql_lkt,3); $sql_query="SELECT * FROM campus.tbl_zeitsperre WHERE ($sql_lkt) AND - ( (vondatum<".$this->db_add_param($datum)." AND bisdatum>".$this->db_add_param($datum).") - OR (vondatum=".$this->db_add_param($datum)." AND bisdatum=".$this->db_add_param($datum)." AND vonstunde<=".$this->db_add_param($stunde)." AND bisstunde>=".$this->db_add_param($stunde).") - OR (vondatum=".$this->db_add_param($datum)." AND bisdatum>".$this->db_add_param($datum)." AND vonstunde<=".$this->db_add_param($stunde).") - OR (vondatum<".$this->db_add_param($datum)." AND bisdatum=".$this->db_add_param($datum)." AND bisstunde>=".$this->db_add_param($stunde).") )"; + (vondatum <= ".$this->db_add_param($datum)." AND + bisdatum >= ".$this->db_add_param($datum)." AND + (vonstunde <= ". $this->db_add_param($stunde)." OR vonstunde IS NULL) AND + (bisstunde >= ". $this->db_add_param($stunde)." OR bisstunde IS NULL))"; //echo $sql_query.'
'; if (!$this->db_query($sql_query)) { diff --git a/include/lehrstunde.class.php b/include/lehrstunde.class.php index 19c1f605f..280e626a8 100644 --- a/include/lehrstunde.class.php +++ b/include/lehrstunde.class.php @@ -660,6 +660,8 @@ class lehrstunde extends basis_db $stunde->titel=$row->titel; $stunde->anmerkung=$row->beschreibung; $stunde->anmerkung_lehreinheit=$row->beschreibung; + $stunde->updateamum=$row->insertamum; + $stunde->updatevon=$row->insertvon; $stunde->farbe=''; $this->lehrstunden[]=$stunde; } diff --git a/include/projektarbeit.class.php b/include/projektarbeit.class.php index cb5fb8f77..783a0670b 100644 --- a/include/projektarbeit.class.php +++ b/include/projektarbeit.class.php @@ -472,10 +472,65 @@ class projektarbeit extends basis_db /** * Prüft ob Projektarbeit aktuell ist (ab bestimmtem Semester). + * Masterarbeiten sind ab der Änderung zur Gewichtung der Punkte aktuell, + * Bachelorarbeiten schon ab dem Umstieg auf das Online Beurteilungsformular. * @param $projektarbeit_id * @return int -1 wenn Fehler, 0 wenn nicht aktuell, 1 wenn aktuell */ public function projektarbeitIsCurrent($projektarbeit_id) + { + // paarbeit sollte nur ab einem Studiensemester online bewertet werden + $qry="SELECT 1 + FROM lehre.tbl_projektarbeit + JOIN lehre.tbl_lehreinheit USING(lehreinheit_id) + JOIN public.tbl_studiensemester USING(studiensemester_kurzbz) + WHERE projektarbeit_id=".$this->db_add_param($projektarbeit_id, FHC_INTEGER)." + AND + ( + ( + projekttyp_kurzbz = 'Diplom' + AND tbl_studiensemester.start::date >= ( + SELECT start + FROM public.tbl_studiensemester + WHERE studiensemester_kurzbz = 'SS2023' + )::date + ) + OR + ( + projekttyp_kurzbz <> 'Diplom' + AND tbl_studiensemester.start::date >= ( + SELECT start + FROM public.tbl_studiensemester + WHERE studiensemester_kurzbz = 'SS2022' + )::date + ) + ) + LIMIT 1"; + + $result_sem=$this->db_query($qry); + + if (!$result_sem) + { + $this->errormsg = "Fehler beim Ermitteln der Projektarbeit Aktualität"; + return -1; + } + + $num_rows = $this->db_num_rows($result_sem); + + if ($num_rows < 0) + { + $this->errormsg = "Fehler beim Ermitteln der Anzahl der aktuellen Projektarbeiten"; + } + + return $num_rows; + } + + /** + * Prüft ob Projektarbeit aktuell ist (ab bestimmtem Semester), vor der Änderung zur Gewichtung der Punkte. + * @param $projektarbeit_id + * @return int -1 wenn Fehler, 0 wenn nicht aktuell, 1 wenn aktuell + */ + public function projektarbeitIsCurrentBeforeWeightening($projektarbeit_id) { // paarbeit sollte nur ab einem Studiensemester online bewertet werden $qry="SELECT 1 diff --git a/include/projektbetreuer.class.php b/include/projektbetreuer.class.php index 04ba36b26..e0ca2099a 100644 --- a/include/projektbetreuer.class.php +++ b/include/projektbetreuer.class.php @@ -395,40 +395,66 @@ class projektbetreuer extends basis_db * @param $erstbegutachter_person_id int person_id des Erstbegutachters * @param $projektarbeit_id int * @param $student_uid string uid des Studenten der Arbeit abgibt + * @param $zweitbegutachter_person_id int person_id des Zweitbegutachters (wenn mehrere Zweitbetreuer zu einem Erstbegutachter erwartet werden) * @return object | bool */ - public function getZweitbegutachterWithToken($erstbegutachter_person_id, $projektarbeit_id, $student_uid) + public function getZweitbegutachterWithToken($erstbegutachter_person_id, $projektarbeit_id, $student_uid, $zweitbegutachter_person_id = null) { - $qry_betr="SELECT betr.person_id, betr.projektarbeit_id, pers.anrede, betr.zugangstoken, betr.zugangstoken_gueltigbis, tbl_benutzer.uid, kontakt, + $qry_betr="SELECT DISTINCT ON (betr.person_id) betr.person_id, betr.projektarbeit_id, pers.anrede, betr.zugangstoken, betr.zugangstoken_gueltigbis, + tbl_benutzer.uid, kontakt, betr.betreuerart_kurzbz, trim(COALESCE(titelpre,'')||' '||COALESCE(vorname,'')||' '||COALESCE(nachname,'')||' '||COALESCE(titelpost,'')) as voller_name, CASE WHEN tbl_benutzer.uid IS NULL THEN kontakt ELSE tbl_benutzer.uid || '@".DOMAIN."' END AS email, abg.abgabedatum FROM lehre.tbl_projektbetreuer betr - JOIN lehre.tbl_projektarbeit parb ON betr.projektarbeit_id = parb.projektarbeit_id + JOIN lehre.tbl_projektarbeit parb ON betr.projektarbeit_id = parb.projektarbeit_id JOIN public.tbl_person pers ON betr.person_id = pers.person_id LEFT JOIN public.tbl_kontakt ON pers.person_id = tbl_kontakt.person_id AND kontakttyp = 'email' AND zustellung = true LEFT JOIN public.tbl_benutzer ON pers.person_id = tbl_benutzer.person_id LEFT JOIN campus.tbl_paabgabe abg ON betr.projektarbeit_id = abg.projektarbeit_id AND abg.paabgabetyp_kurzbz = 'end' - WHERE betr.betreuerart_kurzbz = 'Zweitbegutachter' + WHERE + ( + ( + betr.betreuerart_kurzbz = 'Zweitbegutachter' + AND EXISTS ( + SELECT 1 FROM lehre.tbl_projektbetreuer + WHERE person_id = ".$this->db_add_param($erstbegutachter_person_id, FHC_INTEGER)." + AND betreuerart_kurzbz = 'Erstbegutachter' + AND projektarbeit_id = betr.projektarbeit_id + ) + ) + OR /* either Zweitbegutachter of masterarbeit, or Kommissionsprüfer if Kommission */ + ( + betr.betreuerart_kurzbz = 'Senatsmitglied' + AND EXISTS ( + SELECT 1 FROM lehre.tbl_projektbetreuer + WHERE person_id = ".$this->db_add_param($erstbegutachter_person_id, FHC_INTEGER)." + AND betreuerart_kurzbz = 'Senatsvorsitz' + AND projektarbeit_id = betr.projektarbeit_id + ) + ) + ) AND betr.projektarbeit_id = ".$this->db_add_param($projektarbeit_id, FHC_INTEGER)." AND parb.student_uid = ".$this->db_add_param($student_uid)." - AND EXISTS ( - SELECT 1 FROM lehre.tbl_projektbetreuer - WHERE person_id = ".$this->db_add_param($erstbegutachter_person_id, FHC_INTEGER)." - AND betreuerart_kurzbz = 'Erstbegutachter' - AND projektarbeit_id = betr.projektarbeit_id - ) - AND (tbl_benutzer.aktiv OR tbl_benutzer.aktiv IS NULL) - ORDER BY betr.insertamum DESC - LIMIT 1"; + AND (tbl_benutzer.aktiv OR tbl_benutzer.aktiv IS NULL)"; + + if (isset($zweitbegutachter_person_id)) + { + $qry_betr .= " AND betr.person_id = ".$this->db_add_param($zweitbegutachter_person_id, FHC_INTEGER); + } + + $qry_betr .= " ORDER BY betr.person_id DESC, + (CASE WHEN EXISTS ( /* if multiple accounts, prioritize mitarbeiter */ + SELECT 1 FROM public.tbl_mitarbeiter ma + WHERE ma.mitarbeiter_uid = tbl_benutzer.uid + ) THEN 0 ELSE 1 END), betr.insertamum DESC"; if ($betr=$this->db_query($qry_betr)) { - $row_betr = $this->db_fetch_object($betr); - - if ($row_betr) - return $row_betr; - else - return false; + $result = array(); + while ($row_betr = $this->db_fetch_object()) + { + $this->result[] = $row_betr; + } + return true; } else { @@ -451,7 +477,7 @@ class projektbetreuer extends basis_db LEFT JOIN public.tbl_benutzer USING(person_id) WHERE projektarbeit_id = ".$this->db_add_param($projektarbeit_id, FHC_INTEGER)." AND tbl_projektbetreuer.person_id = ".$this->db_add_param($zweitbegutachter_person_id, FHC_INTEGER)." - AND betreuerart_kurzbz = 'Zweitbegutachter' + AND betreuerart_kurzbz IN ('Zweitbegutachter', 'Senatsmitglied') LIMIT 1"; if ($betreueruidres = $this->db_query($betreuerUidQry)) @@ -494,7 +520,7 @@ class projektbetreuer extends basis_db zugangstoken_gueltigbis = CURRENT_DATE + interval '1 year' WHERE projektarbeit_id = " . $this->db_add_param($projektarbeit_id, FHC_INTEGER) . " AND person_id = " . $this->db_add_param($row_betr->person_id, FHC_INTEGER) . " - AND betreuerart_kurzbz = 'Zweitbegutachter'"; + AND betreuerart_kurzbz IN ('Zweitbegutachter', 'Senatsmitglied')"; if ($this->db_query($qry_upd)) { diff --git a/locale/de-AT/abgabetool.php b/locale/de-AT/abgabetool.php index ae8182cd5..83cd83a3e 100644 --- a/locale/de-AT/abgabetool.php +++ b/locale/de-AT/abgabetool.php @@ -83,12 +83,13 @@ $this->phrasen['abgabetool/gelesenUndAkzeptiert']='Gelesen und akzeptiert'; $this->phrasen['abgabetool/erklaerungNichtAkzeptiert']='Erklärung nicht akzeptiert'; $this->phrasen['abgabetool/downloadProjektarbeit']='Dokument herunterladen'; $this->phrasen['abgabetool/zweitBegutachter']='ZweitbegutachterIn'; -$this->phrasen['abgabetool/zweitbetreuerTokenMailSenden']='Zugangstoken an ZweitbegutachterIn noch einmal senden'; -$this->phrasen['abgabetool/zweitbegutachterMailGesendet']='Mail an ZweitbegutachterIn (%s) gesendet'; -$this->phrasen['abgabetool/zweitbetreuerMailSenden']='Mail an ZweitbegutachterIn (%s) senden'; -$this->phrasen['abgabetool/zweitBegutachterEmailFehlt']='keine Zustellmail für Zweitbegutachter vorhanden!'; +$this->phrasen['abgabetool/zweitbetreuerTokenMailSenden']='Zugangstoken noch einmal senden'; +$this->phrasen['abgabetool/zweitbegutachterMailGesendet']='Mail an %s (%s) gesendet'; +$this->phrasen['abgabetool/zweitbetreuerMailSenden']='Mail an %s (%s) senden'; +$this->phrasen['abgabetool/zweitBegutachterEmailFehlt']='keine Zustellmail vorhanden!'; $this->phrasen['abgabetool/projektbeurteilungDownload']='Projektbeurteilung herunterladen'; $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/senatsMitglied']='Mitglied Prüfungssenat'; ?> diff --git a/locale/en-US/abgabetool.php b/locale/en-US/abgabetool.php index 32fd14380..ac8cc3789 100644 --- a/locale/en-US/abgabetool.php +++ b/locale/en-US/abgabetool.php @@ -84,11 +84,12 @@ $this->phrasen['abgabetool/erklaerungNichtAkzeptiert']='Declaration not accepted $this->phrasen['abgabetool/downloadProjektarbeit']='Download File'; $this->phrasen['abgabetool/zweitBegutachter']='Second assessor'; $this->phrasen['abgabetool/zweitbetreuerTokenMailSenden']='Resend access token to second assessor'; -$this->phrasen['abgabetool/zweitbetreuerMailSenden']='Send mail to second assessor (%s)'; -$this->phrasen['abgabetool/zweitbegutachterMailGesendet']='Mail sent to second assessor (%s)'; -$this->phrasen['abgabetool/zweitBegutachterEmailFehlt']='Second assessor has no delivery mail adress!'; +$this->phrasen['abgabetool/zweitbetreuerMailSenden']='Send mail to assessor %s (%s)'; +$this->phrasen['abgabetool/zweitbegutachterMailGesendet']='Mail sent to assessor %s (%s)'; +$this->phrasen['abgabetool/zweitBegutachterEmailFehlt']='Assessor has no delivery mail adress!'; $this->phrasen['abgabetool/projektbeurteilungDownload']='Thesis-Assessment download'; $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/senatsMitglied']='Examiner'; ?> diff --git a/public/js/components/filter/Filter.js b/public/js/components/filter/Filter.js index e153042ad..2bf878e5a 100644 --- a/public/js/components/filter/Filter.js +++ b/public/js/components/filter/Filter.js @@ -23,6 +23,8 @@ import {CoreFetchCmpt} from '../../components/Fetch.js'; const FILTER_COMPONENT_NEW_FILTER = 'Filter Component New Filter'; const FILTER_COMPONENT_NEW_FILTER_TYPE = 'Filter Component New Filter Type'; +var _uuid = 0; + /** * */ @@ -42,10 +44,12 @@ export const CoreFilterCmpt = { required: true }, tabulatorOptions: Object, - tabulatorEvents: Array + tabulatorEvents: Array, + tableOnly: Boolean }, data: function() { return { + uuid: 0, // FilterCmpt properties filterName: null, fields: null, @@ -54,7 +58,6 @@ export const CoreFilterCmpt = { selectedFields: null, notSelectedFields: null, filterFields: null, - columnsAlias: null, availableFilters: null, @@ -64,104 +67,136 @@ export const CoreFilterCmpt = { fetchCmptApiFunctionParams: null, fetchCmptDataFetched: null, - tabulator: null + tabulator: null, + tableBuilt: false }; }, - created: function() { - this.getFilter(); // get the filter data - }, - updated: function() { - // - let dataset = JSON.parse(JSON.stringify(this.dataset)); - let fields = JSON.parse(JSON.stringify(this.fields)); - let selectedFields = JSON.parse(JSON.stringify(this.selectedFields)); + computed: { + filteredData() { + if (!this.dataset) + return []; + return JSON.parse(JSON.stringify(this.dataset)); + }, + filteredColumns() { + let fields = JSON.parse(JSON.stringify(this.fields)) || []; + let selectedFields = JSON.parse(JSON.stringify(this.selectedFields)) || []; - // - let columns = null; + let columns = null; - // If the tabulator options has been provided and it contains the property columns - if (this.tabulatorOptions != null && this.tabulatorOptions.hasOwnProperty('columns')) - { - columns = this.tabulatorOptions.columns; - } + // If the tabulator options has been provided and it contains the property columns + if (this.tabulatorOptions && this.tabulatorOptions.hasOwnProperty('columns')) + columns = this.tabulatorOptions.columns; - // If columns is not an array or it is an array with less elements then the array fields - if (!Array.isArray(columns) || (Array.isArray(columns) && columns.length < fields.length)) - { - columns = []; // set it as an empty array - - // Loop throught all the retrieved columns from database - for (let i = 0; i < fields.length; i++) + // If columns is not an array or it is an array with less elements then the array fields + if (!Array.isArray(columns) || (Array.isArray(columns) && columns.length < fields.length)) { - // Create a new column having the title equal to the field name - let column = { - title: fields[i], - field: fields[i] - }; + columns = []; // set it as an empty array - // If the column has to be displayed or not - selectedFields.indexOf(fields[i]) >= 0 ? column.visible = true : column.visible = false; - - // Add the new column to the list of columns - columns.push(column); - } - } - else // the property columns has been provided in the tabulator options - { - // Loop throught the property columns of the tabulator options - for (let i = 0; i < columns.length; i++) - { - // If the column has to be displayed or not - selectedFields.indexOf(columns[i].field) >= 0 ? columns[i].visible = true : columns[i].visible = false; - - if (columns[i].hasOwnProperty('resizable')) + // Loop throught all the retrieved columns from database + for (let field of fields) { - columns[i].visible ? columns[i].resizable = true : columns[i].resizable = false; - } + // Create a new column having the title equal to the field name + let column = { + title: field, + field: field + }; + + // If the column has to be displayed or not + column.visible = selectedFields.indexOf(field) >= 0; + + // Add the new column to the list of columns + columns.push(column); + } } - } - - this.columnsAlias = columns; - - // Define a default tabulator options in case it was not provided - let tabulatorOptions = { - height: 500, - layout: "fitColumns", - movableColumns: true, - reactiveData: true, - columns: columns, - data: JSON.parse(JSON.stringify(this.dataset)) - }; - - // If it was provided - if (this.tabulatorOptions != null) - { - // Then copy it... - tabulatorOptions = this.tabulatorOptions; - // ...and overwrite the properties data, reactiveData, movableColumns and columns - tabulatorOptions.data = JSON.parse(JSON.stringify(this.dataset)); - tabulatorOptions.columns = columns; - tabulatorOptions.reactiveData = true; - tabulatorOptions.movableColumns = true; - } - - // Start the tabulator with the buid options - this.tabulator = new Tabulator( - "#filterTableDataset", - tabulatorOptions - ); - - // If event handlers have been provided - if (Array.isArray(this.tabulatorEvents) && this.tabulatorEvents.length > 0) - { - // Attach all the provided event handlers to the started tabulator - for (let i = 0; i < this.tabulatorEvents.length; i++) + else // the property columns has been provided in the tabulator options { - this.tabulator.on(this.tabulatorEvents[i].event, this.tabulatorEvents[i].handler); + // Loop throught the property columns of the tabulator options + for (let col of columns) + { + // If the column has to be displayed or not + col.visible = selectedFields.indexOf(col.field) >= 0; + + if (col.hasOwnProperty('resizable')) + col.resizable = col.visible; + } } + + return columns; + }, + fieldNames() { + if (!this.tableBuilt) + return {}; + return this.tabulator.getColumns().reduce((res, col) => { + res[col.getField()] = col.getDefinition().title; + return res; + }, {}); + }, + idExtra() { + if (!this.uuid) + return ''; + return '-' + this.uuid; } }, + beforeCreate() { + if (!this.tableOnly == !this.filterType) + alert('You can not have a filter-type in table-only mode!'); + }, + created() { + this.uuid = _uuid++; + if (!this.tableOnly) + this.getFilter(); // get the filter data + }, + mounted() { + this.initTabulator(); + }, methods: { + initTabulator() { + // Define a default tabulator options in case it was not provided + let tabulatorOptions = {...{ + height: 500, + layout: "fitColumns", + movableColumns: true, + reactiveData: true + }, ...(this.tabulatorOptions || {})}; + + if (!this.tableOnly) { + tabulatorOptions.data = this.filteredData; + tabulatorOptions.columns = this.filteredColumns; + } + + // Start the tabulator with the build options + this.tabulator = new Tabulator( + this.$refs.table, + tabulatorOptions + ); + // If event handlers have been provided + if (Array.isArray(this.tabulatorEvents) && this.tabulatorEvents.length > 0) + { + // Attach all the provided event handlers to the started tabulator + for (let evt of this.tabulatorEvents) + this.tabulator.on(evt.event, evt.handler); + } + this.tabulator.on('tableBuilt', () => this.tableBuilt = true); + if (this.tableOnly) { + this.tabulator.on('tableBuilt', () => { + const cols = this.tabulator.getColumns(); + this.fields = cols.map(col => col.getField()); + this.selectedFields = cols.filter(col => col.isVisible()).map(col => col.getField()); + }); + } + }, + updateTabulator() { + if (this.tabulator) { + if (this.tableBuilt) + this._updateTabulator(); + else + this.tabulator.on('tableBuilt', this._updateTabulator); + } + }, + _updateTabulator() { + this.tabulator.setData(this.filteredData); + this.tabulator.setColumns(this.filteredColumns); + }, /** * */ @@ -209,6 +244,7 @@ export const CoreFilterCmpt = { { this.setDropDownMenu(data); } + this.updateTabulator(); } else { @@ -335,7 +371,7 @@ export const CoreFilterCmpt = { this.startFetchCmpt( CoreFilterAPIs.saveCustomFilter, { - customFilterName: document.getElementById('customFilterName').value + customFilterName: this.$refscustomFilterName.value }, this.getFilter ); @@ -463,22 +499,22 @@ export const CoreFilterCmpt = { /* * */ - handlerToggleSelectedField: function(event) { + handlerToggleSelectedField(field) { // If it is a selected field - if (this.selectedFields.indexOf(event.target.innerText) != -1) + if (this.selectedFields.indexOf(field) != -1) { // then hide it - this.tabulator.hideColumn(event.target.innerText); + this.tabulator.hideColumn(field); // and remove it from the this.selectedFields property - this.selectedFields.splice(this.selectedFields.indexOf(event.target.innerText), 1); + this.selectedFields.splice(this.selectedFields.indexOf(field), 1); } else // otherwise { // show it - this.tabulator.showColumn(event.target.innerText); + this.tabulator.showColumn(field); // and add it to the this.selectedFields property - this.selectedFields.push(event.target.innerText); + this.selectedFields.push(field); } }, /** @@ -527,6 +563,7 @@ export const CoreFilterCmpt = { template: ` -
+
- [ {{ filterName }} ] - - + [ {{ filterName }} ] + +
-
+
@@ -558,9 +595,9 @@ export const CoreFilterCmpt = {
- {{ fieldToDisplay }} + {{ fieldNames[fieldToDisplay] || fieldToDisplay }}
@@ -568,7 +605,7 @@ export const CoreFilterCmpt = {
-
+
@@ -591,7 +628,7 @@ export const CoreFilterCmpt = {
-
+