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
afb530bc
Commit
afb530bc
authored
11 months ago
by
David Siegfried
Committed by
Jan-Hendrik Willms
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fixes #3996
Closes #3996 Merge request
studip/studip!2846
parent
e3a70de2
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
app/controllers/admin/courses.php
+0
-163
0 additions, 163 deletions
app/controllers/admin/courses.php
with
0 additions
and
163 deletions
app/controllers/admin/courses.php
+
0
−
163
View file @
afb530bc
...
...
@@ -1447,169 +1447,6 @@ class Admin_CoursesController extends AuthenticatedController
return
$views
;
}
/**
* Returns all courses matching set criteria.
*
* @param array $params Additional parameters
* @param bool $display_all : boolean should we show all courses or check for a limit of 500 courses?
* @return array of courses
*/
private
function
getCourses
(
$params
=
[],
$display_all
=
false
)
{
// 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
);
if
(
$params
[
'datafields'
])
{
foreach
(
$params
[
'datafields'
]
as
$field_id
=>
$value
)
{
$datafield
=
DataField
::
find
(
$field_id
);
if
(
$datafield
)
{
//enable filtering by datafield values:
//and use the where-clause for each datafield:
$filter
->
settings
[
'query'
][
'joins'
][
'de_'
.
$field_id
]
=
[
'table'
=>
"datafields_entries"
,
'join'
=>
"LEFT JOIN"
,
'on'
=>
"seminare.seminar_id = de_"
.
$field_id
.
".range_id"
];
$filter
->
where
(
"(de_"
.
$field_id
.
".datafield_id = :fieldId_"
.
$field_id
.
" "
.
"AND de_"
.
$field_id
.
".content = :fieldValue_"
.
$field_id
.
") "
.
(
$datafield
[
'default_value'
]
==
$value
?
" OR (de_"
.
$field_id
.
".content IS NULL)"
:
""
)
.
" "
,
[
'fieldId_'
.
$field_id
=>
$field_id
,
'fieldValue_'
.
$field_id
=>
$value
]
);
}
}
}
$filter
->
where
(
"sem_classes.studygroup_mode = '0'"
);
// Get only children of given course
if
(
!
empty
(
$params
[
'parent_course'
]))
{
$filter
->
where
(
"parent_course = :parent"
,
[
'parent'
=>
$params
[
'parent_course'
]
]
);
}
if
(
$active_elements
[
'semester'
]
&&
is_object
(
$this
->
semester
))
{
$filter
->
filterBySemester
(
$this
->
semester
->
getId
());
}
if
(
$active_elements
[
'courseType'
]
&&
$params
[
'typeFilter'
]
&&
$params
[
'typeFilter'
]
!==
"all"
)
{
$parts
=
explode
(
'_'
,
$params
[
'typeFilter'
]);
$class_filter
=
$parts
[
0
];
$type_filter
=
$parts
[
1
]
??
null
;
if
(
!
$type_filter
&&
!
empty
(
$GLOBALS
[
'SEM_CLASS'
][
$class_filter
]))
{
$type_filter
=
array_keys
(
$GLOBALS
[
'SEM_CLASS'
][
$class_filter
]
->
getSemTypes
());
}
$filter
->
filterByType
(
$type_filter
);
}
if
(
$active_elements
[
'search'
]
&&
$GLOBALS
[
'user'
]
->
cfg
->
ADMIN_COURSES_SEARCHTEXT
)
{
$filter
->
filterBySearchString
(
$GLOBALS
[
'user'
]
->
cfg
->
ADMIN_COURSES_SEARCHTEXT
);
}
if
(
$active_elements
[
'teacher'
]
&&
$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'
])
{
$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
);
}
if
(
$params
[
'sortby'
]
===
"status"
)
{
$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'
]);
}
$filter
->
storeSettings
();
$this
->
count_courses
=
$filter
->
countCourses
();
if
(
$this
->
count_courses
&&
(
$this
->
count_courses
<=
$filter
->
max_show_courses
||
$display_all
))
{
$courses
=
$filter
->
getCourses
();
}
else
{
return
[];
}
$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
);
$seminars
[
$seminar_id
][
'dozenten'
]
=
$dozenten
;
if
(
in_array
(
'contents'
,
$params
[
'view_filter'
]))
{
$tools
=
new
SimpleCollection
(
ToolActivation
::
findbyRange_id
(
$seminar_id
,
"ORDER BY position"
));
$visit_data
=
get_objects_visits
([
$seminar_id
],
0
,
null
,
null
,
$tools
->
pluck
(
'plugin_id'
));
$seminars
[
$seminar_id
][
'visitdate'
]
=
$visit_data
[
$seminar_id
][
0
][
'visitdate'
];
$seminars
[
$seminar_id
][
'last_visitdate'
]
=
$visit_data
[
$seminar_id
][
0
][
'last_visitdate'
];
$seminars
[
$seminar_id
][
'tools'
]
=
$tools
;
$seminars
[
$seminar_id
][
'navigation'
]
=
MyRealmModel
::
getAdditionalNavigations
(
$seminar_id
,
$seminars
[
$seminar_id
],
$seminars
[
$seminar_id
][
'sem_class'
]
??
null
,
$GLOBALS
[
'user'
]
->
id
,
$visit_data
[
$seminar_id
]
);
}
//add last activity column:
if
(
in_array
(
'last_activity'
,
$params
[
'view_filter'
]))
{
$seminars
[
$seminar_id
][
'last_activity'
]
=
lastActivity
(
$seminar_id
);
}
if
((
int
)
$this
->
selected_action
===
17
)
{
$seminars
[
$seminar_id
][
'admission_locked'
]
=
false
;
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
{
$seminars
[
$seminar_id
][
'admission_locked'
]
=
'disable'
;
}
unset
(
$set
);
}
}
}
}
return
$seminars
;
}
/**
* Returns the teacher for a given cours
...
...
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