diff --git a/competency_iena_competencies_2.php b/competency_iena_competencies_2.php index 6e27e44f5c39389544365d6d077f2d9e84c57323..a82b3db57d016bb4ee6e4bad6062c73f764c377e 100644 --- a/competency_iena_competencies_2.php +++ b/competency_iena_competencies_2.php @@ -43,6 +43,7 @@ $thingnode = $coursenode->add(get_string('dashboard_students', 'block_competency $thingnode->make_active(); $PAGE->requires->js("/blocks/competency_iena/js/dropdown.js"); +$PAGE->requires->css("/blocks/competency_iena/styles.css"); echo $OUTPUT->header(); $sql = "SELECT * FROM {competency_usercomp} @@ -63,19 +64,35 @@ $sql = "SELECT * FROM {competency_usercomp} } $chart = new \core\chart_pie(); -$proficiency_serie = new core\chart_series('', [$count_proficients, $count_course_cpts - $count_proficients]); +$proficiency_serie = new core\chart_series(get_string('competencies', 'core_competency'), [$count_proficients, $count_course_cpts - $count_proficients]); $chart->set_doughnut(true); $chart->add_series($proficiency_serie); + $chart->set_labels(["Validé", "Non validé"]); -foreach ($user_course_competencies as $user_course_competency) { +$array_frameworks=array(); + + + +foreach ($user_course_competencies as $user_course_competency) { + // Crée un obj cpt à partir de l'ID. Attention, id de compétence et course_competency sont différents. $cpt = new \core_competency\competency($user_course_competency->get('competencyid')); /* Visuel indentation to reflect levels in cpt framework */ $cpt_level_in_framework = substr_count($cpt->get('path'), '/') - 1; /* start at 1 */ + $user_course_competency->level_indentation = $cpt_level_in_framework * 1.5; + $user_course_competency->cpt_level_in_framework=$cpt_level_in_framework; + $framework_id=$cpt->get('competencyframeworkid'); + if(!in_array($framework_id,array_keys($array_frameworks))){ + $framework = new \core_competency\competency_framework($cpt->get('competencyframeworkid')); + $array_frameworks[$framework_id]=array(); + $array_frameworks[$framework_id]['taxonomy']=$framework->get('taxonomies'); + } + $user_course_competency->taxonomy=get_string("taxonomy_".$array_frameworks[$framework_id]["taxonomy"][$cpt_level_in_framework], 'core_competency'); + // Récupère les chaines de caractère de l'échelle d'évaluation $cpt_scale = $cpt->get_scale()->scale_items; $user_course_competency->eval = "-"; @@ -88,11 +105,11 @@ foreach ($user_course_competencies as $user_course_competency) { $user_course_competency->link=$CFG->wwwroot."/blocks/competency_iena/course_competency.php?courseid=".$COURSE->id."&studentid=".$student->studentid."&competencyid=".$cpt->get('id'); foreach ($reviews_data as $review) { if ( $review->competencyid == $cpt->get('id') ) { - error_log("Oui on a une demande"); $user_course_competency->review_asked=true; break; } } + //$user_course_competency->reviews_data=array_values($reviews_data); } diff --git a/db/install.xml b/db/install.xml index 74d23db509fa814e480bb312cc4c06a7d804a43d..49339a6997bb649a84cfd141d4bae5c3f1f304c2 100644 --- a/db/install.xml +++ b/db/install.xml @@ -16,17 +16,5 @@ <KEY NAME="sectionid" TYPE="foreign" FIELDS="sectionid" REFTABLE="course_sections" REFFIELDS="id"/> </KEYS> </TABLE> - <TABLE NAME="block_competency_iena" COMMENT="Default comment for block_competency_iena, please edit me"> - <FIELDS> - <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/> - <FIELD NAME="cmid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="module id"/> - <FIELD NAME="sectionid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/> - </FIELDS> - <KEYS> - <KEY NAME="primary" TYPE="primary" FIELDS="id"/> - <KEY NAME="cmid" TYPE="foreign" FIELDS="cmid" REFTABLE="course_modules" REFFIELDS="id"/> - <KEY NAME="sectionid" TYPE="foreign" FIELDS="sectionid" REFTABLE="course_sections" REFFIELDS="id"/> - </KEYS> - </TABLE> </TABLES> </XMLDB> \ No newline at end of file diff --git a/styles.css b/styles.css index b2fba2f1e86a5e03967dff7aa4b16b95dcac14f2..c27be45e6fecf6e2df13f36017303cc473cd34cb 100644 --- a/styles.css +++ b/styles.css @@ -274,3 +274,36 @@ table.dataTable{ min-width: 355px; } +.chart-area{ + display: flex; + flex-direction: row; + flex-wrap: nowrap; + + +} + +.chart-image, .chart-table{ + flex-grow: 1; +} + +.chart-image{ + max-width: 40%; +} + +.taxo-lvl1 small{ + background-color: #223D4F; +} + +.taxo-lvl2 small{ + background-color: #355E7A; +} +.taxo-lvl3 small{ + background-color: #5090BA; +} +.taxo-lvl4 small{ + background-color: #60ADE0; +} + +.iena-taxonomy{ + margin-bottom: 5px; +} diff --git a/templates/dashboard_students.mustache b/templates/dashboard_students.mustache index b8dbfdadb84913b528e78640cfb31db5851618d2..7f521b0c5a9e9da7cb6ce671258a9b219a19b0b6 100644 --- a/templates/dashboard_students.mustache +++ b/templates/dashboard_students.mustache @@ -2,7 +2,7 @@ {{#count_course_cpts}} <div class='container-fluid' id='dash-container'> <div class='alert alert-secondary row' style='padding-top: 1.5rem;'> - <div class='col-12 col-lg-6'> + <div class='col-12'> <!--<h2 class='h3'>{{student.firstname}} {{student.lastname}}</h2>--> @@ -21,19 +21,24 @@ </div> </form> {{/is_not_student}} - <h2 class='h4 m-t-2'>Demandes d'évaluations <span class='badge badge-pill badge-primary' style='border-radius: 0.15rem;'>{{reviews_count}}</span></h2> + </div> - <div class='col-12 col-lg-6'> + <div class='col-12'> <h2 class='h4'>Compétences validées</h2> {{{chart}}} </div> + </div> <div class='row'> <div class='col-12' style='padding: 0;'> + <h2 class='h4 m-t-2'>Demandes d'évaluations <span class='badge badge-pill badge-primary' style='border-radius: 0.15rem;'>{{reviews_count}}</span></h2> <div class='list-group'> {{#user_course_competencies}} + <a href='{{link}}' class='list-group-item list-group-item-action{{proficient_class}}' style='padding-left: {{level_indentation}}rem;'> + <div class="iena-taxonomy taxo-lvl{{cpt_level_in_framework}}"><small class='review-badge'>{{taxonomy}}</small></div> <div class='d-flex w-100 justify-content-between'> + <h3 class='mb-1 iena-cpt-action-title h5'>{{shortname}}</h3>