diff --git a/application/controllers/Cis/Abgabetool.php b/application/controllers/Cis/Abgabetool.php index 6c4770421..e00bbe837 100644 --- a/application/controllers/Cis/Abgabetool.php +++ b/application/controllers/Cis/Abgabetool.php @@ -13,7 +13,8 @@ class Abgabetool extends Auth_Controller public function __construct() { parent::__construct([ - 'index' => ['basis/cis:r'] + 'index' => ['basis/cis:r'], + 'getStudentProjektarbeitAbgabeFile' => ['basis/cis:r'] ]); } @@ -32,4 +33,42 @@ class Abgabetool extends Auth_Controller $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'Abgabetool']); } + + public function getStudentProjektarbeitAbgabeFile() + { + $this->_ci =& get_instance(); + $this->_ci->load->helper('download'); + + $paabgabe_id = $this->_ci->input->get('paabgabe_id'); + $student_uid = $this->_ci->input->get('student_uid'); + + if (!isset($paabgabe_id) || isEmptyString($paabgabe_id) || !isset($student_uid) || isEmptyString($student_uid)) + $this->terminateWithError($this->p->t('global', 'wrongParameters'), 'general'); + + $this->_ci->load->model('education/Projektarbeit_model', 'ProjektarbeitModel'); + + $isZugeteilterBetreuer = count($this->_ci->ProjektarbeitModel->checkZuordnung($student_uid, getAuthUID())->retval) > 0; + + if(getAuthUID() == $student_uid || $isZugeteilterBetreuer) { + $file_path = PAABGABE_PATH.$paabgabe_id.'_'.$student_uid.'.pdf'; + if(file_exists($file_path)) { + + header('Content-Description: File Transfer'); + header('Content-Type: application/octet-stream'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Disposition: attachment; filename="'.basename($file_path).'"'); + header('Content-Length: ' . filesize($file_path)); + + flush(); // send headers first just in case + readfile($file_path); // read file content to output buffer + + } else { + $this->terminateWithError('File not found'); + } + } else { + $this->terminateWithError('Keine Zuordnung!'); + } + } } diff --git a/application/controllers/api/frontend/v1/Lehre.php b/application/controllers/api/frontend/v1/Lehre.php index e41881df2..b28bd2d45 100644 --- a/application/controllers/api/frontend/v1/Lehre.php +++ b/application/controllers/api/frontend/v1/Lehre.php @@ -18,6 +18,14 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); +//require_once('../../../include/studiengang.class.php'); +//require_once('../../../include/student.class.php'); +//require_once('../../../include/datum.class.php'); +//require_once('../../../include/mail.class.php'); +//require_once('../../../include/benutzerberechtigung.class.php'); +//require_once('../../../include/phrasen.class.php'); +//require_once('../../../include/projektarbeit.class.php'); +//require_once('../../../include/projektbetreuer.class.php'); class Lehre extends FHCAPI_Controller { @@ -32,8 +40,27 @@ class Lehre extends FHCAPI_Controller 'LV' => self::PERM_LOGGED, 'Pruefungen' => self::PERM_LOGGED, 'getStudentProjektarbeiten' => self::PERM_LOGGED, // TODO: abgabetool berechtigung? - 'getStudentProjektabgaben' => self::PERM_LOGGED + 'getStudentProjektabgaben' => self::PERM_LOGGED, + 'postStudentProjektarbeitZwischenabgabe' => self::PERM_LOGGED, + 'postStudentProjektarbeitEndupload' => self::PERM_LOGGED ]); + + $this->load->library('PhrasesLib'); + + $this->loadPhrases( + array( + 'global', + 'ui', + 'abgabetool' + ) + ); + + $this->load->helper('hlp_sancho_helper'); + + require_once(FHCPATH . 'include/studiengang.class.php'); + require_once(FHCPATH . 'include/student.class.php'); + require_once(FHCPATH . 'include/projektarbeit.class.php'); + require_once(FHCPATH . 'include/projektbetreuer.class.php'); } //------------------------------------------------------------------------------------------------------------------ @@ -94,35 +121,327 @@ class Lehre extends FHCAPI_Controller $this->terminateWithSuccess($result); } + /** + * fetches all projektabgabetermine for a given projektarbeit_id used in cis4 student abgabetool + */ public function getStudentProjektabgaben() { $projektarbeit_id = $this->input->get("projektarbeit_id",TRUE); - $this->load->model('education/Abgabe_model', 'AbgabeModel'); - $ret = $this->AbgabeModel->getProjektarbeitAbgabetermine($projektarbeit_id); - + if (!isset($projektarbeit_id) || isEmptyString($projektarbeit_id)) + $this->terminateWithError($this->p->t('global', 'wrongParameters'), 'general'); + + $this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel'); + $ret = $this->ProjektarbeitModel->getProjektarbeitAbgabetermine($projektarbeit_id); $this->terminateWithSuccess($ret); } - + + /** + * fetches all projektarbeiten and betreuer for a given student_uid used in cis4 student abgabetool + */ public function getStudentProjektarbeiten($uid) { - $this->load->model('education/Abgabe_model', 'AbgabeModel'); $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel'); - - $isZugeteilterBetreuer = count($this->AbgabeModel->checkZuordnung($uid, getAuthUID())->retval) > 0; - $ret = $this->AbgabeModel->getStudentProjektarbeitenLegacy($uid); - $this->addMeta('legacyQueryRetval', $ret); - $this->addMeta('isZugeteilterBetreuer', $isZugeteilterBetreuer); - - if ($this->MitarbeiterModel->isMitarbeiter(getAuthUID()) && ($isZugeteilterBetreuer)){ - $projektarbeiten = $this->AbgabeModel->getStudentProjektarbeitenWithBetreuer($uid); - } else { - $projektarbeiten = $this->AbgabeModel->getStudentProjektarbeitenWithBetreuer(getAuthUID()); - } - + $this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel'); - $this->terminateWithSuccess(array($projektarbeiten, DOMAIN)); + if (!isset($uid) || isEmptyString($uid)) + $this->terminateWithError($this->p->t('global', 'wrongParameters'), 'general'); + + $isZugeteilterBetreuer = count($this->ProjektarbeitModel->checkZuordnung($uid, getAuthUID())->retval) > 0; + $this->addMeta('isZugeteilterBetreuer', $isZugeteilterBetreuer); + $isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter(getAuthUID()); + + if ($isMitarbeiter && $isZugeteilterBetreuer){ + $projektarbeiten = $this->ProjektarbeitModel->getStudentProjektarbeitenWithBetreuer($uid); + } else { + $projektarbeiten = $this->ProjektarbeitModel->getStudentProjektarbeitenWithBetreuer(getAuthUID()); + } + + $this->terminateWithSuccess(array($projektarbeiten, DOMAIN, $uid)); } + + + /** + * projektarbeit - upload for zwischenabgaben in cis4 student abgabetool + */ + public function postStudentProjektarbeitZwischenabgabe() + { + + $projektarbeit_id = $_POST['projektarbeit_id']; + $paabgabe_id = $_POST['paabgabe_id']; + $student_uid = $_POST['student_uid']; + $bperson_id = $_POST['bperson_id']; + $paabgabetyp_kurzbz = $_POST['paabgabetyp_kurzbz']; + + if (!isset($projektarbeit_id) || isEmptyString($projektarbeit_id) + || !isset($paabgabe_id) || isEmptyString($paabgabe_id) + || !isset($student_uid) || isEmptyString($student_uid) + || !isset($paabgabetyp_kurzbz) || isEmptyString($paabgabetyp_kurzbz)) + $this->terminateWithError($this->p->t('global', 'wrongParameters'), 'general'); + + if ((isset($_FILES) and isset($_FILES['file']) and ! $_FILES['file']['error'])) { + move_uploaded_file($_FILES['file']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$student_uid.'.pdf'); + + if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$student_uid.'.pdf')) { + + exec('chmod 640 "'.PAABGABE_PATH.$paabgabe_id.'_'.$student_uid.'.pdf'.'"'); + + $this->load->model('education/Paabgabe_model', 'PaabgabeModel'); + $res = $this->PaabgabeModel->updatePaabgabe($paabgabe_id); + + $this->sendUploadEmail($bperson_id, $projektarbeit_id, $paabgabetyp_kurzbz, $student_uid); + $this->terminateWithSuccess($res); + } else { + $this->terminateWithError('Error moving File'); + } + + } else { + $this->terminateWithError('File missing'); + } + + } + + /** + * upload für finale abgaben aka Endupload in cis4 student abgabetool + */ + public function postStudentProjektarbeitEndupload() + { + + $projektarbeit_id = $_POST['projektarbeit_id']; + $paabgabe_id = $_POST['paabgabe_id']; + $student_uid = $_POST['student_uid']; + $sprache = $_POST['sprache']; + $abstract = $_POST['abstract']; + $abstract_en = $_POST['abstract_en']; + $schlagwoerter = $_POST['schlagwoerter']; + $schlagwoerter_en = $_POST['schlagwoerter_en']; + $seitenanzahl = $_POST['seitenanzahl']; + $bperson_id = $_POST['bperson_id']; + $paabgabetyp_kurzbz = $_POST['paabgabetyp_kurzbz']; + + if (!isset($projektarbeit_id) || isEmptyString($projektarbeit_id) + || !isset($paabgabe_id) || isEmptyString($paabgabe_id) + || !isset($student_uid) || isEmptyString($student_uid) + || !isset($paabgabetyp_kurzbz) || isEmptyString($paabgabetyp_kurzbz)) + $this->terminateWithError($this->p->t('global', 'wrongParameters'), 'general'); + + // TODO: maybe check for other params aswell? + + if ((isset($_FILES) and isset($_FILES['file']) and ! $_FILES['file']['error'])) { + move_uploaded_file($_FILES['file']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$student_uid.'.pdf'); + + if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$student_uid.'.pdf')) { + + // Loads Libraries + $this->load->library('SignatureLib'); + + // Check if the document is signed + $signaturVorhanden = true; + $signList = SignatureLib::list(PAABGABE_PATH.$paabgabe_id.'_'.$student_uid.'.pdf'); + if (is_array($signList) && count($signList) > 0) + { + // The document is signed + $uploadedDocumentSigned = 'The document is signed'; + } + elseif ($signList === null) + { + $uploadedDocumentSigned = 'WARNING: signature server error'; + } + else + { + $signaturVorhanden = false; + $uploadedDocumentSigned = 'No document signature found'; + } + $this->addMeta('signaturInfo', $uploadedDocumentSigned); + + if ($signaturVorhanden === false) + { + $this->signaturFehltEmail($student_uid); + } + + // TODO error handle get data has data the updates + // update projektarbeit cols + $this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel'); + $this->ProjektarbeitModel->updateProjektarbeit($projektarbeit_id,$sprache,$abstract,$abstract_en + ,$schlagwoerter, $schlagwoerter_en, $seitenanzahl); + + + // update paabgabe datum + $this->load->model('education/Paabgabe_model', 'PaabgabeModel'); + $res = $this->PaabgabeModel->updatePaabgabe($paabgabe_id); + + $this->sendUploadEmail($bperson_id, $projektarbeit_id, $paabgabetyp_kurzbz, $student_uid); + + $this->terminateWithSuccess($res); + } else { + $this->terminateWithError('Error moving File'); + } + + } else { + $this->terminateWithError('File missing'); + } + + } + + private function signaturFehltEmail($student_uid) { + + + // Mail an Studiengang wenn keine Signatur gefunden wurde + $student = new student(); + if(!$student->load($student_uid)) + $this->terminateWithError($this->p->t('global','userNichtGefunden'), 'general'); + + $stg_obj = new studiengang(); + if(!$stg_obj->load($student->studiengang_kz)) + $this->terminateWithError($this->p->t('global','fehlerBeimLesenAusDatenbank'), 'general'); + + $subject = 'Abgabe ohne Signatur'; + $tomail = $stg_obj->email; + $data = array( + 'vorname' => $student->vorname, + 'nachname' => $student->nachname, + 'studiengang' => $stg_obj->bezeichnung + ); + + $mailres = sendSanchoMail( + 'ParbeitsbeurteilungSiganturFehlt', + $data, + $tomail, + $subject, + 'sancho_header_min_bw.jpg', + 'sancho_footer_min_bw.jpg' + ); + } + + private function sendUploadEmail($bperson_id, $projektarbeit_id, $paabgabetyp_kurzbz, $student_uid) { + + $this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel'); + + $resBetr = $this->ProjektarbeitModel->getProjektbetreuerAnrede($bperson_id); + + $projektarbeit_obj = new projektarbeit(); + + if(!$projektarbeit_obj->load($projektarbeit_id)) + $this->terminateWithError('Ungueltiger Eintrag'); + + $num_rows_sem = $projektarbeit_obj->projektarbeitIsCurrent($projektarbeit_id); + + if(!is_numeric($num_rows_sem) || $num_rows_sem < 0) + { + $this->terminateWithError($this->p->t('abgabetool','fehlerAktualitaetProjektarbeit'), 'general'); + } + + foreach($resBetr->retval as $betreuerRow) { + + // query student benutzer view for every betreuer row + $studentUser = $this->ProjektarbeitModel->getProjektarbeitBenutzer($student_uid)->retval[0]; + + // TODO: hasdata, getData etc + + // 1. Begutachter mail ohne Token + $mail_baselink = APP_ROOT."index.ci.php/extensions/FHC-Core-Projektarbeitsbeurteilung/ProjektarbeitsbeurteilungErstbegutachter"; + $mail_fulllink = "$mail_baselink?projektarbeit_id=".$projektarbeit_id."&uid=".$studentUser->uid; + $projekttyp_kurzbz = $projektarbeit_obj->projekttyp_kurzbz; + $subject = $projektarbeit_obj->projekttyp_kurzbz == 'Diplom' ? 'Masterarbeitsbetreuung' : 'Bachelorarbeitsbetreuung'; + $abgabetyp = $paabgabetyp_kurzbz == 'end' ? 'Endabgabe' : 'Zwischenabgabe'; + + $maildata = array(); + $maildata['geehrt'] = "geehrte".($betreuerRow->anrede=="Herr"?"r":""); + $maildata['anrede'] = $betreuerRow->anrede; + $maildata['betreuer_voller_name'] = $betreuerRow->first; + $maildata['student_anrede'] = $studentUser->anrede; + $maildata['student_voller_name'] = trim($studentUser->titelpre." ".$studentUser->vorname." ".$studentUser->nachname." ".$studentUser->titelpost); + $maildata['abgabetyp'] = $abgabetyp; + $maildata['parbeituebersichtlink'] = "

Zur Projektarbeitsübersicht

"; + $maildata['bewertunglink'] = $num_rows_sem >= 1 && $paabgabetyp_kurzbz == 'end' ? "

Zur Beurteilung der Arbeit

" : ""; + $maildata['token'] = ""; + + $mailres = sendSanchoMail( + 'ParbeitsbeurteilungEndupload', + $maildata, + $betreuerRow->mitarbeiter_uid."@".DOMAIN, + $subject, + 'sancho_header_min_bw.jpg', + 'sancho_footer_min_bw.jpg', + get_uid()."@".DOMAIN); + + if(!$mailres) + { + $this->terminateWithError($this->p->t('abgabetool', 'fehlerMailBegutachter'), 'general'); + } + + // 2. Begutachter mail, wenn Endabgabe, mit Token wenn extern + if ($paabgabetyp_kurzbz == 'end') + { + // Zweitbegutachter holen + $zweitbegutachter = new projektbetreuer(); + $zweitbegutachterRes = $zweitbegutachter->getZweitbegutachterWithToken($bperson_id, $projektarbeit_id, $studentUser->uid); + + if ($zweitbegutachterRes) + { + $zweitbegutachterResults = $zweitbegutachter->result; + + foreach ($zweitbegutachterResults as $begutachter) + { + // token generieren, wenn noch nicht vorhanden und notwendig (wird in methode überprüft) + $tokenGenRes = $zweitbegutachter->generateZweitbegutachterToken($begutachter->person_id, $projektarbeit_id); + + if (!$tokenGenRes) + { + $this->terminateWithError($this->p->t('abgabetool', 'fehlerMailZweitBegutachter'), 'general'); + } + + // Zweitbegutachter (evtl. mit Token) holen + $zweitbegutachterMitToken = new projektbetreuer(); + $begutachterMitTokenRes = $zweitbegutachterMitToken->getZweitbegutachterWithToken($bperson_id, $projektarbeit_id, $studentUser->uid, $begutachter->person_id); + + if (!$begutachterMitTokenRes) + { + $this->terminateWithError($this->p->t('abgabetool', 'fehlerMailZweitBegutachter'), 'general'); + } + + // 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=".$studentUser->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', + get_uid()."@".DOMAIN + ); + + if (!$mailres) + { + $this->terminateWithError($this->p->t('abgabetool', 'fehlerMailBegutachter'), 'general'); + } + } + } + } + } + } + } } diff --git a/application/models/education/Abgabe_model.php b/application/models/education/Abgabe_model.php index 0240beeb3..5a18c4fe3 100644 --- a/application/models/education/Abgabe_model.php +++ b/application/models/education/Abgabe_model.php @@ -11,144 +11,5 @@ class Abgabe_model extends DB_Model $this->dbTable = 'campus.tbl_abgabe'; $this->pk = 'abgabe_id'; } - - public function checkZuordnung($studentUID, $maUID) { - //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 = ? AND - vw_benutzer.uid = ?"; - - return $this->execReadOnlyQuery($qry, array($studentUID, $maUID)); - } - - public function getProjektarbeitAbgabetermine($projektarbeit_id) { - $qry ="SELECT campus.tbl_paabgabe.paabgabe_id, - campus.tbl_paabgabe.projektarbeit_id, - campus.tbl_paabgabe.fixtermin, - campus.tbl_paabgabe.kurzbz, - campus.tbl_paabgabe.datum, - campus.tbl_paabgabetyp.bezeichnung, - campus.tbl_paabgabe.abgabedatum - FROM campus.tbl_paabgabe JOIN campus.tbl_paabgabetyp USING(paabgabetyp_kurzbz) - WHERE campus.tbl_paabgabe.projektarbeit_id = ? - ORDER BY campus.tbl_paabgabe.datum"; - - return $this->execReadOnlyQuery($qry, array($projektarbeit_id)); - } - - public function getStudentProjektarbeitenWithBetreuer($studentUID) { - $betreuerQuery = " - SELECT - vorname as bvorname, - nachname as bnachname, - titelpre as btitelpre, - titelpost AS btitelpost, - titelpost 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_betreuerart.betreuerart_kurzbz, - person_id as bperson_id, - projektarbeit_id, - lehre.tbl_projekttyp.bezeichnung as projekttypbezeichnung, - lehre.tbl_lehreinheit.studiensemester_kurzbz, - lehre.tbl_lehrveranstaltung.studiengang_kz, - public.tbl_studiengang.kurzbzlang, - lehre.tbl_projektbetreuer.note as note, - public.tbl_mitarbeiter.mitarbeiter_uid, - lehre.tbl_projektarbeit.titel as titel, - (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, - (SELECT datum FROM campus.tbl_paabgabe WHERE paabgabetyp_kurzbz = 'end' AND abgabedatum IS NOT NULL AND projektarbeit_id = tbl_projektarbeit.projektarbeit_id LIMIT 1) AS abgegeben - - FROM lehre.tbl_projektarbeit - LEFT JOIN lehre.tbl_projektbetreuer USING(projektarbeit_id) - LEFT JOIN public.tbl_person USING(person_id) - LEFT JOIN public.tbl_benutzer USING(person_id) - LEFT JOIN lehre.tbl_projekttyp USING (projekttyp_kurzbz) - LEFT JOIN lehre.tbl_betreuerart USING(betreuerart_kurzbz) - LEFT JOIN lehre.tbl_lehreinheit USING(lehreinheit_id) - LEFT JOIN lehre.tbl_lehrveranstaltung USING(lehrveranstaltung_id) - LEFT JOIN public.tbl_mitarbeiter ON(public.tbl_mitarbeiter.mitarbeiter_uid = public.tbl_benutzer.uid) - LEFT JOIN public.tbl_studiengang USING(studiengang_kz) - WHERE - tbl_projektarbeit.student_uid = ? AND - (projekttyp_kurzbz='Bachelor' OR projekttyp_kurzbz='Diplom') - AND betreuerart_kurzbz IN ('Betreuer', 'Begutachter', 'Erstbegutachter', 'Senatsvorsitz')"; - - // TODO: fetch senatsmitglieder - return $this->execReadOnlyQuery($betreuerQuery, array($studentUID)); - } - public function getStudentProjektarbeitenLegacy($studentUID) - { - $qry = "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, - (SELECT datum FROM campus.tbl_paabgabe - WHERE paabgabetyp_kurzbz = 'end' - AND abgabedatum IS NOT NULL - AND projektarbeit_id = tbl_projektarbeit.projektarbeit_id LIMIT 1) AS abgegeben, - * -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= ? -ORDER BY studiensemester_kurzbz desc, tbl_lehrveranstaltung.kurzbz"; - - return $this->execQuery($qry, array($studentUID)); - } - } diff --git a/application/models/education/Paabgabe_model.php b/application/models/education/Paabgabe_model.php index 5fb58cc81..97235c37d 100644 --- a/application/models/education/Paabgabe_model.php +++ b/application/models/education/Paabgabe_model.php @@ -30,4 +30,16 @@ class Paabgabe_model extends DB_Model return $this->execQuery($qry, array($projektarbeit_id)); } + + public function updatePaabgabe($paabgabe_id) { + $qry=" + UPDATE campus.tbl_paabgabe SET + abgabedatum = now(), + updatevon = ?, + updateamum = now() + WHERE paabgabe_id= ?"; + + return $this->execQuery($qry, array(getAuthUID(), $paabgabe_id)); + } + } diff --git a/application/models/education/Projektarbeit_model.php b/application/models/education/Projektarbeit_model.php index 109e23373..c9c2b6b73 100644 --- a/application/models/education/Projektarbeit_model.php +++ b/application/models/education/Projektarbeit_model.php @@ -69,4 +69,146 @@ class Projektarbeit_model extends DB_Model return $this->execQuery($qry, $params); } + + /** + * Update a Projektarbeit of a student by projektarbeit_id with + * the paramenters used by the student endupload page in cis4 abgabetool. + */ + public function updateProjektarbeit($projektarbeit_id,$sprache,$abstract,$abstract_en, + $schlagwoerter, $schlagwoerter_en,$seitenanzahl) + { + $qry = "UPDATE lehre.tbl_projektarbeit SET + seitenanzahl = ?, + abgabedatum = now(), + sprache = ?, + schlagwoerter_en = ?, + schlagwoerter = ?, + abstract = ?, + abstract_en = ? + WHERE projektarbeit_id = ?"; + + return $this->execQuery($qry, array($seitenanzahl, $sprache, $schlagwoerter_en, + $schlagwoerter, $abstract, $abstract_en, $projektarbeit_id)); + } + + /** + * Get a List of Projektarbeiten of a student with betreuer + * used by the student cis4 abgabetool. + */ + public function getStudentProjektarbeitenWithBetreuer($studentUID) + { + $betreuerQuery = " + SELECT + vorname as bvorname, + nachname as bnachname, + titelpre as btitelpre, + titelpost AS btitelpost, + titelpost 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_betreuerart.betreuerart_kurzbz, + person_id as bperson_id, + projektarbeit_id, + lehre.tbl_projekttyp.bezeichnung as projekttypbezeichnung, + lehre.tbl_lehreinheit.studiensemester_kurzbz, + lehre.tbl_lehrveranstaltung.studiengang_kz, + public.tbl_studiengang.kurzbzlang, + lehre.tbl_projektbetreuer.note as note, + public.tbl_mitarbeiter.mitarbeiter_uid, + lehre.tbl_projektarbeit.titel as titel, + lehre.tbl_projektarbeit.sprache as sprache, + lehre.tbl_projektarbeit.seitenanzahl as seitenanzahl, + lehre.tbl_projektarbeit.kontrollschlagwoerter as kontrollschlagwoerter, + lehre.tbl_projektarbeit.schlagwoerter as schlagwoerter, + lehre.tbl_projektarbeit.schlagwoerter_en as schlagwoerter_en, + lehre.tbl_projektarbeit.abstract as abstract, + lehre.tbl_projektarbeit.abstract_en as abstract_en, + (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, + (SELECT datum FROM campus.tbl_paabgabe WHERE paabgabetyp_kurzbz = 'end' AND abgabedatum IS NOT NULL AND projektarbeit_id = tbl_projektarbeit.projektarbeit_id LIMIT 1) AS abgegeben + + FROM lehre.tbl_projektarbeit + LEFT JOIN lehre.tbl_projektbetreuer USING(projektarbeit_id) + LEFT JOIN public.tbl_person USING(person_id) + LEFT JOIN public.tbl_benutzer USING(person_id) + LEFT JOIN lehre.tbl_projekttyp USING (projekttyp_kurzbz) + LEFT JOIN lehre.tbl_betreuerart USING(betreuerart_kurzbz) + LEFT JOIN lehre.tbl_lehreinheit USING(lehreinheit_id) + LEFT JOIN lehre.tbl_lehrveranstaltung USING(lehrveranstaltung_id) + LEFT JOIN public.tbl_mitarbeiter ON(public.tbl_mitarbeiter.mitarbeiter_uid = public.tbl_benutzer.uid) + LEFT JOIN public.tbl_studiengang USING(studiengang_kz) + WHERE + tbl_projektarbeit.student_uid = ? AND + (projekttyp_kurzbz='Bachelor' OR projekttyp_kurzbz='Diplom') + AND betreuerart_kurzbz IN ('Betreuer', 'Begutachter', 'Erstbegutachter', 'Senatsvorsitz')"; + + return $this->execReadOnlyQuery($betreuerQuery, array($studentUID)); + } + + /** + * Get a List of Projektarbeit Abgabetermin used by the student cis4 abgabetool. + */ + public function getProjektarbeitAbgabetermine($projektarbeit_id) { + $qry ="SELECT campus.tbl_paabgabe.paabgabe_id, + campus.tbl_paabgabe.projektarbeit_id, + campus.tbl_paabgabe.fixtermin, + campus.tbl_paabgabe.kurzbz, + campus.tbl_paabgabe.datum, + campus.tbl_paabgabetyp.paabgabetyp_kurzbz, + campus.tbl_paabgabetyp.bezeichnung, + campus.tbl_paabgabe.abgabedatum + FROM campus.tbl_paabgabe JOIN campus.tbl_paabgabetyp USING(paabgabetyp_kurzbz) + WHERE campus.tbl_paabgabe.projektarbeit_id = ? + ORDER BY campus.tbl_paabgabe.datum"; + + return $this->execReadOnlyQuery($qry, array($projektarbeit_id)); + } + + public function getProjektbetreuerAnrede($bperson_id) { + $qry_betr="SELECT distinct trim(COALESCE(titelpre,'')||' '||COALESCE(vorname,'')||' '||COALESCE(nachname,'')||' '||COALESCE(titelpost,'')) as first, + public.tbl_mitarbeiter.mitarbeiter_uid, anrede + FROM public.tbl_person JOIN lehre.tbl_projektbetreuer ON(lehre.tbl_projektbetreuer.person_id=public.tbl_person.person_id) + JOIN public.tbl_benutzer ON(public.tbl_benutzer.person_id=public.tbl_person.person_id) + JOIN public.tbl_mitarbeiter ON(public.tbl_benutzer.uid=public.tbl_mitarbeiter.mitarbeiter_uid) + WHERE public.tbl_person.person_id= ?"; + + return $this->execReadOnlyQuery($qry_betr, [$bperson_id]); + + } + + public function getProjektarbeitBenutzer($uid) { + $qry="SELECT * FROM campus.vw_benutzer where uid=?"; + return $this->execReadOnlyQuery($qry, [$uid]); + } + + /** + * Checks if mitarbeiter has a projektbetreuer zuordnung to student. + */ + public function checkZuordnung($studentUID, $maUID) { + //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 = ? AND + vw_benutzer.uid = ?"; + + return $this->execReadOnlyQuery($qry, array($studentUID, $maUID)); + } } diff --git a/application/views/CisRouterView/CisRouterView.php b/application/views/CisRouterView/CisRouterView.php index 75ea0313e..231e25696 100644 --- a/application/views/CisRouterView/CisRouterView.php +++ b/application/views/CisRouterView/CisRouterView.php @@ -24,9 +24,11 @@ $includesArray = array( 'public/css/Cis4/Cms.css', ), 'customJSs' => array( - 'vendor/npm-asset/primevue/accordion/accordion.js', - 'vendor/npm-asset/primevue/accordiontab/accordiontab.js', - 'vendor/npm-asset/primevue/inputnumber/inputnumber.js' + 'vendor/npm-asset/primevue/accordion/accordion.min.js', + 'vendor/npm-asset/primevue/accordiontab/accordiontab.min.js', + 'vendor/npm-asset/primevue/inputnumber/inputnumber.min.js', + 'vendor/npm-asset/primevue/textarea/textarea.min.js', + 'vendor/npm-asset/primevue/checkbox/checkbox.min.js' ), 'customJSModules' => array( 'public/js/apps/Dashboard/Fhc.js' diff --git a/public/js/api/lehre.js b/public/js/api/lehre.js index 0020d3490..785b6abcf 100644 --- a/public/js/api/lehre.js +++ b/public/js/api/lehre.js @@ -29,8 +29,24 @@ export default { return this.$fhcApi.get( `/api/frontend/v1/Lehre/getStudentProjektabgaben` , { - projektarbeit_id: detail.projektarbeit_id + projektarbeit_id: detail.projektarbeit_id, + student_uid: detail.student_uid } ); + }, + postStudentProjektarbeitEndupload(formData) { + const url = '/api/frontend/v1/Lehre/postStudentProjektarbeitEndupload'; + const headers = {Headers: { "Content-Type": "multipart/form-data" }} + return this.$fhcApi.post(url, formData, headers) + }, + postStudentProjektarbeitZwischenabgabe(formData) { + const url = '/api/frontend/v1/Lehre/postStudentProjektarbeitZwischenabgabe'; + const headers = {Headers: { "Content-Type": "multipart/form-data" }} + return this.$fhcApi.post(url, formData, headers) + }, + getStudentProjektarbeitAbgabeFile(paabgabe_id, student_uid) { + const url = `/Cis/Abgabetool/getStudentProjektarbeitAbgabeFile?paabgabe_id=${paabgabe_id}&student_uid=${student_uid}`; + + window.location = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + url } } \ No newline at end of file diff --git a/public/js/apps/Dashboard/Fhc.js b/public/js/apps/Dashboard/Fhc.js index 34494e324..0b50891b9 100644 --- a/public/js/apps/Dashboard/Fhc.js +++ b/public/js/apps/Dashboard/Fhc.js @@ -30,12 +30,12 @@ const router = VueRouter.createRouter({ component: Profil, props: true }, - // { - // path: `/Cis/Abgabetool`, - // name: 'Abgabetool', - // component: Abgabetool, - // props: true - // }, + { + path: `/Cis/Abgabetool`, + name: 'Abgabetool', + component: Abgabetool, + props: true + }, { path: `/Cis/Raumsuche`, name: 'Raumsuche', diff --git a/public/js/components/Cis/Abgabetool/AbgabeDetail.js b/public/js/components/Cis/Abgabetool/AbgabeDetail.js index a1c3de8ae..5daf1a2b7 100644 --- a/public/js/components/Cis/Abgabetool/AbgabeDetail.js +++ b/public/js/components/Cis/Abgabetool/AbgabeDetail.js @@ -6,7 +6,11 @@ export const AbgabeDetail = { name: "AbgabeDetail", components: { Upload, - BsModal + BsModal, + InputNumber: primevue.inputnumber, + Checkbox: primevue.checkbox, + Dropdown: primevue.dropdown, + Textarea: primevue.textarea }, props: { projektarbeit: { @@ -16,23 +20,101 @@ export const AbgabeDetail = { }, data() { return { - file: [] + eidAkzeptiert: false, + enduploadTermin: null, + allActiveLanguages: FHC_JS_DATA_STORAGE_OBJECT.server_languages, + form: Vue.reactive({ + sprache: '', + abstract: '', + abstract_en: '', + schlagwoerter: '', + schlagwoerter_en: '', + kontrollschlagwoerter: '', + seitenanzahl: 1, + }) } }, methods: { - triggerUpload() { - // todo: trigger the loadup + validate: function(termin) { + if(!termin.file.length) { + this.$fhcAlert.alertWarning(this.$p.t('global/warningChooseFile')); + return false + } + return true; + }, + triggerEndupload() { + if (!this.validate(this.enduploadTermin)) + { + return false; + } + + // post endabgabe + const formData = new FormData(); + formData.append('paabgabetyp_kurzbz', this.enduploadTermin.paabgabetyp_kurzbz) + formData.append('projektarbeit_id', this.enduploadTermin.projektarbeit_id); + formData.append('paabgabe_id', this.enduploadTermin.paabgabe_id) + formData.append('student_uid', this.projektarbeit.student_uid) + formData.append('bperson_id', this.projektarbeit.bperson_id) + + // TODO: validate/check for null etc. + formData.append('sprache', this.form['sprache'].sprache) + formData.append('abstract', this.form['abstract']) + formData.append('abstract_en', this.form['abstract_en']) + formData.append('schlagwoerter', this.form['schlagwoerter']) + formData.append('schlagwoerter_en', this.form['schlagwoerter_en']) + formData.append('seitenanzahl', this.form['seitenanzahl']) + + for (let i = 0; i < this.enduploadTermin.file.length; i++) { + formData.append('file', this.enduploadTermin.file[i]); + } + this.$fhcApi.factory.lehre.postStudentProjektarbeitEndupload(formData) + .then(res => { + this.handleUploadRes(res) + }) + this.$refs.modalContainerEnduploadZusatzdaten.hide() }, + downloadAbgabe(termin) { + this.$fhcApi.factory.lehre.getStudentProjektarbeitAbgabeFile(termin.paabgabe_id, this.projektarbeit.student_uid) + }, upload(termin) { - console.log(termin) - // TODO load it up + + if (!this.validate(termin)) + { + return false; + } if(termin.bezeichnung === 'Endupload') { - // open endupload form modal and await that it will be sent & checked - + // open endupload form modal for further inputs + this.enduploadTermin = termin this.$refs.modalContainerEnduploadZusatzdaten.show() + } else { + const formData = new FormData(); + formData.append('paabgabetyp_kurzbz', termin.paabgabetyp_kurzbz) + formData.append('projektarbeit_id', this.projektarbeit.projektarbeit_id) + formData.append('paabgabe_id', termin.paabgabe_id) + formData.append('student_uid', this.projektarbeit.student_uid) + formData.append('bperson_id', this.projektarbeit.bperson_id) + + for (let i = 0; i < termin.file.length; i++) { + formData.append('file', termin.file[i]); + } + this.$fhcApi.factory.lehre.postStudentProjektarbeitZwischenabgabe(formData) + .then(res => { + this.handleUploadRes(res) + }) + } + }, + handleUploadRes(res) { + if(res.meta.status == "success") { + this.$fhcAlert.alertSuccess('File erfolgreich hochgeladen') + } else { + this.$fhcAlert.alertError('File upload error') + } + + if(res.meta.signaturInfo) { + this.$fhcAlert.alertInfo(res.meta.signaturInfo) } }, dateDiffInDays(datum, today){ @@ -43,6 +125,7 @@ export const AbgabeDetail = { const datum = new Date(termin.datum) const abgabedatum = new Date(termin.abgabedatum) + // todo: rework styling but keep the color pattern logic // https://wiki.fhcomplete.info/doku.php?id=cis:abgabetool_fuer_studierende let color = 'white' let fontColor = 'black' @@ -61,28 +144,33 @@ export const AbgabeDetail = { } return 'font-color: ' + fontColor + '; background-color: ' + color + }, + openBeurteilungLink(link) { + window.open(link, '_blank') + }, + getOptionLabel(option) { + return option.sprache } }, watch: { - 'file'(newVal) { - if(newVal == [] || newVal === null || newVal === undefined) return - - // check filetype on input change - const file = newVal[0] - if(!file) return - - if(file.type && file.type.includes('pdf')) { - // all fine - } else { - // clear and alert for filetypes - this.$fhcAlert.alertInfo(this.$p.t('abgabetool/c4allowedFileTypes')) - this.entschuldigung.files = [] - } - + projektarbeit(newVal) { + // default select german if projektarbeit sprache was null + this.form.sprache = newVal.sprache ? this.allActiveLanguages.find(lang => lang.sprache == newVal.sprache) : this.allActiveLanguages.find(lang => lang.sprache == 'German') + this.form.abstract = newVal.abstract + this.form.abstract_en = newVal.abstract_en + this.form.schlagwoerter = newVal.schlagwoerter + this.form.schlagwoerter_en = newVal.schlagwoerter_en + this.form.kontrollschlagwoerter = newVal.kontrollschlagwoerter + this.form.seitenanzahl = newVal.seitenanzahl } }, computed: { - + getEid() { + return this.$p.t('abgabetool/c4eidesstattlicheErklaerung') + }, + getEnduploadErlaubt() { + return !this.eidAkzeptiert + } }, created() { @@ -100,33 +188,46 @@ export const AbgabeDetail = {
-
{{$p.t('abgabetool/c4fixtermin')}}
-
{{$p.t('abgabetool/c4zieldatum')}}
-
{{$p.t('abgabetool/c4abgabetyp')}}
-
{{$p.t('abgabetool/c4abgabekurzbz')}}
-
{{$p.t('abgabetool/c4abgabedatum')}}
+
{{$p.t('abgabetool/c4fixtermin')}}
+
{{$p.t('abgabetool/c4zieldatum')}}
+
{{$p.t('abgabetool/c4abgabetyp')}}
+
{{$p.t('abgabetool/c4abgabekurzbz')}}
+
{{$p.t('abgabetool/c4abgabedatum')}}
{{$p.t('abgabetool/c4fileupload')}}
-
-
-
+

-
{{ termin.datum?.split("-").reverse().join(".") }}
-
{{ termin.bezeichnung }}
-
{{ termin.kurzbz }}
-
{{ termin.abgabedatum?.split("-").reverse().join(".") }}
-
- +
+
+ {{ termin.datum?.split("-").reverse().join(".") }} +
-
- +
{{ termin.bezeichnung }}
+
{{ termin.kurzbz }}
+
+ {{ termin.abgabedatum?.split("-").reverse().join(".") }} + + + +
+
+
+
+ +
+
+ +
+
+ +
@@ -136,58 +237,98 @@ export const AbgabeDetail = { diff --git a/public/js/components/Cis/Abgabetool/Abgabetool.js b/public/js/components/Cis/Abgabetool/Abgabetool.js index b1ab65181..6a34ff052 100644 --- a/public/js/components/Cis/Abgabetool/Abgabetool.js +++ b/public/js/components/Cis/Abgabetool/Abgabetool.js @@ -21,17 +21,20 @@ export const Abgabetool = { data() { return { domain: '', + student_uid: null, detail: null, + projektarbeiten: null, selectedProjektarbeit: null, tableBuiltResolve: null, tableBuiltPromise: null, abgabeTableOptions: { - height: 200, // TODO: determine smallest necessary height + height: 300, index: 'projektarbeit_id', layout: 'fitColumns', placeholder: this.$p.t('global/noDataAvailable'), columns: [ {title: Vue.computed(() => this.$p.t('abgabetool/c4details')), formatter: this.detailFormatter, field: 'details', widthGrow: 1, tooltip: false}, + {title: Vue.computed(() => this.$p.t('abgabetool/c4beurteilung')), formatter: this.beurteilungFormatter, field: 'beurteilung', widthGrow: 1, tooltip: false}, {title: Vue.computed(() => this.$p.t('abgabetool/c4sem')), field: 'sem', formatter: this.centeredTextFormatter, widthGrow: 1}, {title: Vue.computed(() => this.$p.t('abgabetool/c4stg')), field: 'stg', formatter: this.centeredTextFormatter, widthGrow: 1}, {title: Vue.computed(() => this.$p.t('abgabetool/c4kontakt')), field: 'mail', formatter: this.mailFormatter, widthGrow: 1}, @@ -50,20 +53,23 @@ export const Abgabetool = { { event: "cellClick", handler: async (e, cell) => { - + if(cell.getColumn().getField() === "details") { const val = cell.getValue() + if(val.mode === 'detailTermine') { this.setDetailComponent(cell.getValue()) } else if (val.mode === 'beurteilungDownload') { - //demo.dev.technikum-wien.at/cis/private/lehre/projektbeurteilungDocumentExport.php?betreuerart_kurzbz=Begutachter&projektarbeit_id=39239&person_id=22117 const pdfExportLink = FHC_JS_DATA_STORAGE_OBJECT.app_root + 'cis/private/pdfExport.php?xml=projektarbeitsbeurteilung.xml.php&xsl=Projektbeurteilung&betreuerart_kurzbz='+val.betreuerart_kurzbz+'&projektarbeit_id='+val.projektarbeit_id+'&person_id=' + val.betreuer_person_id - const pdfExportLink2 = FHC_JS_DATA_STORAGE_OBJECT.app_root + 'cis/private/lehre/projektbeurteilungDocumentExport.php?betreuerart_kurzbz='+val.betreuerart_kurzbz+'&projektarbeit_id='+val.projektarbeit_id+'&person_id=' + val.betreuer_person_id + // const pdfExportLink2 = FHC_JS_DATA_STORAGE_OBJECT.app_root + 'cis/private/lehre/projektbeurteilungDocumentExport.php?betreuerart_kurzbz='+val.betreuerart_kurzbz+'&projektarbeit_id='+val.projektarbeit_id+'&person_id=' + val.betreuer_person_id window.open(pdfExportLink, '_blank') } - } - console.log(cell.getData()) + } else if (cell.getColumn().getField() === "beurteilung") { + const val = cell.getValue() + + if(val != '-') window.open(val, '_blank') + } e.stopPropagation() } @@ -71,13 +77,29 @@ export const Abgabetool = { ]}; }, methods: { + isPastDate(date) { + return new Date(date) < new Date(Date.now()) + }, setDetailComponent(details){ this.loadAbgaben(details).then((res)=> { - console.log(res) - const pa = this.data[0]?.retval?.find(projekarbeit => projekarbeit.projektarbeit_id == details.projektarbeit_id) + const pa = this.projektarbeiten?.retval?.find(projekarbeit => projekarbeit.projektarbeit_id == details.projektarbeit_id) pa.abgabetermine = res.data.retval + pa.abgabetermine.forEach(termin => { + termin.file = [] + termin.allowedToUpload = true + + // TODO: fixtermin logic? + if(termin.bezeichnung == 'Endupload' && this.isPastDate(termin.datum)) { + + // termin.allowedToUpload = false + } else { + // termin.allowedToUpload = true + } + + }) pa.betreuer = this.buildBetreuer(pa) - + pa.student_uid = this.student_uid + this.selectedProjektarbeit = pa }) @@ -104,6 +126,13 @@ export const Abgabetool = { return '
' + '
' }, + beurteilungFormatter(cell) { + const val = cell.getValue() + if(val) { + return '
' + + '
' + } else return '-' + }, tableResolve(resolve) { this.tableBuiltResolve = resolve }, @@ -111,28 +140,30 @@ export const Abgabetool = { return 'mailto:' + abgabe.mitarbeiter_uid +'@'+ this.domain }, buildBetreuer(abgabe) { - return abgabe.betreuerart_beschreibung + ': ' + (abgabe.btitelpre ? abgabe.btitelpre + ' ' : '') + abgabe.bvorname + ' ' + abgabe.bnachname + (abgabe.btitelpost ?? '') + return abgabe.betreuerart_beschreibung + ': ' + (abgabe.btitelpre ? abgabe.btitelpre + ' ' : '') + abgabe.bvorname + ' ' + abgabe.bnachname + (abgabe.btitelpost ? ' ' + abgabe.btitelpost : '') }, setupData(data){ - - this.data = data // TODO: better define what is needed from this for detail component - this.domain = data[1] // TODO do this in backend but this is a prototype anyway + this.projektarbeiten = data[0] + this.domain = data[1] + this.student_uid = data[2] const d = data[0]?.retval?.map(projekt => { - console.log('projekt', projekt) let mode = 'detailTermine' if (projekt.babgeschickt || projekt.zweitbetreuer_abgeschickt) { - mode = 'beurteilungDownload' // build dl link for both betreuer documents + // mode = 'beurteilungDownload' // build dl link for both betreuer documents + projekt.beurteilungLink = FHC_JS_DATA_STORAGE_OBJECT.app_root + 'cis/private/pdfExport.php?xml=projektarbeitsbeurteilung.xml.php&xsl=Projektbeurteilung&betreuerart_kurzbz='+projekt.betreuerart_kurzbz+'&projektarbeit_id='+projekt.projektarbeit_id+'&person_id=' + projekt.bperson_id + } return { details: { - student_uid: this.viewData?.uid, + student_uid: this.student_uid, projektarbeit_id: projekt.projektarbeit_id, betreuer_person_id: projekt.bperson_id, betreuerart_kurzbz: projekt.betreuerart_kurzbz, mode }, + beurteilung: projekt.beurteilungLink ?? null, sem: projekt.studiensemester_kurzbz, stg: projekt.kurzbzlang, mail: this.buildMailToLink(projekt), diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index d1bddc46b..01f0427b6 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -37885,13 +37885,13 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => "Fixtermin", + 'text' => "Fix", 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => "Fixed submission deadline", + 'text' => "Fixed", 'description' => '', 'insertvon' => 'system' ) @@ -38025,13 +38025,188 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => "Upload-File ist kein PDF!", + 'text' => "Endupload Zusatzdaten", 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => "Upload-File is not a PDF!", + 'text' => "Final submission additional data", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'abgabetool', + 'phrase' => 'c4beurteilung', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Beurteilung", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Evaluation", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'abgabetool', + 'phrase' => 'c4schlagwoerterGer', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Deutsche Schlagwörter", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "German Keywords", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'abgabetool', + 'phrase' => 'c4schlagwoerterEng', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Englische Schlagwörter", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "English Keywords", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'abgabetool', + 'phrase' => 'c4abstractGer', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Abstract max 5000 Zeichen", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Abstract max 5000 characters", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'abgabetool', + 'phrase' => 'c4abstractEng', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Abstract englisch max 5000 Zeichen", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Abstract english max 5000 characters", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'abgabetool', + 'phrase' => 'c4seitenanzahl', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Seitenanzahl", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Number of pages", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'abgabetool', + 'phrase' => 'c4gelesenUndAkzeptiert', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Gelesen und akzeptiert", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Read and accepted", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'abgabetool', + 'phrase' => 'c4eidesstattlicheErklaerung', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Ich räume der Fachhochschule Technikum Wien das Recht ein, sämtliche übermittelte Dokumente elektronisch zu speichern und zum Zwecke der Langzeitarchivierung unter Beachtung der Bewahrung des Inhalts in andere Formate zu konvertieren. +

+ Im Falle einer Masterarbeit räume ich der FH Technikum Wien das Recht ein, sie in Datennetzen öffentlich zugänglich zu machen und stimme den bezughabenden Nutzungsbedingungen des Publikationsservers ePub zu. +

+ Ich bestätige hiermit, dass ich die eidesstattliche Erklärung mittels digitaler Signatur unterzeichnet habe. + Link zum Leitfaden Digitale Signatur. +

+ Hiermit willige ich ein, dass meine Bachelor- oder Masterarbeit im Zuge der Beurteilung auch mittels (Online)-Tools auf die unerlaubte Verwendung von KI geprüft wird. + ', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'I grant UAS Technikum Wien the right to store all submitted documents electronically and to convert them into other formats for the purpose of long-term archiving, taking into account the preservation of the content. +

+ In the case of a Master\'s thesis, I grant UAS Technikum Wien the right to make it publicly accessible in data networks and agree to the related Terms of use for the publication server ePub. +

+ I hereby confirm that I have signed the affidavit using a digital signature. Link to the Digital Signature Guide. +

+ I hereby agree that my bachelor\'s or master\'s thesis will also be checked for unauthorized use of AI using (online) tools as part of the assessment. + ', 'description' => '', 'insertvon' => 'system' )