mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 09:52:22 +00:00
NotenTab: Phrases
This commit is contained in:
@@ -37,6 +37,11 @@ class Documents extends Auth_Controller
|
||||
'export' => self::PERM_LOGGED,
|
||||
'exportSigned' => self::PERM_LOGGED
|
||||
]);
|
||||
|
||||
// Load Phrases
|
||||
$this->loadPhrases([
|
||||
'stv'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,7 +232,7 @@ class Documents extends Auth_Controller
|
||||
|
||||
$vorlage = current(getData($result));
|
||||
if ($sign_user && !$vorlage->signierbar)
|
||||
return show_error('Diese Vorlage darf nicht signiert werden'); // TODO(chris): phrase
|
||||
return show_error($this->p->t("stv", "grades_error_sign"));
|
||||
|
||||
|
||||
// Filename
|
||||
|
||||
@@ -45,6 +45,11 @@ class Documents extends FHCAPI_Controller
|
||||
'archive' => ['admin:rw', 'assistenz:rw'],
|
||||
'archiveSigned' => ['admin:rw', 'assistenz:rw']
|
||||
]);
|
||||
|
||||
// Load Phrases
|
||||
$this->loadPhrases([
|
||||
'stv'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,7 +182,7 @@ class Documents extends FHCAPI_Controller
|
||||
$result = $this->PrestudentstatusModel->getLastStatus($student->prestudent_id, $ss);
|
||||
$status = current($this->getDataOrTerminateWithError($result));
|
||||
if (!$status)
|
||||
$this->terminateWithError('StudentIn hat keinen Status in diesem Semester'); // TODO(chris): phrase
|
||||
$this->terminateWithError($this->p->t("stv", "grades_error_prestudentstatus"));
|
||||
$semester = $status->ausbildungssemester;
|
||||
|
||||
$this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel');
|
||||
@@ -388,10 +393,10 @@ class Documents extends FHCAPI_Controller
|
||||
}
|
||||
|
||||
if (!$vorlage->archivierbar)
|
||||
$this->terminateWithError('Dieses Dokument ist nicht archivierbar'); // TODO(chris): phrase
|
||||
$this->terminateWithError($this->p->t("stv", "grades_error_archive"));
|
||||
|
||||
if ($sign_user && !$vorlage->signierbar)
|
||||
$this->terminateWithError('Diese Vorlage darf nicht signiert werden'); // TODO(chris): phrase
|
||||
$this->terminateWithError($this->p->t("stv", "grades_error_sign"));
|
||||
|
||||
|
||||
$this->load->library('DocumentExportLib');
|
||||
|
||||
@@ -272,8 +272,8 @@ class Config extends FHCAPI_Controller
|
||||
|
||||
$title_ger = $this->p->t("global", "deutsch");
|
||||
$title_eng = $this->p->t("global", "englisch");
|
||||
$title_ff = 'Zertifikat'; // TODO(chris): phrase
|
||||
$title_lv = 'LV Zeugnis'; // TODO(chris): phrase
|
||||
$title_ff = $this->p->t("stv", "document_certificate");
|
||||
$title_lv = $this->p->t("stv", "document_coursecertificate");
|
||||
|
||||
$link_ff = "documents/export/" .
|
||||
"zertifikat.rdf.php/" .
|
||||
@@ -298,7 +298,7 @@ class Config extends FHCAPI_Controller
|
||||
"&lvid={lehrveranstaltung_id}";
|
||||
|
||||
$archive_url = "api/frontend/v1/documents/archiveSigned";
|
||||
$archive_response = $this->p->t("stv", "document_signed_and_archived"); // TODO(chris): phrase
|
||||
$archive_response = $this->p->t("stv", "document_signed_and_archived");
|
||||
$archive_post_ff = [
|
||||
"xml" => "zertifikat.rdf.php",
|
||||
"xsl" => "Zertifikat",
|
||||
@@ -326,7 +326,7 @@ class Config extends FHCAPI_Controller
|
||||
|
||||
$list = [
|
||||
[
|
||||
'title' => '<i class="fa fa-download" title="Download"></i>', // TODO(chris): phrase
|
||||
'title' => '<i class="fa fa-download" title="' . $this->p->t("stv", "document_download") . '"></i>',
|
||||
'children' => [
|
||||
[
|
||||
'title' => $title_ff,
|
||||
@@ -382,7 +382,7 @@ class Config extends FHCAPI_Controller
|
||||
]
|
||||
],
|
||||
[
|
||||
'title' => '<i class="fas fa-archive" title="Archivieren"></i>', // TODO(chris): phrase
|
||||
'title' => '<i class="fas fa-archive" title="' . $this->p->t("stv", "document_archive") . '"></i>',
|
||||
'children' => [
|
||||
[
|
||||
'title' => $title_ff,
|
||||
|
||||
@@ -44,6 +44,7 @@ class Grades extends FHCAPI_Controller
|
||||
|
||||
// Load Phrases
|
||||
$this->loadPhrases([
|
||||
'stv',
|
||||
'person',
|
||||
'lehre'
|
||||
]);
|
||||
@@ -327,7 +328,7 @@ class Grades extends FHCAPI_Controller
|
||||
$certificateGrade = current($certificateGrade);
|
||||
|
||||
if (!$certificateGrade->lkt_ueberschreibbar)
|
||||
$this->terminateWithError("Nicht überschreibbar"); // TODO(chris): phrase
|
||||
$this->terminateWithError($this->p->t("stv", "grades_error_overwrite"));
|
||||
|
||||
// NOTE(chris): update
|
||||
$data['updateamum'] = $data['uebernahmedatum'];
|
||||
@@ -376,7 +377,7 @@ class Grades extends FHCAPI_Controller
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules("studierendenantrag_lehrveranstaltung_id", "", "required|integer"); // TODO(chris): phrase
|
||||
$this->form_validation->set_rules("studierendenantrag_lehrveranstaltung_id", "studierendenantrag_lehrveranstaltung_id", "required|integer");
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
@@ -454,7 +455,7 @@ class Grades extends FHCAPI_Controller
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules("lehrveranstaltung_id", $this->p->t('lehre', 'lehrveranstaltung'), "required|integer");
|
||||
$this->form_validation->set_rules("points", "Punkte", "required|numeric"); // TODO(chris): phrase
|
||||
$this->form_validation->set_rules("points", $this->p->t("stv", "grades_points"), "required|numeric");
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
@@ -496,7 +497,7 @@ class Grades extends FHCAPI_Controller
|
||||
if (isError($result))
|
||||
return $result;
|
||||
if (!hasData($result))
|
||||
return error('Fehler beim Ermitteln der Lehreinheit ID'); // TODO(chris): phrase
|
||||
return error($this->p->t("stv", "grades_error_lehreinheit_id"));
|
||||
$le = current(getData($result));
|
||||
|
||||
// Prepare
|
||||
|
||||
@@ -87,6 +87,9 @@ class DocumentExportLib
|
||||
// Gets CI instance
|
||||
$this->ci =& get_instance();
|
||||
|
||||
// Load Phrases
|
||||
$this->ci->load->library('PhrasesLib', ['document_export', null], 'documentExportPhrases');
|
||||
|
||||
// Which document converter has to be used
|
||||
if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true)
|
||||
{
|
||||
@@ -104,10 +107,10 @@ class DocumentExportLib
|
||||
$this->unoconv_version = $hlp[1];
|
||||
}
|
||||
else
|
||||
show_error('Could not get Unoconv Version'); // TODO(chris): phrase
|
||||
show_error($this->ci->documentExportPhrases->t("document_export", "error_unoconv_version"));
|
||||
}
|
||||
else
|
||||
show_error('Unoconv not found - Please install Unoconv'); // TODO(chris): phrase
|
||||
show_error($this->ci->documentExportPhrases->t("document_export", "error_unoconv"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +172,11 @@ class DocumentExportLib
|
||||
$xml_data = new DOMDocument;
|
||||
|
||||
if (!$xml_data->load($xml_url))
|
||||
return error('unable to load xml: ' . $xml_url . ' XML:' . $xml . ' PARAMs:' . $params); // TODO(chris): phrase
|
||||
return error($this->ci->documentExportPhrases->t("document_export", "error_xml_load", [
|
||||
"url" => $xml_url,
|
||||
"xml" => $xml,
|
||||
"params" => $params
|
||||
]));
|
||||
|
||||
return success($xml_data);
|
||||
}
|
||||
@@ -249,7 +256,7 @@ class DocumentExportLib
|
||||
$fsize = filesize($temp_filename);
|
||||
$handle = fopen($temp_filename, 'r');
|
||||
if (!$handle)
|
||||
return error('load failed'); // TODO(chris): phrase
|
||||
return error($this->ci->documentExportPhrases->t("document_export", "error_file_load"));
|
||||
$result = fread($handle, $fsize);
|
||||
fclose($handle);
|
||||
|
||||
@@ -311,12 +318,12 @@ class DocumentExportLib
|
||||
$handle = fopen($temp_filename, 'r');
|
||||
if (!$handle) {
|
||||
$this->close($temp_folder, $source_folder);
|
||||
exit('load failed'); // TODO(chris): phrase
|
||||
exit($this->ci->documentExportPhrases->t("document_export", "error_file_load"));
|
||||
}
|
||||
|
||||
if (headers_sent()) {
|
||||
$this->close($temp_folder, $source_folder);
|
||||
exit('Header wurden bereits gesendet -> Abbruch'); // TODO(chris): phrase
|
||||
exit($this->ci->documentExportPhrases->t("document_export", "error_headers"));
|
||||
}
|
||||
|
||||
switch ($outputformat) {
|
||||
@@ -339,7 +346,7 @@ class DocumentExportLib
|
||||
break;
|
||||
default:
|
||||
$this->close($temp_folder, $source_folder);
|
||||
exit('Outputformat is not defined'); // TODO(chris): phrase
|
||||
exit($this->ci->documentExportPhrases->t("document_export", "error_outputformat_missing"));
|
||||
}
|
||||
|
||||
while (!feof($handle)) {
|
||||
@@ -386,7 +393,7 @@ class DocumentExportLib
|
||||
if (isError($result))
|
||||
return $result;
|
||||
if (!hasData($result))
|
||||
return error('no vorlage found'); // TODO(chris): phrase
|
||||
return error($this->ci->documentExportPhrases->t("document_export", "error_template_missing"));
|
||||
$vorlage_stg = current(getData($result));
|
||||
foreach ($vorlage_stg as $k => $v)
|
||||
$vorlage->$k = $v;
|
||||
@@ -426,7 +433,7 @@ class DocumentExportLib
|
||||
{
|
||||
$content_xsl = new DOMDocument();
|
||||
if (!$content_xsl->loadXML($vorlage->text))
|
||||
return error('unable to load xsl'); // TODO(chris): phrase
|
||||
return error($this->ci->documentExportPhrases->t("document_export", "error_xsl_load"));
|
||||
|
||||
$proc = new XSLTProcessor();
|
||||
$proc->importStyleSheet($content_xsl);
|
||||
@@ -442,7 +449,7 @@ class DocumentExportLib
|
||||
if ($vorlage->style) {
|
||||
$styles_xsl = new DOMDocument();
|
||||
if (!$styles_xsl->loadXML($vorlage->style))
|
||||
return error('unable to load styles xsl'); // TODO(chris): phrase
|
||||
return error($this->ci->documentExportPhrases->t("document_export", "error_styles_load"));
|
||||
$style_proc = new XSLTProcessor();
|
||||
$style_proc->importStyleSheet($styles_xsl);
|
||||
|
||||
@@ -470,7 +477,7 @@ class DocumentExportLib
|
||||
$tempname_zip = $temp_folder . '/out.zip';
|
||||
|
||||
if (!copy($zipfile, $tempname_zip))
|
||||
return error('copy failed'); // TODO(chris): phrase
|
||||
return error($this->ci->documentExportPhrases->t("document_export", "error_file_copy"));
|
||||
|
||||
exec("zip $tempname_zip content.xml");
|
||||
if (!is_null($styles_xsl))
|
||||
@@ -490,7 +497,7 @@ class DocumentExportLib
|
||||
|
||||
$manifest_xml = new DOMDocument;
|
||||
if (!$manifest_xml->loadXML($manifest))
|
||||
return error('Manifest File ungueltig'); // TODO(chris): phrase
|
||||
return error($this->ci->documentExportPhrases->t("document_export", "error_manifest"));
|
||||
|
||||
//root-node holen
|
||||
$root = $manifest_xml->getElementsByTagName('manifest')->item(0);
|
||||
@@ -547,11 +554,8 @@ class DocumentExportLib
|
||||
exec($command, $out, $ret);
|
||||
}
|
||||
|
||||
if ($ret) {
|
||||
return error('Dokumentenkonvertierung ist derzeit nicht' .
|
||||
' möglich. Bitte versuchen Sie es in einer Minute' .
|
||||
' erneut oder kontaktieren Sie einen Administrator'); // TODO(chris): phrase
|
||||
}
|
||||
if ($ret)
|
||||
return error($this->ci->documentExportPhrases->t("document_export", "error_conv_timeout"));
|
||||
break;
|
||||
case 'odt':
|
||||
default:
|
||||
@@ -576,7 +580,7 @@ class DocumentExportLib
|
||||
protected function sign($temp_folder, $temp_filename, $outputformat, $user, $profile)
|
||||
{
|
||||
if ($outputformat != 'pdf')
|
||||
return error('Derzeit koennen nur PDFs signiert werden'); // TODO(chris): phrase
|
||||
return error($this->ci->documentExportPhrases->t("document_export", "error_sign_pdf"));
|
||||
|
||||
// Load the File
|
||||
$file_data = file_get_contents($temp_filename);
|
||||
@@ -618,7 +622,7 @@ class DocumentExportLib
|
||||
$result = curl_exec($ch);
|
||||
if (curl_errno($ch)) {
|
||||
curl_close($ch);
|
||||
return error('Signaturserver ist derzeit nicht erreichbar'); // TODO(chris): phrase
|
||||
return error($this->ci->documentExportPhrases->t("document_export", "error_sign_timeout"));
|
||||
}
|
||||
curl_close($ch);
|
||||
$resultdata = json_decode($result);
|
||||
@@ -631,7 +635,7 @@ class DocumentExportLib
|
||||
}
|
||||
|
||||
// otherwise if it is an error
|
||||
return error($resultdata->retval ?? 'Unknown Error:' . $result); // TODO(chris): phrase
|
||||
return error($resultdata->retval ?? $this->ci->documentExportPhrases->t("global", "unknown_error", ["error" => $result]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user