From a4fee77301bb3dcbf5767e7e0baede98176ae208 Mon Sep 17 00:00:00 2001 From: Johann Hoffmann Date: Tue, 18 Nov 2025 15:01:43 +0100 Subject: [PATCH] link url in abgabetoolJob per config; comment out addMeta; --- application/config/abgabe.php | 6 +- .../controllers/api/frontend/v1/Abgabe.php | 188 +----------------- .../controllers/jobs/AbgabetoolJob.php | 25 +-- .../Cis/Abgabetool/AbgabetoolAssistenz.js | 175 ++++++++-------- 4 files changed, 109 insertions(+), 285 deletions(-) diff --git a/application/config/abgabe.php b/application/config/abgabe.php index 9265c70be..63c5699c3 100644 --- a/application/config/abgabe.php +++ b/application/config/abgabe.php @@ -7,4 +7,8 @@ $config['turnitin_link'] = 'https://technikum-wien.turnitin.com/sso/sp/redwood/s $config['old_abgabe_beurteilung_link'] = 'https://moodle.technikum-wien.at/mod/page/view.php?id=1005052'; -$config['PAABGABE_EMAIL_JOB_INTERVAL'] = '1 day'; \ No newline at end of file +$config['PAABGABE_EMAIL_JOB_INTERVAL'] = '1 day'; +// used as APP_ROOT.URL_STUDENTS -> cis4 +$config['URL_STUDENTS'] = 'cis.php/Cis/Abgabetool/Student'; +// used as APP_ROOT.URL_MITARBEITER -> old cis +$config['URL_MITARBEITER'] = 'index.ci.php/Cis/Abgabetool/Mitarbeiter'; \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/Abgabe.php b/application/controllers/api/frontend/v1/Abgabe.php index f25b30e83..349a60985 100644 --- a/application/controllers/api/frontend/v1/Abgabe.php +++ b/application/controllers/api/frontend/v1/Abgabe.php @@ -138,7 +138,7 @@ class Abgabe extends FHCAPI_Controller } $isZugeteilterBetreuer = count($this->ProjektarbeitModel->checkZuordnung($uid, getAuthUID())->retval) > 0; - $this->addMeta('isZugeteilterBetreuer', $isZugeteilterBetreuer); +// $this->addMeta('isZugeteilterBetreuer', $isZugeteilterBetreuer); $isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter(getAuthUID()); if ($isMitarbeiter) { @@ -211,8 +211,8 @@ class Abgabe extends FHCAPI_Controller 'updateamum' => date('Y-m-d H:i:s') )); - // TODO: consider this for daily abgabetool email job - $this->sendUploadEmail($bperson_id, $projektarbeit_id, $paabgabetyp_kurzbz, $student_uid); + // enable this when lektor cry that they dont receive enough emails +// $this->sendUploadEmail($bperson_id, $projektarbeit_id, $paabgabetyp_kurzbz, $student_uid); $this->logLib->logInfoDB(array('zwischenupload',$res, array( 'abgabedatum' => date('Y-m-d'), @@ -308,7 +308,6 @@ class Abgabe extends FHCAPI_Controller $abgabe = getData($res)[0]; $abgabe->signatur = $signaturstatus; - // TODO: consider for email job $this->sendUploadEmail($bperson_id, $projektarbeit_id, $paabgabetyp_kurzbz, $student_uid); $this->logLib->logInfoDB(array('endupload',$res, array( @@ -403,9 +402,11 @@ class Abgabe extends FHCAPI_Controller } else { $ci3BootstrapFilePath = "index.ci.php"; } - $url = APP_ROOT . $ci3BootstrapFilePath . '/Cis/Abgabetool/Mitarbeiter'; - $this->addMeta('betreuerArray', $resBetr->retval); + $path = $this->_ci->config->item('URL_MITARBEITER'); + $url = APP_ROOT.$path; + +// $this->addMeta('betreuerArray', $resBetr->retval); // getProjektbetreuerAnrede fetches distinct on person_id, so there should be one row. zweitbetreuer is handled seperately afterwards foreach($resBetr->retval as $betreuerRow) { @@ -435,7 +436,7 @@ class Abgabe extends FHCAPI_Controller if(!$email) $this->terminateWithError($this->p->t('abgabetool', 'fehlerMailBegutachter'), 'general'); - $this->addMeta('$maildata', $maildata); +// $this->addMeta('$maildata', $maildata); $mailres = sendSanchoMail( 'ParbeitsbeurteilungEndupload', @@ -458,7 +459,7 @@ class Abgabe extends FHCAPI_Controller $this->load->model('education/Projektbetreuer_model', 'ProjektbetreuerModel'); $zweitbegutachterRetval = getData($this->ProjektbetreuerModel->getZweitbegutachterWithToken($bperson_id, $projektarbeit_id, $studentUser->uid)); - $this->addMeta('$zweitbegutachterRes', $zweitbegutachterRetval); +// $this->addMeta('$zweitbegutachterRes', $zweitbegutachterRetval); if ($zweitbegutachterRetval && count($zweitbegutachterRetval) > 0) { @@ -475,7 +476,7 @@ class Abgabe extends FHCAPI_Controller $begutachterMitTokenRetval = getData($this->ProjektbetreuerModel->getZweitbegutachterWithToken($bperson_id, $projektarbeit_id, $studentUser->uid, $begutachter->person_id)); - $this->addMeta('$begutachterMitTokenRetval', $begutachterMitTokenRetval); +// $this->addMeta('$begutachterMitTokenRetval', $begutachterMitTokenRetval); if (!$begutachterMitTokenRetval && count($begutachterMitTokenRetval) <= 0) { @@ -501,9 +502,8 @@ class Abgabe extends FHCAPI_Controller $zweitbetmaildata['bewertunglink'] = $projektarbeitIsCurrent ? "

