diff --git a/application/config/navigation.php b/application/config/navigation.php index c70aba57c..0a7c0131f 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -170,6 +170,13 @@ $config['navigation_header'] = array( 'expand' => true, 'sort' => 51, 'requiredPermissions' => 'vertrag/mitarbeiter:r' + ), + 'studierendenverwaltung' => array( + 'link' => site_url('studentenverwaltung'), + 'description' => 'Studierendenverwaltung', + 'expand' => true, + 'sort' => 52, + 'requiredPermissions' => ['admin:r', 'assistenz:r'] ) ) ), @@ -208,7 +215,14 @@ $config['navigation_header'] = array( 'expand' => true, 'sort' => 30, 'requiredPermissions' => 'lehre/anrechnungszeitfenster:rw' - ) + ), + 'dashboardadmin' => array( + 'link' => site_url('dashboard/Admin'), + 'description' => 'Dashboard Admin', + 'expand' => true, + 'sort' => 40, + 'requiredPermissions' => 'dashboard/admin:r' + ) ) ) ) diff --git a/application/controllers/Cis/MyLv.php b/application/controllers/Cis/MyLv.php index 49a938553..819d56b05 100644 --- a/application/controllers/Cis/MyLv.php +++ b/application/controllers/Cis/MyLv.php @@ -33,9 +33,4 @@ class MyLv extends Auth_Controller $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'MyLv']); } - - public function Info($studien_semester,$lvid) - { - $this->load->view('Cis/LvInfo',['lvid'=> $lvid, 'studien_semester' => $studien_semester]); - } } diff --git a/application/controllers/api/frontend/v1/Abgabe.php b/application/controllers/api/frontend/v1/Abgabe.php index af598a345..43dc18d1c 100644 --- a/application/controllers/api/frontend/v1/Abgabe.php +++ b/application/controllers/api/frontend/v1/Abgabe.php @@ -511,10 +511,11 @@ class Abgabe extends FHCAPI_Controller return $projektarbeit->projektarbeit_id; }; $projektarbeiten_ids = array_map($mapFunc, $projektarbeiten->retval); - - $ret = $this->ProjektarbeitModel->getProjektarbeitenAbgabetermine($projektarbeiten_ids); - $projektabgaben = $this->getDataOrTerminateWithError($ret, 'general'); + if(count($projektarbeiten_ids) > 0) { + $ret = $this->ProjektarbeitModel->getProjektarbeitenAbgabetermine($projektarbeiten_ids); + $projektabgaben = $this->getDataOrTerminateWithError($ret, 'general'); + } forEach($projektarbeiten->retval as $pa) { @@ -846,9 +847,10 @@ class Abgabe extends FHCAPI_Controller private function getProjektbetreuerEmailByProjektarbeitID($projektarbeit_id) { $this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel'); $result = $this->ProjektarbeitModel->getProjektbetreuerEmail($projektarbeit_id); - $email = $this->getDataOrTerminateWithError($result, 'general'); - - return $email[0]->uid ? $email[0]->uid.'@'.DOMAIN : $email[0]->private_email; + if(count($result->retval) > 0) { + $email = getData($result); + return $email[0]->uid ? $email[0]->uid.'@'.DOMAIN : $email[0]->private_email; + } else return ''; } diff --git a/application/controllers/api/frontend/v1/Documents.php b/application/controllers/api/frontend/v1/Documents.php index 7b2fc4a15..13c0a2eba 100644 --- a/application/controllers/api/frontend/v1/Documents.php +++ b/application/controllers/api/frontend/v1/Documents.php @@ -208,7 +208,6 @@ class Documents extends FHCAPI_Controller $this->load->model('system/Vorlage_model', 'VorlageModel'); $result = $this->VorlageModel->load($xsl); - $this->addMeta("ress", $result); $vorlage = current($this->getDataOrTerminateWithError($result)); if (!$vorlage) show_404(); @@ -221,7 +220,7 @@ class Documents extends FHCAPI_Controller 'gedruckt' => true, 'insertamum' => date('c'), 'insertvon' => getAuthUID(), - 'uid' => $this->input->post_get('uid') ?: '', + 'uid' => $this->input->post_get('uid') ?: null, 'archiv' => true, 'signiert' => !!$sign_user, 'stud_selfservice' => $vorlage->stud_selfservice @@ -251,6 +250,9 @@ class Documents extends FHCAPI_Controller 'studiensemester_kurzbz' => $ss, 'student_uid' => $akteData['uid'] ]); + + if (!hasData($result)) $this->terminateWithError($this->p->t("stv", "error_noLehrverbandAssigned")); + $res = current($this->getDataOrTerminateWithError($result)); $studiengang_kz = $res->studiengang_kz; @@ -332,6 +334,7 @@ class Documents extends FHCAPI_Controller if ($prestudent_id) { $this->load->model('crm/prestudent_model', 'PrestudentModel'); $this->PrestudentModel->addJoin('public.tbl_studiengang', 'studiengang_kz', 'LEFT'); + $this->PrestudentModel->addSelect('tbl_prestudent.*, UPPER(typ || kurzbz) AS kuerzel'); $result = $this->PrestudentModel->load($prestudent_id); $prestudent = current($this->getDataOrTerminateWithError($result)); diff --git a/application/controllers/api/frontend/v1/dashboard/Board.php b/application/controllers/api/frontend/v1/dashboard/Board.php new file mode 100644 index 000000000..c50fec128 --- /dev/null +++ b/application/controllers/api/frontend/v1/dashboard/Board.php @@ -0,0 +1,121 @@ +. + */ + +if (! defined('BASEPATH')) exit('No direct script access allowed'); + +/** + * This controller operates between (interface) the JS (GUI) and the back-end + * Provides data to the ajax get calls about addresses + * This controller works with JSON calls on the HTTP GET or POST and the output is always JSON + */ +class Board extends FHCAPI_Controller +{ + public function __construct() + { + parent::__construct([ + 'list' => 'dashboard/admin:r', + 'create' => 'dashboard/admin:rw', + 'update' => 'dashboard/admin:rw', + 'delete' => 'dashboard/admin:rw' + ]); + + // Models + $this->load->model('dashboard/Dashboard_model', 'DashboardModel'); + } + + public function list() + { + $result = $this->DashboardModel->load(); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($result); + } + + public function create() + { + $dashboard_kurzbz = $this->input->post('dashboard_kurzbz'); + + $result = $this->DashboardModel->insert([ + 'dashboard_kurzbz' => $dashboard_kurzbz + ]); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function update() + { + $this->load->library('form_validation'); + + $this->form_validation->set_rules('dashboard_id', 'Dashboard ID', 'required'); + + if (!$this->form_validation->run()) + $this->terminateWithValidationErrors($this->form_validation->error_array()); + + $dashboard_id = $this->input->post('dashboard_id'); + $dashboard_kurzbz = $this->input->post('dashboard_kurzbz'); + $beschreibung = $this->input->post('beschreibung'); + + $result = $this->DashboardModel->update([ + 'dashboard_id' => $dashboard_id + ], [ + 'dashboard_kurzbz' => $dashboard_kurzbz, + 'beschreibung' => $beschreibung + ]); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($result); + } + + public function delete() + { + $this->load->library('form_validation'); + + $this->form_validation->set_rules('dashboard_id', 'Dashboard ID', 'required'); + + if (!$this->form_validation->run()) + $this->terminateWithValidationErrors($this->form_validation->error_array()); + + $dashboard_id = $this->input->post('dashboard_id'); + + //delete all presets + $this->load->model('dashboard/Dashboard_Preset_model', 'DashboardPresetModel'); + + $result = $this->DashboardPresetModel->delete([ + 'dashboard_id' => $dashboard_id + ]); + $this->getDataOrTerminateWithError($result); + + //delete all widgets + $this->load->model('dashboard/Dashboard_Widget_model', 'DashboardWidgetModel'); + + $result = $this->DashboardWidgetModel->delete([ + 'dashboard_id' => $dashboard_id + ]); + $this->getDataOrTerminateWithError($result); + + $result = $this->DashboardModel->delete($dashboard_id); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($result); + } +} diff --git a/application/controllers/api/frontend/v1/dashboard/Preset.php b/application/controllers/api/frontend/v1/dashboard/Preset.php new file mode 100644 index 000000000..5983d9660 --- /dev/null +++ b/application/controllers/api/frontend/v1/dashboard/Preset.php @@ -0,0 +1,200 @@ +. + */ + +if (! defined('BASEPATH')) exit('No direct script access allowed'); + +/** + * This controller operates between (interface) the JS (GUI) and the back-end + * Provides data to the ajax get calls about addresses + * This controller works with JSON calls on the HTTP GET or POST and the output is always JSON + */ +class Preset extends FHCAPI_Controller +{ + public function __construct() + { + parent::__construct([ + 'list' => 'dashboard/admin:r', + 'getBatch' => 'dashboard/admin:r', + 'addWidget' => 'dashboard/admin:rw', + 'removeWidget' => 'dashboard/admin:rw' + ]); + + // Load language phrases + $this->loadPhrases([ + 'ui' + ]); + + // Libraries + $this->load->library('dashboard/DashboardLib'); + + // Models + $this->load->model('ressource/Funktion_model', 'FunktionModel'); + } + + public function list($dashboard_kurzbz) + { + $sql = " + WITH + dashboard_presets AS ( + SELECT + * + FROM + dashboard.tbl_dashboard_preset dp + JOIN + dashboard.tbl_dashboard d ON d.dashboard_id = dp.dashboard_id + WHERE + d.dashboard_kurzbz = {$this->db->escape($dashboard_kurzbz)} + ), + general AS ( + SELECT + 'general' AS funktion_kurzbz, + 'Allgemein' AS beschreibung + ) + + ( + SELECT + f.funktion_kurzbz, + f.beschreibung, + COUNT(p.preset_id) AS has_preset + FROM + general f + LEFT JOIN + dashboard_presets p ON p.funktion_kurzbz IS NULL + GROUP BY + f.funktion_kurzbz, f.beschreibung + ) + UNION ALL + ( + SELECT + f.funktion_kurzbz, + f.beschreibung, + COUNT(p.preset_id) AS has_preset + FROM + public.tbl_funktion f + LEFT JOIN + dashboard_presets p ON p.funktion_kurzbz = f.funktion_kurzbz + GROUP BY + f.funktion_kurzbz, f.beschreibung + ORDER BY + f.beschreibung ASC + ) + "; + + $result = $this->FunktionModel->execReadOnlyQuery($sql); + + $funktionen = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($funktionen); + } + + public function getBatch() + { + $this->load->library('form_validation'); + + $this->form_validation->set_rules('db', 'Dashboard', 'required'); + + if (!$this->form_validation->run()) + $this->terminateWithValidationErrors($this->form_validation->error_array()); + + $db = $this->input->post('db'); + $funktionen = $this->input->post('funktionen') ?: []; + + $result = []; + + foreach ($funktionen as $funktion) { + $conf = $this->dashboardlib->getPreset($db, $funktion); + if ($conf) { + $preset = json_decode($conf->preset, true); + if (!isset($preset[$funktion]) || !isset($preset[$funktion]['widgets'])) + $result[$funktion] = []; + else + $result[$funktion] = $preset[$funktion]['widgets']; + } else { + $result[$funktion] = []; + } + } + + return $this->terminateWithSuccess($result); + } + + public function addWidget() + { + $this->load->library('form_validation'); + + $this->form_validation->set_rules('dashboard', 'Dashboard', 'required'); + $this->form_validation->set_rules('funktion_kurzbz', 'Funktion', 'required'); + $this->form_validation->set_rules('widget[widget]', 'Widget', 'required'); + + if (!$this->form_validation->run()) + $this->terminateWithValidationErrors($this->form_validation->error_array()); + + $dashboard_kurzbz = $this->input->post('dashboard'); + $funktion_kurzbz = $this->input->post('funktion_kurzbz'); + $widget = $this->input->post('widget'); + + if (!isset($widget['widgetid'])) + $widget['widgetid'] = $this->dashboardlib->generateWidgetId($dashboard_kurzbz); + + $preset = $this->dashboardlib->getPresetOrCreateEmptyPreset($dashboard_kurzbz, $funktion_kurzbz); + + $preset_decoded = json_decode($preset->preset, true); + + $this->dashboardlib->addWidgetsToWidgets($preset_decoded, $dashboard_kurzbz, $funktion_kurzbz, [$widget]); + + $preset->preset = json_encode($preset_decoded); + + $result = $this->dashboardlib->insertOrUpdatePreset($preset); + + $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($widget['widgetid']); + } + + public function removeWidget() + { + $this->load->library('form_validation'); + + $this->form_validation->set_rules('db', 'Dashboard', 'required'); + $this->form_validation->set_rules('funktion_kurzbz', 'Funktion', 'required'); + $this->form_validation->set_rules('widgetid', 'Widget', 'required'); + + if (!$this->form_validation->run()) + $this->terminateWithValidationErrors($this->form_validation->error_array()); + + $dashboard_kurzbz = $this->input->post('db'); + $funktion_kurzbz = $this->input->post('funktion_kurzbz'); + $widgetid = $this->input->post('widgetid'); + + $preset = $this->dashboardlib->getPreset($dashboard_kurzbz, $funktion_kurzbz); + if (!$preset) + show_404(); + + $preset_decoded = json_decode($preset->preset, true); + + if (!$this->dashboardlib->removeWidgetFromWidgets($preset_decoded, $funktion_kurzbz, $widgetid)) + show_404(); + + $preset->preset = json_encode($preset_decoded); + + $result = $this->dashboardlib->insertOrUpdatePreset($preset); + + $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess(array('msg' => $this->p->t('dashboard', 'success_savePreset'))); + } +} diff --git a/application/controllers/api/frontend/v1/dashboard/User.php b/application/controllers/api/frontend/v1/dashboard/User.php new file mode 100644 index 000000000..9d020649e --- /dev/null +++ b/application/controllers/api/frontend/v1/dashboard/User.php @@ -0,0 +1,159 @@ +. + */ + +if (! defined('BASEPATH')) exit('No direct script access allowed'); + +/** + * This controller operates between (interface) the JS (GUI) and the back-end + * Provides data to the ajax get calls about the users dashboard + * This controller works with JSON calls on the HTTP GET or POST and the output is always JSON + */ +class User extends FHCAPI_Controller +{ + public function __construct() + { + parent::__construct([ + 'get' => 'dashboard/benutzer:r', + 'addWidget' => 'dashboard/benutzer:rw', + 'removeWidget' => 'dashboard/benutzer:rw' + ]); + + // Libraries + $this->load->library('dashboard/DashboardLib'); + + // Models + $this->load->model('ressource/Funktion_model', 'FunktionModel'); + } + + public function get($dashboard_kurzbz) + { + $dashboard = $this->dashboardlib->getDashboardByKurzbz($dashboard_kurzbz); + if (!$dashboard) + show_404(); + + $uid = $this->authlib->getAuthObj()->username; + + /*$mergedconfig = $this->dashboardlib->getMergedConfig($dashboard->dashboard_id, $uid); + + $this->terminateWithSuccess([ + 'general' => call_user_func_array( + 'array_merge_recursive', + $mergedconfig + ) + ]);*/ + $defaultconfig = $this->dashboardlib->getDefaultConfig($dashboard->dashboard_id); + $userconfig = $this->dashboardlib->getUserConfig($dashboard->dashboard_id, $uid); + + $defaultconfig_squashed = $defaultconfig ? call_user_func_array('array_replace_recursive', $defaultconfig) : []; + $userconfig_squashed = $userconfig ? call_user_func_array('array_replace_recursive', $userconfig) : []; + + $mergedconfig = array_replace_recursive($defaultconfig_squashed, $userconfig_squashed); + + $this->terminateWithSuccess([ + DashboardLib::SECTION_IF_FUNKTION_KURZBZ_IS_NULL => $mergedconfig + ]); + } + + public function addWidget() + { + $this->load->library('form_validation'); + + $this->form_validation->set_rules('dashboard', 'Dashboard', 'required'); + $this->form_validation->set_rules('widget[widget]', 'Widget', 'required'); + + if (!$this->form_validation->run()) + $this->terminateWithValidationErrors($this->form_validation->error_array()); + + $widget = $this->input->post('widget'); + $dashboard_kurzbz = $this->input->post('dashboard'); + $uid = $this->authlib->getAuthObj()->username; + + if (!isset($widget['widgetid'])) + $widget['widgetid'] = $this->dashboardlib->generateWidgetId($dashboard_kurzbz); + + $override = $this->dashboardlib->getOverrideOrCreateEmptyOverride($dashboard_kurzbz, $uid); + + $override_decoded = json_decode($override->override, true); + + if (!isset($override_decoded['general']) || !is_array($override_decoded['general'])) + $override_decoded['general'] = []; + + if (!isset($override_decoded['general']['widgets'])) + $override_decoded['general']['widgets'] = []; + + $override_decoded['general']['widgets'][$widget['widgetid']] = $widget; + + // NOTE(chris): remove doubles in other funktionen + foreach ($override_decoded as $funktion => $array) { + if ($funktion == 'general') + continue; + if (isset($array['widgets']) && isset($array['widgets'][$widget['widgetid']])) + unset($override_decoded[$funktion]['widgets'][$widget['widgetid']]); + } + + $override->override = json_encode($override_decoded); + + $result = $this->dashboardlib->insertOrUpdateOverride($override); + + $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($widget['widgetid']); + } + + public function removeWidget() + { + $this->load->library('form_validation'); + + $this->form_validation->set_rules('dashboard', 'Dashboard', 'required'); + $this->form_validation->set_rules('widget', 'Widget', 'required'); + + if (!$this->form_validation->run()) + $this->terminateWithValidationErrors($this->form_validation->error_array()); + + $widget_id = $this->input->post('widget'); + $dashboard_kurzbz = $this->input->post('dashboard'); + $uid = $this->authlib->getAuthObj()->username; + + $override = $this->dashboardlib->getOverride($dashboard_kurzbz, $uid); + if (!$override) + show_404(); + + $override_decoded = json_decode($override->override, true); + + foreach (array_keys($override_decoded) as $k) { + if (!isset($override_decoded[$k]["widgets"])) { + unset($override_decoded[$k]); + continue; + } + if (isset($override_decoded[$k]["widgets"][$widget_id])) { + unset($override_decoded[$k]["widgets"][$widget_id]); + } + if (!$override_decoded[$k]["widgets"]) { + unset($override_decoded[$k]); + } + } + + $override->override = json_encode($override_decoded); + + $result = $this->dashboardlib->insertOrUpdateOverride($override); + + $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess(); + } +} diff --git a/application/controllers/api/frontend/v1/dashboard/Widget.php b/application/controllers/api/frontend/v1/dashboard/Widget.php new file mode 100644 index 000000000..ac8c682e8 --- /dev/null +++ b/application/controllers/api/frontend/v1/dashboard/Widget.php @@ -0,0 +1,137 @@ +. + */ + +if (! defined('BASEPATH')) exit('No direct script access allowed'); + +/** + * This controller operates between (interface) the JS (GUI) and the back-end + * Provides data to the ajax get calls about the users dashboard + * This controller works with JSON calls on the HTTP GET or POST and the output is always JSON + */ +class Widget extends FHCAPI_Controller +{ + public function __construct() + { + parent::__construct([ + 'get' => ['dashboard/benutzer:r', 'dashboard/admin:r'], + 'list' => 'dashboard/admin:r', + 'listAllowed' => ['dashboard/benutzer:rw', 'dashboard/admin:r'], + 'setAllowed' => 'dashboard/admin:rw' + ]); + + // Libraries + $this->load->library('dashboard/DashboardLib'); + + // Models + $this->load->model('dashboard/Widget_model', 'WidgetModel'); + } + + public function get($id) + { + $result = $this->WidgetModel->load($id); + + $widget = $this->getDataOrTerminateWithError($result); + + if (!$widget) + return $this->terminateWithSuccess([ + "widget_id" => 0, + "widget_kurzbz" => "notfound", + "arguments" => [ + "className" => 'alert-danger', + "title" => 'Widget Not Found', + "msg" => 'The widget with the id ' . $id . ' could not be found' + ], + "setup" => [ + "name" => 'Widget Not Found', + "file" => absoluteJsImportUrl('public/js/components/DashboardWidget/Default.js'), + "width" => 1, + "height" => 1 + ] + ]); + + $widget = current($widget); + $widget->arguments = json_decode($widget->arguments); + $tmpsetup = json_decode($widget->setup); + $tmpsetup->file = absoluteJsImportUrl($tmpsetup->file); + $widget->setup = $tmpsetup; + + $this->terminateWithSuccess($widget); + } + + public function list($dashboard) + { + $result = $this->WidgetModel->getWithAllowedForDashboard($dashboard); + + $widgets = $this->getDataOrTerminateWithError($result); + + $widgets = array_map(function ($widget) { + $widget->arguments = json_decode($widget->arguments); + $tmpsetup = json_decode($widget->setup); + $tmpsetup->file = absoluteJsImportUrl($tmpsetup->file); + $widget->setup = $tmpsetup; + return $widget; + }, $widgets); + + $this->terminateWithSuccess($widgets); + } + + public function listAllowed($dashboard) + { + $result = $this->WidgetModel->getForDashboard($dashboard); + + $widgets = $this->getDataOrTerminateWithError($result); + + $widgets = array_map(function ($widget) { + $widget->arguments = json_decode($widget->arguments); + $tmpsetup = json_decode($widget->setup); + $tmpsetup->file = absoluteJsImportUrl($tmpsetup->file); + $widget->setup = $tmpsetup; + return $widget; + }, $widgets); + + $this->terminateWithSuccess($widgets); + } + + public function setAllowed() + { + $this->load->library('form_validation'); + + $this->form_validation->set_rules('dashboard_id', 'Dashboard', 'required'); + $this->form_validation->set_rules('widget_id', 'Widget', 'required'); + $this->form_validation->set_rules('allowed', 'Allowed', 'is_bool'); + + if (!$this->form_validation->run()) + $this->terminateWithValidationErrors($this->form_validation->error_array()); + + $data = [ + 'dashboard_id' => $this->input->post('dashboard_id'), + 'widget_id' => $this->input->post('widget_id') + ]; + + $this->load->model('dashboard/Dashboard_Widget_model', 'DashboardWidgetModel'); + + if ($this->input->post('allowed')) + $result = $this->DashboardWidgetModel->insert($data); + else + $result = $this->DashboardWidgetModel->delete($data); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } +} diff --git a/application/controllers/api/frontend/v1/detailheader/Detailheader.php b/application/controllers/api/frontend/v1/detailheader/Detailheader.php index ada10c5b6..719afb2c6 100644 --- a/application/controllers/api/frontend/v1/detailheader/Detailheader.php +++ b/application/controllers/api/frontend/v1/detailheader/Detailheader.php @@ -9,9 +9,10 @@ class Detailheader extends FHCAPI_Controller public function __construct() { parent::__construct([ - 'getHeader' => ['vertrag/mitarbeiter:r'], - 'getPersonAbteilung' => ['vertrag/mitarbeiter:r'], - 'getLeitungOrg' => ['vertrag/mitarbeiter:r'], + 'getHeader' => self::PERM_LOGGED, + 'getPersonAbteilung' => self::PERM_LOGGED, + 'getLeitungOrg' => self::PERM_LOGGED, + 'getSemesterStati' => self::PERM_LOGGED, ]); } @@ -48,6 +49,17 @@ class Detailheader extends FHCAPI_Controller $this->terminateWithSuccess(current($data)); } + public function getSemesterStati($prestudent_id) + { + $this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel'); + + $result = $this->PrestudentstatusModel->getAllPrestudentstatiWithStudiensemester($prestudent_id); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + } diff --git a/application/controllers/api/frontend/v1/messages/Messages.php b/application/controllers/api/frontend/v1/messages/Messages.php index 3035e532d..77b46f97b 100644 --- a/application/controllers/api/frontend/v1/messages/Messages.php +++ b/application/controllers/api/frontend/v1/messages/Messages.php @@ -42,14 +42,22 @@ class Messages extends FHCAPI_Controller ]); } - public function getMessages($id, $type_id, $size, $page) + public function getMessages($id, $type_id, $size=null, $page=null) { if($type_id != 'person_id'){ $id = $this->_getPersonId($id, $type_id); } - $offset = $size * ($page - 1); - $limit = $size; + if(!(is_null($size) && is_null($page))) + { + $offset = $size * ($page - 1); + $limit = $size; + } + else + { + $offset = null; + $limit = null; + } $result = $this->MessageModel->getMessagesForTable($id, $offset, $limit); diff --git a/application/controllers/api/frontend/v1/notiz/NotizPerson.php b/application/controllers/api/frontend/v1/notiz/NotizPerson.php index 7f0645bc6..a047129d7 100644 --- a/application/controllers/api/frontend/v1/notiz/NotizPerson.php +++ b/application/controllers/api/frontend/v1/notiz/NotizPerson.php @@ -24,6 +24,7 @@ class NotizPerson extends Notiz_Controller //Load Models $this->load->model('person/Benutzer_model', 'BenutzerModel'); $this->load->model('crm/Student_model', 'StudentModel'); + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); //Permission checks for allowed Oes if ($this->router->method == 'addNewNotiz') @@ -38,7 +39,7 @@ class NotizPerson extends Notiz_Controller { return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Person ID']), self::ERROR_TYPE_GENERAL); } - $this->_checkIfBerechtigungForOneUidExists($person_id, $allowedStgs); + $this->_checkIfBerechtigungForOnePrestudentExists($person_id, $allowedStgs); } if ( $this->router->method == 'updateNotiz') @@ -59,7 +60,7 @@ class NotizPerson extends Notiz_Controller $person_id = current($data)->person_id; $allowedStgs = $this->permissionlib->getSTG_isEntitledFor('assistenz') ?: []; - $this->_checkIfBerechtigungForOneUidExists($person_id, $allowedStgs); + $this->_checkIfBerechtigungForOnePrestudentExists($person_id, $allowedStgs); } if ($this->router->method == 'deleteNotiz' ) @@ -78,7 +79,7 @@ class NotizPerson extends Notiz_Controller } $allowedStgs = $this->permissionlib->getSTG_isEntitledFor('assistenz') ?: []; - $this->_checkIfBerechtigungForOneUidExists($person_id, $allowedStgs); + $this->_checkIfBerechtigungForOnePrestudentExists($person_id, $allowedStgs); } } @@ -99,44 +100,20 @@ class NotizPerson extends Notiz_Controller } //stv: if person has permission of one studiengang of person -> permission to add/update/delete Note - private function _checkIfBerechtigungForOneUidExists($person_id, $allowedStgs) + private function _checkIfBerechtigungForOnePrestudentExists($person_id, $allowedStgs) { - //get all studentUids of person_id - $result = $this->BenutzerModel->loadWhere(['person_id' => $person_id]); + $result = $this->PrestudentModel->loadWhere(['person_id' => $person_id]); $data = $this->getDataOrTerminateWithError($result); $checkarray = []; foreach ($data as $item) { - //check if isStudent - $result = $this->StudentModel->isStudent($item->uid); - - $isStudent = $this->getDataOrTerminateWithError($result); - if($isStudent) + if(in_array($item->studiengang_kz, $allowedStgs)) { - $checkarray[] = $this->_checkAllowedStgsFromUid($item->uid, $allowedStgs); + return true; } - } - if (!in_array(1, $checkarray)) - return $this->terminateWithError($this->p->t('ui', 'error_keineBerechtigungStg'), self::ERROR_TYPE_GENERAL); - } - private function _checkAllowedStgsFromUid($student_uid, $allowedStgs) - { - $this->load->model('crm/Student_model', 'StudentModel'); - $result = $this->StudentModel->loadWhere(['student_uid' => $student_uid]); - - $data = $this->getDataOrTerminateWithError($result); - $studiengang_kz = current($data)->studiengang_kz; - - if (!in_array($studiengang_kz, $allowedStgs)) - { - return 0; - } - else - { - return 1; - } + $this->terminateWithError($this->p->t('ui', 'error_keineBerechtigungStg'), self::ERROR_TYPE_GENERAL); } } diff --git a/application/controllers/api/frontend/v1/stv/Abschlusspruefung.php b/application/controllers/api/frontend/v1/stv/Abschlusspruefung.php index def4f6502..f77de7021 100644 --- a/application/controllers/api/frontend/v1/stv/Abschlusspruefung.php +++ b/application/controllers/api/frontend/v1/stv/Abschlusspruefung.php @@ -20,7 +20,6 @@ class Abschlusspruefung extends FHCAPI_Controller 'getBeurteilungen' => ['admin:rw', 'assistenz:rw'], 'getAkadGrade' => ['admin:rw', 'assistenz:rw'], 'getMitarbeiter' => ['admin:rw', 'assistenz:rw'], - 'getPruefer' => ['admin:rw', 'assistenz:rw'], 'getTypStudiengang' => ['admin:rw', 'assistenz:rw'], 'checkForExistingExams' => ['admin:rw', 'assistenz:rw'], ]); @@ -242,21 +241,6 @@ class Abschlusspruefung extends FHCAPI_Controller $this->terminateWithSuccess($result ?: []); } - public function getPruefer() - { - $searchString = $this->input->get('searchString') ?? ''; - - $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel'); - - $result = $this->MitarbeiterModel->searchMitarbeiter($searchString, 'ohneMaUid'); - - if (isError($result)) { - $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); - } - - $this->terminateWithSuccess($result ?: []); - } - public function getNoten() { $this->load->model('education/Note_model', 'NoteModel'); diff --git a/application/controllers/api/frontend/v1/stv/Dokumente.php b/application/controllers/api/frontend/v1/stv/Dokumente.php index 9f54d0aa4..913a57dc4 100644 --- a/application/controllers/api/frontend/v1/stv/Dokumente.php +++ b/application/controllers/api/frontend/v1/stv/Dokumente.php @@ -78,52 +78,32 @@ class Dokumente extends FHCAPI_Controller $this->terminateWithError($this->p->t('ui', 'errorMissingValue', ['value' => 'Studiengang_kz']), self::ERROR_TYPE_GENERAL); $resultPreDoc = $this->_getPrestudentDokumente($prestudent_id); - - $arrayAccepted = []; $person_id = $this->_getPersonId($prestudent_id); - $docNames = array_map(function ($item) { - return $item->dokument_kurzbz; - }, $resultPreDoc); + $mergedArray = []; - foreach($docNames as $doc) + foreach ($resultPreDoc as $pre) { - $result = $this->AkteModel->getAktenFAS($person_id, $doc, $studiengang_kz, $prestudent_id, true); + $result = $this->AkteModel->getAktenFAS($person_id, $pre->dokument_kurzbz, $studiengang_kz, $prestudent_id, true); if (isError($result)) - { return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); - } + if (hasData($result)) { - $data = getData($result); - foreach ($data as $value) + foreach (getData($result) as $doc) { - array_push($arrayAccepted, $value); + $merged = clone $doc; + $merged->docdatum = $pre->docdatum; + $merged->insertvonma = $pre->insertvonma; + $merged->bezeichnung = $pre->bezeichnung; + $mergedArray[] = $merged; } } - } - - //Mapping with document_kurzbz - $preDocMap = []; - foreach ($resultPreDoc as $pre) { - $preDocMap[$pre->dokument_kurzbz] = $pre; - } - - $mergedArray = []; - foreach ($arrayAccepted as $doc) { - $merged = clone $doc; - - if (isset($preDocMap[$doc->dokument_kurzbz])) { - $merged->docdatum = $preDocMap[$doc->dokument_kurzbz]->docdatum; - $merged->insertvonma = $preDocMap[$doc->dokument_kurzbz]->insertvonma; - $merged->bezeichnung = $preDocMap[$doc->dokument_kurzbz]->bezeichnung; - } else { - $merged->akzeptiertdatum = null; - $merged->akzeptiertvon = null; + else + { + $mergedArray[] = $pre; } - - $mergedArray[] = $merged; } $this->terminateWithSuccess($mergedArray); @@ -753,6 +733,10 @@ class Dokumente extends FHCAPI_Controller ); $data = $this->getDataOrTerminateWithError($result); + if(!(is_array($data) && count($data) > 0)) + { + return null; + } $student = current($data); return $student->student_uid; diff --git a/application/controllers/api/frontend/v1/stv/Konto.php b/application/controllers/api/frontend/v1/stv/Konto.php index ecd58671a..d59bc76b0 100644 --- a/application/controllers/api/frontend/v1/stv/Konto.php +++ b/application/controllers/api/frontend/v1/stv/Konto.php @@ -48,7 +48,8 @@ class Konto extends FHCAPI_Controller // Load language phrases $this->loadPhrases([ - 'konto' + 'konto', + 'lehre' ]); } @@ -112,7 +113,7 @@ class Konto extends FHCAPI_Controller * * @return void */ - public function getBuchungstypen() + public function getBuchungstypen($studiensemester_kurzbz = null) { $this->load->model('crm/Buchungstyp_model', 'BuchungstypModel'); @@ -122,6 +123,7 @@ class Konto extends FHCAPI_Controller $data = $this->getDataOrTerminateWithError($result); + $this->_getOEHBeitrag($data, $studiensemester_kurzbz); $this->terminateWithSuccess($data); } @@ -494,4 +496,43 @@ class Konto extends FHCAPI_Controller $this->terminateWithSuccess(); } + + private function _getOEHBeitrag(&$data, $studiensemester_kurzbz = null) + { + if (is_null($studiensemester_kurzbz)) + { + $this->load->library('VariableLib', ['uid' => getAuthUID()]); + $studiensemester_akt = $this->variablelib->getVar('semester_aktuell'); + } + else + { + $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); + if ($this->StudiensemesterModel->isValidStudiensemester($studiensemester_kurzbz)) + $studiensemester_akt = $studiensemester_kurzbz; + else + $this->terminateWithError($this->p->t('lehre', 'error_noStudiensemester')); + } + + $this->load->model('codex/Oehbeitrag_model', 'OehbeitragModel'); + $oehBeitrag = $this->OehbeitragModel->getByStudiensemester($studiensemester_akt); + + $oehStandardbetrag = null; + if (hasData($oehBeitrag)) + { + $oeh = getData($oehBeitrag)[0]; + $summe = ($oeh->studierendenbeitrag + $oeh->versicherung) * -1; + $oehStandardbetrag = number_format((float)$summe, 2, '.', ''); + } + + if ($oehStandardbetrag !== null) + { + $data = array_map(function ($buchungstyp) use ($oehStandardbetrag) { + if (isset($buchungstyp->buchungstyp_kurzbz) && (strtolower($buchungstyp->buchungstyp_kurzbz) === 'oeh')) + { + $buchungstyp->standardbetrag = $oehStandardbetrag; + } + return $buchungstyp; + }, $data); + } + } } diff --git a/application/controllers/api/frontend/v1/stv/Projektarbeit.php b/application/controllers/api/frontend/v1/stv/Projektarbeit.php index 8740ef3d6..1f1035c98 100644 --- a/application/controllers/api/frontend/v1/stv/Projektarbeit.php +++ b/application/controllers/api/frontend/v1/stv/Projektarbeit.php @@ -90,6 +90,15 @@ class Projektarbeit extends FHCAPI_Controller if (!isset($projektarbeit_id) || !is_numeric($projektarbeit_id)) return $this->terminateWithError('Projektarbeit Id missing', self::ERROR_TYPE_GENERAL); + $result = $this->fetchProjektarbeitByID($projektarbeit_id); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess(current($data)); + } + + private function fetchProjektarbeitById($projektarbeit_id) { + $this->ProjektarbeitModel->resetQuery(); $this->ProjektarbeitModel->addSelect( 'lehre.tbl_projektarbeit.projektarbeit_id, titel, titel_english, themenbereich, projekttyp_kurzbz, lehrveranstaltung_id, lehreinheit_id, firma_id, beginn, ende, gesperrtbis, note, final, freigegeben, tbl_projektarbeit.anmerkung, fa.name AS firma_name' @@ -97,13 +106,10 @@ class Projektarbeit extends FHCAPI_Controller $this->ProjektarbeitModel->addJoin('lehre.tbl_lehreinheit le', 'lehreinheit_id'); $this->ProjektarbeitModel->addJoin('lehre.tbl_lehrveranstaltung lv', 'lehrveranstaltung_id'); $this->ProjektarbeitModel->addJoin('public.tbl_firma fa', 'firma_id', 'LEFT'); - $result = $this->ProjektarbeitModel->loadWhere( + return $this->ProjektarbeitModel->loadWhere( array('projektarbeit_id' => $projektarbeit_id) ); - $data = $this->getDataOrTerminateWithError($result); - - $this->terminateWithSuccess(current($data)); } /** @@ -132,7 +138,8 @@ class Projektarbeit extends FHCAPI_Controller ); $data = $this->getDataOrTerminateWithError($result); - + $data = $this->getDataOrTerminateWithError($this->fetchProjektarbeitById($data)); + $this->terminateWithSuccess($data); } diff --git a/application/controllers/api/frontend/v1/stv/Student.php b/application/controllers/api/frontend/v1/stv/Student.php index 7694807e7..4ee37c954 100644 --- a/application/controllers/api/frontend/v1/stv/Student.php +++ b/application/controllers/api/frontend/v1/stv/Student.php @@ -144,6 +144,7 @@ class Student extends FHCAPI_Controller . $this->PrestudentModel->escape($studiensemester_kurzbz) . ") AS statusofsemester" ); + $this->PrestudentModel->addSelect($this->PrestudentModel->escape($studiensemester_kurzbz) . ' as query_studiensemester_kurzbz'); $this->PrestudentModel->addJoin('public.tbl_student s', 'prestudent_id', 'LEFT'); $this->PrestudentModel->addJoin('public.tbl_benutzer b', 'student_uid = uid', 'LEFT'); diff --git a/application/controllers/api/frontend/v1/stv/Students.php b/application/controllers/api/frontend/v1/stv/Students.php index 55f4b8976..ae83fa4ff 100644 --- a/application/controllers/api/frontend/v1/stv/Students.php +++ b/application/controllers/api/frontend/v1/stv/Students.php @@ -468,6 +468,8 @@ class Students extends FHCAPI_Controller $this->PrestudentModel->addSelect("'' AS verband"); $this->PrestudentModel->addSelect("'' AS gruppe"); $this->addSelectPrioRel(); + $query_studiensemester_kurzbz = $studiensemester_kurzbz ? $this->PrestudentModel->escape($studiensemester_kurzbz) : '\'NULL\''; + $this->PrestudentModel->addSelect($query_studiensemester_kurzbz . ' as query_studiensemester_kurzbz'); $this->addFilter($studiensemester_kurzbz); @@ -588,6 +590,7 @@ class Students extends FHCAPI_Controller $this->PrestudentModel->addSelect('v.verband'); $this->PrestudentModel->addSelect('v.gruppe'); $this->PrestudentModel->addSelect("'' AS priorisierung_relativ"); + $this->PrestudentModel->addSelect($this->PrestudentModel->escape($studiensemester_kurzbz) . ' as query_studiensemester_kurzbz'); $where = []; @@ -626,7 +629,7 @@ class Students extends FHCAPI_Controller $this->addFilter($studiensemester_kurzbz); $result = $this->PrestudentModel->loadWhere($where); - + $data = $this->getDataOrTerminateWithError($result); $this->terminateWithSuccess($data); @@ -798,6 +801,7 @@ class Students extends FHCAPI_Controller $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'); + $this->PrestudentModel->addSelect($this->PrestudentModel->escape($studiensemester_kurzbz) . ' as query_studiensemester_kurzbz'); //add status per semester $this->PrestudentModel->addSelect( @@ -851,40 +855,44 @@ class Students extends FHCAPI_Controller $stdsemEsc = $studiensemester_kurzbz ? $this->PrestudentModel->escape($studiensemester_kurzbz) : 'NULL'; $this->load->config('stv'); - $tags = $this->config->item('stv_prestudent_tags'); - $whereTags = ''; - if (is_array($tags) && !isEmptyArray($tags)) { - $tags = array_keys($tags); + if(defined('STV_TAGS_ENABLED') && STV_TAGS_ENABLED) + { + $tags = $this->config->item('stv_prestudent_tags'); - foreach ($tags as $key => $tag) { - $tags[$key] = $this->db->escape($tag); + $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) . ")"; } - $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 + "; } - $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'); @@ -907,11 +915,17 @@ class Students extends FHCAPI_Controller 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->PrestudentModel->addJoin($subQueryTag, 'tag_data_agg.prestudent_id = tbl_prestudent.prestudent_id', '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"); - $this->PrestudentModel->addSelect('tag_data_agg.tags'); + 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'); @@ -943,6 +957,13 @@ class Students extends FHCAPI_Controller $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(" + CASE + WHEN pls.status_kurzbz = 'Interessent' + THEN pls.ausbildungssemester + ELSE s.semester + END AS semester_berechnet + "); $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 diff --git a/application/controllers/dashboard/Admin.php b/application/controllers/dashboard/Admin.php new file mode 100644 index 000000000..702c04bab --- /dev/null +++ b/application/controllers/dashboard/Admin.php @@ -0,0 +1,52 @@ +. + */ + +if (! defined('BASEPATH')) exit('No direct script access allowed'); + +/** + */ +class Admin extends Auth_Controller +{ + /** + * Constructor + */ + public function __construct() + { + // Set required permissions + parent::__construct( + array( + 'index' => 'dashboard/admin:rw', + 'preview' => 'dashboard/admin:r', + ) + ); + } + + // ----------------------------------------------------------------------------------------------------------------- + // Public methods + public function index() + { + $this->load->view('dashboard/admin.php', []); + } + + public function preview($dashboard_kurzbz = 'CIS') + { + $this->load->view('dashboard/preview.php', [ + 'dashboard_kurzbz' => $dashboard_kurzbz + ]); + } +} diff --git a/application/controllers/dashboard/Api.php b/application/controllers/dashboard/Api.php deleted file mode 100644 index 422bf0675..000000000 --- a/application/controllers/dashboard/Api.php +++ /dev/null @@ -1,76 +0,0 @@ - 'dashboard/admin:rw', - 'getNews' => 'dashboard/benutzer:r', - 'getAmpeln' => 'dashboard/benutzer:r', - ) - ); - - $this->load->library('AuthLib', null, 'AuthLib'); - - $this->_setAuthUID(); - } - - public function index() - { - echo 'Dashboard API Controller'; - } - - /** - * Get News. - */ - public function getNews() - { - $limit = $this->input->get('limit'); - - $this->load->model('content/News_model', 'NewsModel'); - - $result = $this->NewsModel->getAll($limit); - - if (hasData($result)) - { - $this->outputJson(getData($result), REST_Controller::HTTP_OK); - } - else - { - $this->terminateWithJsonError('fehler entdeckt'); - } - } - - - /** - * Get Ampeln. - */ - public function getAmpeln() - { - - $this->load->model('content/Ampel_model', 'AmpelModel'); - $result = $this->AmpelModel->getByUser($this->_uid); - - if (hasData($result)) - { - $this->outputJson(getData($result), REST_Controller::HTTP_OK); - } - else - { - $this->terminateWithJsonError('fehler entdeckt'); - } - } - - /** - * Retrieve the UID of the logged user and checks if it is valid - */ - private function _setAuthUID() - { - $this->_uid = getAuthUID(); - - if (!$this->_uid) show_error('User authentification failed'); - } -} diff --git a/application/controllers/dashboard/Config.php b/application/controllers/dashboard/Config.php deleted file mode 100644 index f6db9509f..000000000 --- a/application/controllers/dashboard/Config.php +++ /dev/null @@ -1,216 +0,0 @@ - 'dashboard/benutzer:r', - 'dummy' => 'dashboard/benutzer:r', - 'genWidgetId' => 'dashboard/benutzer:rw', - 'addWidgetsToPreset' => 'dashboard/admin:rw', - 'removeWidgetFromPreset' => 'dashboard/admin:rw', - 'addWidgetsToUserOverride' => 'dashboard/benutzer:rw', - 'removeWidgetFromUserOverride' => 'dashboard/benutzer:rw', - 'funktionen' => 'dashboard/admin:r', - 'preset' => 'dashboard/admin:r', - 'presetBatch' => 'dashboard/admin:r' - ) - ); - - $this->load->library('dashboard/DashboardLib', null, 'DashboardLib'); - $this->load->library('AuthLib', null, 'AuthLib'); - $this->load->model('ressource/Funktion_model', 'FunktionModel'); - } - - public function index() - { - $dashboard_kurzbz = $this->input->get('db'); - $uid = $this->AuthLib->getAuthObj()->username; - - $dashboard = $this->DashboardLib->getDashboardByKurzbz($dashboard_kurzbz); - if(!$dashboard) { - http_response_code(404); - $this->terminateWithJsonError(array( - 'error' => 'Dashboard ' . $dashboard_kurzbz . ' not found.' - )); - } - - $mergedconfig = $this->DashboardLib->getMergedConfig($dashboard->dashboard_id, $uid); - $this->outputJsonSuccess($mergedconfig); - } - - public function genWidgetId() - { - $dashboard_kurzbz = $this->input->get('db'); - $widgetid = $this->DashboardLib->generateWidgetId($dashboard_kurzbz); - $this->outputJsonSuccess(array( - 'widgetid' => $widgetid - )); - } - - public function addWidgetsToPreset() - { - $input = json_decode($this->input->raw_input_stream); - $dashboard_kurzbz = $input->db; - $funktion_kurzbz = $input->funktion_kurzbz; - - $preset = $this->DashboardLib->getPresetOrCreateEmptyPreset($dashboard_kurzbz, $funktion_kurzbz); - - $preset_decoded = json_decode($preset->preset, true); - - $this->DashboardLib->addWidgetsToWidgets($preset_decoded, $dashboard_kurzbz, $funktion_kurzbz, $input->widgets); - - $preset->preset = json_encode($preset_decoded); - - $result = $this->DashboardLib->insertOrUpdatePreset($preset); - if (isError($result)) { - http_response_code(500); - $this->terminateWithJsonError('preset could not be saved'); - } - - $this->outputJsonSuccess(array('msg' => 'preset successfully stored.', 'data' => $preset_decoded)); - } - - public function removeWidgetFromPreset() - { - $input = json_decode($this->input->raw_input_stream); - $dashboard_kurzbz = $input->db; - $funktion_kurzbz = $input->funktion_kurzbz; - $widgetid = $input->widgetid; - - $preset = $this->DashboardLib->getPreset($dashboard_kurzbz, $funktion_kurzbz); - if ($preset === null) { - http_response_code(404); - $this->terminateWithJsonError('preset for dashboard ' . $dashboard_kurzbz . ' and funktion ' . $funktion_kurzbz . ' not found.'); - } - - $preset_decoded = json_decode($preset->preset, true); - if (!$this->DashboardLib->removeWidgetFromWidgets($preset_decoded, $funktion_kurzbz, $widgetid)) - { - http_response_code(404); - $this->terminateWithJsonError('widgetid ' . $widgetid . ' not found'); - } - - $preset->preset = json_encode($preset_decoded); - $result = $this->DashboardLib->insertOrUpdatePreset($preset); - if (isError($result)) - { - http_response_code(500); - $this->terminateWithJsonError('failed to remove widget'); - } - $this->outputJsonSuccess(array('msg' => 'preset successfully updated.')); - } - - public function addWidgetsToUserOverride() - { - $input = json_decode($this->input->raw_input_stream); - $dashboard_kurzbz = $input->db; - $funktion_kurzbz = $input->funktion_kurzbz; - $uid = $this->AuthLib->getAuthObj()->username; - - $override = $this->DashboardLib->getOverrideOrCreateEmptyOverride($dashboard_kurzbz, $uid); - - $override_decoded = json_decode($override->override, true); - - $this->DashboardLib->addWidgetsToWidgets($override_decoded, $dashboard_kurzbz, $funktion_kurzbz, $input->widgets); - - $override->override = json_encode($override_decoded); - - $result = $this->DashboardLib->insertOrUpdateOverride($override); - if (isError($result)) { - http_response_code(500); - $this->terminateWithJsonError('override could not be saved'); - } - - $this->outputJsonSuccess(array('msg' => 'override successfully stored.', 'data' => $override_decoded)); - } - - public function removeWidgetFromUserOverride() - { - $input = json_decode($this->input->raw_input_stream); - $dashboard_kurzbz = $input->db; - $funktion_kurzbz = $input->funktion_kurzbz; - $uid = $this->AuthLib->getAuthObj()->username; - $widgetid = $input->widgetid; - - $override = $this->DashboardLib->getOverride($dashboard_kurzbz, $uid); - if (empty($override)) { - http_response_code(404); - $this->terminateWithJsonError('userconfig for dashboard ' . $dashboard_kurzbz . ' not found.'); - } - - $override_decoded = json_decode($override->override, true); - - if (!$this->DashboardLib->removeWidgetFromWidgets($override_decoded, $funktion_kurzbz, $widgetid)) - { - http_response_code(404); - $this->terminateWithJsonError('widgetid ' . $widgetid . ' not found'); - } - - $override->override = json_encode($override_decoded); - $result = $this->DashboardLib->insertOrUpdateOverride($override, $uid); - if (isError($result)) - { - http_response_code(500); - $this->terminateWithJsonError('failed to remove widget'); - } - $this->outputJsonSuccess(array('msg' => 'override successfully updated.')); - } - - public function funktionen() - { - $funktionen = $this->FunktionModel->load(); - - if (isError($funktionen)) { - http_response_code(404); - $this->terminateWithJsonError([ - 'error' => getError($funktionen) - ]); - } - - return $this->outputJsonSuccess(getData($funktionen) ?: []); - } - - public function preset() - { - $db = $this->input->get('db'); - $funktion = $this->input->get('funktion'); - - $conf = $this->DashboardLib->getPreset($db, $funktion); - - if (!$conf) - return $this->outputJsonSuccess(['widgets' => [$funktion => []]]); - - return $this->outputJsonSuccess(json_decode($conf->preset, true)); - } - - public function presetBatch() - { - $db = $this->input->get('db'); - $funktionen = $this->input->get('funktionen'); - $result = []; - - foreach ($funktionen as $funktion) { - $conf = $this->DashboardLib->getPreset($db, $funktion); - if ($conf) - { - $preset = json_decode($conf->preset, true); - if (!isset($preset[$funktion]) || !isset($preset[$funktion]['widgets'])) - $result[$funktion] = []; - else - $result[$funktion] = $preset[$funktion]['widgets']; - } - else - $result[$funktion] = []; - } - - return $this->outputJsonSuccess($result); - } -} diff --git a/application/controllers/dashboard/Dashboard.php b/application/controllers/dashboard/Dashboard.php deleted file mode 100644 index 3773a6d73..000000000 --- a/application/controllers/dashboard/Dashboard.php +++ /dev/null @@ -1,86 +0,0 @@ - 'dashboard/admin:r', - 'create' => 'dashboard/admin:rw', - 'update' => 'dashboard/admin:rw', - 'delete' => 'dashboard/admin:rw' - ) - ); - - $this->load->library('dashboard/DashboardLib', null, 'DashboardLib'); - $this->load->model('dashboard/Dashboard_model', 'DashboardModel'); - } - - public function index() - { - $result = $this->DashboardModel->load(); - - if (isError($result)) { - http_response_code(404); - $this->terminateWithJsonError([ - 'error' => getError($result) - ]); - } - - return $this->outputJsonSuccess(getData($result) ?: []); - } - - public function create() - { - $input = $this->getPostJSON(); - - $result = $this->DashboardModel->insert($input); - - if (isError($result)) { - http_response_code(404); - $this->terminateWithJsonError([ - 'error' => getError($result) - ]); - } - - return $this->outputJsonSuccess(getData($result) ?: []); - } - - public function update() - { - $input = $this->getPostJSON(); - - $result = $this->DashboardModel->update($input->dashboard_id, $input); - - if (isError($result)) { - http_response_code(404); - $this->terminateWithJsonError([ - 'error' => getError($result) - ]); - } - - return $this->outputJsonSuccess(getData($result) ?: []); - } - - public function delete() - { - $input = $this->getPostJSON(); - - $result = $this->DashboardModel->delete($input->dashboard_id); - - if (isError($result)) { - http_response_code(404); - $this->terminateWithJsonError([ - 'error' => getError($result) - ]); - } - - return $this->outputJsonSuccess(getData($result) ?: []); - } -} diff --git a/application/controllers/dashboard/DashboardDemo.php b/application/controllers/dashboard/DashboardDemo.php deleted file mode 100644 index 35d530384..000000000 --- a/application/controllers/dashboard/DashboardDemo.php +++ /dev/null @@ -1,58 +0,0 @@ - 'dashboard/benutzer:r', - 'admin' => 'dashboard/admin:rw' - ) - ); - - $this->load->library('AuthLib'); - $this->load->library('WidgetLib'); - - $this->_setAuthUID(); // sets property uid - - $this->setControllerId(); // sets the controller id - } - - // ----------------------------------------------------------------------------------------------------------------- - // Public methods - public function index() - { - $this->load->view('dashboard/dashboard_demo.php', []); - } - - // ----------------------------------------------------------------------------------------------------------------- - // Public methods - public function admin() - { - $this->load->view('dashboard/dashboard_demo_admin.php', []); - } - - // ----------------------------------------------------------------------------------------------------------------- - // Private methods - - /** - * Retrieve the UID of the logged user and checks if it is valid - */ - private function _setAuthUID() - { - $this->_uid = getAuthUID(); - - if (!$this->_uid) show_error('User authentification failed'); - } -} diff --git a/application/controllers/dashboard/Widget.php b/application/controllers/dashboard/Widget.php deleted file mode 100644 index 9966ddc12..000000000 --- a/application/controllers/dashboard/Widget.php +++ /dev/null @@ -1,134 +0,0 @@ - ['dashboard/benutzer:r', 'dashboard/admin:r'], - 'getAll' => 'dashboard/admin:r', - 'getWidgetsForDashboard' => ['dashboard/benutzer:rw', 'dashboard/admin:r'], - 'setAllowed' => 'dashboard/admin:rw' - ) - ); - - $this->load->library('dashboard/DashboardLib', null, 'DashboardLib'); - $this->load->model('dashboard/Widget_model', 'WidgetModel'); - $this->load->model('dashboard/Dashboard_Widget_model', 'DashboardWidgetModel'); - } - - public function index() - { - $widget_id = $this->input->get('id'); - - $widget = $this->WidgetModel->load($widget_id); - - if (isError($widget) || !getData($widget)) - return $this->outputJsonSuccess([ - "widget_id" => 0, - "widget_kurzbz" => "notfound", - "arguments" => [ - "className" => 'alert-danger', - "title" => 'Widget Not Found', - "msg" => 'The widget with the id ' . $widget_id . ' could not be found' - ], - "setup" => [ - "name" => 'Widget Not Found', - "file" => absoluteJsImportUrl('public/js/components/DashboardWidget/Default.js'), - "width" => 1, - "height" => 1 - ] - ]); - - $widget = current(getData($widget)); - $widget->arguments = json_decode($widget->arguments); - $tmpsetup = json_decode($widget->setup); - $tmpsetup->file = absoluteJsImportUrl($tmpsetup->file); - $widget->setup = $tmpsetup; - - return $this->outputJsonSuccess($widget); - } - - public function getAll() - { - $dashboard_id = $this->input->get('dashboard_id'); - $result = $this->WidgetModel->getWithAllowedForDashboard($dashboard_id); - - if (isError($result)) - return $this->outputJsonError(getError($result)); - - $tmpwidgets = getData($result) ?: []; - $widgets = array_map(function($widget) { - $widget->arguments = json_decode($widget->arguments); - $tmpsetup = json_decode($widget->setup); - $tmpsetup->file = absoluteJsImportUrl($tmpsetup->file); - $widget->setup = $tmpsetup; - return $widget; - }, $tmpwidgets); - - $this->outputJsonSuccess($widgets); - } - - public function getWidgetsForDashboard() - { - $db = $this->input->get('db'); - $result = $this->WidgetModel->getForDashboard($db); - - if (isError($result)) { - http_response_code(404); - $this->terminateWithJsonError([ - 'error' => getError($result) - ]); - } - - $tmpwidgets = getData($result) ?: []; - $widgets = array_map(function($widget) { - $widget->arguments = json_decode($widget->arguments); - $tmpsetup = json_decode($widget->setup); - $tmpsetup->file = absoluteJsImportUrl($tmpsetup->file); - $widget->setup = $tmpsetup; - return $widget; - }, $tmpwidgets); - - $this->outputJsonSuccess($widgets); - } - - public function setAllowed() - { - $input = $this->getPostJSON(); - - $dashboard_id = $input->dashboard_id; - $widget_id = $input->widget_id; - $action = $input->action; - - if ($action == 'add') { - $result = $this->DashboardWidgetModel->insert([ - 'dashboard_id' => $dashboard_id, - 'widget_id' => $widget_id - ]); - } elseif ($action == 'delete') { - $result = $this->DashboardWidgetModel->delete([ - 'dashboard_id' => $dashboard_id, - 'widget_id' => $widget_id - ]); - } else { - http_response_code(404); // TODO(chris): 400? - $this->terminateWithJsonError([ - 'error' => 'action value invalid' - ]); - } - if (isError($result)) { - http_response_code(404); - $this->terminateWithJsonError([ - 'error' => getError($result) - ]); - } - return $this->outputJsonSuccess(getData($result)); - } -} diff --git a/application/controllers/jobs/AbgabetoolJob.php b/application/controllers/jobs/AbgabetoolJob.php index 9b59a72e7..b81053032 100644 --- a/application/controllers/jobs/AbgabetoolJob.php +++ b/application/controllers/jobs/AbgabetoolJob.php @@ -495,6 +495,10 @@ class AbgabetoolJob extends JOB_Controller // get all new or changed termine in interval $result = $this->_ci->PaabgabeModel->findAbgabenNewOrUpdatedSince($interval, $relevantTypes); $retval = getData($result); + if(!$retval) { + $this->_ci->logInfo("Keine Emails an Betreuer über neue oder veränderte Termine versandt"); + return; + } // group changed/new abgaben for projektarbeiten $projektarbeiten = []; @@ -557,6 +561,8 @@ class AbgabetoolJob extends JOB_Controller $anredeFillString = $data->anrede == "Herr" ? "r" : ""; $fullFormattedNameString = $data->first; + $relevantCounter = 0; // workaround to check if a betreuer needs to have any notification about relevant + // abgaben at all to avoid sending empty emails since we filter on certain conditions forEach($tupelArr as $tupel) { $projektarbeit_id = $tupel[0]; $betreuerRow = $tupel[1]; @@ -575,6 +581,8 @@ class AbgabetoolJob extends JOB_Controller continue; } + $relevantCounter++; + // format the Student Name $s = $relevantAbgaben[0]; $nameParts = []; @@ -633,6 +641,11 @@ class AbgabetoolJob extends JOB_Controller // done with building the change list, now send it $betreuerRow = $tupelArr[0][1]; + if($relevantCounter == 0) { + $this->_ci->logInfo('No Relevant Abgaben to notify Betreuer PersonID: "'.$betreuerRow->person_id.'".'); + continue; + } + $path = $this->_ci->config->item('URL_MITARBEITER'); $url = CIS_ROOT.$path; diff --git a/application/controllers/person/Gradelist.php b/application/controllers/person/Gradelist.php index 230c7f67f..d6df2c43a 100644 --- a/application/controllers/person/Gradelist.php +++ b/application/controllers/person/Gradelist.php @@ -198,7 +198,19 @@ class Gradelist extends Auth_Controller if (!isset($row_noten->found)) { $result_lv = $this->LehrveranstaltungModel->load($row_noten->lehrveranstaltung_id); - $result_stg = $this->StudiengangModel->load($result_lv->retval[0]->studiengang_kz); + + $studiengang_kz = null; + + if (!empty($result_lv->retval) && isset($result_lv->retval[0]) && isset($result_lv->retval[0]->studiengang_kz)) + { + $result_stg = $this->StudiengangModel->load($result_lv->retval[0]->studiengang_kz); + + if (!empty($result_stg->retval) && isset($result_stg->retval[0]) && is_object($result_stg->retval[0]) && isset($result_stg->retval[0]->kurzbzlang)) + { + $studiengang_kz = $result_stg->retval[0]->kurzbzlang; + } + } + $courses['semester'][$row_noten->studiensemester_kurzbz]['lvs_nonstpl'][] = array( 'lehrveranstaltung_id' => $row_noten->lehrveranstaltung_id, 'lehrtyp_kurzbz' => $result_lv->retval[0]->lehrtyp_kurzbz, @@ -212,8 +224,8 @@ class Gradelist extends Auth_Controller 'semester' => $result_lv->retval[0]->semester, 'note' => $row_noten->note, 'datum' => $row_noten->benotungsdatum, - 'zugeordnet' => true, - 'studiengang_kurzbz' => $result_stg->retval[0]->kurzbzlang + 'studiengang_kurzbz' => $studiengang_kz, + 'zugeordnet' => true ); if(!isset($courses['semester'][$row_noten->studiensemester_kurzbz]['data']['ectssumme_nonstpl'])) $courses['semester'][$row_noten->studiensemester_kurzbz]['data']['ectssumme_nonstpl'] = 0; diff --git a/application/core/Notiz_Controller.php b/application/core/Notiz_Controller.php index 923970923..7269c3b09 100644 --- a/application/core/Notiz_Controller.php +++ b/application/core/Notiz_Controller.php @@ -417,6 +417,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller $notiz_id = $this->input->post('notiz_id'); $this->NotizModel->addSelect('campus.tbl_dms_version.*'); + $this->NotizModel->addSelect($this->NotizModel->escape(base_url('content/notizdokdownload.php?id=')) . ' || public.tbl_notiz_dokument.dms_id AS preview'); $this->NotizModel->addJoin('public.tbl_notiz_dokument', 'ON (public.tbl_notiz_dokument.notiz_id = public.tbl_notiz.notiz_id)'); $this->NotizModel->addJoin('campus.tbl_dms_version', 'ON (public.tbl_notiz_dokument.dms_id = campus.tbl_dms_version.dms_id)'); diff --git a/application/helpers/hlp_header_helper.php b/application/helpers/hlp_header_helper.php index 41d40ca0d..27dfba5a1 100644 --- a/application/helpers/hlp_header_helper.php +++ b/application/helpers/hlp_header_helper.php @@ -269,3 +269,199 @@ function absoluteJsImportUrl($relurl) } return $url; } + +/* + * Manipulate CI views includes Array to load + * - public/js/FhcApps.js via customJSs and + * - app customisation js and/or css from extensions via customJSModules + * if customJSModules contains at least one vuejs app and customisation files + * exist in extensions + */ +class ExtendableAppsHelper +{ + private static $instance = null; + + protected $extensions; + + protected $customCSSs; + protected $customJSs; + protected $customJSModules; + + protected $initialised; + protected $appscount; + + protected $extCustomCSSs; + protected $extCustomJSs; + protected $extCustomJSModules; + + private function __construct() + { + $this->extensions = array(); + $this->customCSSs = null; + $this->customJSs = null; + $this->customJSModules = null; + + $this->initialised = false; + $this->appscount = 0; + + $this->extCustomCSSs = null; + $this->extCustomJSs = null; + $this->extCustomJSModules = null; + } + + public static function getInstance() + { + if(self::$instance === null) + { + self::$instance = new ExtendableAppsHelper(); + } + return self::$instance; + } + + public function init($customCSSs, $customJSs, $customJSModules) + { + if($this->initialised) + { + return; + } + + $this->customCSSs = $customCSSs; + $this->customJSs = $customJSs; + $this->customJSModules = $customJSModules; + $this->initialised = true; + + if(!isset($this->customJSModules)) + { + return; + } + + if(!is_array($this->customJSModules)) + { + $this->customJSModules = array($this->customJSModules); + } + + if(count($this->customJSModules) < 1) + { + return; + } + + $this->buildExtensionsList(); + $this->prepareExtendedArrays(); + } + + public function getCustomCSSs() + { + if(is_null($this->extCustomCSSs)) + { + return $this->customCSSs; + } + return $this->extCustomCSSs; + } + + public function getCustomJSs() + { + if(is_null($this->extCustomJSs)) + { + return $this->customJSs; + } + return $this->extCustomJSs; + } + + public function getCustomJSModules() + { + if(is_null($this->extCustomJSModules)) + { + return $this->customJSModules; + } + return $this->extCustomJSModules; + } + + protected function buildExtensionsList() + { + $this->extensions = array(); + $fsiterator = new FilesystemIterator(FHCPATH . 'application/extensions'); + foreach ($fsiterator as $fsitem) + { + if(preg_match('/^FHC-Core-/', $fsitem->getBasename())) + { + $this->extensions[] = $fsitem->getBasename(); + } + } + } + + protected function prepareExtendedArrays() + { + $this->appscount = 0; + $this->initExtCustomCSSs(); + $this->extCustomJSModules = array(); + foreach($this->customJSModules as $item) + { + $matches = array(); + if(preg_match('#^public/(extensions/FHC-Core-.+)?js/apps/(.*)\.js$#', $item, $matches)) + { + $this->appscount++; + + $fhcextension = $matches[1]; + $app = $matches[2]; + + $extend_js_suffix = 'js/extend_app/' . $fhcextension . $app . '.js'; + $extend_css_suffix = 'css/extend_app/' . $fhcextension . $app . '.css'; + + foreach($this->extensions as $extension) + { + $extend_js = 'public/extensions/' . $extension . '/' . $extend_js_suffix; + $extend_css = 'public/extensions/' . $extension . '/' . $extend_css_suffix; + + if(is_readable(FHCPATH . $extend_js)) + { + array_push($this->extCustomJSModules, $extend_js); + } + + if(is_readable(FHCPATH . $extend_css)) + { + array_push($this->extCustomCSSs, $extend_css); + } + } + } + array_push($this->extCustomJSModules, $item); + } + + if($this->appscount > 0) + { + $this->addFhcAppsJs(); + } + } + + protected function initExtCustomCSSs() + { + if(!isset($this->customCSSs)) + { + $this->extCustomCSSs = array(); + } + elseif(!is_array($this->customCSSs)) + { + $this->extCustomCSSs = array($this->customCSSs); + } + else + { + $this->extCustomCSSs = $this->customCSSs; + } + } + + protected function addFhcAppsJs() + { + if(!isset($this->customJSs)) + { + $this->extCustomJSs = array(); + } + elseif(!is_array($this->customJSs)) + { + $this->extCustomJSs = array($this->customJSs); + } + else + { + $this->extCustomJSs = $this->customJSs; + } + array_push($this->extCustomJSs, 'public/js/FhcApps.js'); + } +} diff --git a/application/libraries/AntragLib.php b/application/libraries/AntragLib.php index d90a98241..3d8a2ea26 100644 --- a/application/libraries/AntragLib.php +++ b/application/libraries/AntragLib.php @@ -128,7 +128,7 @@ class AntragLib return $this->_ci->StudierendenantragstatusModel->resumeAntraegeForAbmeldungStgl($antrag_id); } // NOTE(chris): get last status that is not pause - $this->_ci->StudierendenantragstatusModel->addOrder('insertamum'); + $this->_ci->StudierendenantragstatusModel->addOrder('insertamum', 'DESC'); $this->_ci->StudierendenantragstatusModel->addLimit(1); $result = $this->_ci->StudierendenantragstatusModel->loadWhere([ 'studierendenantrag_id' => $antrag_id, diff --git a/application/libraries/DocsboxLib.php b/application/libraries/DocsboxLib.php index f9167c379..184855ad8 100644 --- a/application/libraries/DocsboxLib.php +++ b/application/libraries/DocsboxLib.php @@ -180,7 +180,8 @@ class DocsboxLib } // Just started or still working on it elseif ($getStatusResponse->body->status == self::STATUS_WORKING - || $getStatusResponse->body->status == self::STATUS_STARTED) + || $getStatusResponse->body->status == self::STATUS_STARTED + || $getStatusResponse->body->status == self::STATUS_QUEUED) { // go on! } diff --git a/application/libraries/PermissionLib.php b/application/libraries/PermissionLib.php index 42502f999..d3fdc6642 100644 --- a/application/libraries/PermissionLib.php +++ b/application/libraries/PermissionLib.php @@ -50,6 +50,7 @@ class PermissionLib const LOGINAS_PERSONIDS_BLACKLIST = 'permission_loginas_personids_blacklist'; private $_ci; // CI instance + private $access_rights; // current users access rights private static $bb; // benutzerberechtigung /** @@ -61,6 +62,8 @@ class PermissionLib // Loads CI instance $this->_ci =& get_instance(); + $this->access_rights = null; + $this->_ci->config->load('permission'); // Loads permission configuration // If it's NOT called from command line @@ -69,8 +72,10 @@ class PermissionLib // API Caller rights initialization $authObj = $this->_ci->authlib->getAuthObj(); self::$bb = new benutzerberechtigung(); - if ($authObj) + if ($authObj) { self::$bb->getBerechtigungen($authObj->{AuthLib::AO_USERNAME}); + $this->access_rights = self::$bb->berechtigungen; + } } } @@ -340,6 +345,16 @@ class PermissionLib } } + /** + * Returns the access rights for the current user + * + * @return array|null + */ + public function getAccessRights() + { + return $this->access_rights; + } + //------------------------------------------------------------------------------------------------------------------ // Private methods diff --git a/application/libraries/dashboard/DashboardLib.php b/application/libraries/dashboard/DashboardLib.php index f6d7d6599..1c3983108 100644 --- a/application/libraries/dashboard/DashboardLib.php +++ b/application/libraries/dashboard/DashboardLib.php @@ -49,7 +49,7 @@ class DashboardLib public function getMergedConfig($dashboard_id, $uid) { - $defaultconfig = $this->getDefaultConfig($dashboard_id, $uid); + $defaultconfig = $this->getDefaultConfig($dashboard_id); $userconfig = $this->getUserConfig($dashboard_id, $uid); $mergedconfig = array_replace_recursive($defaultconfig, $userconfig); @@ -57,14 +57,31 @@ class DashboardLib return $mergedconfig; } - public function getDefaultConfig($dashboard_id, $uid) + public function getDefaultConfig($dashboard_id) { - $res_presets = $this->_ci->DashboardPresetModel->getPresets($dashboard_id, $uid); + $funktion_kurzbzs = []; + $rights = $this->_ci->permissionlib->getAccessRights(); + if ($rights) + $funktion_kurzbzs = array_unique(array_map(function ($right) { + return $right->funktion_kurzbz; + }, $rights)); + + $this->_ci->DashboardPresetModel->db + ->group_start() + ->where_in('funktion_kurzbz', $funktion_kurzbzs) + ->or_where('funktion_kurzbz IS NULL') + ->group_end(); + + $this->_ci->DashboardPresetModel->addOrder('funktion_kurzbz', 'DESC'); + + $result = $this->_ci->DashboardPresetModel->loadWhere([ + 'dashboard_id' => $dashboard_id + ]); $defaultconfig = array(); - if (hasData($res_presets)) + if (hasData($result)) { - $presets = getData($res_presets); + $presets = getData($result); foreach ($presets as $presetobj) { $preset = json_decode($presetobj->preset, true); @@ -137,8 +154,10 @@ class DashboardLib $dashboard = $this->getDashboardByKurzbz($dashboard_kurzbz); $funktion_kurzbz = ($section === self::SECTION_IF_FUNKTION_KURZBZ_IS_NULL) ? null : $section; - $result = $this->_ci->DashboardPresetModel - ->getPresetByDashboardAndFunktion($dashboard->dashboard_id, $funktion_kurzbz); + $result = $this->_ci->DashboardPresetModel->loadWhere([ + 'dashboard_id' => $dashboard->dashboard_id, + 'funktion_kurzbz' => $funktion_kurzbz + ]); if (hasData($result)) { @@ -195,11 +214,11 @@ class DashboardLib { foreach ($addwigets as $widget) { - if(!isset($widget->widgetid)) + if(!isset($widget['widgetid'])) { - $widget->widgetid = $this->generateWidgetId($dashboard_kurzbz); + $widget['widgetid'] = $this->generateWidgetId($dashboard_kurzbz); } - $this->addWidgetToWidgets($widgets, $section, $widget, $widget->widgetid); + $this->addWidgetToWidgets($widgets, $section, $widget, $widget['widgetid']); } } diff --git a/application/libraries/vertragsbestandteil/VertragsbestandteilFactory.php b/application/libraries/vertragsbestandteil/VertragsbestandteilFactory.php index 6e7b0af06..50504099a 100644 --- a/application/libraries/vertragsbestandteil/VertragsbestandteilFactory.php +++ b/application/libraries/vertragsbestandteil/VertragsbestandteilFactory.php @@ -3,6 +3,7 @@ namespace vertragsbestandteil; use Exception; use vertragsbestandteil\VertragsbestandteilStunden; +use vertragsbestandteil\VertragsbestandteilLohnguide; /** * Description of VertragsbestandteilFactory @@ -22,6 +23,7 @@ class VertragsbestandteilFactory const VERTRAGSBESTANDTEIL_URLAUBSANSPRUCH = 'urlaubsanspruch'; const VERTRAGSBESTANDTEIL_ZEITAUFZEICHNUNG = 'zeitaufzeichnung'; const VERTRAGSBESTANDTEIL_LEHRE = 'lehre'; + const VERTRAGSBESTANDTEIL_LOHNGUIDE = 'lohnguide'; public static function getVertragsbestandteil($data, $fromdb=false) { @@ -69,6 +71,11 @@ class VertragsbestandteilFactory $vertragsbestandteil = new VertragsbestandteilZeitaufzeichnung(); $vertragsbestandteil->hydrateByStdClass($data, $fromdb); break; + + case self::VERTRAGSBESTANDTEIL_LOHNGUIDE: + $vertragsbestandteil = new VertragsbestandteilLohnguide(); + $vertragsbestandteil->hydrateByStdClass($data, $fromdb); + break; default: throw new Exception('Unknown vertragsbestandteiltyp_kurzbz ' @@ -127,6 +134,12 @@ class VertragsbestandteilFactory $vertragsbestandteildbmodel = $CI->VertragsbestandteilZeitaufzeichnung_model; break; + case self::VERTRAGSBESTANDTEIL_LOHNGUIDE: + $CI->load->model('vertragsbestandteil/VertragsbestandteilLohnguide_model', + 'VertragsbestandteilLohnguide_model'); + $vertragsbestandteildbmodel = $CI->VertragsbestandteilLohnguide_model; + break; + default: throw new Exception('Unknown vertragsbestandteil_kurzbz ' . $vertragsbestandteil_kurzbz); diff --git a/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php b/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php index 1ecb9ac60..61208eda0 100644 --- a/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php +++ b/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php @@ -10,6 +10,7 @@ require_once __DIR__ . '/VertragsbestandteilKuendigungsfrist.php'; require_once __DIR__ . '/VertragsbestandteilUrlaubsanspruch.php'; require_once __DIR__ . '/VertragsbestandteilFreitext.php'; require_once __DIR__ . '/VertragsbestandteilKarenz.php'; +require_once __DIR__ . '/VertragsbestandteilLohnguide.php'; require_once __DIR__ . '/VertragsbestandteilFactory.php'; require_once __DIR__ . '/OverlapChecker.php'; diff --git a/application/libraries/vertragsbestandteil/VertragsbestandteilLohnguide.php b/application/libraries/vertragsbestandteil/VertragsbestandteilLohnguide.php new file mode 100644 index 000000000..0e071f36b --- /dev/null +++ b/application/libraries/vertragsbestandteil/VertragsbestandteilLohnguide.php @@ -0,0 +1,155 @@ +setVertragsbestandteiltyp_kurzbz( + VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_LOHNGUIDE); + } + + public function getStellenbezeichnung() + { + return $this->stellenbezeichnung; + } + + public function setStellenbezeichnung($stellenbezeichnung): self + { + $this->markDirty('stellenbezeichnung', $this->stellenbezeichnung, $stellenbezeichnung); + $this->stellenbezeichnung = $stellenbezeichnung; + return $this; + } + + public function getVordienstzeit() + { + return $this->vordienstzeit; + } + + public function setVordienstzeit($vordienstzeit): self + { + $this->markDirty('vordienstzeit', $this->vordienstzeit, $vordienstzeit); + $this->vordienstzeit = $vordienstzeit; + return $this; + } + + public function getFachrichtung_kurzbz() + { + return $this->fachrichtung_kurzbz; + } + + public function setFachrichtung_kurzbz($fachrichtung_kurzbz): self + { + $this->markDirty('fachrichtung_kurzbz', $this->fachrichtung_kurzbz, $fachrichtung_kurzbz); + $this->fachrichtung_kurzbz = $fachrichtung_kurzbz; + return $this; + } + + public function getModellstelle_kurzbz() + { + return $this->modellstelle_kurzbz; + } + + public function setModellstelle_kurzbz($modellstelle_kurzbz): self + { + $this->markDirty('modellstelle_kurzbz', $this->modellstelle_kurzbz, $modellstelle_kurzbz); + $this->modellstelle_kurzbz = $modellstelle_kurzbz; + return $this; + } + + public function getKommentar_person() + { + return $this->kommentar_person; + } + + public function setKommentar_person($kommentar_person): self + { + $this->markDirty('kommentar_person', $this->kommentar_person, $kommentar_person); + $this->kommentar_person = $kommentar_person; + return $this; + } + + public function getKommentar_modellstelle() + { + return $this->kommentar_modellstelle; + } + + public function setKommentar_modellstelle($kommentar_modellstelle): self + { + $this->markDirty('kommentar_modellstelle', $this->kommentar_modellstelle, $kommentar_modellstelle); + $this->kommentar_modellstelle = $kommentar_modellstelle; + return $this; + } + + + + + public function hydrateByStdClass($data, $fromdb=false) + { + parent::hydrateByStdClass($data, $fromdb); + $this->fromdb = $fromdb; + isset($data->fachrichtung_kurzbz) && $this->setFachrichtung_kurzbz($data->fachrichtung_kurzbz); + isset($data->stellenbezeichnung) && $this->setStellenbezeichnung($data->stellenbezeichnung); + isset($data->vordienstzeit) && $this->setVordienstzeit($data->vordienstzeit); + isset($data->modellstelle_kurzbz) && $this->setModellstelle_kurzbz($data->modellstelle_kurzbz); + isset($data->kommentar_person) && $this->setKommentar_person($data->kommentar_person); + isset($data->kommentar_modellstelle) && $this->setKommentar_modellstelle($data->kommentar_modellstelle); + $this->fromdb = false; + } + + public function toStdClass(): \stdClass + { + $tmp = array( + 'vertragsbestandteil_id' => $this->getVertragsbestandteil_id(), + 'stellenbezeichnung' => $this->getStellenbezeichnung(), + 'vordienstzeit' => $this->getVordienstzeit(), + 'fachrichtung_kurzbz' => $this->getFachrichtung_kurzbz(), + 'modellstelle_kurzbz' => $this->getModellstelle_kurzbz(), + 'kommentar_person' => $this->getKommentar_person(), + 'kommentar_modellstelle' => $this->getKommentar_modellstelle(), + ); + + $tmp = array_filter($tmp, function($k) { + return in_array($k, $this->modifiedcolumns); + }, ARRAY_FILTER_USE_KEY); + + return (object) $tmp; + } + + public function __toString() + { + $txt = <<getModellstelle_kurzbz()} + +EOTXT; + return parent::__toString() . $txt; + } + + /* public function validate() + { + if( !(filter_var($this->tage, FILTER_VALIDATE_INT, + array( + 'options' => array( + 'min_range' => 1, + 'max_range' => 50 + ) + ) + )) ) { + $this->validationerrors[] = 'Urlaubsanspruch muss eine Tagesanzahl im Bereich 1 bis 50 sein.'; + } + + return parent::validate(); + } */ +} diff --git a/application/models/dashboard/Dashboard_Preset_model.php b/application/models/dashboard/Dashboard_Preset_model.php index ca10ce98a..42570d091 100644 --- a/application/models/dashboard/Dashboard_Preset_model.php +++ b/application/models/dashboard/Dashboard_Preset_model.php @@ -11,57 +11,4 @@ class Dashboard_Preset_model extends DB_Model $this->dbTable = 'dashboard.tbl_dashboard_preset'; $this->pk = 'preset_id'; } - - /** - * Get Presets of given uid. - * @param integer dashboard_id - * @param string $uid - * @return array - */ - public function getPresets($dashboard_id, $uid) - { - // TODO: get Funktionen for uid and load all preset for all funktionen for uid - //return $this->loadWhere(array('dashboard_id' => $dashboard_id, 'funktion_kurzbz'=> null)); - $sql = <<execQuery($sql, array($dashboard_id, $uid)); - } - - /** - * Get Preset by Dashboard and Funktion - * @param integer dashboard_id - * @param string funktion_kurzbz - * @return array - */ - public function getPresetByDashboardAndFunktion($dashboard_id, $funktion_kurzbz) - { - return $this->loadWhere(array('dashboard_id' => $dashboard_id, 'funktion_kurzbz' => $funktion_kurzbz)); - } } diff --git a/application/models/education/Lehrveranstaltung_model.php b/application/models/education/Lehrveranstaltung_model.php index ccac33bc7..5422c290e 100644 --- a/application/models/education/Lehrveranstaltung_model.php +++ b/application/models/education/Lehrveranstaltung_model.php @@ -402,14 +402,17 @@ class Lehrveranstaltung_model extends DB_Model SELECT vorname, nachname, mitarbeiter_uid, lehrfunktion_kurzbz FROM - lehre.tbl_lehreinheit + lehre.tbl_lehreinheit le JOIN lehre.tbl_lehreinheitmitarbeiter lema USING (lehreinheit_id) JOIN public.tbl_benutzer b ON b.uid = lema.mitarbeiter_uid JOIN public.tbl_person p using (person_id) WHERE - tbl_lehreinheit.lehrveranstaltung_id= ? - AND tbl_lehreinheit.studiensemester_kurzbz = ? + le.lehrveranstaltung_id= ? + AND le.studiensemester_kurzbz = ? AND lehrfunktion_kurzbz = 'LV-Leitung' + AND lema.mitarbeiter_uid NOT like '_Dummy%' + AND b.aktiv = TRUE + AND p.aktiv = TRUE ORDER BY lema.insertamum DESC LIMIT 1 diff --git a/application/models/education/Paabgabe_model.php b/application/models/education/Paabgabe_model.php index be42b7660..99b9b75f1 100644 --- a/application/models/education/Paabgabe_model.php +++ b/application/models/education/Paabgabe_model.php @@ -79,10 +79,10 @@ class Paabgabe_model extends DB_Model JOIN public.tbl_benutzer ON (public.tbl_benutzer.uid = student_uid) JOIN public.tbl_person USING (person_id) - WHERE (campus.tbl_paabgabe.insertamum >= NOW() - INTERVAL ? - OR campus.tbl_paabgabe.updateamum >= NOW() - INTERVAL ?) - AND campus.tbl_paabgabe.paabgabetyp_kurzbz IN ?"; - + WHERE (campus.tbl_paabgabe.insertamum::date = CURRENT_DATE - INTERVAL ? + OR campus.tbl_paabgabe.updateamum::date = CURRENT_DATE - INTERVAL ?) + AND campus.tbl_paabgabe.paabgabetyp_kurzbz IN ?"; + return $this->execQuery($query, [$interval, $interval, $relevantTypes]); } @@ -108,7 +108,7 @@ class Paabgabe_model extends DB_Model JOIN public.tbl_person ON (public.tbl_benutzer.person_id = public.tbl_person.person_id) WHERE campus.tbl_paabgabe.abgabedatum IS NOT NULL - AND campus.tbl_paabgabe.abgabedatum >= NOW() - INTERVAL ?"; + AND campus.tbl_paabgabe.abgabedatum = CURRENT_DATE - INTERVAL ?"; if($relevantTypes !== null) { $query .= " AND campus.tbl_paabgabe.paabgabetyp_kurzbz IN ?"; diff --git a/application/models/organisation/Studiengang_model.php b/application/models/organisation/Studiengang_model.php index 131e1deb5..1db658596 100644 --- a/application/models/organisation/Studiengang_model.php +++ b/application/models/organisation/Studiengang_model.php @@ -594,7 +594,10 @@ class Studiengang_model extends DB_Model $this->addSelect('p.prestudent_id'); $this->addSelect('pers.vorname'); $this->addSelect('pers.nachname'); - $this->addSelect("CONCAT(UPPER(pers.nachname), ' ', pers.vorname, ' (', " . $this->dbTable . ".bezeichnung, ')') AS name"); + $this->addSelect("CONCAT(UPPER(pers.nachname), ' ', pers.vorname, ' (', " + . $this->dbTable . ".bezeichnung, ', ', " + . "UPPER(" . $this->dbTable . ".typ), " + . "UPPER(" . $this->dbTable . ".kurzbz),')') AS name"); $this->addJoin('public.tbl_prestudent p', 'studiengang_kz'); $this->addJoin( diff --git a/application/models/person/Benutzerfunktion_model.php b/application/models/person/Benutzerfunktion_model.php index 8c43e4f84..dff422b7d 100644 --- a/application/models/person/Benutzerfunktion_model.php +++ b/application/models/person/Benutzerfunktion_model.php @@ -261,6 +261,42 @@ class Benutzerfunktion_model extends DB_Model } + /** + * Get active Kompetenzfeldleitung bei UID. + * + * @param $uid + * @return array|stdClass|null + */ + public function getKFLByUID($uid) + { + $query = ' + SELECT + bf.uid, + bf.oe_kurzbz, + oe.organisationseinheittyp_kurzbz + FROM + public.tbl_benutzerfunktion bf + JOIN public.tbl_organisationseinheit oe USING (oe_kurzbz) + JOIN public.tbl_benutzer b USING (uid) + WHERE + b.uid = ? + AND b.aktiv = TRUE + AND funktion_kurzbz = \'Leitung\' + AND organisationseinheittyp_kurzbz = \'Kompetenzfeld\' + AND (datum_von IS NULL OR datum_von <= now()) + AND (datum_bis IS NULL OR datum_bis >= now()) + '; + + $parameters_array = array(); + if (is_string($uid)) + { + $parameters_array[] = $uid; + } + + return $this->execQuery($query, $parameters_array); + } + + public function insertBenutzerfunktion($Json) { unset($Json['benutzerfunktion_id']); diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 3e59d7250..ba51e514e 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -242,6 +242,7 @@ class Message_model extends DB_Model */ public function getMessagesForTable($person_id, $offset, $limit) { + $limitoffset = (!is_null($offset) && !is_null($limit)) ? 'limit ? offset ?' : ''; $sql = <<execQuery($sql, $parametersArray); @@ -325,7 +327,7 @@ EOSQL; $data = getData($data); if($data) { - $count = ceil($data[0]->total_msgs / $limit); + $count = is_null($limit) ? 1 : ceil($data[0]->total_msgs / $limit); } return success(['data' => $data, 'count' => $count]); diff --git a/application/models/vertragsbestandteil/VertragsbestandteilLohnguide_model.php b/application/models/vertragsbestandteil/VertragsbestandteilLohnguide_model.php new file mode 100644 index 000000000..6f3f8e47a --- /dev/null +++ b/application/models/vertragsbestandteil/VertragsbestandteilLohnguide_model.php @@ -0,0 +1,11 @@ +dbTable = 'hr.tbl_vertragsbestandteil_lohnguide'; + $this->pk = 'vertragsbestandteil_id'; + } +} diff --git a/application/models/vertragsbestandteil/Vertragsbestandteil_model.php b/application/models/vertragsbestandteil/Vertragsbestandteil_model.php index ce741268d..334a29dfd 100644 --- a/application/models/vertragsbestandteil/Vertragsbestandteil_model.php +++ b/application/models/vertragsbestandteil/Vertragsbestandteil_model.php @@ -37,7 +37,8 @@ class Vertragsbestandteil_model extends DB_Model kf.arbeitgeber_frist, kf.arbeitnehmer_frist, s.wochenstunden, s.teilzeittyp_kurzbz, u.tage, - z.zeitaufzeichnung, z.azgrelevant, z.homeoffice + z.zeitaufzeichnung, z.azgrelevant, z.homeoffice, + lg.stellenbezeichnung, lg.vordienstzeit, lg.fachrichtung_kurzbz, lg.modellstelle_kurzbz, lg.kommentar_person, lg.kommentar_modellstelle FROM hr.tbl_vertragsbestandteil v LEFT JOIN @@ -63,6 +64,8 @@ class Vertragsbestandteil_model extends DB_Model hr.tbl_vertragsbestandteil_urlaubsanspruch u USING(vertragsbestandteil_id) LEFT JOIN hr.tbl_vertragsbestandteil_zeitaufzeichnung z USING(vertragsbestandteil_id) + LEFT JOIN + hr.tbl_vertragsbestandteil_lohnguide lg USING(vertragsbestandteil_id) EOSQL; return $sql; } diff --git a/application/views/Cis/LvInfo.php b/application/views/Cis/LvInfo.php deleted file mode 100644 index 49a7b7a85..000000000 --- a/application/views/Cis/LvInfo.php +++ /dev/null @@ -1,15 +0,0 @@ - 'LvInfo', - 'customJSModules' => ['public/js/apps/Cis/LvInfo.js'] -); - -$this->load->view('templates/CISVUE-Header', $includesArray); -?> - -
- - -
- -load->view('templates/CISVUE-Footer', $includesArray); ?> diff --git a/application/views/Cis/Profil.php b/application/views/Cis/Profil.php deleted file mode 100644 index f66ebf8a9..000000000 --- a/application/views/Cis/Profil.php +++ /dev/null @@ -1,18 +0,0 @@ - 'Profil', - 'customJSModules' => ['public/js/apps/Cis/Profil.js'], - 'tabulator5' => true, - 'primevue3' => true, - 'customCSSs' => ['public/css/components/calendar.css', 'public/css/components/FilterComponent.css','public/css/components/Profil.css','public/css/components/FormUnderline.css'], - -); - -$this->load->view('templates/CISVUE-Header', $includesArray); -?> - -
- -
- -load->view('templates/CISVUE-Footer', $includesArray); ?> diff --git a/application/views/dashboard/dashboard_demo.php b/application/views/dashboard/admin.php similarity index 67% rename from application/views/dashboard/dashboard_demo.php rename to application/views/dashboard/admin.php index 8efc230b7..1e338e125 100644 --- a/application/views/dashboard/dashboard_demo.php +++ b/application/views/dashboard/admin.php @@ -8,9 +8,15 @@ $this->load->view( 'axios027' => true, 'restclient' => true, 'vue3' => true, - 'customJSModules' => ['public/js/apps/Dashboard.js'], + 'primevue3' => true, + 'vuedatepicker11' => true, + 'customJSs' => [ + 'vendor/moment/luxonjs/luxon.min.js' + ], + 'customJSModules' => ['public/js/apps/Dashboard/Admin.js'], 'customCSSs' => [ - 'public/css/components/dashboard.css' + 'public/css/components/dashboard.css', + 'public/css/components/primevue.css', ], 'navigationcomponent' => true ) @@ -25,7 +31,7 @@ $this->load->view(

Dashboard

- + diff --git a/application/views/dashboard/dashboard_demo_admin.php b/application/views/dashboard/preview.php similarity index 67% rename from application/views/dashboard/dashboard_demo_admin.php rename to application/views/dashboard/preview.php index 0d92146a8..f8c37c0c8 100644 --- a/application/views/dashboard/dashboard_demo_admin.php +++ b/application/views/dashboard/preview.php @@ -8,7 +8,12 @@ $this->load->view( 'axios027' => true, 'restclient' => true, 'vue3' => true, - 'customJSModules' => ['public/js/apps/DashboardAdmin.js'], + 'vuedatepicker11' => true, + 'primevue3' => true, + 'customJSs' => [ + 'vendor/moment/luxonjs/luxon.min.js' + ], + 'customJSModules' => ['public/js/apps/Dashboard/Preview.js'], 'customCSSs' => [ 'public/css/components/dashboard.css' ], @@ -23,9 +28,9 @@ $this->load->view(
-

Dashboard

+

Dashboard

- +
diff --git a/application/views/templates/FHC-Footer.php b/application/views/templates/FHC-Footer.php index c816ebf2e..d2eb229f1 100644 --- a/application/views/templates/FHC-Footer.php +++ b/application/views/templates/FHC-Footer.php @@ -17,6 +17,7 @@ $use_vuejs_dev_version = $this->config->item('use_vuejs_dev_version'); // By default set the parameters to null + $customCSSs = isset($customCSSs) ? $customCSSs : null; $customJSs = isset($customJSs) ? $customJSs : null; $customJSModules = isset($customJSModules) ? $customJSModules : null; @@ -191,12 +192,13 @@ // NOTE: keep it as the last but one if ($addons === true) generateAddonsJSsInclude($calledPath.'/'.$calledMethod); - - + $extapphelper = ExtendableAppsHelper::getInstance(); + $extapphelper->init($customCSSs, $customJSs, $customJSModules); + // Eventually required JS // NOTE: keep it as the latest - generateJSsInclude($customJSs); - generateJSModulesInclude($customJSModules); + generateJSsInclude($extapphelper->getCustomJSs()); + generateJSModulesInclude($extapphelper->getCustomJSModules()); ?> diff --git a/application/views/templates/FHC-Header.php b/application/views/templates/FHC-Header.php index f7b5491a1..7b53cbf5d 100644 --- a/application/views/templates/FHC-Header.php +++ b/application/views/templates/FHC-Header.php @@ -9,6 +9,8 @@ $title = isset($title) ? $title : null; $refresh = isset($refresh) ? $refresh : null; $customCSSs = isset($customCSSs) ? $customCSSs : null; + $customJSs = isset($customJSs) ? $customJSs : null; + $customJSModules = isset($customJSModules) ? $customJSModules : null; $skipID = isset($skipID) ? $skipID : null; ?> @@ -132,8 +134,11 @@ //Tags if ($tags === true) generateCSSsInclude('public/css/tags.css'); + $extapphelper = ExtendableAppsHelper::getInstance(); + $extapphelper->init($customCSSs, $customJSs, $customJSModules); + // Eventually required CSS - generateCSSsInclude($customCSSs); // Eventually required CSS + generateCSSsInclude($extapphelper->getCustomCSSs()); // Eventually required CSS ?> diff --git a/cis/private/info/service_uebersicht.php b/cis/private/info/service_uebersicht.php index 348a82b0d..ef2516bf7 100644 --- a/cis/private/info/service_uebersicht.php +++ b/cis/private/info/service_uebersicht.php @@ -46,12 +46,13 @@ echo ' - - '; + include('../../../include/meta/jquery.php'); + include('../../../include/meta/jquery-tablesorter.php'); + const MOODLE_ADDON_KURZBZ = 'moodle'; // Load Addons to get Moodle_Path @@ -71,7 +72,7 @@ echo ' $("#myTable").tablesorter( { sortList: [[0,0],[1,0]], - widgets: [\'zebra\'] + widgets: [\'zebra\',\'filter\'] }); } ); @@ -151,8 +152,9 @@ foreach($service->result as $row) $person = new person(); $person->getPersonFromBenutzer($row->operativ_uid); $operativ = $person->nachname.' '.$person->vorname; + $oeBez = new organisationseinheit($row->oe_kurzbz); echo ''; - echo '',$row->oe_kurzbz,''; + echo '',$oeBez->bezeichnung,''; echo ''.$row->bezeichnung.''; echo '',$row->beschreibung,''; echo '',$design,''; diff --git a/cis/private/lehre/notenliste.xls.php b/cis/private/lehre/notenliste.xls.php index 6c8db5246..25f353c12 100644 --- a/cis/private/lehre/notenliste.xls.php +++ b/cis/private/lehre/notenliste.xls.php @@ -264,7 +264,7 @@ else tbl_bisio.bisio_id, tbl_bisio.bis, tbl_bisio.von, tbl_zeugnisnote.note,tbl_mobilitaet.mobilitaetstyp_kurzbz, (CASE WHEN bis.tbl_mobilitaet.studiensemester_kurzbz = vw_student_lehrveranstaltung.studiensemester_kurzbz THEN '1' ELSE '' END) as doubledegree, - tbl_note.lkt_ueberschreibbar, tbl_note.anmerkung + tbl_note.lkt_ueberschreibbar, tbl_note.anmerkung, tbl_zeugnisnote.punkte FROM campus.vw_student_lehrveranstaltung JOIN public.tbl_benutzer USING(uid) JOIN public.tbl_person USING(person_id) JOIN public.tbl_student ON(uid=student_uid) @@ -306,7 +306,14 @@ else && $elem->von < $stsemdatumbis && (anzahlTage($elem->von, $elem->bis) >= 30)) $inc.=' (o)'; - $note = $elem->note; + if(defined('CIS_GESAMTNOTE_PUNKTE') && CIS_GESAMTNOTE_PUNKTE==true) + { + $note = $elem->punkte; + } + else + { + $note = $elem->note; + } if($elem->lkt_ueberschreibbar == 'f') // angerechnet / intern angerechnet / nicht zugelassen { @@ -339,20 +346,23 @@ else { $worksheet->write($lines,8, trim($elem->matrikelnr), $format_highlight); $pr = new Pruefung(); - $pr->getPruefungen($elem->uid, "Termin2", $lvid, $sem); + $pr->getPruefungen($elem->uid, "Termin2", $lvid, $stsem); $output2 = $pr->result; if ($output2) { $resultPr = $output2[0]; $worksheet->write($lines,9, date('d.m.Y', strtotime($resultPr->datum)), $format_highlightright_date); - $worksheet->write($lines,10, $resultPr->note, $format_highlightright); + if(defined('CIS_GESAMTNOTE_PUNKTE') && CIS_GESAMTNOTE_PUNKTE==true) + $worksheet->write($lines,10, $resultPr->punkte, $format_highlightright); + else + $worksheet->write($lines,10, $resultPr->note, $format_highlightright); + } + else + { + $worksheet->write($lines,9, '', $format_highlightright_date); + $worksheet->write($lines,10, '', $format_highlightright); } - else - { - $worksheet->write($lines,9, '', $format_highlightright_date); - $worksheet->write($lines,10, '', $format_highlightright); - } } // Nachprüfung @@ -360,20 +370,23 @@ else { $worksheet->write($lines,12, trim($elem->matrikelnr), $format_highlight); $pr = new Pruefung(); - $pr->getPruefungen($elem->uid, "Termin3", $lvid, $sem); + $pr->getPruefungen($elem->uid, "Termin3", $lvid, $stsem); $output3 = $pr->result; if ($output3) { $resultPr = $output3[0]; $worksheet->write($lines,13, date('d.m.Y', strtotime($resultPr->datum)), $format_highlightright_date); - $worksheet->write($lines,14, $resultPr->note, $format_highlightright); + if(defined('CIS_GESAMTNOTE_PUNKTE') && CIS_GESAMTNOTE_PUNKTE==true) + $worksheet->write($lines,14, $resultPr->punkte, $format_highlightright); + else + $worksheet->write($lines,14, $resultPr->note, $format_highlightright); + } + else + { + $worksheet->write($lines,13, '', $format_highlightright_date); + $worksheet->write($lines,14, '', $format_highlightright); } - else - { - $worksheet->write($lines,13, '', $format_highlightright_date); - $worksheet->write($lines,14, '', $format_highlightright); - } } $i++; diff --git a/cis/testtool/menu.php b/cis/testtool/menu.php index 11e032f0b..494f05567 100644 --- a/cis/testtool/menu.php +++ b/cis/testtool/menu.php @@ -293,7 +293,7 @@ else if (isset($_SESSION['pruefling_id'])) } $lastsemester = $row->semester; - echo ''; + echo '
'; echo ''; } diff --git a/content/mitarbeiter/mitarbeiterfunktionoverlay.xul.php b/content/mitarbeiter/mitarbeiterfunktionoverlay.xul.php index dd685c5da..81eac4d87 100644 --- a/content/mitarbeiter/mitarbeiterfunktionoverlay.xul.php +++ b/content/mitarbeiter/mitarbeiterfunktionoverlay.xul.php @@ -342,6 +342,8 @@ echo '';
'. ($row->semester == '1' ? $p->t('testtool/basisgebiete') : $p->t('testtool/quereinstiegsgebiete')).'
diff --git a/content/mitarbeiter/mitarbeiteroverlay.js.php b/content/mitarbeiter/mitarbeiteroverlay.js.php index 40ed457c3..3391e0013 100644 --- a/content/mitarbeiter/mitarbeiteroverlay.js.php +++ b/content/mitarbeiter/mitarbeiteroverlay.js.php @@ -1708,6 +1708,7 @@ function MitarbeiterEntwicklungsteamSelect() document.getElementById('mitarbeiter-entwicklungsteam-detail-textbox-studiengang').value=studiengang_kz; document.getElementById('mitarbeiter-entwicklungsteam-detail-datum-beginn').value=beginn; document.getElementById('mitarbeiter-entwicklungsteam-detail-datum-ende').value=ende; + document.getElementById('mitarbeiter-entwicklungsteam-detail-entwicklungsteam_id').value=entwicklungsteam_id; MitarbeiterEntwicklungsteamDetailDisableFields(false); } @@ -1725,6 +1726,7 @@ function MitarbeiterEntwicklungsteamSpeichern() studiengang_kz_old = document.getElementById('mitarbeiter-entwicklungsteam-detail-textbox-studiengang').value; beginn = document.getElementById('mitarbeiter-entwicklungsteam-detail-datum-beginn').value; ende = document.getElementById('mitarbeiter-entwicklungsteam-detail-datum-ende').value; + entwicklungsteam_id = document.getElementById('mitarbeiter-entwicklungsteam-detail-entwicklungsteam_id').value; if(studiengang_kz=='') { diff --git a/content/student/studentdetailoverlay.xul.php b/content/student/studentdetailoverlay.xul.php index 36740d209..63e26d011 100644 --- a/content/student/studentdetailoverlay.xul.php +++ b/content/student/studentdetailoverlay.xul.php @@ -798,6 +798,14 @@ echo ''; class="sortDirectionIndicator" sort="rdf:http://www.technikum-wien.at/prestudentrolle/rdf#updatevon" /> +