diff --git a/entity/course_format_iena_completion.php b/entity/course_format_iena_completion.php index 5bc75086c10547ff8fc63c7229ce219d43f9ec54..b5af69ad796a3fc6eefe10bb49ba5c42c5b044c8 100644 --- a/entity/course_format_iena_completion.php +++ b/entity/course_format_iena_completion.php @@ -27,6 +27,12 @@ */ class course_format_iena_completion { + /** + * Get completion by sections + * @param type $section_names + * @param type $idSection + * @return type + */ public static function get_completion_by_section($section_names, $idSection) { global $COURSE, $USER, $DB, $CFG; diff --git a/entity/course_format_iena_message.php b/entity/course_format_iena_message.php index 9ad8fe79ae934546e548d5cc441461c1a776d918..c673ae56dd946d2cbf5479c499463dcfe6c12375 100644 --- a/entity/course_format_iena_message.php +++ b/entity/course_format_iena_message.php @@ -61,35 +61,4 @@ } - public function get_content($usersID){ - - global $DB, $CFG, $COURSE; - $data=new stdClass(); - $nb = $usersID != "" ? count( explode(",", $usersID) ) : 0; - - if ( $nb == 0 ) { - $data->nb_results=0; - - } else { - - $data->nb_results=$nb; - $data->users_id=$usersID; - $courseID = required_param('courseid', PARAM_INT); - $data->link_cancel= $CFG->wwwroot . "/course/view.php?id=" . $courseID;; - $mform = $this->_form; - $description = ""; - - $mform->addElement('editor', 'summary', get_string('summary', 'format_iena')); - $mform->setType('summary', PARAM_RAW); - $mform->addRule('summary', get_string('error'), 'required', null, null, false, false); - $mform->setDefault('summary', array('text' => $description)); - $this->add_action_buttons(true, "Envoyer"); - - $data->form=$this->render(); - - } - - return $data; - - } } \ No newline at end of file diff --git a/format.php b/format.php index 3d38a9e4172481abbd0282068a81ecf43931ef25..3b82b0591d3b1285d04e9e0dfc8045af5a5f1637 100644 --- a/format.php +++ b/format.php @@ -35,10 +35,7 @@ require_once('entity/course_format_iena_groups.php'); require_once('entity/course_format_iena_attendance.php'); - /*$cron_test = new course_format_iena_cron_action(); - $cron_test->cron_hide_section(); - $cron_test->cron_message();*/ -//use core_completion\progress; + require_once($CFG->dirroot . '/blocks/myoverview/lib.php'); require_once($CFG->dirroot . '/completion/classes/progress.php'); diff --git a/renderer.php b/renderer.php index f4bc8b858532de64db32ef6af3935bbf20c1eeb7..3fe3636def61e238a82b47acefd70d96b68216ba 100644 --- a/renderer.php +++ b/renderer.php @@ -46,6 +46,7 @@ class format_iena_renderer extends format_topics_renderer{ * * @return string */ + //bientôt useless protected function start_section_list() { return html_writer::start_tag('ul', ['class' => 'iena-editing']); @@ -60,6 +61,7 @@ class format_iena_renderer extends format_topics_renderer{ * @param int $sectionreturn * @return string */ + //Bientôt useless protected function section_header($section, $course, $onsectionpage, $sectionreturn = null, $iena = false){ global $PAGE, $CFG; $o = ''; @@ -72,6 +74,7 @@ class format_iena_renderer extends format_topics_renderer{ $sectionstyle = ' current'; } } + if ($PAGE->user_is_editing()) { $o .= html_writer::start_tag('li', ['id' => 'section-' . $section->section, 'class' => 'section main clearfix' . $sectionstyle, @@ -80,6 +83,7 @@ class format_iena_renderer extends format_topics_renderer{ $o .= html_writer::tag('span', $this->section_title($section, $course), ['class' => 'hidden sectionname']); + //This is were the editing menu is generated if ($PAGE->user_is_editing()) { $leftcontent = $this->section_left_content($section, $course, $onsectionpage); $o .= html_writer::tag('div', $leftcontent, ['class' => 'left side']); @@ -120,9 +124,7 @@ class format_iena_renderer extends format_topics_renderer{ $o .= $this->section_availability_message($section, has_capability('moodle/course:viewhiddensections', $context)); - if ($PAGE->user_is_editing()) { - // $o .= html_writer::end_tag('li'); - } + return $o; } @@ -152,6 +154,7 @@ class format_iena_renderer extends format_topics_renderer{ } } + $section->edit=$this->section_title_without_link($section, $course); $hasnamenotsecpg = (!$onsectionpage && ($section->section != 0 || !is_null($section->name))); $hasnamesecpg = ($onsectionpage && ($section->section == 0 && !is_null($section->name))); @@ -223,85 +226,17 @@ class format_iena_renderer extends format_topics_renderer{ } - - - return $section; - } - - protected function get_section_header_edit($section, $course, $onsectionpage, $sectionreturn = null, $iena = false){ - global $PAGE, $CFG; - $o = ''; - $currenttext = ''; - $sectionstyle = ''; - if ($section->section != 0) { - if (!$section->visible) { - $sectionstyle = ' hidden'; - } elseif (course_get_format($course)->is_section_current($section)) { - $sectionstyle = ' current'; - } - } - - $o .= html_writer::start_tag('li', ['id' => 'section-' . $section->section, - 'class' => 'section main clearfix' . $sectionstyle, - 'role' => 'region', 'aria-label' => get_section_name($course, $section)]); - - - $o .= html_writer::tag('span', $this->section_title($section, $course), ['class' => 'hidden sectionname']); - - - $leftcontent = $this->section_left_content($section, $course, $onsectionpage); - $o .= html_writer::tag('div', $leftcontent, ['class' => 'left side']); - $rightcontent = $this->section_right_content($section, $course, $onsectionpage); - $o .= html_writer::tag('div', $rightcontent, ['class' => 'right side']); - - - $hasnamenotsecpg = (!$onsectionpage && ($section->section != 0 || !is_null($section->name))); - $hasnamesecpg = ($onsectionpage && ($section->section == 0 && !is_null($section->name))); - $classes = ' accesshide'; - if ($hasnamenotsecpg || $hasnamesecpg) { - $classes = ''; - } - $sectionname = html_writer::tag('span', $this->section_title($section, $course)); - - $o .= $this->output->heading($sectionname, 3, 'sectionname' . $classes); - - // if ($course->showdefaultsectionname) { - // $o .= $this->output->heading($sectionname, 3, 'sectionname' . $classes); - // } - // if (!$iena) { $o .= $sectionname; } - - $context = context_course::instance($course->id); - - /* résumé de section */ - if ( $section->summary != "" ) { - $o .= html_writer::start_tag('div', ['class' => 'iena-description']); - $o .= html_writer::start_tag('div', ['class' => 'small']); - - $o .= html_writer::start_tag('div', ['class' => 'iena-summary']); - $o .= $this->format_summary_text($section); - $o .= html_writer::end_tag('div'); - - $o .= html_writer::end_tag('div'); - $o .= html_writer::end_tag('div'); - $o .= html_writer::tag('a', 'Voir la description complète', ['href' => '#', 'class' => 'voir-plus']); - } - $o .= $this->section_availability_message($section, has_capability('moodle/course:viewhiddensections', $context)); - if ($PAGE->user_is_editing()) { - // $o .= html_writer::end_tag('li'); - } - return $o; + return $section; } - public function get_completion_by_section($idSection){ + //useless + /*public function get_completion_by_section($idSection){ global $COURSE, $USER; $ressources_entity = new course_format_iena_section_ressources(); $section_entity = new course_format_iena_sections(); - //$completions = $ressources_entity->get_completions_by_userid($USER->id, $COURSE->id); - - // list modules in a section $modules = $ressources_entity->get_ressources_completion_on_by_id_section($idSection); $nb_modules = count($modules); if ($nb_modules == 0) { @@ -318,9 +253,10 @@ class format_iena_renderer extends format_topics_renderer{ } return array($modules, $valueTotal); - } + }*/ + //Bientôt useless public function get_view_iena($course, $htmlsection, $nameSection, $introSection, $idSection){ global $CFG, $COURSE, $USER; $section_entity = new course_format_iena_sections(); @@ -574,21 +510,22 @@ class format_iena_renderer extends format_topics_renderer{ return $view; } - // - public function get_view_iena_new($course,$nameSection, $idSection){ + /** + * Render le template du header avec les infos nécessaires : le progrès + * @param StdObject $course + * @param array<string> $nameSections + * @param array<int> $idSections + * @return type + */ + public function get_view_iena_new($course,$nameSections, $idSections){ global $CFG, $COURSE, $USER; $section_entity = new course_format_iena_sections(); - - - - $view = ""; - require_once($CFG->dirroot . '/course/format/iena/entity/course_format_iena_completion.php'); // return false if completion disabled (site or course) - $cpl = course_format_iena_completion::get_completion_by_section($nameSection, $idSection); + $cpl = course_format_iena_completion::get_completion_by_section($nameSections, $idSections); /* 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($nameSections, $idSections, $course, $cpl); $course_infos= $header->create_view($cpl); @@ -606,7 +543,8 @@ class format_iena_renderer extends format_topics_renderer{ - + //Seulement en mode édition - + //bientôt useless public function print_iena_section_pages($course){ global $PAGE, $USER; @@ -674,8 +612,6 @@ class format_iena_renderer extends format_topics_renderer{ if ($PAGE->user_is_editing()) { $htmlsection[$section] .= $this->section_header($thissection, $course, false, 0); } - //$htmlsection[$section] .= $this->section_title($thissection,$course); - //$introSection[$section] .= $this->section_header($thissection, $course, false, 0); $introSection[$section] = $this->section_header($thissection, $course, false, 0, true); if ($thissection->uservisible) { /* Ne pas enlever sinon le activity chooser ne fonctionne pas en JS */ @@ -685,6 +621,7 @@ class format_iena_renderer extends format_topics_renderer{ $htmlsection[$section] .= $this->courserenderer->course_section_add_cm_control($course, $section, 0); $htmlsection[$section] .= "</div>"; } + /* pas de footer car on ne commence par la structure par une div non fermée et que ce footer ferme par une div */ // $htmlsection[$section] .= $this->section_footer(); @@ -748,19 +685,23 @@ class format_iena_renderer extends format_topics_renderer{ echo $this->end_section_list(); } echo html_writer::tag('style', '.course-content ul.iena #section-' . $sectionvisible . ' { display: block; }'); - if (!$PAGE->user_is_editing()) { + //if (!$PAGE->user_is_editing()) { //$PAGE->requires->js_init_call('M.format_iena.init', [$course->numsections]); - } + //} } - public function get_iena_sections($course){ + /** + * Fetch the course sections with infos + * @param StdObject $course + * @param bool $onsectionpage + * @return templates + */ + public function get_iena_sections($course, $editing, $onsectionpage=false){ global $PAGE, $USER; - - $context = context_course::instance($course->id); - $course = course_get_format($course)->get_course(); + $completion = new \completion_info($course); $groups=groups_get_all_groups($course->id); @@ -804,35 +745,48 @@ class format_iena_renderer extends format_topics_renderer{ } } $thissection=$this->get_section_header($thissection, $course, false, 0, true, $groups); + if ($thissection->uservisible) { - - $thissection->resources= $this->courserenderer->course_section_cm_list($course, $thissection, 0); - $thissection->addresources = $this->courserenderer->course_section_add_cm_control($course, $section, 0); + if ($editing) { + + $thissection->addresources = $this->courserenderer->course_section_add_cm_control($course, $thissection->section, 0); + $thissection->leftcontent = $this->section_left_content($thissection, $course, $onsectionpage); + $thissection->rightcontent = $this->section_right_content($thissection, $course, $onsectionpage); + + } } + + + + array_push($sections['sections'], $thissection); array_push($nameSections, $thissection->name); array_push($idSections, $thissection->id); } - - + if($editing){ + $sections['link_add_sections']=new moodle_url('/course/changenumsections.php', ['courseid' => $course->id, 'insertsection' => 0, 'increase' => false, 'sesskey' => sesskey(), 'sectionreturn' => 0]); + } echo $this->get_view_iena_new($course, $nameSections, $idSections); echo $this->render_from_template('format_iena/sections', $sections); } - //If edit mode, we use the old code that generates HTML, else we use the templates + + + //If edit mode, we use the old code that generates HTML, else we use the templates - bientôt useless public function switch_mode($course){ global $PAGE, $CFG; $context = context_course::instance($course->id); $course = course_get_format($course)->get_course(); if($PAGE->user_is_editing() and has_capability('moodle/course:update', $context)){ - $this->print_iena_section_pages($course); + //$this->print_iena_section_pages($course); + $this->get_iena_sections($course, true); } else{ - //$this->print_iena_section_pages($course); - $this->get_iena_sections($course); + + $this->get_iena_sections($course, false); } } diff --git a/send_message.php b/send_message.php index 05c6773bd0ac4933134eb97216208fe35d317941..f589f690fe55156c71019a4a87f7612ece00d616 100644 --- a/send_message.php +++ b/send_message.php @@ -115,15 +115,13 @@ $data->users_id=$students; $courseID = required_param('courseid', PARAM_INT); $data->link_cancel= $CFG->wwwroot . "/course/view.php?id=" . $courseID;; - $data->form=$send_message->render(); - } - + //if form is cancelled, we go back to the table. Else, we send the message and then go back to the table, with a success or failure message. if($send_message->is_cancelled()){ $back_url=$CFG->wwwroot . '/course/format/iena/suivi_unit.php'.$back_url; diff --git a/styles.css b/styles.css index ee625366ef24193c063cb50170a6d1e1d8536bc3..d137d20cc6a2a15f86f0a9bdc271641e2e0bfa4b 100644 --- a/styles.css +++ b/styles.css @@ -60,7 +60,10 @@ ul.iena-editing .voir-plus { } .iena-editing h3.sectionname { - margin: 1rem 0; + /*margin: 1rem 0;*/ + margin: 0; + padding:0 10px; + background: transparent; } /* @@ -108,11 +111,14 @@ ul.nav.navbar-nav.ml-auto { .heading-iena { background: #D6D6D6; padding: 0rem; - color: white; + float: left; width: 100% } +.heading-iena .right.side{ + margin-top: 0; +} .iena-heading_title { background: #2d2d2d; padding: 0rem; diff --git a/templates/section.mustache b/templates/section.mustache index e210fec42ce59117743e64891331a8ff2cb345a0..d0a53e42dbbf42a764bc3aa78583782e3102579e 100644 --- a/templates/section.mustache +++ b/templates/section.mustache @@ -1,13 +1,21 @@ -<section class="section iena-section" id="{{section_cpt}}"> +<li class="section clearfix iena-section" id="section-{{section}}" role="region"> + <div class="card card_block"> <div class="heading-iena set_height"> + + <div class="left side">{{{leftcontent}}}</div> + + {{#rightcontent}} + <div class="right side">{{{rightcontent}}}</div> + {{/rightcontent}} <div class="titre_section set_height"> {{#presence}} <div class="label_item sect-date"> {{presence}} </div> {{/presence}} - <p>{{sectionname}}</p></div> + + </div> <div class="right_info"> {{#string_date}} @@ -22,21 +30,13 @@ </a> {{/link_suivi}} - <!-- Not used anymore : c'était pour le formulaire avant--> - {{! #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> + <h3 class="sectionname set_height">{{{edit}}}</h3> </div> - <div class="wrapper section"> + <div class="wrapper"> {{#summary}} <div class="iena-description"> <div class="small"> @@ -55,4 +55,4 @@ </div> </div> -</section> \ No newline at end of file +</li> \ No newline at end of file diff --git a/templates/sections.mustache b/templates/sections.mustache index dd7b6c0ad7ec5f34029fd85bee95ac4082ac05b7..9891eb509b372262a4ced7625195ae3c4a949e92 100644 --- a/templates/sections.mustache +++ b/templates/sections.mustache @@ -4,4 +4,11 @@ {{#sections}} {{> format_iena/section}} {{/sections}} -</ul> \ No newline at end of file +</ul> +{{#link_add_sections}} +<div id="changenumsections" class="mdl-right"> + <a class="add-sections" data-add-sections="{{# str }} addsections {{/ str }}" data-new-sections="" href={{{link_add_sections}}}> + <i class="icon fa fa-plus fa-fw"></i>{{# str }} addsections {{/ str }} + </a> +</div> +{{/link_add_sections}} \ No newline at end of file diff --git a/view/view_course_header.php b/view/view_course_header.php index c85fd8b7c37e8c27d6d0dc34ca95730400c38e92..7597ea2965922f8c0ea41734308f485ac22a40f5 100644 --- a/view/view_course_header.php +++ b/view/view_course_header.php @@ -15,6 +15,11 @@ class view_course_header { //$this->create_view($progress); } + /** + * Description + * @param type $progress + * @return type + */ public function create_view($progress) { // $this->get_progress_bis($this->section_names, $this->idSection, $this->course); @@ -24,12 +29,11 @@ class view_course_header { $infos = [ 'progress' => $prog, 'teachers' => $this->get_teachers(), - 'groups' => $this->get_groupes(), + //'groups' => $this->get_groupes(), // 'attendance' => $this->get_attendance_link() ]; return $this->get_data($infos); - //$this->set_html($infos); } private function get_progress_bis($section_names, $idSection, $course) { @@ -277,7 +281,6 @@ class view_course_header { private function count_students(){ $count = count_enrolled_users($COURSE->id); - echo "on compte les étudiants"; return $count; } @@ -295,187 +298,12 @@ class view_course_header { return $array; } - private function set_html($infos) { - - global $CFG, $COURSE, $USER; - - // $css = file_get_contents( $CFG->wwwroot.'/course/format/iena/course-header.css' ); - // $this->_content .= '<style>'.$css.'</style>'; - - - $this->_content .= '<div class="iena-course-header">'; - - - // begin of : top part (always visible) - $this->_content .= '<div class="iena-course-header-top">'; - - //if user is a student - if(!has_capability('course/iena:suivi', $context = context_course::instance($COURSE->id), $USER->id)){ - // PROGRESS TOTAL : total progression percentage - if ( $infos['progress'] !== false && $infos['progress']->total !== false ) { - $this->_content .= '<a href="#" class="btn btn-outline-primary iena-course-h-total" onclick="iena_toggle_course_header(event)">Ma progression : '.$infos['progress']->total.'%</a>'; - } - else { - $this->_content .= '<div class="btn"></div>'; - } - - - - - - // $this->_content .= '<a href="#" class="btn btn-outline-primary iena-course-h-total" onclick="iena_toggle_course_header(event)">Ma progression :%</a>'; - - // MESSAGES : button to send message to teachers - /*if ( $infos['teachers'] !== false ) { - $this->_content .= '<div class="dropdown iena-course-h-message"><a class="btn btn-outline-primary dropdown-toggle" href="#" role="button" id="iena-course-h-message" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="sr-only">Contact : </span>Enseignants</a><div class="dropdown-menu dropdown-menu-right" aria-labelledby="iena-course-h-message">'; - $my_group_teachers = []; - foreach ($infos['teachers'] as $teacher) { - // echo "<pre>"; - // var_dump($teacher->id); - $teacher_groups = groups_get_user_groups($COURSE->id, $teacher->id)[0]; - // var_dump($teacher_groups); - $user_groups = groups_get_user_groups($COURSE->id, $USER->id)[0]; - // var_dump($user_groups); - $user_is_in_teacher_group = false; - foreach ($user_groups as $user_group) { - if ( in_array($user_group, $teacher_groups) ) { - $user_is_in_teacher_group = true; - $my_group_teachers[] = $teacher; - break; - } - } - // var_dump($user_is_in_teacher_group); - // echo "<hr>"; - // echo "</pre>"; - } - if ( count($my_group_teachers) > 0 ) { - $this->_content .= '<span class="dropdown-header">Mon groupe</span>'; - foreach ($my_group_teachers as $teacher) { - $this->_content .= '<a class="dropdown-item" target="_blank" href="'.$CFG->wwwroot.'/message/index.php?id='.$teacher->id.'"><span class="sr-only">Envoyer un message à (nouvel onglet) : </span>'.$teacher->firstname.' '.$teacher->lastname.'</a>'; - } - $this->_content .= '<span class="dropdown-header">Tous les groupes</span>'; - } - foreach ($infos['teachers'] as $teacher) { - $this->_content .= '<a class="dropdown-item" target="_blank" href="'.$CFG->wwwroot.'/message/index.php?id='.$teacher->id.'"><span class="sr-only">Envoyer un message à (nouvel onglet) : </span>'.$teacher->firstname.' '.$teacher->lastname.'</a>'; - } - $this->_content .= '</div></div>'; - }*/ - - // ATTENDANCE : button to help with attendance mod if one - // if ( $infos['attendance'] !== false ) { - // $this->_content .= '<a href="'.$infos['attendance'].'" class="btn btn-outline-warning iena-course-h-attendance" id="iena-attendance-btn">Présences</a>'; - // } - - - - // GROUP : teacher group select (input-group-lg if needed) - /*if ( $infos['groups'] !== false ) { - $this->_content .= '<script type=\"text/javascript\" charset=\"utf8\" src=\"https://code.jquery.com/jquery-3.3.1.min.js\"></script>'; - $this->_content .= '<script src="'.$CFG->wwwroot.'/course/format/iena/js/groups.js"></script>'; - $this->_content .= '<script>function change_grouplink(obj) { - var classList = obj.classList; - var id_groupe = classList[2].split("id_groupe"); - id_group = id_groupe[1]; - var t = obj.parentNode; - var t_href = t.getAttribute("href"); - t_href += "&groupid=" + id_group; - t.setAttribute("href", t_href); - } - </script>'; - $this->_content .= '<span class="form-inline iena-course-h-group"> - <div class="input-group-prepend"> - <label class="input-group-text orange-bg" for="select-group">Groupe</label> - </div> - <select class="custom-select form-control" id="select-group">'; - $this->_content .= '<option value="id_groupe0" selected>Tous les groupes</option>'; - $this->_content .= '<optgroup label="Mes groupes">'; - $user_groups = groups_get_user_groups($COURSE->id, $USER->id)[0]; - foreach ($infos['groups'] as $group) { - if ( in_array($group['id'], $user_groups ) ) { - $this->_content .= '<option value="id_groupe'.$group['id'].'">'.$group['name'].'</option>'; - } - } - $this->_content .= '</optgroup>'; - - if (has_capability('course/iena:suivi_edit', $context = context_course::instance($COURSE->id), $USER->id)) { - $this->_content .= '<optgroup label="Tous les groupes">'; - foreach ($infos['groups'] as $group) { - $this->_content .= '<option value="id_groupe'.$group['id'].'">'.$group['name'].'</option>'; - } - $this->_content .= '</optgroup>'; - } - - $this->_content .= '</select> - </span>'; - }*/ - } - - - - $this->_content .= '<script type=\"text/javascript\" charset=\"utf8\" src=\"https://code.jquery.com/jquery-3.3.1.min.js\"></script>'; - $this->_content .= '<script src="'.$CFG->wwwroot.'/course/format/iena/js/groups.js"></script>'; - $this->_content .= '<script>function change_grouplink(obj) { - console.log("change grouplink") - var classList = obj.classList; - var id_groupe = classList[2].split("id_groupe"); - id_group = id_groupe[1]; - var t = obj.parentNode; - var t_href = t.getAttribute("href"); - t_href += "&groupid=" + id_group; - t.setAttribute("href", t_href); - } - </script>'; - - - - - - $this->_content .= '</div><div class="iena-h-clear"></div>'; // end of : top - - - // begin of : bottom part visible at toggle - $this->_content .= '<div class="iena-course-header-bottom" id="iena-h-bottom" aria-expanded="false" style="display:none;">'; - // $this->_content .= '<div class="iena-course-header-bottom" id="iena-h-bottom" aria-expanded="true">'; - - - // PROGRESS DETAIL - if ( $infos['progress'] !== false && $infos['progress']->total !== false ) { - // section progress begin - $this->_content .= '<div class="iena-h-prog-sect"><h2>Progression détaillée</h2>'; - // section progress total - foreach ($infos['progress']->sections as $section) { - if ( count($section->modules) > 0 ) { - $this->_content .= '<a href="#section-'.$section->id.'" class="iena-h-prog-name btn btn-outline-success"><strong>'.$section->completion.'%</strong> – '.$section->name.'</a>'; - // section progress each module - 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>'; - } - } - } - $this->_content .= '</div><div class="iena-h-clear"></div>'; - } - - // course summary - $summary_copy = $COURSE->summary; - $to_delete = array('<p>', '</p>', '<br>', '</br>', ' '); - $summary_copy = str_replace($to_delete, '', $summary_copy); - $summary_copy = preg_replace('/\s+/', '', $summary_copy); - if ( $summary_copy != "" ) { - - } - - $this->_content .= '</div>'; // end of : bottom part - - if ( $summary_copy != "" ) { - $this->_content .= '<hr><div id="title-summary-iena" class="container"><h3>'.get_string('aboutcourse', 'format_iena').'</h3><div class="collapse" id="summary-collapse" aria-expanded="false">' . $COURSE->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>'; - //$this->_content .= '<div class="iena-course-header-toggler" id="iena-h-toggler"><hr><a href="#" onclick="iena_toggle_course_header(event)">Afficher / masquer les infos du cours</a></div>'; - } - - //$this->_content .= '<script>function iena_toggle_course_header(event) { event.preventDefault(); var bottom = document.getElementById("iena-h-bottom"); if(bottom.style.display == "none") { bottom.style.display = ""; bottom.setAttribute("aria-expanded", true); } else { bottom.style.display = "none"; bottom.setAttribute("aria-expanded", false); } }</script>'; - - $this->_content .= '</div>'; // end of : iena course header - } + /** + * Retourne un tableau d'informations : array progress_total, array progress_sections, bool student, string summary + * @param array of object $infos + * @return array + */ private function get_data($infos){ global $CFG, $COURSE, $USER; $course_data=[]; @@ -496,9 +324,6 @@ class view_course_header { 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>'; - }*/ } }