Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iena
iena-path-block
Commits
c4102d46
Commit
c4102d46
authored
Jul 06, 2021
by
Lea
Browse files
add function gat_all_path_list
parent
70e006e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
block_career.php
View file @
c4102d46
...
...
@@ -51,6 +51,15 @@ class block_career extends block_base
{
return
true
;
}
function
get_all_path_list
(
$course_id
){
global
$DB
;
$list
=
array
();
$request
=
$DB
->
get_records_sql
(
'SELECT * FROM {block_career} WHERE course = ?'
,
array
(
$course_id
));
foreach
(
$request
as
$value
){
array_push
(
$list
,
$value
);
}
return
$list
;
}
function
get_path_list
(
$course_id
,
$user_id
){
global
$DB
;
...
...
@@ -93,8 +102,15 @@ class block_career extends block_base
$this
->
content
->
text
.
=
'<div class="list-group career-list-group font-weight-light">'
;
$this
->
content
->
text
.
=
'<a href="'
.
$CFG
->
wwwroot
.
'/course/view.php?id='
.
$COURSE
->
id
.
'" class="list-group-item list-group-item-success list-group-item-action" style="border-top-left-radius: .15rem; border-top-right-radius: .15rem; border-top: none;">Accueil du cours</a>'
;
$list
=
$this
->
get_path_list
(
$COURSE
->
id
,
$USER
->
id
);
$context
=
context_course
::
instance
(
$COURSE
->
id
);
if
(
has_capability
(
'moodle/course:update'
,
$context
)){
$list
=
$this
->
get_all_path_list
(
$COURSE
->
id
);
}
else
{
$list
=
$this
->
get_path_list
(
$COURSE
->
id
,
$USER
->
id
);
}
foreach
(
$list
as
$value
)
{
// if (file_get_contents("$CFG->wwwroot/blocks/career/$value->image") != null) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment