Skip to content
Snippets Groups Projects
Commit c4d02c41 authored by Myriam Delaruelle's avatar Myriam Delaruelle
Browse files

Refonte template Sections/Header + ajout attribut presence a section_option_format

parent d15034fa
Branches
Tags
No related merge requests found
...@@ -33,14 +33,13 @@ ...@@ -33,14 +33,13 @@
public $name; public $name;
/** @var int id of course */ /** @var int id of course */
public $id_course; public $id_course;
/** @var block_career_ressources array<Ressource> ressources */ /** @var block_career_resources array<Ressource> resources */
public $ressources; public $resources;
/** @var date */ /** @var date */
public $date; public $date;
/** @var string availability */ /** @var string availability */
public $availability; public $availability;
/** @var array section */ public $visibility;
public $sections;
/** /**
...@@ -195,19 +194,19 @@ ...@@ -195,19 +194,19 @@
/** /**
* @return mixed * @return mixed
*/ */
public function getRessources() public function getResources()
{ {
return $this->ressources; return $this->resources;
} }
/** /**
* @param mixed $ressources * @param mixed $resources
* *
* @return self * @return self
*/ */
public function setRessources($ressources) public function setResources($resources)
{ {
$this->ressources = $ressources; $this->resources = $resources;
return $this; return $this;
} }
...@@ -252,23 +251,35 @@ ...@@ -252,23 +251,35 @@
return $this; return $this;
} }
/** /**
* @return mixed * @return mixed
*/ */
public function getSections() public function getVisibility()
{ {
return $this->sections; return $this->visibility;
} }
/** /**
* @param mixed $sections * @param mixed $visibility
* *
* @return self * @return self
*/ */
public function setSections($sections) public function setVisibility($visibility)
{ {
$this->sections = $sections; $this->visibility = $visibility;
return $this; return $this;
} }
public function toArray(){
$vars = [];
foreach($this as $varName => $varValue) {
$vars[$varName] = $varValue;
}
return $vars;
}
} }
...@@ -82,6 +82,131 @@ ...@@ -82,6 +82,131 @@
} }
return $courseformatoptions; return $courseformatoptions;
} }
/**
* Definitions of the additional options that this course format uses for section
*
* See {@link format_base::course_format_options()} for return array definition.
*
* Additionally section format options may have property 'cache' set to true
* if this option needs to be cached in {@link get_fast_modinfo()}. The 'cache' property
* is recommended to be set only for fields used in {@link format_base::get_section_name()},
* {@link format_base::extend_course_navigation()} and {@link format_base::get_view_url()}
*
* For better performance cached options are recommended to have 'cachedefault' property
* Unlike 'default', 'cachedefault' should be static and not access get_config().
*
* Regardless of value of 'cache' all options are accessed in the code as
* $sectioninfo->OPTIONNAME
* where $sectioninfo is instance of section_info, returned by
* get_fast_modinfo($course)->get_section_info($sectionnum)
* or get_fast_modinfo($course)->get_section_info_all()
*
* All format options for particular section are returned by calling:
* $this->get_format_options($section);
*
* @param bool $foreditform
* @return array
*/
public function section_format_options($foreditform = false) {
global $CFG;
static $courseformatoptions = false;
if ($courseformatoptions === false) {
$courseformatoptions = array(
'presence'=>array(
'label'=>"Présence",
'type'=>PARAM_INT
)
);
}
if ($foreditform) {
$courseformatoptionsedit = array(
/*'periodduration' => array(
'label' => 'poury',
'element_attributes' => array(
array(0=>'hello'),
array(1=>'hghgh')
),
'element_type' => 'advcheckbox',
),
'presence'=>array(
'label' => 'Modalité',
'element_type' => 'select',
'element_attributes' => array (
array (
0 => 'Aucune',
1 => 'Présentiel',
2 => 'À distance',
)
))*/
);
$courseformatoptions = array_merge_recursive($courseformatoptions, $courseformatoptionsedit);
}
return $courseformatoptions;
}
/**
* Adds format options elements to the course/section edit form.
*
* This function is called from {@link course_edit_form::definition_after_data()}.
*
* @param MoodleQuickForm $mform form the elements are added to.
* @param bool $forsection 'true' if this is a section edit form, 'false' if this is course edit form.
* @return array array of references to the added form elements.
*/
public function create_edit_form_elements(&$mform, $forsection = false) {
global $COURSE;
global $PAGE;
$elements = parent::create_edit_form_elements($mform, $forsection);
echo "\n hksddkh \n <br> <br> blabla <br>";
if ($forsection) {
$mform->removeElement('presence', false);
$sectionclass = new stdClass();
$sectionclass->id=optional_param('id', 0, PARAM_INT);
$section_config=$this->get_format_options($sectionclass);
$radioarray=array();
$radioarray[] = $mform->createElement('radio', 'modalite', '', 'Distance', 2);
$radioarray[] = $mform->createElement('radio', 'modalite', '', 'Présentiel', 1);
$radioarray[] = $mform->createElement('radio', 'modalite', '', 'Aucune', 0);
$mform->addGroup($radioarray, 'Modalité', 'Modalité', array(' '), false);
if($section_config && $section_config['presence']){
$mform->setDefault('modalite', $section_config['presence']);
}
//$mform->setType('numsections', PARAM_INT);
//array_unshift($elements, $element);
}
// Re-order things.
/*if ($forsection) {
$mform->insertElementBefore($mform->removeElement('automaticenddate', false), 'idnumber');
$mform->disabledIf('enddate', 'automaticenddate', 'checked');
foreach ($elements as $key => $element) {
if ($element->getName() == 'automaticenddate') {
unset($elements[$key]);
}
}
$elements = array_values($elements);
}*/
return $elements;
}
/** /**
* get_view_url * get_view_url
...@@ -150,3 +275,5 @@ ...@@ -150,3 +275,5 @@
return course_get_format($section->course)->inplace_editable_update_section_name($section, $itemtype, $newvalue); return course_get_format($section->course)->inplace_editable_update_section_name($section, $itemtype, $newvalue);
} }
} }
...@@ -126,9 +126,20 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -126,9 +126,20 @@ class format_iena_renderer extends format_topics_renderer{
return $o; return $o;
} }
/**
* Add style attributes, classes (useless?), format section summary and add the hidden/restricted message
* @param type $section
* @param type $course
* @param type $onsectionpage
* @param type|null $sectionreturn
* @param type|bool $iena
* @return type
*/
protected function get_section_header($section, $course, $onsectionpage, $sectionreturn = null, $iena = false){ protected function get_section_header($section, $course, $onsectionpage, $sectionreturn = null, $iena = false){
echo "ON PASSE ICI";
global $PAGE, $CFG; global $PAGE, $CFG, $COURSE, $USER;
$section_entity = new course_format_iena_sections();
$o = ''; $o = '';
$currenttext = ''; $currenttext = '';
$sectionstyle = ''; $sectionstyle = '';
...@@ -156,6 +167,47 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -156,6 +167,47 @@ class format_iena_renderer extends format_topics_renderer{
$section->messageavailability= $this->section_availability_message($section, has_capability('moodle/course:viewhiddensections', $context)); $section->messageavailability= $this->section_availability_message($section, has_capability('moodle/course:viewhiddensections', $context));
/* Paramètres */
$presence = "";
$param_section = $section_entity->get_section_settings_by_id_section($section->id);
if ($param_section !== false) {
if ($param_section->presence) {
if ($param_section->presence == 1) {
$section->presence = "En présence";
$string_date_presence="Pour le ";
} else if ($param_section->presence == 2) {
$section->presence = "À distance";
$string_date_presence="Le ";
}
}
if ($param_section->date_rendu) {
$section->dateUp = date_create($param_section->date_rendu);
$section->date = $section->dateUp->format("j/m H:i");
$section->date_jour = $section->dateUp->format("j/m");
$section->date_heure = $section->dateUp->format("H:i");
$section->dateUp = $section->dateUp->getTimestamp();
if($string_date_presence){
$section->string_date=$string_date_presence.$section->date_jour." à ".$section->date_heure;
}
else{
$section->string_date="Le ".$section->date_jour." à ".$section->date_heure;
}
} else {
$section->date = "";
}
} else {
$section->date = "";
}
if (has_capability('moodle/course:update', $context = context_course::instance($COURSE->id), $USER->id)) {
$section->link_param = $CFG->wwwroot . "/course/format/iena/param_section.php?courseid=" . $COURSE->id . "&sectionid=" . $section->id;
}
return $section; return $section;
} }
...@@ -808,7 +860,7 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -808,7 +860,7 @@ class format_iena_renderer extends format_topics_renderer{
return $view; return $view;
} }
public function get_view_iena_new($course, $htmlsection, $nameSection, $introSection, $idSection) public function get_view_iena_new($course,$nameSection, $idSection)
{ {
global $CFG, $COURSE, $USER; global $CFG, $COURSE, $USER;
$section_entity = new course_format_iena_sections(); $section_entity = new course_format_iena_sections();
...@@ -823,10 +875,17 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -823,10 +875,17 @@ class format_iena_renderer extends format_topics_renderer{
/* Passer le calcul de complétion de la classe course_format_iena_completion à part à la vue qui fait le header permet de ne pas récupérer deux fois les mêmes informations. */ /* Passer le calcul de complétion de la classe course_format_iena_completion à part à la vue qui fait le header permet de ne pas récupérer deux fois les mêmes informations. */
$header = new view_course_header($nameSection, $idSection, $course, $cpl); $header = new view_course_header($nameSection, $idSection, $course, $cpl);
$view .= $header->get_content(); $course_infos= $header->create_view($cpl);
echo $this->render_from_template('format_iena/course-header', $course_infos);
$i = 0; $i = 0;
$link = $CFG->wwwroot . "/course/format/iena/suivi_unit.php?courseid=" . $COURSE->id; $link = $CFG->wwwroot . "/course/format/iena/suivi_unit.php?courseid=" . $COURSE->id;
$view .= "<!-- <script defer src=\"https://use.fontawesome.com/releases/v5.0.8/js/all.js\"></script> --> $view .= "<!-- <script defer src=\"https://use.fontawesome.com/releases/v5.0.8/js/all.js\"></script> -->
<style> <style>
...@@ -911,146 +970,7 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -911,146 +970,7 @@ class format_iena_renderer extends format_topics_renderer{
padding-top: 5%; padding-top: 5%;
} }
</style>"; </style>";
foreach ($htmlsection as $section) {
$presence = "";
if (!$section) {
continue;
}
$param_section = $section_entity->get_section_settings_by_id_section($idSection[$i]);
// dates, modality and notification section parameters : false if not set.
if ($param_section !== false) {
if ($param_section->presence && $i != 0) {
if ($param_section->presence == 1) {
$presence = "En présence";
} else if ($param_section->presence == 2) {
$presence = "A distance";
}
}
if ($param_section->date_rendu) {
$dateUp = date_create($param_section->date_rendu);
$date = $dateUp->format("j/m H:i");
$date_jour = $dateUp->format("j/m");
$date_heure = $dateUp->format("H:i");
$dateUp = $dateUp->getTimestamp();
} else {
$date = "";
}
} else {
$date = "";
}
$titre = $nameSection[$i];
$sectionIntro = $introSection[$i];
//If section is hidden continue
if ($titre == null && !(has_capability('moodle/course:update', $context = context_course::instance($COURSE->id), $USER->id))) {
$i++;
continue;
}
$view .= "<section class=\"section iena-section\" id=\"section-$i\">
<div class=\"card card_block\">
<div class=\"heading-iena set_height\">";
if ( $cpl != false && count($cpl->sections[$i]->modules) > 0 && !has_capability('course/iena:suivi', $context = context_course::instance($COURSE->id), $USER->id)) {
$view .= "<div class='iena-percent set_height'>" . $cpl->sections[$i]->completion . "%</div>";
}
if (has_capability('course/iena:suivi', $context = context_course::instance($COURSE->id), $USER->id) && $i != 0) {
$course_groups = groups_get_all_groups($COURSE->id);
$group_indicateur = 0;
$view .= "<a href='$link&sectionid=".$idSection[$i]."' style=\"color : white\">";
$view .="<div onclick='change_grouplink(this)' style=\"display:block;\" class=\"nb_pers set_height id_groupe0\">";
$view .= "Suivi étudiants";
$view .= "</div>";
$view .="</a>";
}
$view .= "<div class=\"titre_section set_height\">
<p>$titre</p>
</div>
<div class=\"right_info\">
";
if ($date) {
$link_date = $CFG->wwwroot . "/calendar/view.php?view=month&time=" . $dateUp . "&course=" . $COURSE->id;
if ($presence && $presence == "A distance") {
$view .= "
<div class=\"label_item sect-date\">
À distance
</div>
<div class=\"label_item sect-date\">
Pour le $date_jour à $date_heure
</div>";
} else if ($presence && $presence == "En présence") {
$view .= "
<div class=\"label_item sect-date\">
En présence
</div>
<div class=\"label_item sect-date\">
Le $date_jour à $date_heure
</div>";
} else {
$view .= "
<div class=\"label_item sect-date\">
Le $date_jour à $date_heure
</div>";
}
} else {
if ($presence && $presence == "A distance") {
$view .= "
<div class=\"label_item sect-date\">
À distance
</div>";
} else if ($presence && $presence == "En présence") {
$view .= "
<div class=\"label_item sect-date\">
En présence
</div>";
}
}
// $cpt = $this->get_render_competences($idSection[$i]);
$cpt = "";
if ($cpt != "") {
$view .= "
<div class=\"titre_section set_height\">
";
$view .= $cpt;
$view .= "</div>
";
}
$link_param = $CFG->wwwroot . "/course/format/iena/param_section.php?courseid=" . $COURSE->id . "&sectionid=" . $idSection[$i];
if (has_capability('moodle/course:update', $context = context_course::instance($COURSE->id), $USER->id) && $i != 0) {
$view .= "<div class=\"titre_section set_height\">
<a href='$link_param' style=\"color : white\">
<i class=\"fa fa-cog \" aria-hidden=\"true\" ></i>
</a>
</div>";
}
$view .= "</div>
</div>
";
$view .= "<div class=\"wrapper section\">";
$view .= $sectionIntro;
$view .= "<div class=\"wrapper\">
$section
</div >
</div>
</section>";
$i++;
}
return $view;
} }
...@@ -1231,19 +1151,19 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -1231,19 +1151,19 @@ class format_iena_renderer extends format_topics_renderer{
$sectionvisible = 1; $sectionvisible = 1;
} }
$htmlsection = false; $htmlsection = false;
$nameSection = []; $nameSections = [];
$idSection = false; $idSections = [];
$introSection = false; $introSection = false;
echo "hello byuddy";
$sections=['sections'=>[]]; $sections=['sections'=>[]];
//var_dump($modinfo->get_section_info_all()); //var_dump($modinfo->get_section_info_all());
foreach($modinfo->get_section_info_all() as $section => $thissection){ foreach($modinfo->get_section_info_all() as $section => $thissection){
if (!$PAGE->user_is_editing() && (!has_capability('moodle/course:viewhiddensections', $context = context_course::instance($course->id), $USER->id))) { if (!$PAGE->user_is_editing() && (!has_capability('moodle/course:viewhiddensections', $context = context_course::instance($course->id), $USER->id))) {
if (isset($course->hiddensections) && !(int)$thissection->visible) { if (isset($course->hiddensections) && !(int)$thissection->visible) {
continue; continue;
...@@ -1255,7 +1175,7 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -1255,7 +1175,7 @@ class format_iena_renderer extends format_topics_renderer{
continue; continue;
} }
if (!$thissection->uservisible || !$thissection->visible) { if (!$thissection->uservisible || !$thissection->visible) {
$htmlsection[$section] .= $this->section_hidden($section, $course->id); $htmlsection = $this->section_hidden($section, $course->id);
continue; continue;
} }
...@@ -1269,8 +1189,12 @@ class format_iena_renderer extends format_topics_renderer{ ...@@ -1269,8 +1189,12 @@ class format_iena_renderer extends format_topics_renderer{
} }
array_push($sections['sections'], $thissection); array_push($sections['sections'], $thissection);
array_push($nameSections, $thissection->name);
array_push($idSections, $thissection->id);
} }
echo $this->get_view_iena_new($course, $nameSections, $idSections);
echo $this->render_from_template('format_iena/sections', $sections); echo $this->render_from_template('format_iena/sections', $sections);
//On récupère toutes les infos des sections //On récupère toutes les infos des sections
/*foreach ($modinfo->get_section_info_all() as $section => $thissection) { /*foreach ($modinfo->get_section_info_all() as $section => $thissection) {
......
...@@ -102,7 +102,7 @@ ul.nav.navbar-nav.ml-auto { ...@@ -102,7 +102,7 @@ ul.nav.navbar-nav.ml-auto {
.set_height { .set_height {
/*min-height: 3rem;*/ /*min-height: 3rem;*/
line-height: 0.7rem; line-height: 2.4rem;
} }
.heading-iena { .heading-iena {
...@@ -152,8 +152,8 @@ ul.nav.navbar-nav.ml-auto { ...@@ -152,8 +152,8 @@ ul.nav.navbar-nav.ml-auto {
.titre_section { .titre_section {
float: left; float: left;
padding-top: 1rem;
padding-left: 0.8rem; /*padding-left: 0.8rem;*/
padding-right: 1rem; padding-right: 1rem;
font-size: 1.4rem; font-size: 1.4rem;
color: #1a1a1a; color: #1a1a1a;
...@@ -161,6 +161,17 @@ ul.nav.navbar-nav.ml-auto { ...@@ -161,6 +161,17 @@ ul.nav.navbar-nav.ml-auto {
/*font-weight: bold;*/ /*font-weight: bold;*/
} }
.titre_section p {
margin-bottom: 0;
display: inline-block;
padding-left: 0.5rem;
}
.titre_section .label_item.sect-date{
display: inline-block;
border-left: none;
}
.nb_pers { .nb_pers {
text-align: center; text-align: center;
background: #009186; background: #009186;
...@@ -185,17 +196,20 @@ ul.nav.navbar-nav.ml-auto { ...@@ -185,17 +196,20 @@ ul.nav.navbar-nav.ml-auto {
} }
.label_item.sect-date { .label_item.sect-date {
color: #fafafa; /* color: #fafafa; */
border: 1px solid #fafafa; /* border: 1px solid #fafafa; */
border-radius: .15rem; border-right: 1px solid white;
/* margin: 0.9rem; */ border-left: 1px solid white;
margin: 0.9rem 0.2rem 0.9rem 0.2rem; border-radius: .15rem;
/* margin-right: 0; */ /* margin: .9rem .2rem .9rem .2rem; */
padding: .05rem .6rem; padding: .05rem .6rem;
float: left; float: left;
font-weight: 700; font-weight: 700;
background-color: #666; /* background-color: #666; */
font-size: 0.85rem; font-size: .85rem;
line-height: 2.4rem;
color: #666;
font-weight: 400;
} }
.iena-description { .iena-description {
...@@ -301,6 +315,25 @@ ul.nav.navbar-nav.ml-auto { ...@@ -301,6 +315,25 @@ ul.nav.navbar-nav.ml-auto {
/* Progress detail */ /* Progress detail */
.iean-progress-header .iena-progress-label, .iean-progress-header .progress-wrapper{
display: inline-block;
}
.iean-progress-header .progress{
width: 200px;
}
.iena-h-prog-sect{
margin-left: 10px;
padding-left: 20px;
margin-top: 20px;
border-left: 1px solid lightgrey;
}
.iena-h-prog-sect h2 { .iena-h-prog-sect h2 {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
...@@ -314,25 +347,31 @@ ul.nav.navbar-nav.ml-auto { ...@@ -314,25 +347,31 @@ ul.nav.navbar-nav.ml-auto {
/* Section progression name and % */ /* Section progression name and % */
.btn-outline-success.iena-h-prog-name { .btn-outline-success.iena-h-prog-name {
color: #009085; color: #009085;
border-color: #009085; border-color: #009085;
border-radius: 0.15rem; border-radius: .15rem;
max-width: 300px; max-width: 300px;
overflow: hidden; display: block;
position: relative; /* overflow: hidden; */
margin-bottom: 0.5rem; /* position: relative; */
float: left; /* margin-bottom: .5rem; */
clear: left; /* float: left; */
min-width: 300px; /* clear: left; */
text-align: left; min-width: 300px;
text-align: left;
}
.iena-h-prog-name{
display: block;
font-size: large;
} }
.btn-outline-success.iena-h-prog-name:before { .btn-outline-success.iena-h-prog-name:before {
content:''; /*content:'';
width:100%; width:100%;
height:100%; height:100%;
position:absolute; position:absolute;
left:0; left:0;
top:0; top:0;
background:linear-gradient(90deg, rgba(255, 255, 255, 0) 245px, rgba(255, 255, 255, 1) 289px); background:linear-gradient(90deg, rgba(255, 255, 255, 0) 245px, rgba(255, 255, 255, 1) 289px);
*/
} }
.btn-outline-success.iena-h-prog-name:hover, .btn-outline-success.iena-h-prog-name:hover,
.btn-outline-success.iena-h-prog-name:active { .btn-outline-success.iena-h-prog-name:active {
...@@ -350,15 +389,40 @@ ul.nav.navbar-nav.ml-auto { ...@@ -350,15 +389,40 @@ ul.nav.navbar-nav.ml-auto {
border-color: #009085 !important; border-color: #009085 !important;
} }
.details-progress .section-progress{
margin-bottom: 1rem;
}
.details-progress .section-progress .progress-wrapper{
width: 300px;
display: inline-block;
}
.details-progress .section-progress .progress-wrapper .progress{
height: 0.5rem;
}
.details-progress .section-progress .progress-wrapper .iena-prog-label{
font-size: small;
}
/* Represent a course module link as a bullet */ /* Represent a course module link as a bullet */
.iena-h-prog-mod-item { .iena-h-prog-mod-item {
border-radius: 1.5rem; border-radius: 1.5rem;
float: left; display: inline-block;
min-width: 1.5rem; line-height: 36px;
min-height: 1.5rem; vertical-align: top;
position: relative; /* float: left; */
margin-left: 0.25rem; min-width: 1.5rem;
margin-top: 0.4rem; display: inline-block;
/* height: 24px; */
/* width: 24px; */
min-height: 1.5rem;
position: relative;
margin-left: .25rem;
margin: auto;
/* margin-top: .4rem;
} }
/* .iena-h-prog-mod-item.iena-g-prog-done { /* .iena-h-prog-mod-item.iena-g-prog-done {
background-color: #009085; background-color: #009085;
...@@ -423,6 +487,9 @@ ul.nav.navbar-nav.ml-auto { ...@@ -423,6 +487,9 @@ ul.nav.navbar-nav.ml-auto {
} }
#title-summary-iena{
padding-left: 0;
}
#title-summary-iena #summary-collapse.collapse:not(.show) { #title-summary-iena #summary-collapse.collapse:not(.show) {
display: block; display: block;
......
<div class="iena-course-header"> <div class="iena-course-header">
{{#student}}<div class="iena-course-header-bottom" id="iena-h-bottom" aria-expanded="false" style="display: none"></div> {{#student}}
<!--<a href="#" class="btn btn-outline-primary iena-course-h-total" onclick="iena_toggle_course_header(event)">Ma progression : {{progress_total}}%</a>-->
<div class="iean-progress-header">
<h5 class="iena-progress-label"> Ma progression dans le cours : </h5>
<div class="progress-wrapper">
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="{{progress_total}}" style="width:{{progress_total}}%" aria-valuemin="0" aria-valuemax="100"> {{progress_total}}%</div>
</div>
</div>
<a class="iena-progress-label" data-toggle="collapse" href="#progress-details" role="button" aria-expanded="false" aria-controls="progress-details"> <i class="fa fa-search-plus"></i> </a>
</div>
<div class="iena-course-header-bottom" id="iena-h-bottom" aria-expanded="false" style="">
<div class="iena-h-prog-sect collapse" id="progress-details">
<div class="details-progress">
{{#progress_sections}}
<div class="section-progress">
<a href="#section-{{id}}" class="iena-h-prog-name">{{name}}</a>
<div class="progress-wrapper">
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="{{completion}}" style="width:{{completion}}%" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="iena-prog-label">{{completion}}%</strong> terminé</div>
</div>
{{#modules}}
<a href="{{url}}" class="iena-h-prog-mod-item iena-g-prog-{{completion}}"><span>{{name}}</span></a>
{{/modules}}
</div>
{{/progress_sections}}
</div>
</div>
</div>
{{/student}}
<div class="iena-course-header-bottom" id="" aria-expanded="false">
<div id="title-summary-iena" class="container">
<h3>
{{# str }} aboutcourse, format_iena {{/ str}}
</h3>
<div class="collapse" id="summary-collapse" aria-expanded="false">{{{ summary }}}</div>
<a role="button" class="collapsed" data-toggle="collapse" href="#summary-collapse" aria-expanded="false" aria-controls="summary-collapse">Afficher / Masquer les infos du cours</a>
</div>
</div>
</div> </div>
\ No newline at end of file
<section class="section iena-section" id="{{section_cpt}}"> <section class="section iena-section" id="{{section_cpt}}">
<div class="card card_block"> <div class="card card_block">
<div class="heading-iena set_height"> <div class="heading-iena set_height">
<div class="titre_section set_height"><p>{{sectionname}}</p></div> <div class="titre_section set_height">
<div class="right-info"></div> {{#presence}}
<div class="label_item sect-date">
{{presence}}
</div>
{{/presence}}
<p>{{sectionname}}</p></div>
<div class="right_info">
{{#string_date}}
<div class="label_item sect-date">
{{string_date}}
</div>
{{/string_date}}
{{#link_param}}
<div class="titre_section set_height">
<a href={{link_param}} style="color : white">
<i class="fa fa-cog " aria-hidden="true" ></i>
</a>
</div>
{{/link_param}}
</div>
</div> </div>
<div class="wrapper section"> <div class="wrapper section">
......
...@@ -12,10 +12,10 @@ class view_course_header { ...@@ -12,10 +12,10 @@ class view_course_header {
$this->idSection = $idSection; $this->idSection = $idSection;
// $this->completion_total = $completion_total; // $this->completion_total = $completion_total;
$this->course = $course; $this->course = $course;
$this->create_view($progress); //$this->create_view($progress);
} }
private function create_view($progress) { public function create_view($progress) {
// $this->get_progress_bis($this->section_names, $this->idSection, $this->course); // $this->get_progress_bis($this->section_names, $this->idSection, $this->course);
...@@ -28,7 +28,8 @@ class view_course_header { ...@@ -28,7 +28,8 @@ class view_course_header {
// 'attendance' => $this->get_attendance_link() // 'attendance' => $this->get_attendance_link()
]; ];
$this->set_html($infos); return $this->get_data($infos);
//$this->set_html($infos);
} }
private function get_progress_bis($section_names, $idSection, $course) { private function get_progress_bis($section_names, $idSection, $course) {
...@@ -40,19 +41,6 @@ class view_course_header { ...@@ -40,19 +41,6 @@ class view_course_header {
return false; return false;
} }
// $modules = $DB->get_records_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate, cm.section
// FROM {course_modules_completion} as cmc
// inner join {course_modules} as cm on cm.id = cmc.coursemoduleid
// inner join {user} as u on u.id = cmc.userid
// inner join {modules} as m on m.id = cm.module
// where cm.course = ? and cm.deletioninprogress = 0
// and cmc.userid = ?
// order by section, coursemoduleid asc', array($course->id, $USER->id));
// echo "<pre>";
// var_dump($modules);
// echo "</pre>";
$sections = []; $sections = [];
$fast_modinfo = get_fast_modinfo($course->id); $fast_modinfo = get_fast_modinfo($course->id);
...@@ -488,6 +476,46 @@ class view_course_header { ...@@ -488,6 +476,46 @@ class view_course_header {
$this->_content .= '</div>'; // end of : iena course header $this->_content .= '</div>'; // end of : iena course header
} }
private function get_data($infos){
global $CFG, $COURSE, $USER;
$course_data=[];
$course_data['student']=false;
//if user is a student
if(!has_capability('course/iena:suivi', $context = context_course::instance($COURSE->id), $USER->id)){
$course_data['progress_total']=$infos['progress']->total;
// PROGRESS TOTAL : total progression percentage
if ( $infos['progress'] !== false && $infos['progress']->total !== false ) {
$course_data['progress_sections']=[];
// section progress total
foreach ($infos['progress']->sections as $section) {
if ( count($section->modules) > 0 ) {
array_push($course_data['progress_sections'], $section);
/*foreach ($section->modules as $module) {
$this->_content .= '<a href="'.$module->url.'" class="iena-h-prog-mod-item iena-g-prog-'.$module->completion.'"><span>'.$module->name.'</span></a>';
}*/
}
}
}
else {
}
$course_data['student']=true;
}
$course_data['summary']=$COURSE->summary;
return $course_data;
}
public function get_content() { public function get_content() {
return $this->_content; return $this->_content;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment