link url in abgabetoolJob per config; comment out addMeta;

This commit is contained in:
Johann Hoffmann
2025-11-18 15:01:43 +01:00
parent 96fdc357de
commit a4fee77301
4 changed files with 109 additions and 285 deletions
+5 -1
View File
@@ -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';
$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';
@@ -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 ? "<p><a href='$mail_link'>Zur Beurteilung der Arbeit</a></p>" : "";
$zweitbetmaildata['token'] = $projektarbeitIsCurrent && isset($begutachterMitToken->zugangstoken) && !$intern ? "<p>Zugangstoken: " . $begutachterMitToken->zugangstoken . "</p>" : "";
$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 = '<br /><br />';
// 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 . ' <br /> ' . $abgabe->kurzbz . '<br />';
// }
//
// // 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 = '<br /><br />';
// forEach($abgaben as $abgabe) {
// $datetime = new DateTime($abgabe->datum);
// $dateEmailFormatted = $datetime->format('d.m.Y');
//
// $abgabenString .= $dateEmailFormatted.' '.$abgabe->bezeichnung.' '.$abgabe->kurzbz.'<br />';
// }
//
// // 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;
+7 -18
View File
@@ -87,15 +87,10 @@ class AbgabetoolJob extends JOB_Controller
$abgabenString .= 'Abgabedatum: '.$abgabedatumFormatted.' Zieldatum: '.$dateEmailFormatted . ' ' . $abgabe->bezeichnung . ' <br /> ' . $abgabe->kurzbz . '<br />';
}
// 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.'<br />';
}
// 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,
@@ -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 = {
</template>
</BsOffcanvas>
<!-- low max height on this vsplit wrapper to avoid padding scrolls, elements have their inherent height anyways -->
<div style="max-height:40vw;">
<div class="row">
<div class="col-auto">