diff --git a/notemyprogress/ajax.php b/notemyprogress/ajax.php index 06f5fea66bbf8560785cf10ae302737c52c606fc..bbace1eb93c360453537ef0af7ab3205dc38adb5 100644 --- a/notemyprogress/ajax.php +++ b/notemyprogress/ajax.php @@ -105,6 +105,7 @@ if($action == 'saveconfigweek') {//Exemple: if the action passed is saveconfigwe array_push($params, $newinstance); if($weeks && $courseid && $userid){ + $func = "local_notemyprogress_save_weeks_config"; //this function must be contained in localib.php } } elseif ($action == 'changegroup') { @@ -398,8 +399,6 @@ function local_sr_update_lastweek($courseid, $userid, $lastweekid, $classroom_ho local_notemyprogress_ajax_response(array('response_update_last_week' => $lastweekresponse)); } -function local_notemyprogress_logsNMP($beginDate, $lastDate, $courseid, $userid, $currentUrl) -{ function local_notemyprogress_logsNMP($beginDate, $lastDate, $courseid, $userid, $currentUrl) { $logs = new \local_notemyprogress\logs($courseid, $userid); $logs->addLogsNMP("downloaded", "logfile", "LOGFILES", "nmp", $currentUrl, "File that contains all the activities performed on the moodle course in a time interval"); @@ -583,5 +582,4 @@ function local_notemyprogress_save_enable($courseid, $userid, $enable,$url){ // $configLevels->save_enable($enable); // $message = get_string('fml_api_save_successful', 'local_notemyprogress'); // local_notemyprogress_ajax_response($message); - } -} \ No newline at end of file + } \ No newline at end of file diff --git a/notemyprogress/amd/build/setweeks.js b/notemyprogress/amd/build/setweeks.js index 1b41697c4d5c776c641ae34c508a22ea31e7e940..97747ff54aaaec5c2f70c023b3278d342eb12f20 100644 --- a/notemyprogress/amd/build/setweeks.js +++ b/notemyprogress/amd/build/setweeks.js @@ -218,34 +218,34 @@ define([ params: data, }) .then((response) => { - //console.log("then1"); + console.log("then1"); if (response.status == 200 && response.data.ok) { - //console.log("then1.2"); + console.log("then1.2"); this.settings = response.data.data.settings; - //console.log("then1.3"); + console.log("then1.3"); Alertify.success(this.strings.save_successful); - //console.log("then1.4"); + console.log("then1.4"); this.save_successful = true; - //console.log("then1.5"); + console.log("then1.5"); } else { - //console.log("then1.6"); + console.log("then1.6"); Alertify.error(this.strings.error_network); - //console.log("then1.7"); + console.log("then1.7"); this.error_messages.push(this.strings.error_network); - //console.log("then1.8"); + console.log("then1.8"); } }) .catch((e) => { - //console.log("catch1"); + console.log("catch1"); Alertify.error(this.strings.error_network); - //console.log("catch2"); + console.log("catch2"); this.error_messages.push(this.strings.error_network); - //console.log("catch3"); + console.log("catch3"); }) .finally(() => { - //console.log("finally1"); + console.log("finally1"); this.saving_loader = false; - //console.log("finally2"); + console.log("finally2"); //this.addLogsIntoDB("saved", "configuration", "weeks", "Saved a new configuration for the weeks !"); }); }, diff --git a/notemyprogress/classes/configweeks.php b/notemyprogress/classes/configweeks.php index 285d68d8c3a2d02821de66b66cf7f0f8d7ea342c..bb0e8c4571cadc058e29f5971846dbaace9222a1 100644 --- a/notemyprogress/classes/configweeks.php +++ b/notemyprogress/classes/configweeks.php @@ -530,8 +530,6 @@ class configweeks $page->is_current_week = $week->weekcode == $current_week->weekcode ? true : false; array_push($pages, $page); } - //file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("pages = ", TRUE), FILE_APPEND); - //file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r($pages, TRUE), FILE_APPEND); return $pages; } } diff --git a/notemyprogress/classes/lib_trait.php b/notemyprogress/classes/lib_trait.php index 6cf0537022a54ce834b8e0a3ee1ee08ec7e3f7d7..ec343fcdbc778058cba2704c72334645fc6e0cd0 100644 --- a/notemyprogress/classes/lib_trait.php +++ b/notemyprogress/classes/lib_trait.php @@ -257,17 +257,14 @@ trait lib_trait { global $DB; $sql = "select sequence from {course_sections} where id = ?"; - $sequence = $DB->get_record_sql($sql, array($sectionid)); - //debug_text::print("sequence", $sequence); + $sequence = $DB->get_record_sql($sql, array($sectionid)); $course_modules = self::get_course_module_section($sequence->sequence); - //debug_text::print("course_modules", $course_modules); + return $course_modules; } public function get_course_module_section($sequence) { - // //file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("sequence = \r\n", TRUE), FILE_APPEND); - // //file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r($sequence, TRUE), FILE_APPEND); $sequence = explode(',', $sequence); $course_modules = array(); foreach ($sequence as $key => $course_module_id) { diff --git a/notemyprogress/classes/metareflexion.php b/notemyprogress/classes/metareflexion.php index f66991f3037309dd1969c2fee89d01e6368b0463..1ca592a8a404985831529ba9c5de54b2c1bcace3 100644 --- a/notemyprogress/classes/metareflexion.php +++ b/notemyprogress/classes/metareflexion.php @@ -166,18 +166,22 @@ class metareflexion //debug_text::print("sectionid", $section->sectionid); $course_modules = self::get_sequence_section($section->sectionid); //debug_text::print("course_modules", $course_modules); - foreach ($course_modules as $key => $cm) { - //debug_text::print("cm", $cm); - //if ($cm->modname == "resource") { - //debug_text::print("resource"); - $cm->modname = self::get_resource_type($cm->id); - // if ($current_wk_schedule) { - // //debug_text::print("current_wk_schedule exists"); - // $days_committed_for_module = $this->get_days_committed($cm->id); - // foreach ($days_committed_for_module as $key => $day) { - // array_push($days_committed[$day->description], $cm->id); - // } - // } + if ($course_modules["0"] === false){ + } + else{ + foreach ($course_modules as $key => $cm) { + //debug_text::print("cm", $cm); + //if ($cm->modname == "resource") { + //debug_text::print("resource"); + $cm->modname = self::get_resource_type($cm->id); + // if ($current_wk_schedule) { + // //debug_text::print("current_wk_schedule exists"); + // $days_committed_for_module = $this->get_days_committed($cm->id); + // foreach ($days_committed_for_module as $key => $day) { + // array_push($days_committed[$day->description], $cm->id); + // } + // } + } } } @@ -211,7 +215,7 @@ class metareflexion $weekly_schedules_days->dias_trabajados = $dias_trabajados; $current_week->weekly_schedules_days = $weekly_schedules_days; - $current_week->weekly_schedules_hours = 1; + $current_week->weekly_schedules_hours = 0; $current_week->weekly_cm = $course_modules; $goals_cat = $this->get_goals_cat(); diff --git a/notemyprogress/lang/en/local_notemyprogress.php b/notemyprogress/lang/en/local_notemyprogress.php index 60904628e29f932dd42edcd2e5f116c97d28616c..d13e8d9784ad8fffc6f662159a6e4a81fea57ad1 100644 --- a/notemyprogress/lang/en/local_notemyprogress.php +++ b/notemyprogress/lang/en/local_notemyprogress.php @@ -866,6 +866,7 @@ $string['set_weeks_title'] = "Setting up the course weeks"; $string['set_weeks'] = "Configuration of the course weeks"; /*Metareflexion*/ +$string['metareflexion_no_modules_in_section'] = "This week has no modules"; $string['compare_with_course'] = "Compare my results with those of my colleagues"; $string['sr_menu_metareflexion'] = "Metareflexion"; $string['metareflexion_last_week_created'] = "Last week's reflections have been saved"; diff --git a/notemyprogress/lang/es/local_notemyprogress.php b/notemyprogress/lang/es/local_notemyprogress.php index 12a9bf4224b3bff1a83d07a36a4bdc32b98970e0..b77fd6a5a8e4934c4a44deb997b3bfbf98f2771d 100644 --- a/notemyprogress/lang/es/local_notemyprogress.php +++ b/notemyprogress/lang/es/local_notemyprogress.php @@ -868,7 +868,7 @@ $string['notes_message_not_updated'] = 'No se ha podido actualizar la nota.'; /*Metareflexion*/ - +$string['metareflexion_no_modules_in_section'] = "Esta semana no hay módulos"; $string['compare_with_course'] = "Comparar mis resultados con los de mis compañeros"; $string['sr_menu_metareflexion'] = "Metareflexión"; $string['metareflexion_last_week_created'] = 'Reflexiones de la semana pasada guardadas'; diff --git a/notemyprogress/lang/fr/local_notemyprogress.php b/notemyprogress/lang/fr/local_notemyprogress.php index d52adb7ae7a52cbc53f405eae058194d56b29db0..94e199cac1b1bf3cc9269f99ebcf06befdbd40bd 100644 --- a/notemyprogress/lang/fr/local_notemyprogress.php +++ b/notemyprogress/lang/fr/local_notemyprogress.php @@ -869,6 +869,7 @@ $string['notes_message_updated'] = "La note a été mise à jour"; $string['notes_message_not_updated'] = "Note n'a pas pu être mise à jour'"; /*Metareflexion*/ +$string['metareflexion_no_modules_in_section'] = "Cette semaine n'as pas de modules"; $string['compare_with_course'] = "Comparer mes résultats avec ceux de mes collègues"; $string['sr_menu_metareflexion'] = "Méta-réflexion"; $string['metareflexion_last_week_created'] = "Les réflexions de la semaine dernière ont été sauvegardées"; diff --git a/notemyprogress/lib.php b/notemyprogress/lib.php index ef55353de6638ba0f009fb681fdb077981c55336..95b9ec7190073768af2252440527173e46a58c7d 100644 --- a/notemyprogress/lib.php +++ b/notemyprogress/lib.php @@ -114,11 +114,11 @@ function local_notemyprogress_render_navbar_output(\renderer_base $renderer) array_push($items, local_notemyprogress_new_menu_item(s($text), $url)); } - // if (has_capability('local/notemyprogress:teacher_planning', $context) && $configuration_is_set) { - // $text = get_string('menu_planning', 'local_notemyprogress'); - // $url = new moodle_url('/local/notemyprogress/metareflexion.php?courseid=' . $COURSE->id); - // array_push($items, local_notemyprogress_new_menu_item(s($text), $url)); - // } + if (has_capability('local/notemyprogress:teacher_planning', $context) && $configuration_is_set) { + $text = get_string('menu_planning', 'local_notemyprogress'); + $url = new moodle_url('/local/notemyprogress/metareflexion.php?courseid=' . $COURSE->id); + array_push($items, local_notemyprogress_new_menu_item(s($text), $url)); + } if (has_capability('local/notemyprogress:student_planning', $context) && !is_siteadmin() && $configuration_is_set) { $text = get_string('menu_planning', 'local_notemyprogress'); diff --git a/notemyprogress/metareflexion.php b/notemyprogress/metareflexion.php index dd942332fd9571046628a01e9b42e95da8cb492d..e7908d4557aff95b5984435b79cdf6b5346bcd04 100644 --- a/notemyprogress/metareflexion.php +++ b/notemyprogress/metareflexion.php @@ -179,6 +179,7 @@ $content = [ "goals_reflexion_title" => get_string("metareflexion_goals_reflexion_title", "local_notemyprogress"), "title_hours_plan" => get_string("metareflexion_title_hours_plan", "local_notemyprogress"), "title_retrospective" => get_string("metareflexion_title_retrospective", "local_notemyprogress"), + "no_modules_in_section" => get_string("metareflexion_no_modules_in_section", "local_notemyprogress"), ), //'indicators' => $reports->get_general_indicators(), diff --git a/notemyprogress/templates/metareflexion.mustache b/notemyprogress/templates/metareflexion.mustache index ba0f40ffd052cc667e3c7005061b21613e55ef4a..1f8e7b8d268bb709061936b302c43be68d04baf8 100644 --- a/notemyprogress/templates/metareflexion.mustache +++ b/notemyprogress/templates/metareflexion.mustache @@ -48,7 +48,7 @@ <span class="ml-2 d-flex" v-text="strings.currentweek_dialog_daysdedicate"></span> <v-row cols="12" md="6"> <v-layout> - <template> + <template v-if="current_week[0].weekly_cm[0]"> <v-simple-table class="resource_list_week"> <template v-slot:default> <thead> @@ -78,6 +78,11 @@ </template> </v-simple-table> </template> + <template v-else> + <v-row cols="12" class="justify-center"> + <span class="justify-center" v-text="strings.no_modules_in_section"></span> + </v-row> + </template> </v-row> </v-card-text>