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
bd60f4a8
Commit
bd60f4a8
authored
2 years ago
by
Jan-Hendrik Willms
Committed by
David Siegfried
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix php8 errors and warnings on my courses page, fixes #2232
Closes #2232 Merge request
studip/studip!1462
parent
b7ce03e2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/controllers/my_courses.php
+2
-2
2 additions, 2 deletions
app/controllers/my_courses.php
lib/classes/MyRealmModel.php
+21
-5
21 additions, 5 deletions
lib/classes/MyRealmModel.php
lib/models/StudipStudyArea.class.php
+1
-1
1 addition, 1 deletion
lib/models/StudipStudyArea.class.php
with
24 additions
and
8 deletions
app/controllers/my_courses.php
+
2
−
2
View file @
bd60f4a8
...
@@ -603,7 +603,7 @@ class MyCoursesController extends AuthenticatedController
...
@@ -603,7 +603,7 @@ class MyCoursesController extends AuthenticatedController
if
(
is_array
(
$courses
))
{
if
(
is_array
(
$courses
))
{
if
(
$group_field
!==
'sem_number'
)
{
if
(
$group_field
!==
'sem_number'
)
{
// tlx: If array is 2-dimensional, merge it into a 1-dimensional
// tlx: If array is 2-dimensional, merge it into a 1-dimensional
$courses
=
call_user_func_array
(
'array_merge'
,
$courses
);
$courses
=
array_merge
(
...
array_values
(
$courses
)
)
;
}
}
foreach
(
$courses
as
$course
)
{
foreach
(
$courses
as
$course
)
{
...
@@ -753,7 +753,7 @@ class MyCoursesController extends AuthenticatedController
...
@@ -753,7 +753,7 @@ class MyCoursesController extends AuthenticatedController
foreach
(
$_inner
as
$course
)
{
foreach
(
$_inner
as
$course
)
{
$_courses
[
$course
[
'seminar_id'
]]
=
$course
;
$_courses
[
$course
[
'seminar_id'
]]
=
$course
;
if
(
$course
[
'children'
])
{
if
(
isset
(
$course
[
'children'
])
&&
is_array
(
$couse
[
'children'
]))
{
foreach
(
$course
[
'children'
]
as
$child
)
{
foreach
(
$course
[
'children'
]
as
$child
)
{
$_courses
[
$child
[
'seminar_id'
]]
=
$child
;
$_courses
[
$child
[
'seminar_id'
]]
=
$child
;
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/classes/MyRealmModel.php
+
21
−
5
View file @
bd60f4a8
...
@@ -634,7 +634,12 @@ class MyRealmModel
...
@@ -634,7 +634,12 @@ class MyRealmModel
*/
*/
public
static
function
groupBySemTree
(
&
$sem_courses
)
public
static
function
groupBySemTree
(
&
$sem_courses
)
{
{
$_tmp_courses
=
[];
foreach
(
$sem_courses
as
$sem_key
=>
$collection
)
{
foreach
(
$sem_courses
as
$sem_key
=>
$collection
)
{
if
(
!
isset
(
$_tmp_courses
[
$sem_key
]))
{
$_tmp_courses
[
$sem_key
]
=
[];
}
//We have to store the sem_tree names separately
//We have to store the sem_tree names separately
//since we first need the sem_tree IDs as array keys.
//since we first need the sem_tree IDs as array keys.
//This makes it more easy to get the ordering
//This makes it more easy to get the ordering
...
@@ -644,10 +649,18 @@ class MyRealmModel
...
@@ -644,10 +649,18 @@ class MyRealmModel
if
(
!
empty
(
$course
[
'sem_tree'
]))
{
if
(
!
empty
(
$course
[
'sem_tree'
]))
{
foreach
(
$course
[
'sem_tree'
]
as
$tree
)
{
foreach
(
$course
[
'sem_tree'
]
as
$tree
)
{
$sem_tree_names
[
$tree
[
'sem_tree_id'
]]
=
$tree
[
'name'
];
$sem_tree_names
[
$tree
[
'sem_tree_id'
]]
=
$tree
[
'name'
];
if
(
!
isset
(
$_tmp_courses
[
$sem_key
][(
string
)
$tree
[
'sem_tree_id'
]]))
{
$_tmp_courses
[
$sem_key
][(
string
)
$tree
[
'sem_tree_id'
]]
=
[];
}
$_tmp_courses
[
$sem_key
][(
string
)
$tree
[
'sem_tree_id'
]][
$course
[
'seminar_id'
]]
=
$course
;
$_tmp_courses
[
$sem_key
][(
string
)
$tree
[
'sem_tree_id'
]][
$course
[
'seminar_id'
]]
=
$course
;
}
}
}
else
{
}
else
{
$_tmp_courses
[
$sem_key
][
""
][
$course
[
'seminar_id'
]]
=
$course
;
if
(
!
isset
(
$_tmp_courses
[
$sem_key
][
''
]))
{
$_tmp_courses
[
$sem_key
][
''
]
=
[];
}
$_tmp_courses
[
$sem_key
][
''
][
$course
[
'seminar_id'
]]
=
$course
;
}
}
}
}
uksort
(
$_tmp_courses
[
$sem_key
],
function
(
$a
,
$b
)
use
(
$sem_tree_names
)
{
uksort
(
$_tmp_courses
[
$sem_key
],
function
(
$a
,
$b
)
use
(
$sem_tree_names
)
{
...
@@ -655,8 +668,7 @@ class MyRealmModel
...
@@ -655,8 +668,7 @@ class MyRealmModel
'StudipSemTree'
,
'StudipSemTree'
,
[
'build_index'
=>
true
]
[
'build_index'
=>
true
]
);
);
return
(
int
)(
$the_tree
->
tree_data
[
$a
][
'index'
]
return
(
int
)(
$the_tree
->
tree_data
[
$a
][
'index'
]
??
0
-
$the_tree
->
tree_data
[
$b
][
'index'
]
??
0
);
-
$the_tree
->
tree_data
[
$b
][
'index'
]);
});
});
//At this point the $_tmp_courses array is sorted by the ordering
//At this point the $_tmp_courses array is sorted by the ordering
//of the sem_tree.
//of the sem_tree.
...
@@ -664,9 +676,13 @@ class MyRealmModel
...
@@ -664,9 +676,13 @@ class MyRealmModel
//of the $_tmp_courses array with the sem_tree names:
//of the $_tmp_courses array with the sem_tree names:
foreach
(
$_tmp_courses
[
$sem_key
]
as
$sem_tree_id
=>
$courses
)
{
foreach
(
$_tmp_courses
[
$sem_key
]
as
$sem_tree_id
=>
$courses
)
{
foreach
(
$courses
as
$course
)
{
foreach
(
$courses
as
$course
)
{
$_tmp_courses
[
$sem_key
][(
string
)
$sem_tree_names
[
$sem_tree_id
]][
$course
[
'seminar_id'
]]
=
$course
;
$index
=
(
string
)(
$sem_tree_names
[
$sem_tree_id
]
??
''
);
if
(
!
isset
(
$_tmp_courses
[
$sem_key
][
$index
]))
{
$_tmp_courses
[
$sem_key
][
$index
]
=
[];
}
$_tmp_courses
[
$sem_key
][
$index
][
$course
[
'seminar_id'
]]
=
$course
;
}
}
if
(
$sem_tree_names
[
$sem_tree_id
])
{
if
(
isset
(
$sem_tree_names
[
$sem_tree_id
])
)
{
unset
(
$_tmp_courses
[
$sem_key
][
$sem_tree_id
]);
unset
(
$_tmp_courses
[
$sem_key
][
$sem_tree_id
]);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/models/StudipStudyArea.class.php
+
1
−
1
View file @
bd60f4a8
...
@@ -127,7 +127,7 @@ class StudipStudyArea extends SimpleORMap
...
@@ -127,7 +127,7 @@ class StudipStudyArea extends SimpleORMap
public
function
getName
()
public
function
getName
()
{
{
if
(
$this
->
studip_object_id
)
{
if
(
$this
->
studip_object_id
)
{
return
$this
->
institute
->
name
;
return
$this
->
institute
?
$this
->
institute
->
name
:
_
(
'Unbekannte Einrichtung'
)
;
}
}
return
$this
->
content
[
'name'
];
return
$this
->
content
[
'name'
];
}
}
...
...
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