mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
optional sammelmail buttons assistenz abgabetool
This commit is contained in:
@@ -36,3 +36,6 @@ $config['SIGNATUR_CHECK_PAABGABETYPEN'] = ['end'];
|
||||
|
||||
// to be used as "https://moodle.technikum-wien.at/course/view.php?idnumber=dl{$stg_kz}" for stg specific moodle routing
|
||||
$config['STG_MOODLE_LINK'] = 'https://moodle.technikum-wien.at/course/view.php?idnumber=dl';
|
||||
|
||||
$config['ASSISTENZ_SAMMELMAIL_BUTTON_STUDENT'] = true;
|
||||
$config['ASSISTENZ_SAMMELMAIL_BUTTON_BETREUER'] = true;
|
||||
|
||||
@@ -87,11 +87,15 @@ class Abgabe extends FHCAPI_Controller
|
||||
$old_abgabe_beurteilung_link =$this->config->item('old_abgabe_beurteilung_link');
|
||||
$turnitin_link = $this->config->item('turnitin_link');
|
||||
$abgabetypenBetreuer = $this->config->item('ALLOWED_ABGABETYPEN_BETREUER');
|
||||
$ASSISTENZ_SAMMELMAIL_BUTTON_STUDENT = $this->config->item('ASSISTENZ_SAMMELMAIL_BUTTON_STUDENT');
|
||||
$ASSISTENZ_SAMMELMAIL_BUTTON_BETREUER = $this->config->item('ASSISTENZ_SAMMELMAIL_BUTTON_BETREUER');
|
||||
|
||||
$ret = array(
|
||||
'old_abgabe_beurteilung_link' => $old_abgabe_beurteilung_link,
|
||||
'turnitin_link' => $turnitin_link,
|
||||
'abgabetypenBetreuer' => $abgabetypenBetreuer
|
||||
'abgabetypenBetreuer' => $abgabetypenBetreuer,
|
||||
'ASSISTENZ_SAMMELMAIL_BUTTON_STUDENT' => $ASSISTENZ_SAMMELMAIL_BUTTON_STUDENT,
|
||||
'ASSISTENZ_SAMMELMAIL_BUTTON_BETREUER' => $ASSISTENZ_SAMMELMAIL_BUTTON_BETREUER
|
||||
);
|
||||
|
||||
$this->terminateWithSuccess($ret);
|
||||
@@ -762,7 +766,7 @@ class Abgabe extends FHCAPI_Controller
|
||||
/**
|
||||
* helper function to fetch the correct email for a projektarbeits erstbetreuer
|
||||
*/
|
||||
private function getProjektbetreuerEmail($projektarbeit_id) {
|
||||
private function getProjektbetreuerEmailByProjektarbeitID($projektarbeit_id) {
|
||||
$this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel');
|
||||
$result = $this->ProjektarbeitModel->getProjektbetreuerEmail($projektarbeit_id);
|
||||
$email = $this->getDataOrTerminateWithError($result, 'general');
|
||||
@@ -771,6 +775,18 @@ class Abgabe extends FHCAPI_Controller
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* helper function to fetch the correct email for a projektarbeits zweitbetreuer by their person id
|
||||
* can be used for erstbetreuer aswell if necessary
|
||||
*/
|
||||
private function getProjektbetreuerEmailByPersonID($person_id) {
|
||||
$this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel');
|
||||
$result = $this->ProjektarbeitModel->getProjektbetreuerEmailByPersonID($person_id);
|
||||
$email = $this->getDataOrTerminateWithError($result, 'general');
|
||||
|
||||
return $email[0]->uid ? $email[0]->uid.'@'.DOMAIN : $email[0]->private_email;
|
||||
}
|
||||
|
||||
//TODO: SWITCH TO NOTEN API ONCE NOTENTOOL IS IN MASTER TO AVOID DUPLICATE API
|
||||
|
||||
/**
|
||||
@@ -887,6 +903,12 @@ class Abgabe extends FHCAPI_Controller
|
||||
|
||||
// map the abgaben into projektarbeiten
|
||||
foreach($projektarbeiten as $projektarbeit) {
|
||||
$projektarbeit->betreuer_mail = $this->getProjektbetreuerEmailByProjektarbeitID($projektarbeit->projektarbeit_id);
|
||||
|
||||
if($projektarbeit->zweitbetreuer_person_id !== null) {
|
||||
$projektarbeit->zweitbetreuer_mail = $this->getProjektbetreuerEmailByPersonID($projektarbeit->zweitbetreuer_person_id);
|
||||
}
|
||||
|
||||
$filterFunc = function($projektabgabe) use ($projektarbeit) {
|
||||
return $projektabgabe->projektarbeit_id == $projektarbeit->projektarbeit_id;
|
||||
};
|
||||
@@ -1140,7 +1162,7 @@ class Abgabe extends FHCAPI_Controller
|
||||
$maildata['bewertunglink'] = $projektarbeitIsCurrent && $paabgabetyp_kurzbz == 'end' ? "<p><a href='$mail_fulllink'>Zur Beurteilung der Arbeit</a></p>" : "";
|
||||
$maildata['token'] = "";
|
||||
|
||||
$email = $this->getProjektbetreuerEmail($projektarbeit_id);
|
||||
$email = $this->getProjektbetreuerEmailByProjektarbeitID($projektarbeit_id);
|
||||
|
||||
if(!$email) $this->terminateWithError($this->p->t('abgabetool', 'c4fehlerMailBegutachter'), 'general');
|
||||
|
||||
|
||||
@@ -244,6 +244,28 @@ class Projektarbeit_model extends DB_Model
|
||||
|
||||
return $this->execReadOnlyQuery($qry, [$projektarbeit_id]);
|
||||
}
|
||||
|
||||
public function getProjektbetreuerEmailByPersonID($person_id) {
|
||||
$qry = "SELECT (
|
||||
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, mitarbeiter_uid as 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 OR ben.aktiv IS NULL)
|
||||
AND person_id = ?";
|
||||
|
||||
return $this->execReadOnlyQuery($qry, [$person_id]);
|
||||
}
|
||||
|
||||
public function getProjektarbeitBenutzer($uid) {
|
||||
$qry="SELECT * FROM campus.vw_benutzer where uid=?";
|
||||
|
||||
@@ -77,6 +77,8 @@ export const AbgabetoolAssistenz = {
|
||||
phrasenResolved: false,
|
||||
turnitin_link: null,
|
||||
old_abgabe_beurteilung_link: null,
|
||||
ASSISTENZ_SAMMELMAIL_BUTTON_STUDENT: null,
|
||||
ASSISTENZ_SAMMELMAIL_BUTTON_BETREUER: null,
|
||||
saving: false,
|
||||
loading: false,
|
||||
abgabeTypeOptions: null,
|
||||
@@ -221,6 +223,32 @@ export const AbgabetoolAssistenz = {
|
||||
]};
|
||||
},
|
||||
methods: {
|
||||
sammelMailStudent() {
|
||||
const emails = this.selectedData
|
||||
.map(row => `${row.student_uid}@${this.domain}`)
|
||||
.join(',');
|
||||
|
||||
const subject = this.$p.t('abgabetool/c4sammelmailStudentBetreff', [this.selectedStudiengangOption?.bezeichnung]);
|
||||
|
||||
const href = `mailto:${emails}?subject=${subject}`;
|
||||
|
||||
window.location.href = href
|
||||
},
|
||||
sammelMailBetreuer() {
|
||||
const recipientList = [];
|
||||
this.selectedData.forEach(row => {
|
||||
if (row.betreuer_mail) recipientList.push(row.betreuer_mail);
|
||||
if (row.zweitbetreuer_mail) recipientList.push(row.zweitbetreuer_mail);
|
||||
});
|
||||
|
||||
// actually not necessary for email clients but looks better for assistenz if we avoid duplicates here
|
||||
const uniqueRecipients = [...new Set(recipientList)];
|
||||
|
||||
const subject = this.$p.t('abgabetool/c4sammelmailBetreuerBetreff', [this.selectedStudiengangOption?.bezeichnung]);
|
||||
const href = `mailto:${uniqueRecipients.join(',')}?subject=${encodeURIComponent(subject)}`;
|
||||
|
||||
window.location.href = href;
|
||||
},
|
||||
selectHandler(e, cell) {
|
||||
const row = cell.getRow();
|
||||
|
||||
@@ -620,9 +648,8 @@ export const AbgabetoolAssistenz = {
|
||||
|
||||
const mappedData = this.mapProjekteToTableData(this.projektarbeiten)
|
||||
|
||||
this.$refs.abgabeTable.tabulator.setColumns(this.abgabeTableOptions.columns)
|
||||
this.$refs.abgabeTable.tabulator.setData(mappedData)
|
||||
|
||||
this.$refs.abgabeTable.tabulator.redraw(true)
|
||||
}).finally(()=>{
|
||||
this.saving = false
|
||||
})
|
||||
@@ -867,8 +894,8 @@ export const AbgabetoolAssistenz = {
|
||||
tableResolve(resolve) {
|
||||
this.tableBuiltResolve = resolve
|
||||
},
|
||||
buildMailToLink(abgabe) {
|
||||
return 'mailto:' + abgabe.student_uid +'@'+ this.domain
|
||||
buildMailToLink(projekt) {
|
||||
return 'mailto:' + projekt.student_uid +'@'+ this.domain
|
||||
},
|
||||
buildPKZ(projekt) {
|
||||
return `${projekt.student_uid} / ${projekt.matrikelnr}`
|
||||
@@ -941,6 +968,29 @@ export const AbgabetoolAssistenz = {
|
||||
this.calcMaxTableHeight()
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
uniqueBetreuerEmailCount() {
|
||||
const emails = new Set();
|
||||
|
||||
this.selectedData.forEach(row => {
|
||||
if (row.betreuer_mail) emails.add(row.betreuer_mail);
|
||||
if (row.zweitbetreuer_mail) emails.add(row.zweitbetreuer_mail);
|
||||
});
|
||||
|
||||
return emails.size;
|
||||
},
|
||||
uniqueStudentEmailCount() {
|
||||
const emails = new Set();
|
||||
|
||||
this.selectedData.forEach(row => {
|
||||
if (row.student_uid) {
|
||||
emails.add(row.student_uid); // actually dont need domain for this
|
||||
}
|
||||
});
|
||||
|
||||
return emails.size;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'serienTermin.bezeichnung'(newVal) {
|
||||
if(newVal?.paabgabetyp_kurzbz === 'qualgate1' || newVal?.paabgabetyp_kurzbz === 'qualgate2') {
|
||||
@@ -987,6 +1037,8 @@ export const AbgabetoolAssistenz = {
|
||||
const res = results[0].value;
|
||||
this.turnitin_link = res.data?.turnitin_link;
|
||||
this.old_abgabe_beurteilung_link = res.data?.old_abgabe_beurteilung_link;
|
||||
this.ASSISTENZ_SAMMELMAIL_BUTTON_STUDENT = res.data?.ASSISTENZ_SAMMELMAIL_BUTTON_STUDENT;
|
||||
this.ASSISTENZ_SAMMELMAIL_BUTTON_BETREUER = res.data?.ASSISTENZ_SAMMELMAIL_BUTTON_BETREUER;
|
||||
}
|
||||
|
||||
// 2. Studiengänge
|
||||
@@ -1292,6 +1344,16 @@ export const AbgabetoolAssistenz = {
|
||||
:useSelectionSpan="false"
|
||||
>
|
||||
<template #actions>
|
||||
<button v-if="ASSISTENZ_SAMMELMAIL_BUTTON_STUDENT"
|
||||
role="button" class="btn btn-secondary ml-2"
|
||||
@click="sammelMailStudent">
|
||||
{{ $p.t('abgabetool/c4sendEmailStudierendev2', [uniqueStudentEmailCount]) }}
|
||||
</button>
|
||||
<button v-if="ASSISTENZ_SAMMELMAIL_BUTTON_BETREUER"
|
||||
role="button" class="btn btn-secondary ml-2"
|
||||
@click="sammelMailBetreuer">
|
||||
{{ $p.t('abgabetool/c4sendEmailBetreuerv2', [uniqueBetreuerEmailCount]) }}
|
||||
</button>
|
||||
<Dropdown
|
||||
@change="semesterChanged"
|
||||
:placeholder="$capitalize($p.t('lehre/studiensemester'))"
|
||||
|
||||
@@ -45510,18 +45510,18 @@ array(
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'abgabetool',
|
||||
'phrase' => 'c4sendEmailStudierende',
|
||||
'phrase' => 'c4sendEmailStudierendev2',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Email an Studierende schicken',
|
||||
'text' => 'Email an {0} Studierende schicken',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Send Email to students',
|
||||
'text' => 'Send Email to {0} students',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
@@ -45530,18 +45530,58 @@ array(
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'abgabetool',
|
||||
'phrase' => 'c4sendEmailBetreuer',
|
||||
'phrase' => 'c4sammelmailStudentBetreff',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Email an Betreuende schicken',
|
||||
'text' => 'Betreuungen Bachelorarbeit bzw. Master Thesis bei Studiengang {0}',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Send Email to assessors',
|
||||
'text' => "Supervision of Bachelor's thesis or Master's thesis for degree program {0}",
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'abgabetool',
|
||||
'phrase' => 'c4sendEmailBetreuerv2',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Email an {0} Betreuende schicken',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Send Email to {0} assessors',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'abgabetool',
|
||||
'phrase' => 'c4sammelmailBetreuerBetreff',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Betreuungen Bachelorarbeit bzw. Master Thesis bei Studiengang {0}',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => "Supervision of Bachelor's thesis or Master's thesis for degree program {0}",
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user