{{ translation.title || $capitalize($p.t('ui', 'untitledNews')) }}
+ {{ $capitalize($p.t('ui', 'notPublishedYet')) }} +{{ $capitalize($p.t('ui', 'newsContentPreviewHint')) }}
+diff --git a/application/config/infocenter.php b/application/config/infocenter.php
index 555c30996..15889ef78 100644
--- a/application/config/infocenter.php
+++ b/application/config/infocenter.php
@@ -3,3 +3,4 @@
if (! defined('BASEPATH')) exit('No direct script access allowed');
$config['infocenter_studiengang_kz'] = '10021, 10027, 10002';
+$config['infocenter_qualifikationskurs_kz'] = '10002';
diff --git a/application/config/routes.php b/application/config/routes.php
index 1674b45ed..2c89e5ace 100644
--- a/application/config/routes.php
+++ b/application/config/routes.php
@@ -61,6 +61,15 @@ $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';
+// Legacy CMS news routes
+$route['api/frontend/v1/Cms/getNewsItem/(:num)'] = 'api/frontend/v1/NewsAdministrationAPI/getNewsItem/$1';
+$route['api/frontend/v1/Cms/storeNewsItem'] = 'api/frontend/v1/NewsAdministrationAPI/storeNewsItem';
+$route['api/frontend/v1/Cms/updateNewsItem/(:num)'] = 'api/frontend/v1/NewsAdministrationAPI/updateNewsItem/$1';
+$route['api/frontend/v1/Cms/deleteNewsItem/(:num)'] = 'api/frontend/v1/NewsAdministrationAPI/deleteNewsItem/$1';
+
+// Keep legacy uppercase URLs refreshable while using the canonical controller method casing
+$route['CisVue/Cms/NewsAdministration'] = 'CisVue/Cms/newsAdministration';
+
$route['Cis/LvPlan/.*'] = 'Cis/LvPlan/index/$1';
$route['Cis/MyLvPlan/.*'] = 'Cis/MyLvPlan/index/$1';
$route['Cis/MyLv/.*'] = 'Cis/MyLv/index/$1';
@@ -69,6 +78,8 @@ $route['Cis/OtherLvPlan/.*'] = 'Cis/OtherLvPlan/index/$1';
$route['Cis/StgOrgLvPlan/.*'] = 'Cis/StgOrgLvPlan/index/$1';
$route['Cis/Benotungstool/.*'] = 'Cis/Benotungstool/index/$1';
+$route['Cis/MyReservation'] = 'Cis/MyReservation/index/$1';
+
//Route for Zeitsperrenma
$route['Cis/Zeitsperrenma/.*'] = 'Cis/Zeitsperrenma/index/$1';
//Route für Zeitsperren
diff --git a/application/controllers/Cis/MyReservation.php b/application/controllers/Cis/MyReservation.php
new file mode 100644
index 000000000..e4045cf90
--- /dev/null
+++ b/application/controllers/Cis/MyReservation.php
@@ -0,0 +1,33 @@
+ ['basis/cis:r']
+ ]);
+
+ // Load Config
+ $this->load->config('calendar');
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // Public methods
+
+ /**
+ * @return void
+ */
+ public function index()
+ {
+ $this->load->view('CisRouterView/CisRouterView.php', ['route' => 'MyReservation']);
+ }
+}
diff --git a/application/controllers/CisVue/Cms.php b/application/controllers/CisVue/Cms.php
index aa07b919f..8f70e91c8 100644
--- a/application/controllers/CisVue/Cms.php
+++ b/application/controllers/CisVue/Cms.php
@@ -17,14 +17,15 @@ class Cms extends Auth_Controller
array(
'content' => 'basis/cis:r',
'getNews' => 'basis/cis:r',
- 'getNewsRowCount' => 'basis/cis:r',
'getRoomInformation' => 'basis/cis:r',
- 'news' => 'basis/cis:r'
+ 'news' => 'basis/cis:r',
+ 'newsAdministration' => ['basis/news:r'],
)
);
// Loads Libraries
$this->load->library('CmsLib');
+ $this->load->library('PermissionLib');
// Loads phrases system
$this->loadPhrases([
@@ -83,10 +84,18 @@ class Cms extends Auth_Controller
*/
public function news($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true)
{
- $viewData = array();
- $this->load->view('CisRouterView/CisRouterView.php', ['viewData'=>$viewData, 'route' => 'News']);
+ $this->load->view('CisRouterView/CisRouterView.php', [
+ 'route' => 'News',
+ ]);
}
+ public function newsAdministration()
+ {
+ $this->load->view('CisRouterView/CisRouterView.php', [
+ 'route' => 'NewsAdministration',
+ ]);
+ }
+
public function getRoomInformation($ort_kurzbz)
{
// Load Config
diff --git a/application/controllers/api/frontend/v1/Benutzer.php b/application/controllers/api/frontend/v1/Benutzer.php
new file mode 100644
index 000000000..f5dea1c7f
--- /dev/null
+++ b/application/controllers/api/frontend/v1/Benutzer.php
@@ -0,0 +1,48 @@
+.
+ */
+
+if (!defined('BASEPATH')) exit('No direct script access allowed');
+
+class Benutzer extends FHCAPI_Controller
+{
+
+ /**
+ * Object initialization
+ */
+ public function __construct()
+ {
+ parent::__construct([
+ 'getUserData' => self::PERM_LOGGED,
+ ]);
+
+ $this->load->model('person/Benutzer_model', 'BenutzerModel');
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Public methods
+
+ public function getUserData()
+ {
+ $uid = $this->input->get("uid") ?? getAuthUID();
+ $this->BenutzerModel->addSelect("uid, person_id, insertamum");
+ $userResult = $this->BenutzerModel->load(["uid" => $uid]);
+ $userData = $this->getDataOrTerminateWithError($userResult);
+ $this->terminateWithSuccess($userData);
+ }
+}
+
diff --git a/application/controllers/api/frontend/v1/CisMenu.php b/application/controllers/api/frontend/v1/CisMenu.php
index d5da7528f..debab48a4 100644
--- a/application/controllers/api/frontend/v1/CisMenu.php
+++ b/application/controllers/api/frontend/v1/CisMenu.php
@@ -67,8 +67,11 @@ class CisMenu extends FHCAPI_Controller
private function generateUrlForMenuItem($menuItem)
{
- $menuItem->url = $this->menuItemUrlHelper($menuItem);
- unset($menuItem->content);
+ if(!isset($menuItem->url))
+ {
+ $menuItem->url = $this->menuItemUrlHelper($menuItem);
+ unset($menuItem->content);
+ }
if ($menuItem->childs && count($menuItem->childs)) {
$menuItem->childs = $this->generateUrlsForMenuItems($menuItem->childs);
@@ -91,6 +94,8 @@ class CisMenu extends FHCAPI_Controller
$doc->loadXML($menuItem->content);
$urlElem = $doc->getElementsByTagName('url')->item(0);
+ $this->menuItemUrlTargetHelper($menuItem, $doc);
+
if (!$urlElem) {
return '';
}
@@ -122,5 +127,18 @@ class CisMenu extends FHCAPI_Controller
return $url;
}
+ private function menuItemUrlTargetHelper($menuItem, $xmldoc)
+ {
+ if($menuItem->template_kurzbz === 'redirect')
+ {
+ $targetElem = $xmldoc->getElementsByTagName('target')->item(0);
+ $target = ($targetElem) ? $targetElem->textContent : '';
+ if(!in_array($target, array('_self', '_top', '_blank')))
+ {
+ $target = '_self';
+ }
+ $menuItem->target = $target;
+ }
+ }
}
diff --git a/application/controllers/api/frontend/v1/Cms.php b/application/controllers/api/frontend/v1/Cms.php
index b8937a1f4..06b88c454 100644
--- a/application/controllers/api/frontend/v1/Cms.php
+++ b/application/controllers/api/frontend/v1/Cms.php
@@ -36,14 +36,15 @@ class Cms extends FHCAPI_Controller
'ContentID' => self::PERM_LOGGED,
'getOrtKurzbzContent' => self::PERM_LOGGED,
'content' => self::PERM_LOGGED,
- 'news' => self::PERM_LOGGED,
- 'getNewsRowCount' => self::PERM_LOGGED,
+ 'newsForWidget' => self::PERM_LOGGED,
'getNews' => self::PERM_LOGGED,
]);
$this->load->model('content/News_model', 'NewsModel');
-
+ $this->load->model('crm/Student_model', 'StudentModel');
+ $this->load->model('crm/Prestudent_model', 'PrestudentModel');
+
// setting up the papgination_size
$this->page_size = 10;
@@ -59,7 +60,6 @@ class Cms extends FHCAPI_Controller
//------------------------------------------------------------------------------------------------------------------
// Private methods
-
//------------------------------------------------------------------------------------------------------------------
// Public methods
@@ -106,7 +106,7 @@ class Cms extends FHCAPI_Controller
$this->terminateWithSuccess($content_id);
}
- public function news()
+ public function newsForWidget()
{
// form validation
@@ -118,7 +118,7 @@ class Cms extends FHCAPI_Controller
$this->load->model('content/news_model', 'NewsModel');
$limit = $this->input->get('limit',TRUE);
-
+
//query the news
$news = $this->NewsModel->getAll($limit);
@@ -157,23 +157,7 @@ class Cms extends FHCAPI_Controller
}
- 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;
-
- $this->load->model('content/News_model','NewsModel');
-
- $num_rows = $this->NewsModel->countNewsWithContent(getSprache(), $studiengang_kz, $semester, $fachbereich_kurzbz, $sichtbar, $maxalter, $page, $page_size, $all, $mischen);
-
- $num_rows = $this->getDataOrTerminateWithError($num_rows);
-
- $this->terminateWithSuccess($num_rows);
-
- }
-
-
- public function getNews($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true)
+ public function getNews($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = false, $titel = '', $edit = false, $sichtbar = true)
{
//form validation
$this->load->library('form_validation');
@@ -193,15 +177,45 @@ class Cms extends FHCAPI_Controller
// default value for the page_size is 10
$page_size = $page_size ?? 10;
+
+ $passedSichtbar = $this->input->get('published', true);
+ if($passedSichtbar !== null)
+ {
+ $sichtbar = $passedSichtbar;
+ }
- $news = $this->cmslib->getNews($infoscreen, $studiengang_kz, $semester, $mischen, $titel, $edit, $sichtbar, $page, $page_size, $sprache);
+ $filterForDegreePrograms = false;
+ $entitledDegreePrograms = [];
+ $student = $this->StudentModel->loadWhere(['student_uid' => getAuthUID()]);
+ if(isError($student))
+ {
+ $this->terminateWithError(getError($student));
+ }
+ if(hasData($student))
+ {
+ $student = current(getData($student));
+
+ $degreeProgramSemesterDataResult = $this->PrestudentModel->getStudiengaengAndAusbildungssemesterByStudentUid(getAuthUID());
+ $degreeProgramSemesterData = $this->getDataOrTerminateWithError($degreeProgramSemesterDataResult)[0];
+ if ($degreeProgramSemesterData) {
+ $studiengang_kz = isset($degreeProgramSemesterData->studiengang_kz) ? $degreeProgramSemesterData->studiengang_kz : null;
+ $semester = isset($degreeProgramSemesterData->ausbildungssemester) ? $degreeProgramSemesterData->ausbildungssemester : null;
+ }
+
+ $mischen = true;
+ } else {
+ $filterForDegreePrograms = true;
+ $entitledDegreePrograms = $this->permissionlib->getSTG_isEntitledFor("basis/news");
+ array_push($entitledDegreePrograms, 0);
+ }
+
+ $news = $this->cmslib->getNews($infoscreen, $studiengang_kz, $semester, $mischen, $titel, $edit, $sichtbar, $page, $page_size, $sprache, $filterForDegreePrograms, $entitledDegreePrograms, true);
$news = $this->getDataOrTerminateWithError($news);
- $this->addMeta('phrases', json_decode($this->p->getJson()));
- $this->terminateWithSuccess($news);
+ $this->addMeta('row_count', $news["row_count"] ?? 0);
+ $this->terminateWithSuccess($news["content"]);
}
}
-
diff --git a/application/controllers/api/frontend/v1/MaZeitsperren.php b/application/controllers/api/frontend/v1/MaZeitsperren.php
index 8e83e6df1..1cded3cbe 100644
--- a/application/controllers/api/frontend/v1/MaZeitsperren.php
+++ b/application/controllers/api/frontend/v1/MaZeitsperren.php
@@ -7,15 +7,15 @@ class MaZeitsperren extends FHCAPI_Controller
public function __construct()
{
parent::__construct([
- 'getAllActiveZeitsperren' => self::PERM_LOGGED,
- 'getAllZeitsperrenFixeMa' => self::PERM_LOGGED,
- 'getAllZeitsperrenLector' => self::PERM_LOGGED,
- 'getAllZeitsperrenOes' => self::PERM_LOGGED,
- 'getZeitsperrenAss' => self::PERM_LOGGED,
+ 'getAllActiveZeitsperren' => ['basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
+ 'getAllZeitsperrenFixeMa' => ['basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
+ 'getAllZeitsperrenLector' => ['basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
+ 'getAllZeitsperrenOes' => ['basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
+ 'getZeitsperrenAss' => ['basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
'getStgLectors' => self::PERM_LOGGED,
- 'loadZeitsperrenLectorStg' => self::PERM_LOGGED,
- 'loadZeitsperrenMa' => self::PERM_LOGGED,
- 'getDetailsMa' => self::PERM_LOGGED,
+ 'loadZeitsperrenLectorStg' => ['basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
+ 'loadZeitsperrenMa' => ['basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
+ 'getDetailsMa' => self::PERM_LOGGED
]);
// Load Libraries
diff --git a/application/controllers/api/frontend/v1/NewsAdministrationAPI.php b/application/controllers/api/frontend/v1/NewsAdministrationAPI.php
new file mode 100644
index 000000000..e15e403cd
--- /dev/null
+++ b/application/controllers/api/frontend/v1/NewsAdministrationAPI.php
@@ -0,0 +1,948 @@
+.
+ */
+
+if (!defined('BASEPATH')) exit('No direct script access allowed');
+
+class NewsAdministrationAPI extends FHCAPI_Controller
+{
+ /**
+ * News API constructor.
+ */
+ public function __construct()
+ {
+ parent::__construct([
+ 'getNews' => 'basis/news:r',
+ 'getNewsItem' => 'basis/news:r',
+ 'storeNewsItem' => 'basis/news:w',
+ 'updateNewsItem' => 'basis/news:w',
+ 'deleteNewsItem' => 'basis/news:w'
+ ]);
+
+ $this->load->model('content/Content_model', 'ContentModel');
+ $this->load->model('content/Contentsprache_model', 'ContentspracheModel');
+ $this->load->model('content/News_model', 'NewsModel');
+ $this->load->model('organisation/Studiengang_model', 'StudiengangModel');
+ $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
+ $this->load->model('system/Sprache_model', 'SpracheModel');
+ $this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
+
+ $this->loadPhrases([
+ 'global'
+ ]);
+
+ $this->load->library('CmsLib');
+
+ $this->load->helper('hlp_sancho_helper');
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Public methods
+
+ public function getNews($infoscreen = false, $studiengang_kz = null, $semester = null, $titel = '', $active = true, $sichtbar = true)
+ {
+ $this->load->library('form_validation');
+ $this->form_validation->set_data($_GET);
+ $this->form_validation->set_rules('page','Page','required|is_natural');
+ $this->form_validation->set_rules('page_size', 'PageSize', 'is_natural');
+ if($this->form_validation->run() == FALSE) $this->terminateWithValidationErrors($this->form_validation->error_array());
+
+ $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;
+
+ $passedSichtbar = $this->input->get('published', true);
+ if($passedSichtbar !== null)
+ {
+ $sichtbar = $passedSichtbar;
+ }
+
+ $passedIsActive = $this->input->get('isActive', true);
+ if ($passedIsActive !== null)
+ {
+ $isActive = filter_var(
+ $passedIsActive,
+ FILTER_VALIDATE_BOOLEAN,
+ FILTER_NULL_ON_FAILURE
+ );
+ if ($isActive !== null)
+ {
+ $active = $isActive;
+ }
+ }
+
+ $degreeProgramShortCode = $this->input->get('degreeProgramShortCode', true);
+ if ($degreeProgramShortCode !== null && $degreeProgramShortCode !== '')
+ {
+ if (!ctype_digit((string)$degreeProgramShortCode))
+ {
+ $this->terminateWithValidationErrors([
+ 'degreeProgramShortCode' => 'A valid degree program is required'
+ ]);
+ }
+ $studiengang_kz = $degreeProgramShortCode;
+ }
+
+ $passedSemester = $this->input->get('semester', true);
+ if ($passedSemester !== null && $passedSemester !== '')
+ {
+ if (
+ !ctype_digit((string)$passedSemester)
+ || (int)$passedSemester < 1
+ || (int)$passedSemester > 8
+ )
+ {
+ $this->terminateWithValidationErrors([
+ 'semester' => 'A valid semester is required'
+ ]);
+ }
+ $semester = filter_var($passedSemester, FILTER_VALIDATE_INT);
+ }
+
+ $entitledDegreePrograms = $this->permissionlib->getSTG_isEntitledFor("basis/news");
+
+ $news = $this->cmslib->getNews($infoscreen, $studiengang_kz, $semester, false, $titel, true, $sichtbar, $page, $page_size, $sprache, true, $entitledDegreePrograms, $active);
+ $news = $this->getDataOrTerminateWithError($news);
+
+ $this->addMeta('row_count', $news["row_count"] ?? 0);
+ $this->terminateWithSuccess($news["content"]);
+ }
+
+ /**
+ * Returns one news entry with all available language versions for editing.
+ *
+ * @return void
+ */
+ public function getNewsItem($newsId)
+ {
+ if (!is_numeric($newsId) || (int)$newsId < 1)
+ {
+ $this->terminateWithValidationErrors([
+ 'newsId' => 'A valid news ID is required'
+ ]);
+ }
+
+ $newsId = (int)$newsId;
+ $newsResult = $this->NewsModel->load($newsId);
+
+ if (isError($newsResult))
+ {
+ $this->terminateWithError(getError($newsResult), self::ERROR_TYPE_DB);
+ }
+
+ if (!hasData($newsResult))
+ {
+ $this->terminateWithValidationErrors([
+ 'newsId' => 'The requested news entry does not exist'
+ ]);
+ }
+
+ $news = current(getData($newsResult));
+ $entitledDegreePrograms = $this->permissionlib->getSTG_isEntitledFor("basis/news");
+
+ if (!in_array($news->studiengang_kz, $entitledDegreePrograms)) {
+ $this->terminateWithError('You are not entitled to access this news entry', self::ERROR_TYPE_PERMISSION);
+ }
+ $translationsResult = $this->ContentspracheModel->loadWhere([
+ 'content_id' => $news->content_id
+ ]);
+
+ if (isError($translationsResult))
+ {
+ $this->terminateWithError(getError($translationsResult), self::ERROR_TYPE_DB);
+ }
+
+ $languages = [];
+
+ foreach ((array)getData($translationsResult) as $translation)
+ {
+ $languages[$translation->sprache] = true;
+ }
+
+ $translations = [];
+
+ foreach (array_keys($languages) as $language)
+ {
+ $contentResult = $this->ContentModel->getContent(
+ $news->content_id,
+ $language,
+ null,
+ null,
+ false
+ );
+
+ if (isError($contentResult))
+ {
+ $this->terminateWithError(getError($contentResult), self::ERROR_TYPE_DB);
+ }
+
+ $content = getData($contentResult);
+ $document = new DOMDocument('1.0', 'UTF-8');
+
+ if ($content->content !== '' && $document->loadXML($content->content) === false)
+ {
+ $this->terminateWithError(
+ 'The stored news content is invalid',
+ self::ERROR_TYPE_GENERAL
+ );
+ }
+
+ $author = $document->getElementsByTagName('verfasser')->item(0);
+ $title = $document->getElementsByTagName('betreff')->item(0);
+ $text = $document->getElementsByTagName('text')->item(0);
+
+ $translations[] = [
+ 'language' => $language,
+ 'author' => $author ? $author->nodeValue : '',
+ 'title' => $title ? $title->nodeValue : '',
+ 'text' => $text ? str_replace('dms.php', APP_ROOT . 'cms/dms.php', $text->nodeValue) : '',
+ 'isPublished' => (bool)$content->sichtbar
+ ];
+ }
+
+ $this->terminateWithSuccess([
+ 'newsId' => (int)$news->news_id,
+ 'visibleFrom' => $news->datum,
+ 'visibleTo' => $news->datum_bis,
+ 'degreeProgramShortCode' => $news->studiengang_kz,
+ 'semester' => $news->semester,
+ 'translations' => $translations
+ ]);
+ }
+
+ /**
+ * Creates a news entry and all supplied translations.
+ *
+ * @return void
+ */
+ public function storeNewsItem()
+ {
+ $this->load->library('form_validation');
+ $postData = $this->input->post(null, true);
+ $this->form_validation->set_data(is_array($postData) ? $postData : []);
+ $this->form_validation->set_rules('visibleFrom', 'Visible from', 'required|is_valid_date');
+ $this->form_validation->set_rules('visibleTo', 'Visible to', 'is_valid_date');
+ $this->form_validation->set_rules(
+ 'degreeProgramShortCode',
+ 'Degree program',
+ 'required|is_natural'
+ );
+ $this->form_validation->set_rules(
+ 'semester',
+ 'Semester',
+ 'is_natural_no_zero|less_than_equal_to[8]'
+ );
+
+ $errors = $this->form_validation->run() === false
+ ? $this->form_validation->error_array()
+ : [];
+ $visibleFrom = $this->input->post('visibleFrom', true);
+ $visibleTo = $this->input->post('visibleTo', true);
+ $translations = $this->input->post('translations', true);
+
+ if (
+ is_string($visibleFrom)
+ && is_string($visibleTo)
+ && $visibleTo !== ''
+ && is_valid_date($visibleFrom)
+ && is_valid_date($visibleTo)
+ && new DateTime($visibleTo) < new DateTime($visibleFrom)
+ )
+ {
+ $errors['visibleTo'] = 'Visible to must not be before Visible from';
+ }
+
+ if (!is_array($translations) || count($translations) === 0)
+ {
+ $errors['translations'] = 'At least one translation is required';
+ }
+ else
+ {
+ foreach ($translations as $index => $translation)
+ {
+ if (!is_array($translation))
+ {
+ $errors['translations.' . $index] = 'Each translation must be an object';
+ }
+ }
+ }
+
+ if (count($errors) > 0)
+ {
+ $this->terminateWithValidationErrors($errors);
+ }
+
+
+ $this->_ensureUserIsEntitledForDegreeProgram($this->input->post('degreeProgramShortCode', true));
+
+ $degreeProgramShortCode = $this->input->post('degreeProgramShortCode', true);
+ $semester = $this->input->post('semester', true);
+ $semester = $semester === '' ? null : $semester;
+ $visibleTo = $visibleTo === '' ? null : $visibleTo;
+
+ $studiengang = $this->_getStudiengang($degreeProgramShortCode);
+
+ $data = [
+ 'studiengang_kz' => $degreeProgramShortCode,
+ 'semester' => $semester,
+ 'datum' => $visibleFrom,
+ 'datum_bis' => $visibleTo,
+ 'translations' => []
+ ];
+
+ foreach ($translations as $index => $translation)
+ {
+ $data['translations'][$index] = [
+ 'sprache' => $translation['language'] ?? '',
+ 'verfasser' => $translation['author'] ?? '',
+ 'betreff' => $translation['title'] ?? '',
+ 'text' => $translation['text'] ?? '',
+ 'sichtbar' => isset($translation['isPublished']) ? (bool)$translation['isPublished'] : false
+ ];
+ }
+
+ $this->_validateLanguages($data['translations']);
+
+ foreach ($data['translations'] as $index => $translation)
+ {
+ $data['translations'][$index]['content'] = $this->_buildNewsXml($translation);
+ }
+
+ $uid = getAuthUID();
+ $now = date('Y-m-d H:i:s');
+
+ if ($this->db->trans_begin() === false)
+ {
+ $this->terminateWithError($this->db->error(), self::ERROR_TYPE_DB);
+ }
+
+ $contentResult = $this->ContentModel->insert([
+ 'template_kurzbz' => 'news',
+ 'oe_kurzbz' => $studiengang->oe_kurzbz,
+ 'aktiv' => true,
+ 'menu_open' => false,
+ 'insertamum' => $now,
+ 'insertvon' => $uid
+ ]);
+ $contentId = (int)$this->_getInsertedIdOrRollback($contentResult);
+
+ $newsResult = $this->NewsModel->insert([
+ 'uid' => $uid,
+ 'studiengang_kz' => $data['studiengang_kz'],
+ 'semester' => $data['semester'],
+ 'datum' => $data['datum'],
+ 'datum_bis' => $data['datum_bis'],
+ 'content_id' => $contentId,
+ 'insertamum' => $now,
+ 'insertvon' => $uid,
+ 'updateamum' => $now,
+ 'updatevon' => $uid
+ ]);
+ $newsId = (int)$this->_getInsertedIdOrRollback($newsResult);
+
+ foreach ($data['translations'] as $translation)
+ {
+ $translation['content'] = $this->formatContentURLsToRelative($translation['content']);
+
+ $translationResult = $this->ContentspracheModel->insert([
+ 'sprache' => $translation['sprache'],
+ 'content_id' => $contentId,
+ 'version' => 1,
+ 'sichtbar' => $translation['sichtbar'],
+ 'content' => $translation['content'],
+ 'titel' => $translation['betreff'],
+ 'insertamum' => $now,
+ 'insertvon' => $uid,
+ 'updateamum' => $now,
+ 'updatevon' => $uid
+ ]);
+
+ $this->_getInsertedIdOrRollback($translationResult);
+ }
+
+ $newsItemResult = $this->NewsModel->load($newsId);
+ $newsItem = $this->getDataOrTerminateWithError($newsItemResult);
+ $newsItem = $newsItem[0];
+
+ $this->_sendNewsItemTranslationRequiredMail(
+ $newsItem
+ );
+
+ if ($this->db->trans_status() === false)
+ {
+ $error = $this->db->error();
+ $this->db->trans_rollback();
+ $this->terminateWithError($error, self::ERROR_TYPE_DB);
+ }
+
+ if ($this->db->trans_commit() === false)
+ {
+ $error = $this->db->error();
+ $this->db->trans_rollback();
+ $this->terminateWithError($error, self::ERROR_TYPE_DB);
+ }
+
+ $this->terminateWithSuccess($newsId);
+ }
+
+ /**
+ * Updates a news entry and its supplied translations.
+ *
+ * @return void
+ */
+ public function updateNewsItem($newsId)
+ {
+ if (!is_numeric($newsId) || (int)$newsId < 1)
+ {
+ $this->terminateWithValidationErrors([
+ 'newsId' => 'A valid news ID is required'
+ ]);
+ }
+
+ $newsId = (int)$newsId;
+ $existingNewsResult = $this->NewsModel->load($newsId);
+
+ if (isError($existingNewsResult))
+ {
+ $this->terminateWithError(getError($existingNewsResult), self::ERROR_TYPE_DB);
+ }
+
+ if (!hasData($existingNewsResult))
+ {
+ $this->terminateWithValidationErrors([
+ 'newsId' => 'The requested news entry does not exist'
+ ]);
+ }
+
+ $existingNews = current(getData($existingNewsResult));
+
+ $this->_ensureUserIsEntitledForDegreeProgram($existingNews->studiengang_kz);
+
+ $this->load->library('form_validation');
+ $postData = $this->input->post(null, true);
+ $this->form_validation->set_data(is_array($postData) ? $postData : []);
+ $this->form_validation->set_rules('visibleFrom', 'Visible from', 'required|is_valid_date');
+ $this->form_validation->set_rules('visibleTo', 'Visible to', 'is_valid_date');
+ $this->form_validation->set_rules(
+ 'degreeProgramShortCode',
+ 'Degree program',
+ 'required|is_natural'
+ );
+ $this->form_validation->set_rules(
+ 'semester',
+ 'Semester',
+ 'is_natural_no_zero|less_than_equal_to[8]'
+ );
+
+ $errors = $this->form_validation->run() === false
+ ? $this->form_validation->error_array()
+ : [];
+ $visibleFrom = $this->input->post('visibleFrom', true);
+ $visibleTo = $this->input->post('visibleTo', true);
+ $translations = $this->input->post('translations', true);
+
+ if (
+ is_string($visibleFrom)
+ && is_string($visibleTo)
+ && $visibleTo !== ''
+ && is_valid_date($visibleFrom)
+ && is_valid_date($visibleTo)
+ && new DateTime($visibleTo) < new DateTime($visibleFrom)
+ )
+ {
+ $errors['visibleTo'] = 'Visible to must not be before Visible from';
+ }
+
+ if (!is_array($translations) || count($translations) === 0)
+ {
+ $errors['translations'] = 'At least one translation is required';
+ }
+ else
+ {
+ foreach ($translations as $index => $translation)
+ {
+ if (!is_array($translation))
+ {
+ $errors['translations.' . $index] = 'Each translation must be an object';
+ }
+ }
+ }
+
+ if (count($errors) > 0)
+ {
+ $this->terminateWithValidationErrors($errors);
+ }
+
+ $degreeProgramShortCode = $this->input->post('degreeProgramShortCode', true);
+ $semester = $this->input->post('semester', true);
+ $semester = $semester === '' ? null : $semester;
+ $visibleTo = $visibleTo === '' ? null : $visibleTo;
+
+ $studiengang = $this->_getStudiengang($degreeProgramShortCode);
+
+ $data = [
+ 'studiengang_kz' => $degreeProgramShortCode,
+ 'semester' => $semester,
+ 'datum' => $visibleFrom,
+ 'datum_bis' => $visibleTo,
+ 'translations' => []
+ ];
+
+ foreach ($translations as $index => $translation)
+ {
+ $data['translations'][$index] = [
+ 'sprache' => $translation['language'] ?? '',
+ 'verfasser' => $translation['author'] ?? '',
+ 'betreff' => $translation['title'] ?? '',
+ 'text' => $translation['text'] ?? '',
+ 'sichtbar' => isset($translation['isPublished']) ? (bool)$translation['isPublished'] : false
+ ];
+ }
+
+ $this->_validateLanguages($data['translations']);
+
+ foreach ($data['translations'] as $index => $translation)
+ {
+ $data['translations'][$index]['content'] = $this->_buildNewsXml($translation);
+ }
+
+ $uid = getAuthUID();
+ $now = date('Y-m-d H:i:s');
+
+ if ($this->db->trans_begin() === false)
+ {
+ $this->terminateWithError($this->db->error(), self::ERROR_TYPE_DB);
+ }
+
+ $contentResult = $this->ContentModel->update($existingNews->content_id, [
+ 'oe_kurzbz' => $studiengang->oe_kurzbz,
+ 'updateamum' => $now,
+ 'updatevon' => $uid
+ ]);
+
+ if (isError($contentResult))
+ {
+ $this->db->trans_rollback();
+ $this->terminateWithError(getError($contentResult), self::ERROR_TYPE_DB);
+ }
+
+ $newsResult = $this->NewsModel->update($newsId, [
+ 'studiengang_kz' => $data['studiengang_kz'],
+ 'semester' => $data['semester'],
+ 'datum' => $data['datum'],
+ 'datum_bis' => $data['datum_bis'],
+ 'updateamum' => $now,
+ 'updatevon' => $uid
+ ]);
+
+ if (isError($newsResult))
+ {
+ $this->db->trans_rollback();
+ $this->terminateWithError(getError($newsResult), self::ERROR_TYPE_DB);
+ }
+
+ $existingTranslationsResult = $this->ContentspracheModel->loadWhere([
+ 'content_id' => $existingNews->content_id
+ ]);
+
+ if (isError($existingTranslationsResult))
+ {
+ $this->db->trans_rollback();
+ $this->terminateWithError(getError($existingTranslationsResult), self::ERROR_TYPE_DB);
+ }
+
+ $existingTranslations = [];
+
+ foreach ((array)getData($existingTranslationsResult) as $existingTranslation)
+ {
+ $language = $existingTranslation->sprache;
+
+ if (
+ !isset($existingTranslations[$language])
+ || (int)$existingTranslation->version > (int)$existingTranslations[$language]->version
+ )
+ {
+ $existingTranslations[$language] = $existingTranslation;
+ }
+ }
+
+ $submittedLanguages = array_column($data['translations'], 'sprache');
+ $this->db->where('content_id', $existingNews->content_id);
+ $this->db->where_not_in('sprache', $submittedLanguages);
+
+ if ($this->db->delete('campus.tbl_contentsprache') === false)
+ {
+ $error = $this->db->error();
+ $this->db->trans_rollback();
+ $this->terminateWithError($error, self::ERROR_TYPE_DB);
+ }
+
+ foreach ($data['translations'] as $translation)
+ {
+ $translation['content'] = $this->formatContentURLsToRelative($translation['content']);
+ $translationData = [
+ 'sichtbar' => $translation['sichtbar'],
+ 'content' => $translation['content'],
+ 'titel' => $translation['betreff'],
+ 'updateamum' => $now,
+ 'updatevon' => $uid
+ ];
+
+ $existingTranslation = $existingTranslations[$translation['sprache']] ?? null;
+
+ if ($existingTranslation)
+ {
+ $translationResult = $this->ContentspracheModel->update(
+ $existingTranslation->contentsprache_id,
+ $translationData
+ );
+ }
+ else
+ {
+ $translationResult = $this->ContentspracheModel->insert([
+ 'sprache' => $translation['sprache'],
+ 'content_id' => $existingNews->content_id,
+ 'version' => 1,
+ 'insertamum' => $now,
+ 'insertvon' => $uid
+ ] + $translationData);
+ }
+
+ $this->_getInsertedIdOrRollback($translationResult);
+ }
+
+ if ($this->db->trans_status() === false)
+ {
+ $error = $this->db->error();
+ $this->db->trans_rollback();
+ $this->terminateWithError($error, self::ERROR_TYPE_DB);
+ }
+
+ if ($this->db->trans_commit() === false)
+ {
+ $error = $this->db->error();
+ $this->db->trans_rollback();
+ $this->terminateWithError($error, self::ERROR_TYPE_DB);
+ }
+
+ $this->terminateWithSuccess($newsId);
+ }
+
+ /**
+ * Deletes one news entry and its linked content.
+ *
+ * @return void
+ */
+ public function deleteNewsItem($newsId)
+ {
+ if (!is_numeric($newsId) || (int)$newsId < 1)
+ {
+ $this->terminateWithValidationErrors([
+ 'newsId' => 'A valid news ID is required'
+ ]);
+ }
+
+ $newsId = (int)$newsId;
+ $newsResult = $this->NewsModel->load($newsId);
+
+ if (isError($newsResult))
+ {
+ $this->terminateWithError(getError($newsResult), self::ERROR_TYPE_DB);
+ }
+
+ if (!hasData($newsResult))
+ {
+ $this->terminateWithValidationErrors([
+ 'newsId' => 'The requested news entry does not exist'
+ ]);
+ }
+
+ $news = current(getData($newsResult));
+
+
+ $this->_ensureUserIsEntitledForDegreeProgram($news->studiengang_kz);
+
+ if ($this->db->trans_begin() === false)
+ {
+ $this->terminateWithError($this->db->error(), self::ERROR_TYPE_DB);
+ }
+
+ $newsDeleteResult = $this->NewsModel->delete($newsId);
+
+ if (isError($newsDeleteResult))
+ {
+ $this->db->trans_rollback();
+ $this->terminateWithError(getError($newsDeleteResult), self::ERROR_TYPE_DB);
+ }
+
+ $this->db->where('content_id', $news->content_id);
+
+ if ($this->db->delete('campus.tbl_contentsprache') === false)
+ {
+ $error = $this->db->error();
+ $this->db->trans_rollback();
+ $this->terminateWithError($error, self::ERROR_TYPE_DB);
+ }
+
+ $contentDeleteResult = $this->ContentModel->delete($news->content_id);
+
+ if (isError($contentDeleteResult))
+ {
+ $this->db->trans_rollback();
+ $this->terminateWithError(getError($contentDeleteResult), self::ERROR_TYPE_DB);
+ }
+
+ if ($this->db->trans_status() === false)
+ {
+ $error = $this->db->error();
+ $this->db->trans_rollback();
+ $this->terminateWithError($error, self::ERROR_TYPE_DB);
+ }
+
+ if ($this->db->trans_commit() === false)
+ {
+ $error = $this->db->error();
+ $this->db->trans_rollback();
+ $this->terminateWithError($error, self::ERROR_TYPE_DB);
+ }
+
+ $this->terminateWithSuccess($newsId);
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Private methods
+
+ /**
+ * Loads the requested Studiengang or reports a validation error.
+ *
+ * @param integer $studiengangKz
+ * @return stdClass
+ */
+ private function _getStudiengang($studiengangKz)
+ {
+ $result = $this->StudiengangModel->load($studiengangKz);
+
+ if (isError($result))
+ {
+ $this->terminateWithError(getError($result), self::ERROR_TYPE_DB);
+ }
+
+ if (!hasData($result))
+ {
+ $this->terminateWithValidationErrors([
+ 'studiengang_kz' => 'The requested Studiengang does not exist'
+ ]);
+ }
+
+ $studiengaenge = getData($result);
+
+ return current($studiengaenge);
+ }
+
+ /**
+ * Ensures that all supplied languages exist in tbl_sprache.
+ *
+ * @param array $translations
+ * @return void
+ */
+ private function _validateLanguages($translations)
+ {
+ $languages = [];
+
+ foreach ($translations as $translation)
+ {
+ $languages[] = $translation['sprache'];
+ }
+
+ $result = $this->SpracheModel->loadMultiple($languages);
+
+ if (isError($result))
+ {
+ $this->terminateWithError(getError($result), self::ERROR_TYPE_DB);
+ }
+
+ $existingLanguages = [];
+
+ foreach ((array)getData($result) as $language)
+ {
+ $existingLanguages[$language->sprache] = true;
+ }
+
+ $errors = [];
+
+ foreach ($translations as $index => $translation)
+ {
+ if (!isset($existingLanguages[$translation['sprache']]))
+ {
+ $errors['translations.' . $index . '.sprache'] = 'The requested language does not exist';
+ }
+ }
+
+ if (count($errors) > 0)
+ {
+ $this->terminateWithValidationErrors($errors);
+ }
+ }
+
+ private function _ensureUserIsEntitledForDegreeProgram($degreeProgramShortCode)
+ {
+ $entitledDegreePrograms = $this->permissionlib->getSTG_isEntitledFor("basis/news:w");
+ if (!is_array($entitledDegreePrograms))
+ {
+ $this->terminateWithError('Failed to retrieve entitled degree programs for the user', self::ERROR_TYPE_GENERAL);
+ }
+
+ if (!in_array($degreeProgramShortCode, $entitledDegreePrograms)) {
+ $this->terminateWithError("User is not entitled for the specified degree program");
+ }
+ }
+ /**
+ * Returns an inserted identifier or rolls the transaction back on error.
+ *
+ * @param stdClass $result
+ * @return mixed
+ */
+ private function _getInsertedIdOrRollback($result)
+ {
+ if (isError($result))
+ {
+ $this->db->trans_rollback();
+ $this->terminateWithError(getError($result), self::ERROR_TYPE_DB);
+ }
+
+ return getData($result);
+ }
+
+ /**
+ * Builds the XML format consumed by existing news readers.
+ *
+ * @param array $translation
+ * @return string
+ */
+ private function _buildNewsXml($translation)
+ {
+ $document = new DOMDocument('1.0', 'UTF-8');
+ $news = $document->createElement('news');
+ $document->appendChild($news);
+
+ $this->_appendCdataElement($document, $news, 'verfasser', $translation['verfasser']);
+ $this->_appendCdataElement($document, $news, 'betreff', $translation['betreff']);
+ $this->_appendCdataElement($document, $news, 'text', $translation['text']);
+
+ return $document->saveXML($news);
+ }
+
+ /**
+ * Appends a CDATA element and safely preserves CDATA terminators.
+ *
+ * @param DOMDocument $document
+ * @param DOMElement $parent
+ * @param string $name
+ * @param string $value
+ * @return void
+ */
+ private function _appendCdataElement($document, $parent, $name, $value)
+ {
+ $element = $document->createElement($name);
+ $parts = explode(']]>', $value);
+ $lastIndex = count($parts) - 1;
+
+ foreach ($parts as $index => $part)
+ {
+ if ($index > 0)
+ {
+ $part = '>' . $part;
+ }
+
+ if ($index < $lastIndex)
+ {
+ $part .= ']]';
+ }
+
+ $element->appendChild($document->createCDATASection($part));
+ }
+
+ $parent->appendChild($element);
+ }
+
+ private function _sendNewsItemTranslationRequiredMail($newsItem)
+ {
+ $translatorsResult = $this->BenutzerfunktionModel->getBenutzerFunktionen("translate", $newsItem->studiengang_kz);
+ $translators = $this->getDataOrTerminateWithError($translatorsResult);
+
+ $newsItemContentResult = $this->ContentspracheModel->loadWhere([
+ 'content_id' => $newsItem->content_id,
+ 'sprache' => 'German'
+ ]);
+ $newsItemContentEntry = getData($newsItemContentResult)[0] ?? null;
+ if ($newsItemContentEntry) {
+ $newsItem->sichtbar = $newsItemContentEntry->sichtbar ?? false;
+ $newsItem->content = $newsItemContentEntry->content;
+ }
+ $content = getData(
+ $this->cmslib->createNewsContent(
+ $this->cmslib->createNewsWrapper($newsItem, true),
+ false,
+ ""
+ )
+ );
+
+ foreach ($translators as $translator) {
+ sendSanchoMail(
+ "Sancho_Mail_News_Translation_Req",
+ [
+ "newsItemUrl" => APP_ROOT . "cis.php/CisVue/Cms/newsAdministration?newsId=" . $newsItem->news_id,
+ "newsItemAuthor" => $newsItem->verfasser,
+ "newsItemSubject" => $newsItem->betreff,
+ "newsItemContent" => $content
+ ],
+ $translator->uid . "@" . DOMAIN,
+ "Übersetzung erforderlich / Translation required"
+ );
+ }
+ }
+
+ private function formatContentURLsToRelative($content)
+ {
+ $content = preg_replace(
+ '#https?://[^"\'>\s]*/(dms\.php(?:\?[^"\'>\s]*)?)#i',
+ '$1',
+ $content
+ );
+
+ $content = preg_replace(
+ '#(?:\.\./)+[^"\'>\s]*/(dms\.php(?:\?[^"\'>\s]*)?)#i',
+ '$1',
+ $content
+ );
+
+ $content = preg_replace(
+ '#/[^"\'>\s]*/(dms\.php(?:\?[^"\'>\s]*)?)#i',
+ '$1',
+ $content
+ );
+
+ return $content;
+ }
+}
diff --git a/application/controllers/api/frontend/v1/OtherLvPlan.php b/application/controllers/api/frontend/v1/OtherLvPlan.php
index 1807f0a4a..e6616cc99 100644
--- a/application/controllers/api/frontend/v1/OtherLvPlan.php
+++ b/application/controllers/api/frontend/v1/OtherLvPlan.php
@@ -1,6 +1,6 @@
.
+ */
+
+if (!defined('BASEPATH'))
+ exit('No direct script access allowed');
+
+class Permission extends FHCAPI_Controller
+{
+
+ /**
+ * Object initialization
+ */
+ public function __construct()
+ {
+ parent::__construct([
+ 'getPermissions' => self::PERM_LOGGED,
+ ]);
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Public methods
+
+ /**
+ * retrieves permissions for auth user
+ * @access public
+ */
+ public function getPermissions()
+ {
+ $permissionsParam = $this->input->post("permissions");
+ if (!$permissionsParam || !is_array($permissionsParam)) {
+ $this->terminateWithError("Invalid parameter!");
+ }
+
+ $permissions = [];
+ foreach ($permissionsParam as $permission) {
+ $permissions[$permission] = $this->permissionlib->isBerechtigt($permission);
+ }
+
+ $this->terminateWithSuccess($permissions);
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // Private methods
+
+}
+
diff --git a/application/controllers/api/frontend/v1/Reservierung.php b/application/controllers/api/frontend/v1/Reservierung.php
new file mode 100644
index 000000000..6ee9b293e
--- /dev/null
+++ b/application/controllers/api/frontend/v1/Reservierung.php
@@ -0,0 +1,67 @@
+.
+ */
+
+if (! defined('BASEPATH')) exit('No direct script access allowed');
+
+class Reservierung extends FHCAPI_Controller
+{
+
+ /**
+ * Object initialization
+ */
+ public function __construct()
+ {
+ parent::__construct([
+ 'getMyReservation' => 'basis/cis:r',
+ 'deleteReservation' => 'lehre/reservierung:rw'
+ ]);
+
+ $this->load->model('ressource/Reservierung_model', 'ReservierungModel');
+
+ }
+
+ /**
+ * Retrieves all reservations from lehre.vw_reservation of the logged in user
+ */
+ public function getMyReservation()
+ {
+ $result = $this->ReservierungModel->getMyReservation();
+ $data = $this->getDataOrTerminateWithError($result);
+
+ $this->terminateWithSuccess($data);
+ }
+
+ /**
+ * deletes a reservation by ID
+ */
+ public function deleteReservation()
+ {
+ $reservierung_id = $this->input->post('reservierung_id');
+
+
+ if ($reservierung_id === NULL || trim((string)$reservierung_id) === '') {
+ $this->terminateWithError($this->p->t('global', 'wrongParameters'), 'general');
+ }
+
+ $result = $this->ReservierungModel->deleteReservation($reservierung_id);
+ $data = $this->getDataOrTerminateWithError($result);
+
+ $this->terminateWithSuccess($data);
+ }
+}
+
diff --git a/application/controllers/api/frontend/v1/Studgang.php b/application/controllers/api/frontend/v1/Studgang.php
index 82aebb666..001706c92 100644
--- a/application/controllers/api/frontend/v1/Studgang.php
+++ b/application/controllers/api/frontend/v1/Studgang.php
@@ -27,7 +27,7 @@ class Studgang extends FHCAPI_Controller
{
parent::__construct([
'getStudiengangInfo'=> self::PERM_LOGGED,
-
+ 'getDegreePrograms'=> self::PERM_LOGGED,
]);
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
@@ -43,15 +43,46 @@ class Studgang extends FHCAPI_Controller
//------------------------------------------------------------------------------------------------------------------
// Public methods
- public function getStudiengangInfo(){
- $isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter(getAuthUID());
- $isMitarbeiter = $this->getDataOrTerminateWithError($isMitarbeiter);
- if($isMitarbeiter) {
- $this->terminateWithSuccess(null);
+ public function getDegreePrograms() {
+ $entitledDegreePrograms = $this->permissionlib->getSTG_isEntitledFor("basis/news");
+ if (!$entitledDegreePrograms) {
+ $this->terminateWithError("User is not entitled for any degree program");
}
-
+
+ $activeDegreePrograms = $this->StudiengangModel->getDegreePrograms();
+ $activeDegreePrograms= $this->getDataOrTerminateWithError($activeDegreePrograms);
+
+ $activeDegreePrograms = array_values(array_filter($activeDegreePrograms, function($degreeProgram) use ($entitledDegreePrograms) {
+ return in_array($degreeProgram->studiengang_kz, $entitledDegreePrograms);
+ }));
+
+ $this->terminateWithSuccess($activeDegreePrograms);
+ }
+
+ public function getStudiengangInfo(){
+ $studiengang_kz = $this->input->get('studiengang_kz', true);
+ $semester = $this->input->get('semester', true);
+
+ // without a Studiengang the info of the logged in Student is returned
+ if (!is_numeric($studiengang_kz))
+ {
+ $isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter(getAuthUID());
+ $isMitarbeiter = $this->getDataOrTerminateWithError($isMitarbeiter);
+ if($isMitarbeiter) {
+ $this->terminateWithSuccess(null);
+ }
+
+ $studiengang_kz = null;
+ $semester = null;
+ }
+ else
+ {
+ $studiengang_kz = (int)$studiengang_kz;
+ $semester = is_numeric($semester) ? (int)$semester : null;
+ }
+
// fetches the Studiengang Information which is used next to the news
- $studiengangInfo = $this->StudiengangModel->getStudiengangInfoForNews();
+ $studiengangInfo = $this->StudiengangModel->getStudiengangInfoForNews($studiengang_kz, $semester);
$studiengangInfo= $this->getDataOrTerminateWithError($studiengangInfo);
$this->terminateWithSuccess($studiengangInfo);
}
diff --git a/application/controllers/api/frontend/v1/Zeitsperren.php b/application/controllers/api/frontend/v1/Zeitsperren.php
index d2698d205..aa25e911d 100644
--- a/application/controllers/api/frontend/v1/Zeitsperren.php
+++ b/application/controllers/api/frontend/v1/Zeitsperren.php
@@ -7,14 +7,14 @@ class Zeitsperren extends FHCAPI_Controller
public function __construct()
{
parent::__construct([
- 'getZeitsperrenUser' => self::PERM_LOGGED,
+ 'getZeitsperrenUser' => ['basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
'getTypenZeitsperren' => self::PERM_LOGGED,
'getTypenErreichbarkeit' => self::PERM_LOGGED,
'getStunden' => self::PERM_LOGGED,
- 'loadZeitsperre' => self::PERM_LOGGED,
- 'add' => self::PERM_LOGGED,
- 'update' => self::PERM_LOGGED,
- 'delete' => self::PERM_LOGGED,
+ 'loadZeitsperre' => ['basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
+ 'add' => ['basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
+ 'update' => ['basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
+ 'delete' => ['basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
]);
// Load Libraries
diff --git a/application/controllers/api/frontend/v1/funktionen/Funktionen.php b/application/controllers/api/frontend/v1/funktionen/Funktionen.php
index a3efcdb51..821dcf5bd 100644
--- a/application/controllers/api/frontend/v1/funktionen/Funktionen.php
+++ b/application/controllers/api/frontend/v1/funktionen/Funktionen.php
@@ -12,9 +12,9 @@ class Funktionen extends FHCAPI_Controller
parent::__construct(array(
'getAllFunctions' => ['admin:r', 'assistenz:r'],
'getAllUserFunctions' => ['admin:r', 'assistenz:r'],
- 'getOrgHeads' => ['admin:r', 'assistenz:r'],
- 'getOrgetsForCompany' => ['admin:r', 'assistenz:r'],
- 'getAllOrgUnits' => ['admin:r', 'assistenz:r'],
+ 'getOrgHeads' => self::PERM_LOGGED,
+ 'getOrgetsForCompany' => self::PERM_LOGGED,
+ 'getAllOrgUnits' => self::PERM_LOGGED,
'loadFunction' => ['admin:r', 'assistenz:r'],
'insertFunction' => ['admin:rw', 'assistenz:rw'],
'updateFunction' => ['admin:rw', 'assistenz:rw'],
diff --git a/application/controllers/api/frontend/v1/stv/LvTermine.php b/application/controllers/api/frontend/v1/stv/LvTermine.php
index b9e23e77d..0d070ffd3 100644
--- a/application/controllers/api/frontend/v1/stv/LvTermine.php
+++ b/application/controllers/api/frontend/v1/stv/LvTermine.php
@@ -370,6 +370,7 @@ class LvTermine extends FHCAPI_Controller
$result->semester = $item->semester;
$result->verband = $item->verband;
$result->gruppe = $item->gruppe;
+ $result->studiensemester_kurzbz = $item->studiensemester_kurzbz;
return $result;
},
$lehrverband_query_result));
diff --git a/application/controllers/api/frontend/v1/stv/Projektarbeit.php b/application/controllers/api/frontend/v1/stv/Projektarbeit.php
index d26d6a10c..f8131bd3a 100644
--- a/application/controllers/api/frontend/v1/stv/Projektarbeit.php
+++ b/application/controllers/api/frontend/v1/stv/Projektarbeit.php
@@ -42,6 +42,8 @@ class Projektarbeit extends FHCAPI_Controller
$this->load->model('education/Note_model', 'NoteModel');
$this->load->model('education/Projektbetreuer_model', 'BetreuerModel');
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
+ $this->load->model('crm/Student_model', 'StudentModel');
+ $this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
// load libraries
$this->load->library('PermissionLib');
@@ -100,16 +102,16 @@ class Projektarbeit extends FHCAPI_Controller
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'
+ 'lehre.tbl_projektarbeit.projektarbeit_id, titel, titel_english, themenbereich, projekttyp_kurzbz, lehrveranstaltung_id, lehreinheit_id,
+ tbl_projektarbeit.studiensemester_kurzbz, firma_id, beginn, ende, gesperrtbis, note, final, freigegeben, tbl_projektarbeit.anmerkung, fa.name AS firma_name'
);
- $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');
+
+
return $this->ProjektarbeitModel->loadWhere(
array('projektarbeit_id' => $projektarbeit_id)
);
-
}
/**
@@ -246,14 +248,38 @@ class Projektarbeit extends FHCAPI_Controller
$additional_lehrveranstaltung_id = $this->input->get('additional_lehrveranstaltung_id');
if (!isset($student_uid)) $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Student UID']), self::ERROR_TYPE_GENERAL);
- if (!isset($studiensemester_kurzbz)) $this->terminateWithError('Studiensemster missing', self::ERROR_TYPE_GENERAL);
+ if (!isset($studiensemester_kurzbz)) $this->terminateWithError('Studiensemester missing', self::ERROR_TYPE_GENERAL);
- // get Lvs
+ // get prestudent_id from student model
+ $studentRes = $this->StudentModel->load(['student_uid' => $student_uid]);
+ if(hasData($studentRes)) {
+ $student = getData($studentRes);
+ } else {
+ $this->terminateWithError($studentRes, self::ERROR_TYPE_GENERAL);
+ }
+
+ // to get prestudent_status history
+ $historyRes = $this->PrestudentstatusModel->getHistoryPrestudent($student[0]->prestudent_id);
+ if(hasData($historyRes)) {
+ $history = getData($historyRes);
+ } else {
+ $this->terminateWithError($historyRes, self::ERROR_TYPE_GENERAL);
+ }
+
+ // query for every lva of a studiengang that has projektarbeit flag true
$lvsResult = $this->LehrveranstaltungModel->getLvsForProjektarbeit($student_uid, $studiengang_kz, $additional_lehrveranstaltung_id);
-
if (isError($lvsResult)) return $this->terminateWithError($lvsResult, self::ERROR_TYPE_GENERAL);
-
$lvs = hasData($lvsResult) ? getData($lvsResult) : [];
+
+ $lvsIDs = array_column($lvs, 'lehrveranstaltung_id');
+
+ // get current studienplan_id from status history to find out which lva options are actually assigned to the students studienplan
+ // important so the projektarbeit has the correct lva assigned to be able to find and print the thesis title on the degree documents!
+ $currentStatus = $history[0];
+ $lvByStudienPlanRes = $this->LehrveranstaltungModel->getLvsByStudienplanByLvaIDs($currentStatus->studienplan_id, $lvsIDs);
+ if(hasData($lvByStudienPlanRes)) {
+ $lvs = getData($lvByStudienPlanRes);
+ }
foreach ($lvs as $lv)
{
@@ -320,11 +346,18 @@ class Projektarbeit extends FHCAPI_Controller
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Projekttyp'])
]);
- $this->form_validation->set_rules('lehreinheit_id', 'Lehreinheit', 'required|is_natural', [
- 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Lehreinheit']),
+ $this->form_validation->set_rules('lehreinheit_id', 'Lehreinheit', 'is_natural', [
'is_natural' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Lehreinheit'])
]);
+ $this->form_validation->set_rules('lehrveranstaltung_id', 'Lehrveranstaltung', 'required', [
+ 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Lehrveranstaltung'])
+ ]);
+
+ $this->form_validation->set_rules('studiensemester_kurzbz', 'Studiensemester', 'required', [
+ 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Studiensemester'])
+ ]);
+
$this->form_validation->set_rules('beginn', 'Beginn', 'is_valid_date', [
'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'Beginn'])
]);
@@ -354,6 +387,8 @@ class Projektarbeit extends FHCAPI_Controller
'projekttyp_kurzbz' => $formData['projekttyp_kurzbz'],
'firma_id' => $formData['firma_id'] ?? null,
'lehreinheit_id' => $formData['lehreinheit_id'],
+ 'lehrveranstaltung_id' => $formData['lehrveranstaltung_id'],
+ 'studiensemester_kurzbz' => $formData['studiensemester_kurzbz'],
'beginn' => isset($formData['beginn']) && !isEmptyString($formData['beginn']) ? $formData['beginn'] : null,
'ende' => isset($formData['ende']) && !isEmptyString($formData['ende']) ? $formData['ende'] : null,
'note' => $formData['note'] ?? null,
diff --git a/application/controllers/jobs/ReihungstestJob.php b/application/controllers/jobs/ReihungstestJob.php
index 6dd214fbb..83ab9b526 100644
--- a/application/controllers/jobs/ReihungstestJob.php
+++ b/application/controllers/jobs/ReihungstestJob.php
@@ -803,7 +803,7 @@ class ReihungstestJob extends JOB_Controller
{
if (!isset($studiensemester) || isEmptyString($studiensemester))
{
- $this->logError("Studiensemster not passed as parameter");
+ $this->logError("Studiensemester not passed as parameter");
return;
}
diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php
index eaa207ff1..f10d94a8a 100644
--- a/application/controllers/system/infocenter/InfoCenter.php
+++ b/application/controllers/system/infocenter/InfoCenter.php
@@ -34,6 +34,9 @@ class InfoCenter extends Auth_Controller
const PREV_FILTER_ID = 'prev_filter_id';
const KEEP_TABLESORTER_FILTER = 'keepTsFilter';
+ const ONBOARDING_INSERTVON = 'onboarding';
+ const ONBOARDING_KENNZEICHENTYP = 'eobRegistrierungsId';
+
private $_uid; // contains the UID of the logged user
// Used to log with PersonLogLib
@@ -175,6 +178,7 @@ class InfoCenter extends Auth_Controller
$this->load->model('person/Kontakt_model', 'KontaktModel');
$this->load->model('person/Geschlecht_model', 'GeschlechtModel');
$this->load->model('person/adresse_model', 'AdresseModel');
+ $this->load->model('person/Kennzeichen_model', 'KennzeichenModel');
// Loads libraries
$this->load->library('PersonLogLib');
@@ -1452,6 +1456,100 @@ class InfoCenter extends Auth_Controller
$this->outputJsonSuccess("Done!");
}
+
+ public function getAbsageData()
+ {
+ $stg_typ = $this->getStudienArtBerechtigung(['b', 'm']);
+
+ if (!is_null($stg_typ))
+ {
+ $statusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval;
+ $studienSemester = $this->variablelib->getVar('infocenter_studiensemester');
+ $studiengaenge = $this->StudiengangModel->getStudiengaengeWithOrgForm(array_column($stg_typ, 'typ'), $studienSemester);
+
+ $data = array (
+ 'statusgruende' => $statusgruende,
+ 'studiengaenge' => $studiengaenge->retval
+ );
+
+ $this->outputJsonSuccess($data);
+ }
+ else
+ $this->outputJsonSuccess(null);
+ }
+
+ public function getStudienArtBerechtigung($typ = null)
+ {
+ $studiengang_kz_all = $this->permissionlib->getSTG_isEntitledFor('infocenter');
+ $stg_typ = $this->StudiengangModel->getStudiengangTyp($studiengang_kz_all, $typ);
+ return getData($stg_typ);
+ }
+
+ public function getStudienartData()
+ {
+ $this->outputJsonSuccess($this->getStudienArtBerechtigung(['b', 'm', 'l']));
+ }
+
+ public function saveAbsageForAll()
+ {
+ $statusgrund = $this->input->post('statusgrund');
+ $studiengang = $this->input->post('studiengang');
+ $abgeschickt = $this->input->post('abgeschickt');
+ $personen = $this->input->post('personen');
+ $studienSemester = $this->variablelib->getVar('infocenter_studiensemester');
+
+ if ($statusgrund === 'null' || $studiengang === 'null' || $abgeschickt === 'null' || empty($personen))
+ $this->terminateWithJsonError("Bitte füllen Sie alle Felder aus");
+
+ if ($studiengang === 'all' && $abgeschickt === 'all')
+ {
+ foreach($personen as $person)
+ {
+ $prestudenten = $this->PrestudentModel->getByPersonWithoutLehrgang($person, $studienSemester);
+
+ if (!hasData($prestudenten))
+ continue;
+
+ $prestudentenData = getData($prestudenten);
+
+ foreach ($prestudentenData as $prestudent)
+ {
+ $this->saveAbsage($prestudent->prestudent_id, $statusgrund);
+ }
+ }
+ }
+ else
+ {
+ $this->load->model('organisation/Studienplan_model', 'StudienplanModel');
+
+ $this->StudienplanModel->addSelect('1');
+ $this->StudienplanModel->addJoin('lehre.tbl_studienordnung so', 'studienordnung_id');
+ $escaped = $this->StudienplanModel->db->escape(strtoupper($studiengang));
+ $this->StudienplanModel->db->where("UPPER(so.studiengangkurzbzlang || ':' || tbl_studienplan.orgform_kurzbz) = $escaped");
+ $this->StudienplanModel->addLimit(1);
+ $studiengangResult = $this->StudienplanModel->load();
+
+ if (hasData($studiengangResult))
+ {
+ foreach($personen as $person)
+ {
+ $prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt, $abgeschickt === 'all');
+
+ if (!hasData($prestudent))
+ continue;
+
+ $prestudentData = getData($prestudent);
+ $this->saveAbsage($prestudentData[0]->prestudent_id, $statusgrund);
+ }
+ }
+ else
+ $this->terminateWithJsonError("Falschen Studiengang übergeben!");
+
+ }
+
+ $this->outputJsonSuccess("Success");
+ }
+
// -----------------------------------------------------------------------------------------------------------------
// Private methods
@@ -1946,6 +2044,17 @@ class InfoCenter extends Auth_Controller
show_error(getError($user_person));
}
+ // add info about first electronig onboarding login
+ $this->KennzeichenModel->addSelect('insertamum');
+ $onboarding_first_login = $this->KennzeichenModel->loadWhere(
+ array('person_id' => $person_id, 'kennzeichentyp_kurzbz' => self::ONBOARDING_KENNZEICHENTYP)
+ );
+
+ if (isError($onboarding_first_login))
+ {
+ show_error(getError($onboarding_first_login));
+ }
+
$data = array (
'lockedby' => $lockedby,
'lockedbyother' => $lockedbyother,
@@ -1955,7 +2064,9 @@ class InfoCenter extends Auth_Controller
'messages' => $messages->retval,
'logs' => $logs,
'notizen' => $notizen->retval,
- 'notizenbewerbung' => $notizen_bewerbung->retval
+ 'notizenbewerbung' => $notizen_bewerbung->retval,
+ 'created_by_onboarding' => $stammdaten->retval->insertvon == self::ONBOARDING_INSERTVON,
+ 'onboarding_first_login' => hasData($onboarding_first_login) ? getData($onboarding_first_login)[0]->insertamum : null
);
return $data;
@@ -2375,97 +2486,4 @@ class InfoCenter extends Auth_Controller
$this->loglib->logError('Studiengang has no mail for sending Freigabe mail');
}
}
-
- public function getAbsageData()
- {
- $stg_typ = $this->getStudienArtBerechtigung(['b', 'm']);
-
- if (!is_null($stg_typ))
- {
- $statusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval;
- $studienSemester = $this->variablelib->getVar('infocenter_studiensemester');
- $studiengaenge = $this->StudiengangModel->getStudiengaengeWithOrgForm(array_column($stg_typ, 'typ'), $studienSemester);
-
- $data = array (
- 'statusgruende' => $statusgruende,
- 'studiengaenge' => $studiengaenge->retval
- );
-
- $this->outputJsonSuccess($data);
- }
- else
- $this->outputJsonSuccess(null);
- }
-
- public function getStudienArtBerechtigung($typ = null)
- {
- $studiengang_kz_all = $this->permissionlib->getSTG_isEntitledFor('infocenter');
- $stg_typ = $this->StudiengangModel->getStudiengangTyp($studiengang_kz_all, $typ);
- return getData($stg_typ);
- }
-
- public function getStudienartData()
- {
- $this->outputJsonSuccess($this->getStudienArtBerechtigung(['b', 'm', 'l']));
- }
-
- public function saveAbsageForAll()
- {
- $statusgrund = $this->input->post('statusgrund');
- $studiengang = $this->input->post('studiengang');
- $abgeschickt = $this->input->post('abgeschickt');
- $personen = $this->input->post('personen');
- $studienSemester = $this->variablelib->getVar('infocenter_studiensemester');
-
- if ($statusgrund === 'null' || $studiengang === 'null' || $abgeschickt === 'null' || empty($personen))
- $this->terminateWithJsonError("Bitte füllen Sie alle Felder aus");
-
- if ($studiengang === 'all' && $abgeschickt === 'all')
- {
- foreach($personen as $person)
- {
- $prestudenten = $this->PrestudentModel->getByPersonWithoutLehrgang($person, $studienSemester);
-
- if (!hasData($prestudenten))
- continue;
-
- $prestudentenData = getData($prestudenten);
-
- foreach ($prestudentenData as $prestudent)
- {
- $this->saveAbsage($prestudent->prestudent_id, $statusgrund);
- }
- }
- }
- else
- {
- $this->load->model('organisation/Studienplan_model', 'StudienplanModel');
-
- $this->StudienplanModel->addSelect('1');
- $this->StudienplanModel->addJoin('lehre.tbl_studienordnung so', 'studienordnung_id');
- $escaped = $this->StudienplanModel->db->escape(strtoupper($studiengang));
- $this->StudienplanModel->db->where("UPPER(so.studiengangkurzbzlang || ':' || tbl_studienplan.orgform_kurzbz) = $escaped");
- $this->StudienplanModel->addLimit(1);
- $studiengangResult = $this->StudienplanModel->load();
-
- if (hasData($studiengangResult))
- {
- foreach($personen as $person)
- {
- $prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt, $abgeschickt === 'all');
-
- if (!hasData($prestudent))
- continue;
-
- $prestudentData = getData($prestudent);
- $this->saveAbsage($prestudentData[0]->prestudent_id, $statusgrund);
- }
- }
- else
- $this->terminateWithJsonError("Falschen Studiengang übergeben!");
-
- }
-
- $this->outputJsonSuccess("Success");
- }
}
\ No newline at end of file
diff --git a/application/controllers/system/infocenter/Rueckstellung.php b/application/controllers/system/infocenter/Rueckstellung.php
index b1f2b60b7..2a122348f 100644
--- a/application/controllers/system/infocenter/Rueckstellung.php
+++ b/application/controllers/system/infocenter/Rueckstellung.php
@@ -7,6 +7,8 @@ class Rueckstellung extends Auth_Controller
private $_ci; // Code igniter instance
private $_uid;
+ const ZGV_UEBERPRUEFUNG_MAIL_VORLAGE = 'ZGVUEP';
+
public function __construct()
{
parent::__construct(
@@ -23,6 +25,7 @@ class Rueckstellung extends Auth_Controller
$this->load->model('crm/RueckstellungStatus_model', 'RueckstellungStatusModel');
$this->load->model('person/Person_model', 'PersonModel');
$this->load->library('PersonLogLib');
+ $this->load->library('MessageLib');
$this->_setAuthUID(); // sets property uid
@@ -78,6 +81,8 @@ class Rueckstellung extends Auth_Controller
$this->_log($person_id, $status_kurzbz);
+ if ($status_kurzbz === 'onhold_zgv')
+ $this->sendRueckstellungMessage($person_id);
$this->outputJson($result);
}
@@ -104,6 +109,10 @@ class Rueckstellung extends Auth_Controller
if (isError($result))
$this->terminateWithJsonError(getError($result));
$this->_log($person, $status_kurzbz);
+
+ if ($status_kurzbz === 'onhold_zgv')
+ $this->sendRueckstellungMessage($person);
+
}
$this->outputJsonSuccess("Erfolgreich gespeichert!");
}
@@ -160,4 +169,26 @@ class Rueckstellung extends Auth_Controller
$this->_uid
);
}
+
+ private function sendRueckstellungMessage($person_id)
+ {
+ $person = $this->_ci->PersonModel->load($person_id);
+
+ if (hasData($person))
+ {
+ $person = getData($person)[0];
+
+ return $this->messagelib->sendMessageUserTemplate(
+ $person_id,
+ self::ZGV_UEBERPRUEFUNG_MAIL_VORLAGE,
+ array(
+ 'anrede' => $person->anrede,
+ 'nachname' => $person->nachname
+ ),
+ null,
+ getAuthPersonId(),
+ 'infocenter'
+ );
+ }
+ }
}
\ No newline at end of file
diff --git a/application/helpers/hlp_header_helper.php b/application/helpers/hlp_header_helper.php
index eb2cd9f85..41f361bf1 100644
--- a/application/helpers/hlp_header_helper.php
+++ b/application/helpers/hlp_header_helper.php
@@ -82,6 +82,21 @@ function generateCSSsInclude($CSSs)
}
}
+/**
+ * Generates tags for the style sheets you want to include, the parameter could by a string or an array of strings
+ */
+function generatePrintCSS($path)
+{
+ $cssLink = '';
+
+ $ci =& get_instance();
+ $cachetoken = '?'.$ci->config->item('fhcomplete_build_version');
+
+ if (isset($path)) {
+ echo sprintf($cssLink, base_url($path).$cachetoken) . PHP_EOL;
+ }
+}
+
/**
* Generates global JS-Object to pass parms to other javascripts
*/
diff --git a/application/libraries/AnrechnungLib.php b/application/libraries/AnrechnungLib.php
index 8ee1891b5..4c27a297c 100644
--- a/application/libraries/AnrechnungLib.php
+++ b/application/libraries/AnrechnungLib.php
@@ -741,7 +741,7 @@ class AnrechnungLib
$fullname = hasData($result) ? $result->retval[0]->vorname. $result->retval[0]->nachname : '';
// Return filename
- return 'Anrechnungsantrag'. $orgform_kurzbz .'_LV-'. $lehrveranstaltung_id. '_'. $fullname;
+ return 'Anrechnungsantrag'. $orgform_kurzbz .'_LV-'. $lehrveranstaltung_id. '_'. $fullname . '.pdf';
}
public function LVhasLector($anrechnung_id)
diff --git a/application/libraries/CmsLib.php b/application/libraries/CmsLib.php
index 355cf7c56..89f06c412 100644
--- a/application/libraries/CmsLib.php
+++ b/application/libraries/CmsLib.php
@@ -4,6 +4,7 @@ if (!defined('BASEPATH'))
exit('No direct script access allowed');
use \DateTime as DateTime;
+use \DateInterval as DateInterval;
use \DOMDocument as DOMDocument;
use \XSLTProcessor as XSLTProcessor;
@@ -141,63 +142,6 @@ class CmsLib
]);
}
- /**
- * @param stdClass $stg_obj
- *
- * @return stdClass
- */
- protected function getNewsExtras($stg_obj, $semester)
- {
- $this->ci->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
-
- $stg_ltg = $this->ci->StudiengangModel->getLeitungDetailed($stg_obj->studiengang_kz);
- if (isError($stg_ltg))
- return $stg_ltg;
- $stg_ltg = getData($stg_ltg) ?: [];
-
- $gf_ltg = $this->ci->BenutzerfunktionModel->getBenutzerFunktionenDetailed('gLtg', $stg_obj->oe_kurzbz);
- if (isError($gf_ltg))
- return $gf_ltg;
- $gf_ltg = getData($gf_ltg) ?: [];
-
- $stv_ltg = $this->ci->BenutzerfunktionModel->getBenutzerFunktionenDetailed('stvLtg', $stg_obj->oe_kurzbz);
- if (isError($stv_ltg))
- return $stv_ltg;
- $stv_ltg = getData($stv_ltg) ?: [];
-
- $ass = $this->ci->BenutzerfunktionModel->getBenutzerFunktionenDetailed('ass', $stg_obj->oe_kurzbz);
- if (isError($ass))
- return $ass;
- $ass = getData($ass) ?: [];
-
- $hochschulvertr = $this->ci->BenutzerfunktionModel->getBenutzerFunktionenDetailed('hsv');
- if (isError($hochschulvertr))
- return $hochschulvertr;
- $hochschulvertr = getData($hochschulvertr) ?: [];
-
- $stdv = $this->ci->BenutzerfunktionModel->getBenutzerFunktionenDetailed('stdv', $stg_obj->oe_kurzbz);
- if (isError($stdv))
- return $stdv;
- $stdv = getData($stdv) ?: [];
-
- $jahrgangsvertr = $this->ci->BenutzerfunktionModel->getBenutzerFunktionenDetailed('jgv', $stg_obj->oe_kurzbz, $semester);
- if (isError($jahrgangsvertr))
- return $jahrgangsvertr;
- $jahrgangsvertr = getData($jahrgangsvertr) ?: [];
-
- return success($this->ci->load->view('Cis/Cms/News/Xml/NewsExtras', [
- 'studiengang' => $stg_obj,
- 'semester' => $semester,
- 'stg_ltg' => $stg_ltg,
- 'gf_ltg' => $gf_ltg,
- 'stv_ltg' => $stv_ltg,
- 'ass' => $ass,
- 'hochschulvertr' => $hochschulvertr,
- 'stdv' => $stdv,
- 'jahrgangsvertr' => $jahrgangsvertr
- ], true));
- }
-
/**
* @param string $studiengang_kz
* @param string $semester
@@ -233,64 +177,102 @@ 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, $sprache)
+ public function getNews($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true, $page = 1, $page_size = 10, $sprache, $filterForDegreePrograms = false, $allowedDegreePrograms = [], $active = true)
+
{
$this->ci->load->model('organisation/Studiengang_model', 'StudiengangModel');
list($studiengang_kz, $semester) = $this->getStgAndSem($studiengang_kz, $semester);
- $all = $edit;
-
- $xml = '
| '. ($row->semester == '1' ? $p->t('testtool/basisgebiete') : $p->t('testtool/quereinstiegsgebiete')).' |
| ' . $p->t('testtool/basisgebiete') . ' |
| ' . $p->t('testtool/quereinstiegsgebiete') . ' |
| UID | -
- {{ day.weekday }}
- {{ day.day }}
- |
- ||||
|---|---|---|---|---|---|
| {{m.sperren[0].nachname}} {{m.sperren[0].vorname}} | -
+
+
{{m.sperren[0].nachname}} {{m.sperren[0].vorname}} |
+
+
+ {{$p.t('zeitsperren/abwesend')}}
+ |
+
+ V:
+ {{ sperre.kurzbz }}
+
+
+ E: {{ sperre.erreichbarkeit_kurzbz }}
+
+ |
{{$p.t('ui/keineEintraegeGefunden')}}
+{{$p.t('ui/keineEintraegeGefunden')}}