diff --git a/application/config/cis.php b/application/config/cis.php index b7330ef29..82655f244 100644 --- a/application/config/cis.php +++ b/application/config/cis.php @@ -4,6 +4,6 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); // CMS Content Id for CIS4 Menu Root -$config['cis_menu_root_content_id'] = 11066; +$config['cis_menu_root_content_id'] = 11087; // send Mails for ProfilUpdate $config['cis_send_profil_update_mails'] = true; diff --git a/application/config/routes.php b/application/config/routes.php index b07497ae7..8acf9b5ea 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -61,8 +61,7 @@ $route['api/v1/organisation/[O|o]rganisationseinheit/(:any)'] = 'api/v1/organisa $route['api/v1/ressource/[B|b]etriebsmittelperson/(:any)'] = 'api/v1/ressource/betriebsmittelperson2/$1'; $route['api/v1/system/[S|s]prache/(:any)'] = 'api/v1/system/sprache2/$1'; -$route['CisVue'] = 'CisVue/dashboard'; -$route['Cis/Stundenplan/(:any)'] = 'Cis/Stundenplan'; +$route['Cis/Stundenplan/(:any)?'] = 'Cis/Stundenplan/index/$1'; // load routes from extensions $subdir = 'application/config/extensions'; diff --git a/application/controllers/Cis/InfoTerminal.php b/application/controllers/Cis/InfoTerminal.php new file mode 100644 index 000000000..13dea1367 --- /dev/null +++ b/application/controllers/Cis/InfoTerminal.php @@ -0,0 +1,30 @@ + ['basis/cis:r'], + ]); + } + + // ----------------------------------------------------------------------------------------------------------------- + // Public methods + + /** + * @return void + */ + public function index() + { + $this->load->view('Cis/InfoTerminal.php', []); + } +} diff --git a/application/controllers/Cis/MyLv.php b/application/controllers/Cis/MyLv.php index 08bf843b5..49a938553 100644 --- a/application/controllers/Cis/MyLv.php +++ b/application/controllers/Cis/MyLv.php @@ -26,7 +26,12 @@ class MyLv extends Auth_Controller */ public function index() { - $this->load->view('Cis/MyLv'); + + $viewData = array( + + ); + + $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'MyLv']); } public function Info($studien_semester,$lvid) diff --git a/application/controllers/Cis/Profil.php b/application/controllers/Cis/Profil.php index e991d1976..8c3088bd7 100644 --- a/application/controllers/Cis/Profil.php +++ b/application/controllers/Cis/Profil.php @@ -55,7 +55,10 @@ class Profil extends Auth_Controller */ public function index() { - $this->load->view('Cis/Profil'); + $viewData = array( + + ); + $this->load->view('CisRouterView/CisRouterView.php',['viewData' => $viewData, 'route' => 'profilIndex']); } /** @@ -65,7 +68,9 @@ class Profil extends Auth_Controller */ public function View($uid) { - $this->load->view('Cis/Profil'); + $viewData = array ('uid' => $uid); + + $this->load->view('CisRouterView/CisRouterView.php',['viewData' => $viewData, 'route' => 'profilViewUid']); } /** diff --git a/application/controllers/Cis/Stundenplan.php b/application/controllers/Cis/Stundenplan.php index 3e4e1a070..a9f89f172 100644 --- a/application/controllers/Cis/Stundenplan.php +++ b/application/controllers/Cis/Stundenplan.php @@ -23,8 +23,13 @@ class Stundenplan extends Auth_Controller /** * @return void */ - public function index() + public function index($lv_id = null) { - $this->load->view('Cis/Stundenplan'); + + $viewData = array( + 'lv_id' => $lv_id + ); + + $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'Stundenplan']); } } diff --git a/application/controllers/Cis4.php b/application/controllers/Cis4.php index 9197fd388..c0ca8d503 100644 --- a/application/controllers/Cis4.php +++ b/application/controllers/Cis4.php @@ -36,6 +36,6 @@ class Cis4 extends Auth_Controller 'person_id' => $personData->person_id ); - $this->load->view('CisVue/Dashboard.php',['viewData' => $viewData]); + $this->load->view('CisRouterView/CisRouterView.php',['viewData' => $viewData, 'route' => 'FhcDashboard']); } } \ No newline at end of file diff --git a/application/controllers/CisVue/Cms.php b/application/controllers/CisVue/Cms.php index d1fe5468e..72706d4c3 100644 --- a/application/controllers/CisVue/Cms.php +++ b/application/controllers/CisVue/Cms.php @@ -60,7 +60,14 @@ class Cms extends Auth_Controller $content = current($content); - $this->load->view('CisVue/Cms/Content', ['content_id' => $content_id, 'template_kurzbz' => $content->template_kurzbz, 'version' => $version, 'sprache' => $sprache, 'sichtbar' => $sichtbar]); + $viewData = array( + 'content_id' => $content_id, + 'template_kurzbz' => $content->template_kurzbz, + 'version' => $version, + 'sichtbar' => $sichtbar + ); + + $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'Content']); } /** @@ -76,49 +83,10 @@ class Cms extends Auth_Controller */ public function news($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true) { - $this->load->view('CisVue/Cms/Content', ['infoscreen' => $infoscreen, 'studiengang_kz' => $studiengang_kz, 'semester' => $semester, 'mischen' => $mischen, 'titel' => $titel, 'edit' => $edit, 'sichtbar' => $sichtbar]); - } - - public function getNews($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true) - { - $get_page = intval($this->input->get('page', true)); - $get_page_size = intval($this->input->get('page_size', true)); - if ($get_page) { - $page = $get_page; - } - if ($get_page_size) { - $page_size = $get_page_size; - } else { - $page_size = $this->page_size; - } - $news = $this->cmslib->getNews($infoscreen, $studiengang_kz, $semester, $mischen, $titel, $edit, $sichtbar, $page, $page_size); - - if (isError($news)) { - $this->terminateWithJsonError(getError($news)); - } - $news = hasData($news) ? getData($news) : null; - if ($news) { - echo json_encode($news); - } else { - show_error("News: No data found"); - } - - } - - public function getNewsRowCount($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $fachbereich_kurzbz = null, $maxalter = 0, $edit = false, $sichtbar = true, $page = 1, $page_size = 10) - { - list($studiengang_kz, $semester) = $this->cmslib->getStgAndSem($studiengang_kz, $semester); - $all = $edit; - $num_rows = $this->NewsModel->countNewsWithContent(getSprache(), $studiengang_kz, $semester, $fachbereich_kurzbz, $sichtbar, $maxalter, $page, $this->page_size, $all, $mischen); - if (isError($num_rows)) { - $this->terminateWithJsonError(getError($num_rows)); - } - $num_rows = hasData($num_rows) ? getData($num_rows) : null; - if ($num_rows) { - echo json_encode($num_rows); - } else { - show_error("News number rows: No data found"); - } + // TODO: what are those parameters and what are they used for? + + $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'News']); +// $this->load->view('CisVue/Cms/Content', ['infoscreen' => $infoscreen, 'studiengang_kz' => $studiengang_kz, 'semester' => $semester, 'mischen' => $mischen, 'titel' => $titel, 'edit' => $edit, 'sichtbar' => $sichtbar]); } public function getRoomInformation($ort_kurzbz){ diff --git a/application/controllers/CisVue/Dashboard.php b/application/controllers/CisVue/Dashboard.php index 5cb0d1a9e..ee830cb8b 100644 --- a/application/controllers/CisVue/Dashboard.php +++ b/application/controllers/CisVue/Dashboard.php @@ -29,17 +29,15 @@ class Dashboard extends Auth_Controller { $this->load->model('person/Person_model','PersonModel'); - $begruesung = $this->PersonModel->getFirstName(getAuthUID()); - if(isError($begruesung)) - { - show_error("name couldn't be loaded for username ".getAuthUID()); - } - $begruesung = getData($begruesung); + $personData = getData($this->PersonModel->getByUid(getAuthUID()))[0]; + $viewData = array( - 'name' => $begruesung + 'uid' => getAuthUID(), + 'name' => $personData->vorname, + 'person_id' => $personData->person_id ); - $this->load->view('CisVue/Dashboard.php', ['viewData' => $viewData]); + $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData]); } } \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/Bookmark.php b/application/controllers/api/frontend/v1/Bookmark.php index a811843ce..3e646bb51 100644 --- a/application/controllers/api/frontend/v1/Bookmark.php +++ b/application/controllers/api/frontend/v1/Bookmark.php @@ -30,6 +30,7 @@ class Bookmark extends FHCAPI_Controller 'getBookmarks' => self::PERM_LOGGED, 'delete' => self::PERM_LOGGED, 'insert' => self::PERM_LOGGED, + 'update' => self::PERM_LOGGED, ]); $this->load->model('dashboard/Bookmark_model', 'BookmarkModel'); @@ -50,7 +51,8 @@ class Bookmark extends FHCAPI_Controller */ public function getBookmarks() { - $bookmarks = $this->BookmarkModel->loadWhere(["uid"=>$this->uid]); + $this->BookmarkModel->addOrder("bookmark_id"); + $bookmarks = $this->BookmarkModel->loadWhere(["uid"=>$this->uid]); $bookmarks = $this->getDataOrTerminateWithError($bookmarks); @@ -104,6 +106,33 @@ class Bookmark extends FHCAPI_Controller $this->terminateWithSuccess($insert_into_result); + } + + /** + * updates bookmark in the bookmark table + * @access public + * @return void + */ + public function update($bookmark_id) + { + // form validation + $this->load->library('form_validation'); + $this->form_validation->set_rules('url', 'URL', 'required|valid_url|max_length[511]'); + $this->form_validation->set_rules('title', 'Title', 'required|max_length[255]'); + if($this->form_validation->run() == FALSE) $this->terminateWithValidationErrors($this->form_validation->error_array()); + + $url = $this->input->post('url',true); + $title = $this->input->post('title',true); + + $now = new DateTime(); + $now = $now->format('Y-m-d H:i:s'); + + $update_result = $this->BookmarkModel->update($bookmark_id,['url'=>$url, 'title'=>$title,'updateamum'=>$now]); + + $update_result = $this->getDataOrTerminateWithError($update_result); + + $this->terminateWithSuccess($update_result); + } } diff --git a/application/controllers/api/frontend/v1/Cis4FhcApi.php b/application/controllers/api/frontend/v1/Cis4FhcApi.php new file mode 100644 index 000000000..372e4bfaa --- /dev/null +++ b/application/controllers/api/frontend/v1/Cis4FhcApi.php @@ -0,0 +1,58 @@ +. + */ + +if (! defined('BASEPATH')) exit('No direct script access allowed'); + +class Cis4FhcApi extends FHCAPI_Controller +{ + + /** + * Object initialization + */ + public function __construct() + { + parent::__construct([ + 'getViewData' => self::PERM_LOGGED, + ]); + + } + + //------------------------------------------------------------------------------------------------------------------ + // Public methods + + /** + * fetches ViewData + */ + public function getViewData() + { + $this->load->model('person/Person_model','PersonModel'); + $personData = getData($this->PersonModel->getByUid(getAuthUID()))[0]; + + $viewData = array( + 'uid' => getAuthUID(), + 'name' => $personData->vorname, + 'person_id' => $personData->person_id + ); + + $this->terminateWithSuccess($viewData); + } + + + +} + diff --git a/application/controllers/api/frontend/v1/CisMenu.php b/application/controllers/api/frontend/v1/CisMenu.php new file mode 100644 index 000000000..4f4f2573e --- /dev/null +++ b/application/controllers/api/frontend/v1/CisMenu.php @@ -0,0 +1,58 @@ +. + */ + +if (! defined('BASEPATH')) exit('No direct script access allowed'); + + +class CisMenu extends FHCAPI_Controller +{ + + /** + * Object initialization + */ + public function __construct() + { + parent::__construct([ + 'getMenu' => self::PERM_LOGGED, + ]); + + + + } + + //------------------------------------------------------------------------------------------------------------------ + // Public methods + + /** + * fetches the menu for CIS from the database based on the userLanguage + */ + public function getMenu() + { + $this->load->model('content/Content_model', 'ContentModel'); + $this->load->config('cis'); + $cis4_content_id =$this->config->item('cis_menu_root_content_id'); + $result = $this->ContentModel->getMenu($cis4_content_id, getAuthUID(),getUserLanguage()); + $result = $this->getDataOrTerminateWithError($result); + $menu = $result->childs ?? []; + $this->terminateWithSuccess($menu); + } + + + +} + diff --git a/application/controllers/api/frontend/v1/Cms.php b/application/controllers/api/frontend/v1/Cms.php index e41196f45..b8937a1f4 100644 --- a/application/controllers/api/frontend/v1/Cms.php +++ b/application/controllers/api/frontend/v1/Cms.php @@ -106,7 +106,6 @@ class Cms extends FHCAPI_Controller $this->terminateWithSuccess($content_id); } - //todo: there is the method news and getNews but only one should exist public function news() { @@ -125,25 +124,35 @@ class Cms extends FHCAPI_Controller //get the data or terminate with error $news = $this->getDataOrTerminateWithError($news); - + // array that keeps track of which news don't have a betreff and have to be removed from the news array + $newsToRemove = array(); // collect the content of the news - foreach($news as $news_element){ - $this->addMeta("content_id",$news_element->content_id); + foreach($news as $index=>$news_element){ - //todo: quick fix, for query builder error when fetching content $this->NewsModel->resetQuery(); $content = $this->cmslib->getContent($news_element->content_id); - - $content = getData($content); - - $news_element->content_obj = $content; + if(isError($content)) + { + // removes the news from the news array, so that the response does not include a invalid news + array_push($newsToRemove,$index); + //add the error to the api response? visual feedback + //$this->addError(print_r($content->retval,true)); + continue; + } + $content = getData($content); + $news_element->content_obj = $content; } + + //removes all news that don't have a betreff + foreach($newsToRemove as $removeNewsIndex) + { + unset($news[$removeNewsIndex]); + } + $withContent = function($news) { return $news->content_obj != null; - }; - + }; $newsWithContent = array_filter($news, $withContent); - $this->terminateWithSuccess($newsWithContent); } @@ -176,15 +185,18 @@ class Cms extends FHCAPI_Controller // getting the GET parameters $page = intval($this->input->get('page', true)); $page_size = intval($this->input->get('page_size', true)); + $sprache = $this->input->get('sprache', true); + if(!$sprache) + { + $sprache = getUserLanguage(); + } // default value for the page_size is 10 $page_size = $page_size ?? 10; - $news = $this->cmslib->getNews($infoscreen, $studiengang_kz, $semester, $mischen, $titel, $edit, $sichtbar, $page, $page_size); - + $news = $this->cmslib->getNews($infoscreen, $studiengang_kz, $semester, $mischen, $titel, $edit, $sichtbar, $page, $page_size, $sprache); $news = $this->getDataOrTerminateWithError($news); - $this->addMeta('test', $this->p->t('global', 'studiengangsleitung')); $this->addMeta('phrases', json_decode($this->p->getJson())); $this->terminateWithSuccess($news); diff --git a/application/controllers/api/frontend/v1/Lehre.php b/application/controllers/api/frontend/v1/Lehre.php index c25dc1986..f079a5b37 100644 --- a/application/controllers/api/frontend/v1/Lehre.php +++ b/application/controllers/api/frontend/v1/Lehre.php @@ -30,6 +30,7 @@ class Lehre extends FHCAPI_Controller parent::__construct([ 'lvStudentenMail' => self::PERM_LOGGED, 'LV' => self::PERM_LOGGED, + 'Pruefungen' => self::PERM_LOGGED, ]); @@ -76,6 +77,23 @@ class Lehre extends FHCAPI_Controller $this->terminateWithSuccess($result); } + + /** + * fetches all Pruefungen of a student for a specific lehrveranstaltung + * if the student passed the Pruefung on the first attempt, no information about the Pruefungen is stored in the database + * @param mixed $lehrveranstaltung_id + * @return void + */ + public function Pruefungen($lehrveranstaltung_id) + { + $this->load->model('education/Pruefung_model', 'PruefungModel'); + + $result = $this->PruefungModel->getByStudentAndLv(getAuthUID(), $lehrveranstaltung_id, getUserLanguage()); + + $result = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($result); + } diff --git a/application/controllers/api/frontend/v1/LvMenu.php b/application/controllers/api/frontend/v1/LvMenu.php index 777d49b0c..393c4d5c3 100644 --- a/application/controllers/api/frontend/v1/LvMenu.php +++ b/application/controllers/api/frontend/v1/LvMenu.php @@ -58,6 +58,22 @@ class LvMenu extends FHCAPI_Controller //------------------------------------------------------------------------------------------------------------------ // Public methods + + /** + * alternative function to get multiple lvMenus with a single http request + */ + public function getMultipleLvMenu($lvMenuOptionList){ + $result =[]; + foreach($lvMenuOptionList as $lvMenuOptions){ + $lvMenu = $this->getLvMenu($lvMenuOptions['lvid'],$lvMenuOptions['studiensemester_kurzbz']); + if(isError($lvMenu)){ + // TODO: some lvMenu threw an error, handle error here + } + $result[$lvMenuOptions['lvid']]=$lvMenu; + } + $this->terminateWithSuccess($result); + } + /** * */ @@ -91,20 +107,24 @@ class LvMenu extends FHCAPI_Controller $lvres = $this->Lehrveranstaltung_model->load($lvid); if(!hasData($lvres)) { - $this->terminateWithError('LV ' . $lvid . ' not found.'); + $this->terminateWithError('LV ' . $lvid . ' not found.'); } $lv = (getData($lvres))[0]; - + $this->addMeta('lvInfo',$lv); // define studiengang_kz / semester / lehrverzeichnis $studiengang_kz = $lv->studiengang_kz; $semester = $lv->semester; $short = $lv->lehreverzeichnis; + // return empty menu for studiengang_kz = 0 + if($studiengang_kz == 0){ + $this->terminateWithSuccess("organisatorische_einheit"); + } // load studiengang - $stgres = $this->Studiengang_model->load($lv->studiengang_kz); + $stgres = $this->Studiengang_model->load(strval($studiengang_kz)); if(!hasData($stgres)) { - $this->terminateWithError('Stg ' . $lv->studiengang_kz . ' nof found.'); + $this->terminateWithError('Stg ' . $lv->studiengang_kz . ' not found.'); } $stg = (getData($stgres))[0]; $kurzbz = strtoupper($stg->typ . $stg->kurzbz); @@ -284,24 +304,6 @@ class LvMenu extends FHCAPI_Controller } - - private function fhc_menu_digitale_anwesenheiten(&$menu, $angemeldet, $studiengang_kz, $semester, $lvid, $angezeigtes_stsem){ - - // DIGITALE ANWESENHEITEN - if (defined('CIS_LEHRVERANSTALTUNG_ANWESENHEIT_ANZEIGEN') && CIS_LEHRVERANSTALTUNG_ANWESENHEIT_ANZEIGEN && $angemeldet) { - - $menu[] = array - ( - 'id' => 'core_menu_digitale_anwesenheitslisten', - 'position' => '50', - 'name' => $this->p->t('lehre', 'digiAnw'), - 'c4_icon' => base_url('skin/images/button_kreuzerltool.png'), - 'c4_link' => base_url("index.ci.php/extensions/FHC-Core-Anwesenheiten/?stg_kz=$studiengang_kz&sem=$semester&lvid=$lvid&sem_kurzbz=$angezeigtes_stsem&nav=false"), - 'c4_linkList' => [] - ); - } - } - private function fhc_menu_lvinfo(&$menu, $lvid, $studiengang_kz, $lektor_der_lv, $is_lector, $lehrfach_oe_kurzbz_arr){ // LVINFO diff --git a/application/controllers/api/frontend/v1/Phrasen.php b/application/controllers/api/frontend/v1/Phrasen.php index 3509e6630..7cc652c71 100644 --- a/application/controllers/api/frontend/v1/Phrasen.php +++ b/application/controllers/api/frontend/v1/Phrasen.php @@ -73,11 +73,22 @@ class Phrasen extends FHCAPI_Controller // gets all languages that are set as active in the database public function getAllLanguages() { - $langs = getDBActiveLanguages(); + $this->load->model('system/Sprache_model', 'SprachenModel'); + + // Add order clause by index and select the sprache,bezeichnung and index column + $this->SprachenModel->addOrder('index'); + $this->SprachenModel->addSelect('sprache, bezeichnung, index'); + + // Retrieves from public.tbl_sprache + $langs = $this->SprachenModel->loadWhere(array('content' => true)); $langs = $this->getDataOrTerminateWithError($langs); $langs = array_map(function($lang){ - return $lang->sprache; + $data = new stdClass(); + $data->sprache = $lang->sprache; + $data->bezeichnung = $lang->bezeichnung[($lang->index-1)]; + return $data; }, $langs); + $this->terminateWithSuccess($langs); } diff --git a/application/controllers/api/frontend/v1/Studgang.php b/application/controllers/api/frontend/v1/Studgang.php new file mode 100644 index 000000000..0e4eb3205 --- /dev/null +++ b/application/controllers/api/frontend/v1/Studgang.php @@ -0,0 +1,58 @@ +. + */ + +if (! defined('BASEPATH')) exit('No direct script access allowed'); +class Studgang extends FHCAPI_Controller +{ + + /** + * Object initialization + */ + public function __construct() + { + parent::__construct([ + 'getStudiengangInfo'=> self::PERM_LOGGED, + + ]); + + $this->load->model('organisation/Studiengang_model', 'StudiengangModel'); + + // Loads phrases system + $this->loadPhrases([ + 'global' + ]); + + } + + //------------------------------------------------------------------------------------------------------------------ + // Public methods + + public function getStudiengangInfo(){ + // fetches the Studiengang Information which is used next the the news + $studiengangInfo = $this->StudiengangModel->getStudiengangInfoForNews(); + $studiengangInfo= $this->getDataOrTerminateWithError($studiengangInfo); + $this->terminateWithSuccess($studiengangInfo); + } + + //------------------------------------------------------------------------------------------------------------------ + // Private methods + + + +} + diff --git a/application/controllers/api/frontend/v1/Stundenplan.php b/application/controllers/api/frontend/v1/Stundenplan.php index c14ea4315..a087f32a0 100644 --- a/application/controllers/api/frontend/v1/Stundenplan.php +++ b/application/controllers/api/frontend/v1/Stundenplan.php @@ -126,24 +126,33 @@ class Stundenplan extends FHCAPI_Controller // storing the get parameter in local variables $start_date = $this->input->get('start_date', TRUE); $end_date = $this->input->get('end_date', TRUE); + $lv_id = $this->input->get('lv_id', TRUE); $student_uid = getAuthUID(); if(is_null($student_uid)) { $this->terminateWithError("No UID"); } + + $semester_range = $this->studienSemesterErmitteln($start_date,$end_date); + $this->sortStudienSemester($semester_range); + $this->applyLoadUeberSemesterHaelfte($semester_range); + + if($lv_id) { // fetch Stundenplan for lva, irrelevant of who is requesting it (for now) + $stundenplan_data = $this->StundenplanModel->getStundenplanLVA($start_date, $end_date, $lv_id); + $stundenplan_data = $this->getDataOrTerminateWithError($stundenplan_data) ?? []; + $this->expand_object_information($stundenplan_data); + $this->terminateWithSuccess($stundenplan_data); + + } + $is_mitarbeiter = getData($this->MitarbeiterModel->isMitarbeiter($student_uid)); if($is_mitarbeiter) { $this->terminateWithError("Not possible to look at the Student Calendar as a Mitarbeiter"); } - $semester_range = $this->studienSemesterErmitteln($start_date,$end_date); - - $this->sortStudienSemester($semester_range); - - $this->applyLoadUeberSemesterHaelfte($semester_range); // getting the gruppen_kurzbz of the student in the different studiensemester $benutzer_gruppen = $this->fetchBenutzerGruppenFromStudiensemester($semester_range); diff --git a/application/helpers/hlp_header_helper.php b/application/helpers/hlp_header_helper.php index ea1795ad5..14f7ed338 100644 --- a/application/helpers/hlp_header_helper.php +++ b/application/helpers/hlp_header_helper.php @@ -87,18 +87,28 @@ function generateCSSsInclude($CSSs) */ function generateJSDataStorageObject($indexPage, $calledPath, $calledMethod) { + $ci =& get_instance(); + $ci->load->model('system/Sprache_model','SpracheModel'); + $server_language = getData($ci->SpracheModel->loadWhere(['content' => true])); + $server_language = array_map(function($language){ + return ['sprache'=>$language->sprache, 'LC_Time'=>$language->locale, 'bezeichnung'=>$language->bezeichnung[$language->index-1]]; + }, $server_language); $user_language = getUserLanguage(); + $FHC_JS_DATA_STORAGE_OBJECT = array( + 'app_root' => APP_ROOT, + 'ci_router' => $indexPage, + 'called_path' => $calledPath, + 'called_method' => $calledMethod, + 'server_languages' => $server_language, + 'user_language' => $user_language, + 'timezone' => date_default_timezone_get(), + ); + $toPrint = "\n"; $toPrint .= ''; $toPrint .= "\n\n"; diff --git a/application/libraries/CmsLib.php b/application/libraries/CmsLib.php index b65e2a71c..355cf7c56 100644 --- a/application/libraries/CmsLib.php +++ b/application/libraries/CmsLib.php @@ -43,7 +43,7 @@ class CmsLib * @param string $sprache * @param boolean $sichtbar * - * @return void + * @return stdClass */ public function getContent($content_id, $version = null, $sprache = null, $sichtbar = true) { @@ -105,7 +105,19 @@ class CmsLib if($content->titel){ $betreff = $content->titel; }else{ + //DomDocument getElementsByTagName returns a DomNodeList $betreff = $XML->getElementsByTagName('betreff'); + //check if any betreff was found and if it is not empty + if($betreff->length > 0 && !empty($betreff->item(0)->nodeValue)) + { + //DomNodeList item() return a DomNode, property nodeValue contains the value of the node + $betreff = $betreff->item(0)->nodeValue; + + } + else + { + return error('no betreff found for the content'); + } } $xsltemplate = new DOMDocument(); @@ -221,7 +233,7 @@ class CmsLib * * @return void */ - public function getNews($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true, $page = 1, $page_size = 10) + public function getNews($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true, $page = 1, $page_size = 10, $sprache) { $this->ci->load->model('organisation/Studiengang_model', 'StudiengangModel'); list($studiengang_kz, $semester) = $this->getStgAndSem($studiengang_kz, $semester); @@ -230,13 +242,13 @@ class CmsLib $xml = ''; $this->ci->load->model('content/News_model', 'NewsModel'); - $news = $this->ci->NewsModel->getNewsWithContent(getSprache(), $studiengang_kz, $semester, null, $sichtbar, 0, $page, $page_size, $all, $mischen); + $news = $this->ci->NewsModel->getNewsWithContent($sprache, $studiengang_kz, $semester, null, $sichtbar, 0, $page, $page_size, $all, $mischen); if (isError($news)) return $news; $news = getData($news); - //var_dump($news->maxPageCount); + foreach ($news as $newsobj) { if ($studiengang_kz && $edit && !$newsobj->studiengang_kz) continue; @@ -247,7 +259,7 @@ class CmsLib $xml .= "" . $newsobj->content . $datum . $id . ""; } - if ($studiengang_kz != 0) { + /* if ($studiengang_kz != 0) { $stg_obj = $this->ci->StudiengangModel->load($studiengang_kz); if (isError($stg_obj)) return $stg_obj; @@ -262,7 +274,7 @@ class CmsLib } $xml .= 'bezeichnung . ']]>'; } - } + } */ if ($titel != '') { $xml .= '' . $titel . ''; diff --git a/application/models/content/News_model.php b/application/models/content/News_model.php index 0700a7057..ad8ecab99 100644 --- a/application/models/content/News_model.php +++ b/application/models/content/News_model.php @@ -21,7 +21,7 @@ class News_model extends DB_Model { $this->addJoin("campus.tbl_content","content_id"); return $this->execReadOnlyQuery(' - SELECT * + SELECT *, TO_CHAR(campus.tbl_news.datum, ?) as datumformatted FROM campus.tbl_news JOIN campus.tbl_content content ON content.content_id = campus.tbl_news.content_id WHERE @@ -29,7 +29,7 @@ class News_model extends DB_Model datum <= NOW() AND (datum_bis IS NULL OR datum_bis >= now()::date) ORDER BY datum DESC LIMIT ' . $this->escape($limit) - ); + , ['DD/MM/YYYY']); } public function getNewsContentIDs($limit=10){ diff --git a/application/models/education/Lehrveranstaltung_model.php b/application/models/education/Lehrveranstaltung_model.php index 9fe9f2a54..e61101b14 100644 --- a/application/models/education/Lehrveranstaltung_model.php +++ b/application/models/education/Lehrveranstaltung_model.php @@ -609,7 +609,11 @@ class Lehrveranstaltung_model extends DB_Model $this->addSelect($lvbezeichnung . ' AS bezeichnung'); $this->addSelect($sgbezeichnung . ' AS sg_bezeichnung'); $this->addSelect('UPPER(sg.typ::VARCHAR(1) || sg.kurzbz) AS studiengang_kuerzel'); - + + //also adds returns the index of the grade + //TODO: ist zeugnissnote immer gleich wie die lvgesamtnote + $this->addSelect('COALESCE(zn.note::numeric,gn.note::numeric) as note_index'); + $this->addSelect('COALESCE(znn.positiv,gnn.positiv) as positiv'); $this->addSelect('COALESCE(gnn.' . $bezeichnung . ', gnn.bezeichnung, gn.note::text) AS lvnote'); $this->addSelect('COALESCE(znn.' . $bezeichnung . ', znn.bezeichnung, zn.note::text) AS znote'); diff --git a/application/models/organisation/Studiengang_model.php b/application/models/organisation/Studiengang_model.php index e306ce950..066210e0b 100644 --- a/application/models/organisation/Studiengang_model.php +++ b/application/models/organisation/Studiengang_model.php @@ -647,4 +647,139 @@ class Studiengang_model extends DB_Model return $this->load(); } + + /** + * @return stdClass + */ + public function getStudiengangInfoForNews() + { + + $this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel'); + $this->load->model('person/Person_model', 'PersonModel'); + + $addEmailProperty= function(&$benutzerfunktionen){ + if(count($benutzerfunktionen) && defined('DOMAIN')) + { + $benutzerfunktionen = array_map(function($benutzer) + { + $benutzer->email = $benutzer->alias."@".DOMAIN; + return $benutzer; + },$benutzerfunktionen) ; + } + + }; + $addFotoProperty= function(&$collection){ + $collection = array_map(function($item){ + $person_id = $this->PersonModel->getByUid($item->uid); + if(isError($person_id)) + return error($person_id); + $person_id = current(getData($person_id))->person_id; + $this->PersonModel->addSelect('foto'); + $foto = $this->PersonModel->loadWhere(array('person_id'=>$person_id)); + if(isError($foto)) + return error($foto); + $foto = current(getData($foto))->foto; + $item->foto = $foto; + return $item; + },$collection); + }; + + + $this->load->model('crm/Student_model', 'StudentModel'); + + $student = $this->StudentModel->loadWhere(['student_uid' => getAuthUID()]); + if (isError($student)) + return error($student); + if (getData($student)) { + //TODO: if a mitarbeiter requests this site, empty data should be returned + if(count($student) == 0) + { + return new stdClass(); + } + $student = current(getData($student)); + $studiengang_kz = $student->studiengang_kz; + $semester = $student->semester; + } + + $stg_obj = $this->load($studiengang_kz); + if(isError($stg_obj)) + return error($stg_obj); + if(getData($stg_obj)) + { + $stg_obj = current(getData($stg_obj)); + } + + $stg_ltg = $this->getLeitungDetailed($stg_obj->studiengang_kz); + if (isError($stg_ltg)) + return $stg_ltg; + $stg_ltg = getData($stg_ltg) ?: []; + $addFotoProperty($stg_ltg); + + $gf_ltg = $this->BenutzerfunktionModel->getBenutzerFunktionenDetailed('gLtg', $stg_obj->oe_kurzbz); + if (isError($gf_ltg)) + return $gf_ltg; + $gf_ltg = getData($gf_ltg) ?: []; + $addEmailProperty($gf_ltg); + + $stv_ltg = $this->BenutzerfunktionModel->getBenutzerFunktionenDetailed('stvLtg', $stg_obj->oe_kurzbz); + if (isError($stv_ltg)) + return $stv_ltg; + $stv_ltg = getData($stv_ltg) ?: []; + $addEmailProperty($stv_ltg); + + $ass = $this->BenutzerfunktionModel->getBenutzerFunktionenDetailed('ass', $stg_obj->oe_kurzbz); + if (isError($ass)) + return $ass; + $ass = getData($ass) ?: []; + $addEmailProperty($ass); + $addFotoProperty($ass); + + $hochschulvertr = $this->BenutzerfunktionModel->getBenutzerFunktionenDetailed('hsv'); + if (isError($hochschulvertr)) + return $hochschulvertr; + $hochschulvertr = getData($hochschulvertr) ?: []; + $addEmailProperty($hochschulvertr); + + + $stdv = $this->BenutzerfunktionModel->getBenutzerFunktionenDetailed('stdv', $stg_obj->oe_kurzbz); + if (isError($stdv)) + return $stdv; + $stdv = getData($stdv) ?: []; + $addEmailProperty($stdv); + + + $jahrgangsvertr = $this->BenutzerfunktionModel->getBenutzerFunktionenDetailed('jgv', $stg_obj->oe_kurzbz, $semester); + if (isError($jahrgangsvertr)) + return $jahrgangsvertr; + $jahrgangsvertr = getData($jahrgangsvertr) ?: []; + $addEmailProperty($jahrgangsvertr); + + + $result_object = new stdClass(); + $result_object->studiengang = $stg_obj; + $result_object->semester = $semester; + $result_object->stg_ltg = $stg_ltg; + $result_object->gf_ltg = $gf_ltg; + $result_object->stv_ltg = $stv_ltg; + $result_object->ass = $ass; + $result_object->hochschulvertr = $hochschulvertr; + $result_object->stdv = $stdv; + $result_object->jahrgangsvertr = $jahrgangsvertr; + + return success($result_object); + } + + public function getLvaForStudiengangInStudiensemester($studiengang_kz, $orgform_kurzbz, $studiensemester_kurzbz) { + $qry = ' + SELECT DISTINCT ON (lehre.tbl_lehrveranstaltung.lehrveranstaltung_id, + kurzbz, bezeichnung, semester, + lehre.tbl_lehrveranstaltung.sprache, orgform_kurzbz, + lehre.tbl_lehrveranstaltung.lehrform_kurzbz) + lehre.tbl_lehrveranstaltung.lehrveranstaltung_id, kurzbz, bezeichnung, + semester, lehre.tbl_lehrveranstaltung.sprache, orgform_kurzbz, lehre.tbl_lehrveranstaltung.lehrform_kurzbz + FROM lehre.tbl_lehrveranstaltung JOIN lehre.tbl_lehreinheit USING(lehrveranstaltung_id) JOIN lehre.tbl_lehreinheitmitarbeiter USING(lehreinheit_id) + WHERE aktiv = TRUE AND studiengang_kz = ? AND orgform_kurzbz = ? AND tbl_lehreinheit.studiensemester_kurzbz IN ?'; + + return $this->execReadOnlyQuery($qry, array($studiengang_kz, $orgform_kurzbz, $studiensemester_kurzbz)); + } } diff --git a/application/models/ressource/Stundenplan_model.php b/application/models/ressource/Stundenplan_model.php index 8cb07a3bb..909892674 100644 --- a/application/models/ressource/Stundenplan_model.php +++ b/application/models/ressource/Stundenplan_model.php @@ -186,9 +186,63 @@ class Stundenplan_model extends DB_Model return $query_result; } + /** + * queries Stundenplan but for a whole lva, irrespective of who is requesting it + * + * @return void + */ + public function getStundenplanLVA($start_date, $end_date, $lv_id) { + return $this->execReadOnlyQuery(" + + SELECT + 'lehreinheit' as type, beginn, ende, datum, + CONCAT(lehrfach,'-',lehrform) as topic, + array_agg(DISTINCT lektor) as lektor, + array_agg(DISTINCT (gruppe,verband,semester,studiengang_kz,gruppen_kuerzel)) as gruppe, + string_agg(DISTINCT ort_kurzbz, '/') as ort_kurzbz, + array_agg(DISTINCT lehreinheit_id) as lehreinheit_id, + + titel, lehrfach, lehrform, lehrfach_bez, organisationseinheit, farbe, lehrveranstaltung_id + + FROM + ( + SELECT unr,datum,beginn, ende, + CASE + WHEN sp.mitarbeiter_kurzbz IS NOT NULL THEN sp.mitarbeiter_kurzbz + ELSE lektor + END as lektor, + CASE + WHEN gruppe_kurzbz IS NOT NULL THEN gruppe_kurzbz + ELSE CONCAT(UPPER(sp.stg_typ),UPPER(sp.stg_kurzbz),'-',COALESCE(CAST(sp.semester AS varchar),'/'),COALESCE(CAST(sp.verband AS varchar),'/')) + END as gruppen_kuerzel, + (SELECT bezeichnung + FROM public.tbl_organisationseinheit + WHERE oe_kurzbz IN( + SELECT oe_kurzbz + FROM lehre.tbl_lehrveranstaltung + WHERE lehrveranstaltung_id = sp.lehrveranstaltung_id + )) as organisationseinheit, + ort_kurzbz, studiengang_kz, titel,lehreinheit_id,lehrfach_id,anmerkung,fix,lehrveranstaltung_id,stg_kurzbzlang,stg_bezeichnung,stg_typ,fachbereich_kurzbz,lehrfach,lehrfach_bez,farbe,lehrform,anmerkung_lehreinheit,gruppe, verband, semester,stg_kurzbz + + FROM ( + SELECT sp.* + FROM lehre.vw_stundenplan sp + WHERE + sp.datum >= ? + AND sp.datum <= ? AND sp.lehrveranstaltung_id = ? + ) sp + JOIN lehre.tbl_stunde ON lehre.tbl_stunde.stunde = sp.stunde + + ) as subquery + + GROUP BY unr, datum, beginn, ende, ort_kurzbz, titel, lehrform, lehrfach, lehrfach_bez, organisationseinheit, farbe, lehrveranstaltung_id + + ORDER BY datum, beginn + ", [$start_date, $end_date, $lv_id]); + } + /** * NO STANDALONE FUNCTION - Generates a SQL query string to fetch 'stundenplan' events for a specific student within the current semester. - * @param string $uid the user id that is used to fetch the stundenplan rows from the lehre.vw_stundenplan table * * @return mixed */ diff --git a/application/views/Cis/InfoTerminal.php b/application/views/Cis/InfoTerminal.php new file mode 100644 index 000000000..e25368286 --- /dev/null +++ b/application/views/Cis/InfoTerminal.php @@ -0,0 +1,16 @@ + 'Infoterminal', + 'tabulator5' => true, + 'primevue3' => true, +); +$this->load->view( + 'templates/CISVUE-Header', + $includesArray +); +?> + + +load->view('templates/CISVUE-Footer', $includesArray); ?> diff --git a/application/views/Cis/MyLv.php b/application/views/Cis/MyLv.php deleted file mode 100644 index d8d5026a1..000000000 --- a/application/views/Cis/MyLv.php +++ /dev/null @@ -1,15 +0,0 @@ - 'MyLv', - 'customJSModules' => ['public/js/apps/Cis/MyLv/Student.js'], - 'customCSSs' => ['public/css/components/MyLv.css'] -); - -$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 index 788d44360..f66ebf8a9 100644 --- a/application/views/Cis/Profil.php +++ b/application/views/Cis/Profil.php @@ -1,6 +1,6 @@ 'Stundenplan', + 'title' => 'Profil', 'customJSModules' => ['public/js/apps/Cis/Profil.js'], 'tabulator5' => true, 'primevue3' => true, diff --git a/application/views/Cis/Stundenplan.php b/application/views/Cis/Stundenplan.php deleted file mode 100644 index bfab73109..000000000 --- a/application/views/Cis/Stundenplan.php +++ /dev/null @@ -1,15 +0,0 @@ - 'Stundenplan', - 'customJSModules' => ['public/js/apps/Cis/Stundenplan.js'], - 'customCSSs' => ['public/css/components/calendar.css'] -); - -$this->load->view('templates/CISVUE-Header', $includesArray); -?> - -
- -
- -load->view('templates/CISVUE-Footer', $includesArray); ?> diff --git a/application/views/CisRouterView/CisRouterView.php b/application/views/CisRouterView/CisRouterView.php new file mode 100644 index 000000000..137f6cc65 --- /dev/null +++ b/application/views/CisRouterView/CisRouterView.php @@ -0,0 +1,40 @@ + 'Cis4', + 'axios027' => true, + 'bootstrap5' => true, + 'fontawesome6' => true, + 'tabulator5' => true, + 'vue3' => true, + 'primevue3' => true, + 'customCSSs' => array( + 'public/css/components/verticalsplit.css', + 'public/css/components/searchbar.css', + 'public/css/Fhc.css', + 'public/css/components/dashboard.css', + 'public/css/components/calendar.css', + 'public/css/components/MyLv.css', + 'public/css/components/FilterComponent.css', + 'public/css/components/Profil.css', + 'public/css/components/FormUnderline.css', + 'public/css/Cis4/Cms.css', + ), + 'customJSs' => array( + 'vendor/npm-asset/primevue/accordion/accordion.js', + 'vendor/npm-asset/primevue/accordiontab/accordiontab.js' + ), + 'customJSModules' => array( + 'public/js/apps/Dashboard/Fhc.js' + ), + +); + +$this->load->view('templates/CISVUE-Header', $includesArray); +?> +
> + +
+load->view('templates/CISVUE-Footer', $includesArray); ?> \ No newline at end of file diff --git a/application/views/CisVue/Cms/Content.php b/application/views/CisVue/Cms/Content.php index f957bb7f9..3d0097031 100644 --- a/application/views/CisVue/Cms/Content.php +++ b/application/views/CisVue/Cms/Content.php @@ -18,8 +18,8 @@ if(defined('CIS4')){ } ?> -
-' : ''); ?> +
+ ' : ''); ?>
'Dashboard', - 'tabulator5'=>true, - 'primevue3' => true, - 'customJSModules' => ['public/js/apps/Dashboard/Fhc.js'], - 'customCSSs' => [ - 'public/css/components/dashboard.css' - ], -); - -$this->load->view('templates/CISVUE-Header', $includesArray); -?> - -
- -
- -load->view('templates/CISVUE-Footer', $includesArray); ?> - diff --git a/application/views/templates/CISVUE-Header.php b/application/views/templates/CISVUE-Header.php index 119b9e5ee..de413bc7e 100644 --- a/application/views/templates/CISVUE-Header.php +++ b/application/views/templates/CISVUE-Header.php @@ -5,6 +5,7 @@ $includesArray = array( 'bootstrap5' => true, 'fontawesome6' => true, 'axios027' => true, + 'primevue3' => true, 'customJSModules' => array_merge([ 'public/js/apps/Cis.js' ], $customJSModules ?? []), @@ -15,15 +16,6 @@ $includesArray = array( $this->load->view('templates/FHC-Header', $includesArray); - -if (!isset($menu)) { - $ci =& get_instance(); // get CI instance - $ci->load->model('content/Content_model', 'ContentModel'); - $ci->load->config('cis'); - $cis4_content_id = $ci->config->item('cis_menu_root_content_id'); - $result = $ci->ContentModel->getMenu($cis4_content_id, getAuthUID()); - $menu = getData($result)->childs ?? []; -} ?>