Zur Beurteilung der Arbeit

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

Zugangstoken: " . $begutachterMitToken->zugangstoken . "

" : ""; - $this->addMeta('$zweitbetmaildata', $zweitbetmaildata); +// $this->addMeta('$zweitbetmaildata', $zweitbetmaildata); -// TODO: persist email event somehow, let job bundle the updates later? $mailres = sendSanchoMail( 'ParbeitsbeurteilungEndupload', $zweitbetmaildata, @@ -985,172 +985,6 @@ class Abgabe extends FHCAPI_Controller } } -// public function notifyBetreuerMail() { -// // send all new projektarbeit abgabe UPLOADS since the last job run to the related betreuer -// // this job gathers all new or changed file uploads via field 'abgabedatum', enduploads still -// // send an email directly after happening since they are kind of important -// -//// $this->logInfo('Start job queue scheduler FHC-Core->notifyBetreuerMail'); -// $this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel'); -// $this->load->model('education/Paabgabe_model', 'PaabgabeModel'); -// $this->load->model('crm/Student_model', 'StudentModel'); -// -// $interval = $this->config->item('PAABGABE_EMAIL_JOB_INTERVAL'); -// -// $result = $this->PaabgabeModel->findAbgabenNewOrUpdatedSinceByAbgabedatum($interval); -// $retval = getData($result); -// -// // retval are paabgaben joined with projektarbeit and betreuer -// if(count($retval) == 0) return; // TODO: terminate appropriately -// -// // group contents per betreuer person_id -// $betreuer_uids = []; -// forEach($retval as $paabgabe) { -// if(!isset($betreuer_uids[$paabgabe->person_id])) { -// $betreuer_uids[$paabgabe->person_id] = []; -// } -// -// $betreuer_uids[$paabgabe->person_id][] = $paabgabe; -// } -// -// forEach ($betreuer_uids as $person_id => $abgaben) { -// // $person_id is from betreuer -// -// $result = $this->ProjektarbeitModel->getProjektbetreuerAnrede($person_id); -// $data = getData($result)[0]; -// -// // $abgabe is the array of paabgabe objects -// $anrede = $data->anrede; -// $anredeFillString = $data->anrede == "Herr" ? "r" : ""; -// $fullFormattedNameString = $data->first; -// -// $result = $this->ProjektarbeitModel->getProjektbetreuerEmail($paabgabe->projektarbeit_id); -// $data = getData($result)[0]; -// -// // https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.spaceship-op -// // php has spaceships 🚀🚀🚀🚀🚀 -// usort($abgaben, function ($a, $b) { -// return strtotime($a->datum) <=> strtotime($b->datum); -// }); -// -// $projektarbeit_titel = $abgaben[0]->titel; -// $abgabenString = '

