AbgabetoolStudent beurteilung erstbetreuer/zweitbetreuer switch + get the actual link from the projektarbeitsbeurteilung extension via event 'projektbeurteilung_download_link' + fallback from config in case that fails; WIP implementing the switch for lektor beurteilungstemplate based on isCurrent/Semester etc in an Event in the pabu extension;

This commit is contained in:
Johann Hoffmann
2025-12-02 16:07:26 +01:00
parent 6359dc0fc9
commit 7747857583
4 changed files with 99 additions and 19 deletions
+3 -1
View File
@@ -15,4 +15,6 @@ $config['URL_MITARBEITER'] = 'index.ci.php/Cis/Abgabetool/Mitarbeiter';
// lehre.tbl_paabgabetyp bezeichnung
$config['ALLOWED_ABGABETYPEN_BETREUER'] = ['Zwischenabgabe', 'Quality Gate 1', 'Quality Gate 2'];
$config['ALLOWED_NOTEN_ABGABETOOL'] = ['Bestanden', 'Nicht bestanden'];
$config['ALLOWED_NOTEN_ABGABETOOL'] = ['Bestanden', 'Nicht bestanden'];
$config['beurteilung_link_fallback'] = 'addons/fhtw/content/projektbeurteilung/projektbeurteilungDocumentExport.php?projektarbeit_id=?&betreuerart_kurzbz=?&person_id=?';
@@ -18,6 +18,8 @@
if (! defined('BASEPATH')) exit('No direct script access allowed');
use CI3_Events as Events;
class Abgabe extends FHCAPI_Controller
{
@@ -80,7 +82,6 @@ class Abgabe extends FHCAPI_Controller
* loads config related to abgabetool, found in application/config/abgabe
*/
public function getConfig() {
$this->load->config('abgabe');
$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');
@@ -152,6 +153,38 @@ class Abgabe extends FHCAPI_Controller
if(count($projektarbeiten)) {
foreach($projektarbeiten as $pa) {
if($pa->babgeschickt) {
$downloadLink1 = '';
$downloadLinkFunc1 = function ($link) use (&$downloadLink1) {
$downloadLink1 = $link;
};
Events::trigger('projektbeurteilung_download_link', $pa->projektarbeit_id, $pa->betreuerart_kurzbz, $pa->bperson_id, $downloadLinkFunc1);
// use config fallback in case the event fails
if($downloadLink1 == '') {
$fallback = $this->config->item('beurteilung_link_fallback');
$search = array(
'betreuerart_kurzbz=?',
'projektarbeit_id=?',
'person_id=?'
);
$replace = array(
'betreuerart_kurzbz=' . $pa->betreuerart_kurzbz,
'projektarbeit_id=' . $pa->projektarbeit_id,
'person_id=' . $pa->bperson_id
);
$fallback = str_replace($search, $replace, $fallback);
$downloadLink1 = APP_ROOT.$fallback;
}
$pa->downloadLink1 = $downloadLink1;
}
$result = $this->ProjektarbeitModel->getProjektbetreuerEmail($pa->projektarbeit_id);
$data = getData($result);
@@ -159,6 +192,39 @@ class Abgabe extends FHCAPI_Controller
$pa->email = $data[0]->private_email;
}
if($pa->zweitbetreuer_person_id !== null) {
if($pa->zweitbetreuer_abgeschickt) {
$downloadLink2 = '';
$downloadLinkFunc2 = function ($link) use (&$downloadLink2) {
$downloadLink2 = $link;
};
Events::trigger('projektbeurteilung_download_link', $pa->projektarbeit_id, $pa->zweitbetreuer_betreuerart_kurzbz, $pa->zweitbetreuer_person_id, $downloadLinkFunc2);
// use config fallback in case the event fails
if($downloadLink2 == '') {
$fallback = $this->config->item('beurteilung_link_fallback');
$search = array(
'betreuerart_kurzbz=?',
'projektarbeit_id=?',
'person_id=?'
);
$replace = array(
'betreuerart_kurzbz=' . $pa->zweitbetreuer_betreuerart_kurzbz,
'projektarbeit_id=' . $pa->projektarbeit_id,
'person_id=' . $pa->zweitbetreuer_person_id
);
$fallback = str_replace($search, $replace, $fallback);
$downloadLink2 = APP_ROOT.$fallback;
}
$pa->downloadLink2 = $downloadLink2;
}
// TODO: see assistenz query in projektarbeit_model
@@ -1026,4 +1092,5 @@ class Abgabe extends FHCAPI_Controller
}
}
}
}
@@ -223,15 +223,6 @@ export const AbgabetoolStudent = {
this.projektarbeiten = projektarbeiten.map(projekt => {
let mode = 'detailTermine'
if (projekt.babgeschickt || projekt.zweitbetreuer_abgeschickt) {
// mode = 'beurteilungDownload' // build dl link for both betreuer documents
// TODO: if switch zweitbetreuer beurteilung / erstbetreuer beurteilung download
projekt.beurteilungLink1 = 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
if(projekt.zweitbetreuer_abgeschickt && projekt.zweitbetreuer_betreuerart_kurzbz && projekt.zweitbetreuer_person_id) {
projekt.beurteilungLink2 = FHC_JS_DATA_STORAGE_OBJECT.app_root + 'cis/private/pdfExport.php?xml=projektarbeitsbeurteilung.xml.php&xsl=Projektbeurteilung&betreuerart_kurzbz='+projekt.zweitbetreuer_betreuerart_kurzbz+'&projektarbeit_id='+projekt.projektarbeit_id+'&person_id=' + projekt.zweitbetreuer_person_id
}
}
return {
...projekt,
@@ -242,8 +233,8 @@ export const AbgabetoolStudent = {
betreuerart_kurzbz: projekt.betreuerart_kurzbz,
mode
},
beurteilung1: projekt.beurteilungLink1 ?? null,
beurteilung2: projekt.beurteilungLink2 ?? null,
beurteilung1: projekt.downloadLink1 ?? null,
beurteilung2: projekt.downloadLink2 ?? null,
sem: projekt.studiensemester_kurzbz,
stg: projekt.kurzbzlang,
mail: this.buildMailToLink(projekt),
@@ -378,11 +369,11 @@ export const AbgabetoolStudent = {
<div class="col-4 col-md-3 fw-bold">{{$capitalize( $p.t('abgabetool/c4beurteilung') )}}</div>
<div class="col-8 col-md-9">
<button v-if="projektarbeit.beurteilung1" @click="handleDownloadBeurteilung1(projektarbeit)" class="btn btn-primary">
<a> {{$capitalize( $p.t('abgabetool/c4downloadBeurteilung') )}} <i class="fa fa-file-pdf" style="margin-left:4px; cursor: pointer;"></i></a>
<a> {{$capitalize( $p.t('abgabetool/c4downloadBeurteilungErstbetreuer') )}} <i class="fa fa-file-pdf" style="margin-left:4px; cursor: pointer;"></i></a>
</button>
<a v-else>{{$capitalize( $p.t('abgabetool/c4nobeurteilungVorhanden') )}}</a>
<button v-if="projektarbeit.beurteilung2" @click="handleDownloadBeurteilung2(projektarbeit)" class="btn btn-primary">
<a> {{$capitalize( $p.t('abgabetool/c4downloadBeurteilung') )}} <i class="fa fa-file-pdf" style="margin-left:4px; cursor: pointer;"></i></a>
<button v-if="projektarbeit.beurteilung2" @click="handleDownloadBeurteilung2(projektarbeit)" class="btn btn-primary" style="margin-left: 4px;">
<a> {{$capitalize( $p.t('abgabetool/c4downloadBeurteilungZweitbetreuer') )}} <i class="fa fa-file-pdf" style="margin-left:4px; cursor: pointer;"></i></a>
</button>
</div>
</div>
+23 -3
View File
@@ -44096,18 +44096,38 @@ array(
array(
'app' => 'core',
'category' => 'abgabetool',
'phrase' => 'c4downloadBeurteilung',
'phrase' => 'c4downloadBeurteilungErstbetreuer',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Beurteilung herunterladen",
'text' => "Erstbetreuer Beurteilung herunterladen",
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Download Evaluation',
'text' => 'Download evaluation of first assesor',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'abgabetool',
'phrase' => 'c4downloadBeurteilungZweitbetreuer',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Zweitbetreuer Beurteilung herunterladen",
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Download evaluation of second assesor',
'description' => '',
'insertvon' => 'system'
)