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
a0f3af1a
Commit
a0f3af1a
authored
6 months ago
by
Jan-Hendrik Willms
Browse files
Options
Downloads
Patches
Plain Diff
actually reset settings for admin course filter, fixes #4515
Closes #4515 Merge request
studip/studip!3304
parent
96a057e7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/classes/AdminCourseFilter.php
+26
-20
26 additions, 20 deletions
lib/classes/AdminCourseFilter.php
with
26 additions
and
20 deletions
lib/classes/AdminCourseFilter.php
+
26
−
20
View file @
a0f3af1a
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
*/
*/
class
AdminCourseFilter
class
AdminCourseFilter
{
{
static
protected
$instance
=
null
;
protected
static
$instance
=
null
;
/** @var SQLQuery|null */
/** @var SQLQuery|null */
public
$query
=
null
;
public
$query
=
null
;
...
@@ -38,11 +38,14 @@ class AdminCourseFilter
...
@@ -38,11 +38,14 @@ class AdminCourseFilter
* returns an AdminCourseFilter singleton object
* returns an AdminCourseFilter singleton object
* @return AdminCourseFilter or derived-class object
* @return AdminCourseFilter or derived-class object
*/
*/
static
publ
ic
function
get
(
$reset_settings
=
false
)
public
stat
ic
function
get
(
$reset_settings
=
false
)
{
{
if
(
$reset_settings
)
{
return
new
static
(
$reset_settings
);
}
if
(
!
self
::
$instance
)
{
if
(
!
self
::
$instance
)
{
$class
=
get_called_class
();
self
::
$instance
=
new
static
(
$reset_settings
);
self
::
$instance
=
new
$class
(
$reset_settings
);
}
}
return
self
::
$instance
;
return
self
::
$instance
;
}
}
...
@@ -50,12 +53,12 @@ class AdminCourseFilter
...
@@ -50,12 +53,12 @@ class AdminCourseFilter
/**
/**
* Constructor of the singleton-object.
* Constructor of the singleton-object.
*/
*/
public
function
__construct
()
public
function
__construct
(
bool
$reset_settings
=
false
)
{
{
$this
->
initSettings
();
$this
->
initSettings
(
$reset_settings
);
}
}
protected
function
initSettings
(
)
protected
function
initSettings
(
bool
$reset_settings
=
false
):
void
{
{
$this
->
query
=
SQLQuery
::
table
(
'seminare'
);
$this
->
query
=
SQLQuery
::
table
(
'seminare'
);
$this
->
query
->
join
(
'sem_types'
,
'sem_types'
,
'sem_types.id = seminare.status'
);
$this
->
query
->
join
(
'sem_types'
,
'sem_types'
,
'sem_types.id = seminare.status'
);
...
@@ -63,7 +66,7 @@ class AdminCourseFilter
...
@@ -63,7 +66,7 @@ class AdminCourseFilter
$this
->
query
->
where
(
"sem_classes.studygroup_mode = '0'"
);
$this
->
query
->
where
(
"sem_classes.studygroup_mode = '0'"
);
$this
->
query
->
groupBy
(
'seminare.Seminar_id'
);
$this
->
query
->
groupBy
(
'seminare.Seminar_id'
);
if
(
$GLOBALS
[
'user'
]
->
cfg
->
ADMIN_COURSES_SEARCHTEXT
)
{
if
(
!
$reset_settings
&&
$GLOBALS
[
'user'
]
->
cfg
->
ADMIN_COURSES_SEARCHTEXT
)
{
$this
->
query
->
join
(
'teachers_su'
,
'seminar_user'
,
"teachers_su.Seminar_id = seminare.Seminar_id AND teachers_su.status = 'dozent'"
);
$this
->
query
->
join
(
'teachers_su'
,
'seminar_user'
,
"teachers_su.Seminar_id = seminare.Seminar_id AND teachers_su.status = 'dozent'"
);
$this
->
query
->
join
(
'teachers'
,
'auth_user_md5'
,
'teachers.user_id = teachers_su.user_id'
);
$this
->
query
->
join
(
'teachers'
,
'auth_user_md5'
,
'teachers.user_id = teachers_su.user_id'
);
$this
->
query
->
where
(
$this
->
query
->
where
(
...
@@ -72,7 +75,7 @@ class AdminCourseFilter
...
@@ -72,7 +75,7 @@ class AdminCourseFilter
[
'search'
=>
'%'
.
$GLOBALS
[
'user'
]
->
cfg
->
ADMIN_COURSES_SEARCHTEXT
.
'%'
]
[
'search'
=>
'%'
.
$GLOBALS
[
'user'
]
->
cfg
->
ADMIN_COURSES_SEARCHTEXT
.
'%'
]
);
);
}
}
if
(
Request
::
option
(
'course_id'
))
{
if
(
!
$reset_settings
&&
Request
::
option
(
'course_id'
))
{
$this
->
query
->
where
(
'course_id'
,
'seminare.Seminar_id = :course_id'
,
[
'course_id'
=>
Request
::
option
(
'course_id'
)]);
$this
->
query
->
where
(
'course_id'
,
'seminare.Seminar_id = :course_id'
,
[
'course_id'
=>
Request
::
option
(
'course_id'
)]);
}
}
$inst_ids
=
[];
$inst_ids
=
[];
...
@@ -114,7 +117,10 @@ class AdminCourseFilter
...
@@ -114,7 +117,10 @@ class AdminCourseFilter
]);
]);
}
}
if
(
$GLOBALS
[
'user'
]
->
cfg
->
MY_COURSES_TYPE_FILTER
&&
$GLOBALS
[
'user'
]
->
cfg
->
MY_COURSES_TYPE_FILTER
!==
'all'
)
{
if
(
$GLOBALS
[
'user'
]
->
cfg
->
MY_COURSES_TYPE_FILTER
&&
$GLOBALS
[
'user'
]
->
cfg
->
MY_COURSES_TYPE_FILTER
!==
'all'
)
{
if
(
str_contains
(
$GLOBALS
[
'user'
]
->
cfg
->
MY_COURSES_TYPE_FILTER
,
'_'
))
{
if
(
str_contains
(
$GLOBALS
[
'user'
]
->
cfg
->
MY_COURSES_TYPE_FILTER
,
'_'
))
{
list
(
$sem_class_id
,
$sem_type_id
)
=
explode
(
'_'
,
$GLOBALS
[
'user'
]
->
cfg
->
MY_COURSES_TYPE_FILTER
);
list
(
$sem_class_id
,
$sem_type_id
)
=
explode
(
'_'
,
$GLOBALS
[
'user'
]
->
cfg
->
MY_COURSES_TYPE_FILTER
);
$this
->
query
->
where
(
'course_type'
,
'seminare.status = :course_type'
,
[
'course_type'
=>
$sem_type_id
]);
$this
->
query
->
where
(
'course_type'
,
'seminare.status = :course_type'
,
[
'course_type'
=>
$sem_type_id
]);
...
@@ -149,16 +155,16 @@ class AdminCourseFilter
...
@@ -149,16 +155,16 @@ class AdminCourseFilter
);
);
}
}
if
(
!
$reset_settings
)
{
$datafields_filters
=
$GLOBALS
[
'user'
]
->
cfg
->
ADMIN_COURSES_DATAFIELDS_FILTERS
;
$datafields_filters
=
$GLOBALS
[
'user'
]
->
cfg
->
ADMIN_COURSES_DATAFIELDS_FILTERS
;
foreach
(
$datafields_filters
as
$datafield_id
=>
$value
)
{
foreach
(
$datafields_filters
as
$datafield_id
=>
$value
)
{
$this
->
query
->
join
(
'de_'
.
$datafield_id
,
'datafields_entries'
,
'de_'
.
$datafield_id
.
'.range_id = seminare.Seminar_id AND `de_'
.
$datafield_id
.
'`.datafield_id = :de_'
.
$datafield_id
.
'_id'
);
$this
->
query
->
join
(
'de_'
.
$datafield_id
,
'datafields_entrie
s'
,
'de_'
.
$datafield_id
.
'.range_id = seminare.Seminar_id AND `de_'
.
$datafield_id
.
'`.datafield_id =
:de_'
.
$datafield_id
.
'_id'
);
$this
->
query
->
where
(
'de_'
.
$datafield_id
.
'_content
s'
,
'de_'
.
$datafield_id
.
'.`content` LIKE
:de_'
.
$datafield_id
.
'_content'
,
$this
->
query
->
where
(
'de_'
.
$datafield_id
.
'_contents'
,
'de_'
.
$datafield_id
.
'.`content` LIKE :de_'
.
$datafield_id
.
'_content'
,
[
[
'de_'
.
$datafield_id
.
'_id'
=>
$datafield_id
,
'de_'
.
$datafield_id
.
'_
id'
=>
$datafield_id
,
'de_'
.
$datafield_id
.
'_
content'
=>
'%'
.
$value
.
'%'
'de_'
.
$datafield_id
.
'_content'
=>
'%'
.
$value
.
'%'
]);
]);
}
}
}
}
}
...
...
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