'; -// foreach ($abgaben as $abgabe) { -// $datetime = new DateTime($abgabe->datum); -// $dateEmailFormatted = $datetime->format('d.m.Y'); -// -// $datetimeAbgabe = new DateTime($abgabe->abgabedatum); -// $abgabedatumFormatted = $datetimeAbgabe->format('d.m.Y'); -// -// $abgabenString .= 'Abgabedatum: '.$abgabedatumFormatted.' Zieldatum: '.$dateEmailFormatted . ' ' . $abgabe->bezeichnung . '
' . $abgabe->kurzbz . '
'; -// } -// -// // Link to Abgabetool -// if (defined('CIS4') && CIS4) { -// $ci3BootstrapFilePath = "cis.php"; -// } else { -// $ci3BootstrapFilePath = "index.ci.php"; -// } -// $url = APP_ROOT . $ci3BootstrapFilePath . '/Cis/Abgabetool/Mitarbeiter'; -// -// $body_fields = array( -// 'anrede' => $anrede, -// 'anredeFillString' => $anredeFillString, -// 'fullFormattedNameString' => $fullFormattedNameString, -// 'paTitel' => $projektarbeit_titel, -// 'abgabenString' => $abgabenString, -// 'linkAbgabetool' => $url -// ); -// -// // send email with bundled info -// sendSanchoMail( -// 'paabgabeUpdatesBetSM', -// $body_fields, -// $data->private_email, -// $this->p->t('abgabetool', 'changedAbgabeterminev2') -// ); -// } -// } -// -// public function notifyStudentMail() -// { -// // send all new projektarbeit abgabe since the last job run to the related student -// -//// $this->logInfo('Start job queue scheduler FHC-Core->notifyBetreuerMail'); -// $this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel'); -// $this->load->model('education/Paabgabe_model', 'PaabgabeModel'); -// $this->load->model('crm/Student_model', 'StudentModel'); -// -// $interval = $this->config->item('PAABGABE_EMAIL_JOB_INTERVAL'); -// -// $result = $this->PaabgabeModel->findAbgabenNewOrUpdatedSince($interval); -// $retval = getData($result); -// -// if(count($retval) == 0) return; // TODO: terminate appropriately -// -// // group results per projektarbeit/student_uid -// $student_uids = []; -// forEach($retval as $paabgabe) { -// if(!isset($student_uids[$paabgabe->student_uid])) { -// $student_uids[$paabgabe->student_uid] = []; -// } -// -// $student_uids[$paabgabe->student_uid][] = $paabgabe; -// } -// -// foreach ($student_uids as $uid => $abgaben) { -// // $uid is the student's UID -// $result = $this->StudentModel->getEmailAnredeForStudentUID($uid); -// $data = getData($result)[0]; -// -// // $abgabe is the array of paabgabe objects -// $anredeFillString = $data->anrede=="Herr"?"r":""; -// $fullFormattedNameString = trim($data->titelpre." ".$data->vorname." ".$data->vornamen." ".$data->nachname." ".$data->titelpost); -// -// // https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.spaceship-op -// // php has spaceships 🚀🚀🚀🚀🚀 -// usort($abgaben, function($a, $b) { -// return strtotime($a->datum) <=> strtotime($b->datum); -// }); -// -// $projektarbeit_titel = $abgaben[0]->titel; -// $abgabenString = '

