Skip to content
Snippets Groups Projects
Commit 3418f869 authored by Yoshi5123's avatar Yoshi5123
Browse files

Planification saving

parent eaa96889
Branches
Tags
No related merge requests found
Showing
with 1291 additions and 797 deletions
......@@ -54,7 +54,13 @@ $scriptname = optional_param('scriptname', false, PARAM_ALPHA);
$action = optional_param('action', false, PARAM_ALPHA);
$weeks = optional_param('weeks', false, PARAM_RAW);
$profile = optional_param('profile', false, PARAM_RAW);
$weekcode = optional_param('weekcode', false, PARAM_INT);
$dayscommitted = optional_param('days', false, PARAM_TEXT);
$goalscommitted = optional_param('goals', false, PARAM_TEXT);
$hourscommitted = optional_param('hours', false, PARAM_INT);
$idmetareflexion = optional_param('metareflexionid', false, PARAM_INT);
$groupid = optional_param('groupid', null, PARAM_INT);
$subject = optional_param('subject', false, PARAM_TEXT);
......@@ -69,6 +75,8 @@ $newinstance = optional_param('newinstance', false, PARAM_BOOL);
$params = array();
$func = null;
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("Enter ajax file", TRUE), FILE_APPEND);
if ($action == 'saveconfigweek') {
array_push($params, $weeks);
array_push($params, $courseid);
......@@ -147,11 +155,24 @@ if ($action == 'saveconfigweek') {
array_push($params, $userid);
array_push($params, $weekcode);
array_push($params, $dayscommitted);
array_push($params, $goalscommitted);
array_push($params, $hourscommitted);
array_push($params, $courseid);
if ($userid && $weekcode && $dayscommitted && $hourscommitted && $courseid) {
if ($userid && $weekcode && $dayscommitted && $goalscommitted && $hourscommitted && $courseid) {
$func = "local_sr_save_metareflexion";
}
} elseif ($action == 'updatemetareflexion') {
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("Enter ajax if updatemetareflexion", TRUE), FILE_APPEND);
array_push($params, $userid);
array_push($params, $weekcode);
array_push($params, $idmetareflexion);
array_push($params, $dayscommitted);
array_push($params, $goalscommitted);
array_push($params, $hourscommitted);
array_push($params, $courseid);
if ($userid && $weekcode && $idmetareflexion && $dayscommitted && $goalscommitted && $hourscommitted && $courseid) {
$func = "local_sr_update_metareflexion";
}
} elseif ($action == 'downloadMOODLElogs') {
array_push($params, $beginDate);
array_push($params, $lastDate);
......@@ -187,8 +208,6 @@ if ($action == 'saveconfigweek') {
}
}
if (isset($params) && isset($func)) {
call_user_func_array($func, $params);
} else {
......@@ -197,6 +216,39 @@ if (isset($params) && isset($func)) {
}
function local_sr_save_metareflexion($userid, $weekcode, $dayscommitted, $goalscommitted, $hourscommitted, $courseid)
{
$metareflexion = new \local_notemyprogress\metareflexion($courseid, $userid);
$metareflexion->weekcode = $weekcode;
$metareflexion->days = $dayscommitted;
$metareflexion->goals_committed = $goalscommitted;
$metareflexion->hours = $hourscommitted;
$metareflexionid = $metareflexion->save_metareflexion();
local_notemyprogress_ajax_response(array('responsemetareflexion' => $metareflexionid));
}
function local_sr_update_metareflexion($userid, $weekcode, $idmetareflexion, $dayscommitted, $goalscommitted, $hourscommitted, $courseid)
{
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("Enter local_sr_update_metareflexion", TRUE), FILE_APPEND);
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("userid = " . $userid, TRUE), FILE_APPEND);
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("idmetareflexion = " . $idmetareflexion, TRUE), FILE_APPEND);
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("dayscommitted = " . $dayscommitted, TRUE), FILE_APPEND);
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("goalscommitted = " . $goalscommitted, TRUE), FILE_APPEND);
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("hourscommitted = " . $hourscommitted, TRUE), FILE_APPEND);
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("courseid = " . $courseid, TRUE), FILE_APPEND);
$metareflexion = new \local_notemyprogress\metareflexion($courseid, $userid, $idmetareflexion);
$metareflexion->id = $idmetareflexion;
$metareflexion->weekcode = $weekcode;
$metareflexion->days = $dayscommitted;
$metareflexion->goals_committed = $goalscommitted;
$metareflexion->hours = $hourscommitted;
$metareflexionid = $metareflexion->update_metareflexion();
local_notemyprogress_ajax_response(array('responsemetareflexion' => $metareflexionid));
}
function local_notemyprogress_logsNMP($beginDate, $lastDate, $courseid, $userid, $currentUrl)
{
$logs = new \local_notemyprogress\logs($courseid, $userid);
......
......@@ -4,7 +4,7 @@ define([
"local_notemyprogress/axios",
"local_notemyprogress/alertify",
"local_notemyprogress/pagination",
//"local_student_reports/chartcomponent",
//"local_notemyprogress/chartcomponent",
"local_notemyprogress/chartstatic",
"local_notemyprogress/pageheader",
], function (Vue, Vuetify, Axios, Alertify, Pagination, Chart, Pageheader) {
......@@ -20,12 +20,27 @@ define([
Vue.component("chart", Chart);
Vue.component("pageheader", Pageheader);
var vue = new Vue({
let vue = new Vue({
delimiters: ["[[", "]]"],
el: "#metareflexion",
vuetify: new Vuetify(),
data() {
return {
module_groups : content.module_groups,
indicators: content.indicators,
resources_access_colors: content.resources_access_colors,
inverted_time_colors: content.inverted_time_colors,
inverted_time: content.indicators.inverted_time,
hours_sessions: content.indicators.hours_sessions,
sections: content.indicators.sections,
sections_map: null,
week_progress: 0,
resource_access_categories: [],
resource_access_data: [],
modules_dialog: false,
help_dialog: false,
help_contents: [],
disabled_form: false,
groups: content.groups,
students_planification: content.students_planification,
......@@ -50,36 +65,6 @@ define([
past_week: content.lastweek,
render_has: content.profile_render,
dialog: false,
days_committed: [
{
name: "monday",
modules: [],
},
{
name: "tuesday",
modules: [],
},
{
name: "wednesday",
modules: [],
},
{
name: "thursday",
modules: [],
},
{
name: "friday",
modules: [],
},
{
name: "saturday",
modules: [],
},
{
name: "sunday",
modules: [],
},
],
days_week: [
content.strings.currentweek_day_lun,
content.strings.currentweek_day_mar,
......@@ -232,9 +217,23 @@ define([
if (typeof this.past_week.id != "undefined") {
this.disabled_form = true;
}
this.display_debug(this.current_week[0].goals_committed["goal3"]);
},
computed: {
progress() {
var count_all = 0;
var count_finished = 0;
Object.keys(this.module_groups).map((key) => {
let group = this.module_groups[key];
count_all += group.count_all;
count_finished += group.count_finished;
});
let average = (count_finished * 100) / count_all;
average = Number.isNaN(average) ? 0 : average.toFixed(0);
return average;
},
isDisabledBtnLastWeek() {
return (
this.past_week.classroom_hours >= 0 &&
......@@ -254,18 +253,18 @@ define([
return last_week;
},
isDisabledBtnCurrentWeek() {
return (
this.current_week[0].weekly_schedules_hours > 0 &&
(this.current_week[0].weekly_schedules_days.lun == true ||
this.current_week[0].weekly_schedules_days.mar == true ||
this.current_week[0].weekly_schedules_days.mie == true ||
this.current_week[0].weekly_schedules_days.jue == true ||
this.current_week[0].weekly_schedules_days.vie == true ||
this.current_week[0].weekly_schedules_days.sab == true ||
this.current_week[0].weekly_schedules_days.dom == true)
);
},
// isDisabledBtnCurrentWeek() {
// return (
// this.current_week[0].weekly_schedules_hours > 0 &&
// (this.current_week[0].weekly_schedules_days.lun == true ||
// this.current_week[0].weekly_schedules_days.mar == true ||
// this.current_week[0].weekly_schedules_days.mie == true ||
// this.current_week[0].weekly_schedules_days.jue == true ||
// this.current_week[0].weekly_schedules_days.vie == true ||
// this.current_week[0].weekly_schedules_days.sab == true ||
// this.current_week[0].weekly_schedules_days.dom == true)
// );
// },
benefits_attending_has_data() {
var attending_has_data = false;
......@@ -298,14 +297,134 @@ define([
methods: {
display_debug() {
console.log(this.days_committed[0].modules[0]);
console.log(this.days_committed[1].modules[0]);
console.log(this.days_committed[2].modules[0]);
console.log(this.days_committed[3].modules[0]);
console.log(this.days_committed[4].modules[0]);
console.log(this.days_committed[5].modules[0]);
console.log(this.days_committed[6].modules[0]);
convert_time(time) {
time *= 3600; // pasar las horas a segundos
let h = this.strings.hours_short;
let m = this.strings.minutes_short;
let s = this.strings.seconds_short;
let hours = Math.floor(time / 3600);
let minutes = Math.floor((time % 3600) / 60);
let seconds = Math.floor(time % 60);
let text;
if (hours >= 1) {
if (minutes >= 1) {
text = `${hours}${h} ${minutes}${m}`;
} else {
text = `${hours}${h}`;
}
} else if (minutes >= 1) {
if (seconds >= 1) {
text = `${minutes}${m} ${seconds}${s}`;
} else {
text = `${minutes}${m}`;
}
} else {
text = `${seconds}${s}`;
}
return text;
},
get_help_content() {
let contents = [];
contents.push({
title: this.strings.section_help_title,
description: this.strings.section_help_description,
});
return contents;
},
build_inverted_time_chart() {
//console.log(this.students_planification);
//console.log("this.data_report_meta_hours = ");
//console.log(this.data_report_meta_hours);
let chart = new Object();
let meta = new Object();
meta = this.chartdata_hours_week_dedication();
console.log("meta = ");
console.log(meta);
let invest = [
{
name: meta.labels[0],
y: meta.datasets[0].data[0],
},
{
name: meta.labels[1],
y: meta.datasets[0].data[1],
},
{
name: meta.labels[2],
y: meta.datasets[0].data[2],
},
];
chart.chart = {
type: "bar",
backgroundColor: null,
style: { fontFamily: "poppins" },
};
chart.title = { text: null };
chart.colors = this.inverted_time_colors;
chart.xAxis = {
type: "category",
crosshair: true,
};
chart.yAxis = {
title: {
text: this.strings.inverted_time_chart_x_axis,
},
};
chart.tooltip = {
shared: true,
useHTML: true,
formatter: function () {
let category_name = this.points[0].key;
let time = vue.convert_time(this.y);
return `<b>${category_name}: </b>${time}`;
},
};
chart.legend = {
enabled: false,
};
chart.series = [
{
colorByPoint: true,
data: invest,
},
];
console.log("this.inverted_time.data = ");
console.log(this.inverted_time.data);
// console.log("invest = ");
// console.log(invest);
return chart;
},
update_goal(goal_id, event) {
if (event) {
this.current_week[0].goals_committed.push(goal_id);
} else {
const i = this.current_week[0].goals_committed.indexOf(goal_id);
console.log(i);
this.current_week[0].goals_committed.splice(i, 1);
}
console.log(this.current_week[0].goals_committed);
},
update_module(day, module_id, event) {
if (event) {
this.current_week[0].days_committed[day].push(module_id);
} else {
const i =
this.current_week[0].days_committed[day].indexOf(module_id);
console.log(i);
this.current_week[0].days_committed[day].splice(i, 1);
}
console.log(this.current_week[0].days_committed[day]);
},
display_debug(goals) {
//console.log(goals);
//console.log("key = " + key);
//console.log("value = " + this.current_week[0].goals_committed[key]);
},
subtitle_reports_hours_label() {
......@@ -495,22 +614,24 @@ define([
dataset.borderWidth = 0;
data.datasets.push(dataset);
if (this.render_has == "student" && this.compare_with_course) {
data.labels.splice(1, 0, this.strings.inverted_time_course);
data.labels.splice(3, 0, this.strings.planified_time_course);
dataset.data.splice(
1,
0,
parseFloat(this.course_report_hours.horas_trabajadas)
);
dataset.data.splice(
3,
0,
parseFloat(this.course_report_hours.horas_planificadas)
);
dataset.backgroundColor.splice(1, 0, "#ffa700");
dataset.backgroundColor.splice(3, 0, "#a0c2fa");
}
//if (this.render_has == "student" && this.compare_with_course) {
data.labels.splice(1, 0, this.strings.inverted_time_course);
//data.labels.splice(3, 0, this.strings.planified_time_course);
dataset.data.splice(
1,
0,
parseFloat(this.course_report_hours.horas_trabajadas)
);
// dataset.data.splice(
// 3,
// 0,
// parseFloat(this.course_report_hours.horas_planificadas)
// );
dataset.backgroundColor.splice(1, 0, "#ffa700");
//dataset.backgroundColor.splice(3, 0, "#a0c2fa");
//}
console.log("data = ");
console.log(data);
return data;
},
......@@ -567,6 +688,7 @@ define([
action_save_metareflexion(course_module) {
if (course_module.weekly_schedules_id) {
console.log("update_metareflexion called");
this.update_metareflexion(course_module);
} else {
this.save_metareflexion_new(course_module);
......@@ -595,75 +717,80 @@ define([
},
update_metareflexion(course_module) {
var days_committed = this.get_selected_days(
course_module.weekly_schedules_days
);
var data_params = {
// var days_committed = this.get_selected_days(
// course_module.weekly_schedules_days
// );
var data = {
action: "updatemetareflexion",
metareflexionid: course_module.weekly_schedules_id,
days: days_committed,
// days: days_committed,
days: JSON.stringify(this.current_week[0].days_committed),
goals: this.current_week[0].goals_committed,
hours: course_module.weekly_schedules_hours,
courseid: this.courseid,
weekcode: course_module.weekcode,
userid: this.userid,
};
Axios({
method: "get",
url: M.cfg.wwwroot + "/local/local_notemyprogress/ajax.php",
params: data_params,
url: M.cfg.wwwroot + "/local/notemyprogress/ajax.php",
params: data,
})
.then((response) => {
if (response.status == 200 && response.data.valid) {
console.log("then");
if (response.status == 200 && response.data.ok) {
Alertify.success(this.strings.update_planification_success);
course_module.modalopened = false;
} else {
console.log("error if axios");
}
})
.catch((e) => {
console.log("catch");
this.saving_loader = false;
Alertify.error("No se pudo guardar la nota...");
Alertify.error("The note could not be saved...");
});
},
save_metareflexion_new(course_module) {
// var days_committed = "";
// Object.values(course_module.weekly_schedules_days).forEach(function (
// elemento,
// indice
// ) {
// if (elemento) {
// if (indice > 0) {
// days_committed += ",";
// }
// days_committed += Object.keys(course_module.weekly_schedules_days)[indice];
// }
// });
var days_committed = "";
var data_params = {
var data = {
action: "savemetareflexion",
userid: this.userid,
courseid: this.courseid,
weekcode: course_module.weekcode,
hours: course_module.weekly_schedules_hours,
goals: goals_committed,
days: days_committed,
goals: this.current_week[0].goals_committed,
days: JSON.stringify(this.current_week[0].days_committed),
};
Axios({
method: "get",
url: M.cfg.wwwroot + "/local/local_notemyprogress/ajax.php",
params: data_params,
url: M.cfg.wwwroot + "/local/notemyprogress/ajax.php",
params: data,
})
.then((response) => {
if (response.status == 200 && response.data.valid) {
console.log("then");
if (response.status == 200 && response.data.ok) {
course_module.weekly_schedules_id =
response.data.data.responsemetareflexion.id;
console.log(response.data.data.responsemetareflexion.days);
console.log("if");
Alertify.success(this.strings.save_planification_success);
course_module.modalopened = false;
} else {
console.log("else status");
Alertify.error(this.strings.api_error_network);
}
})
.catch((e) => {
console.log("catch");
this.saving_loader = false;
Alertify.error(this.strings.api_error_network);
})
.finally(() => {
console.log("finally");
this.saving_loader = false;
});
},
......
......@@ -183,9 +183,7 @@ define([
backgroundColor: null,
style: { fontFamily: "poppins" },
};
chart.title = {
text: null,
};
chart.title = { text: null };
chart.colors = this.inverted_time_colors;
chart.xAxis = {
type: "category",
......
This diff is collapsed.
......@@ -86,18 +86,22 @@ define(["local_notemyprogress/vue",
};
chart.colors = this.week_resources_colors;
chart.xAxis = {
categories: this.week_resources_categories
//categories: this.week_resources_categories
categories:;
};
chart.yAxis = {
min: 0,
title: {
text: this.strings.teacher_indicators_week_resources_yaxis_title
//text: this.strings.teacher_indicators_week_resources_yaxis_title
text:;
}
};
chart.legend = {
enabled: false
};
chart.series = this.week_resources_data;
// chart.series = this.week_resources_data;
chart.series = ;
return chart;
},
......
......@@ -104,9 +104,9 @@ class configweeks
}
/**
* Agrega el campo sections a la variable de clase semanas para almacenar las secciones asignadas a cada semana.
* Adds the sections field to the weeks class variable to store the sections assigned to each week.
*
* @return array una lista con las semanas del curso y las secciones asignadas a cada una
* @return array a list with the weeks of the course and the sections assigned to each one.
* @throws coding_exception | dml_exception
*/
public function get_weeks_with_sections()
......
......@@ -255,12 +255,18 @@ trait lib_trait
global $DB;
$sql = "select sequence from {course_sections} where id = ?";
$sequence = $DB->get_record_sql($sql, array($sectionid));
//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);
$course_modules = self::get_course_module_section($sequence->sequence);
//file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("course_modules = \r\n", TRUE), FILE_APPEND);
//file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r($course_modules, TRUE), FILE_APPEND);
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) {
......
......@@ -23,7 +23,7 @@ class metareflexion
public $benefit_going_class;
public $days;
public $goals_commited;
public $goals_committed;
public $goals_completed;
public $questions;
......@@ -40,36 +40,32 @@ class metareflexion
$this->past_week = $configweeks->get_past_week();
$this->weekcode = null;
$this->days = null;
$this->days = [];
$this->hours = null;
$this->goals_committed = [];
$this->metareflexionid = $idmetareflexion;
}
public function get_goals_cat(){
global $DB;
$sql = "select * from {notemyprogress_goals_ct}";
$goals_cat_res = $DB->get_record_sql($sql);
return $goals_cat_res ;
}
public function save_goals()
public function get_days_committed($id_module)
{
global $DB;
$goals_cats = get_goals_cat()
$lastweek = new stdClass();
$lastweek->userid = $this->user->id;
$lastweek->weekcode = $this->past_week->weekcode;
$lastweek->classroom_hours = $this->classroom_hours;
$lastweek->hours_off_course = $this->hours_off_course;
$lastweek->previous_class_learning = $this->previous_class_learning;
$lastweek->benefit_going_class = $this->benefit_going_class;
$id = $DB->insert_record("st_rpt_work_last_weeks", $lastweek, true);
$lastweek->id = $id;
return $lastweek;
$sql = "select notemyprogress_days.description from notemyprogress_days,notemyprogress_days_modules where notemyprogress_days.id = notemyprogress_days_modules.id_days and notemyprogress_days_modules.id_course_modules = ?";
$goals_cat_res = $DB->get_record_sql($sql, array($id_module));
return $goals_cat_res;
}
// public function get_previous_weeks(){
// global $DB;
// $weeks = $this->weeks;
// foreach ($weeks as $key => $week) {
// $sql = "select * from {mdl_notemyprogress_questions} where weekcode = ? and userid = ? order by id desc limit 1";
// $questions = $DB->get_records_sql($sql, array($week->weekcode, $this->user->id));
// foreach ($weeks as $key => $week) {
// }
// }
// }
public function find_last_week()
{
......@@ -145,76 +141,66 @@ class metareflexion
}
public function find_current_week()
{
$array_section_cm = array();
foreach ($this->current_week->sections as $key => $week) {
$course_modules = self::get_sequence_section($week->sectionid);
foreach ($course_modules as $key => $course_module) {
$course_module->weekcode = $this->current_week->weekcode;
$course_module->weekly_schedules_id = null;
//$course_module->weekly_schedules_days = array('lun' => false, 'mar' => false, 'mie' => false, 'jue' => false, 'vie' => false, 'sab' => false, 'dom' => false);
$course_module->weekly_schedules_hours = 0;
$cm_ws = self::get_schedules_cm($course_module->id);
if ($cm_ws) {
$explode_days = explode(',', $cm_ws->days);
foreach ($explode_days as $key => $day) {
$course_module->weekly_schedules_days[$day] = true;
}
$course_module->weekly_schedules_id = $cm_ws->id;
$course_module->weekly_schedules_hours = $cm_ws->hours;
}
array_push($array_section_cm, $course_module);
}
}
return $array_section_cm;
}
public function get_schedules_cm($cmid)
public function find_current_week_new()
{
global $DB;
$sql = "select * from {st_rpt_weekly_schedules} where userid = ? order by id desc limit 1";
$cm_week_schedules = $DB->get_record_sql($sql, array($this->user->id, $cmid));
return $cm_week_schedules;
}
$array_current_week = array();
$days_committed = array(
"monday" => array(),
"tuesday" => array(),
"wednesday" => array(),
"thursday" => array(),
"friday" => array(),
"saturday" => array(),
"sunday" => array(),
);
public function find_days()
{
$days = new stdClass();
}
$current_wk_schedule = self::get_schedules($this->current_week->weekcode);
public function find_current_week_new()
{
$array_section_cm = array();
foreach ($this->current_week->sections as $key => $week) {
$course_modules = self::get_sequence_section($week->sectionid);
foreach ($this->current_week->sections as $key => $section) {
// file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("sectionid = \r\n", TRUE), FILE_APPEND);
// file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r($section->sectionid, TRUE), FILE_APPEND);
$course_modules = self::get_sequence_section($section->sectionid);
foreach ($course_modules as $key => $cm) {
if ($cm->modname == "resource") {
$cm->modname = self::get_resource_type($cm->id);
if ($current_wk_schedule) {
$days_committed_for_module = $this->get_days_committed($cm->id);
foreach ($days_committed_for_module as $key => $day) {
$days_committed[$day->name][$cm->id] = $cm->modname;
}
}
}
}
}
$cm_ws = self::get_schedules_cm_new($this->current_week->weekcode);
$current_week = new stdClass();
$current_week->weekly_schedules_id = null;
$current_week->weekcode = $this->current_week->weekcode;
//$current_week->weekly_schedules_days = array('lun' => false, 'mar' => false, 'mie' => false, 'jue' => false, 'vie' => false, 'sab' => false, 'dom' => false);
$current_week->days_committed = $days_committed;
$current_week->weekly_schedules_hours = 0;
$current_week->weekly_cm = $course_modules;
if ($cm_ws) {
$explode_days = explode(',', $cm_ws->days);
foreach ($explode_days as $key => $day) {
$current_week->weekly_schedules_days[$day] = true;
}
$current_week->weekly_schedules_id = $cm_ws->id;
$current_week->weekly_schedules_hours = $cm_ws->hours;
if ($current_wk_schedule) {
// $explode_days = explode(',', $current_wk_schedule->days);
// foreach ($explode_days as $key => $day) {
// $current_week->weekly_schedules_days[$day] = true;
// }
$current_week->weekly_schedules_id = $current_wk_schedule->id;
$current_week->weekly_schedules_hours = $current_wk_schedule->hours;
}
array_push($array_section_cm, $current_week);
return $array_section_cm;
$goals_committed = array();
$goals_cat = $this->get_goals_cat();
//foreach ($goals_cat as $key => $cat) {
// $goals_committed[$cat->description] = false;
//}
$current_week->goals_categories = $goals_cat;
$current_week->goals_committed = [];
array_push($array_current_week, $current_week);
return $array_current_week;
}
public function get_schedules_cm_new($weekcode)
public function get_schedules($weekcode)
{
global $DB;
$sql = "select * from {st_rpt_weekly_schedules} where userid = ? and weekcode = ?";
......@@ -224,18 +210,50 @@ class metareflexion
public function save_metareflexion()
{
if (!isset($this->weekcode) || !isset($this->days) || !isset($this->hours)) {
if (!isset($this->weekcode) || !isset($this->days) || !isset($this->goals_committed) || !isset($this->hours)) {
return false;
}
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("Enter save_metareflexion", TRUE), FILE_APPEND);
global $DB;
//Add the weekly schedule to the st_rpt_weekly_schedules table
$metareflexion = new stdClass();
$metareflexion->userid = $this->user->id;
$metareflexion->weekcode = $this->weekcode;
$metareflexion->days = $this->days;
$metareflexion->goals_committed = $this->goals_committed;
$metareflexion->hours = $this->hours;
$metareflexion->timecreated = self::now_timestamp();
$metareflexion->timemodified = self::now_timestamp();
$meta = $DB->insert_record("st_rpt_weekly_schedules", $metareflexion, true);
//Add goals committed to the notemyprogress_goals table
foreach ($this->goals_committed as $key => $id_goal) {
$goal = new stdClass();
$goal->userid = $this->user->id;
$goal->id_goals_categories = $id_goal;
$goal->weekcode = $this->weekcode;
$goal->completed = 0;
$DB->insert_record("notemyprogress_goals", $goal, true);
}
//Create days in notemyprogress_days table
$day_descriptions = array("monday", "tuesday", "wednesday", "thursday", "friday", 'saturday', 'sunday');
$d_array = json_decode($this->days, true);
foreach ($day_descriptions as $day_description) {
$day = new stdClass();
$day->userid = $this->user->id;
$day->id_weekly_schedules = $meta;
$day->description = $day_description;
$id_day = $DB->insert_record("notemyprogress_days", $day, true);
//Create an entry in notemyprogress_days_modules table for each day and module associated
foreach ($d_array[$day_description] as $key => $id_module) {
$days_modules = new stdClass();
$days_modules->id_course_modules = $id_module;
$days_modules->id_days = $id_day;
$DB->insert_record("notemyprogress_days_modules", $days_modules, true);
}
}
//return metareflexion created
$this->metareflexionid = $meta;
$metareflexion->id = $meta;
return $metareflexion;
......@@ -243,17 +261,76 @@ class metareflexion
public function update_metareflexion()
{
if (!isset($this->metareflexionid) || !isset($this->days) || !isset($this->hours)) {
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("Enter update_metareflexion", TRUE), FILE_APPEND);
if (!isset($this->metareflexionid) || !isset($this->days) || !isset($this->goals_committed) || !isset($this->hours)) {
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("not set", TRUE), FILE_APPEND);
return false;
}
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("set", TRUE), FILE_APPEND);
global $DB;
//update schedule
$metareflexion = new stdClass();
$metareflexion->id = $this->metareflexionid;
$metareflexion->days = $this->days;
$metareflexion->hours = $this->hours;
$metareflexion->timemodified = self::now_timestamp();
$sql = "update {st_rpt_weekly_schedules} set days = ?, hours = ?, timemodified = ? where id = ?";
$result = $DB->execute($sql, array($metareflexion->days, $metareflexion->hours, self::now_timestamp(), $metareflexion->id));
$sql = "update {st_rpt_weekly_schedules} set hours = ?, timemodified = ? where id = ?";
$result = $DB->execute($sql, array($this->hours, self::now_timestamp(), $this->metareflexionid));
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("update", TRUE), FILE_APPEND);
//delete or add goals committed to the notemyprogress_goals table
$sql = "select id from {notemyprogress_goals}";
$query_goals = $DB->get_records_sql($sql);
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("select", TRUE), FILE_APPEND);
$goals_stored = array();
foreach ($query_goals as $key => $goal) {
array_push($goal->id);
}
$goals_to_add = array_diff($this->goals_committed, $goals_stored);
$goals_to_remove = array_diff($goals_stored, $this->goals_committed);
//file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("hello", TRUE));
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("goals_stored = ", TRUE), FILE_APPEND);
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r($goals_stored, TRUE), FILE_APPEND);
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("goals_to_add = ", TRUE), FILE_APPEND);
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r($goals_to_add, TRUE), FILE_APPEND);
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("goals_to_remove = ", TRUE), FILE_APPEND);
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r($goals_to_remove, TRUE), FILE_APPEND);
//Add the goals in $this->goals_committed and absent in the notemyprogress_goals table
foreach ($goals_to_add as $key => $id_goal) {
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("id_goal to add = " . $id_goal, TRUE), FILE_APPEND);
$goal = new stdClass();
$goal->userid = $this->user->id;
$goal->id_goals_categories = $id_goal;
$goal->weekcode = $this->weekcode;
$goal->completed = 0;
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("goal = ", TRUE), FILE_APPEND);
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r($goal, TRUE), FILE_APPEND);
$DB->insert_record("notemyprogress_goals", $goal, true);
}
//Delete the goals absent in $this->goals_committed and currently stored in the notemyprogress_goals table
foreach ($goals_to_remove as $key => $id_goal) {
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("id_goal to delete = " . $id_goal, TRUE), FILE_APPEND);
$sql = "delete from {notemyprogress_goals} where id = ?";
$result = $DB->execute($sql, array($id_goal));
}
//Delete previous notemyprogress_days_modules entries
$sql = "delete from {notemyprogress_days_modules}";
$result = $DB->execute($sql);
//Add entries
$d_array = json_decode($this->days, true);
foreach ($d_array as $key => $day) {
$sql = "select id from {notemyprogress_days} where id_weekly_schedules = ? and description = ? ";
$id_day = $DB->get_record_sql($sql, array($this->metareflexionid, $key));
//Create an entry in notemyprogress_days_modules table for each day and module associated
foreach ($day as $key => $id_module) {
file_put_contents('D:\Alexis\Stage_IRIT\NMP\debug\log.txt', print_r("id_module = " . $id_module, TRUE), FILE_APPEND);
$days_modules = new stdClass();
$days_modules->id_course_modules = $id_module;
$days_modules->id_days = $id_day->id;
$DB->insert_record("notemyprogress_days_modules", $days_modules, true);
}
}
return $metareflexion;
}
......@@ -288,4 +365,12 @@ class metareflexion
$result = $DB->execute($sql, array($lastweek->classroom_hours, $lastweek->hours_off_course, $lastweek->previous_class_learning, $lastweek->benefit_going_class, $lastweek->id));
return $lastweek;
}
public function get_goals_cat()
{
global $DB;
$sql = "select * from {notemyprogress_goals_ct}";
$goals_cat_res = $DB->get_records_sql($sql);
return $goals_cat_res;
}
}
......@@ -911,7 +911,7 @@ abstract class report
}
$tz = self::get_timezone();
date_default_timezone_set($tz);
$planifications = self::days_report_metereflexion($weekcode);
$planifications = array(true, false, true, false, true, true, false); //self::days_report_metereflexion($weekcode);
$weekstart = $week->weekstart;
$current_time = time();
$status = array();
......@@ -1038,7 +1038,6 @@ abstract class report
if (!empty($weekcode)) {
$week = self::find_week($weekcode);
}
$work_sessions = self::get_work_sessions($week->weekstart, $week->weekend);
$number_planned_days = self::planned_days($weekcode);
......@@ -1174,54 +1173,54 @@ abstract class report
}
}
protected function number_schedules_day($week_schedules)
{
$count_planned_days = new stdClass();
$count_planned_days->lun = 0;
$count_planned_days->mar = 0;
$count_planned_days->mie = 0;
$count_planned_days->jue = 0;
$count_planned_days->vie = 0;
$count_planned_days->sab = 0;
$count_planned_days->dom = 0;
foreach ($week_schedules as $key => $week_schedule) {
$days = explode(',', $week_schedule->days);
foreach ($days as $key => $day) {
switch ($day) {
case 'lun':
$count_planned_days->lun++;
break;
case 'mar':
$count_planned_days->mar++;
break;
case 'mie':
$count_planned_days->mie++;
break;
case 'jue':
$count_planned_days->jue++;
break;
case 'vie':
$count_planned_days->vie++;
break;
case 'sab':
$count_planned_days->sab++;
break;
case 'dom':
$count_planned_days->dom++;
break;
}
}
}
$data_days = array();
foreach (array_values((array)$count_planned_days) as $key => $value) {
array_push($data_days, $value);
}
return $data_days;
}
// protected function number_schedules_day($week_schedules)
// {
// $count_planned_days = new stdClass();
// $count_planned_days->lun = 0;
// $count_planned_days->mar = 0;
// $count_planned_days->mie = 0;
// $count_planned_days->jue = 0;
// $count_planned_days->vie = 0;
// $count_planned_days->sab = 0;
// $count_planned_days->dom = 0;
// foreach ($week_schedules as $key => $week_schedule) {
// $days = explode(',', $week_schedule->days);
// foreach ($days as $key => $day) {
// switch ($day) {
// case 'lun':
// $count_planned_days->lun++;
// break;
// case 'mar':
// $count_planned_days->mar++;
// break;
// case 'mie':
// $count_planned_days->mie++;
// break;
// case 'jue':
// $count_planned_days->jue++;
// break;
// case 'vie':
// $count_planned_days->vie++;
// break;
// case 'sab':
// $count_planned_days->sab++;
// break;
// case 'dom':
// $count_planned_days->dom++;
// break;
// }
// }
// }
// $data_days = array();
// foreach (array_values((array)$count_planned_days) as $key => $value) {
// array_push($data_days, $value);
// }
// return $data_days;
// }
public function hours_report_metereflexion($weekcode = null)
{
......
......@@ -27,52 +27,152 @@ namespace local_notemyprogress;
use stdClass;
class student extends report {
class student extends report
{
function __construct($courseid, $userid){
function __construct($courseid, $userid)
{
parent::__construct($courseid, $userid);
self::set_profile();
self::set_users();
}
public function get_modules_completion($weekcode = null)
{
if (!self::course_in_transit()) {
return null;
}
if (!self::course_has_users()) {
return null;
}
$week = $this->current_week;
if (!empty($weekcode)) {
$week = self::find_week($weekcode);
}
$course_modules = self::get_course_modules_from_sections($week->sections);
$course_modules = self::set_finished_modules($course_modules);
$summary = self::summary_finished_course_modules($course_modules);
return $summary;
}
private function set_finished_modules($course_modules)
{
$finished = self::get_finished_course_module($course_modules);
foreach ($course_modules as $key => $course_module) {
if (empty($course_module)) {
continue;
}
$course_module->finished = false;
$findies = array_filter($finished, function ($e) use ($course_module) {
return $e->contextinstanceid == $course_module->id;
});
if (!empty($findies)) {
$findies = array_values($findies);
$course_module->finished = self::to_format("Y-m-d H:i:s", $findies[0]->timecreated);
}
}
return $course_modules;
}
private function get_finished_course_module($course_modules)
{
if (empty($course_modules)) {
return array();
}
global $DB;
$finished = array();
$course_modules = self::extract_ids($course_modules);
list($users_in, $users_values) = $DB->get_in_or_equal($this->users);
list($course_modules_in, $course_modules_values) = $DB->get_in_or_equal($course_modules);
$sql_values = array_merge($users_values, $course_modules_values);
$sql = "select * from {logstore_standard_log} where courseid = {$this->course->id} AND userid $users_in AND contextinstanceid $course_modules_in order by timecreated asc";
$logs = $DB->get_recordset_sql($sql, $sql_values);
foreach ($logs as $key => $log) {
$findies = array_filter($finished, function ($e) use ($log) {return $e->contextinstanceid == $log->contextinstanceid;});
if (count($findies) == 0) {
array_push($finished, $log);
}
}
$logs->close();
return $finished;
}
private function summary_finished_course_modules($course_modules)
{
$groups = array();
foreach ($course_modules as $key => $course_module) {
if (empty($course_module)) {
continue;
}
if ($course_module->modname == "resource") {
$course_module->modname = self::get_resource_type($course_module->id);
}
if (!isset($groups[$course_module->modname])) {
$group = new stdClass();
$group->count_all = 0;
$group->count_pending = 0;
$group->count_finished = 0;
$groups[$course_module->modname] = $group;
}
$current_group = $groups[$course_module->modname];
$current_group->count_all++;
if ($course_module->finished) {
$current_group->count_finished++;
} else {
$current_group->count_pending++;
}
}
return $groups;
}
/**
* Almacena el perfil de visualización de la clase en la variable $profile de clase
*/
public function set_profile(){
public function set_profile()
{
$this->profile = "student";
}
/**
* Almacena el id del estudiante en la variable $users de la clase
*/
public function set_users(){
public function set_users()
{
$this->users = array($this->user->id);
return $this->users;
}
public function get_general_indicators () {
if(!self::course_in_transit()){
public function get_general_indicators()
{
if (!self::course_in_transit()) {
return null;
}
if(!self::course_has_users()){
if (!self::course_has_users()) {
return null;
}
$start = null;
if(isset($this->course->startdate) && ((int)$this->course->startdate) > 0) {
if (isset($this->course->startdate) && ((int)$this->course->startdate) > 0) {
$start = $this->course->startdate;
}
$end = null;
if(isset($this->course->enddate) && ((int)$this->course->enddate) > 0) {
if (isset($this->course->enddate) && ((int)$this->course->enddate) > 0) {
$end = $this->course->enddate;
}
$enable_completion = false;
if(isset($this->course->enablecompletion) && ((int)$this->course->enablecompletion) == 1) {
if (isset($this->course->enablecompletion) && ((int)$this->course->enablecompletion) == 1) {
$enable_completion = true;
}
$cms = self::get_course_modules();
$cms = array_filter($cms, function($cm){ return $cm['modname'] != 'label';});
$cms = array_filter($cms, function ($cm) {
return $cm['modname'] != 'label';
});
$cms = array_values($cms);
$user_sessions = self::get_work_sessions($start, $end);
......@@ -81,7 +181,9 @@ class student extends report {
$user = $this->get_users_course_grade($user);
$user = $this->get_users_items_grades($user);
$sessions = array_map(function($user_sessions){ return $user_sessions->sessions;}, $user_sessions);
$sessions = array_map(function ($user_sessions) {
return $user_sessions->sessions;
}, $user_sessions);
$sessions = self::get_sessions_by_weeks($sessions);
$sessions = self::get_sessions_by_weeks_summary($sessions, (int) $this->course->startdate);
......@@ -96,25 +198,30 @@ class student extends report {
return $response;
}
public function get_sessions($weekcode = null, $include_weeks = true){
if(!self::course_in_transit()){
public function get_sessions($weekcode = null, $include_weeks = true)
{
if (!self::course_in_transit()) {
return null;
}
if(!self::course_has_users()){
if (!self::course_has_users()) {
return null;
}
$week = $this->current_week;
if(!empty($weekcode)){
if (!empty($weekcode)) {
$week = self::find_week($weekcode);
}
$work_sessions = self::get_work_sessions($week->weekstart, $week->weekend);
$sessions = array_map(function($user_sessions){ return $user_sessions->sessions;}, $work_sessions);
$sessions = array_map(function ($user_sessions) {
return $user_sessions->sessions;
}, $work_sessions);
$sessions = self::get_sessions_by_hours($sessions);
$sessions = self::get_sessions_by_hours_summary($sessions);
$inverted_time = array_map(function($user_sessions){ return $user_sessions->summary;}, $work_sessions);
$inverted_time = array_map(function ($user_sessions) {
return $user_sessions->summary;
}, $work_sessions);
$inverted_time = self::calculate_average("added", $inverted_time);
$inverted_time = self::get_inverted_time_summary($inverted_time, (int) $week->hours_dedications, false);
......@@ -124,30 +231,32 @@ class student extends report {
if ($include_weeks) {
$start = null;
if(isset($this->course->startdate) && ((int)$this->course->startdate) > 0) {
if (isset($this->course->startdate) && ((int)$this->course->startdate) > 0) {
$start = $this->course->startdate;
}
$end = null;
if(isset($this->course->enddate) && ((int)$this->course->enddate) > 0) {
if (isset($this->course->enddate) && ((int)$this->course->enddate) > 0) {
$end = $this->course->enddate;
}
$enable_completion = false;
if(isset($this->course->enablecompletion) && ((int)$this->course->enablecompletion) == 1) {
if (isset($this->course->enablecompletion) && ((int)$this->course->enablecompletion) == 1) {
$enable_completion = true;
}
$work_sessions = self::get_work_sessions($start, $end);
$cms = self::get_course_modules();
$cms = array_filter($cms, function($cm){ return $cm['modname'] != 'label';});
$cms = array_filter($cms, function ($cm) {
return $cm['modname'] != 'label';
});
$cms = array_values($cms);
$user = self::get_progress_table($work_sessions, $cms, $enable_completion);
$response->course_cms = $cms;
$response->user_cms = $user[0]->cms->modules;
// $response->weeks = $this->weeks;
// $response->sections = $this->current_sections;
// $response->weeks = $this->weeks;
// $response->sections = $this->current_sections;
}
$response->sections = $week->sections;
return $response;
}
}
\ No newline at end of file
}
......@@ -42,6 +42,20 @@ function xmldb_local_notemyprogress_install()
$DB->insert_record("notemyprogress_goals_ct", $goal2,true);
$DB->insert_record("notemyprogress_goals_ct", $goal3,true);
//Create questions
$question1 = new stdClass();
$question2 = new stdClass();
$question3 = new stdClass();
$question4 = new stdClass();
$question1->description = "question1";
$question2->description = "question2";
$question3->description = "question3";
$question4->description = "question3";
$DB->insert_record("notemyprogress_questions_ct", $question1,true);
$DB->insert_record("notemyprogress_questions_ct", $question2,true);
$DB->insert_record("notemyprogress_questions_ct", $question3,true);
$DB->insert_record("notemyprogress_questions_ct", $question4,true);
$question = new stdClass();
$question->enunciated = 'question_number_one';
......
......@@ -41,7 +41,6 @@
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="weekcode" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="days" TYPE="char" LENGTH="1333" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="hours" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
......@@ -67,12 +66,10 @@
<TABLE NAME="notemyprogress_goals" COMMENT="table notemyprogress_goals">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="id_goals_categories" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="id_goals_categories" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="weekcode" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="completed" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
......@@ -113,10 +110,8 @@
<TABLE NAME="notemyprogress_days" COMMENT="table notemyprogress_days">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="weekcode" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="id_weekly_schedules" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="description" TYPE="char" LENGTH="1333" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="is_set" TYPE="char" LENGTH="1333" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
......@@ -126,7 +121,6 @@
<TABLE NAME="notemyprogress_days_modules" COMMENT="table notemyprogress_days_modules">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="id_course_modules" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="id_days" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
......
......@@ -114,18 +114,6 @@ 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/planning.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');
$url = new moodle_url('/local/notemyprogress/student_planning.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);
......
......@@ -31,6 +31,36 @@ if (!$configweeks->is_set()) {
$content = [
'strings' => array(
"inverted_time_chart_title" => get_string("fml_student_time_inverted_title", "local_notemyprogress"),
"inverted_time_chart_x_axis" => get_string("fml_student_time_inverted_x_axis", "local_notemyprogress"),
"inverted_time" => get_string("fml_student_inverted_time", "local_notemyprogress"),
"expected_time" => get_string("fml_student_expected_time", "local_notemyprogress"),
"resource_access_title" => get_string("fml_resource_access_title", "local_notemyprogress"),
"resource_access_x_axis" => get_string("fml_resource_access_x_axis", "local_notemyprogress"),
"resource_access_y_axis" => get_string("fml_resource_access_y_axis", "local_notemyprogress"),
"resource_access_legend1" => get_string("fml_resource_access_legend1", "local_notemyprogress"),
"resource_access_legend2" => get_string("fml_resource_access_legend2", "local_notemyprogress"),
"hours_sessions_title" => get_string("fml_hours_sessions_title", "local_notemyprogress"),
"week_progress_title" => get_string("fml_week_progress_title", "local_notemyprogress"),
"session_text" => get_string("fml_session_text", "local_notemyprogress"),
"sessions_text" => get_string("fml_sessions_text", "local_notemyprogress"),
"modules_details" => get_string("fml_modules_details", "local_notemyprogress"),
"hours_short" => get_string("fml_hours_short", "local_notemyprogress"),
"minutes_short" => get_string("fml_minutes_short", "local_notemyprogress"),
"seconds_short" => get_string("fml_seconds_short", "local_notemyprogress"),
"modules_access_chart_title" => get_string("fml_modules_access_chart_title", "local_notemyprogress"),
"modules_viewed" => get_string("fml_modules_viewed", "local_notemyprogress"),
"modules_no_viewed" => get_string("fml_modules_no_viewed", "local_notemyprogress"),
"modules_complete" => get_string("fml_modules_complete", "local_notemyprogress"),
"modules_interaction" => get_string("fml_modules_interaction", "local_notemyprogress"),
"modules_interactions" => get_string("fml_modules_interactions", "local_notemyprogress"),
"close_button" => get_string("fml_close_button", "local_notemyprogress"),
'hours_unit_time_label' => get_string('hours_unit_time_label', 'local_notemyprogress'),
'graph_generating' => get_string('graph_generating', 'local_notemyprogress'),
'last_week_update' => get_string('metareflexion_last_week_update', 'local_notemyprogress'),
......@@ -139,11 +169,16 @@ $content = [
"saved_form" => get_string("metareflexion_saved_form", "local_notemyprogress"),
"goals_title" => get_string("metareflexion_goals_title", "local_notemyprogress"),
),
'module_groups' => $reports->get_modules_completion(),
'indicators' => $reports->get_sessions(),
'inverted_time_colors' => array('#118AB2', '#118AB2', '#06D6A0'),
'sessions_count_colors' => array('#FFD166', '#06D6A0', '#118AB2'),
'cmcurrentweeknew' => $metareflexion->find_current_week_new(),
'lastweek' => $metareflexion->find_last_week(),
//'previous_weeks' => $metareflexion->get_previous_weeks(),
'userid' => $USER->id,
'courseid' => $courseid,
'data_report_days' => $reports->days_report_metereflexion(),
//'data_report_days' => $reports->days_report_metereflexion(),
'data_report_hours' => $reports->hours_report_metereflexion(),
'status_planning' => $reports->status_planning(),
'students_planification' => $reports->students_planification_summary(),
......@@ -156,10 +191,10 @@ $content = [
'image_no_data' => "{$CFG->wwwroot}/local/notemyprogress/img/empty_char.png",
'calendar_icon' => "{$CFG->wwwroot}/local/notemyprogress/img/calendar.png"
];
if (!has_capability('local/notemyprogress:view_as_teacher', $context)) {
$teacher = new \local_notemyprogress\teacher($COURSE->id, $USER->id);
$content['course_report_hours'] = $teacher->hours_report_metereflexion();
}
//if (!has_capability('local/notemyprogress:view_as_teacher', $context)) {
$teacher = new \local_notemyprogress\teacher($COURSE->id, $USER->id);
$content['course_report_hours'] = $teacher->hours_report_metereflexion();
//}
$PAGE->requires->js_call_amd('local_notemyprogress/metareflexion', 'init', ['content' => $content]);
echo $OUTPUT->header();
......
......@@ -43,13 +43,13 @@ $logs->addLogsNMP("viewed", "section", "TEACHER_STUDY_SESSIONS", "study_sessions
$reports = new \local_notemyprogress\teacher($COURSE->id, $USER->id);
$configweeks = new \local_notemyprogress\configweeks($COURSE, $USER);
if(!$configweeks->is_set()){
if (!$configweeks->is_set()) {
$message = get_string("weeks_not_config", "local_notemyprogress");
print_error($message);
}
$content = [
'strings' =>[
'strings' => [
"section_help_title" => get_string("ts_section_help_title", "local_notemyprogress"),
"section_help_description" => get_string("ts_section_help_description", "local_notemyprogress"),
"inverted_time_help_title" => get_string("ts_inverted_time_help_title", "local_notemyprogress"),
......@@ -134,19 +134,19 @@ $content = [
"ss_change_timezone" => get_string("ss_change_timezone", "local_notemyprogress"),
"graph_generating" => get_string("graph_generating", "local_notemyprogress"),
"api_error_network" => get_string("api_error_network", "local_notemyprogress"),
"pagination_name" => get_string("pagination_component_name","local_notemyprogress"),
"pagination_separator" => get_string("pagination_component_to","local_notemyprogress"),
"pagination_title" => get_string("pagination_title","local_notemyprogress"),
"helplabel" => get_string("helplabel","local_notemyprogress"),
"exitbutton" => get_string("exitbutton","local_notemyprogress"),
"pagination_name" => get_string("pagination_component_name", "local_notemyprogress"),
"pagination_separator" => get_string("pagination_component_to", "local_notemyprogress"),
"pagination_title" => get_string("pagination_title", "local_notemyprogress"),
"helplabel" => get_string("helplabel", "local_notemyprogress"),
"exitbutton" => get_string("exitbutton", "local_notemyprogress"),
"session_text" => get_string("fml_session_text","local_notemyprogress"),
"sessions_text" => get_string("fml_sessions_text","local_notemyprogress"),
"session_text" => get_string("fml_session_text", "local_notemyprogress"),
"sessions_text" => get_string("fml_sessions_text", "local_notemyprogress"),
"time_inverted_title" => get_string("fml_time_inverted_title","local_notemyprogress"),
"time_inverted_x_axis" => get_string("fml_time_inverted_x_axis","local_notemyprogress"),
"inverted_time" => get_string("fml_inverted_time","local_notemyprogress"),
"expected_time" => get_string("fml_expected_time","local_notemyprogress"),
"time_inverted_title" => get_string("fml_time_inverted_title", "local_notemyprogress"),
"time_inverted_x_axis" => get_string("fml_time_inverted_x_axis", "local_notemyprogress"),
"inverted_time" => get_string("fml_inverted_time", "local_notemyprogress"),
"expected_time" => get_string("fml_expected_time", "local_notemyprogress"),
"hours_short" => get_string("fml_hours_short", "local_notemyprogress"),
"minutes_short" => get_string("fml_minutes_short", "local_notemyprogress"),
......@@ -164,7 +164,7 @@ $content = [
'timezone' => $reports->timezone,
];
$PAGE->requires->js_call_amd('local_notemyprogress/sessions','init', ['content' => $content]);
$PAGE->requires->js_call_amd('local_notemyprogress/sessions', 'init', ['content' => $content]);
echo $OUTPUT->header();
echo $OUTPUT->render_from_template('local_notemyprogress/sessions', ['content' => $content]);
echo $OUTPUT->footer();
\ No newline at end of file
echo $OUTPUT->footer();
......@@ -18,23 +18,17 @@
<v-layout wrap v-for="(form_curren_week,index,key) in current_week" :key="key">
<v-card-text>
<v-col sm="8" offset-sm="2" class="d-flex justify-start align-center hide-input-details pa-0 mb-2">
<v-text-field :disabled="disabled_form" class="max_width_input" type="number" min="0" max="24" v-model="form_curren_week.weekly_schedules_hours" outlined placeholder="0"></v-text-field>
<v-text-field :disabled="disabled_form" class="max_width_input" type="number" min="0" max="24" v-model="form_curren_week.weekly_schedules_hours" @input="display_debug()" outlined placeholder="0"></v-text-field>
<span class="ml-2 d-flex" v-text="strings.currentweek_dialog_hoursdedicate"></span>
</v-col>
</v-card-text>
<v-card-text>
<span class="ml-2 d-flex" v-text="strings.goals_title"></span>
<v-row v-for="(past_week_question,index,key) in past_week.questions" :key="key">
<v-row v-for="(goal,index,key) in current_week[0].goals_categories" :key="key">
<v-col sm="8" offset-sm="2" class="pa-0">
<v-layout column>
<span class="justify-center seleccion_semana_pasada full-width" v-text="past_week_question.enunciated"></span>
<v-flex>
<v-alert outlined class="seleccion_semana_pasada">
<v-radio-group :disabled="disabled_form" :mandatory="false" v-model="past_week_question.answer_selected">
<v-radio :label="past_week_question_answer.enunciated" v-for="(past_week_question_answer,index,key) in past_week_question.answers" :key="key" :value="past_week_question_answer.id"></v-radio>
</v-radio-group>
</v-alert>
</v-flex>
<v-checkbox :label="goal.description" @change="update_goal(goal.id,$event)"></v-checkbox>
</v-layout>
</v-col>
</v-row>
......@@ -62,18 +56,16 @@
</tr>
</thead>
<tbody>
<template v-for="(cms,index,key) in current_week">
<tr v-for="(cm,index,key) in cms.weekly_cm" :key="key">
<tr v-for="(cm,index,key) in current_week[0].weekly_cm" :key="key">
<td v-text="cm.name"></td>
<td><v-checkbox v-model="days_committed[0].modules[index]" @change="display_debug()"></v-checkbox></td>
<td><v-checkbox v-model="days_committed[1].modules[index]" @change="display_debug()"></v-checkbox></td>
<td><v-checkbox v-model="days_committed[2].modules[index]" @change="display_debug()"></v-checkbox></td>
<td><v-checkbox v-model="days_committed[3].modules[index]" @change="display_debug()"></v-checkbox></td>
<td><v-checkbox v-model="days_committed[4].modules[index]" @change="display_debug()"></v-checkbox></td>
<td><v-checkbox v-model="days_committed[5].modules[index]" @change="display_debug()"></v-checkbox></td>
<td><v-checkbox v-model="days_committed[6].modules[index]" @change="display_debug()"></v-checkbox></td>
<td><v-checkbox @change="update_module('monday',cm.id,$event);"></v-checkbox></td>
<td><v-checkbox @change="update_module('tuesday',cm.id,$event)"></v-checkbox></td>
<td><v-checkbox @change="update_module('wednesday',cm.id,$event)"></v-checkbox></td>
<td><v-checkbox @change="update_module('thursday',cm.id,$event)"></v-checkbox></td>
<td><v-checkbox @change="update_module('friday',cm.id,$event)"></v-checkbox></td>
<td><v-checkbox @change="update_module('saturday',cm.id,$event)"></v-checkbox></td>
<td><v-checkbox @change="update_module('sunday',cm.id,$event)"></v-checkbox></td>
</tr>
</template>
</tbody>
</template>
</v-simple-table>
......@@ -84,13 +76,39 @@
<v-layout column justify-center>
<v-flex d-flex justify-center>
<v-btn class="sr-btn-primary" :disabled="!isDisabledBtnCurrentWeek" @click="action_save_days(form_curren_week,past_week)" v-text="strings.currentweek_dialog_btn_accept"></v-btn>
<v-btn class="sr-btn-primary" @click="action_save_metareflexion(form_curren_week)" v-text="strings.currentweek_dialog_btn_accept"></v-btn>
</v-flex>
</v-layout>
</v-layout>
</v-tab-item>
<v-tab-item v-if="must_renderize(tabs_header[1])">
<pagination :pages="pages" :name="strings.pagination_name" :nameseparator="strings.pagination_separator" @changepage="get_interaction_group" :title="strings.pagination_title"></pagination>
<v-col cols="12" md="6">
<v-card elevation="2">
<v-card-title class="justify-center"><h5 v-text="strings.inverted_time_chart_title"></h5></v-card-title>
<v-card-text>
<chart
:container="'inverted_time'"
:chart="build_inverted_time_chart()"
:lang="strings.chart"
></chart>
<span class="caption" @click="open_chart_help('inverted_time')">
<v-icon small v-text="'mdi-help-circle-outline'"></v-icon>
<span v-text="strings.about"></span>
</span>
</v-card-text>
</v-card>
</v-col>
<v-progress-linear :rotate="-90" :size="100" :width="15" :value="progress" color="#42a5f5" height="25px" :background-color="'#d8e8f8'" id="progress-bar-course" class="mt-2">
<strong v-text="progress + '%'"></strong>
</v-progress-linear>
<v-row v-for="(goal,index,key) in current_week[0].goals_categories" :key="key">
<v-col sm="8" offset-sm="2" class="d-flex justify-start align-center hide-input-details pa-0 mb-2">
<span class="ml-2 d-flex" v-text="strings.pastweek_classroom_hours"></span>
<v-text-field :disabled="disabled_form" class="max_width_input" type="number" min="0" max="24" v-model="past_week.classroom_hours" outlined placeholder="0"></v-text-field>
</v-col>
</v-row>
</v-tab-item>
</v-tabs>
</v-container>
......
......@@ -33,9 +33,6 @@
:chart="build_inverted_time_chart()"
:lang="strings.chart"
></chart>
<span id="helpInvestedTime" class="caption" @click="open_chart_help('inverted_time')">
<v-icon small v-text="'mdi-help-circle-outline'"></v-icon>
<span v-text="strings.about"></span>
</span>
</v-card-text>
</v-card>
......
......@@ -48,9 +48,9 @@
</v-card-title>
<v-card-text>
<chart
:container="'hour_sessions'"
:chart="build_hours_session_chart()"
:lang="strings.chart"
:container="'hour_sessions'"
:chart="build_hours_session_chart()"
:lang="strings.chart"
></chart>
<span class="caption" @click="open_chart_help('hours_session')">
<v-icon small v-text="'mdi-help-circle-outline'"></v-icon>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment