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
Jan-Hendrik Willms
Stud.IP
Commits
8a725a08
Commit
8a725a08
authored
1 year ago
by
Jan-Hendrik Willms
Browse files
Options
Downloads
Patches
Plain Diff
fixes #3070
Closes #3070 Merge request
studip/studip!2054
parent
e8b70555
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/admin/courseplanning.php
+24
-85
24 additions, 85 deletions
app/controllers/admin/courseplanning.php
lib/classes/InstituteCalendarHelper.class.php
+2
-2
2 additions, 2 deletions
lib/classes/InstituteCalendarHelper.class.php
with
26 additions
and
87 deletions
app/controllers/admin/courseplanning.php
+
24
−
85
View file @
8a725a08
...
@@ -768,69 +768,7 @@ class Admin_CourseplanningController extends AuthenticatedController
...
@@ -768,69 +768,7 @@ class Admin_CourseplanningController extends AuthenticatedController
*/
*/
private
function
getCourses
(
$params
=
[],
$display_all
=
false
):
array
private
function
getCourses
(
$params
=
[],
$display_all
=
false
):
array
{
{
// Init
if
(
$GLOBALS
[
'user'
]
->
cfg
->
MY_INSTITUTES_DEFAULT
===
"all"
)
{
$inst
=
new
SimpleCollection
(
$this
->
insts
);
$inst
->
filter
(
function
(
$a
)
use
(
&
$inst_ids
)
{
$inst_ids
[]
=
$a
->
Institut_id
;
});
}
else
{
//We must check, if the institute ID belongs to a faculty
//and has the string _i appended to it.
//In that case we must display the courses of the faculty
//and all its institutes.
//Otherwise we just display the courses of the faculty.
$inst_id
=
$GLOBALS
[
'user'
]
->
cfg
->
MY_INSTITUTES_DEFAULT
;
$institut
=
new
Institute
(
$inst_id
);
if
(
!
$institut
->
isFaculty
()
||
$GLOBALS
[
'user'
]
->
cfg
->
MY_INSTITUTES_INCLUDE_CHILDREN
)
{
// If the institute is not a faculty or the child insts are included,
// pick the institute IDs of the faculty/institute and of all sub-institutes.
$inst_ids
[]
=
$inst_id
;
if
(
$institut
->
isFaculty
())
{
foreach
(
$institut
->
sub_institutes
->
pluck
(
"Institut_id"
)
as
$institut_id
)
{
$inst_ids
[]
=
$institut_id
;
}
}
}
else
{
// If the institute is a faculty and the child insts are not included,
// pick only the institute id of the faculty:
$inst_ids
[]
=
$inst_id
;
}
}
$active_elements
=
$this
->
getActiveElements
();
$filter
=
AdminCourseFilter
::
get
(
true
);
$filter
=
AdminCourseFilter
::
get
(
true
);
$filter
->
where
(
"sem_classes.studygroup_mode = '0'"
);
if
(
is_object
(
$this
->
semester
))
{
$filter
->
filterBySemester
(
$this
->
semester
->
getId
());
}
if
(
$params
[
'typeFilter'
]
&&
$params
[
'typeFilter'
]
!==
"all"
)
{
list
(
$class_filter
,
$type_filter
)
=
explode
(
'_'
,
$params
[
'typeFilter'
]);
if
(
!
$type_filter
&&
!
empty
(
$GLOBALS
[
'SEM_CLASS'
][
$class_filter
]))
{
$type_filter
=
array_keys
(
$GLOBALS
[
'SEM_CLASS'
][
$class_filter
]
->
getSemTypes
());
}
$filter
->
filterByType
(
$type_filter
);
}
if
(
$GLOBALS
[
'user'
]
->
cfg
->
ADMIN_COURSES_TEACHERFILTER
&&
(
$GLOBALS
[
'user'
]
->
cfg
->
ADMIN_COURSES_TEACHERFILTER
!==
"all"
))
{
$filter
->
filterByDozent
(
$GLOBALS
[
'user'
]
->
cfg
->
ADMIN_COURSES_TEACHERFILTER
);
}
if
(
$active_elements
[
'institute'
]
&&
$GLOBALS
[
'user'
]
->
cfg
->
MY_INSTITUTES_DEFAULT
!==
"all"
)
{
$filter
->
filterByInstitute
(
$inst_ids
);
}
if
(
$GLOBALS
[
'user'
]
->
cfg
->
MY_COURSES_SELECTED_STGTEIL
&&
$GLOBALS
[
'user'
]
->
cfg
->
MY_COURSES_SELECTED_STGTEIL
!==
'all'
)
{
$filter
->
filterByStgTeil
(
$GLOBALS
[
'user'
]
->
cfg
->
MY_COURSES_SELECTED_STGTEIL
);
}
$filter
->
storeSettings
();
$this
->
count_courses
=
$filter
->
countCourses
();
$this
->
count_courses
=
$filter
->
countCourses
();
if
(
$this
->
count_courses
&&
(
$this
->
count_courses
<=
$filter
->
max_show_courses
||
$display_all
))
{
if
(
$this
->
count_courses
&&
(
$this
->
count_courses
<=
$filter
->
max_show_courses
||
$display_all
))
{
$courses
=
$filter
->
getCourses
();
$courses
=
$filter
->
getCourses
();
...
@@ -842,41 +780,42 @@ class Admin_CourseplanningController extends AuthenticatedController
...
@@ -842,41 +780,42 @@ class Admin_CourseplanningController extends AuthenticatedController
$sem_types
=
SemType
::
getTypes
();
$sem_types
=
SemType
::
getTypes
();
}
}
$seminars
=
array_map
(
'current'
,
$courses
);
$seminars
=
[];
foreach
(
$courses
as
$course
)
{
$seminars
[
$course
->
id
]
=
$course
->
toArray
();
foreach
(
$seminars
as
$seminar_id
=>
$seminar
)
{
$seminars
[
$course
->
id
][
'seminar_id'
]
=
$course
->
id
;
$seminars
[
$seminar_id
][
'seminar_id'
]
=
$seminar_id
;
$seminars
[
$course
->
id
][
'obj_type'
]
=
'sem'
;
$seminars
[
$seminar_id
][
'obj_type'
]
=
'sem'
;
$dozenten
=
$this
->
getTeacher
(
$course
->
id
);
$dozenten
=
$this
->
getTeacher
(
$seminar_id
);
$seminars
[
$course
->
id
][
'dozenten'
]
=
$dozenten
;
$seminars
[
$seminar_id
][
'dozenten'
]
=
$dozenten
;
if
(
in_array
(
'contents'
,
$params
[
'view_filter'
]))
{
if
(
in_array
(
'contents'
,
$params
[
'view_filter'
]))
{
$tools
=
new
SimpleCollection
(
ToolActivation
::
findbyRange_id
(
$
seminar_
id
,
"ORDER BY position"
));
$tools
=
new
SimpleCollection
(
ToolActivation
::
findbyRange_id
(
$
course
->
id
,
"ORDER BY position"
));
$visit_data
=
get_objects_visits
([
$
seminar_
id
],
0
,
null
,
null
,
$tools
->
pluck
(
'plugin_id'
));
$visit_data
=
get_objects_visits
([
$
course
->
id
],
0
,
null
,
null
,
$tools
->
pluck
(
'plugin_id'
));
$seminars
[
$
seminar_
id
][
'tools'
]
=
$tools
;
$seminars
[
$
course
->
id
][
'tools'
]
=
$tools
;
$seminars
[
$
seminar_
id
][
'visitdate'
]
=
$visit_data
[
$
seminar_
id
][
0
][
'visitdate'
];
$seminars
[
$
course
->
id
][
'visitdate'
]
=
$visit_data
[
$
course
->
id
][
0
][
'visitdate'
];
$seminars
[
$
seminar_
id
][
'last_visitdate'
]
=
$visit_data
[
$
seminar_
id
][
0
][
'last_visitdate'
];
$seminars
[
$
course
->
id
][
'last_visitdate'
]
=
$visit_data
[
$
course
->
id
][
0
][
'last_visitdate'
];
$seminars
[
$
seminar_
id
][
'sem_class'
]
=
$sem_types
[
$
seminar
[
'
status
'
]
]
->
getClass
();
$seminars
[
$
course
->
id
][
'sem_class'
]
=
$sem_types
[
$
course
->
status
]
->
getClass
();
$seminars
[
$
seminar_
id
][
'navigation'
]
=
MyRealmModel
::
getAdditionalNavigations
(
$seminars
[
$
course
->
id
][
'navigation'
]
=
MyRealmModel
::
getAdditionalNavigations
(
$
seminar_
id
,
$
course
->
id
,
$seminars
[
$
seminar_
id
],
$seminars
[
$
course
->
id
],
$seminars
[
$
seminar_
id
][
'sem_class'
],
$seminars
[
$
course
->
id
][
'sem_class'
],
$GLOBALS
[
'user'
]
->
id
,
$GLOBALS
[
'user'
]
->
id
,
$visit_data
[
$
seminar_
id
]
$visit_data
[
$
course
->
id
]
);
);
}
}
//add last activity column:
//add last activity column:
if
(
in_array
(
'last_activity'
,
$params
[
'view_filter'
]))
{
if
(
in_array
(
'last_activity'
,
$params
[
'view_filter'
]))
{
$seminars
[
$
seminar_
id
][
'last_activity'
]
=
lastActivity
(
$
seminar_
id
);
$seminars
[
$
course
->
id
][
'last_activity'
]
=
lastActivity
(
$
course
->
id
);
}
}
if
(
$this
->
selected_action
==
17
)
{
if
(
$this
->
selected_action
==
17
)
{
$seminars
[
$
seminar_
id
][
'admission_locked'
]
=
false
;
$seminars
[
$
course
->
id
][
'admission_locked'
]
=
false
;
if
(
$
seminar
[
'
course_set
'
]
)
{
if
(
$
course
->
course_set
)
{
$set
=
new
CourseSet
(
$
seminar
[
'
course_set
'
]
);
$set
=
new
CourseSet
(
$
course
->
course_set
);
if
(
!
is_null
(
$set
)
&&
$set
->
hasAdmissionRule
(
'LockedAdmission'
))
{
if
(
!
is_null
(
$set
)
&&
$set
->
hasAdmissionRule
(
'LockedAdmission'
))
{
$seminars
[
$
seminar_
id
][
'admission_locked'
]
=
'locked'
;
$seminars
[
$
course
->
id
][
'admission_locked'
]
=
'locked'
;
}
else
{
}
else
{
$seminars
[
$
seminar_
id
][
'admission_locked'
]
=
'disable'
;
$seminars
[
$
course
->
id
][
'admission_locked'
]
=
'disable'
;
}
}
unset
(
$set
);
unset
(
$set
);
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/classes/InstituteCalendarHelper.class.php
+
2
−
2
View file @
8a725a08
...
@@ -346,8 +346,8 @@ class InstituteCalendarHelper
...
@@ -346,8 +346,8 @@ class InstituteCalendarHelper
)
{
)
{
$semtype
=
$course
->
getSemType
();
$semtype
=
$course
->
getSemType
();
$event_columns
=
self
::
getCourseEventcolumns
(
$course
);
$event_columns
=
self
::
getCourseEventcolumns
(
$course
)
?:
[]
;
$event_colors
=
self
::
getCourseEventcolors
(
$course
);
$event_colors
=
self
::
getCourseEventcolors
(
$course
)
?:
[]
;
if
(
in_array
(
$course
->
institut_id
,
$user_insts
))
{
if
(
in_array
(
$course
->
institut_id
,
$user_insts
))
{
$is_editable
=
true
;
$is_editable
=
true
;
...
...
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