Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • alexander.vorwerk/studip
  • hochschule-wismar/stud-ip
  • tleilax/studip
  • marcus/studip
  • manschwa/studip
  • eberhardt/studip
  • uol/studip
  • pluta/studip
  • thienel/extern-uni-b
  • studip/studip
  • strohm/studip
  • uni-osnabrueck/studip
  • FloB/studip
  • universit-t-rostock/studip
  • Robinyyy/studip
  • jakob.diel/studip
  • HyperSpeeed/studip
  • ann/studip
  • nod3zer0/stud-ip-siple-saml-php-plugin
19 results
Show changes
Commits on Source (753)
Showing
with 1107 additions and 71 deletions
{
"parserOptions": {
"parser": "@babel/eslint-parser",
"sourceType": "module"
},
"env": {
"browser": true,
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:vue/essential"
],
"globals": {
"STUDIP": "writable",
"CKEDITOR": "writable",
"$": "writable",
"_": "writable",
"jQuery": "writable"
},
"plugins": [
"vue"
],
"rules": {
"no-unused-vars": "off",
"no-async-promise-executor": "error",
"no-await-in-loop": "error",
"no-promise-executor-return": "error",
"require-atomic-updates": "error",
"max-nested-callbacks": ["error", 4],
"no-return-await": "error",
"prefer-promise-reject-errors": "error"
}
}
......@@ -4,6 +4,9 @@
composer
node_modules
nbproject
phpstan.neon
.caches/*
.reports/*
config/config_local.inc.php
config/config.inc.php
......@@ -34,7 +37,6 @@ public/pictures/smile/*.jpg
public/pictures/smile/*.png
public/pictures/user/[0-9a-f]*.png
public/plugins_packages/*
!public/plugins_packages/core
tests/_log
tests/_helpers/CodeGuy.php
......@@ -44,3 +46,5 @@ tests/_helpers/_generated
tests/_output/
.idea
/config/oauth2/*.key
/config/oauth2/encryption_key.php
image: studip/studip:tests
variables:
MYSQL_RANDOM_ROOT_PASSWORD: "true"
MYSQL_DATABASE: studip_db
MYSQL_USER: studip_user
MYSQL_PASSWORD: studip_password
MYSQL_HOST: mariadb
DEMO_DATA: "true"
MAIL_TRANSPORT: debug
PHPSTAN_LEVEL: 0
# Optimize caching
FF_USE_FASTZIP: "true"
CACHE_COMPRESSION_LEVEL: "fast"
# User faster docker driver
DOCKER_DRIVER: overlay2
stages:
- checks
- analyse
- tests
- packaging
- release
- build
.scripts:
install-composer:
- make composer-dev
configure-studip:
- !reference [.scripts, install-composer]
- cp docker/studip/config_local.php config/config_local.inc.php
- cp config/config.inc.php.dist config/config.inc.php
initialize-studip-database:
- !reference [.scripts, configure-studip]
- chmod +x .gitlab/scripts/install_db.sh
- .gitlab/scripts/install_db.sh
- cli/studip migrate
remove-absolute-path-in-report:
- sed -i "s%$PWD/%%" tests/_output/report.xml
.artifacts:
common: &common-artifacts
when: always
expire_in: 1 week
tests: &test-artifacts
<<: *common-artifacts
paths:
- tests/_output
reports:
junit: tests/_output/report.xml
.caches:
php: &composer-cache
key: "php-$CI_COMMIT_REF_SLUG"
paths:
- composer/
- .caches/phplint-cache
- .caches/resultCache.php
- .caches/cache/*
- .caches/resultCaches/*
js: &npm-cache
key: "js-$CI_COMMIT_REF_SLUG"
paths:
- node_modules/
- .caches/eslint-cache
- .caches/stylelint-cache
lint-php:
stage: checks
needs: []
cache: *composer-cache
allow_failure: false
interruptible: true
before_script:
- !reference [.scripts, install-composer]
- mkdir -p .reports
script:
- php -d memory_limit=-1 composer/bin/phplint --xml .reports/phplint-report.xml --cache=.caches/phplint-cache
artifacts:
<<: *common-artifacts
paths:
- .reports/phplint-report.xml
reports:
junit: .reports/phplint-report.xml
lint-js:
stage: checks
needs: []
cache: *npm-cache
allow_failure: false
interruptible: true
before_script:
- make npm
script:
- npm run lint -- --cache --cache-location .caches/eslint-cache --format ./node_modules/eslint-junit/index.js
artifacts:
<<: *common-artifacts
paths:
- .reports/eslint-report.xml
reports:
junit: .reports/eslint-report.xml
lint-css:
stage: checks
needs: []
cache: *npm-cache
allow_failure: false
interruptible: true
before_script:
- make npm
script:
- npm run css-lint -s -- --cache --cache-location .caches/stylelint-cache --custom-formatter node_modules/stylelint-junit-formatter --output-file .reports/stylelint-report.xml
artifacts:
<<: *common-artifacts
paths:
- .reports/stylelint-report.xml
reports:
junit: .reports/stylelint-report.xml
phpstan:
stage: analyse
needs: [lint-php]
allow_failure: true
interruptible: true
when: manual
cache: *composer-cache
before_script:
- make composer-dev
- mkdir .reports -p
script:
- php composer/bin/phpstan analyse --memory-limit=1G --no-progress --level=$PHPSTAN_LEVEL --error-format=gitlab > .reports/report-phpstan.json
artifacts:
paths:
- .reports/report-phpstan.json
expire_in: 14 days
when: always
reports:
codequality: .reports/report-phpstan.json
test-unit:
stage: tests
needs: [lint-php]
cache:
<<: *composer-cache
policy: pull
allow_failure: false
interruptible: true
before_script:
- !reference [.scripts, configure-studip]
script:
- composer/bin/codecept run unit --xml
- !reference [.scripts, remove-absolute-path-in-report]
artifacts:
<<: *test-artifacts
test-functional:
stage: tests
needs: [lint-php]
cache:
<<: *composer-cache
policy: pull
services:
- mariadb
allow_failure: false
interruptible: true
before_script:
- !reference [.scripts, initialize-studip-database]
script:
- composer/bin/codecept run functional --xml
- !reference [.scripts, remove-absolute-path-in-report]
artifacts:
<<: *test-artifacts
test-jsonapi:
stage: tests
needs: [lint-php]
cache:
<<: *composer-cache
policy: pull
services:
- mariadb
allow_failure: false
interruptible: true
before_script:
- !reference [.scripts, initialize-studip-database]
script:
- composer/bin/codecept run jsonapi --xml
- !reference [.scripts, remove-absolute-path-in-report]
artifacts:
<<: *test-artifacts
when: always
expire_in: 1 week
paths:
- tests/_output
reports:
junit: tests/_output/report.xml
test-assets:
stage: tests
needs: []
cache: *npm-cache
allow_failure: false
interruptible: true
before_script:
- make npm
script:
- make webpack-dev
packaging:
stage: packaging
cache: []
rules:
- if: $CI_COMMIT_TAG
before_script:
- echo GE_JOB_ID=$CI_JOB_ID >> .packaging.env
- mkdir .pkg
script:
- echo 'Running packaging job'
- make build clean-npm
- zip -r9 .pkg/studip-release-$CI_COMMIT_TAG.zip *
- tar -czf .pkg/studip-release-$CI_COMMIT_TAG.tar.gz *
artifacts:
untracked: true
name: 'Stud.IP-Release-$CI_COMMIT_TAG'
paths:
- .pkg/studip-release.zip
- .pkg/studip-release.tar.gz
reports:
dotenv: .packaging.env
release:
stage: release
image: studip/release-cli
cache: []
rules:
- if: $CI_COMMIT_TAG
script:
- echo 'Running release job'
needs:
- job: packaging
artifacts: true
release:
name: "Stud.IP-Release-$CI_COMMIT_TAG"
description: "Created using the release"
tag_name: "$CI_COMMIT_TAG"
assets:
links:
- name: "Stud.IP-Release-$CI_COMMIT_TAG.zip"
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${GE_JOB_ID}/artifacts/.pkg/studip-release-$CI_COMMIT_TAG.zip"
link_type: package
- name: "Stud.IP-Release-$CI_COMMIT_TAG.tar.gz"
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${GE_JOB_ID}/artifacts/.pkg/studip-release-$CI_COMMIT_TAG.tar.gz"
link_type: package
......@@ -6,4 +6,4 @@ Welches Problem ist aufgetreten und wie ist es dazu gekommen? (Hilfreich: vorher
Ist der Fehler reproduzierbar? Falls ja, wie.
/label ~"BIEST"
/label ~BIEST ~"Version::5.3"
......@@ -40,4 +40,4 @@ Sehr knappe Zusammenfassung des Proposals (Titel/Überschrift)
- [Regeln für StEPs](https://develop.studip.de/studip/dispatch.php/course/scm/9f22a869f704747dd066fbfe7ef55684?cid=1927f2b86d6b185aa6c6697810ad42f1)
/label ~StEP
/label ~StEP ~"StEP::Status::neu"
#!/bin/bash
set -e
if [ $(mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE -e "show tables;" --batch | wc -l) -eq 0 ]; then
# Setup mysql database
echo "INSTALL DB"
mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE < ./db/studip.sql
echo "INSTALL DEFAULT DATA"
mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE < ./db/studip_default_data.sql
mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE < ./db/studip_resources_default_data.sql
echo "INSTALL ROOTUSER"
mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE < ./db/studip_root_user.sql
# Check if demodata is required
if [ ! -z $DEMO_DATA ]; then
echo "INSTALL DEMODATA"
mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE < ./db/studip_demo_data.sql
echo "INSTALL MVV_DEMODATA"
mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE < ./db/studip_mvv_demo_data.sql
echo "INSTALL RESOURCES-DEMODATA"
mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE < ./db/studip_resources_demo_data.sql
fi
echo "INSTALLATION FINISHED"
else
echo "Found some SQL table. Skipping installation"
fi
path: ./
jobs: 10
cache: .caches/phplint-cache
extensions:
- php
exclude:
- composer
- public/plugins_packages
- vendor
{
"extends": "stylelint-config-standard",
"rules": {
"alpha-value-notation": null,
"at-rule-empty-line-before": null,
"at-rule-no-vendor-prefix": null,
"block-closing-brace-empty-line-before": null,
"block-closing-brace-newline-after": null,
"block-closing-brace-newline-before": null,
"block-closing-brace-space-before": null,
"block-no-empty": null,
"block-opening-brace-newline-after": null,
"block-opening-brace-space-after": null,
"block-opening-brace-space-before": null,
"color-function-notation": null,
"color-hex-case": null,
"color-hex-length": null,
"color-no-invalid-hex": null,
"comment-empty-line-before": null,
"comment-whitespace-inside": null,
"declaration-bang-space-after": null,
"declaration-bang-space-before": null,
"declaration-block-no-duplicate-properties": null,
"declaration-block-no-redundant-longhand-properties": null,
"declaration-block-no-shorthand-property-overrides": null,
"declaration-block-semicolon-newline-after": null,
"declaration-block-semicolon-space-before": null,
"declaration-block-single-line-max-declarations": null,
"declaration-block-trailing-semicolon": null,
"declaration-colon-newline-after": null,
"declaration-colon-space-after": null,
"declaration-colon-space-before": null,
"declaration-empty-line-before": null,
"font-family-name-quotes": null,
"font-family-no-missing-generic-family-keyword": null,
"function-comma-space-after": null,
"function-comma-space-before": null,
"function-name-case": null,
"function-no-unknown": null,
"function-parentheses-newline-inside": null,
"function-parentheses-space-inside": null,
"function-url-quotes": null,
"hue-degree-notation": null,
"indentation": null,
"keyframes-name-pattern": null,
"length-zero-no-unit": null,
"max-empty-lines": null,
"max-line-length": null,
"media-feature-name-no-vendor-prefix": null,
"no-descending-specificity": null,
"no-duplicate-selectors": null,
"no-empty-first-line": null,
"no-empty-source": null,
"no-eol-whitespace": null,
"no-extra-semicolons": null,
"no-invalid-position-at-import-rule": null,
"no-irregular-whitespace": null,
"no-missing-end-of-source-newline": null,
"number-leading-zero": null,
"number-max-precision": null,
"number-no-trailing-zeros": null,
"property-no-vendor-prefix": null,
"rule-empty-line-before": null,
"selector-attribute-quotes": null,
"selector-class-pattern": null,
"selector-combinator-space-after": null,
"selector-combinator-space-before": null,
"selector-descendant-combinator-no-non-space": null,
"selector-id-pattern": null,
"selector-list-comma-newline-after": null,
"selector-no-vendor-prefix": null,
"selector-not-notation": null,
"selector-pseudo-element-colon-notation": null,
"shorthand-property-no-redundant-values": null,
"string-quotes": null,
"value-keyword-case": null,
"value-list-max-empty-lines": null,
"value-no-vendor-prefix": null
},
"overrides": [
{
"files": ["**/*.scss"],
"customSyntax": "postcss-scss",
"rules": {
"at-rule-no-unknown": null
}
},
{
"files": ["**/*.less"],
"customSyntax": "postcss-less"
}
],
"ignoreFiles": [
"resource/assets/stylesheets/jquery-ui.structure.css",
"resources/assets/stylesheets/less/jquery-ui/*",
"resources/assets/stylesheets/vendor/*"
]
}
......@@ -14,6 +14,7 @@ André Noack <noack@data-quest.de>
Cornelia Roser <roser@hawk-hhg.de>
David Siegfried <david.siegfried@uni-vechta.de>
Martin Stratmann <martin@herrstratmann.de>
Moritz Strohm <strohm@data-quest.de>
Stefan Suchi <suchi@data-quest.de>
Peter Thienel <thienel@data-quest.de>
Jan-Hendrik Willms <tleilax@gmail.com>
......@@ -90,9 +91,6 @@ Jörg Röpke <roepke@uni-trier.de>
Tobias Thelen <tobias.thelen@uos.de>
Stud.IP help, event logging, wiki enhancements
Hartje Kriete <kriete@math.uni-goettingen.de>
English translation
Carola Kruse <carola.kruse@tu-braunschweig.de>
Jan Kulmann <jankul@zmml.uni-bremen.de>
......
This diff is collapsed.
......@@ -30,7 +30,7 @@ clean-composer:
npm: node_modules/.package-lock.json
node_modules/.package-lock.json: package.json package-lock.json
npm install --no-save
npm install --no-save --no-audit --no-fund
clean-npm:
rm -rf node_modules
......@@ -42,9 +42,6 @@ webpack-prod: .webpack.prod
webpack-watch: npm
npm run webpack-watch
wds: npm
npm run wds
.webpack.dev: node_modules/.package-lock.json $(RESOURCES)
@rm -f .webpack.prod
npm run webpack-dev
......
RELEASE 5.1.alpha-svn
RELEASE 5.2.alpha-svn
<?php
use \Studip\Activity\ActivityProvider;
class ActivityfeedController extends AuthenticatedController
{
public function save_action()
{
if (Config::get()->ACTIVITY_FEED === NULL) {
Config::get()->create('ACTIVITY_FEED', [
'range' => 'user',
'type' => 'array',
'description' => 'Einstellungen des Activity-Widgets']
);
}
$provider = Request::getArray('provider');
WidgetHelper::addWidgetUserConfig($GLOBALS['user']->id, 'ACTIVITY_FEED', $provider);
$this->response->add_header('X-Dialog-Close', 1);
$this->response->add_header('X-Dialog-Execute', 'STUDIP.ActivityFeed.updateFilter');
$this->render_json($provider);
}
/**
* return a list for all providers for every context
*
* @return array
*/
private function getAllModules()
{
$modules = [];
$modules['system'] = [
'news' => _('Ankündigungen'),
'blubber' => _('Blubber')
];
$modules[Context::COURSE] = [
'forum' => _('Forum'),
'participants' => _('Teilnehmende'),
'documents' => _('Dateien'),
'wiki' => _('Wiki'),
'schedule' => _('Ablaufplan'),
'news' => _('Ankündigungen'),
'blubber' => _('Blubber'),
'courseware' => _('Courseware')
];
$modules[Context::INSTITUTE] = $modules[Context::COURSE];
unset($modules[Context::INSTITUTE]['participants']);
unset($modules[Context::INSTITUTE]['schedule']);
$standard_plugins = PluginManager::getInstance()->getPlugins("StandardPlugin");
foreach ($standard_plugins as $plugin) {
if ($plugin instanceof ActivityProvider) {
$modules[Context::COURSE][$plugin->getPluginName()] = $plugin->getPluginName();
$modules[Context::INSTITUTE][$plugin->getPluginName()] = $plugin->getPluginName();
}
}
$modules[Context::USER] = [
'message' => _('Nachrichten'),
'news' => _('Ankündigungen'),
'blubber' => _('Blubber'),
];
$homepage_plugins = PluginEngine::getPlugins('HomepagePlugin');
foreach ($homepage_plugins as $plugin) {
if ($plugin->isActivated($GLOBALS['user']->id, 'user')) {
if ($plugin instanceof ActivityProvider) {
$modules[Context::USER][] = $plugin;
}
}
}
return $modules;
}
public function configuration_action()
{
$this->config = WidgetHelper::getWidgetUserConfig($GLOBALS['user']->id, 'ACTIVITY_FEED');
$this->modules = $this->getAllModules();
$this->context_translations = [
Context::COURSE => _('Veranstaltungen'),
Context::INSTITUTE => _('Einrichtungen'),
Context::USER => _('Persönlich'),
'system' => _('Global')
];
PageLayout::setTitle(_('Aktivitäten konfigurieren'));
}
}
<?php
/**
* accessibility_info_text.php - controller class for administrating additional information text to accessible files
* in file upload/edit dialogs
*
* @author Michaela Brückner <brueckner@data-quest.de>
* @license GPL2 or any later version
* @category Stud.IP
* @package admin
* @since 5.3
*/
class Admin_AccessibilityInfoTextController extends AuthenticatedController
{
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
$GLOBALS['perm']->check('root');
PageLayout::setTitle(_('Infotext zu barrierefreien Dateien'));
Navigation::activateItem('/admin/locations/accessibility_info_text');
}
public function index_action()
{
}
public function edit_action()
{
CSRFProtection::verifyUnsafeRequest();
Config::get()->store('ACCESSIBILITY_INFO_TEXT', Request::i18n('accessbility_info_text'));
PageLayout::postSuccess(_('Die Einstellungen wurden gespeichert.'));
$this->relocate('admin/accessibility_info_text/index');
}
}
......@@ -51,8 +51,7 @@ class Admin_AdditionalController extends AuthenticatedController
}
// purge data
if (Request::submitted('delete')) {
$stmt = DBManager::get()->prepare('DELETE FROM datafields_entries WHERE sec_range_id = ?');
$stmt->execute([$this->course->id]);
DatafieldEntryModel::deleteBySQL('sec_rage_id = ?', [$this->course->id]);
}
if ($this->course->store()) {
......@@ -65,9 +64,7 @@ class Admin_AdditionalController extends AuthenticatedController
}
// Fetch data
$stmt = DBManager::get()->prepare('SELECT COUNT(*) FROM datafields_entries WHERE sec_range_id = ?');
$stmt->execute([$this->course->id]);
$this->count = $stmt->fetchColumn();
$this->count = DatafieldEntryModel::countBySql('sec_range_id = ?', [$this->course->id]);
$this->list = AuxLockRule::findBySQL('1=1');
}
}
......@@ -36,6 +36,10 @@ class Admin_AutoinsertController extends AuthenticatedController
*/
public function index_action()
{
$this->sem_search = '';
$this->sem_select = '';
$this->seminar_search = [];
// search seminars
if (Request::submitted('suchen')) {
if (Request::get('sem_search')) {
......@@ -142,6 +146,8 @@ class Admin_AutoinsertController extends AuthenticatedController
*/
public function manual_action()
{
$this->seminar_search = [];
PageLayout::setTitle(_('Manuelles Eintragen von Nutzergruppen in Veranstaltungen'));
if (Request::submitted('submit')) {
$filters = array_filter(Request::getArray('filter'));
......@@ -204,7 +210,7 @@ class Admin_AutoinsertController extends AuthenticatedController
if (Request::get('sem_search') and Request::get('sem_select')) {
if (Request::get('sem_search')) {
$search = new SeminarSearch('number-name');
$search = new SeminarSearch();
$this->seminar_search = $search->getResults(Request::get('sem_search'), ['search_sem_sem' => $this->sem_select]);
if (count($this->seminar_search) == 0) {
PageLayout::postInfo(_('Es wurden keine Veranstaltungen gefunden.'));
......@@ -249,7 +255,6 @@ class Admin_AutoinsertController extends AuthenticatedController
}
$data = ['users' => count($userlookup->execute())];
}
$this->set_content_type('application/json;charset=utf-8');
return $this->render_text(json_encode($data));
$this->render_json($data);
}
}
......@@ -112,8 +112,6 @@ class Admin_CacheController extends AuthenticatedController
if (Config::get()->store('SYSTEMCACHE', $settings)) {
PageLayout::postSuccess(_('Die Einstellungen wurden gespeichert.'));
StudipCacheFactory::unconfigure();
} else {
PageLayout::postError(_('Die Einstellungen konnten nicht gespeichert werden.'));
}
$this->relocate('admin/cache/settings');
......
......@@ -36,14 +36,18 @@ class Admin_ConfigurationController extends AuthenticatedController
}
$this->setupSidebar($this->range_type);
// Preserve section parameter
// This *must* be after the sidebar has been defined
if (!Request::isPost() && Request::option('section')) {
URLHelper::addLinkParam('section', Request::option('section'));
}
}
/**
* Maintenance view for the configuration parameters
*
* @param mixed $section Open section
*/
public function configuration_action($open_section = null)
public function configuration_action()
{
PageLayout::setTitle(_('Verwaltung von Systemkonfigurationen'));
......@@ -61,7 +65,7 @@ class Admin_ConfigurationController extends AuthenticatedController
// set variables for view
$this->only_section = $section;
$this->open_section = $open_section ?: $section;
$this->open_section = Request::get('open_section', $section);
$this->needle = $needle;
$this->sections = ConfigurationModel::getConfig($section, $needle);
......@@ -97,7 +101,7 @@ class Admin_ConfigurationController extends AuthenticatedController
htmlReady($field)
));
$this->relocate('admin/configuration/configuration/' . $section);
$this->relocate($this->action_url("configuration#field-{$field}", ['open_section' => $section]));
return;
}
}
......
......@@ -22,10 +22,6 @@ class Admin_CourseplanningController extends AuthenticatedController
PageLayout::postError(_('Sie wurden noch keiner Einrichtung zugeordnet'));
}
if (!$GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT) {
$GLOBALS['user']->cfg->store('MY_INSTITUTES_DEFAULT', $this->insts[0]['Institut_id']);
}
// Semester selection
if ($GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE) {
$this->semester = Semester::find($GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE);
......@@ -38,6 +34,7 @@ class Admin_CourseplanningController extends AuthenticatedController
if (in_array($action, ['index', 'weekday'])) {
PageLayout::allowFullscreenMode();
}
$this->selected_weekday = '';
}
private function getPlanTitle()
......@@ -631,13 +628,8 @@ class Admin_CourseplanningController extends AuthenticatedController
$stgteile = StudiengangTeil::getAllEnriched('fach_name','ASC', ['mvv_fach_inst.institut_id' => $GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT]);
$sidebar = Sidebar::Get();
$list = new SelectWidget(_('Studiengangteil'), $this->url_for('admin/courseplanning/set_selection/' . $this->selected_weekday), 'stgteil_select');
if ($this->selected_weekday) {
$list->addElement(new SelectElement('all', _('Alle')), 'stgteil_select-all');
}
$list->addElement(new SelectElement('all', _('Alle')), 'stgteil_select-all');
foreach ($stgteile as $stgteil) {
if (!$GLOBALS['user']->cfg->MY_COURSES_SELECTED_STGTEIL || ($GLOBALS['user']->cfg->MY_COURSES_SELECTED_STGTEIL == 'all' && !$this->selected_weekday)) {
$GLOBALS['user']->cfg->store('MY_COURSES_SELECTED_STGTEIL', $stgteil->id);
}
$list->addElement(new SelectElement(
$stgteil->id,
$stgteil->getDisplayName(),
......@@ -652,7 +644,6 @@ class Admin_CourseplanningController extends AuthenticatedController
* Returns a course type widthet depending on all available courses and theirs types
* @param string $selected
* @param array $params
* @return ActionsWidget
*/
private function setCourseTypeWidget($selected = 'all')
{
......@@ -702,7 +693,6 @@ class Admin_CourseplanningController extends AuthenticatedController
/**
* Returns a widget to selected a specific teacher
* @param array $teachers
* @return ActionsWidget|null
*/
private function setTeacherWidget()
{
......@@ -751,7 +741,7 @@ class Admin_CourseplanningController extends AuthenticatedController
* @param String $course_id Id of the course
* @return array of user infos [user_id, username, Nachname, fullname]
*/
private function getTeacher($course_id)
private function getTeacher($course_id): array
{
$teachers = CourseMember::findByCourseAndStatus($course_id, 'dozent');
$collection = SimpleCollection::createFromArray($teachers);
......@@ -769,11 +759,10 @@ class Admin_CourseplanningController extends AuthenticatedController
* Returns all courses matching set criteria.
*
* @param Array $params Additional parameters
* @param String $parent_id Fetch only subcourses of this parent
* @param display_all : boolean should we show all courses or check for a limit of 500 courses?
* @param bool $display_all should we show all courses or check for a limit of 500 courses?
* @return Array of courses
*/
private function getCourses($params = [], $display_all = false)
private function getCourses($params = [], $display_all = false): array
{
// Init
if ($GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT === "all") {
......
......@@ -43,7 +43,7 @@ class Admin_CoursesController extends AuthenticatedController
{
//first get the active datafields of the user:
$userSelectedElements = $this->getActiveElements();
$activeDatafields = $userSelectedElements['datafields'];
$activeDatafields = $userSelectedElements['datafields'] ?? [];
if (!$activeDatafields) {
return [];
......@@ -189,7 +189,7 @@ class Admin_CoursesController extends AuthenticatedController
}
//if there are datafields in the list, draw their input fields, too:
if ($visibleElements['datafields']) {
if (!empty($visibleElements['datafields'])) {
//The datafields entry contains an array with datafield-IDs.
//We must fetch them from the database and show an appropriate widget
//for each datafield.
......@@ -222,7 +222,7 @@ class Admin_CoursesController extends AuthenticatedController
$actions->addLink(
_('Neue Veranstaltung anlegen'),
URLHelper::getURL('dispatch.php/course/wizard'),
Icon::create('seminar+add')
Icon::create('add')
)->asDialog('size=50%');
$actions->addLink(
_('Diese Seitenleiste konfigurieren'),
......@@ -291,10 +291,6 @@ class Admin_CoursesController extends AuthenticatedController
PageLayout::postError(_('Sie wurden noch keiner Einrichtung zugeordnet'));
}
if (!$GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT) {
$GLOBALS['user']->cfg->store('MY_INSTITUTES_DEFAULT', $this->insts[0]['Institut_id']);
}
// Semester selection
if ($GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE) {
$this->semester = Semester::find($GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE);
......@@ -376,13 +372,7 @@ class Admin_CoursesController extends AuthenticatedController
]],
LockRule::findAllByType('sem')
));
$this->aux_lock_rules = array_merge(
[[
'name' => '--' . _("keine Zusatzangaben") . '--',
'lock_id' => 'none'
]],
AuxLockRules::getAllLockRules()
);
$this->aux_lock_rules = AuxLockRule::findBySQL('1 ORDER BY name');
//build the sidebar:
......@@ -487,7 +477,8 @@ class Admin_CoursesController extends AuthenticatedController
$data = [];
foreach ($courses as $course_id => $course) {
$sem = new Seminar(Course::buildExisting($course));
$course_model = Course::buildExisting($course);
$sem = new Seminar($course_model);
$row = [];
if (in_array('number', $filter_config)) {
......@@ -541,7 +532,11 @@ class Admin_CoursesController extends AuthenticatedController
}
if (in_array('semester', $filter_config)) {
$row['semester'] = $course->semester_text;
$row['semester'] = $course_model->getTextualSemester();
}
if (in_array('institute', $filter_config)) {
$row['institute'] = $course->home_institut ? $course->home_institut['name'] : $course['institute'];
}
foreach (PluginManager::getInstance()->getPlugins('AdminCourseContents') as $plugin) {
......@@ -1097,6 +1092,7 @@ class Admin_CoursesController extends AuthenticatedController
'type' => _('Veranstaltungstyp'),
'room_time' => _('Raum/Zeit'),
'semester' => _('Semester'),
'institute' => _('Einrichtung'),
'requests' => _('Raumanfragen'),
'teachers' => _('Lehrende'),
'members' => _('Teilnehmende'),
......@@ -1185,7 +1181,7 @@ class Admin_CoursesController extends AuthenticatedController
$filter->where("sem_classes.studygroup_mode = '0'");
// Get only children of given course
if ($params['parent_course']) {
if (!empty($params['parent_course'])) {
$filter->where("parent_course = :parent",
[
'parent' => $params['parent_course']
......@@ -1216,7 +1212,9 @@ class Admin_CoursesController extends AuthenticatedController
$filter->filterByStgTeil($GLOBALS['user']->cfg->MY_COURSES_SELECTED_STGTEIL);
}
if ($params['sortby'] === "status") {
$filter->orderBy(sprintf('sem_classes.name %s, sem_types.name %s, VeranstaltungsNummer', $params['sortFlag'], $params['sortFlag'], $params['sortFlag']), $params['sortFlag']);
$filter->orderBy(sprintf('sem_classes.name %s, sem_types.name %s, VeranstaltungsNummer %s', $params['sortFlag'], $params['sortFlag'], $params['sortFlag']), $params['sortFlag']);
} elseif ($params['sortby'] === 'institute') {
$filter->orderBy('Institute.Name', $params['sortFlag']);
} elseif ($params['sortby']) {
$filter->orderBy($params['sortby'], $params['sortFlag']);
}
......@@ -1228,10 +1226,10 @@ class Admin_CoursesController extends AuthenticatedController
return [];
}
$seminars = array_map('reset', $courses);
if (!empty($seminars)) {
foreach ($seminars as $seminar_id => $seminar) {
$seminars = [];
if (!empty($courses)) {
foreach ($courses as $seminar_id => $seminar) {
$seminars[$seminar_id] = $seminar[0];
$seminars[$seminar_id]['seminar_id'] = $seminar_id;
$seminars[$seminar_id]['obj_type'] = 'sem';
$dozenten = $this->getTeacher($seminar_id);
......@@ -1246,7 +1244,7 @@ class Admin_CoursesController extends AuthenticatedController
$seminars[$seminar_id]['navigation'] = MyRealmModel::getAdditionalNavigations(
$seminar_id,
$seminars[$seminar_id],
$seminars[$seminar_id]['sem_class'],
$seminars[$seminar_id]['sem_class'] ?? null,
$GLOBALS['user']->id,
$visit_data[$seminar_id]
);
......@@ -1257,8 +1255,8 @@ class Admin_CoursesController extends AuthenticatedController
}
if ((int)$this->selected_action === 17) {
$seminars[$seminar_id]['admission_locked'] = false;
if ($seminar['course_set']) {
$set = new CourseSet($seminar['course_set']);
if ($seminar[0]['course_set']) {
$set = new CourseSet($seminar[0]['course_set']);
if (!is_null($set) && $set->hasAdmissionRule('LockedAdmission')) {
$seminars[$seminar_id]['admission_locked'] = 'locked';
} else {
......@@ -1411,7 +1409,6 @@ class Admin_CoursesController extends AuthenticatedController
/**
* Adds HTML-Selector to the sidebar
* @param null $selected_action
* @return string
*/
private function setActionsWidget($selected_action = null)
{
......@@ -1430,7 +1427,6 @@ class Admin_CoursesController extends AuthenticatedController
* Returns a course type widthet depending on all available courses and theirs types
* @param string $selected
* @param array $params
* @return ActionsWidget
*/
private function setCourseTypeWidget($selected = 'all')
{
......@@ -1480,7 +1476,6 @@ class Admin_CoursesController extends AuthenticatedController
/**
* Returns a widget to selected a specific teacher
* @param array $teachers
* @return ActionsWidget|null
*/
private function setTeacherWidget()
{
......@@ -1539,7 +1534,7 @@ class Admin_CoursesController extends AuthenticatedController
*
* @return array containing the filter configuration
*/
private function getFilterConfig()
private function getFilterConfig(): array
{
$available_filters = array_keys($this->getViewFilters());
......