mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-28 17:39:28 +00:00
Compare commits
41 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d50590aefb | |||
| c40ee917df | |||
| 8126665acd | |||
| 5826bf5b70 | |||
| fc5ba954fb | |||
| 4e9bf3676d | |||
| 31410f0bb9 | |||
| 1136d9dca1 | |||
| 967f53d73c | |||
| 8c24292195 | |||
| 0a232828c8 | |||
| 0687ef72ce | |||
| 9180b9bd63 | |||
| 168fb00023 | |||
| f5d81e4a93 | |||
| b0f3fa0c46 | |||
| 6d89e95afa | |||
| 07bb0ddffd | |||
| 2f90112e4d | |||
| 774eb90bcc | |||
| 1def930147 | |||
| 30b8a406a5 | |||
| 093842274e | |||
| fd2f4187fa | |||
| b2bebb7fa3 | |||
| e32cce57fe | |||
| bf5ab6b7dd | |||
| aba680cd52 | |||
| 1fe742d9c7 | |||
| 13e8a1a9f6 | |||
| 8487694b37 | |||
| 36beb927f1 | |||
| ee41b2b68d | |||
| c0b685c77b | |||
| a4b1104abf | |||
| c56d323cd3 | |||
| ac4cdb44de | |||
| 97126553f0 | |||
| da03e11071 | |||
| 738c819272 | |||
| ed39127f31 |
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Configs for the Long Run Tasks
|
||||
*/
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
// Maximum LRTs for a single user in parallel
|
||||
$config['lrt_max_number_single_user'] = 10;
|
||||
|
||||
// Maximum LRTs for the whole system in parallel
|
||||
$config['lrt_max_number_system'] = 100;
|
||||
|
||||
// Maximum running time in hours for a single LRT before killing it
|
||||
$config['lrt_max_run_timeout'] = 24;
|
||||
|
||||
// List of existing LRT types
|
||||
$config['lrt_types'] = array('LRTDummy');
|
||||
|
||||
@@ -25,9 +25,6 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
*/
|
||||
class Students extends FHCAPI_Controller
|
||||
{
|
||||
private $allowedStgs = [];
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$permissions = [];
|
||||
@@ -35,16 +32,17 @@ class Students extends FHCAPI_Controller
|
||||
$permissions[$router->method] = ['admin:r', 'assistenz:r'];
|
||||
parent::__construct($permissions);
|
||||
|
||||
$this->allowedStgs = $this->permissionlib->getSTG_isEntitledFor('admin') ?: [];
|
||||
$this->allowedStgs = array_merge($this->allowedStgs, $this->permissionlib->getSTG_isEntitledFor('assistenz') ?: []);
|
||||
$allowedStgs = $this->permissionlib->getSTG_isEntitledFor('admin') ?: [];
|
||||
$allowedStgs = array_merge($allowedStgs, $this->permissionlib->getSTG_isEntitledFor('assistenz') ?: []);
|
||||
|
||||
if (!$this->allowedStgs) {
|
||||
if (!$allowedStgs) {
|
||||
$this->_outputAuthError([$router->method => ['admin:r', 'assistenz:r']]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Load Libraries
|
||||
$this->load->library('PhrasesLib');
|
||||
$this->load->library('stv/StudentListLib', ['allowedStgs' => $allowedStgs]);
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
'lehre'
|
||||
@@ -111,23 +109,19 @@ class Students extends FHCAPI_Controller
|
||||
]);
|
||||
|
||||
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
|
||||
$this->PrestudentModel->addJoin(
|
||||
$this->studentlistlib->addJoin(
|
||||
"(
|
||||
SELECT prestudent_id
|
||||
FROM public.tbl_prestudentstatus
|
||||
WHERE status_kurzbz = 'Incoming'
|
||||
AND studiensemester_kurzbz = " . $this->PrestudentModel->escape($studiensemester_kurzbz) . "
|
||||
) test",
|
||||
"prestudent_id"
|
||||
"prestudent_id",
|
||||
"",
|
||||
"start"
|
||||
);
|
||||
|
||||
|
||||
$this->prepareQuery($studiensemester_kurzbz);
|
||||
|
||||
$this->PrestudentModel->addSelect("COALESCE(
|
||||
$this->studentlistlib->addSelect("COALESCE(
|
||||
v.semester::text,
|
||||
CASE
|
||||
WHEN pls.status_kurzbz IN ('Aufgenommener', 'Bewerber', 'Wartender', 'interessent')
|
||||
@@ -135,16 +129,13 @@ class Students extends FHCAPI_Controller
|
||||
ELSE ''::text
|
||||
END
|
||||
) AS semester", false);
|
||||
$this->PrestudentModel->addSelect("COALESCE(v.verband::text, ''::text)");
|
||||
$this->PrestudentModel->addSelect("COALESCE(v.gruppe::text, ''::text)");
|
||||
|
||||
$this->addSelectPrioRel();
|
||||
$this->studentlistlib->addSelect("COALESCE(v.verband::text, ''::text) AS verband");
|
||||
$this->studentlistlib->addSelect("COALESCE(v.gruppe::text, ''::text) AS gruppe");
|
||||
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
|
||||
$result = $this->PrestudentModel->load();
|
||||
|
||||
$result = $this->studentlistlib->execute($studiensemester_kurzbz);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
@@ -164,10 +155,7 @@ class Students extends FHCAPI_Controller
|
||||
]);
|
||||
|
||||
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
|
||||
$this->PrestudentModel->addJoin(
|
||||
$this->studentlistlib->addJoin(
|
||||
"(
|
||||
SELECT prestudent_id
|
||||
FROM bis.tbl_bisio bis
|
||||
@@ -187,14 +175,12 @@ class Students extends FHCAPI_Controller
|
||||
) AND stdsem.studiensemester_kurzbz = " . $this->PrestudentModel->escape($studiensemester_kurzbz) . "
|
||||
GROUP BY prestudent_id
|
||||
) test",
|
||||
"prestudent_id"
|
||||
"prestudent_id",
|
||||
"",
|
||||
"start"
|
||||
);
|
||||
|
||||
|
||||
$this->prepareQuery($studiensemester_kurzbz);
|
||||
|
||||
|
||||
$this->PrestudentModel->addSelect("COALESCE(
|
||||
$this->studentlistlib->addSelect("COALESCE(
|
||||
v.semester::text,
|
||||
CASE
|
||||
WHEN pls.status_kurzbz IN ('Aufgenommener', 'Bewerber', 'Wartender', 'interessent')
|
||||
@@ -202,16 +188,13 @@ class Students extends FHCAPI_Controller
|
||||
ELSE ''::text
|
||||
END
|
||||
) AS semester", false);
|
||||
$this->PrestudentModel->addSelect("COALESCE(v.verband::text, ''::text)");
|
||||
$this->PrestudentModel->addSelect("COALESCE(v.gruppe::text, ''::text)");
|
||||
$this->studentlistlib->addSelect("COALESCE(v.verband::text, ''::text) AS verband");
|
||||
$this->studentlistlib->addSelect("COALESCE(v.gruppe::text, ''::text) AS gruppe");
|
||||
|
||||
$this->addSelectPrioRel();
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
|
||||
$result = $this->PrestudentModel->load();
|
||||
|
||||
$result = $this->studentlistlib->execute($studiensemester_kurzbz);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
@@ -231,23 +214,18 @@ class Students extends FHCAPI_Controller
|
||||
]);
|
||||
|
||||
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
|
||||
$this->PrestudentModel->addJoin(
|
||||
$this->studentlistlib->addJoin(
|
||||
"(
|
||||
SELECT prestudent_id
|
||||
FROM bis.tbl_mobilitaet
|
||||
WHERE studiensemester_kurzbz = " . $this->PrestudentModel->escape($studiensemester_kurzbz) . "
|
||||
) bis",
|
||||
"prestudent_id"
|
||||
"prestudent_id",
|
||||
"",
|
||||
"start"
|
||||
);
|
||||
|
||||
|
||||
$this->prepareQuery($studiensemester_kurzbz);
|
||||
|
||||
|
||||
$this->PrestudentModel->addSelect("COALESCE(
|
||||
$this->studentlistlib->addSelect("COALESCE(
|
||||
v.semester::text,
|
||||
CASE
|
||||
WHEN pls.status_kurzbz IN ('Aufgenommener', 'Bewerber', 'Wartender', 'interessent')
|
||||
@@ -255,16 +233,13 @@ class Students extends FHCAPI_Controller
|
||||
ELSE ''::text
|
||||
END
|
||||
) AS semester", false);
|
||||
$this->PrestudentModel->addSelect("COALESCE(v.verband::text, ''::text)");
|
||||
$this->PrestudentModel->addSelect("COALESCE(v.gruppe::text, ''::text)");
|
||||
$this->studentlistlib->addSelect("COALESCE(v.verband::text, ''::text) AS verband");
|
||||
$this->studentlistlib->addSelect("COALESCE(v.gruppe::text, ''::text) AS gruppe");
|
||||
|
||||
$this->addSelectPrioRel();
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
|
||||
$result = $this->PrestudentModel->load();
|
||||
|
||||
$result = $this->studentlistlib->execute($studiensemester_kurzbz);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
@@ -313,8 +288,6 @@ class Students extends FHCAPI_Controller
|
||||
*/
|
||||
protected function fetchPrestudents($studiengang_kz, $studiensemester_kurzbz = null, $filter = null, $orgform_kurzbz = null)
|
||||
{
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$stdsemEsc = $studiensemester_kurzbz ? $this->PrestudentModel->escape($studiensemester_kurzbz) : 'NULL';
|
||||
|
||||
$selectRT = "
|
||||
@@ -331,38 +304,38 @@ class Students extends FHCAPI_Controller
|
||||
AND r.studiensemester_kurzbz=" . $stdsemEsc;
|
||||
|
||||
|
||||
$where = ['tbl_prestudent.studiengang_kz' => $studiengang_kz];
|
||||
$this->studentlistlib->addWhere('tbl_prestudent.studiengang_kz', $studiengang_kz);
|
||||
|
||||
if ($orgform_kurzbz) {
|
||||
$where['ps.orgform_kurzbz'] = $orgform_kurzbz;
|
||||
$this->studentlistlib->addWhere('ps.orgform_kurzbz', $orgform_kurzbz);
|
||||
}
|
||||
|
||||
switch ($filter) {
|
||||
case "interessenten":
|
||||
$where['ps.status_kurzbz'] = 'Interessent';
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Interessent');
|
||||
break;
|
||||
case "bewerbungnichtabgeschickt":
|
||||
$where['ps.status_kurzbz'] = 'Interessent';
|
||||
$where['ps.bewerbung_abgeschicktamum'] = null;
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Interessent');
|
||||
$this->studentlistlib->addWhere('ps.bewerbung_abgeschicktamum IS NULL');
|
||||
break;
|
||||
case "bewerbungabgeschickt":
|
||||
$where['ps.status_kurzbz'] = 'Interessent';
|
||||
$where['ps.bewerbung_abgeschicktamum IS NOT NULL'] = null;
|
||||
$where['ps.bestaetigtam'] = null;
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Interessent');
|
||||
$this->studentlistlib->addWhere('ps.bewerbung_abgeschicktamum IS NOT NULL');
|
||||
$this->studentlistlib->addWhere('ps.bestaetigtam IS NULL');
|
||||
break;
|
||||
case "statusbestaetigt":
|
||||
$where['ps.status_kurzbz'] = 'Interessent';
|
||||
$where['ps.bestaetigtam IS NOT NULL'] = null;
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Interessent');
|
||||
$this->studentlistlib->addWhere('ps.bestaetigtam IS NOT NULL');
|
||||
break;
|
||||
case "statusbestaetigtrtnichtangemeldet":
|
||||
$where['ps.status_kurzbz'] = 'Interessent';
|
||||
$where['ps.bestaetigtam IS NOT NULL'] = null;
|
||||
$this->PrestudentModel->db->where('NOT EXISTS(' . $selectRT . ')', null, false);
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Interessent');
|
||||
$this->studentlistlib->addWhere('ps.bestaetigtam IS NOT NULL');
|
||||
$this->studentlistlib->addWhere('NOT EXISTS(' . $selectRT . ')', null, false);
|
||||
break;
|
||||
case "statusbestaetigtrtangemeldet":
|
||||
$where['ps.status_kurzbz'] = 'Interessent';
|
||||
$where['ps.bestaetigtam IS NOT NULL'] = null;
|
||||
$this->PrestudentModel->db->where('EXISTS(' . $selectRT . ')', null, false);
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Interessent');
|
||||
$this->studentlistlib->addWhere('ps.bestaetigtam IS NOT NULL');
|
||||
$this->studentlistlib->addWhere('EXISTS(' . $selectRT . ')', null, false);
|
||||
break;
|
||||
case "zgv":
|
||||
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||
@@ -374,69 +347,69 @@ class Students extends FHCAPI_Controller
|
||||
$this->terminateWithSuccess([]);
|
||||
$stg = current($stg);
|
||||
|
||||
$where['ps.status_kurzbz'] = 'Interessent';
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Interessent');
|
||||
|
||||
if ($stg->typ == 'm') {
|
||||
$where['zgvmas_code IS NOT NULL'] = null;
|
||||
$this->studentlistlib->addWhere('zgvmas_code IS NOT NULL');
|
||||
if (defined('ZGV_ERFUELLT_ANZEIGEN') && ZGV_ERFUELLT_ANZEIGEN)
|
||||
$where['zgvmas_erfuellt'] = true;
|
||||
$this->studentlistlib->addWhere('zgvmas_erfuellt', true);
|
||||
} elseif ($stg->typ == 'p') {
|
||||
$where['zgvdoktor_code IS NOT NULL'] = null;
|
||||
$this->studentlistlib->addWhere('zgvdoktor_code IS NOT NULL');
|
||||
if (defined('ZGV_DOKTOR_ANZEIGEN') && ZGV_DOKTOR_ANZEIGEN)
|
||||
$where['zgvdoktor_erfuellt'] = true;
|
||||
$this->studentlistlib->addWhere('zgvdoktor_erfuellt', true);
|
||||
} else {
|
||||
$where['zgv_code IS NOT NULL'] = null;
|
||||
$this->studentlistlib->addWhere('zgv_code IS NOT NULL');
|
||||
if (defined('ZGV_ERFUELLT_ANZEIGEN') && ZGV_ERFUELLT_ANZEIGEN)
|
||||
$where['zgv_erfuellt'] = true;
|
||||
$this->studentlistlib->addWhere('zgv_erfuellt', true);
|
||||
}
|
||||
break;
|
||||
case "reihungstestangemeldet":
|
||||
$where['ps.status_kurzbz'] = 'Interessent';
|
||||
$this->PrestudentModel->db->where('EXISTS(' . $selectRT . ')', null, false);
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Interessent');
|
||||
$this->studentlistlib->addWhere('EXISTS(' . $selectRT . ')', null, false);
|
||||
break;
|
||||
case "reihungstestnichtangemeldet":
|
||||
$where['ps.status_kurzbz'] = 'Interessent';
|
||||
$this->PrestudentModel->db->where('NOT EXISTS(' . $selectRT . ')', null, false);
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Interessent');
|
||||
$this->studentlistlib->addWhere('NOT EXISTS(' . $selectRT . ')', null, false);
|
||||
break;
|
||||
case "bewerber":
|
||||
$where['ps.status_kurzbz'] = 'Bewerber';
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Bewerber');
|
||||
break;
|
||||
case "bewerberrtnichtangemeldet":
|
||||
$where['ps.status_kurzbz'] = 'Bewerber';
|
||||
$this->PrestudentModel->db->where('NOT EXISTS(' . $selectRT . ')', null, false);
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Bewerber');
|
||||
$this->studentlistlib->addWhere('NOT EXISTS(' . $selectRT . ')', null, false);
|
||||
break;
|
||||
case "bewerberrtangemeldet":
|
||||
$where['ps.status_kurzbz'] = 'Bewerber';
|
||||
$this->PrestudentModel->db->where('EXISTS(' . $selectRT . ')', null, false);
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Bewerber');
|
||||
$this->studentlistlib->addWhere('EXISTS(' . $selectRT . ')', null, false);
|
||||
break;
|
||||
case "bewerberrtangemeldetteilgenommen":
|
||||
$where['ps.status_kurzbz'] = 'Bewerber';
|
||||
$this->PrestudentModel->db->where('EXISTS(' . $selectRT . ')', null, false);
|
||||
$where['reihungstestangetreten'] = true;
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Bewerber');
|
||||
$this->studentlistlib->addWhere('EXISTS(' . $selectRT . ')', null, false);
|
||||
$this->studentlistlib->addWhere('reihungstestangetreten', true);
|
||||
break;
|
||||
case "bewerberrtangemeldetnichtteilgenommen":
|
||||
$where['ps.status_kurzbz'] = 'Bewerber';
|
||||
$this->PrestudentModel->db->where('EXISTS(' . $selectRT . ')', null, false);
|
||||
$where['reihungstestangetreten'] = false;
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Bewerber');
|
||||
$this->studentlistlib->addWhere('EXISTS(' . $selectRT . ')', null, false);
|
||||
$this->studentlistlib->addWhere('reihungstestangetreten', false);
|
||||
break;
|
||||
case "aufgenommen":
|
||||
$where['ps.status_kurzbz'] = 'Aufgenommener';
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Aufgenommener');
|
||||
break;
|
||||
case "warteliste":
|
||||
$where['ps.status_kurzbz'] = 'Wartender';
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Wartender');
|
||||
break;
|
||||
case "absage":
|
||||
$where['ps.status_kurzbz'] = 'Abgewiesener';
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Abgewiesener');
|
||||
break;
|
||||
case "incoming":
|
||||
// NOTE(chris): in FAS it was not filtered for studiengang_kz
|
||||
$where['ps.status_kurzbz'] = 'Incoming';
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Incoming');
|
||||
break;
|
||||
case "absolvent":
|
||||
$where['ps.status_kurzbz'] = 'Absolvent';
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Absolvent');
|
||||
break;
|
||||
case "diplomand":
|
||||
$where['ps.status_kurzbz'] = 'Diplomand';
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', 'Diplomand');
|
||||
break;
|
||||
default:
|
||||
if (!$studiensemester_kurzbz) {
|
||||
@@ -444,9 +417,9 @@ class Students extends FHCAPI_Controller
|
||||
* show all prestudents in this stg who don't have a status
|
||||
* $orgform_kurzbz does not change the results since orgform is stored in the status table
|
||||
*/
|
||||
$where['ps.status_kurzbz'] = null;
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz IS NULL');
|
||||
} else {
|
||||
$this->PrestudentModel->db->where_in('ps.status_kurzbz', [
|
||||
$this->studentlistlib->addWhere('ps.status_kurzbz', [
|
||||
'Interessent',
|
||||
'Bewerber',
|
||||
'Aufgenommener',
|
||||
@@ -457,21 +430,19 @@ class Students extends FHCAPI_Controller
|
||||
break;
|
||||
}
|
||||
|
||||
$this->prepareQuery($studiensemester_kurzbz);
|
||||
|
||||
$this->PrestudentModel->addSelect("
|
||||
$this->studentlistlib->addSelect("
|
||||
CASE
|
||||
WHEN pls.status_kurzbz IN ('Aufgenommener', 'Bewerber', 'Wartender', 'interessent')
|
||||
THEN ps.ausbildungssemester::text
|
||||
ELSE ''::text
|
||||
END AS semester", false);
|
||||
$this->PrestudentModel->addSelect("'' AS verband");
|
||||
$this->PrestudentModel->addSelect("'' AS gruppe");
|
||||
$this->addSelectPrioRel();
|
||||
$this->studentlistlib->addSelect("'' AS verband");
|
||||
$this->studentlistlib->addSelect("'' AS gruppe");
|
||||
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
$result = $this->PrestudentModel->loadWhere($where);
|
||||
$result = $this->studentlistlib->execute($studiensemester_kurzbz);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
@@ -574,7 +545,6 @@ class Students extends FHCAPI_Controller
|
||||
$gruppe_kurzbz = null,
|
||||
$orgform_kurzbz = null
|
||||
) {
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
|
||||
if (!$this->StudiensemesterModel->isValidStudiensemester($studiensemester_kurzbz))
|
||||
@@ -582,34 +552,29 @@ class Students extends FHCAPI_Controller
|
||||
$this->terminateWithError($studiensemester_kurzbz . ' - ' . $this->p->t('lehre', 'error_noStudiensemester'));
|
||||
}
|
||||
|
||||
$this->prepareQuery($studiensemester_kurzbz, '');
|
||||
// NOTE(chris): overwrite 'LEFT JOIN' with 'JOIN'
|
||||
$this->studentlistlib->addJoin("public.tbl_student s", "prestudent_id");
|
||||
|
||||
$this->PrestudentModel->addSelect('v.semester');
|
||||
$this->PrestudentModel->addSelect('v.verband');
|
||||
$this->PrestudentModel->addSelect('v.gruppe');
|
||||
$this->PrestudentModel->addSelect("'' AS priorisierung_relativ");
|
||||
|
||||
|
||||
$where = [];
|
||||
$this->studentlistlib->addSelect("'' AS priorisierung_relativ");
|
||||
|
||||
if ($gruppe_kurzbz !== null) {
|
||||
$this->PrestudentModel->addJoin('public.tbl_benutzergruppe g', 'uid');
|
||||
$where['g.gruppe_kurzbz'] = $gruppe_kurzbz;
|
||||
$where['g.studiensemester_kurzbz'] = $studiensemester_kurzbz;
|
||||
$this->studentlistlib->addJoin('public.tbl_benutzergruppe g', 'uid', '', 'after_b');
|
||||
$this->studentlistlib->addWhere('g.gruppe_kurzbz', $gruppe_kurzbz);
|
||||
$this->studentlistlib->addWhere('g.studiensemester_kurzbz', $studiensemester_kurzbz);
|
||||
} else {
|
||||
$where['v.studiengang_kz'] = $studiengang_kz;
|
||||
$this->studentlistlib->addWhere('v.studiengang_kz', $studiengang_kz);
|
||||
|
||||
if ($semester !== null)
|
||||
$where['v.semester'] = $semester;
|
||||
$this->studentlistlib->addWhere('v.semester', $semester);
|
||||
|
||||
if ($verband !== null)
|
||||
$where['v.verband'] = $verband;
|
||||
$this->studentlistlib->addWhere('v.verband', $verband);
|
||||
|
||||
if ($gruppe !== null)
|
||||
$where['v.gruppe'] = $gruppe;
|
||||
$this->studentlistlib->addWhere('v.gruppe', $gruppe);
|
||||
|
||||
if (!$verband && !$gruppe && $orgform_kurzbz !== null) {
|
||||
$this->PrestudentModel->db->where(
|
||||
$this->studentlistlib->addWhere(
|
||||
"(
|
||||
SELECT orgform_kurzbz
|
||||
FROM public.tbl_prestudentstatus
|
||||
@@ -623,9 +588,10 @@ class Students extends FHCAPI_Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
$result = $this->PrestudentModel->loadWhere($where);
|
||||
$result = $this->studentlistlib->execute($studiensemester_kurzbz);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
@@ -652,11 +618,8 @@ class Students extends FHCAPI_Controller
|
||||
$this->terminateWithError($studiensemester_kurzbz . ' - ' . $this->p->t('lehre', 'error_noStudiensemester'));
|
||||
}
|
||||
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$this->prepareQuery($studiensemester_kurzbz);
|
||||
|
||||
$this->PrestudentModel->addSelect("COALESCE(
|
||||
|
||||
$this->studentlistlib->addSelect("COALESCE(
|
||||
v.semester::text,
|
||||
CASE
|
||||
WHEN pls.status_kurzbz IN ('Aufgenommener', 'Bewerber', 'Wartender', 'interessent')
|
||||
@@ -664,16 +627,15 @@ class Students extends FHCAPI_Controller
|
||||
ELSE ''::text
|
||||
END
|
||||
) AS semester", false);
|
||||
$this->PrestudentModel->addSelect("COALESCE(v.verband::text, ''::text)");
|
||||
$this->PrestudentModel->addSelect("COALESCE(v.gruppe::text, ''::text)");
|
||||
$this->studentlistlib->addSelect("COALESCE(v.verband::text, ''::text) AS verband");
|
||||
$this->studentlistlib->addSelect("COALESCE(v.gruppe::text, ''::text) AS gruppe");
|
||||
|
||||
$this->studentlistlib->addWhere('tbl_prestudent.prestudent_id', $prestudent_id);
|
||||
|
||||
$this->addSelectPrioRel();
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
$result = $this->PrestudentModel->loadWhere([
|
||||
'tbl_prestudent.prestudent_id' => $prestudent_id
|
||||
]);
|
||||
$result = $this->studentlistlib->execute($studiensemester_kurzbz);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
@@ -700,23 +662,13 @@ class Students extends FHCAPI_Controller
|
||||
$this->terminateWithError($studiensemester_kurzbz . ' - ' . $this->p->t('lehre', 'error_noStudiensemester'));
|
||||
}
|
||||
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$this->prepareQuery($studiensemester_kurzbz);
|
||||
|
||||
$this->PrestudentModel->addSelect('v.semester');
|
||||
$this->PrestudentModel->addSelect('v.verband');
|
||||
$this->PrestudentModel->addSelect('v.gruppe');
|
||||
|
||||
$this->addSelectPrioRel();
|
||||
|
||||
|
||||
$this->studentlistlib->addWhere('s.student_uid', $student_uid);
|
||||
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
$result = $this->PrestudentModel->loadWhere([
|
||||
's.student_uid' => $student_uid
|
||||
]);
|
||||
$result = $this->studentlistlib->execute($studiensemester_kurzbz);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
@@ -744,21 +696,13 @@ class Students extends FHCAPI_Controller
|
||||
$this->terminateWithError($studiensemester_kurzbz . ' - ' . $this->p->t('lehre', 'error_noStudiensemester'));
|
||||
}
|
||||
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$this->prepareQuery($studiensemester_kurzbz);
|
||||
|
||||
$this->PrestudentModel->addSelect('v.semester');
|
||||
$this->PrestudentModel->addSelect('v.verband');
|
||||
$this->PrestudentModel->addSelect('v.gruppe');
|
||||
|
||||
$this->addSelectPrioRel();
|
||||
$this->studentlistlib->addWhere('p.person_id', $person_id);
|
||||
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
$result = $this->PrestudentModel->loadWhere([
|
||||
'p.person_id' => $person_id
|
||||
]);
|
||||
$result = $this->studentlistlib->execute($studiensemester_kurzbz);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
@@ -790,29 +734,8 @@ class Students extends FHCAPI_Controller
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$this->prepareQuery($studiensemester_kurzbz);
|
||||
|
||||
$this->PrestudentModel->addSelect("COALESCE(v.semester::text, CASE WHEN public.get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL) IN ('Aufgenommener', 'Bewerber', 'Wartender', 'interessent') THEN public.get_absem_prestudent(tbl_prestudent.prestudent_id, NULL)::text ELSE ''::text END) AS semester", false);
|
||||
$this->PrestudentModel->addSelect('v.verband');
|
||||
$this->PrestudentModel->addSelect('v.gruppe');
|
||||
|
||||
//add status per semester
|
||||
$this->PrestudentModel->addSelect(
|
||||
"public.get_rolle_prestudent(public.tbl_prestudent.prestudent_id, "
|
||||
. $this->PrestudentModel->escape($studiensemester_kurzbz)
|
||||
. ") AS statusofsemester"
|
||||
);
|
||||
|
||||
$this->addSelectPrioRel();
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
$prestudent_ids = [];
|
||||
$student_uids = [];
|
||||
$this->addMeta('data', $data);
|
||||
foreach ($data as $row) {
|
||||
$dataset = json_decode($row->data);
|
||||
if ($row->type == 'prestudent') {
|
||||
@@ -822,197 +745,38 @@ class Students extends FHCAPI_Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->studentlistlib->addSelect("COALESCE(
|
||||
v.semester::text,
|
||||
CASE
|
||||
WHEN public.get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL) IN ('Aufgenommener', 'Bewerber', 'Wartender', 'interessent')
|
||||
THEN public.get_absem_prestudent(tbl_prestudent.prestudent_id, NULL)::text
|
||||
ELSE ''::text
|
||||
END
|
||||
) AS semester", false);
|
||||
|
||||
|
||||
if ($prestudent_ids && $student_uids) {
|
||||
$this->PrestudentModel->db->where_in('tbl_prestudent.prestudent_id', $prestudent_ids);
|
||||
$this->PrestudentModel->db->or_where_in('s.student_uid', $student_uids);
|
||||
$this->studentlistlib->addWhere('tbl_prestudent.prestudent_id', $prestudent_ids);
|
||||
$this->studentlistlib->addOrWhere('s.student_uid', $student_uids);
|
||||
} elseif ($prestudent_ids) {
|
||||
$this->PrestudentModel->db->where_in('tbl_prestudent.prestudent_id', $prestudent_ids);
|
||||
$this->studentlistlib->addWhere('tbl_prestudent.prestudent_id', $prestudent_ids);
|
||||
} elseif ($student_uids) {
|
||||
$this->PrestudentModel->db->where_in('s.student_uid', $student_uids);
|
||||
$this->studentlistlib->addWhere('s.student_uid', $student_uids);
|
||||
} else {
|
||||
$this->terminateWithSuccess([]);
|
||||
}
|
||||
|
||||
$result = $this->PrestudentModel->load();
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
$result = $this->studentlistlib->execute($studiensemester_kurzbz);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $studiensemester_kurzbz
|
||||
* @param string $type
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareQuery($studiensemester_kurzbz, $type = 'LEFT')
|
||||
{
|
||||
$stdsemEsc = $studiensemester_kurzbz ? $this->PrestudentModel->escape($studiensemester_kurzbz) : 'NULL';
|
||||
|
||||
$this->load->config('stv');
|
||||
|
||||
if(defined('STV_TAGS_ENABLED') && STV_TAGS_ENABLED)
|
||||
{
|
||||
$tags = $this->config->item('stv_prestudent_tags');
|
||||
|
||||
$whereTags = '';
|
||||
if (is_array($tags) && !isEmptyArray($tags)) {
|
||||
$tags = array_keys($tags);
|
||||
|
||||
foreach ($tags as $key => $tag) {
|
||||
$tags[$key] = $this->db->escape($tag);
|
||||
}
|
||||
$whereTags = " AND nt.typ_kurzbz IN (" . implode(",", $tags) . ")";
|
||||
}
|
||||
$subQueryTag = "
|
||||
(
|
||||
SELECT
|
||||
tag.prestudent_id,
|
||||
COALESCE(json_agg(tag ORDER BY tag.done), '[]'::json) AS tags
|
||||
FROM (
|
||||
SELECT DISTINCT ON (n.notiz_id)
|
||||
n.notiz_id AS id,
|
||||
nt.typ_kurzbz,
|
||||
array_to_json(nt.bezeichnung_mehrsprachig)->>0 AS beschreibung,
|
||||
n.text AS notiz,
|
||||
nt.style,
|
||||
n.erledigt AS done,
|
||||
nz.prestudent_id
|
||||
FROM public.tbl_notizzuordnung AS nz
|
||||
JOIN public.tbl_notiz AS n ON nz.notiz_id = n.notiz_id
|
||||
JOIN public.tbl_notiz_typ AS nt ON n.typ = nt.typ_kurzbz "
|
||||
. $whereTags .
|
||||
"
|
||||
) AS tag
|
||||
GROUP BY tag.prestudent_id
|
||||
) AS tag_data_agg
|
||||
";
|
||||
}
|
||||
|
||||
$this->PrestudentModel->addJoin('public.tbl_studiengang stg', 'studiengang_kz', 'LEFT');
|
||||
$this->PrestudentModel->addJoin('public.tbl_person p', 'person_id');
|
||||
$this->PrestudentModel->addJoin('public.tbl_student s', 'prestudent_id', $type);
|
||||
$this->PrestudentModel->addJoin('public.tbl_prestudentstatus pls', '
|
||||
pls.status_kurzbz=public.get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL)
|
||||
AND pls.prestudent_id=tbl_prestudent.prestudent_id
|
||||
AND pls.studiensemester_kurzbz=public.get_stdsem_prestudent(tbl_prestudent.prestudent_id, NULL)
|
||||
AND pls.ausbildungssemester=public.get_absem_prestudent(tbl_prestudent.prestudent_id, NULL)', 'LEFT');
|
||||
$this->PrestudentModel->addJoin('lehre.tbl_studienplan sp', 'studienplan_id', 'LEFT');
|
||||
$this->PrestudentModel->addJoin('public.tbl_benutzer b', 's.student_uid=b.uid', 'LEFT');
|
||||
$this->PrestudentModel->addJoin(
|
||||
'public.tbl_studentlehrverband v',
|
||||
'v.student_uid=s.student_uid AND v.studiensemester_kurzbz' . ($studiensemester_kurzbz ? '=' . $stdsemEsc : ' IS NULL'),
|
||||
$type
|
||||
);
|
||||
$this->PrestudentModel->addJoin('public.tbl_prestudentstatus ps', '
|
||||
ps.status_kurzbz=public.get_rolle_prestudent(tbl_prestudent.prestudent_id, ' . $stdsemEsc . ')
|
||||
AND ps.prestudent_id=tbl_prestudent.prestudent_id
|
||||
AND ps.studiensemester_kurzbz=public.get_stdsem_prestudent(tbl_prestudent.prestudent_id, ' . $stdsemEsc . ')
|
||||
AND ps.ausbildungssemester=public.get_absem_prestudent(tbl_prestudent.prestudent_id, ' . $stdsemEsc . ')', 'LEFT');
|
||||
|
||||
if(defined('STV_TAGS_ENABLED') && STV_TAGS_ENABLED)
|
||||
{
|
||||
$this->PrestudentModel->addJoin($subQueryTag, 'tag_data_agg.prestudent_id = tbl_prestudent.prestudent_id', 'LEFT');
|
||||
}
|
||||
|
||||
|
||||
$this->PrestudentModel->addSelect("b.uid");
|
||||
if(defined('STV_TAGS_ENABLED') && STV_TAGS_ENABLED)
|
||||
{
|
||||
$this->PrestudentModel->addSelect('tag_data_agg.tags');
|
||||
}
|
||||
$this->PrestudentModel->addSelect('titelpre');
|
||||
$this->PrestudentModel->addSelect('nachname');
|
||||
$this->PrestudentModel->addSelect('vorname');
|
||||
$this->PrestudentModel->addSelect('wahlname');
|
||||
$this->PrestudentModel->addSelect('vornamen');
|
||||
$this->PrestudentModel->addSelect('titelpost');
|
||||
$this->PrestudentModel->addSelect('ersatzkennzeichen');
|
||||
$this->PrestudentModel->addSelect('gebdatum');
|
||||
$this->PrestudentModel->addSelect('geschlecht');
|
||||
$this->PrestudentModel->addSelect('foto');
|
||||
$this->PrestudentModel->addSelect('foto_sperre');
|
||||
|
||||
// semester
|
||||
// verband
|
||||
// gruppe
|
||||
|
||||
//add status per semester
|
||||
$this->PrestudentModel->addSelect(
|
||||
"public.get_rolle_prestudent(public.tbl_prestudent.prestudent_id, "
|
||||
. $this->PrestudentModel->escape($studiensemester_kurzbz)
|
||||
. ") AS statusofsemester"
|
||||
);
|
||||
|
||||
$this->PrestudentModel->addSelect('UPPER(stg.typ || stg.kurzbz) AS studiengang');
|
||||
$this->PrestudentModel->addSelect('tbl_prestudent.studiengang_kz');
|
||||
$this->PrestudentModel->addSelect('stg.bezeichnung AS stg_bezeichnung');
|
||||
$this->PrestudentModel->addSelect("s.matrikelnr");
|
||||
$this->PrestudentModel->addSelect('p.person_id');
|
||||
$this->PrestudentModel->addSelect('pls.status_kurzbz AS status');
|
||||
$this->PrestudentModel->addSelect('pls.datum AS status_datum');
|
||||
$this->PrestudentModel->addSelect('pls.bestaetigtam AS status_bestaetigung');
|
||||
$this->PrestudentModel->addSelect(
|
||||
"(SELECT kontakt FROM public.tbl_kontakt WHERE kontakttyp='email' AND person_id=p.person_id AND zustellung LIMIT 1) AS mail_privat",
|
||||
false
|
||||
);
|
||||
$this->PrestudentModel->addSelect("
|
||||
CASE WHEN b.uid IS NOT NULL AND b.uid<>''
|
||||
THEN CONCAT(b.uid, '@', " . $this->PrestudentModel->escape(DOMAIN) . ")
|
||||
ELSE '' END AS mail_intern", false);
|
||||
$this->PrestudentModel->addSelect('p.anmerkung AS anmerkungen');
|
||||
$this->PrestudentModel->addSelect('tbl_prestudent.anmerkung');
|
||||
$this->PrestudentModel->addSelect('pls.orgform_kurzbz');
|
||||
$this->PrestudentModel->addSelect('aufmerksamdurch_kurzbz');
|
||||
$this->PrestudentModel->addSelect(
|
||||
"(SELECT rt_gesamtpunkte AS punkte FROM public.tbl_prestudent WHERE prestudent_id=ps.prestudent_id) AS punkte",
|
||||
false
|
||||
);
|
||||
$this->PrestudentModel->addSelect('tbl_prestudent.aufnahmegruppe_kurzbz');
|
||||
$this->PrestudentModel->addSelect('tbl_prestudent.dual');
|
||||
$this->PrestudentModel->addSelect('p.matr_nr');
|
||||
$this->PrestudentModel->addSelect('sp.bezeichnung AS studienplan_bezeichnung');
|
||||
$this->PrestudentModel->addSelect('tbl_prestudent.prestudent_id');
|
||||
|
||||
// priorisierung_relativ
|
||||
|
||||
$this->PrestudentModel->addSelect('mentor');
|
||||
$this->PrestudentModel->addSelect('b.aktiv AS bnaktiv');
|
||||
$this->PrestudentModel->addSelect('unruly');
|
||||
|
||||
$this->PrestudentModel->db->where_in('tbl_prestudent.studiengang_kz', $this->allowedStgs);
|
||||
|
||||
$this->PrestudentModel->addOrder('nachname');
|
||||
$this->PrestudentModel->addOrder('vorname');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function addSelectPrioRel()
|
||||
{
|
||||
$this->PrestudentModel->addSelect("(
|
||||
SELECT count(*)
|
||||
FROM (
|
||||
SELECT *, public.get_rolle_prestudent(pss.prestudent_id, NULL) AS laststatus
|
||||
FROM public.tbl_prestudent pss
|
||||
JOIN public.tbl_prestudentstatus USING (prestudent_id)
|
||||
WHERE person_id = p.person_id
|
||||
AND studiensemester_kurzbz = (
|
||||
SELECT studiensemester_kurzbz
|
||||
FROM public.tbl_prestudentstatus
|
||||
WHERE prestudent_id = tbl_prestudent.prestudent_id
|
||||
AND status_kurzbz = 'Interessent'
|
||||
LIMIT 1
|
||||
)
|
||||
AND status_kurzbz = 'Interessent'
|
||||
) prest
|
||||
WHERE laststatus NOT IN ('Abbrecher', 'Abgewiesener', 'Absolvent')
|
||||
AND priorisierung <= tbl_prestudent.priorisierung
|
||||
) || ' (' || COALESCE(tbl_prestudent.priorisierung::text, ' '::text) || ')' AS priorisierung_relativ", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds additional filters to the query
|
||||
*
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
/**
|
||||
* - This controller acts as interface of the LongRunTaskLib that contains
|
||||
* all the needed functionalities to operate with the Long Run Task system
|
||||
* that is built on top of the Jobs Queue System
|
||||
* - This is a Job Queue Worker that gets scheduled LRTs from the queue and executes them
|
||||
* - Once all the LRTs have been started checks if there are LRTs that are running for too long and kills them
|
||||
*/
|
||||
class LongRunTaskExecJob extends JOB_Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Changes the needed configs for LogLib
|
||||
$this->LogLibJob->setConfigs(
|
||||
array(
|
||||
'dbExecuteUser' => get_class($this),
|
||||
'requestId' => 'LRT'
|
||||
)
|
||||
);
|
||||
|
||||
// Loads LongRunTaskLib library
|
||||
$this->load->library('LongRunTaskLib');
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes all the new LRTs
|
||||
*/
|
||||
public function execEmAll()
|
||||
{
|
||||
$this->logInfo('Execute long run tasks started');
|
||||
|
||||
// Get all the LRTs that is possible to execute now
|
||||
$lrtsResult = $this->longruntasklib->getNewLRTs();
|
||||
// If an error occurred then return it
|
||||
if (isError($lrtsResult)) return $lrtsResult;
|
||||
|
||||
if (hasData($lrtsResult))
|
||||
{
|
||||
// For each LRT
|
||||
foreach (getData($lrtsResult) as $lrt)
|
||||
{
|
||||
// Execute the task
|
||||
$executeLrtResult = $this->longruntasklib->executeLrt($lrt);
|
||||
if (isError($executeLrtResult)) $this->logError($executeLrtResult);
|
||||
}
|
||||
}
|
||||
|
||||
$this->logInfo('Execute long run tasks ended');
|
||||
}
|
||||
|
||||
/**
|
||||
* Kills all the hanging LRTs
|
||||
*/
|
||||
public function killHangingLRTs()
|
||||
{
|
||||
$this->logInfo('Kill hanging LRTs started');
|
||||
|
||||
// Get all the LRTs that is possible to execute now
|
||||
$lrtsResult = $this->longruntasklib->getHangingLRTs();
|
||||
// If an error occurred then return it
|
||||
if (isError($lrtsResult)) return $lrtsResult;
|
||||
|
||||
if (hasData($lrtsResult))
|
||||
{
|
||||
// For each LRT
|
||||
foreach (getData($lrtsResult) as $lrt)
|
||||
{
|
||||
// Kill the task
|
||||
$killLrtResult = $this->longruntasklib->killLrt($lrt);
|
||||
if (isError($killLrtResult)) $this->logError($killLrtResult);
|
||||
}
|
||||
}
|
||||
|
||||
$this->logInfo('Kill hanging LRTs ended');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function checkExecution()
|
||||
{
|
||||
$this->logInfo('Check execution long run tasks started');
|
||||
|
||||
// Get the related LRT data from the queue
|
||||
$lrtsResult = $this->longruntasklib->getRunningLRTs();
|
||||
// If an error occurred then return it
|
||||
if (isError($lrtsResult)) return $lrtsResult;
|
||||
|
||||
// If there are running LRTs
|
||||
if (hasData($lrtsResult))
|
||||
{
|
||||
// For each LRT
|
||||
foreach (getData($lrtsResult) as $lrt)
|
||||
{
|
||||
// Check the LRT execution
|
||||
$checkExecutionResult = $this->longruntasklib->checkExecution($lrt);
|
||||
if (isError($checkExecutionResult)) $this->logError($checkExecutionResult);
|
||||
}
|
||||
}
|
||||
|
||||
$this->logInfo('Check execution long run tasks ended');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
/**
|
||||
* Testing LRT to check if the LRT system is working properly
|
||||
* This will be called by the LongRunTaskExecJob
|
||||
*/
|
||||
class LRTDummy extends LRT_Controller
|
||||
{
|
||||
/**
|
||||
* This method must be implemented!
|
||||
*/
|
||||
public function run($jobid)
|
||||
{
|
||||
$this->logInfo('Long run tasks '.get_class($this).' started');
|
||||
|
||||
$this->_doIt($jobid);
|
||||
|
||||
$this->logInfo('Long run tasks '.get_class($this).' ended');
|
||||
}
|
||||
|
||||
/**
|
||||
* Loops on the number of seconds provided by the LRT input
|
||||
* Sleeps every time 1 sec
|
||||
* Writes the progress
|
||||
* Writes the output
|
||||
*/
|
||||
private function _doIt($jobid)
|
||||
{
|
||||
// Get the LRT record related to the provided jobid
|
||||
$lrtResult = $this->getLrt($jobid);
|
||||
|
||||
// If an error occurred or the record has not been found
|
||||
if (isError($lrtResult))
|
||||
{
|
||||
$this->logError($lrtResult);
|
||||
return;
|
||||
}
|
||||
if (!hasData($lrtResult))
|
||||
{
|
||||
$this->logError('LRT not found in database');
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the record
|
||||
$lrt = getData($lrtResult)[0];
|
||||
|
||||
// Get and check the input
|
||||
$input = json_decode($lrt->{LongRunTaskLib::PROPERTY_INPUT});
|
||||
if ($input == null)
|
||||
{
|
||||
$this->logError('LRT input is not a valid json');
|
||||
return;
|
||||
}
|
||||
|
||||
// Operation
|
||||
for ($i = 0; $i < (int)$input->sleep; $i++)
|
||||
{
|
||||
sleep(1);
|
||||
// Set the progress
|
||||
$setProgressResult = $this->setProgress($jobid, (($i + 1) / (int)$input->sleep) * 100);
|
||||
if (isError($setProgressResult))
|
||||
{
|
||||
$this->logError($setProgressResult);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$sleepMsg = 'The user '.$lrt->{LongRunTaskLib::PROPERTY_UID}.' slept for '.$input->sleep.' seconds';
|
||||
|
||||
$this->logInfo($sleepMsg);
|
||||
|
||||
// Set the output
|
||||
$setOutputResult = $this->setOutput($jobid, $sleepMsg);
|
||||
if (isError($setOutputResult))
|
||||
{
|
||||
$this->logError($setOutputResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
use \stdClass as stdClass;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class LRTTest extends Auth_Controller
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'system/developer:r',
|
||||
'lrt1min' => 'system/developer:r',
|
||||
)
|
||||
);
|
||||
|
||||
// Loads LongRunTaskLib library
|
||||
$this->load->library('LongRunTaskLib');
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Everything has a beginning
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('system/lrtTest.php');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function lrt1min()
|
||||
{
|
||||
$lrtInput = new stdClass();
|
||||
$lrtInput->sleep = 1; // Sleep for 1 min
|
||||
|
||||
$this->outputJsonSuccess(
|
||||
$this->longruntasklib->addNewLrtToQueue(
|
||||
'LRTDummy', // LRT type
|
||||
getAuthUID(), // UID executer
|
||||
$lrtInput // LRT input
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
/**
|
||||
* Long Run Task
|
||||
*
|
||||
* - This controller acts as interface of the LongRunTaskLib that contains
|
||||
* all the needed functionalities to operate with the Long Run Task system
|
||||
* that is built on top of the Jobs Queue System
|
||||
* - This is an abstract class that provide basic functionalities,
|
||||
* it has to be extended to broaden its logic
|
||||
* - Any implementation of a Long Run Task should extends this class to
|
||||
* properly operate with the LRT system
|
||||
*/
|
||||
abstract class LRT_Controller extends JOB_Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Changes the needed configs for LogLib
|
||||
$this->LogLibJob->setConfigs(
|
||||
array(
|
||||
'dbExecuteUser' => get_class($this),
|
||||
'requestId' => 'LRT'
|
||||
)
|
||||
);
|
||||
|
||||
// Loads LongRunTaskLib library
|
||||
$this->load->library('LongRunTaskLib');
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
abstract public function run($jobid);
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Protected methods
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function getLrt($jobid)
|
||||
{
|
||||
return $this->longruntasklib->getLrt($jobid);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function setProgress($jobid, $progress)
|
||||
{
|
||||
return $this->longruntasklib->setProgress($jobid, $progress);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function setOutput($jobid, $output)
|
||||
{
|
||||
return $this->longruntasklib->setOutuput($jobid, $output);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
use \stdClass as stdClass;
|
||||
|
||||
/**
|
||||
* Library that contains all the needed functionalities to operate with the Jobs Queue System
|
||||
*/
|
||||
@@ -24,12 +26,12 @@ class JobsQueueLib
|
||||
const PROPERTY_END_TIME = 'endtime';
|
||||
const PROPERTY_ERROR = 'error';
|
||||
|
||||
private $_ci; // CI instance
|
||||
protected $_ci; // CI instance
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct($authenticate = true)
|
||||
public function __construct()
|
||||
{
|
||||
// Gets CI instance
|
||||
$this->_ci =& get_instance();
|
||||
@@ -62,14 +64,29 @@ class JobsQueueLib
|
||||
*/
|
||||
public function getOldestJobs($type, $maxAmount = null)
|
||||
{
|
||||
$this->_ci->JobsQueueModel->resetQuery();
|
||||
|
||||
$this->_ci->JobsQueueModel->addOrder('creationtime', 'ASC');
|
||||
$types = $type; // default is array
|
||||
$limit = 0; // default query limit
|
||||
|
||||
// If the maximum amount of jobs to retrieve have been specified
|
||||
if (is_numeric($maxAmount)) $this->_ci->JobsQueueModel->addLimit($maxAmount);
|
||||
if (is_numeric($maxAmount)) $limit = $maxAmount;
|
||||
|
||||
return $this->_ci->JobsQueueModel->loadWhere(array('status' => self::STATUS_NEW, 'type' => $type));
|
||||
// If it is a string then include it into an array
|
||||
if (!isEmptyString($type) && is_string($type)) $types = array($type);
|
||||
|
||||
// Return the result of the query
|
||||
return $this->_ci->JobsQueueModel->execReadOnlyQuery('
|
||||
SELECT jq.*
|
||||
FROM system.tbl_jobsqueue jq
|
||||
WHERE jq.type IN ?
|
||||
AND jq.status = ?
|
||||
ORDER BY jq.creationtime DESC
|
||||
LIMIT ?',
|
||||
array(
|
||||
$types,
|
||||
self::STATUS_NEW,
|
||||
$limit
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,11 +94,23 @@ class JobsQueueLib
|
||||
*/
|
||||
public function getJobsByTypeStatus($type, $status)
|
||||
{
|
||||
$this->_ci->JobsQueueModel->resetQuery();
|
||||
$types = $type; // default is array
|
||||
|
||||
$this->_ci->JobsQueueModel->addOrder('creationtime', 'DESC');
|
||||
// If it is a string then include it into an array
|
||||
if (!isEmptyString($type) && is_string($type)) $types = array($type);
|
||||
|
||||
return $this->_ci->JobsQueueModel->loadWhere(array('status' => $status, 'type' => $type));
|
||||
// Return the result of the query
|
||||
return $this->_ci->JobsQueueModel->execReadOnlyQuery('
|
||||
SELECT jq.*
|
||||
FROM system.tbl_jobsqueue jq
|
||||
WHERE jq.type IN ?
|
||||
AND jq.status = ?
|
||||
ORDER BY jq.creationtime DESC',
|
||||
array(
|
||||
$types,
|
||||
$status
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,8 +282,30 @@ class JobsQueueLib
|
||||
return array($job);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Protected methods
|
||||
|
||||
/**
|
||||
* Checks if the given job contains a valid type
|
||||
*/
|
||||
protected function _checkJobType($type, $types)
|
||||
{
|
||||
return $this->_inArray($type, $types, self::PROPERTY_TYPE);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Drop not allowed properties from the given job
|
||||
*/
|
||||
private function _dropNotAllowedPropertiesNewJob(&$job)
|
||||
{
|
||||
unset($job->{self::PROPERTY_JOBID});
|
||||
unset($job->{self::PROPERTY_CREATIONTIME});
|
||||
unset($job->{self::PROPERTY_TYPE});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks the job object structure when needed for insert
|
||||
@@ -281,34 +332,6 @@ class JobsQueueLib
|
||||
return false; // better sorry than wrong
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the job object structure when needed for update
|
||||
*/
|
||||
private function _checkUpdateJobStructure(&$job)
|
||||
{
|
||||
// If job is a valid object
|
||||
if (is_object($job) && property_exists($job, self::PROPERTY_JOBID)) return true; // it is valid!
|
||||
|
||||
// If not object then object it!
|
||||
if (!is_object($job)) $job = new stdClass();
|
||||
|
||||
// If an error property was not already previously stored then store an error message in job object
|
||||
if (!property_exists($job, self::PROPERTY_ERROR))
|
||||
{
|
||||
$job->{self::PROPERTY_ERROR} = 'The structure of the provided job is not valid';
|
||||
}
|
||||
|
||||
return false; // better sorry than wrong
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given job contains a valid type
|
||||
*/
|
||||
private function _checkJobType($type, $types)
|
||||
{
|
||||
return $this->_inArray($type, $types, self::PROPERTY_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given job contains a valid status
|
||||
*/
|
||||
@@ -333,6 +356,26 @@ class JobsQueueLib
|
||||
return $found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the job object structure when needed for update
|
||||
*/
|
||||
private function _checkUpdateJobStructure(&$job)
|
||||
{
|
||||
// If job is a valid object
|
||||
if (is_object($job) && property_exists($job, self::PROPERTY_JOBID)) return true; // it is valid!
|
||||
|
||||
// If not object then object it!
|
||||
if (!is_object($job)) $job = new stdClass();
|
||||
|
||||
// If an error property was not already previously stored then store an error message in job object
|
||||
if (!property_exists($job, self::PROPERTY_ERROR))
|
||||
{
|
||||
$job->{self::PROPERTY_ERROR} = 'The structure of the provided job is not valid';
|
||||
}
|
||||
|
||||
return false; // better sorry than wrong
|
||||
}
|
||||
|
||||
/**
|
||||
* Search in an array the given value
|
||||
* The elements of the given array are objects
|
||||
@@ -354,16 +397,6 @@ class JobsQueueLib
|
||||
return $found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop not allowed properties from the given job
|
||||
*/
|
||||
private function _dropNotAllowedPropertiesNewJob(&$job)
|
||||
{
|
||||
unset($job->{self::PROPERTY_JOBID});
|
||||
unset($job->{self::PROPERTY_CREATIONTIME});
|
||||
unset($job->{self::PROPERTY_TYPE});
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop not allowed properties from the given job
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,333 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once 'JobsQueueLib.php';
|
||||
|
||||
/**
|
||||
* Library that contains all the needed functionalities to operate with the Long Run Tasks
|
||||
*/
|
||||
class LongRunTaskLib extends JobsQueueLib
|
||||
{
|
||||
// Config names
|
||||
const CFG_LRT_MAX_NUMBER_SYSTEM = 'lrt_max_number_system';
|
||||
const CFG_LRT_TYPES = 'lrt_types';
|
||||
const CFG_LRT_MAX_RUN = 'lrt_max_run_timeout';
|
||||
const CFG_LRT_MAX_NUMBER_USER = 'lrt_max_number_single_user';
|
||||
|
||||
// LRT object properties
|
||||
const PROPERTY_UID = 'uid';
|
||||
const PROPERTY_PID = 'pid';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Loads the Long Run Tasks configs
|
||||
$this->_ci->config->load('lrt');
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods used by the LongRunTaskExecJob
|
||||
|
||||
/**
|
||||
* Get the oldest added LRTs to the queue having status = new
|
||||
* The maximum number of returned queued LRTs is limited by:
|
||||
* number of currently running LRTs - maximum allowed number of LRTs for the system
|
||||
*/
|
||||
public function getNewLRTs()
|
||||
{
|
||||
// Get all the running LRTs
|
||||
$runningLrtsResult = $this->getJobsByTypeStatus($this->_ci->config->item(self::CFG_LRT_TYPES), JobsQueueLib::STATUS_RUNNING);
|
||||
|
||||
if (isError($runningLrtsResult)) return $runningLrtsResult;
|
||||
|
||||
// The number of the currently running LRTs - the maximum LRTs for the system
|
||||
$max_number_of_lrts = $this->_ci->config->item(self::CFG_LRT_MAX_NUMBER_SYSTEM) - count(getData($runningLrtsResult));
|
||||
|
||||
// Get the oldest LRTs added to the queue
|
||||
return $this->getOldestJobs($this->_ci->config->item(self::CFG_LRT_TYPES), $max_number_of_lrts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the LRT that are running more then CFG_LRT_MAX_RUN hours
|
||||
*/
|
||||
public function getHangingLRTs()
|
||||
{
|
||||
// Return the result of the query
|
||||
return $this->_ci->JobsQueueModel->execReadOnlyQuery('
|
||||
SELECT jq.*
|
||||
FROM system.tbl_jobsqueue jq
|
||||
WHERE jq.type IN ?
|
||||
AND jq.status = ?
|
||||
AND jq.starttime < NOW() - INTERVAL \''.$this->_ci->config->item(self::CFG_LRT_MAX_RUN).' hours\'
|
||||
ORDER BY jq.creationtime DESC',
|
||||
array(
|
||||
$this->_ci->config->item(self::CFG_LRT_TYPES),
|
||||
JobsQueueLib::STATUS_RUNNING
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the LRT that are currently running
|
||||
*/
|
||||
public function getRunningLRTs()
|
||||
{
|
||||
// Return the result of the query
|
||||
return $this->_ci->JobsQueueModel->execReadOnlyQuery('
|
||||
SELECT jq.*
|
||||
FROM system.tbl_jobsqueue jq
|
||||
WHERE jq.type IN ?
|
||||
AND jq.status = ?
|
||||
ORDER BY jq.creationtime DESC',
|
||||
array(
|
||||
$this->_ci->config->item(self::CFG_LRT_TYPES),
|
||||
JobsQueueLib::STATUS_RUNNING
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a LRT in background
|
||||
* - Checks if the wanted LRT exists in the applcation/controllers/lrts directory
|
||||
* - Then executes it in background via CI CLI
|
||||
* - Stores the LRT pid into the database
|
||||
*/
|
||||
public function executeLrt($lrt)
|
||||
{
|
||||
$output = array();
|
||||
|
||||
// If does _not_ exist a LRT implementation for this LRT type, then return an error
|
||||
if (!file_exists(APPPATH.'controllers/lrts/'.$lrt->{self::PROPERTY_TYPE}.'.php'))
|
||||
{
|
||||
return error('The required LRT implementation has not been found');
|
||||
}
|
||||
|
||||
// Execute the LRT implementation (a CI controller from CLI) providing as parameter the jobid
|
||||
exec(
|
||||
// Command
|
||||
sprintf(
|
||||
'/usr/bin/php %s/../index.ci.php lrts/%s/run %s > /dev/null 2>&1 & echo $!',
|
||||
APPPATH,
|
||||
$lrt->{self::PROPERTY_TYPE},
|
||||
$lrt->{self::PROPERTY_JOBID}
|
||||
),
|
||||
$output // Here goes the output from the standard output and error
|
||||
);
|
||||
|
||||
// If a pid has not been returned
|
||||
if (isEmptyArray($output) || !is_numeric($output[0])) return error('Not a valid pid has been returned');
|
||||
|
||||
// Set the pid, status and starttime of this LRT into the database
|
||||
$updateLrtResult = $this->_ci->JobsQueueModel->update(
|
||||
$lrt->{self::PROPERTY_JOBID},
|
||||
array(
|
||||
'pid' => $output[0],
|
||||
'starttime' => 'NOW()',
|
||||
'status' => self::STATUS_RUNNING
|
||||
)
|
||||
);
|
||||
if (isError($updateLrtResult)) return $updateLrtResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kill the provided LRT
|
||||
* To avoid to kill a process that is not this LRT,
|
||||
* since the same PID can be assigned to another process once this ended
|
||||
*/
|
||||
public function killLrt($lrt)
|
||||
{
|
||||
// Try to get the pid of this LRT from the system
|
||||
$pid = exec(
|
||||
sprintf(
|
||||
'ps -eo pid,cmd | grep "index.ci.php lrts/%s/run %s" | grep -v grep | awk \'{print $1}\'',
|
||||
$lrt->{self::PROPERTY_TYPE},
|
||||
$lrt->{self::PROPERTY_JOBID}
|
||||
)
|
||||
);
|
||||
|
||||
// If the pid is the same then kill the process with a SIGKILL
|
||||
if ($pid == $lrt->{self::PROPERTY_PID}) exec('kill -9 '.$lrt->{self::PROPERTY_PID}.' > /dev/null 2>&1');
|
||||
|
||||
// Set the LRT as failed in any case
|
||||
$lrtExecFailedResult = $this->_ci->JobsQueueModel->update(
|
||||
$lrt->{self::PROPERTY_JOBID},
|
||||
array(
|
||||
'endtime' => 'NOW()',
|
||||
'status' => self::STATUS_FAILED
|
||||
)
|
||||
);
|
||||
// If an error occurred then return it
|
||||
if (isError($lrtExecFailedResult)) return $lrtExecFailedResult;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function checkExecution($lrt)
|
||||
{
|
||||
// If the LRT stopped running
|
||||
if (!$this->_isRunning($lrt))
|
||||
{
|
||||
// Loads MessageLib library
|
||||
$this->_ci->load->library('MessageLib');
|
||||
// Load the BenutzerModel
|
||||
$this->_ci->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||
|
||||
// Get the benutzer for this uid
|
||||
$benutzerResult = $this->_ci->BenutzerModel->loadWhere(array('uid' => $lrt->{LongRunTaskLib::PROPERTY_UID}));
|
||||
// If an error occurred then return it
|
||||
if (isError($benutzerResult)) return $benutzerResult;
|
||||
// If no benutzer has been found
|
||||
if (!hasData($benutzerResult)) return error('No benutzer found, uid: '.$lrt->{LongRunTaskLib::PROPERTY_UID});
|
||||
|
||||
$benutzer = getData($benutzerResult)[0];
|
||||
|
||||
// Sends a message to the user
|
||||
$messageResult = $this->_ci->messagelib->sendMessageUser(
|
||||
$benutzer->person_id,
|
||||
'Long run task ended',
|
||||
'The long run task '.$lrt->{self::PROPERTY_TYPE}.' ended, output: '.$lrt->{self::PROPERTY_OUTPUT}
|
||||
);
|
||||
// If an error occurred then return it
|
||||
if (isError($messageResult)) return $messageResult;
|
||||
|
||||
// Set the LRT as done
|
||||
$lrtExecOverResult = $this->_ci->JobsQueueModel->update(
|
||||
$lrt->{self::PROPERTY_JOBID},
|
||||
array(
|
||||
'endtime' => 'NOW()',
|
||||
'status' => self::STATUS_DONE
|
||||
)
|
||||
);
|
||||
// If an error occurred then return it
|
||||
if (isError($lrtExecOverResult)) return $lrtExecOverResult;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods used by the front end applications (standard controllers/end points, ex. controllers/system/LRTTest.php)
|
||||
|
||||
/**
|
||||
* Add a single LRT to the queue
|
||||
*/
|
||||
public function addNewLrtToQueue($type, $uid, $lrtInput)
|
||||
{
|
||||
// Checks parameters
|
||||
if (isEmptyString($type)) return error('The provided type parameter is not a valid string');
|
||||
if (isEmptyString($uid)) return error('The provided uid parameter is not a valid string');
|
||||
|
||||
// Get all the running task for this uid
|
||||
// Return the result of the query
|
||||
$runningLRTbyUIDResult = $this->_ci->JobsQueueModel->execReadOnlyQuery('
|
||||
SELECT jq.*
|
||||
FROM system.tbl_jobsqueue jq
|
||||
WHERE jq.status IN ?
|
||||
AND jq.uid = ?
|
||||
',
|
||||
array(
|
||||
array(
|
||||
self::STATUS_NEW,
|
||||
self::STATUS_RUNNING
|
||||
),
|
||||
$uid
|
||||
)
|
||||
);
|
||||
|
||||
// If an error occurred then return it
|
||||
if (isError($runningLRTbyUIDResult)) return $runningLRTbyUIDResult;
|
||||
|
||||
// If the running tasks for this user are too many
|
||||
if (count(getData($runningLRTbyUIDResult)) >= $this->_ci->config->item(self::CFG_LRT_MAX_NUMBER_USER))
|
||||
{
|
||||
return error('Too many running tasks for this user');
|
||||
}
|
||||
|
||||
// Convert input to JSON and check it
|
||||
$jsonLrtInput = json_encode($lrtInput);
|
||||
if ($jsonLrtInput == null) return error('The provided LRT input is not valid');
|
||||
|
||||
// Get all the job types
|
||||
$dbResult = $this->_ci->JobTypesModel->load();
|
||||
if (isError($dbResult)) return $dbResult;
|
||||
$types = getData($dbResult);
|
||||
|
||||
// If the given type is not present in database
|
||||
if (!$this->_checkJobType($type, $types)) return error('The provided type parameter is not valid');
|
||||
|
||||
// Get all the job statuses
|
||||
$dbResult = $this->_ci->JobStatusesModel->load();
|
||||
if (isError($dbResult)) return $dbResult;
|
||||
$statuses = getData($dbResult);
|
||||
|
||||
// Create an object that represent the new tbl_jobsqueue record with the provided input
|
||||
$lrt = $this->generateJobs(self::STATUS_NEW, $jsonLrtInput)[0];
|
||||
|
||||
// What you asked is what you get!
|
||||
$lrt->{self::PROPERTY_TYPE} = $type;
|
||||
$lrt->{self::PROPERTY_UID} = $uid;
|
||||
|
||||
// Try to insert the single lrt into database
|
||||
$dbNewLrtResult = $this->_ci->JobsQueueModel->insert($lrt);
|
||||
|
||||
// If an error occurred during while inserting in database
|
||||
if (isError($dbNewLrtResult)) return $dbNewLrtResult;
|
||||
|
||||
return success('LRT added to the queue');
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods used by the LRT implementation (controllers/ltrs/*, ex. controllers/ltrs/LRTDummy)
|
||||
|
||||
/**
|
||||
* Return a single record from the
|
||||
*/
|
||||
public function getLrt($jobid)
|
||||
{
|
||||
$this->_ci->JobsQueueModel->resetQuery();
|
||||
|
||||
return $this->_ci->JobsQueueModel->loadWhere(array('jobid' => $jobid));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function setProgress($jobid, $progress)
|
||||
{
|
||||
return $this->_ci->JobsQueueModel->update($jobid, array('progress' => $progress));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function setOutuput($jobid, $output)
|
||||
{
|
||||
return $this->_ci->JobsQueueModel->update($jobid, array('output' => json_encode($output)));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Return true if the LRT is still running
|
||||
*/
|
||||
private function _isRunning($lrt)
|
||||
{
|
||||
// Try to get the pid of this LRT from the system
|
||||
$pid = exec(
|
||||
sprintf(
|
||||
'ps -eo pid,cmd | grep "index.ci.php lrts/%s/run %s" | grep -v grep | awk \'{print $1}\'',
|
||||
$lrt->{self::PROPERTY_TYPE},
|
||||
$lrt->{self::PROPERTY_JOBID}
|
||||
)
|
||||
);
|
||||
|
||||
// If the pid is the same then the LRT is still running
|
||||
return $pid == $lrt->{self::PROPERTY_PID};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,363 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2025 fhcomplete.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This generates a list of students and or prestudents used for Studierendenverwaltung
|
||||
*/
|
||||
class StudentListLib
|
||||
{
|
||||
private $_ci; // Code igniter instance
|
||||
|
||||
private $_allowedStgs = [];
|
||||
private $_selects = [];
|
||||
private $_joins = [];
|
||||
|
||||
/**
|
||||
* Gets the CI instance, loads model and prepares default values
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($params = null)
|
||||
{
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
if (isset($params['allowedStgs']))
|
||||
$this->_allowedStgs = $params['allowedStgs'];
|
||||
|
||||
// Add default SELECTs
|
||||
$this->addSelect("b.uid");
|
||||
if (defined('STV_TAGS_ENABLED') && STV_TAGS_ENABLED)
|
||||
$this->addSelect('tag_data_agg.tags');
|
||||
$this->addSelect('titelpre');
|
||||
$this->addSelect('nachname');
|
||||
$this->addSelect('vorname');
|
||||
$this->addSelect('wahlname');
|
||||
$this->addSelect('vornamen');
|
||||
$this->addSelect('titelpost');
|
||||
$this->addSelect('ersatzkennzeichen');
|
||||
$this->addSelect('gebdatum');
|
||||
$this->addSelect('geschlecht');
|
||||
$this->addSelect('foto');
|
||||
$this->addSelect('foto_sperre');
|
||||
$this->addSelect('v.semester');
|
||||
$this->addSelect('v.verband');
|
||||
$this->addSelect('v.gruppe');
|
||||
$this->addSelect("statusofsemester"); // Will be replaced later
|
||||
$this->addSelect('UPPER(stg.typ || stg.kurzbz) AS studiengang');
|
||||
$this->addSelect('tbl_prestudent.studiengang_kz');
|
||||
$this->addSelect('stg.bezeichnung AS stg_bezeichnung');
|
||||
$this->addSelect("s.matrikelnr");
|
||||
$this->addSelect('p.person_id');
|
||||
$this->addSelect('pls.status_kurzbz AS status');
|
||||
$this->addSelect('pls.datum AS status_datum');
|
||||
$this->addSelect('pls.bestaetigtam AS status_bestaetigung');
|
||||
$this->addSelect(
|
||||
"(SELECT kontakt FROM public.tbl_kontakt WHERE kontakttyp='email' AND person_id=p.person_id AND zustellung LIMIT 1) AS mail_privat",
|
||||
false
|
||||
);
|
||||
$this->addSelect("
|
||||
CASE WHEN b.uid IS NOT NULL AND b.uid<>''
|
||||
THEN CONCAT(b.uid, '@', " . $this->_ci->PrestudentModel->escape(DOMAIN) . ")
|
||||
ELSE '' END AS mail_intern", false);
|
||||
$this->addSelect('p.anmerkung AS anmerkungen');
|
||||
$this->addSelect('tbl_prestudent.anmerkung');
|
||||
$this->addSelect('pls.orgform_kurzbz');
|
||||
$this->addSelect('aufmerksamdurch_kurzbz');
|
||||
$this->addSelect(
|
||||
"(SELECT rt_gesamtpunkte AS punkte FROM public.tbl_prestudent WHERE prestudent_id=ps.prestudent_id) AS punkte",
|
||||
false
|
||||
);
|
||||
$this->addSelect('tbl_prestudent.aufnahmegruppe_kurzbz');
|
||||
$this->addSelect('tbl_prestudent.dual');
|
||||
$this->addSelect('p.matr_nr');
|
||||
$this->addSelect('sp.bezeichnung AS studienplan_bezeichnung');
|
||||
$this->addSelect('tbl_prestudent.prestudent_id');
|
||||
$this->addSelect("(
|
||||
SELECT count(*)
|
||||
FROM (
|
||||
SELECT *, public.get_rolle_prestudent(pss.prestudent_id, NULL) AS laststatus
|
||||
FROM public.tbl_prestudent pss
|
||||
JOIN public.tbl_prestudentstatus USING (prestudent_id)
|
||||
WHERE person_id = p.person_id
|
||||
AND studiensemester_kurzbz = (
|
||||
SELECT studiensemester_kurzbz
|
||||
FROM public.tbl_prestudentstatus
|
||||
WHERE prestudent_id = tbl_prestudent.prestudent_id
|
||||
AND status_kurzbz = 'Interessent'
|
||||
LIMIT 1
|
||||
)
|
||||
AND status_kurzbz = 'Interessent'
|
||||
) prest
|
||||
WHERE laststatus NOT IN ('Abbrecher', 'Abgewiesener', 'Absolvent')
|
||||
AND priorisierung <= tbl_prestudent.priorisierung
|
||||
) || ' (' || COALESCE(tbl_prestudent.priorisierung::text, ' '::text) || ')' AS priorisierung_relativ", false); // TODO(chris): overwrite in fetchStudents
|
||||
$this->addSelect('mentor');
|
||||
$this->addSelect('b.aktiv AS bnaktiv');
|
||||
$this->addSelect('unruly');
|
||||
|
||||
// Add default JOINs
|
||||
$this->addJoin('public.tbl_studiengang stg', 'studiengang_kz', 'LEFT');
|
||||
$this->addJoin('public.tbl_person p', 'person_id');
|
||||
$this->addJoin('public.tbl_student s', 'prestudent_id', 'LEFT'); // TODO(chris): overwrite in fetchStudents
|
||||
$this->addJoin('public.tbl_prestudentstatus pls', '
|
||||
pls.status_kurzbz=public.get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL)
|
||||
AND pls.prestudent_id=tbl_prestudent.prestudent_id
|
||||
AND pls.studiensemester_kurzbz=public.get_stdsem_prestudent(tbl_prestudent.prestudent_id, NULL)
|
||||
AND pls.ausbildungssemester=public.get_absem_prestudent(tbl_prestudent.prestudent_id, NULL)', 'LEFT');
|
||||
$this->addJoin('lehre.tbl_studienplan sp', 'studienplan_id', 'LEFT');
|
||||
$this->addJoin('public.tbl_benutzer b', 's.student_uid=b.uid', 'LEFT');
|
||||
$this->addJoin("v", "", ""); // Will be replaced later
|
||||
$this->addJoin("ps", "", ""); // Will be replaced later
|
||||
if (defined('STV_TAGS_ENABLED') && STV_TAGS_ENABLED) {
|
||||
$this->_ci->load->config('stv');
|
||||
$tags = $this->_ci->config->item('stv_prestudent_tags');
|
||||
|
||||
$whereTags = '';
|
||||
if (is_array($tags) && !isEmptyArray($tags)) {
|
||||
$tags = array_keys($tags);
|
||||
|
||||
foreach ($tags as $key => $tag) {
|
||||
$tags[$key] = $this->_ci->PrestudentModel->escape($tag);
|
||||
}
|
||||
$whereTags = " AND nt.typ_kurzbz IN (" . implode(",", $tags) . ")";
|
||||
}
|
||||
$subQueryTag = "(
|
||||
SELECT
|
||||
tag.prestudent_id,
|
||||
COALESCE(json_agg(tag ORDER BY tag.done), '[]'::json) AS tags
|
||||
FROM (
|
||||
SELECT DISTINCT ON (n.notiz_id)
|
||||
n.notiz_id AS id,
|
||||
nt.typ_kurzbz,
|
||||
array_to_json(nt.bezeichnung_mehrsprachig)->>0 AS beschreibung,
|
||||
n.text AS notiz,
|
||||
nt.style,
|
||||
n.erledigt AS done,
|
||||
nz.prestudent_id
|
||||
FROM public.tbl_notizzuordnung AS nz
|
||||
JOIN public.tbl_notiz AS n ON nz.notiz_id = n.notiz_id
|
||||
JOIN public.tbl_notiz_typ AS nt ON n.typ = nt.typ_kurzbz " . $whereTags . "
|
||||
) AS tag
|
||||
GROUP BY tag.prestudent_id
|
||||
) AS tag_data_agg";
|
||||
|
||||
$this->addJoin($subQueryTag, 'tag_data_agg.prestudent_id = tbl_prestudent.prestudent_id', 'LEFT');
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Adds a SELECT statement to the query.
|
||||
*
|
||||
* @param string|array $select
|
||||
* @param boolean $escape (optional)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addSelect($select, $escape = true)
|
||||
{
|
||||
if (is_array($select)) {
|
||||
foreach ($select as $s)
|
||||
$this->addSelect($s, $escape);
|
||||
return;
|
||||
}
|
||||
$alias = $this->getAliasFromSelect($select);
|
||||
$this->_selects[$alias] = [$select, $escape];
|
||||
}
|
||||
|
||||
/**
|
||||
* Joins a table to the query.
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $cond
|
||||
* @param string $type (optional)
|
||||
* @param string $position (optional)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addJoin($table, $cond, $type = '', $position = 'end')
|
||||
{
|
||||
$alias = $this->getAliasFromTable($table);
|
||||
|
||||
if ($position == 'end') {
|
||||
return $this->_joins[$alias] = [$table, $cond, $type];
|
||||
}
|
||||
|
||||
if ($position == 'start') {
|
||||
return $this->_joins = [$alias => [$table, $cond, $type]] + $this->_joins;
|
||||
}
|
||||
|
||||
if (substr($position, 0, 7) == 'before_') {
|
||||
$ref = substr($position, 7);
|
||||
$index = 0;
|
||||
} elseif (substr($position, 0, 6) == 'after_') {
|
||||
$ref = substr($position, 6);
|
||||
$index = 1;
|
||||
} else {
|
||||
return $this->addJoin($table, $cond, $type);
|
||||
}
|
||||
if (!isset($this->_joins[$ref]))
|
||||
return $this->addJoin($table, $cond, $type);
|
||||
|
||||
$key_indeces = array_flip(array_keys($this->_joins));
|
||||
$index += $key_indeces[$ref];
|
||||
|
||||
if (!$index)
|
||||
return $this->addJoin($table, $cond, $type, 'start');
|
||||
|
||||
$front_part = array_slice($this->_joins, 0, $index, true);
|
||||
$back_part = array_slice($this->_joins, $index, null, true);
|
||||
|
||||
if (isset($front_part[$alias])) {
|
||||
unset($front_part[$alias]);
|
||||
}
|
||||
|
||||
$this->_joins = $front_part + [$alias => [$table, $cond, $type]] + $back_part;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a WHERE clause to the query.
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|array $value
|
||||
* @param boolean $escape
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addWhere($key, $value = null, $escape = true)
|
||||
{
|
||||
if (!is_array($key) && is_array($value)) {
|
||||
$this->_ci->PrestudentModel->db->where_in($key, $value, $escape);
|
||||
} else {
|
||||
$this->_ci->PrestudentModel->db->where($key, $value, $escape);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a OR WHERE clause to the query.
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|array $value
|
||||
* @param boolean $escape
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addOrWhere($key, $value = null, $escape = true)
|
||||
{
|
||||
if (!is_array($key) && is_array($value)) {
|
||||
$this->_ci->PrestudentModel->db->or_where_in($key, $value, $escape);
|
||||
} else {
|
||||
$this->_ci->PrestudentModel->db->or_where($key, $value, $escape);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the query and executes it.
|
||||
*
|
||||
* @param string|null $studiensemester_kurzbz
|
||||
*
|
||||
* @return stdClass result of the query
|
||||
*/
|
||||
public function execute($studiensemester_kurzbz)
|
||||
{
|
||||
$stdsemEsc = $studiensemester_kurzbz ? $this->_ci->PrestudentModel->escape($studiensemester_kurzbz) : 'NULL';
|
||||
|
||||
|
||||
$this->addSelect(
|
||||
"public.get_rolle_prestudent(
|
||||
public.tbl_prestudent.prestudent_id,
|
||||
" . $this->_ci->PrestudentModel->escape($studiensemester_kurzbz) . "
|
||||
) AS statusofsemester"
|
||||
);
|
||||
$this->addJoin(
|
||||
'public.tbl_studentlehrverband v',
|
||||
'v.student_uid=s.student_uid AND v.studiensemester_kurzbz' . ($studiensemester_kurzbz ? '=' . $stdsemEsc : ' IS NULL'),
|
||||
'LEFT'
|
||||
);
|
||||
$this->addJoin(
|
||||
'public.tbl_prestudentstatus ps',
|
||||
'ps.status_kurzbz=public.get_rolle_prestudent(tbl_prestudent.prestudent_id, ' . $stdsemEsc . ')
|
||||
AND ps.prestudent_id=tbl_prestudent.prestudent_id
|
||||
AND ps.studiensemester_kurzbz=public.get_stdsem_prestudent(tbl_prestudent.prestudent_id, ' . $stdsemEsc . ')
|
||||
AND ps.ausbildungssemester=public.get_absem_prestudent(tbl_prestudent.prestudent_id, ' . $stdsemEsc . ')
|
||||
',
|
||||
'LEFT'
|
||||
);
|
||||
|
||||
$this->addWhere('tbl_prestudent.studiengang_kz', $this->_allowedStgs);
|
||||
|
||||
foreach ($this->_joins as $join)
|
||||
$this->_ci->PrestudentModel->addJoin($join[0], $join[1], $join[2]);
|
||||
|
||||
foreach ($this->_selects as $select)
|
||||
$this->_ci->PrestudentModel->addSelect($select[0], $select[1]);
|
||||
|
||||
$this->_ci->PrestudentModel->addOrder('nachname');
|
||||
$this->_ci->PrestudentModel->addOrder('vorname');
|
||||
|
||||
return $this->_ci->PrestudentModel->load();
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Protected methods
|
||||
|
||||
/**
|
||||
* Get alias of a table or select statement
|
||||
*
|
||||
* @param string $select
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final protected function getAliasFromSelect($select)
|
||||
{
|
||||
if (strpos($select, ' ') !== false) {
|
||||
return trim(strrchr($select, ' '));
|
||||
}
|
||||
|
||||
if (strpos($select, '.') !== false) {
|
||||
return substr(strrchr($select, '.'), 1);
|
||||
}
|
||||
|
||||
return $select;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get alias of a table or select statement
|
||||
*
|
||||
* @param string|array $table
|
||||
*
|
||||
* @return string|array
|
||||
*/
|
||||
final protected function getAliasFromTable($table)
|
||||
{
|
||||
if (strpos($table, ' ') !== false) {
|
||||
return trim(strrchr($table, ' '));
|
||||
}
|
||||
|
||||
return $table;
|
||||
}
|
||||
}
|
||||
@@ -315,22 +315,15 @@
|
||||
WHERE tpl.app = '.$APP.'
|
||||
) pl USING(person_id)
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
SELECT DISTINCT ON (tbl_rueckstellung.person_id)
|
||||
tbl_rueckstellung.person_id,
|
||||
tbl_rueckstellung.datum_bis,
|
||||
tbl_rueckstellung.status_kurzbz,
|
||||
array_to_json(bezeichnung_mehrsprachig::varchar[])->>0 as bezeichnung
|
||||
FROM public.tbl_rueckstellung
|
||||
JOIN public.tbl_rueckstellung_status USING(status_kurzbz)
|
||||
JOIN public.tbl_person sp ON tbl_rueckstellung.person_id = sp.person_id
|
||||
WHERE tbl_rueckstellung.rueckstellung_id =
|
||||
(
|
||||
SELECT srueck.rueckstellung_id
|
||||
FROM public.tbl_rueckstellung srueck
|
||||
WHERE srueck.person_id = tbl_rueckstellung.person_id
|
||||
AND datum_bis >= NOW()
|
||||
ORDER BY srueck.datum_bis DESC LIMIT 1
|
||||
)
|
||||
WHERE tbl_rueckstellung.datum_bis >= NOW()
|
||||
ORDER BY tbl_rueckstellung.person_id, tbl_rueckstellung.datum_bis DESC
|
||||
) rueck ON rueck.person_id = p.person_id
|
||||
WHERE
|
||||
EXISTS (
|
||||
|
||||
@@ -24,22 +24,15 @@ $query = '
|
||||
WHERE tpl.app = '.$APP.'
|
||||
) pl ON p.person_id = pl.person_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
SELECT DISTINCT ON (tbl_rueckstellung.person_id)
|
||||
tbl_rueckstellung.person_id,
|
||||
tbl_rueckstellung.datum_bis,
|
||||
tbl_rueckstellung.status_kurzbz,
|
||||
array_to_json(bezeichnung_mehrsprachig::varchar[])->>0 as bezeichnung
|
||||
FROM public.tbl_rueckstellung
|
||||
JOIN public.tbl_rueckstellung_status USING(status_kurzbz)
|
||||
JOIN public.tbl_person sp ON tbl_rueckstellung.person_id = sp.person_id
|
||||
WHERE tbl_rueckstellung.rueckstellung_id =
|
||||
(
|
||||
SELECT srueck.rueckstellung_id
|
||||
FROM public.tbl_rueckstellung srueck
|
||||
WHERE srueck.person_id = tbl_rueckstellung.person_id
|
||||
AND datum_bis >= NOW()
|
||||
ORDER BY srueck.datum_bis DESC LIMIT 1
|
||||
)
|
||||
JOIN public.tbl_rueckstellung_status USING(status_kurzbz)
|
||||
WHERE tbl_rueckstellung.datum_bis >= NOW()
|
||||
ORDER BY tbl_rueckstellung.person_id, tbl_rueckstellung.datum_bis DESC
|
||||
) rueck ON rueck.person_id = p.person_id
|
||||
WHERE p.person_id NOT IN (SELECT person_id FROM public.tbl_prestudent)';
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
$includesArray = array(
|
||||
'title' => 'LRT Test Page',
|
||||
'axios027' => true,
|
||||
'bootstrap5' => true,
|
||||
'fontawesome6' => true,
|
||||
'vue3' => true,
|
||||
'navigationcomponent' => true,
|
||||
'phrases' => array(
|
||||
'global',
|
||||
'ui'
|
||||
),
|
||||
'customJSModules' => array('public/js/apps/LRTTest.js'),
|
||||
);
|
||||
|
||||
$this->load->view('templates/FHC-Header', $includesArray);
|
||||
?>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<!-- Navigation component -->
|
||||
<core-navigation-cmpt></core-navigation-cmpt>
|
||||
|
||||
<div id="content"></div>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer', $includesArray); ?>
|
||||
|
||||
+75
-11
@@ -80,9 +80,17 @@ echo '
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
|
||||
<link rel="stylesheet" href="../../vendor/components/jqueryui/themes/base/jquery-ui.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../vendor/twbs/bootstrap3/dist/css/bootstrap.min.css" type="text/css"/>
|
||||
<link href="../../skin/style.css.php" rel="stylesheet" type="text/css" />
|
||||
<style>
|
||||
.ui-dialog-titlebar-close
|
||||
{
|
||||
visibility: hidden !important;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="../../vendor/components/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="../../vendor/components/jqueryui/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="../../vendor/twbs/bootstrap3/dist/js/bootstrap.min.js"></script>
|
||||
<script language="Javascript" type="text/javascript">
|
||||
//<![CDATA[
|
||||
@@ -131,22 +139,78 @@ echo '
|
||||
}
|
||||
}
|
||||
|
||||
function GebietStarten(bezeichnung,stunde,minute,sekunde,gebiet_id)
|
||||
function GebietStarten(bezeichnung, stunde, minute, sekunde, gebiet_id)
|
||||
{
|
||||
var check = confirm(<?php echo "'".$p->t('testtool/okKlickenUmZuStarten')."'"?>+' '+stunde+'h '+minute+'m '+sekunde+'s');
|
||||
if (check == true) {
|
||||
var sprache_user = <?php echo "'".$sprache_user."'"?>;
|
||||
document.location.href = 'frage.php?gebiet_id='+gebiet_id+'&start=true';
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
let message = <?php echo "'".$p->t('testtool/okKlickenUmZuStarten')."'"?> + ' ' + stunde + 'h ' + minute + 'm ' + sekunde + 's';
|
||||
let title = <?php echo "'".$p->t('testtool/startGebiet')."'"?>;
|
||||
let abbrechen = <?php echo "'".$p->t('testtool/abbrechen')."'"?>;
|
||||
|
||||
if ($('#gebiet-dialog').length === 0)
|
||||
{
|
||||
$('body').append(
|
||||
'<div id="gebiet-dialog" title="' + title + '">' +
|
||||
'<p id="gebiet-dialog-msg">' + message + '</p>' +
|
||||
'</div>'
|
||||
);
|
||||
}
|
||||
|
||||
$('#gebiet-dialog').dialog({
|
||||
modal: true,
|
||||
width: 400,
|
||||
resizable: false,
|
||||
buttons: [
|
||||
{
|
||||
text: 'OK',
|
||||
click: function() {
|
||||
$(this).dialog('close');
|
||||
document.location.href = 'frage.php?gebiet_id=' + gebiet_id + '&start=true';
|
||||
}
|
||||
},
|
||||
{
|
||||
text: abbrechen,
|
||||
click: function() {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
let letzteFrageBestaetigt = false;
|
||||
|
||||
function letzteFrage()
|
||||
{
|
||||
alert(<?php echo "'".$p->t("testtool/alleFragenBeantwortet")."'"?>);
|
||||
return true;
|
||||
if (letzteFrageBestaetigt)
|
||||
return true;
|
||||
|
||||
let message = <?php echo "'".$p->t("testtool/alleFragenBeantwortet")."'"?>;
|
||||
|
||||
if ($('#fertig-dialog').length === 0)
|
||||
{
|
||||
$('body').append(
|
||||
'<div id="fertig-dialog">' +
|
||||
'<p>' + message + '</p>' +
|
||||
'</div>'
|
||||
);
|
||||
}
|
||||
|
||||
$('#fertig-dialog').dialog({
|
||||
modal: true,
|
||||
width: 400,
|
||||
resizable: false,
|
||||
buttons: [
|
||||
{
|
||||
text: 'OK',
|
||||
click: function() {
|
||||
$(this).dialog('close');
|
||||
letzteFrageBestaetigt = true;
|
||||
$('[name="submitantwort"]').click();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
@@ -647,7 +711,7 @@ if($frage->frage_id!='')
|
||||
}
|
||||
|
||||
$letzte = $frage->getNextFrage($gebiet_id, $_SESSION['pruefling_id'], $frage_id, $demo);
|
||||
echo "<form action=\"$PHP_SELF?gebiet_id=$gebiet_id&frage_id=$frage->frage_id\" method=\"POST\" ".(!$letzte && !$levelgebiet?"onsubmit=\"letzteFrage()\"":"").">";
|
||||
echo "<form action=\"$PHP_SELF?gebiet_id=$gebiet_id&frage_id=$frage->frage_id\" method=\"POST\" ".(!$letzte && !$levelgebiet?"onsubmit=\"return letzteFrage()\"":"").">";
|
||||
echo '
|
||||
<div class="row text-center">
|
||||
<table class="table" style="width: 600px; margin-left: auto; margin-right: auto;">
|
||||
|
||||
@@ -44,6 +44,27 @@ if (isset($_GET['sprache_user']) && !empty($_GET['sprache_user']))
|
||||
$sprache_user = (isset($_SESSION['sprache_user']) && !empty($_SESSION['sprache_user'])) ? $_SESSION['sprache_user'] : DEFAULT_LANGUAGE;
|
||||
$p = new phrasen($sprache_user);
|
||||
|
||||
$showInfo = false;
|
||||
if (isset($_SESSION['alleGebiete']))
|
||||
{
|
||||
$alleGebiete = array_map('intval', $_SESSION['alleGebiete']);
|
||||
$pruefling_id = $_SESSION['pruefling_id'];
|
||||
|
||||
$qry = "SELECT COUNT(DISTINCT gebiet_id) as anzahl
|
||||
FROM testtool.tbl_pruefling_frage
|
||||
JOIN testtool.tbl_frage USING(frage_id)
|
||||
WHERE gebiet_id IN (". implode(',', $alleGebiete) .")
|
||||
AND pruefling_id = ". $pruefling_id ."
|
||||
";
|
||||
|
||||
$result = $db->db_query($qry);
|
||||
$anzahlGebiete = $db->db_fetch_object($result);
|
||||
|
||||
|
||||
if ((int)$anzahlGebiete->anzahl === count($alleGebiete))
|
||||
$showInfo = true;
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
@@ -69,6 +90,7 @@ $p = new phrasen($sprache_user);
|
||||
<body>
|
||||
<br><br><br><br><br>
|
||||
<center><h2><?php echo $p->t('testtool/zeitAbgelaufen');?></h2>
|
||||
<h3><?php echo ($showInfo ? ($p->t('testtool/alleGebietGestartet') . "<br />" . $p->t('testtool/alleGebieteGestartetInfo')) : ''); ?></h3>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+11
-2
@@ -142,7 +142,9 @@ if (isset($_REQUEST['prestudent']))
|
||||
}
|
||||
if ($reihungstest_id != '' && $rt->load($reihungstest_id))
|
||||
{
|
||||
if ($rt->freigeschaltet)
|
||||
$pruefling_exist = new Pruefling();
|
||||
$alreadyInRT = $pruefling_exist->personAlreadyInRT($ps->person_id, $rt->reihungstest_id, $ps->prestudent_id);
|
||||
if ($rt->freigeschaltet && !$alreadyInRT)
|
||||
{
|
||||
// regenerate Session ID after Login
|
||||
session_regenerate_id();
|
||||
@@ -282,7 +284,14 @@ if (isset($_REQUEST['prestudent']))
|
||||
}
|
||||
else
|
||||
{
|
||||
$alertmsg .= '<div class="alert alert-danger">'.$p->t('testtool/reihungstestNichtFreigeschalten').'</div>';
|
||||
if ($alreadyInRT)
|
||||
{
|
||||
$alertmsg .= '<div class="alert alert-danger">'.$p->t('testtool/reihungstestNichtRegistriert').'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$alertmsg .= '<div class="alert alert-danger">'.$p->t('testtool/reihungstestNichtFreigeschalten').'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -187,6 +187,7 @@ else if (isset($_SESSION['pruefling_id']))
|
||||
}
|
||||
|
||||
$qry .= "
|
||||
AND ps_status.bewerbung_abgeschicktamum IS NOT NULL
|
||||
|
||||
/* Order to get last semester when using distinct on */
|
||||
ORDER BY
|
||||
@@ -405,6 +406,29 @@ else if (isset($_SESSION['pruefling_id']))
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
if (isset($_SESSION['pruefling_id']) && !empty($_SESSION['alleGebiete']))
|
||||
{
|
||||
$alleGebiete = array_map('intval', $_SESSION['alleGebiete']);
|
||||
$pruefling_id = (int)$_SESSION['pruefling_id'];
|
||||
|
||||
$qry = "SELECT COUNT(DISTINCT gebiet_id) AS anzahl
|
||||
FROM testtool.tbl_pruefling_frage
|
||||
JOIN testtool.tbl_frage USING(frage_id)
|
||||
WHERE gebiet_id IN (". implode(',', $alleGebiete) .")
|
||||
AND pruefling_id = ". $pruefling_id;
|
||||
|
||||
$result_check = $db->db_query($qry);
|
||||
$row_check = $db->db_fetch_object($result_check);
|
||||
|
||||
if ((int)$row_check->anzahl === count($alleGebiete))
|
||||
{
|
||||
echo '<tr><td>
|
||||
<div class="alert alert-success small" style="margin-left: 20px; width: 170px; margin-top: 3px;" role="alert">
|
||||
<strong>'.$p->t('testtool/alleGebietGestartet').'</strong>
|
||||
</div>
|
||||
</td></tr>';
|
||||
}
|
||||
}
|
||||
// Link zum Logout
|
||||
|
||||
echo '<tr><td class="ItemTesttool" style="margin-left: 20px;" nowrap>
|
||||
|
||||
@@ -95,37 +95,37 @@ foreach ($result_student as $row)
|
||||
if ($uids == '')
|
||||
die('Es befinden sich keine Studierende in diesem Semester');
|
||||
|
||||
$qry = "SELECT
|
||||
lehrveranstaltung_id, bezeichnung, studiengang_kz, semester, ects
|
||||
FROM
|
||||
lehre.tbl_lehrveranstaltung
|
||||
WHERE
|
||||
lehrveranstaltung_id IN
|
||||
(
|
||||
SELECT
|
||||
distinct lehrveranstaltung_id
|
||||
FROM
|
||||
campus.vw_student_lehrveranstaltung, public.tbl_studentlehrverband
|
||||
WHERE
|
||||
tbl_studentlehrverband.studiengang_kz=".$db->db_add_param($studiengang_kz, FHC_INTEGER)." AND
|
||||
tbl_studentlehrverband.semester=".$db->db_add_param($semester, FHC_INTEGER)." AND
|
||||
vw_student_lehrveranstaltung.studiensemester_kurzbz=".$db->db_add_param($semester_aktuell)." AND
|
||||
uid=student_uid AND
|
||||
vw_student_lehrveranstaltung.studiensemester_kurzbz=tbl_studentlehrverband.studiensemester_kurzbz
|
||||
$qry = "SELECT
|
||||
lehrveranstaltung_id, bezeichnung, studiengang_kz, semester, ects
|
||||
FROM
|
||||
lehre.tbl_lehrveranstaltung
|
||||
WHERE
|
||||
lehrveranstaltung_id IN (
|
||||
SELECT
|
||||
DISTINCT lehrveranstaltung_id
|
||||
FROM
|
||||
campus.vw_student_lehrveranstaltung
|
||||
JOIN public.tbl_studentlehrverband ON(student_uid = uid)
|
||||
WHERE
|
||||
tbl_studentlehrverband.studiengang_kz = ".$db->db_add_param($studiengang_kz, FHC_INTEGER)."
|
||||
AND tbl_studentlehrverband.semester = ".$db->db_add_param($semester, FHC_INTEGER)."
|
||||
AND vw_student_lehrveranstaltung.studiensemester_kurzbz = ".$db->db_add_param($semester_aktuell)."
|
||||
AND vw_student_lehrveranstaltung.studiensemester_kurzbz = tbl_studentlehrverband.studiensemester_kurzbz
|
||||
)
|
||||
AND studiengang_kz<>0
|
||||
AND studiengang_kz != 0
|
||||
AND zeugnis
|
||||
UNION
|
||||
SELECT
|
||||
lehrveranstaltung_id, bezeichnung, studiengang_kz, semester, ects
|
||||
FROM
|
||||
lehre.tbl_lehrveranstaltung JOIN lehre.tbl_zeugnisnote USING(lehrveranstaltung_id)
|
||||
WHERE
|
||||
tbl_lehrveranstaltung.studiengang_kz=".$db->db_add_param($studiengang_kz, FHC_INTEGER)." AND
|
||||
tbl_zeugnisnote.student_uid in($uids) AND
|
||||
tbl_zeugnisnote.studiensemester_kurzbz=".$db->db_add_param($semester_aktuell)." AND
|
||||
zeugnis
|
||||
ORDER BY bezeichnung";
|
||||
UNION
|
||||
SELECT
|
||||
lehrveranstaltung_id, bezeichnung, studiengang_kz, semester, ects
|
||||
FROM
|
||||
lehre.tbl_lehrveranstaltung
|
||||
JOIN lehre.tbl_zeugnisnote USING(lehrveranstaltung_id)
|
||||
WHERE
|
||||
tbl_lehrveranstaltung.studiengang_kz = ".$db->db_add_param($studiengang_kz, FHC_INTEGER)."
|
||||
AND tbl_zeugnisnote.student_uid IN ($uids)
|
||||
AND tbl_zeugnisnote.studiensemester_kurzbz = ".$db->db_add_param($semester_aktuell)."
|
||||
AND zeugnis
|
||||
ORDER BY bezeichnung";
|
||||
|
||||
if (!$result_lva = $db->db_query($qry))
|
||||
die('Fehler beim Ermitteln der Lehrveranstaltungen');
|
||||
@@ -338,6 +338,10 @@ if ($typ == 'xls')
|
||||
}
|
||||
$anzahl_lvspalten = $spalte - 2;
|
||||
|
||||
$worksheet->write($zeile, ++$spalte, 'ECTS Summe zugeteilt', $format_bold);
|
||||
$maxlength[$spalte] = 20;
|
||||
$worksheet->write($zeile, ++$spalte, 'ECTS Summe gewichtet', $format_bold);
|
||||
$maxlength[$spalte] = 20;
|
||||
$worksheet->write($zeile, ++$spalte, 'Notendurchschnitt', $format_bold);
|
||||
$maxlength[$spalte] = 15;
|
||||
$worksheet->write($zeile, ++$spalte, "Gewichteter\nNotendurchschnitt", $format_bold_wrap);
|
||||
@@ -372,9 +376,12 @@ if ($typ == 'xls')
|
||||
$worksheet->write($zeile, ++$spalte, $row_student->gruppe, $format_bold_left);
|
||||
$worksheet->write($zeile, ++$spalte, $row_student->matrikelnr, $format_bold);
|
||||
|
||||
//Alle Zeugnisnoten des Studierenden holen
|
||||
// Alle Zeugnisnoten des Studierenden holen
|
||||
$noten = array();
|
||||
$qry = "SELECT * FROM lehre.tbl_zeugnisnote WHERE student_uid=".$db->db_add_param($row_student->uid)." AND studiensemester_kurzbz=".$db->db_add_param($semester_aktuell);
|
||||
$qry = "SELECT lehrveranstaltung_id, note
|
||||
FROM lehre.tbl_zeugnisnote
|
||||
WHERE student_uid = ".$db->db_add_param($row_student->uid)."
|
||||
AND studiensemester_kurzbz = ".$db->db_add_param($semester_aktuell);
|
||||
if ($result = $db->db_query($qry))
|
||||
while ($row = $db->db_fetch_object($result))
|
||||
$noten[$row->lehrveranstaltung_id] = $row->note;
|
||||
@@ -382,15 +389,16 @@ if ($typ == 'xls')
|
||||
//Zu jeder Lehrveranstaltungsnote Prüfungstyp (Anzahl der Antritte) holen
|
||||
$pruefungstypen = array();
|
||||
$qry = "SELECT tbl_lehrveranstaltung.lehrveranstaltung_id, pruefungstyp_kurzbz, sort, datum
|
||||
FROM
|
||||
lehre.tbl_pruefung
|
||||
JOIN
|
||||
lehre.tbl_lehreinheit using(lehreinheit_id)
|
||||
JOIN
|
||||
lehre.tbl_lehrveranstaltung using(lehrveranstaltung_id)
|
||||
WHERE
|
||||
student_uid=".$db->db_add_param($row_student->uid)." AND studiensemester_kurzbz=".$db->db_add_param($semester_aktuell)."
|
||||
ORDER BY lehrveranstaltung_id, sort, datum";
|
||||
FROM
|
||||
lehre.tbl_pruefung
|
||||
JOIN
|
||||
lehre.tbl_lehreinheit USING(lehreinheit_id)
|
||||
JOIN
|
||||
lehre.tbl_lehrveranstaltung USING(lehrveranstaltung_id)
|
||||
WHERE
|
||||
student_uid = ".$db->db_add_param($row_student->uid)."
|
||||
AND studiensemester_kurzbz = ".$db->db_add_param($semester_aktuell)."
|
||||
ORDER BY lehrveranstaltung_id, sort, datum";
|
||||
if ($result = $db->db_query($qry))
|
||||
{
|
||||
while ($row = $db->db_fetch_object($result))
|
||||
@@ -399,15 +407,14 @@ if ($typ == 'xls')
|
||||
}
|
||||
}
|
||||
|
||||
//Alle LVs holen zu denen der Studierende zugeteilt ist
|
||||
// Alle LVs holen zu denen der Studierende zugeteilt ist
|
||||
$zugeteilte_lvs = array();
|
||||
$qry = "SELECT distinct lehrveranstaltung_id
|
||||
FROM
|
||||
campus.vw_student_lehrveranstaltung
|
||||
WHERE
|
||||
uid=".$db->db_add_param($row_student->uid)." AND
|
||||
studiensemester_kurzbz=".$db->db_add_param($semester_aktuell);
|
||||
|
||||
$qry = "SELECT DISTINCT lehrveranstaltung_id
|
||||
FROM
|
||||
campus.vw_student_lehrveranstaltung
|
||||
WHERE
|
||||
uid = ".$db->db_add_param($row_student->uid)."
|
||||
AND studiensemester_kurzbz = ".$db->db_add_param($semester_aktuell);
|
||||
if ($result = $db->db_query($qry))
|
||||
while ($row = $db->db_fetch_object($result))
|
||||
$zugeteilte_lvs[] = $row->lehrveranstaltung_id;
|
||||
@@ -416,17 +423,20 @@ if ($typ == 'xls')
|
||||
$summe = 0;
|
||||
$rowcount = 0;
|
||||
$summeects = 0;
|
||||
$total_ects = 0;
|
||||
$gewichtetenote = 0;
|
||||
|
||||
while ($rowcount < $db->db_num_rows($result_lva))
|
||||
{
|
||||
$row_lva = $db->db_fetch_object($result_lva, $rowcount);
|
||||
$rowcount++;
|
||||
|
||||
//wenn es eine Note gibt
|
||||
if (isset($noten[$row_lva->lehrveranstaltung_id]))
|
||||
{
|
||||
$note = $noten[$row_lva->lehrveranstaltung_id];
|
||||
$format = 0;
|
||||
$total_ects += $row_lva->ects;
|
||||
|
||||
//wenn für die LV der Studierende eine Nachprüfung hat (z.B. 2 Termin, kommissionelle...)
|
||||
if (isset($pruefungstypen[$row_lva->lehrveranstaltung_id]))
|
||||
@@ -472,6 +482,7 @@ if ($typ == 'xls')
|
||||
//Keine Note fuer diese LV vorhanden
|
||||
if (in_array($row_lva->lehrveranstaltung_id, $zugeteilte_lvs))
|
||||
{
|
||||
$total_ects += $row_lva->ects;
|
||||
$worksheet->write($zeile, ++$spalte, '', $format_colored_nichteingetragen);
|
||||
}
|
||||
else
|
||||
@@ -489,6 +500,8 @@ if ($typ == 'xls')
|
||||
if ($summeects != 0)
|
||||
$gewichtetenote /= $summeects;
|
||||
|
||||
$worksheet->write($zeile, ++$spalte, sprintf("%.2f", $total_ects), $format_number);
|
||||
$worksheet->write($zeile, ++$spalte, sprintf("%.2f", $summeects), $format_number);
|
||||
$worksheet->write($zeile, ++$spalte, sprintf("%.2f", $schnitt), $format_number);
|
||||
$worksheet->write($zeile, ++$spalte, sprintf("%.2f", $gewichtetenote), $format_number);
|
||||
if ($gewichtetenote != 0)
|
||||
@@ -529,6 +542,8 @@ if ($typ == 'xls')
|
||||
$schnitt = $summe_schnitt / $anzahl_schnitt;
|
||||
else
|
||||
$schnitt = 0;
|
||||
$worksheet->write($zeile, ++$spalte, '-', $format_bold_center);
|
||||
$worksheet->write($zeile, ++$spalte, '-', $format_bold_center);
|
||||
$worksheet->write($zeile, ++$spalte, sprintf("%.2f", $schnitt), $format_number);
|
||||
if ($anzahlgewichtet != 0)
|
||||
$summegewichtet = $summegewichtet / $anzahlgewichtet;
|
||||
|
||||
@@ -584,6 +584,32 @@ class pruefling extends basis_db
|
||||
|
||||
$qry .= " LIMIT 1";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if ($this->db_num_rows($result) == 0)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei einer Abfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public function personAlreadyInRT($person_id, $reihungstest_id, $prestudent_id)
|
||||
{
|
||||
$qry = "SELECT tbl_prestudent.prestudent_id
|
||||
FROM public.tbl_rt_person
|
||||
JOIN public.tbl_prestudent ON tbl_prestudent.person_id = tbl_rt_person.person_id
|
||||
JOIN public.tbl_prestudentstatus ON tbl_prestudent.prestudent_id = tbl_prestudentstatus.prestudent_id AND status_kurzbz = 'Bewerber'
|
||||
AND tbl_prestudentstatus.studienplan_id = tbl_rt_person.studienplan_id
|
||||
WHERE tbl_rt_person.person_id = " . $this->db_add_param($person_id) . "
|
||||
AND tbl_rt_person.rt_id = " . $this->db_add_param($reihungstest_id) . "
|
||||
AND tbl_prestudent.prestudent_id != " . $this->db_add_param($prestudent_id) . "
|
||||
AND get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL) = 'Bewerber'
|
||||
LIMIT 1";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if ($this->db_num_rows($result) == 0)
|
||||
|
||||
@@ -17,6 +17,7 @@ $this->phrasen['testtool/basic']='Basic';
|
||||
$this->phrasen['testtool/basisgebiete']='Basisgebiete';
|
||||
$this->phrasen['testtool/semester']='Semester';
|
||||
$this->phrasen['testtool/reihungstestNichtFreigeschalten']='Der zuteilte Reihungstest ist noch nicht freigeschaltet';
|
||||
$this->phrasen['testtool/reihungstestNichtRegistriert']='Sie sind für den Reihungstest nicht registriert';
|
||||
$this->phrasen['testtool/reihungstestKannNichtGeladenWerden']='Der Reihungstest dem Sie zugeteilt sind, kann nicht geladen werden. Melden Sie sich bitte bei der Reihungstestaufsicht.';
|
||||
$this->phrasen['testtool/geburtsdatumStimmtNichtUeberein']='Ihr Geburtsdatum stimmt nicht mit unseren Daten überein. Bitte wenden Sie sich an die Aufsichtsperson';
|
||||
$this->phrasen['testtool/home']='Home';
|
||||
@@ -31,10 +32,14 @@ $this->phrasen['testtool/keineAntwort']='Keine Antwort';
|
||||
$this->phrasen['testtool/speichernUndWeiter']='Speichern und weiter';
|
||||
$this->phrasen['testtool/alleFragenBeantwortet']='GLÜCKWUNSCH! \n\nSie haben alle Fragen in der zur Verfügung stehenden Zeit beantwortet. \nNutzen Sie die verbleibende Zeit, um Ihre Antworten zu kontrollieren oder fahren Sie mit dem nächsten Teilgebiet fort.';
|
||||
$this->phrasen['testtool/zeitAbgelaufen']='Die Maximalzeit für dieses Gebiet ist abgelaufen, oder alle Fragen wurden beantwortet';
|
||||
$this->phrasen['testtool/alleGebietGestartet']='Sie haben alle Gebiete bearbeitet.';
|
||||
$this->phrasen['testtool/alleGebieteGestartetInfo']='Sie können sich nun ausloggen und den Browser schließen.';
|
||||
$this->phrasen['testtool/spracheDerTestfragen']='Gewünschte Sprache der Testfragen';
|
||||
$this->phrasen['testtool/einleitung']='Einleitung';
|
||||
$this->phrasen['testtool/blaettern']='Blättern';
|
||||
$this->phrasen['testtool/demo']='Demobeispiel ansehen';
|
||||
$this->phrasen['testtool/abbrechen']='Abbrechen';
|
||||
$this->phrasen['testtool/startGebiet']='Gebiet starten';
|
||||
$this->phrasen['testtool/okKlickenUmZuStarten']='Klicken Sie OK um dieses Gebiet zu starten. \nSie haben für die Bearbeitung ein Zeitlimit von';
|
||||
$this->phrasen['testtool/bitteZuerstAnmelden']='Bitte zuerst anmelden!';
|
||||
$this->phrasen['testtool/fehlerBeimGenerierenDesFragenpools']='Fehler beim generieren des Fragenpools';
|
||||
|
||||
@@ -17,6 +17,7 @@ $this->phrasen['testtool/basic']='Basic';
|
||||
$this->phrasen['testtool/basisgebiete']='Basic test';
|
||||
$this->phrasen['testtool/semester']='Semester';
|
||||
$this->phrasen['testtool/reihungstestNichtFreigeschalten']='The entrance examination assigned has not yet been activated.';
|
||||
$this->phrasen['testtool/reihungstestNichtRegistriert']='You are not registered for the placement test.';
|
||||
$this->phrasen['testtool/reihungstestKannNichtGeladenWerden']='The placement test you are assigned to could not be loaded. Please contact the placement test supervisior.';
|
||||
$this->phrasen['testtool/geburtsdatumStimmtNichtUeberein']='Your date of birth does not correspond to the data we have. Please speak to the supervisor. ';
|
||||
$this->phrasen['testtool/home']='Home';
|
||||
@@ -31,10 +32,14 @@ $this->phrasen['testtool/keineAntwort']='No Answer';
|
||||
$this->phrasen['testtool/speichernUndWeiter']='Save and next';
|
||||
$this->phrasen['testtool/alleFragenBeantwortet']='CONGRATULATIONS!\n\nYou have answered all the questions in the time allowed.\n Use the remaining time to check your answers or continue to the next section.';
|
||||
$this->phrasen['testtool/zeitAbgelaufen']='The time for this part has expired or you have answered all the questions.';
|
||||
$this->phrasen['testtool/alleGebietGestartet']='You have worked on all sections.';
|
||||
$this->phrasen['testtool/alleGebieteGestartetInfo']='You can now log out and close the browser.';
|
||||
$this->phrasen['testtool/spracheDerTestfragen']='Desired language of questions';
|
||||
$this->phrasen['testtool/einleitung']='Introduction';
|
||||
$this->phrasen['testtool/blaettern']='Browse';
|
||||
$this->phrasen['testtool/demo']='See an example';
|
||||
$this->phrasen['testtool/abbrechen']='Cancel';
|
||||
$this->phrasen['testtool/startGebiet']='Start the section';
|
||||
$this->phrasen['testtool/okKlickenUmZuStarten']='Click OK to start this section. \nYou have a timelimit of';
|
||||
$this->phrasen['testtool/bitteZuerstAnmelden']='Please log in first!';
|
||||
$this->phrasen['testtool/fehlerBeimGenerierenDesFragenpools']='Error in generating the pool of questions.';
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
export default {
|
||||
addNew1MinLrt()
|
||||
{
|
||||
return {
|
||||
method: 'post',
|
||||
url: '/system/LRTTest/lrt1min'
|
||||
};
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Copyright (C) 2022 fhcomplete.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import PluginsPhrasen from '../plugins/Phrasen.js';
|
||||
import {CoreNavigationCmpt} from '../components/navigation/Navigation.js'
|
||||
|
||||
import ApiLrt from "../api/LRTTEst.js";
|
||||
|
||||
const lrtTestApp = Vue.createApp({
|
||||
data: function() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
components: {
|
||||
CoreNavigationCmpt,
|
||||
},
|
||||
methods: {
|
||||
addNew1MinLrt() {
|
||||
this.$api.call(ApiLrt.addNew1MinLrt())
|
||||
.then(result => {
|
||||
this.dropdowns.studiensemester_array = result.data;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<button type="button" class="btn btn-primary" @click="addNew1MinLrt()">Add a 1 min LRT</button>
|
||||
`
|
||||
});
|
||||
|
||||
FhcApps.makeExtendable(lrtTestApp);
|
||||
|
||||
lrtTestApp.use(PluginsPhrasen).mount('#main');
|
||||
|
||||
@@ -705,7 +705,72 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml")
|
||||
}
|
||||
echo ' </anrechnungen>';
|
||||
|
||||
//Berufliche Kompetenzen
|
||||
$studienplan = new studienplan();
|
||||
$studienplan->loadStudienplan($studienplan_id);
|
||||
$regelstudiendauer = $studienplan->regelstudiendauer;
|
||||
$studienplan_ects = $studienplan->ects_stpl;
|
||||
$ects_berufliche_kompetenzen = 0;
|
||||
|
||||
//bei masterlehrgängen und $studienplan_ects >= 120 ECTS: Andruck der beruflichen Kompetenzen, wenn die Lv angerechnet wurde
|
||||
//TODO(Manu) check if rule still valid
|
||||
if ($row->typ == 'l' && $regelstudiendauer >= 4)
|
||||
{
|
||||
$ects_berufliche_kompetenzen = 0;
|
||||
echo '<berufliche_kompetenzen>';
|
||||
echo '<header_berufliche_kompetenz>Validierung von beruflich erworbenen Kompetenzen</header_berufliche_kompetenz>';
|
||||
|
||||
$qry_sem_0="
|
||||
SELECT
|
||||
lehrveranstaltung_id,
|
||||
lehrform_kurzbz,
|
||||
sws,
|
||||
lehre.tbl_lehrveranstaltung.bezeichnung,
|
||||
bezeichnung_english,
|
||||
ects,
|
||||
benotungsdatum,
|
||||
note,
|
||||
positiv,
|
||||
offiziell,
|
||||
note.anmerkung
|
||||
FROM
|
||||
lehre.tbl_zeugnisnote zeugnis
|
||||
JOIN lehre.tbl_note note USING(note)
|
||||
JOIN lehre.tbl_lehrveranstaltung USING(lehrveranstaltung_id)
|
||||
JOIN public.tbl_student student USING(student_uid)
|
||||
WHERE
|
||||
student_uid =".$db->db_add_param($uid_arr[$i])."
|
||||
AND
|
||||
lehre.tbl_lehrveranstaltung.semester = '0'
|
||||
";
|
||||
|
||||
if($result_sem_0 = $db->db_query($qry_sem_0))
|
||||
{
|
||||
while ($row_sem_0 = $db->db_fetch_object($result_sem_0))
|
||||
{
|
||||
$benotungsdatum = $datum->formatDatum($row_sem_0->benotungsdatum, 'd/m/Y');
|
||||
$note = $db->db_parse_bool($row_sem_0->offiziell) ? $row_sem_0->anmerkung : $row_sem_0->note;
|
||||
$ects_berufliche_kompetenzen += $row_sem_0->ects;
|
||||
|
||||
echo '<lv_sem0>
|
||||
<lv_id>' . $row_sem_0->lehrveranstaltung_id . '</lv_id>
|
||||
<lehrform_kurzbz>' . $row_sem_0->lehrform_kurzbz . '</lehrform_kurzbz>
|
||||
<bezeichnung><![CDATA[' . $row_sem_0->bezeichnung . ']]></bezeichnung>
|
||||
<bezeichnung_englisch><![CDATA[' . $row_sem_0->bezeichnung_english . ']]></bezeichnung_englisch>
|
||||
<sws_lv>'.$row_sem_0->sws.'</sws_lv>
|
||||
<ects>'.$row_sem_0->ects.'</ects>
|
||||
<note_positiv>'.$db->db_parse_bool($row_sem_0->positiv).'</note_positiv>
|
||||
<note>'.$note.'</note>
|
||||
<benotungsdatum>'.$benotungsdatum.'</benotungsdatum>
|
||||
</lv_sem0>';
|
||||
}
|
||||
}
|
||||
echo '<ects_berufliche_kompetenz>'.$ects_berufliche_kompetenzen.'</ects_berufliche_kompetenz>';
|
||||
echo '</berufliche_kompetenzen>';
|
||||
}
|
||||
|
||||
echo "<studiensemester>";
|
||||
|
||||
for($start = $semesterNumberStart; $start <= $semesterNumberEnd; $start++)
|
||||
{
|
||||
$semester_ects = 0;
|
||||
@@ -728,6 +793,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml")
|
||||
AND zeugnis = true
|
||||
AND status.ausbildungssemester = ".$db->db_add_param($start)."
|
||||
AND status.status_kurzbz NOT IN('Unterbrecher', 'Interessent','Bewerber','Aufgenommener','Abgewiesener','Wartender')
|
||||
--AND lehre.tbl_lehrveranstaltung.semester != '0'
|
||||
ORDER BY datum ASC";
|
||||
|
||||
$semester_kurzbz = array();
|
||||
@@ -776,6 +842,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml")
|
||||
WHERE
|
||||
student_uid = ".$db->db_add_param($uid_arr[$i])."
|
||||
AND zeugnis = true
|
||||
AND lehre.tbl_lehrveranstaltung.semester != '0'
|
||||
AND studiensemester_kurzbz in (".$sqlStudent->implode4SQL($aktuellesSemester).")";
|
||||
|
||||
if (defined('ZEUGNISNOTE_NICHT_ANZEIGEN'))
|
||||
@@ -1134,10 +1201,19 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<ects_gesamt>'.$semester_ects.'</ects_gesamt>';
|
||||
echo '<ects_gesamt_positiv>'.$semester_ects_positiv.'</ects_gesamt_positiv>';
|
||||
echo "</semesters>";
|
||||
}
|
||||
|
||||
//TODO(Manu) check if rule still valid
|
||||
if ($row->typ == 'l' && $regelstudiendauer >= 4)
|
||||
{
|
||||
$ects_total += $ects_berufliche_kompetenzen;
|
||||
$ects_total_positiv += $ects_berufliche_kompetenzen;
|
||||
}
|
||||
|
||||
echo "</studiensemester>";
|
||||
echo " <ects_total>$ects_total</ects_total>";
|
||||
echo " <ects_total_positiv>$ects_total_positiv</ects_total_positiv>";
|
||||
|
||||
@@ -94,6 +94,8 @@ require_once('dbupdate_3.4/71399_dashboard_update_widget_paths.php');
|
||||
require_once('dbupdate_3.4/71645_studvw_messagetab_ladezeit.php');
|
||||
require_once('dbupdate_3.4/71566_studienordnungsdokument_neuer_organisationseinheitstyp_programm.php');
|
||||
require_once('dbupdate_3.4/70376_lohnguide.php');
|
||||
require_once('dbupdate_3.4/76203_Asynchrone_Tasks.php');
|
||||
require_once('dbupdate_3.4/75888_reihungstest_mehrfachdurchfuehrung.php');
|
||||
|
||||
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
|
||||
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
|
||||
@@ -429,7 +431,7 @@ $tabellen=array(
|
||||
"system.tbl_log" => array("log_id","person_id","zeitpunkt","app","oe_kurzbz","logtype_kurzbz","logdata","insertvon","taetigkeit_kurzbz"),
|
||||
"system.tbl_logtype" => array("logtype_kurzbz", "data_schema"),
|
||||
"system.tbl_filters" => array("filter_id","app","dataset_name","filter_kurzbz","person_id","description","sort","default_filter","filter","oe_kurzbz","statistik_kurzbz"),
|
||||
"system.tbl_jobsqueue" => array("jobid", "type", "creationtime", "status", "input", "output", "starttime", "endtime", "insertvon", "insertamum"),
|
||||
"system.tbl_jobsqueue" => array("jobid", "type", "creationtime", "status", "input", "output", "starttime", "endtime", "insertvon", "insertamum", "pid", "uid", "progress"),
|
||||
"system.tbl_jobstatuses" => array("status"),
|
||||
"system.tbl_jobtriggers" => array("type", "status", "following_type"),
|
||||
"system.tbl_jobtypes" => array("type", "description"),
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
if (! defined('DB_NAME')) exit('No direct script access allowed');
|
||||
|
||||
if ($result = $db->db_query("SELECT * FROM pg_class WHERE relname='idx_tbl_benutzerfunktion_uid'"))
|
||||
{
|
||||
if ($db->db_num_rows($result) == 0)
|
||||
{
|
||||
$qry = "CREATE INDEX idx_tbl_benutzerfunktion_uid ON public.tbl_benutzerfunktion USING btree (uid)";
|
||||
|
||||
if (! $db->db_query($qry))
|
||||
echo '<strong>idx_tbl_benutzerfunktion_uid: ' . $db->db_last_error() . '</strong><br>';
|
||||
else
|
||||
echo 'Index idx_tbl_benutzerfunktion_uid angelegt<br>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
// Add column pid to system.tbl_jobsqueue
|
||||
if (!$result = @$db->db_query('SELECT "pid" FROM "system"."tbl_jobsqueue" LIMIT 1'))
|
||||
{
|
||||
$qry = 'ALTER TABLE "system"."tbl_jobsqueue" ADD "pid" INT NULL DEFAULT NULL;';
|
||||
if (!$db->db_query($qry))
|
||||
echo '<strong>system.tbl_jobsqueue: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>Added column pid to table system.tbl_jobsqueue';
|
||||
}
|
||||
|
||||
// Add column uid to system.tbl_jobsqueue
|
||||
if (!$result = @$db->db_query('SELECT "uid" FROM "system"."tbl_jobsqueue" LIMIT 1'))
|
||||
{
|
||||
$qry = 'ALTER TABLE "system"."tbl_jobsqueue" ADD "uid" VARCHAR(32) NULL DEFAULT NULL;';
|
||||
if (!$db->db_query($qry))
|
||||
echo '<strong>system.tbl_jobsqueue: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>Added column uid to table system.tbl_jobsqueue';
|
||||
}
|
||||
|
||||
// Add column progress to system.tbl_jobsqueue
|
||||
if (!$result = @$db->db_query('SELECT "progress" FROM "system"."tbl_jobsqueue" LIMIT 1'))
|
||||
{
|
||||
$qry = 'ALTER TABLE "system"."tbl_jobsqueue" ADD "progress" NUMERIC(2,1) NULL DEFAULT 0;';
|
||||
if (!$db->db_query($qry))
|
||||
echo '<strong>system.tbl_jobsqueue: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>Added column progress to table system.tbl_jobsqueue';
|
||||
}
|
||||
|
||||
// Add foreign key fk_jobsqueue_benutzer_uid on system.tbl_jobsqueue.uid with public.tbl_benutzer.uid
|
||||
if ($result = $db->db_query("SELECT conname FROM pg_constraint WHERE conname = 'fk_jobsqueue_benutzer_uid'"))
|
||||
{
|
||||
if ($db->db_num_rows($result) == 0)
|
||||
{
|
||||
$qry = 'ALTER TABLE "system"."tbl_jobsqueue" ADD CONSTRAINT "fk_jobsqueue_benutzer_uid" FOREIGN KEY ("uid") REFERENCES "public"."tbl_benutzer" ("uid") ON DELETE RESTRICT ON UPDATE CASCADE;';
|
||||
if (!$db->db_query($qry))
|
||||
echo '<strong>system.tbl_jobsqueue: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>Created foreign key fk_jobsqueue_benutzer_uid';
|
||||
}
|
||||
}
|
||||
|
||||
// Add new webservice type in system.tbl_webservicetyp
|
||||
if ($result = @$db->db_query("SELECT 1 FROM system.tbl_webservicetyp WHERE webservicetyp_kurzbz = 'lrt';"))
|
||||
{
|
||||
if ($db->db_num_rows($result) == 0)
|
||||
{
|
||||
$qry = "INSERT INTO system.tbl_webservicetyp(webservicetyp_kurzbz, beschreibung) VALUES('lrt', 'Long Run Task');";
|
||||
|
||||
if (!$db->db_query($qry))
|
||||
echo '<strong>system.tbl_webservicetyp '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo ' system.tbl_webservicetyp: Added webservice type "lrt"<br>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1638,6 +1638,84 @@ $filters = array(
|
||||
}',
|
||||
'oe_kurzbz' => null,
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'dataset_name' => 'logs',
|
||||
'filter_kurzbz' => 'lrts24hours',
|
||||
'description' => '{Last 24 hours LRTs logs}',
|
||||
'sort' => 2,
|
||||
'default_filter' => false,
|
||||
'filter' => '
|
||||
{
|
||||
"name": "All Long Run Tasks logs from the last 24 hours",
|
||||
"columns": [
|
||||
{"name": "RequestId"},
|
||||
{"name": "ExecutionTime"},
|
||||
{"name": "ExecutedBy"},
|
||||
{"name": "Description"},
|
||||
{"name": "Data"}
|
||||
],
|
||||
"filters": [
|
||||
{
|
||||
"name": "WebserviceType",
|
||||
"operation": "contains",
|
||||
"condition": "job"
|
||||
},
|
||||
{
|
||||
"name": "RequestId",
|
||||
"operation": "contains",
|
||||
"condition": "LRT"
|
||||
},
|
||||
{
|
||||
"name": "ExecutionTime",
|
||||
"operation": "lt",
|
||||
"condition": "24",
|
||||
"option": "hours"
|
||||
}
|
||||
]
|
||||
}
|
||||
',
|
||||
'oe_kurzbz' => null,
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'dataset_name' => 'logs',
|
||||
'filter_kurzbz' => 'lrts48hours',
|
||||
'description' => '{Last 48 hours LRTs logs}',
|
||||
'sort' => 2,
|
||||
'default_filter' => false,
|
||||
'filter' => '
|
||||
{
|
||||
"name": "All Long Run Tasks logs from the last 48 hours",
|
||||
"columns": [
|
||||
{"name": "RequestId"},
|
||||
{"name": "ExecutionTime"},
|
||||
{"name": "ExecutedBy"},
|
||||
{"name": "Description"},
|
||||
{"name": "Data"}
|
||||
],
|
||||
"filters": [
|
||||
{
|
||||
"name": "WebserviceType",
|
||||
"operation": "contains",
|
||||
"condition": "job"
|
||||
},
|
||||
{
|
||||
"name": "RequestId",
|
||||
"operation": "contains",
|
||||
"condition": "LRT"
|
||||
},
|
||||
{
|
||||
"name": "ExecutionTime",
|
||||
"operation": "lt",
|
||||
"condition": "48",
|
||||
"option": "hours"
|
||||
}
|
||||
]
|
||||
}
|
||||
',
|
||||
'oe_kurzbz' => null,
|
||||
),
|
||||
);
|
||||
|
||||
// Loop through the filters array
|
||||
|
||||
Reference in New Issue
Block a user