'; -// forEach($abgaben as $abgabe) { -// $datetime = new DateTime($abgabe->datum); -// $dateEmailFormatted = $datetime->format('d.m.Y'); -// -// $abgabenString .= $dateEmailFormatted.' '.$abgabe->bezeichnung.' '.$abgabe->kurzbz.'
'; -// } -// -// // Link to Entschuldigungsmanagement -// if(defined('CIS4') && CIS4) { -// $ci3BootstrapFilePath = "cis.php"; -// } else { -// $ci3BootstrapFilePath = "index.ci.php"; -// } -// $url = APP_ROOT.$ci3BootstrapFilePath.'/Cis/Abgabetool/Student'; -// -//// $linkAbgabetool = ''; -// $body_fields = array( -// 'anrede' => $data->anrede, -// 'anredeFillString' => $anredeFillString, -// 'fullFormattedNameString' => $fullFormattedNameString, -// 'paTitel' => $projektarbeit_titel, -// 'abgabenString' => $abgabenString, -// 'linkAbgabetool' => $url -// ); -// -// // send email with bundled info -// sendSanchoMail( -// 'paabgabeUpdatesSammelmail', -// $body_fields, -// $uid.'@'.DOMAIN, -// $this->p->t('abgabetool', 'changedAbgabeterminev2') -// ); -// -// } -// } - private function checkAbgabeSignatur($abgabe, $projektarbeit) { if($abgabe->paabgabetyp_kurzbz != 'end') { return; diff --git a/application/controllers/jobs/AbgabetoolJob.php b/application/controllers/jobs/AbgabetoolJob.php index c38306240..301e747c1 100644 --- a/application/controllers/jobs/AbgabetoolJob.php +++ b/application/controllers/jobs/AbgabetoolJob.php @@ -87,15 +87,10 @@ class AbgabetoolJob extends JOB_Controller $abgabenString .= 'Abgabedatum: '.$abgabedatumFormatted.' Zieldatum: '.$dateEmailFormatted . ' ' . $abgabe->bezeichnung . '
' . $abgabe->kurzbz . '
'; } - - // Link to Abgabetool - if (defined('CIS4') && CIS4) { - $ci3BootstrapFilePath = "cis.php"; - } else { - $ci3BootstrapFilePath = "index.ci.php"; - } - $url = APP_ROOT . $ci3BootstrapFilePath . '/Cis/Abgabetool/Mitarbeiter'; - + + $path = $this->_ci->config->item('URL_MITARBEITER'); + $url = APP_ROOT.$path; + $body_fields = array( 'anrede' => $anrede, 'anredeFillString' => $anredeFillString, @@ -170,16 +165,10 @@ class AbgabetoolJob extends JOB_Controller $abgabenString .= $dateEmailFormatted.' '.$abgabe->bezeichnung.' '.$abgabe->kurzbz.'
'; } - - // TODO: check this config flag in job context - // Link to Entschuldigungsmanagement - if(defined('CIS4') && CIS4) { - $ci3BootstrapFilePath = "cis.php"; - } else { - $ci3BootstrapFilePath = "index.ci.php"; - } - $url = APP_ROOT.$ci3BootstrapFilePath.'/Cis/Abgabetool/Student'; + $route = $this->_ci->config->item('URL_STUDENTS'); + $url = APP_ROOT.$route; + $body_fields = array( 'anrede' => $data->anrede, 'anredeFillString' => $anredeFillString, diff --git a/public/js/components/Cis/Abgabetool/AbgabetoolAssistenz.js b/public/js/components/Cis/Abgabetool/AbgabetoolAssistenz.js index 6752e727e..c987f1613 100644 --- a/public/js/components/Cis/Abgabetool/AbgabetoolAssistenz.js +++ b/public/js/components/Cis/Abgabetool/AbgabetoolAssistenz.js @@ -228,91 +228,91 @@ export const AbgabetoolAssistenz = { }, handleTableBuilt() { const table = this.$refs.abgabeTable.tabulator - table.on("columnMoved", () => { - this.saveState(table); - }); - - table.on("columnResized", () => { - this.saveState(table); - }); - - table.on("columnVisibilityChanged", () => { - this.saveState(table); - }); - - table.on("filterChanged", () => { - this.saveState(table); - }); - - table.on("headerFilterChanged", () => { - this.saveState(table); - }); - - table.on("dataSorted", () => { - this.saveState(table); - }); - - table.on("columnSorted", () => { - this.saveState(table); - }); - - table.on("sortersChanged", () => { - this.saveState(table); - }); - - const saved = this.loadState(); + // table.on("columnMoved", () => { + // this.saveState(table); + // }); + // + // table.on("columnResized", () => { + // this.saveState(table); + // }); + // + // table.on("columnVisibilityChanged", () => { + // this.saveState(table); + // }); + // + // table.on("filterChanged", () => { + // this.saveState(table); + // }); + // + // table.on("headerFilterChanged", () => { + // this.saveState(table); + // }); + // + // table.on("dataSorted", () => { + // this.saveState(table); + // }); + // + // table.on("columnSorted", () => { + // this.saveState(table); + // }); + // + // table.on("sortersChanged", () => { + // this.saveState(table); + // }); + // + // const saved = this.loadState(); - table.on("renderComplete", () => { - if(!this.stateRestored) { - - if (saved?.columns && !this.colLayoutRestored) { - const layout = saved.columns.map(col => ({ - field: col.field, - width: col.width, - visible: col.visible, - // add more if needed, but keep it simple - })); - - const safeLayout = layout.filter(col => - col.field && !["rowSelection", "rowHandle", "rowNum", "zweitbetreuer"].includes(col.field) - ); - - table.setColumnLayout(safeLayout); - - this.colLayoutRestored = true; - } - - if (saved?.filters && !this.filtersRestored) { - this.filtersRestored = true // instantly avoid retriggers - table.setFilter(saved.filters); - } - if (saved?.headerFilters && !this.headerFiltersRestored) { - this.headerFiltersRestored = true // instantly avoid retriggers - for (let hf of saved.headerFilters) { - table.setHeaderFilterValue(hf.field, hf.value); - } - } - - if (saved?.sort?.length && !this.sortRestored) { - this.sortRestored = true; - - setTimeout(() => { - const sortList = saved.sort.map(s => { - const col = table.columnManager.findColumn(s.field); - if (!col) { - return null; - } - return { column: col, dir: s.dir }; - }).filter(Boolean); - - table.setSort(sortList); - }, 100); - } - this.stateRestored = true - - } - - }); + // table.on("renderComplete", () => { + // if(!this.stateRestored) { + // + // if (saved?.columns && !this.colLayoutRestored) { + // const layout = saved.columns.map(col => ({ + // field: col.field, + // width: col.width, + // visible: col.visible, + // // add more if needed, but keep it simple + // })); + // + // const safeLayout = layout.filter(col => + // col.field && !["rowSelection", "rowHandle", "rowNum", "zweitbetreuer"].includes(col.field) + // ); + // + // table.setColumnLayout(safeLayout); + // + // this.colLayoutRestored = true; + // } + // + // if (saved?.filters && !this.filtersRestored) { + // this.filtersRestored = true // instantly avoid retriggers + // table.setFilter(saved.filters); + // } + // if (saved?.headerFilters && !this.headerFiltersRestored) { + // this.headerFiltersRestored = true // instantly avoid retriggers + // for (let hf of saved.headerFilters) { + // table.setHeaderFilterValue(hf.field, hf.value); + // } + // } + // + // if (saved?.sort?.length && !this.sortRestored) { + // this.sortRestored = true; + // + // setTimeout(() => { + // const sortList = saved.sort.map(s => { + // const col = table.columnManager.findColumn(s.field); + // if (!col) { + // return null; + // } + // return { column: col, dir: s.dir }; + // }).filter(Boolean); + // + // table.setSort(sortList); + // }, 100); + // } + // this.stateRestored = true + // + // } + // + // }); }, handleToggleFullscreenDetail() { this.detailIsFullscreen = !this.detailIsFullscreen @@ -441,10 +441,7 @@ export const AbgabetoolAssistenz = { const mappedData = this.mapProjekteToTableData(this.projektarbeiten) - - if(!this.$refs.abgabeTable.tabulator) return - this.$refs.abgabeTable.tabulator.clearData() this.$refs.abgabeTable.tabulator.setColumns(this.abgabeTableOptions.columns) this.$refs.abgabeTable.tabulator.replaceData(mappedData) @@ -765,7 +762,8 @@ export const AbgabetoolAssistenz = { this.curSem = res.data[1] // TODO: maybe filter only for available semester from projektarbeiten dataset - this.studiensemesterOptions = [{studiensemester_kurzbz: 'Alle'}, ...this.allSem] + this.studiensemesterOptions = [{studiensemester_kurzbz: 'Alle'}, this.curSem, ...this.allSem] + }).catch(e => { this.loading = false }) @@ -1001,7 +999,6 @@ export const AbgabetoolAssistenz = { -