Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcus Eibrink-Lunzenauer
Stud.IP
Commits
4d98ebd6
Commit
4d98ebd6
authored
1 year ago
by
André Noack
Committed by
David Siegfried
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Resolve #3989 "Filter "Vorletztes und aktuelles Semester" für meine Veranstaltungen"
Closes #3989 Merge request
studip/studip!2838
parent
81d4d624
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/my_courses.php
+5
-1
5 additions, 1 deletion
app/controllers/my_courses.php
lib/classes/MyRealmModel.php
+16
-6
16 additions, 6 deletions
lib/classes/MyRealmModel.php
with
21 additions
and
7 deletions
app/controllers/my_courses.php
+
5
−
1
View file @
4d98ebd6
...
@@ -344,7 +344,10 @@ class MyCoursesController extends AuthenticatedController
...
@@ -344,7 +344,10 @@ class MyCoursesController extends AuthenticatedController
$semesters
=
MyRealmModel
::
getSelectedSemesters
(
$sem
);
$semesters
=
MyRealmModel
::
getSelectedSemesters
(
$sem
);
$min_sem_key
=
min
(
$semesters
);
$min_sem_key
=
min
(
$semesters
);
$max_sem_key
=
max
(
$semesters
);
$max_sem_key
=
max
(
$semesters
);
$courses
=
MyRealmModel
::
getCourses
(
$min_sem_key
,
$max_sem_key
,
compact
(
'deputies_enabled'
));
$courses
=
MyRealmModel
::
getCourses
(
$min_sem_key
,
$max_sem_key
,
[
'deputies_enabled'
=>
$deputies_enabled
,
'exactly'
=>
$semesters
,
]);
foreach
(
$courses
as
$index
=>
$course
)
{
foreach
(
$courses
as
$index
=>
$course
)
{
MyRealmModel
::
setObjectVisits
(
$course
,
$GLOBALS
[
'user'
]
->
id
,
$timestamp
);
MyRealmModel
::
setObjectVisits
(
$course
,
$GLOBALS
[
'user'
]
->
id
,
$timestamp
);
}
}
...
@@ -1168,6 +1171,7 @@ class MyCoursesController extends AuthenticatedController
...
@@ -1168,6 +1171,7 @@ class MyCoursesController extends AuthenticatedController
'future'
=>
_
(
'Aktuelles und nächstes Semester'
),
'future'
=>
_
(
'Aktuelles und nächstes Semester'
),
'last'
=>
_
(
'Aktuelles und letztes Semester'
),
'last'
=>
_
(
'Aktuelles und letztes Semester'
),
'lastandnext'
=>
_
(
'Letztes, aktuelles, nächstes Semester'
),
'lastandnext'
=>
_
(
'Letztes, aktuelles, nächstes Semester'
),
'lastbutone'
=>
_
(
'Aktuelles und vorletztes Semester'
),
];
];
if
(
Config
::
get
()
->
MY_COURSES_ENABLE_ALL_SEMESTERS
)
{
if
(
Config
::
get
()
->
MY_COURSES_ENABLE_ALL_SEMESTERS
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/classes/MyRealmModel.php
+
16
−
6
View file @
4d98ebd6
...
@@ -163,16 +163,22 @@ class MyRealmModel
...
@@ -163,16 +163,22 @@ class MyRealmModel
public
static
function
getCourses
(
$min_sem_key
,
$max_sem_key
,
$params
=
[])
public
static
function
getCourses
(
$min_sem_key
,
$max_sem_key
,
$params
=
[])
{
{
// init
// init
$order_by
=
$params
[
'order_by'
]
??
null
;
$order_by
=
$params
[
'order_by'
]
??
null
;
$order
=
$params
[
'order'
]
??
null
;
$order
=
$params
[
'order'
]
??
null
;
$deputies_enabled
=
$params
[
'deputies_enabled'
];
$deputies_enabled
=
$params
[
'deputies_enabled'
];
$sem_data
=
Semester
::
getAllAsArray
();
$sem_data
=
Semester
::
getAllAsArray
();
$semester_ids
=
[];
$semester_ids
=
[];
if
(
is_numeric
(
$min_sem_key
)
&&
is_numeric
(
$max_sem_key
))
{
if
(
is_numeric
(
$min_sem_key
)
&&
is_numeric
(
$max_sem_key
))
{
foreach
(
$sem_data
as
$index
=>
$data
)
{
foreach
(
$sem_data
as
$index
=>
$data
)
{
if
(
$index
>=
$min_sem_key
&&
$index
<=
$max_sem_key
)
{
if
(
$index
>=
$min_sem_key
&&
$index
<=
$max_sem_key
&&
(
!
isset
(
$params
[
'exactly'
])
||
in_array
(
$index
,
$params
[
'exactly'
])
)
)
{
$semester_ids
[]
=
$data
[
'semester_id'
]
??
''
;
$semester_ids
[]
=
$data
[
'semester_id'
]
??
''
;
}
}
}
}
...
@@ -244,7 +250,7 @@ class MyRealmModel
...
@@ -244,7 +250,7 @@ class MyRealmModel
}
}
// Get the needed semester
// Get the needed semester
if
(
!
in_array
(
$sem
,
[
''
,
'current'
,
'future'
,
'last'
,
'lastandnext'
]))
{
if
(
!
in_array
(
$sem
,
[
''
,
'current'
,
'future'
,
'last'
,
'lastandnext'
,
'lastbutone'
]))
{
$semesters
[]
=
Semester
::
getIndexById
(
$sem
);
$semesters
[]
=
Semester
::
getIndexById
(
$sem
);
}
else
{
}
else
{
switch
(
$sem
)
{
switch
(
$sem
)
{
...
@@ -264,6 +270,10 @@ class MyRealmModel
...
@@ -264,6 +270,10 @@ class MyRealmModel
$semesters
[]
=
$current_sem
;
$semesters
[]
=
$current_sem
;
$semesters
[]
=
$max_sem
;
$semesters
[]
=
$max_sem
;
break
;
break
;
case
'lastbutone'
:
$semesters
[]
=
$current_sem
-
2
;
$semesters
[]
=
$current_sem
;
break
;
default
:
default
:
$semesters
=
array_keys
(
$sem_data
);
$semesters
=
array_keys
(
$sem_data
);
break
;
break
;
...
@@ -287,7 +297,7 @@ class MyRealmModel
...
@@ -287,7 +297,7 @@ class MyRealmModel
$min_sem_key
=
min
(
$semesters
);
$min_sem_key
=
min
(
$semesters
);
$max_sem_key
=
max
(
$semesters
);
$max_sem_key
=
max
(
$semesters
);
$group_field
=
$params
[
'group_field'
];
$group_field
=
$params
[
'group_field'
];
$courses
=
self
::
getCourses
(
$min_sem_key
,
$max_sem_key
,
$params
);
$courses
=
self
::
getCourses
(
$min_sem_key
,
$max_sem_key
,
$params
+
[
'exactly'
=>
$semesters
]
);
$show_semester_name
=
UserConfig
::
get
(
$GLOBALS
[
'user'
]
->
id
)
->
SHOWSEM_ENABLE
;
$show_semester_name
=
UserConfig
::
get
(
$GLOBALS
[
'user'
]
->
id
)
->
SHOWSEM_ENABLE
;
$sem_courses
=
[];
$sem_courses
=
[];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment