mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 16:32:20 +00:00
Standard validations, show Hint KommPrfg, disable noten not active
This commit is contained in:
@@ -46,6 +46,22 @@ class Pruefung extends FHCAPI_Controller
|
||||
|
||||
//Load Models
|
||||
$this->load->model('education/LePruefung_model', 'PruefungModel');
|
||||
|
||||
//TODO(Manu) check
|
||||
// Additional Permission Checks
|
||||
//not working if activated?
|
||||
/* if ($this->router->method == 'insertPruefung'
|
||||
|| $this->router->method == 'updatePruefung'
|
||||
|| $this->router->method == 'deletePruefung'
|
||||
) {
|
||||
$prestudent_id = current(array_slice($this->uri->rsegments, 2));
|
||||
$this->checkPermissionsForPrestudent($prestudent_id, ['admin:rw', 'assistenz:rw']);
|
||||
}*/
|
||||
|
||||
// Load language phrases
|
||||
$this->loadPhrases([
|
||||
'global', 'ui','lehre'
|
||||
]);
|
||||
}
|
||||
|
||||
public function getPruefungen($student_uid, $studiensemester_kurzbz = null)
|
||||
@@ -101,7 +117,6 @@ class Pruefung extends FHCAPI_Controller
|
||||
}
|
||||
|
||||
public function insertPruefung(){
|
||||
//TODO(Manu) Berechtigungen
|
||||
|
||||
$authUID = getAuthUID();
|
||||
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||
@@ -114,10 +129,27 @@ class Pruefung extends FHCAPI_Controller
|
||||
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('lehrveranstaltung_id', $this->p->t('lehre', 'lehrveranstaltung'), 'required', [
|
||||
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('lehre','lehrveranstaltung')]),
|
||||
]);
|
||||
|
||||
$this->form_validation->set_rules('lehreinheit_id', $this->p->t('lehre', 'lehreinheit'), 'required', [
|
||||
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('lehre','lehreinheit')]),
|
||||
]);
|
||||
|
||||
$this->form_validation->set_rules('pruefungstyp_kurzbz', $this->p->t('lehre', 'pruefung'), 'required', [
|
||||
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('global','typ')]),
|
||||
]);
|
||||
|
||||
$this->form_validation->set_rules(
|
||||
'datum', $this->p->t('global', 'datum'), ['is_valid_date']
|
||||
);
|
||||
|
||||
if ($this->form_validation->run() == false)
|
||||
{
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
}
|
||||
|
||||
$result = $this->PruefungModel->insert([
|
||||
'lehreinheit_id' => $lehreinheit_id,
|
||||
'student_uid' => $student_uid,
|
||||
@@ -137,7 +169,7 @@ class Pruefung extends FHCAPI_Controller
|
||||
}
|
||||
|
||||
public function updatePruefung($pruefung_id){
|
||||
//TODO(Manu) validations and Berechtigungen
|
||||
|
||||
$result = $this->PruefungModel->load($pruefung_id);
|
||||
|
||||
$oldpruefung = $this->getDataOrTerminateWithError($result);
|
||||
@@ -154,6 +186,29 @@ class Pruefung extends FHCAPI_Controller
|
||||
$pruefungstyp_kurzbz = $this->input->post('pruefungstyp_kurzbz');
|
||||
$anmerkung = $this->input->post('anmerkung');
|
||||
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('lehrveranstaltung_id', $this->p->t('lehre', 'lehrveranstaltung'), 'required', [
|
||||
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('lehre','lehrveranstaltung')]),
|
||||
]);
|
||||
|
||||
$this->form_validation->set_rules('lehreinheit_id', $this->p->t('lehre', 'lehreinheit'), 'required', [
|
||||
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('lehre','lehreinheit')]),
|
||||
]);
|
||||
|
||||
$this->form_validation->set_rules('pruefungstyp_kurzbz', $this->p->t('lehre', 'pruefung'), 'required', [
|
||||
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('global','typ')]),
|
||||
]);
|
||||
|
||||
$this->form_validation->set_rules(
|
||||
'datum', $this->p->t('global', 'datum'), ['is_valid_date']
|
||||
);
|
||||
|
||||
if ($this->form_validation->run() == false)
|
||||
{
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
}
|
||||
|
||||
$result = $this->PruefungModel->update(
|
||||
[
|
||||
'pruefung_id' => $pruefung_id
|
||||
|
||||
Reference in New Issue
Block a user