Commit c4102d46 authored by Lea's avatar Lea
Browse files

add function gat_all_path_list

parent 70e006e2
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment