Skip to content
Snippets Groups Projects
Commit 6ba816be authored by CORDEL Yannick's avatar CORDEL Yannick
Browse files

Nettoyage code + personnalisation notification par défaut

parent 7f7de3d1
No related branches found
No related tags found
No related merge requests found
Showing
with 2946 additions and 3387 deletions
<?php
/**
* Created by PhpStorm.
* User: softia
* Date: 15/03/18
* Time: 16:22
*/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* sync_task_iena_message lunch cron_message()
*
* @package format_iena
* @category format
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace format_iena\task;
class sync_task_iena_message extends \core\task\scheduled_task
{
/**
* Get a descriptive name for this task (shown to admins).
*
* @return string
*/
public function get_name()
{
return "task_iena_message";
}
public function execute()
{
global $CFG;
mtrace("IENA notifications task started");
require_once($CFG->dirroot . '/course/format/iena/entity/course_format_iena_cron_action.php');
$cron_test = new \course_format_iena_cron_action();
// echo 'send message start';
$cron_test->cron_message();
mtrace("IENA notifications task completed");
// echo 'send message stop';
}
}
\ No newline at end of file
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* sync_task_iena_message lunch cron_message()
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace format_iena\task;
class sync_task_iena_message extends \core\task\scheduled_task {
/**
* Get a descriptive name for this task (shown to admins).
*
* @return string
*/
public function get_name() {
return "task_iena_message";
}
public function execute() {
global $CFG;
mtrace("IENA notifications task started");
require_once($CFG->dirroot . '/course/format/iena/entity/course_format_iena_cron_action.php');
$cron = new \course_format_iena_cron_action();
$cron->cron_message();
mtrace("IENA notifications task completed");
}
}
<?php
$capabilities = array(
'course/iena:suivi' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
)
),
'course/iena:suivi_edit' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
)
),
);
\ No newline at end of file
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Plugin capabilities
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
'course/iena:suivi' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
)
),
'course/iena:suivi_edit' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
)
),
);
<?php
/**
* Created by PhpStorm.
* User: softia
* Date: 15/03/18
* Time: 16:34
*/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* Set setting for cron
*
* @package format_iena
* @category format
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$tasks = array(
array(
'classname' => 'format_iena\task\sync_task_iena_message',
'blocking' => 0,
'minute' => '0',
'hour' => '22',
'day' => '*',
'month' => '*',
'dayofweek' => '*'
)
);
\ No newline at end of file
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* Set setting for cron
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$tasks = array(
array(
'classname' => 'format_iena\task\sync_task_iena_message',
'blocking' => 0,
'minute' => '0',
'hour' => '22',
'day' => '*',
'month' => '*',
'dayofweek' => '*'
)
);
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* Set setting for cron
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
function xmldb_format_iena_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = TRUE;
if ($oldversion < 2021220900) {
$dbman = $DB->get_manager();
$result = true;
//Support for old versions: we copy format options to the course_format_options table
if ($oldversion < 2021220900) {
// Support for old versions: we copy format options to the course_format_options table.
try {
$sections= $DB->get_records_sql('select * FROM {format_iena}');
}
catch (dml_exception $e) {
$sections = $DB->get_records_sql('select * FROM {format_iena}');
} catch (dml_exception $e) {
echo "Aucun cours avec le format hybride dans la base";
}
if(count($sections) > 0){
if (count($sections) > 0) {
foreach ($sections as $section) {
try {
$courseid = $DB->get_record_sql('SELECT course
FROM {course_sections}
WHERE id=?',
array($section->id_section));
$sectiondata = new stdClass();
$sectiondata->courseid = $courseid->course;
$sectiondata->format = "iena";
$sectiondata->sectionid = $section->id_section;
// On va faire pour présence, daterendu et daysnotif.
$sectiondata->name = "presence";
$sectiondata->value = $section->presence;
$exists = $DB->get_record_sql('SELECT *
FROM {course_format_options}
WHERE sectionid=?
AND name="presence"',
array($section->id_section));
$courseid = $DB->get_record_sql('select course FROM {course_sections} WHERE id=?', array($section->id_section));
$section_data = new stdClass();
$section_data->courseid = $courseid->course;
$section_data->format = "iena";
$section_data->sectionid = $section->id_section;
//On va faire pour présence, daterendu et daysnotif
$section_data->name = "presence";
$section_data->value = $section->presence;
$exists = $DB->get_record_sql('select * FROM {course_format_options} WHERE sectionid=? AND name="presence"', array($section->id_section));
if(!$exists){
$resultat = $DB->insert_record('course_format_options', $section_data, true);
if (!$exists) {
$resultat = $DB->insert_record('course_format_options', $sectiondata, true);
}
$exists = $DB->get_record_sql('select * FROM {course_format_options} WHERE sectionid=? AND name="daterendu"', array($section->id_section));
if(!$exists){
if(isset($section->date_rendu)){
$section_data->name = "daterendu";
$section_data->value = strtotime($section->date_rendu);
$resultat = $DB->insert_record('course_format_options', $section_data, true);
$exists = $DB->get_record_sql('SELECT *
FROM {course_format_options}
WHERE sectionid=?
AND name="daterendu"',
array($section->id_section));
if (!$exists) {
if (isset($section->date_rendu)) {
$sectiondata->name = "daterendu";
$sectiondata->value = strtotime($section->date_rendu);
$resultat = $DB->insert_record('course_format_options', $sectiondata, true);
}
}
$exists = $DB->get_record_sql('select * FROM {course_format_options} WHERE sectionid=? AND name="daysnotif"', array($section->id_section));
if(!$exists){
if(!empty($section->day_before)){
$section_data->name = "daysnotif";
$section_data->value = $section->nb_days_before;
$resultat = $DB->insert_record('course_format_options', $section_data, true);
$exists = $DB->get_record_sql('SELECT *
FROM {course_format_options}
WHERE sectionid=?
AND name="daysnotif"',
array($section->id_section));
if (!$exists) {
if (!empty($section->day_before)) {
$sectiondata->name = "daysnotif";
$sectiondata->value = $section->nb_days_before;
$resultat = $DB->insert_record('course_format_options', $sectiondata, true);
}
}
}
catch (dml_exception $e) {
} catch (dml_exception $e) {
}
}
}
// Format_iena savepoint reached.
upgrade_plugin_savepoint(true, 2021070600,'format', 'iena');
upgrade_plugin_savepoint(true, 2021070600, 'format', 'iena');
}
return $result;
}
?>
\ No newline at end of file
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
......@@ -14,53 +13,31 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* course_format_iena_sections
*
* @package format_iena
* @category format
* @copyright 2018 Softia/Université lorraine
* @author Thomas Fradet
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_format_iena_attendance
{
/**
* @param $id_course
* @return array
* @throws dml_exception
*/
public function get_attendance_sessions($course_id) {
global $DB;
// -- FROM {attendance_sessions}
// $DB->set_debug(true);
$res = $DB->get_records_sql('SELECT sessdate, att_sess.id, duration, groupid
FROM {attendance_sessions} as att_sess
INNER JOIN {attendance} as att on att_sess.attendanceid = att.id
WHERE att.course = ?'
, array($course_id));
return $res;
// $groups = array();
// $i = 0;
// foreach ($requete as $value) {
// $group = new course_format_iena_groups();
// $group->get_group_by_id_group($value->id);
// $groups[$i] = $group;
// $i++;
// }
// return $groups;
}
class course_format_iena_attendance {
/**
* @param $idcourse
* @return array
* @throws dml_exception
*/
public function get_attendance_sessions($courseid) {
global $DB;
$res = $DB->get_records_sql('SELECT sessdate, att_sess.id, duration, groupid
FROM {attendance_sessions} att_sess
INNER JOIN {attendance} att ON att_sess.attendanceid = att.id
WHERE att.course = ?',
array($courseid));
return $res;
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
......@@ -17,153 +16,147 @@
/**
*
* This file give completion datas to get and display completion infos.
* This file give completion datas to get and display completion infos.
*
* @package format_iena
* @category format
* @copyright 2018 Softia/Université lorraine
* @author Thomas Fradet
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_format_iena_completion {
/**
* Get completion by sections
* @param array $section_names
* @param array $idSection
* @return type
*/
public static function get_completion_by_section($section_names, $idSection) {
global $COURSE, $USER, $DB, $CFG;
$completion = new \completion_info($COURSE);
if ( $completion->is_enabled_for_site() == false || $completion->has_activities() == false || $completion->is_enabled() == 0 ) {
return false;
}
$sections = [];
$fast_modinfo = get_fast_modinfo($COURSE->id);
$modinfos_cms = $fast_modinfo->get_cms();
$modules = [];
//Il récupère les modules qui ne sont pas en cours de suppression, qui ont l'achèvement d'activité, et qui sont visibles pour l'user
foreach ($modinfos_cms as $cm) {
$module = $completion->get_data($cm, true, $USER->id, $fast_modinfo);
$module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
$module->section = $cm->section;
if ( $cm->deletioninprogress == 0 && $cm->completion != 0 && $cm->uservisible) {
$module->name = $cm->name;
$module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
$modules[] = $module;
}
}
$total_completed = 0;
$total_modules = 0;
foreach ($idSection as $i => $section_id) {
$section = new StdClass();
$section->id = $i;
$section->name = $section_names[$i];
$inner_modules = [];
$inner_completed = 0;
foreach ($modules as $module) {
if ( $module->section == $section_id) {
$mod = new StdClass();
$mod->coursemoduleid = $module->coursemoduleid;
$mod->completion = $module->completionstate;
$mod->name = $module->name;
$mod->url = $module->url;
if ( $mod->completion == 1 || $mod->completion == 2 ) {
$inner_completed++;
}
$inner_modules[] = $mod;
}
}
$section->modules = $inner_modules;
if ( count($inner_modules) == 0 ) {
$section->completion = 0;
} else {
$section->completion = number_format( 100 * $inner_completed / count($inner_modules), 0 );
}
$total_completed += $inner_completed;
$total_modules += count($inner_modules);
array_push($sections, $section);
}
if($total_modules==0){
return false;
}
$progress = new StdClass();
$progress->total = number_format( 100 * $total_completed / $total_modules, 0);
$progress->sections = $sections;
return $progress;
}
public static function get_completion_by_section_old() {
global $COURSE, $DB, $USER;
$completion = new \completion_info($COURSE);
if ( $completion->is_enabled_for_site() == false || $completion->has_activities() == false || $completion->is_enabled() == 0 ) {
return false;
}
$modinfo = get_fast_modinfo($COURSE->id);
$sections_infos = $modinfo->get_section_info_all();
$section_ids = [];
foreach ($sections_infos as $section) {
array_push($section_ids, $section->__get('id') );
}
$modules = $DB->get_records_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate, cm.section
FROM {course_modules_completion} as cmc
inner join {course_modules} as cm on cm.id = cmc.coursemoduleid
inner join {user} as u on u.id = cmc.userid
inner join {modules} as m on m.id = cm.module
where cm.course = ? and cm.deletioninprogress = 0
and cmc.userid = ?
order by section, coursemoduleid asc', array($COURSE->id, $USER->id));
$sections = [];
foreach ($section_ids as $i => $section_id) {
$section = new StdClass();
$section->id = $i;
$inner_modules = [];
$inner_completed = 0;
foreach ($modules as $module) {
if ( $module->section == $section_id ) {
$mod = new StdClass();
$mod->coursemoduleid = $module->coursemoduleid;
$mod->completion = $module->completionstate;
if ( $mod->completion == 1 || $mod->completion == 2 ) {
$inner_completed++;
}
$inner_modules[] = $mod;
}
}
$section->modules = $inner_modules;
if ( count($inner_modules) == 0 ) {
$section->completion = false;
} else {
$section->completion = number_format( 100 * $inner_completed / count($inner_modules), 0 );
}
array_push($sections, $section);
}
// echo '<pre>';
// var_dump($sections);
// echo '</pre>';
return $sections;
}
}
\ No newline at end of file
/**
* Get completion by sections
* @param array $sectionnames
* @param array $idsection
* @return type
*/
public static function get_completion_by_section($sectionnames, $idsection) {
global $COURSE, $USER, $DB, $CFG;
$completion = new \completion_info($COURSE);
if ($completion->is_enabled_for_site() == false
|| $completion->has_activities() == false || $completion->is_enabled() == 0) {
return false;
}
$sections = [];
$fastmodinfo = get_fast_modinfo($COURSE->id);
$modinfoscms = $fastmodinfo->get_cms();
$modules = [];
// Il récupère les modules qui ne sont pas en cours de suppression, qui ont l'achèvement d'activité,
// et qui sont visibles pour l'user.
foreach ($modinfoscms as $cm) {
$module = $completion->get_data($cm, true, $USER->id, $fastmodinfo);
$module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
$module->section = $cm->section;
if ($cm->deletioninprogress == 0 && $cm->completion != 0 && $cm->uservisible) {
$module->name = $cm->name;
$module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
$modules[] = $module;
}
}
$totalcompleted = 0;
$totalmodules = 0;
foreach ($idsection as $i => $sectionid) {
$section = new StdClass();
$section->id = $i;
$section->name = $sectionnames[$i];
$innermodules = [];
$innercompleted = 0;
foreach ($modules as $module) {
if ($module->section == $sectionid) {
$mod = new StdClass();
$mod->coursemoduleid = $module->coursemoduleid;
$mod->completion = $module->completionstate;
$mod->name = $module->name;
$mod->url = $module->url;
if ($mod->completion == 1 || $mod->completion == 2) {
$innercompleted++;
}
$innermodules[] = $mod;
}
}
$section->modules = $innermodules;
if (count($innermodules) == 0) {
$section->completion = 0;
} else {
$section->completion = number_format(100 * $innercompleted / count($innermodules), 0);
}
$totalcompleted += $innercompleted;
$totalmodules += count($innermodules);
array_push($sections, $section);
}
if ($totalmodules == 0) {
return false;
}
$progress = new StdClass();
$progress->total = number_format(100 * $totalcompleted / $totalmodules, 0);
$progress->sections = $sections;
return $progress;
}
public static function get_completion_by_section_old() {
global $COURSE, $DB, $USER;
$completion = new \completion_info($COURSE);
if ($completion->is_enabled_for_site() == false
|| $completion->has_activities() == false
|| $completion->is_enabled() == 0) {
return false;
}
$modinfo = get_fast_modinfo($COURSE->id);
$sectionsinfos = $modinfo->get_section_info_all();
$sectionids = [];
foreach ($sectionsinfos as $section) {
array_push($sectionids, $section->__get('id') );
}
$modules = $DB->get_records_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate, cm.section
FROM {course_modules_completion} cmc
INNER JOIN {course_modules} cm ON cm.id = cmc.coursemoduleid
INNER JOIN {user} u ON u.id = cmc.userid
INNER JOIN {modules} m ON m.id = cm.module
WHERE cm.course = ? AND cm.deletioninprogress = 0
AND cmc.userid = ?
ORDER BY section, coursemoduleid ASC',
array($COURSE->id, $USER->id));
$sections = [];
foreach ($sectionids as $i => $sectionid) {
$section = new StdClass();
$section->id = $i;
$innermodules = [];
$innercompleted = 0;
foreach ($modules as $module) {
if ($module->section == $sectionid) {
$mod = new StdClass();
$mod->coursemoduleid = $module->coursemoduleid;
$mod->completion = $module->completionstate;
if ($mod->completion == 1 || $mod->completion == 2) {
$innercompleted++;
}
$innermodules[] = $mod;
}
}
$section->modules = $innermodules;
if (count($innermodules) == 0) {
$section->completion = false;
} else {
$section->completion = number_format(100 * $innercompleted / count($innermodules), 0);
}
array_push($sections, $section);
}
return $sections;
}
}
<?php
/**
* Created by PhpStorm.
* User: softia
* Date: 15/03/18
* Time: 11:33
*/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* Class course_format_iena_cron_action
* This class hide and show section with setting present in table format_iena
* This class send message with setting present in table format_iena
*
* @package format_iena
* @category format
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille / Michaël Lebeau
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// include('../../lib.php');
// include('../../../../config.php');
class course_format_iena_cron_action
{
/**
* Récupère le nombre de jours avant le rendu/présence pour envoyer une notification
* @return type
*/
public function cron_message()
{
global $DB, $USER, $CFG;
$sections = $DB->get_records_sql("SELECT fo1.sectionid, fo1.value daysnotif, fo2.value daterendu, fo3.value presence, fo4.value msg FROM {course_format_options} fo1 LEFT JOIN {course_format_options} fo2 ON fo1.sectionid = fo2.sectionid LEFT JOIN {course_format_options} fo3 ON fo1.sectionid = fo3.sectionid LEFT JOIN {course_format_options} fo4 ON fo1.sectionid = fo4.sectionid WHERE fo1.format='iena' AND fo1.name ='daysnotif' AND (fo1.value IS NOT NULL) AND fo1.value != -1 AND fo2.name='daterendu' AND fo3.name='presence' AND fo4.name='msg'");
foreach ($sections as $section) {
$requete = $DB->get_record('course_sections', array('id' => $section->sectionid));
$date_notif = $this->is_notif($section);
if ($date_notif == false) {
continue;
}
$this->iena_send_message($requete, $section, $section->msg);
}
}
/**
* Check if it's time to send a notif by comparing the date withe the numbers of days before sending one in the db
* @param $section
* @return bool true if it's time to send a notif
*/
private function is_notif($section)
{
//On compare la date d'aujourd'hui avec le timestamp - daysnotifs
$date_now=date('Ymd');
$timenotif=strtotime('-'.$section->daysnotif.' days', $section->daterendu);
$date_notif=date('Ymd', $timenotif);
if($date_notif==$date_now){
return true;
}
return false;
}
/**
* @param $requete
* @param $section
* @throws coding_exception
* @throws dml_exception
*/
private function iena_send_message($requete, $section, $message)
{
global $DB, $CFG, $USER;
$course_ctx = context_course::instance($requete->course);
//À vérifier : on récupère tous les utilisateurs, même les invités
//2. $students = get_role_users(5 , $context) (the 5 represents the role-id with role.shortname = 'student')
//
$students = get_enrolled_users($course_ctx);
$course = $DB->get_record('course', array('id' => $requete->course), '*', MUST_EXIST);
$messageContent = false;
$messageContent .= "<h1>Rappel</h1>";
$messageContent .= "<h2>$course->fullname</h2>";
$date_jour = date('d/m', $section->daterendu);
$date_heure = date('H:i', $section->daterendu);
// 0 : NC
// 1 : work in the classroom
// 2 : online work
if ( $section->presence < 2 ) {
//$messageContent .= "<p>La séance de cours <strong>$requete->name</strong> aura lieu le $date_jour à $date_heure.</p>";
$messageContent .= "$message";
} else if ( $section->presence == 2 ) {
//$messageContent .= "<p>Le travail de la séance de cours à distance <strong>$requete->name</strong> est à finir pour le $date_jour à $date_heure.</p>";
$messageContent .= "$message";
}
$messageContent .= "<p>Lien vers le cours : <a href='" . $CFG->wwwroot . "/course/view.php?id=" . $course->id . "'>" . $course->fullname . "</a></p>";
//Create message
$message = new \core\message\message();
$message->component = 'moodle';
$message->name = 'instantmessage';
$message->userfrom = $USER;
$message->courseid = $course->id;
$message->notification = '1';
$message->contexturl = $CFG->wwwroot . "/course/view.php?id=" . $course->id . "#section-" . $requete->section;
$message->contexturlname = $course->fullname;
$message->fullmessageformat = FORMAT_HTML;
$log = "Messages sent for section $requete->name of course $course->fullname (id $course->id) to ";
$studs_counter = 0;
foreach ($students as $student) {
$studs_counter++;
$message->userto = $student;
$studs[] =
$message->smallmessage = $messageContent;
$message->fullmessage = $messageContent;
$message->fullmessagehtml = $messageContent;
$message->subject = "Rappel : " . $course->fullname . " — " . $requete->name;
// $message->subject = $messageContent;
message_send($message);
}
$log .= $studs_counter . " students.";
echo $log;
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* Class course_format_iena_cron_action
* This class hide and show section with setting present in table format_iena
* This class send message with setting present in table format_iena
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille / Michaël Lebeau
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_format_iena_cron_action {
/**
* Récupère le nombre de jours avant le rendu/présence pour envoyer une notification
* @return type
*/
public function cron_message() {
global $DB, $USER, $CFG;
$sections = $DB->get_records_sql("SELECT fo1.sectionid, fo1.value daysnotif,
fo2.value daterendu, fo3.value presence, fo4.value msg
FROM {course_format_options} fo1
LEFT JOIN {course_format_options} fo2 ON fo1.sectionid = fo2.sectionid
LEFT JOIN {course_format_options} fo3 ON fo1.sectionid = fo3.sectionid
LEFT JOIN {course_format_options} fo4 ON fo1.sectionid = fo4.sectionid
WHERE fo1.format='iena'
AND fo1.name ='daysnotif'
AND (fo1.value IS NOT NULL)
AND fo1.value != -1
AND fo2.name='daterendu'
AND fo3.name='presence'
AND fo4.name='msg'");
foreach ($sections as $section) {
$requete = $DB->get_record('course_sections', array('id' => $section->sectionid));
$datenotif = $this->is_notif($section);
if ($datenotif == false) {
continue;
}
if ((empty($section->msg)) && ($section->presence == 2)) {
$this->iena_send_message($requete, $section, get_config('format_iena', 'msg_dist'));
} else if ((empty($section->msg)) && ($section->presence == 1)) {
$this->iena_send_message($requete, $section, get_config('format_iena', 'msg_pres'));
} else {
$this->iena_send_message($requete, $section, $section->msg);
}
}
}
/**
* Check if it's time to send a notif by comparing the date withe the numbers of days before sending one in the db
* @param $section
* @return bool true if it's time to send a notif
*/
private function is_notif($section) {
// On compare la date d'aujourd'hui avec le timestamp - daysnotifs.
$datenow = date('Ymd');
$timenotif = strtotime('-'.$section->daysnotif.' days', $section->daterendu);
$datenotif = date('Ymd', $timenotif);
if ($datenotif == $datenow) {
return true;
}
return false;
}
/**
* @param $requete
* @param $section
* @throws coding_exception
* @throws dml_exception
*/
private function iena_send_message($requete, $section, $message) {
global $DB, $CFG, $USER;
$coursectx = context_course::instance($requete->course);
// A vérifier : on récupère tous les utilisateurs, même les invités.
// 2. $students = get_role_users(5 , $context) (the 5 represents the role-id with role.shortname = 'student').
$students = get_enrolled_users($coursectx);
$course = $DB->get_record('course', array('id' => $requete->course), '*', MUST_EXIST);
$messagecontent = false;
$messagecontent .= "<h1>Rappel</h1>";
$messagecontent .= "<h2>$course->fullname</h2>";
$datejour = date('d/m', $section->daterendu);
$dateheure = date('H:i', $section->daterendu);
// 0 : NC
// 1 : work in the classroom
// 2 : online work
if ( $section->presence < 2 ) {
$messagecontent .= "$message";
} else if ( $section->presence == 2 ) {
$messagecontent .= "$message";
}
$messagecontent .= "<p>Lien vers le cours : <a href='" . $CFG->wwwroot .
"/course/view.php?id=" . $course->id . "'>" . $course->fullname . "</a></p>";
// Create message.
$message = new \core\message\message();
$message->component = 'moodle';
$message->name = 'instantmessage';
$message->userfrom = $USER;
$message->courseid = $course->id;
$message->notification = '1';
$message->contexturl = $CFG->wwwroot . "/course/view.php?id=" . $course->id . "#section-" . $requete->section;
$message->contexturlname = $course->fullname;
$message->fullmessageformat = FORMAT_HTML;
$log = "Messages sent for section $requete->name of course $course->fullname (id $course->id) to ";
$studscounter = 0;
foreach ($students as $student) {
$studscounter++;
$message->userto = $student;
$studs[] =
$message->smallmessage = $messagecontent;
$message->fullmessage = $messagecontent;
$message->fullmessagehtml = $messagecontent;
$message->subject = "Rappel : " . $course->fullname . " — " . $requete->name;
message_send($message);
}
$log .= $studscounter . " students.";
echo $log;
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* course_format_iena_sections
*
* @package format_iena
* @category format
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille / Michaël Lebeau
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_format_iena_groups
{
/** @var int id of group */
public $id;
/** @var int id of course */
public $id_course;
/** @var string idnumber of group */
public $idnumber;
/** @var string name of group */
public $name;
/** @var string description of group */
public $description;
/** @var array<userid> */
public $list_userid;
/**
* @param $id_course
* @return array
* @throws dml_exception
*/
public function get_groups_by_id_course($id_course)
{
global $DB;
$requete = $DB->get_records_sql('SELECT id FROM {groups} WHERE courseid = ?', array($id_course));
$groups = array();
$i = 0;
foreach ($requete as $value) {
$group = new course_format_iena_groups();
$group->get_group_by_id_group($value->id);
$groups[$i] = $group;
$i++;
}
return $groups;
}
/**
* @param $id_section
* @throws dml_exception
*/
public function get_group_by_id_group($id_group)
{
global $DB;
$requete = $DB->get_record_sql('SELECT * FROM {groups} WHERE id = ?', array($id_group));
$this->id = $requete->id;
$this->id_course = $requete->courseid;
$this->idnumber = "id_groupe".$requete->id;
$this->name = $requete->name;
$this->description = $requete->description;
$this->list_userid = $DB->get_records_sql('SELECT userid FROM {groups_members} WHERE groupid = ?', array($id_group));
}
/**
*
* @gparam $id_course
* @return array
*/
public function get_students_group($id_course)
{
global $DB;
$students_group = $DB->get_records_sql('SELECT gm.userid, gm.groupid FROM {groups} as g
inner join {groups_members} as gm on gm.groupid=g.id
WHERE g.courseid = ?', array($id_course));
return $students_group;
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* course_format_iena_sections
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille / Michaël Lebeau
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_format_iena_groups {
/** @var int id of group */
public $id;
/** @var int id of course */
public $idcourse;
/** @var string idnumber of group */
public $idnumber;
/** @var string name of group */
public $name;
/** @var string description of group */
public $description;
/** @var array<userid> */
public $listuserid;
/**
* @param $id_course
* @return array
* @throws dml_exception
*/
public function get_groups_by_id_course($idcourse) {
global $DB;
$requete = $DB->get_records_sql('SELECT id
FROM {groups}
WHERE courseid = ?',
array($idcourse));
$groups = array();
$i = 0;
foreach ($requete as $value) {
$group = new course_format_iena_groups();
$group->get_group_by_id_group($value->id);
$groups[$i] = $group;
$i++;
}
return $groups;
}
/**
* @param $id_section
* @throws dml_exception
*/
public function get_group_by_id_group($idgroup) {
global $DB;
$requete = $DB->get_record_sql('SELECT *
FROM {groups}
WHERE id = ?',
array($idgroup));
$this->id = $requete->id;
$this->idcourse = $requete->courseid;
$this->idnumber = "id_groupe".$requete->id;
$this->name = $requete->name;
$this->description = $requete->description;
$this->listuserid = $DB->get_records_sql('SELECT userid
FROM {groups_members}
WHERE groupid = ?',
array($idgroup));
}
/**
*
* @gparam $id_course
* @return array
*/
public function get_students_group($idcourse) {
global $DB;
$studentsgroup = $DB->get_records_sql('SELECT gm.userid, gm.groupid
FROM {groups} g
INNER JOIN {groups_members} gm ON gm.groupid=g.id
WHERE g.courseid = ?',
array($idcourse));
return $studentsgroup;
}
}
<?php
/**
* Created by PhpStorm.
* User: softia
* Date: 13/03/18
* Time: 11:26
*/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
......@@ -20,45 +13,36 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* course_format_iena_sections
*
* @package format_iena
* @category format
* @copyright 2021 Softia/Université lorraine
* @author Delaruelle Myriam
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
*
* course_format_iena_sections
*
* @package format_iena
* @copyright 2021 Softia/Université lorraine
* @author Delaruelle Myriam
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once("{$CFG->libdir}/formslib.php");
require_once("{$CFG->libdir}/formslib.php");
class course_format_iena_message extends moodleform {
public function definition() {
// TODO: Implement definition() method.
class course_format_iena_message extends moodleform
{
public function definition()
{
// TODO: Implement definition() method.
$mform = $this->_form; // Don't forget the underscore!
$mform = $this->_form;
$description = "";
$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));
$mform->addElement('hidden', 'back_url', '');
$mform->setType('back_url', PARAM_TEXT);
$mform->setDefault('back_url', $this->_customdata['back_url']);
$mform->addElement('hidden', 'students', '');
$mform->setType('students', PARAM_TEXT);
$mform->setDefault('students', $this->_customdata['students']);
$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));
$mform->addElement('hidden', 'back_url', '');
$mform->setType('back_url', PARAM_TEXT);
$mform->setDefault('back_url', $this->_customdata['back_url']);
$mform->addElement('hidden', 'students', '');
$mform->setType('students', PARAM_TEXT);
$mform->setDefault('students', $this->_customdata['students']);
$this->add_action_buttons(true, "Envoyer");
}
}
\ No newline at end of file
$this->add_action_buttons(true, "Envoyer");
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* course_format_iena_section_ressources
*
* @package format_iena
* @category format
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille/Thomas Fradet
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_format_iena_section_ressources
{
/** @var int Id of ressource */
public $id;
/** @var string name of ressource */
public $name;
/** @var string type of ressource */
public $type;
/** @var int module id of ressource */
public $module;
/** @var string intro of ressource */
public $descrition;
/** @var course_format_iena_section_ressources section */
public $section;
/** @var module hide indicator (from table format_iena_settings) */
public $ressource_hide_indic;
/**
* @param $id_module
* @return mixed
* @throws dml_exception
*/
public function get_ressource_hide_indicator($id_module)
{
global $DB;
$module_state = $DB->get_record_sql('SELECT hide from {format_iena_settings} where cmid = ?', array($id_module));
return $module_state->hide;
}
/**
* @param $id_module
* @return mixed
* @throws dml_exception
*/
public function is_followed_ressources($cm_ids)
{
global $DB;
$module_state = $DB->get_records_sql('SELECT hide from {format_iena_settings} where cmid = ?', $cm_ids);
// echo "<pre>";
// var_dump($module_state);
// echo "</pre>";
return $module_state;
}
/**
* @param $id_section
* @return array
* @throws dml_exception
*/
public function get_ressources_by_id_section($id_section)
{
global $DB;
$requete = $DB->get_records_sql('SELECT id FROM {course_modules} WHERE section = ? AND deletioninprogress = 0', array($id_section));
$ressources = array();
$i = 0;
foreach ($requete as $value) {
$ressource = new course_format_iena_section_ressources();
$ressource->get_ressource_by_id($value->id);
$ressources[$i] = $ressource;
$i++;
}
return $ressources;
}
/**
* @param $id_section
* @return array
* @throws dml_exception
*/
public function get_ressources_completion_on_by_id_section($id_section)
{
global $COURSE, $DB;
// !!! format_iena_settings.hide stands for this module is followed by teacher in a section following indicator — this course module is NOT hidden
// visible : disponibility for studient (right to access), visibleoncoursepage : visibility for student (display on course page) ; 1 : true, 0 : false.
$course = course_get_format($COURSE)->get_course();
// search only modules by general course format parameters
// count only if it is follewed by teacher
// $if_followed = $course->restrictedbreadcrum == 1;
// count even if it is "hidden on course page but available"
$even_if_hidden_but_available = $course->allmodulesbreadcrum == 1;
if ( $even_if_hidden_but_available ) {
$requete = $DB->get_records_sql('SELECT id FROM {course_modules} WHERE section = ? AND deletioninprogress = 0
AND visible = 1
AND completion != 0', array($id_section));
} else {
$requete = $DB->get_records_sql('SELECT id FROM {course_modules} WHERE section = ? AND deletioninprogress = 0
AND visible = 1
AND visibleoncoursepage = 1
AND completion != 0', array($id_section));
}
$ressources = array();
$i = 0;
foreach ($requete as $value) {
$ressource = new course_format_iena_section_ressources();
$ressource->get_ressource_by_id($value->id);
$ressources[$i] = $ressource;
$i++;
}
return $ressources;
}
/**
* @param $id_course_modules
* @throws dml_exception
*/
public function get_ressource_by_id($id_course_modules)
{
global $DB;
if ($id_course_modules) {
$this->id = $id_course_modules;
$requete = $DB->get_record_sql('SELECT * FROM {course_modules} WHERE id = ? AND deletioninprogress = 0', array($id_course_modules));
$id_instance = $requete->instance;
$id_module = $requete->module;
if ($id_module) {
$modules = $DB->get_record_sql('SELECT * FROM {modules} WHERE id = ?', array($id_module));
}
if ($modules->name) {
$instance = $DB->get_record_sql('SELECT * FROM {' . $modules->name . '} WHERE id = ?', array($id_instance));
}
if ($instance->name) {
$this->name = $instance->name;
}
$this->descrition = $instance->intro;
$this->type = $modules->name;
$this->module = $modules->id;
// $this->section = new course_format_iena_section_ressources();
$this->section = new course_format_iena_sections();
$this->section->get_section_by_id_section($requete->section);
}
}
/**
* @param $userId
* @param $courseID
* @return array
* @throws dml_exception
*/
public function get_completions_by_userid($userId, $courseID)
{
global $DB;
$modules_completion_infos = $DB->get_records_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate
FROM {course_modules_completion} as cmc
inner join {course_modules} as cm on cm.id = cmc.coursemoduleid
inner join {user} as u on u.id = cmc.userid
inner join {modules} as m on m.id = cm.module
where cm.course = ? and cm.deletioninprogress = 0
and cmc.userid = ?
order by section, coursemoduleid asc', array($courseID, $userId));
return $modules_completion_infos;
}
/**
* @param $userId
* @param $courseID
* @param $moduleID
* @return mixed
* @throws dml_exception
*/
public function get_completions_by_module($userId, $courseID, $moduleID)
{
global $DB, $COURSE;
$course = course_get_format($COURSE)->get_course();
$modules_completion_infos = $DB->get_record_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate
FROM {course_modules_completion} as cmc
inner join {course_modules} as cm on cm.id = cmc.coursemoduleid
inner join {user} as u on u.id = cmc.userid
inner join {modules} as m on m.id = cm.module
where cm.course = ? and cm.deletioninprogress = 0
and cmc.userid = ?
and cmc.coursemoduleid = ?
order by section, coursemoduleid asc', array($courseID, $userId, $moduleID));
return $modules_completion_infos;
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* course_format_iena_section_ressources
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille/Thomas Fradet
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_format_iena_section_ressources {
/** @var int Id of ressource */
public $id;
/** @var string name of ressource */
public $name;
/** @var string type of ressource */
public $type;
/** @var int module id of ressource */
public $module;
/** @var string intro of ressource */
public $description;
/** @var course_format_iena_section_ressources section */
public $section;
/** @var module hide indicator (from table format_iena_settings) */
public $ressourcehideindic;
/**
* @param $idmodule
* @return mixed
* @throws dml_exception
*/
public function get_ressource_hide_indicator($idmodule) {
global $DB;
$modulestate = $DB->get_record_sql('SELECT hide
FROM {format_iena_settings}
WHERE cmid = ?',
array($idmodule));
return $modulestate->hide;
}
/**
* @param $idmodule
* @return mixed
* @throws dml_exception
*/
public function is_followed_ressources($cmids) {
global $DB;
$modulestate = $DB->get_records_sql('SELECT hide
FROM {format_iena_settings}
WHERE cmid = ?',
$cmids);
return $modulestate;
}
/**
* @param $idsection
* @return array
* @throws dml_exception
*/
public function get_ressources_by_id_section($idsection) {
global $DB;
$requete = $DB->get_records_sql('SELECT id
FROM {course_modules}
WHERE section = ?
AND deletioninprogress = 0',
array($idsection));
$ressources = array();
$i = 0;
foreach ($requete as $value) {
$ressource = new course_format_iena_section_ressources();
$ressource->get_ressource_by_id($value->id);
$ressources[$i] = $ressource;
$i++;
}
return $ressources;
}
/**
* @param $idsection
* @return array
* @throws dml_exception
*/
public function get_ressources_completion_on_by_id_section($idsection) {
global $COURSE, $DB;
// Format_iena_settings.hide stands for this module is followed by teacher in a section following indicator —
// this course module is NOT hidden.
// Visible : disponibility for studient (right to access), visibleoncoursepage : visibility for student
// (display on course page) ; 1 : true, 0 : false.
$course = course_get_format($COURSE)->get_course();
// Search only modules by general course format parameters
// count only if it is follewed by teacher
// count even if it is "hidden on course page but available".
$evenifhiddenbutavailable = $course->allmodulesbreadcrum == 1;
if ($evenifhiddenbutavailable) {
$requete = $DB->get_records_sql('SELECT id
FROM {course_modules}
WHERE section = ?
AND deletioninprogress = 0
AND visible = 1
AND completion != 0',
array($idsection));
} else {
$requete = $DB->get_records_sql('SELECT id
FROM {course_modules}
WHERE section = ?
AND deletioninprogress = 0
AND visible = 1
AND visibleoncoursepage = 1
AND completion != 0',
array($idsection));
}
$ressources = array();
$i = 0;
foreach ($requete as $value) {
$ressource = new course_format_iena_section_ressources();
$ressource->get_ressource_by_id($value->id);
$ressources[$i] = $ressource;
$i++;
}
return $ressources;
}
/**
* @param $idcoursemodules
* @throws dml_exception
*/
public function get_ressource_by_id($idcoursemodules) {
global $DB;
if ($idcoursemodules) {
$this->id = $idcoursemodules;
$requete = $DB->get_record_sql('SELECT *
FROM {course_modules}
WHERE id = ?
AND deletioninprogress = 0',
array($idcoursemodules));
$idinstance = $requete->instance;
$idmodule = $requete->module;
if ($idmodule) {
$modules = $DB->get_record_sql('SELECT *
FROM {modules}
WHERE id = ?',
array($idmodule));
}
if ($modules->name) {
$instance = $DB->get_record_sql('SELECT *
FROM {' . $modules->name . '}
WHERE id = ?',
array($idinstance));
}
if ($instance->name) {
$this->name = $instance->name;
}
$this->descrition = $instance->intro;
$this->type = $modules->name;
$this->module = $modules->id;
$this->section = new course_format_iena_sections();
$this->section->get_section_by_id_section($requete->section);
}
}
/**
* @param $userid
* @param $courseid
* @return array
* @throws dml_exception
*/
public function get_completions_by_userid($userid, $courseid) {
global $DB;
$modulescompletioninfos = $DB->get_records_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate
FROM {course_modules_completion} cmc
INNER JOIN {course_modules} cm ON cm.id = cmc.coursemoduleid
INNER JOIN {user} u ON u.id = cmc.userid
INNER JOIN {modules} m ON m.id = cm.module
WHERE cm.course = ?
AND cm.deletioninprogress = 0
AND cmc.userid = ?
ORDER BY section, coursemoduleid ASC',
array($courseid, $userid));
return $modulescompletioninfos;
}
/**
* @param $userid
* @param $courseid
* @param $moduleid
* @return mixed
* @throws dml_exception
*/
public function get_completions_by_module($userid, $courseid, $moduleid) {
global $DB, $COURSE;
$course = course_get_format($COURSE)->get_course();
$modulescompletioninfos = $DB->get_record_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate
FROM {course_modules_completion} cmc
INNER JOIN {course_modules} cm ON cm.id = cmc.coursemoduleid
INNER JOIN {user} u ON u.id = cmc.userid
INNER JOIN {modules} m ON m.id = cm.module
WHERE cm.course = ?
AND cm.deletioninprogress = 0
AND cmc.userid = ?
AND cmc.coursemoduleid = ?
ORDER BY section, coursemoduleid ASC',
array($courseid, $userid, $moduleid));
return $modulescompletioninfos;
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* course_format_iena_sections
*
* @package format_iena
* @category format
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille / Michaël Lebeau
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_format_iena_sections
{
/** @var int id of section */
public $id;
/** @var string name of section */
public $name;
/** @var int id of course */
public $id_course;
/** @var block_career_resources array<Ressource> resources */
public $resources;
/** @var date */
public $date;
/** @var string availability */
public $availability;
public $visibility;
/**
* @param $id_course
* @return array
* @throws dml_exception
*/
public function get_sections_by_id_course($id_course)
{
global $DB;
$requete = $DB->get_records_sql('SELECT * FROM {course_sections} WHERE course = ? ORDER BY section', array($id_course));
// $numsection = $DB->get_record_sql('SELECT value FROM {course_format_options} WHERE courseid = ? AND name = ?', array($id_course,"numsections"));
return $requete;
$sections = array();
$i = 0;
foreach ($requete as $value) {
// if ($value->section > $numsection->value){
// continue;
// }
$section = new course_format_iena_sections();
$section->get_section_by_id_section($value->id);
$sections[$i] = $section;
$i++;
}
// var_dump($sections);
return $sections;
}
/**
* @param $id_section
* @throws dml_exception
*/
public function get_section_by_id_section($id_section)
{
global $DB;
$requete = $DB->get_record_sql('SELECT * FROM {course_sections} WHERE id = ?', array($id_section));
$this->id = $requete->id;
$this->name = $requete->name;
$this->id_course = $requete->course;
if (!$this->name) {
$this->name = get_string('section', 'format_iena') . " " . $requete->section;
}
}
/**
* @param $id_section
* @return mixed
* @throws dml_exception
*/
public function get_section_settings_by_id_section($id_section)
{
global $DB;
$requete = $DB->get_record_sql('SELECT * FROM {format_iena} WHERE id_section = ?', array($id_section));
return $requete;
}
/**
* @param $id_section
* @param $id_user
* @return array
* @throws dml_exception
*/
public function get_completion_by_sectionID_userID($id_section, $id_user)
{
global $DB;
$requete = $DB->get_records_sql('SELECT cmc.id as moduleid, cm.course, cm.section, cmc.userid, cmc.completionstate
FROM {course_modules} as cm
inner join {course_modules_completion} as cmc on cmc.coursemoduleid = cm.id
WHERE cm.section= ? AND cmc.userid= ?
order by cm.section, cmc.userid', array($id_section, $id_user));
return $requete;
}
/**
* @param $id_section
* @return array
* @throws dml_exception
*/
public function get_hidden_modules_by_section($id_section)
{
global $DB;
$requete = $DB->get_records_sql('SELECT *
FROM {format_iena_settings}
WHERE sectionid =?', array($id_section));
return $requete;
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @param mixed $id
*
* @return self
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* @return mixed
*/
public function getName()
{
return $this->name;
}
/**
* @param mixed $name
*
* @return self
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* @return mixed
*/
public function getIdCourse()
{
return $this->id_course;
}
/**
* @param mixed $id_course
*
* @return self
*/
public function setIdCourse($id_course)
{
$this->id_course = $id_course;
return $this;
}
/**
* @return mixed
*/
public function getResources()
{
return $this->resources;
}
/**
* @param mixed $resources
*
* @return self
*/
public function setResources($resources)
{
$this->resources = $resources;
return $this;
}
/**
* @return mixed
*/
public function getDate()
{
return $this->date;
}
/**
* @param mixed $date
*
* @return self
*/
public function setDate($date)
{
$this->date = $date;
return $this;
}
/**
* @return mixed
*/
public function getAvailability()
{
return $this->availability;
}
/**
* @param mixed $availability
*
* @return self
*/
public function setAvailability($availability)
{
$this->availability = $availability;
return $this;
}
/**
* @return mixed
*/
public function getVisibility()
{
return $this->visibility;
}
/**
* @param mixed $visibility
*
* @return self
*/
public function setVisibility($visibility)
{
$this->visibility = $visibility;
return $this;
}
public function toArray(){
$vars = [];
foreach($this as $varName => $varValue) {
$vars[$varName] = $varValue;
}
return $vars;
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* course_format_iena_sections
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille / Michaël Lebeau
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_format_iena_sections {
/** @var int id of section */
public $id;
/** @var string name of section */
public $name;
/** @var int id of course */
public $idcourse;
/** @var block_career_resources array<Ressource> resources */
public $resources;
/** @var date */
public $date;
/** @var string availability */
public $availability;
public $visibility;
/**
* @param $idcourse
* @return array
* @throws dml_exception
*/
public function get_sections_by_id_course($idcourse) {
global $DB;
$requete = $DB->get_records_sql('SELECT *
FROM {course_sections}
WHERE course = ?
ORDER BY section',
array($idcourse));
return $requete;
$sections = array();
$i = 0;
foreach ($requete as $value) {
$section = new course_format_iena_sections();
$section->get_section_by_id_section($value->id);
$sections[$i] = $section;
$i++;
}
return $sections;
}
/**
* @param $idsection
* @throws dml_exception
*/
public function get_section_by_id_section($idsection) {
global $DB;
$requete = $DB->get_record_sql('SELECT *
FROM {course_sections}
WHERE id = ?',
array($idsection));
$this->id = $requete->id;
$this->name = $requete->name;
$this->id_course = $requete->course;
if (!$this->name) {
$this->name = get_string('section', 'format_iena') . " " . $requete->section;
}
}
/**
* @param $idsection
* @return mixed
* @throws dml_exception
*/
public function get_section_settings_by_id_section($idsection) {
global $DB;
$requete = $DB->get_record_sql('SELECT *
FROM {format_iena}
WHERE id_section = ?',
array($idsection));
return $requete;
}
/**
* @param $idsection
* @param $iduser
* @return array
* @throws dml_exception
*/
public function get_completion_by_sectionID_userID($idsection, $iduser) {
global $DB;
$requete = $DB->get_records_sql('SELECT cmc.id as moduleid, cm.course, cm.section, cmc.userid, cmc.completionstate
FROM {course_modules} cm
INNER JOIN {course_modules_completion} cmc ON cmc.coursemoduleid = cm.id
WHERE cm.section= ?
AND cmc.userid= ?
ORDER BY cm.section, cmc.userid',
array($idsection, $iduser));
return $requete;
}
/**
* @param $idsection
* @return array
* @throws dml_exception
*/
public function get_hidden_modules_by_section($idsection) {
global $DB;
$requete = $DB->get_records_sql('SELECT *
FROM {format_iena_settings}
WHERE sectionid =?',
array($idsection));
return $requete;
}
/**
* @return mixed
*/
public function getId() {
return $this->id;
}
/**
* @param mixed $id
*
* @return self
*/
public function setId($id) {
$this->id = $id;
return $this;
}
/**
* @return mixed
*/
public function getName() {
return $this->name;
}
/**
* @param mixed $name
*
* @return self
*/
public function setName($name) {
$this->name = $name;
return $this;
}
/**
* @return mixed
*/
public function getIdCourse() {
return $this->id_course;
}
/**
* @param mixed $id_course
*
* @return self
*/
public function setIdCourse($idcourse) {
$this->id_course = $idcourse;
return $this;
}
/**
* @return mixed
*/
public function getResources() {
return $this->resources;
}
/**
* @param mixed $resources
*
* @return self
*/
public function setResources($resources) {
$this->resources = $resources;
return $this;
}
/**
* @return mixed
*/
public function getDate() {
return $this->date;
}
/**
* @param mixed $date
*
* @return self
*/
public function setDate($date) {
$this->date = $date;
return $this;
}
/**
* @return mixed
*/
public function getAvailability() {
return $this->availability;
}
/**
* @param mixed $availability
*
* @return self
*/
public function setAvailability($availability) {
$this->availability = $availability;
return $this;
}
/**
* @return mixed
*/
public function getVisibility() {
return $this->visibility;
}
/**
* @param mixed $visibility
*
* @return self
*/
public function setVisibility($visibility) {
$this->visibility = $visibility;
return $this;
}
public function toArray() {
$vars = [];
foreach ($this as $varname => $varvalue) {
$vars[$varname] = $varvalue;
}
return $vars;
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* format_iena
*
* @package format_iena
* @category format
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*
* Point d'entrée du plugin
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/filelib.php');
require_once($CFG->libdir . '/completionlib.php');
require_once('entity/course_format_iena_section_ressources.php');
require_once('entity/course_format_iena_sections.php');
require_once('entity/course_format_iena_completion.php');
require_once('entity/course_format_iena_cron_action.php');
require_once('entity/course_format_iena_groups.php');
require_once('entity/course_format_iena_attendance.php');
require_once($CFG->dirroot . '/blocks/myoverview/lib.php');
require_once($CFG->dirroot . '/completion/classes/progress.php');
require_once($CFG->libdir . '/completionlib.php');
$PAGE->requires->js('/course/format/iena/js/jquery.min.js');
$PAGE->requires->js('/course/format/iena/format.js');
if ($topic = optional_param('topic', 0, PARAM_INT)) {
$url = $PAGE->url;
$url->param('section', $topic);
debugging('Outdated topic param passed to course/view.php', DEBUG_DEVELOPER);
redirect($url);
}
$context = context_course::instance($course->id);
if (($marker >= 0) && has_capability('moodle/course:setcurrentsection', $context) && confirm_sesskey()) {
$course->marker = $marker;
course_set_marker($course->id, $marker);
}
$course = course_get_format($course)->get_course();
// course_create_sections_if_missing($course, range(0, $course->numsections));
course_create_sections_if_missing($course, 0);
$renderer = $PAGE->get_renderer('format_iena');
if (!empty($displaysection)) {
$renderer->print_single_section_page($course, null, null, null, null, $displaysection);
} else {
$renderer->switch_mode($course);
//$renderer->print_iena_section_pages($course);
}
// $PAGE->requires->js('/course/format/iena/js/jquery.min.js');
// $PAGE->requires->js('/course/format/iena/format.js');
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* format_iena
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*
* Point d'entrée du plugin
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/filelib.php');
require_once($CFG->libdir . '/completionlib.php');
require_once('entity/course_format_iena_section_ressources.php');
require_once('entity/course_format_iena_sections.php');
require_once('entity/course_format_iena_completion.php');
require_once('entity/course_format_iena_cron_action.php');
require_once('entity/course_format_iena_groups.php');
require_once('entity/course_format_iena_attendance.php');
require_once($CFG->dirroot . '/blocks/myoverview/lib.php');
require_once($CFG->dirroot . '/completion/classes/progress.php');
require_once($CFG->libdir . '/completionlib.php');
$PAGE->requires->js('/course/format/iena/js/jquery.min.js');
$PAGE->requires->js('/course/format/iena/format.js');
if ($topic = optional_param('topic', 0, PARAM_INT)) {
$url = $PAGE->url;
$url->param('section', $topic);
debugging('Outdated topic param passed to course/view.php', DEBUG_DEVELOPER);
redirect($url);
}
$context = context_course::instance($course->id);
if (($marker >= 0) && has_capability('moodle/course:setcurrentsection', $context) && confirm_sesskey()) {
$course->marker = $marker;
course_set_marker($course->id, $marker);
}
$course = course_get_format($course)->get_course();
course_create_sections_if_missing($course, 0);
$renderer = $PAGE->get_renderer('format_iena');
if (!empty($displaysection)) {
$renderer->print_single_section_page($course, null, null, null, null, $displaysection);
} else {
$renderer->switch_mode($course);
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* format_iena
*
* @package format_iena
* @category format
* @copyright 2018 Softia/Université lorraine
* @author Michael lebeau
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['pluginname'] = 'Blended learning format';
$string['currentsection'] = 'The section';
$string['editsection'] = 'Edit section';
$string['deletesection'] = 'Delete section';
$string['sectionname'] = 'Section';
$string['section0name'] = 'General';
$string['hidefromothers'] = 'Hide section';
$string['showfromothers'] = 'Show section';
$string['showdefaultsectionname'] = 'Show the default sections name';
$string['showdefaultsectionname_help'] = 'If no name is set for the section will not show anything.<br>
By definition an unnamed section is displayed as <strong>section [N]</strong>.';
$string['yes'] = 'Yes';
$string['no'] = 'No';
$string['sectionposition'] = 'Section zero position';
$string['name'] = 'Name';
$string['summary'] = 'Summary';
$string['modalite'] = 'Modality';
$string['notif'] = 'Notification';
$string['notif_summary'] = 'A notification can be sent to the student by email. She will remind her to consult the section and will contain various information (name of the course, link to the course, name of the section, date the section and modality';
$string['in_presence'] = 'Face-to-face session';
$string['not_presence'] = 'Remote session';
$string['days_before'] = 'A number of days before the session';
$string['days_after'] = 'A number of days after the session';
$string['days_same'] = 'The same day';
$string['nb_days_before'] = 'days before';
$string['nb_days_after'] = 'days after';
$string['hide_section'] = 'Hide the section';
$string['hide_section_summary'] = 'Restrict access to the session and hide it before a certain date';
$string['hide_option_1'] = 'Do not restrict access before a date';
$string['hide_option_2'] = 'Before the date of the session';
$string['hide_option_3'] = 'Before the date of notification';
$string['hide_bread_crum'] = 'Show progress bar';
$string['hide_icon_message'] = 'Show the mail icon';
$string['modules_for'] = 'Activities followed for';
$string['all_course'] = 'All the Course';
$string['students'] = 'Students';
$string['not_done'] = 'not having completed everything';
$string['all_students'] = 'all the students';
$string['student'] = 'Student';
$string['send_message'] = 'Send a message';
$string['for_section_select'] = 'For the selected section, you will have an indicator of the number of students who have not completed the activities below.';
$string['cancel'] = 'Cancel';
$string['save'] = 'Save';
$string['check_completion'] = 'Monitor completion';
$string['indic_suivi'] = 'Tracking indicators of the section';
$string['form_not_defined'] = 'Not specified';
$string['settings_section_form'] = 'Section parameter';
$string['course'] = 'Course';
$string['link'] = 'Link';
$string['prof'] = 'Professor';
$string['section'] = 'Section';
$string['hide_section'] = 'HIDE section ';
$string['show_section'] = 'SHOW section ';
$string['aboutcourse'] = 'About this course';
$string['modalite_help'] = 'The "Distance" mode will allow you to define a date for a course session and notifications x days before the session. The "Face to face" mode will allow you to define a date for an assessment, and notifications x days before the assessment due date';
$string['loadingResults'] = "Loading results...";
$string['errorLoadingResults'] = "Students could not be retrieved, please contact an administrator";
$string['caption']="Caption";
$string['status0']="Activity not completed";
$string['status1']="Activity completed";
$string['status2']="Activity completed and passed";
$string['status3']="Activity completed but not passed";
$string["send_message_title"]="Sending a message to {{nb_results}} people";
$string['display_course_infos']="Show/hide course information";
$string['my_progress']="My progress in the course: ";
$string['table_progress']="Tracking";
$string['displayInfos']="Display course informations";
$string['hideInfos']="Hide course informations";
$string['message_pres']="presential learning mail";
$string['message_dist']="distance learning mail";
$string['message_default_dist']="Default message distance learning";
$string['message_default_pres']="Default message presential learning";
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* format_iena
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @author Michael lebeau
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['pluginname'] = 'Blended learning format';
$string['currentsection'] = 'The section';
$string['editsection'] = 'Edit section';
$string['deletesection'] = 'Delete section';
$string['sectionname'] = 'Section';
$string['section0name'] = 'General';
$string['hidefromothers'] = 'Hide section';
$string['showfromothers'] = 'Show section';
$string['showdefaultsectionname'] = 'Show the default sections name';
$string['showdefaultsectionname_help'] = 'If no name is set for the section will not show anything.<br>
By definition an unnamed section is displayed as <strong>section [N]</strong>.';
$string['yes'] = 'Yes';
$string['no'] = 'No';
$string['sectionposition'] = 'Section zero position';
$string['name'] = 'Name';
$string['summary'] = 'Summary';
$string['modalite'] = 'Modality';
$string['notif'] = 'Notification';
$string['notif_summary'] = 'A notification can be sent to the student by email. She will remind her to consult the section and will contain various information (name of the course, link to the course, name of the section, date the section and modality';
$string['in_presence'] = 'Face-to-face session';
$string['not_presence'] = 'Remote session';
$string['days_before'] = 'A number of days before the session';
$string['days_after'] = 'A number of days after the session';
$string['days_same'] = 'The same day';
$string['nb_days_before'] = 'days before';
$string['nb_days_after'] = 'days after';
$string['hide_section'] = 'Hide the section';
$string['hide_section_summary'] = 'Restrict access to the session and hide it before a certain date';
$string['hide_option_1'] = 'Do not restrict access before a date';
$string['hide_option_2'] = 'Before the date of the session';
$string['hide_option_3'] = 'Before the date of notification';
$string['hide_bread_crum'] = 'Show progress bar';
$string['hide_icon_message'] = 'Show the mail icon';
$string['modules_for'] = 'Activities followed for';
$string['all_course'] = 'All the Course';
$string['students'] = 'Students';
$string['not_done'] = 'not having completed everything';
$string['all_students'] = 'all the students';
$string['student'] = 'Student';
$string['send_message'] = 'Send a message';
$string['for_section_select'] = 'For the selected section, you will have an indicator of the number of students who have not completed the activities below.';
$string['cancel'] = 'Cancel';
$string['save'] = 'Save';
$string['check_completion'] = 'Monitor completion';
$string['indic_suivi'] = 'Tracking indicators of the section';
$string['form_not_defined'] = 'Not specified';
$string['settings_section_form'] = 'Section parameter';
$string['course'] = 'Course';
$string['link'] = 'Link';
$string['prof'] = 'Professor';
$string['section'] = 'Section';
$string['hide_section'] = 'HIDE section ';
$string['show_section'] = 'SHOW section ';
$string['aboutcourse'] = 'About this course';
$string['modalite_help'] = 'The "Distance" mode will allow you to define a date for a course session and notifications x days before the session. The "Face to face" mode will allow you to define a date for an assessment, and notifications x days before the assessment due date';
$string['loadingResults'] = "Loading results...";
$string['errorLoadingResults'] = "Students could not be retrieved, please contact an administrator";
$string['caption'] = "Caption";
$string['status0'] = "Activity not completed";
$string['status1'] = "Activity completed";
$string['status2'] = "Activity completed and passed";
$string['status3'] = "Activity completed but not passed";
$string["send_message_title"] = "Sending a message to {{nb_results}} people";
$string['display_course_infos'] = "Show/hide course information";
$string['my_progress'] = "My progress in the course: ";
$string['table_progress'] = "Tracking";
$string['displayInfos'] = "Display course informations";
$string['hideInfos'] = "Hide course informations";
$string['message_pres'] = "presential learning mail";
$string['message_default_pres'] = "Default message presential learning";
$string['message_pres_desc'] = "Configure default presential course message";
$string['message_dist'] = "distance learning mail";
$string['message_dist_desc'] = "Configure default blended course message";
$string['message_default_dist'] = "Default message distance learning";
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* format_iena
*
* @package format_iena
* @category format
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['pluginname'] = 'Format enseignement hybride';
$string['currentsection'] = 'La section';
$string['editsection'] = 'Modifier section';
$string['deletesection'] = 'Supprimer section';
$string['sectionname'] = 'Section';
$string['section0name'] = 'Général';
$string['hidefromothers'] = 'Cacher section';
$string['showfromothers'] = 'Voir section';
$string['showdefaultsectionname'] = 'Show the default sections name';
$string['showdefaultsectionname_help'] = 'If no name is set for the section will not show anything.<br>
By definition an unnamed section is displayed as <strong>section [N]</strong>.';
$string['yes'] = 'Oui';
$string['no'] = 'Non';
$string['sectionposition'] = 'Section zero position';
$string['name'] = 'Nom';
$string['summary'] = 'Résumé';
$string['modalite'] = 'Modalité';
$string['notif'] = 'Notification';
$string['notif_summary'] = 'Une notification peut être envoyée à l étudiant par mail. Elle lui rapplera de consulter la section et contiendra diverses informations (nom du cours, lien vers le cours, nom de la section, date le la section et modalité';
$string['in_presence'] = 'Session en présence';
$string['not_presence'] = 'Session à distance';
$string['days_before'] = 'Un certain nombre de jours avant la séance';
$string['days_after'] = 'Un certain nombre de jours après la séance';
$string['days_same'] = 'Le jour même';
$string['nb_days_before'] = 'jours avant';
$string['nb_days_after'] = 'jours après';
$string['hide_section'] = 'Cacher la section';
$string['hide_section_summary'] = 'Restreindre l\'accès à la séance et la cacher avant une certaine date';
$string['hide_option_1'] = 'Ne pas restreindre l\'accès avant une date';
$string['hide_option_2'] = 'Avant la date de la séance';
$string['hide_option_3'] = 'Avant la date de la notification';
$string['hide_bread_crum'] = 'Afficher la barre de progression';
$string['hide_icon_message'] = 'Afficher l\'icone messagerie';
$string['modules_for'] = 'Activités suivies pour';
$string['all_course'] = 'Tout le Cours';
$string['students'] = 'Etudiants';
$string['not_done'] = 'n\'ayant pas tout achevé';
$string['all_students'] = 'tous les étudiants';
$string['student'] = 'Eleve';
$string['send_message'] = 'Envoyer un message';
$string['for_section_select'] = 'Pour la section sélectionnée, vous aurez un indicateur du nombre d\'étudiant qui n\'ont pas achevé les activités ci-dessous.';
$string['cancel'] = 'Annuler';
$string['save'] = 'Enregistrer';
$string['check_completion'] = 'Surveiller l\'achèvement';
$string['indic_suivi'] = 'Indicateurs de suivi de la section';
$string['form_not_defined'] = 'Non renseigné';
$string['settings_section_form'] = 'Paramètre de la section';
$string['course'] = 'Cours';
$string['link'] = 'Lien';
$string['prof'] = 'Professeur';
$string['section'] = 'Section';
$string['hide_section'] = 'CACHER la section ';
$string['show_section'] = 'MONTRER la section ';
$string['aboutcourse'] = 'À propos de ce cours';
$string['modalite_help'] = 'La modalité "Distance" vous permettra de définir une date de séance et des notifications x jours avant la séance. La modalité "Présentiel" vous permettra de définir une date pour un rendu, et des notifications x jours avant la date de rendu';
$string['loadingResults'] = "Chargement des résultats...";
$string['errorLoadingResults'] = "Les étudiants n'ont pas pu être chargés, veuillez contacter un administrateur.";
$string['caption']="Légende";
$string['status0']="Activité non complétée";
$string['status1']="Activité complétée";
$string['status2']="Activité complétée et validée";
$string['status3']="Activité complétée non validée";
$string["send_message_title"]="Envoi d'un message à {{nb_results}} personnes";
$string['display_course_infos']="Afficher/Masquer les informations du cours";
$string['my_progress']="Ma progression dans le cours : ";
$string['table_progress']="Suivi des étudiants";
$string['displayInfos']="Afficher les infos du cours";
$string['hideInfos']="Masquer les infos du cours";
$string['message_pres']="Message présentiel";
$string['message_dist']="Message distanciel";
$string['message_default_dist']="message par défaut distance";
$string['message_default_pres']="message par defaut pres";
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* format_iena
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['pluginname'] = 'Format enseignement hybride';
$string['currentsection'] = 'La section';
$string['editsection'] = 'Modifier section';
$string['deletesection'] = 'Supprimer section';
$string['sectionname'] = 'Section';
$string['section0name'] = 'Général';
$string['hidefromothers'] = 'Cacher section';
$string['showfromothers'] = 'Voir section';
$string['showdefaultsectionname'] = 'Show the default sections name';
$string['showdefaultsectionname_help'] = 'If no name is set for the section will not show anything.<br>
By definition an unnamed section is displayed as <strong>section [N]</strong>.';
$string['yes'] = 'Oui';
$string['no'] = 'Non';
$string['sectionposition'] = 'Section zero position';
$string['name'] = 'Nom';
$string['summary'] = 'Résumé';
$string['modalite'] = 'Modalité';
$string['notif'] = 'Notification';
$string['notif_summary'] = 'Une notification peut être envoyée à l étudiant par mail. Elle lui rapplera de consulter la section et contiendra diverses informations (nom du cours, lien vers le cours, nom de la section, date le la section et modalité';
$string['in_presence'] = 'Session en présence';
$string['not_presence'] = 'Session à distance';
$string['days_before'] = 'Un certain nombre de jours avant la séance';
$string['days_after'] = 'Un certain nombre de jours après la séance';
$string['days_same'] = 'Le jour même';
$string['nb_days_before'] = 'jours avant';
$string['nb_days_after'] = 'jours après';
$string['hide_section'] = 'Cacher la section';
$string['hide_section_summary'] = 'Restreindre l\'accès à la séance et la cacher avant une certaine date';
$string['hide_option_1'] = 'Ne pas restreindre l\'accès avant une date';
$string['hide_option_2'] = 'Avant la date de la séance';
$string['hide_option_3'] = 'Avant la date de la notification';
$string['hide_bread_crum'] = 'Afficher la barre de progression';
$string['hide_icon_message'] = 'Afficher l\'icone messagerie';
$string['modules_for'] = 'Activités suivies pour';
$string['all_course'] = 'Tout le Cours';
$string['students'] = 'Etudiants';
$string['not_done'] = 'n\'ayant pas tout achevé';
$string['all_students'] = 'tous les étudiants';
$string['student'] = 'Eleve';
$string['send_message'] = 'Envoyer un message';
$string['for_section_select'] = 'Pour la section sélectionnée, vous aurez un indicateur du nombre d\'étudiant qui n\'ont pas achevé les activités ci-dessous.';
$string['cancel'] = 'Annuler';
$string['save'] = 'Enregistrer';
$string['check_completion'] = 'Surveiller l\'achèvement';
$string['indic_suivi'] = 'Indicateurs de suivi de la section';
$string['form_not_defined'] = 'Non renseigné';
$string['settings_section_form'] = 'Paramètre de la section';
$string['course'] = 'Cours';
$string['link'] = 'Lien';
$string['prof'] = 'Professeur';
$string['section'] = 'Section';
$string['hide_section'] = 'CACHER la section ';
$string['show_section'] = 'MONTRER la section ';
$string['aboutcourse'] = 'À propos de ce cours';
$string['modalite_help'] = 'La modalité "Distance" vous permettra de définir une date de séance et des notifications x jours avant la séance. La modalité "Présentiel" vous permettra de définir une date pour un rendu, et des notifications x jours avant la date de rendu';
$string['loadingResults'] = "Chargement des résultats...";
$string['errorLoadingResults'] = "Les étudiants n'ont pas pu être chargés, veuillez contacter un administrateur.";
$string['caption'] = "Légende";
$string['status0'] = "Activité non complétée";
$string['status1'] = "Activité complétée";
$string['status2'] = "Activité complétée et validée";
$string['status3'] = "Activité complétée non validée";
$string["send_message_title"] = "Envoi d'un message à {{nb_results}} personnes";
$string['display_course_infos'] = "Afficher/Masquer les informations du cours";
$string['my_progress'] = "Ma progression dans le cours : ";
$string['table_progress'] = "Suivi des étudiants";
$string['displayInfos'] = "Afficher les infos du cours";
$string['hideInfos'] = "Masquer les infos du cours";
$string['message_pres'] = "Message présentiel";
$string['message_default_pres'] = "message par defaut pres";
$string['message_pres_desc'] = "Paramétrez le message qui sera envoyé par défaut pour un cours en présentiel";
$string['message_dist'] = "Message distanciel";
$string['message_dist_desc'] = "Paramétrez le message qui sera envoyé par défaut pour un cours à distance";
$string['message_default_dist'] = "message par défaut distance";
This diff is collapsed.
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* @package format_iena
* @category format
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../../config.php');
require_once('view/view_param_indicateur.php');
require_once('entity/course_format_iena_section_ressources.php');
require_once('entity/course_format_iena_sections.php');
global $COURSE, $DB, $USER;
$courseID = required_param('courseid', PARAM_INT);
$sectionID = required_param('sectionid', PARAM_INT);
$url = new moodle_url('/course/format/iena/param_indicateur.php', array('courseid' => $courseID));
$PAGE->set_pagelayout('course');
$PAGE->set_url($url);
if (!has_capability('moodle/course:sectionvisibility', $context = context_course::instance($courseID), $USER->id)) {
$link = $CFG->wwwroot . '/course/view.php?id=' . $courseID;
header("Location: {$link}");
exit;
}
$course = $DB->get_record('course', array('id' => $courseID), '*', MUST_EXIST);
require_login($course, false, NULL);
$PAGE->set_title('Indicateurs de suivi');
$PAGE->set_heading('Indicateurs de suivi');
/* Update in Database all tables format_iena_settings for each module */
if ($_POST) {
if ($_POST['select-section']) {
$sectionid = $_POST['select-section'];
$sectionid = explode('-', $sectionid)[1];
} else {
$sectionid = "undefined";
}
/* Récupération de l'état des modules du formulaire */
$posted_module_ids = [];
$y = 0;
foreach ($_POST as $key => $form_module) {
$temp = explode($_POST['select-section'], $key);
if (count($temp) > 1) {
$posted_module_ids[$y] = $temp[0];
}
$y++;
}
$all_modules = explode("-", $_POST['all_modules']);
// echo "<pre>";
/* var_dump($_POST);
echo "---<br>";
var_dump($all_modules);
echo "---<br>";
var_dump($posted_module_ids);
die; */
$suivi_records = $DB->get_records('format_iena_settings', array('sectionid' => $sectionid));
/* pour chaque activité du cours */
foreach ($all_modules as $course_mod_id) {
$done = false;
/* pour chaque activité suivie ou non en base */
foreach ($suivi_records as $record) {
/* si l'activité est en base (suivie ou non) */
if ( $record->cmid == $course_mod_id ) {
/* l'activité est suivie en base (1 ou 0 => true, false) */
$is_suivi = $record->hide == 1 ? true : false;
/* l'activité a été checkée pour être suivie à présent (true ou false) */
$is_ask_suivi = in_array($record->cmid, $posted_module_ids);
/* si l'état de suivi de l'activité n'est pas le même que demandé */
if ( $is_suivi !== $is_ask_suivi ) {
/* mise à jour de l'état de l'activité suivie */
$update = new stdClass();
$update->id = $record->id;
$update->hide = $is_ask_suivi ? 1 : 0;
$DB->update_record('format_iena_settings', $update, false);
/* l'activité a été traitée */
$done = true;
} else {
/* l'activité n'a pas besoin d'être traitée */
$done = true;
}
}
}
/* si l'activité n'est pas en base (n'a pas été traitée) */
if ( $done == false ) {
/* si l'activité a été checkée pour être suivie à présent (true ou false) */
if ( in_array($course_mod_id, $posted_module_ids) ) {
$insert = new stdClass();
$insert->courseid = $COURSE->id;
$insert->cmid = $course_mod_id;
$insert->hide = 1;
$insert->sectionid = $sectionid;
$DB->insert_record('format_iena_settings', $insert, false);
}
}
}
// die;
/*
$DB->insert_record('format_iena_settings', $format_iena_setting_data, false);
Records (0 ou 1)
Form (1)
Pour chaque activité $all_modules
Enregistrement traité = faux
Pour chaque enregistrement $suivi_records
Si l'enregistement $posted_module_ids existe dans $suivi_records
Si l'enregistrement est différent
Modifier l'enregistrement
Enregistrement traité = vrai
Break
Si Enregistrement traité == faux
Créer l'enregistrement
*/
// foreach ($posted_module_ids as $module_id) {
// $prev_record_exists = false;
// foreach ( $suivi_records as $record ) {
// if ( $module_id == $record->cmid ) {
// $update = new stdClass();
// $update->id = $record->id;
// $update->hide = 1;
// $DB->update_record('format_iena_settings', $update, false);
$prev_record_exists = true;
// break;
// }
// }
// if ( !$prev_record_exists ) {
// $insert = new stdClass();
// $insert->courseid = $COURSE->id;
// $insert->cmid = $module_id;
// $insert->hide = 1;
// $insert->sectionid = $sectionid;
// $DB->insert_record('format_iena_settings', $insert, false);
// }
// }
/*---*/
// // récupération de l'état des modules dans la BDD
// $modulesStates = $DB->get_records('format_iena_settings', array('sectionid' => $sectionid));
// foreach ($modulesStates as $module) {
// //var_dump($modulesStates);
// // Création de l'objet à updater
// //$format_iena_setting_data_upd = new stdClass();
// $indic = false;
// foreach ($posted_module_ids as $form_module) {
// if ($module->cmid == $form_module) {
// $format_iena_setting_data_upd = new stdClass();
// $format_iena_setting_data_upd->hide = 1;
// $format_iena_setting_data_upd->sectionid = $sectionid;
// $format_iena_setting_data_upd->id = $module->id;
// $DB->update_record('format_iena_settings', $format_iena_setting_data_upd, false);
// $indic = true;
// break;
// }
// }
// if ($indic == false) {
// $format_iena_setting_data_upd = new stdClass();
// $format_iena_setting_data_upd->hide = 0;
// $format_iena_setting_data_upd->sectionid = $sectionid;
// $format_iena_setting_data_upd->id = $module->id;
// $DB->update_record('format_iena_settings', $format_iena_setting_data_upd, false);
// }
// }
$link = $CFG->wwwroot . '/course/format/iena/suivi_unit.php?courseid=' . $courseID . '&sectionid=' . $sectionid;
header("Location: {$link}");
exit;
} elseif ( $_GET['sectionid'] ) {
echo $OUTPUT->header();
$get_section_id = $_GET['sectionid'];
$modinfo = get_fast_modinfo($COURSE->id);
$sections = $modinfo->get_section_info_all();
$suivi_cms = $DB->get_records_sql('SELECT id, cmid, hide from {format_iena_settings} where courseid = ? and sectionid = ?', array($COURSE->id, $get_section_id));
$is_course_section = false;
$current_section_name = "";
$sections_arr = [];
foreach ($sections as $section_num => $section) {
$section_id = $section->__get('id');
$section_name = $section->__get('name');
if ( $section_name == NULL ) {
$section_name = "Section " . $section_num;
}
if ( $section_id == $get_section_id ) {
$is_course_section = true;
$current_section_name = $section_name;
$current_section_id = $section_id;
}
$section_cms = [];
foreach ($modinfo->get_cms() as $module) {
if ( $module->section == $section_id ) {
$mod = new stdClass();
$mod->moduleid = $module->id;
$mod->name = $module->name;
$mod->courseid = $module->course;
$mod->sectionid = $module->section;
foreach ($suivi_cms as $suivi) {
if ( $module->id == $suivi->cmid ) {
if ( $suivi->hide == 1 ) {
$mod->suivi = 1;
} else {
$mod->suivi = 0;
}
}
}
array_push($section_cms, $mod);
}
}
$sec = new stdClass();
$sec->id = $section_id;
$sec->name = $section_name;
$sec->modules = $section_cms;
$sections_arr[] = $sec;
}
if ( $is_course_section == false ) {
echo "<p class='alert alert-warning'>Id de section invalide</p>";
echo $OUTPUT->footer();
} else {
// echo "<pre>";
// var_dump($sections_arr);
// echo "</pre>";
$view_param_indicateur = new view_param_indicateur();
echo $view_param_indicateur->get_content($sections_arr, $current_section_name, $current_section_id);
echo $OUTPUT->footer();
}
} else {
$link = $CFG->wwwroot . '/course/view.php?id=' . $courseID;
header("Location: {$link}");
exit;
}
// $PAGE->requires->js("/course/format/Sprint3/js/jquery.min.js");
// $PAGE->requires->js("/course/format/iena/js/file.js");
// $PAGE->requires->js_call_amd("/course/format/Sprint3/js/jquery.dataTables.js", 'init');
// echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"normalize.css\">";
// echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"common.css\">";
// echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.datatables.net/1.10.16/css/jquery.dataTables.css\">";
// echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\">";
// var_dump(count($modinfo->get_cms()));
// $suivi_cms = $DB->get_records_sql('SELECT id, cmid, hide from {format_iena_settings}
// where courseid = ? and sectionid = ?', array($COURSE->id, 124));
// echo "<pre>";
// var_dump($suivi_cms);
// echo "</pre>";
// echo $OUTPUT->footer();
// die;
// $view_param_indicateur = new view_param_indicateur();
// $sections = $view_param_indicateur->get_course_sections_modules();
// $Tab_id_modules = array();
// $i = 0;
// foreach ($sections as $section) {
// foreach ($section->ressources as $mod) {
// $Tab_id_modules[$i] = $mod->id;
// $i++;
// }
// }
// $initee="avant creation";
// var_dump($initee);
// die;
// $suivi_cms = $DB->get_records_sql('SELECT * from {format_iena_settings}
// where courseid = ?', array($COURSE->id));
// // var_dump($suivi_cms);
// // die;
// $inidezaaaatee="apres premiere requete";
// var_dump($inidezaaaatee);
// $to_insert = [];
// foreach ($sections as $section) {
// foreach ($Tab_id_modules as $id_module) {
// // $verif_db = $DB->get_record('format_iena_settings', array('cmid' => $id_module, 'sectionid' => $section->id), '*');
// $verif_db = false;
// foreach ($suivi_cms as $suivi_cm) {
// if ( $suivi_cm->cmid == $id_module && $suivi_cm->sectionid == $section->id ) {
// $verif_db = true;
// break;
// }
// }
// // if ($verif_db == false) {
// if ($verif_db == false) {
// $format_iena_setting_data = new stdClass();
// $format_iena_setting_data->cmid = $id_module;
// $format_iena_setting_data->hide = 0;
// $format_iena_setting_data->courseid = $COURSE->id;
// $format_iena_setting_data->sectionid = $section->id;
// array_push($to_insert, $format_iena_setting_data);
// // $DB->insert_record('format_iena_settings', $format_iena_setting_data, false);
// }
// }
// }
// $indezite="avant requete";
// var_dump($indezite);
// if ( count($to_insert) > 0 ) {
// $DB->insert_records('format_iena_settings', $to_insert);
// }
// $inite="initialisation terminée";
// var_dump($inite);
// echo $view_param_indicateur->get_content();
// echo $OUTPUT->footer();
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../../config.php');
require_once('view/view_param_indicateur.php');
require_once('entity/course_format_iena_section_ressources.php');
require_once('entity/course_format_iena_sections.php');
global $COURSE, $DB, $USER;
$courseid = required_param('courseid', PARAM_INT);
$sectionid = required_param('sectionid', PARAM_INT);
$url = new moodle_url('/course/format/iena/param_indicateur.php', array('courseid' => $courseid));
$PAGE->set_pagelayout('course');
$PAGE->set_url($url);
if (!has_capability('moodle/course:sectionvisibility', $context = context_course::instance($courseid), $USER->id)) {
$link = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
header("Location: {$link}");
exit;
}
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
require_login($course, false, null);
$PAGE->set_title('Indicateurs de suivi');
$PAGE->set_heading('Indicateurs de suivi');
// Update in Database all tables format_iena_settings for each module.
if ($_POST) {
if ($_POST['select-section']) {
$sectionid = $_POST['select-section'];
$sectionid = explode('-', $sectionid)[1];
} else {
$sectionid = "undefined";
}
// Récupération de l'état des modules du formulaire.
$postedmoduleids = [];
$y = 0;
foreach ($_POST as $key => $formmodule) {
$temp = explode($_POST['select-section'], $key);
if (count($temp) > 1) {
$postedmoduleids[$y] = $temp[0];
}
$y++;
}
$allmodules = explode("-", $_POST['all_modules']);
$suivirecords = $DB->get_records('format_iena_settings', array('sectionid' => $sectionid));
// Pour chaque activité du cours.
foreach ($allmodules as $coursemodid) {
$done = false;
// Pour chaque activité suivie ou non en base.
foreach ($suivirecords as $record) {
// Si l'activité est en base (suivie ou non).
if ($record->cmid == $coursemodid) {
// L'activité est suivie en base (1 ou 0 => true, false).
$issuivi = $record->hide == 1 ? true : false;
// L'activité a été checkée pour être suivie à présent (true ou false).
$isasksuivi = in_array($record->cmid, $postedmoduleids);
// Si l'état de suivi de l'activité n'est pas le même que demandé.
if ($issuivi !== $isasksuivi ) {
// Mise à jour de l'état de l'activité suivie.
$update = new stdClass();
$update->id = $record->id;
$update->hide = $isasksuivi ? 1 : 0;
$DB->update_record('format_iena_settings', $update, false);
// L'activité a été traitée.
$done = true;
} else {
// L'activité n'a pas besoin d'être traitée.
$done = true;
}
}
}
// Si l'activité n'est pas en base (n'a pas été traitée).
if ($done == false) {
// Si l'activité a été checkée pour être suivie à présent (true ou false).
if (in_array($coursemodid, $postedmoduleids) ) {
$insert = new stdClass();
$insert->courseid = $COURSE->id;
$insert->cmid = $coursemodid;
$insert->hide = 1;
$insert->sectionid = $sectionid;
$DB->insert_record('format_iena_settings', $insert, false);
}
}
}
$prevrecordexists = true;
$link = $CFG->wwwroot . '/course/format/iena/suivi_unit.php?courseid=' . $courseid . '&sectionid=' . $sectionid;
header("Location: {$link}");
exit;
} else if ( $_GET['sectionid'] ) {
echo $OUTPUT->header();
$getsectionid = $_GET['sectionid'];
$modinfo = get_fast_modinfo($COURSE->id);
$sections = $modinfo->get_section_info_all();
$suivicms = $DB->get_records_sql('SELECT id, cmid, hide
FROM {format_iena_settings}
WHERE courseid = ?
AND sectionid = ?',
array($COURSE->id, $getsectionid));
$iscoursesection = false;
$currentsectionname = "";
$sectionsarr = [];
foreach ($sections as $sectionnum => $section) {
$sectionid = $section->__get('id');
$sectionname = $section->__get('name');
if ($sectionname == null) {
$sectionname = "Section " . $sectionnum;
}
if ($sectionid == $getsectionid) {
$iscoursesection = true;
$currentsectionname = $sectionname;
$currentsectionid = $sectionid;
}
$sectioncms = [];
foreach ($modinfo->get_cms() as $module) {
if ( $module->section == $sectionid ) {
$mod = new stdClass();
$mod->moduleid = $module->id;
$mod->name = $module->name;
$mod->courseid = $module->course;
$mod->sectionid = $module->section;
foreach ($suivicms as $suivi) {
if ($module->id == $suivi->cmid) {
if ($suivi->hide == 1) {
$mod->suivi = 1;
} else {
$mod->suivi = 0;
}
}
}
array_push($sectioncms, $mod);
}
}
$sec = new stdClass();
$sec->id = $sectionid;
$sec->name = $sectionname;
$sec->modules = $sectioncms;
$sectionsarr[] = $sec;
}
if ($iscoursesection == false) {
echo "<p class='alert alert-warning'>Id de section invalide</p>";
echo $OUTPUT->footer();
} else {
$viewparamindicateur = new view_param_indicateur();
echo $viewparamindicateur->get_content($sectionsarr, $currentsectionname, $currentsectionid);
echo $OUTPUT->footer();
}
} else {
$link = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
header("Location: {$link}");
exit;
}
<?php
/**
* Created by PhpStorm.
* User: softia
* Date: 06/03/18
* Time: 10:20
*/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* @package format_iena
* @category format
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
require_once('../../../config.php');
require_once('../../lib.php');
global $COURSE, $DB, $USER;
$courseID = required_param('courseid', PARAM_INT);
$sectionId = required_param('sectionid', PARAM_INT);
$url = new moodle_url('/course/format/iena/param_section.php', array('courseid' => $courseID, 'sectionid' => $sectionId));
$PAGE->set_pagelayout('course');
$PAGE->set_url($url);
$course = $DB->get_record('course', array('id' => $courseID), '*', MUST_EXIST);
require_login($course, false, NULL);
if (!has_capability('moodle/course:update', $context = context_course::instance($courseID), $USER->id)) {
$link = $CFG->wwwroot . '/course/view.php?id=' . $courseID;
header("Location: {$link}");
exit;
}
if ($_POST) {
global $DB;
$dateChaine = $_POST["date_iena"]["year"] . "-" . $_POST["date_iena"]["month"] . "-" . $_POST["date_iena"]["day"] . " " .
$_POST["date_iena"]["hour"] . ":" . $_POST["date_iena"]["minute"] . ":00";
$dateUp = date_create($dateChaine);
$data_iena = new stdClass();
if (isset($_POST['date_render'])) {
$dateChaine = "";
}
$data_iena->date_rendu = $dateChaine;
$data_iena->presence = $_POST['presence'];
$data_iena->id_section = $sectionId;
if (isset($_POST['day_same'])) {
$data_iena->day_same = $_POST['day_same'];
} else {
$data_iena->day_same = 0;
}
if (isset($_POST['day_before'])) {
$data_iena->day_before = $_POST['day_before'];
} else {
$data_iena->day_before = 0;
}
if (isset($_POST['day_after'])) {
$data_iena->day_after = $_POST['day_after'];
} else {
$data_iena->day_after = 0;
}
$data_iena->nb_days_before = $_POST['nb_days_before'];
$data_iena->nb_days_after = $_POST['nb_days_after'];
/* Anciennement, servait à décider si la section était suivie dans les tableau de bord. Aujourd'hui, c'est le suivi d'achèvement d'activité qui est utilisé à la place. */
/* $data_iena->hide = $_POST['hide']; */
$data_iena->hide = false;
$testIfsection = $DB->get_record('format_iena', array('id_section' => $sectionId), '*');
if ($testIfsection == false) {
$DB->insert_record('format_iena', $data_iena, false);
} else {
$data_iena->id = $testIfsection->id;
$DB->update_record('format_iena', $data_iena, false);
}
$section = $DB->get_record('course_sections', array('id' => $sectionId), '*', MUST_EXIST);
$data = new stdClass();
$data->name = $_POST['name'];
$data->summary = $_POST['summary']['text'];
$data->summaryformat = $_POST['summary']['format'];
course_update_section($COURSE, $section, $data);
$link = $CFG->wwwroot . '/course/view.php?id=' . $courseID;
header("Location: {$link}");
exit;
} else {
$dataSection = $DB->get_record('format_iena', array('id_section' => $sectionId), '*');
$PAGE->set_title($COURSE->fullname);
$PAGE->set_heading($COURSE->fullname);
echo $OUTPUT->header();
//$PAGE->requires->js("/course/format/Sprint3/js/jquery.min.js");
//$PAGE->requires->js("/course/format/iena/js/file.js");
//$PAGE->requires->js_call_amd("/course/format/Sprint3/js/jquery.dataTables.js", 'init');
require_once("$CFG->libdir/formslib.php");
require_once('view/view_param_section.php');
$view_param_section = new view_param_section();
echo $view_param_section->get_content($course, $dataSection);
echo $OUTPUT->footer();
}
\ No newline at end of file
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
require_once('../../../config.php');
require_once('../../lib.php');
global $COURSE, $DB, $USER;
$courseid = required_param('courseid', PARAM_INT);
$sectionid = required_param('sectionid', PARAM_INT);
$url = new moodle_url('/course/format/iena/param_section.php', array('courseid' => $courseid, 'sectionid' => $sectionid));
$PAGE->set_pagelayout('course');
$PAGE->set_url($url);
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
require_login($course, false, null);
if (!has_capability('moodle/course:update', $context = context_course::instance($courseid), $USER->id)) {
$link = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
header("Location: {$link}");
exit;
}
if ($_POST) {
global $DB;
$datechaine = $_POST["date_iena"]["year"] . "-" . $_POST["date_iena"]["month"] . "-" . $_POST["date_iena"]["day"] . " " .
$_POST["date_iena"]["hour"] . ":" . $_POST["date_iena"]["minute"] . ":00";
$dateup = date_create($datechaine);
$dataiena = new stdClass();
if (isset($_POST['date_render'])) {
$datechaine = "";
}
$dataiena->date_rendu = $datechaine;
$dataiena->presence = $_POST['presence'];
$dataiena->id_section = $sectionid;
if (isset($_POST['day_same'])) {
$dataiena->day_same = $_POST['day_same'];
} else {
$dataiena->day_same = 0;
}
if (isset($_POST['day_before'])) {
$dataiena->day_before = $_POST['day_before'];
} else {
$dataiena->day_before = 0;
}
if (isset($_POST['day_after'])) {
$dataiena->day_after = $_POST['day_after'];
} else {
$dataiena->day_after = 0;
}
$dataiena->nb_days_before = $_POST['nb_days_before'];
$dataiena->nb_days_after = $_POST['nb_days_after'];
// Anciennement, servait à décider si la section était suivie dans les tableau de bord.
// Aujourd'hui, c'est le suivi d'achèvement d'activité qui est utilisé à la place.
$dataiena->hide = false;
$testifsection = $DB->get_record('format_iena', array('id_section' => $sectionid), '*');
if ($testifsection == false) {
$DB->insert_record('format_iena', $dataiena, false);
} else {
$dataiena->id = $testifsection->id;
$DB->update_record('format_iena', $dataiena, false);
}
$section = $DB->get_record('course_sections', array('id' => $sectionid), '*', MUST_EXIST);
$data = new stdClass();
$data->name = $_POST['name'];
$data->summary = $_POST['summary']['text'];
$data->summaryformat = $_POST['summary']['format'];
course_update_section($COURSE, $section, $data);
$link = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
header("Location: {$link}");
exit;
} else {
$datasection = $DB->get_record('format_iena', array('id_section' => $sectionid), '*');
$PAGE->set_title($COURSE->fullname);
$PAGE->set_heading($COURSE->fullname);
echo $OUTPUT->header();
require_once("$CFG->libdir/formslib.php");
require_once('view/view_param_section.php');
$viewparamsection = new view_param_section();
echo $viewparamsection->get_content($course, $datasection);
echo $OUTPUT->footer();
}
This diff is collapsed.
<?php
/**
* Created by PhpStorm.
* User: softia
* Date: 06/03/18
* Time: 10:20
*/
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
......@@ -20,168 +13,112 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* @package format_iena
* @category format
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
require_once('../../../config.php');
global $COURSE, $DB, $USER, $CFG;
$courseID = required_param('courseid', PARAM_INT);
$url = new moodle_url('/course/format/iena/send_message.php', array('courseid' => $courseID));
$PAGE->set_pagelayout('course');
$PAGE->set_url($url);
if (!has_capability('course/iena:suivi', $context = context_course::instance($courseID), $USER->id)) {
$link = $CFG->wwwroot . '/course/view.php?id=' . $courseID;
header("Location: {$link}");
exit;
}
$course = $DB->get_record('course', array('id' => $courseID), '*', MUST_EXIST);
require_login($course, false, NULL);
/*if (isset($_POST['action'])) {
$messageContent = $_POST['summary']['text'];
$usersid = explode(",", $_POST["usersid"]);
// $messageContent .= "<br>". get_string('course', 'format_iena') . " : " . $course->fullname;
$messageContent .= "<br>". get_string('course', 'format_iena') . " : <a href='" . $CFG->wwwroot . "/course/view.php?id=" . $course->id . "'>" . $course->fullname . "</a>";
$messageContent .= "<br> ". get_string('prof', 'format_iena') . " : " . $USER->firstname . " " . $USER->lastname;
$brutMessageContent = $course->fullname . " " . $_POST['summary']['text'];
$course_ctx = context_course::instance($courseID);
$students = get_enrolled_users($course_ctx);
// sending a notification to each students
foreach ($usersid as $userID) {
foreach ($students as $student) {
if ($student->id == $userID) {
$message = new \core\message\message();
$message->courseid = $course->id;
$message->component = 'moodle';
$message->name = 'instantmessage';
$message->userfrom = $USER;
$message->notification = '0';
$message->fullmessageformat = FORMAT_HTML;
$message->subject = "Rappel : " . $course->fullname;
$message->smallmessage = $messageContent;
$message->fullmessage = $brutMessageContent;
$message->fullmessagehtml = $messageContent;
$message->userto = $student;
$messageid = message_send($message);
break;
}
}
}
$link = $CFG->wwwroot . '/course/view.php?id=' . $courseID;
header("Location: {$link}");
exit;
}*/
//$dataSection = $DB->get_record('format_iena', array('id_section' => $sectionId), '*');
//$course = $DB->get_record('course', array('id' => $courseID), '*', MUST_EXIST);
// require_login($course, false, NULL);
$students="";
$back_url=$CFG->wwwroot . '/course/view.php?id=' . $courseID;
if(isset($_POST["students"])){
$students=$_POST["students"];
}
if(isset($_POST["back_url"])){
$back_url=$_POST["back_url"];
}
$data=new stdClass();
$nb = $students != "" ? count( explode(",", $students) ) : 0;
require_once('entity/course_format_iena_message.php');
$send_message = new course_format_iena_message(null, array('back_url'=>$back_url, 'students'=>$students));
if ( $nb == 0 ) {
$data->nb_results=0;
} else {
$data->nb_results=$nb;
$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;
header("Location: {$back_url}");
}
else if ($fromform = $send_message->get_data()) {
$back_url=$CFG->wwwroot . '/course/format/iena/suivi_unit.php'.$back_url;
try{
$messageContent = $fromform->summary['text'];
$usersid = explode(",", $fromform->students);
$messageContent .= "<br>". get_string('course', 'format_iena') . " : <a href='" . $CFG->wwwroot . "/course/view.php?id=" . $course->id . "'>" . $course->fullname . "</a>";
$messageContent .= "<br> ". get_string('prof', 'format_iena') . " : " . $USER->firstname . " " . $USER->lastname;
$brutMessageContent = $course->fullname . " " . $_POST['summary']['text'];
$course_ctx = context_course::instance($courseID);
$students = get_enrolled_users($course_ctx);
// sending a notification to each students
foreach ($usersid as $userID) {
foreach ($students as $student) {
if ($student->id == $userID) {
$message = new \core\message\message();
$message->courseid = $course->id;
$message->component = 'moodle';
$message->name = 'instantmessage';
$message->userfrom = $USER;
$message->notification = '0';
$message->fullmessageformat = FORMAT_HTML;
$message->subject = "Rappel : " . $course->fullname;
$message->smallmessage = $messageContent;
$message->fullmessage = $brutMessageContent;
$message->fullmessagehtml = $messageContent;
$message->userto = $student;
$messageid = message_send($message);
break;
}
}
}
$back_url.="&msg_success=true";
}
catch(Exception $e){
$back_url.="&msg_failure=true";
}
header("Location: {$back_url}");
}
else{
echo $OUTPUT->header();
$renderer = $PAGE->get_renderer('format_iena');
$renderer->display_message($data);
echo $OUTPUT->footer();
}
//echo $view_param_section->get_content($course, $dataSection);
/**
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @author vrignaud camille
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
require_once('../../../config.php');
global $COURSE, $DB, $USER, $CFG;
$courseid = required_param('courseid', PARAM_INT);
$url = new moodle_url('/course/format/iena/send_message.php', array('courseid' => $courseid));
$PAGE->set_pagelayout('course');
$PAGE->set_url($url);
if (!has_capability('course/iena:suivi',
$context = context_course::instance($courseid), $USER->id)) {
$link = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
header("Location: {$link}");
exit;
}
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
require_login($course, false, null);
$students = "";
$backurl = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
if (isset($_POST["students"])) {
$students = $_POST["students"];
}
if (isset($_POST["back_url"])) {
$backurl = $_POST["back_url"];
}
$data = new stdClass();
$nb = $students != "" ? count( explode(",", $students) ) : 0;
require_once('entity/course_format_iena_message.php');
$sendmessage = new course_format_iena_message(null, array('back_url' => $backurl,
'students' => $students));
if ($nb == 0) {
$data->nb_results = 0;
} else {
$data->nb_results = $nb;
$data->users_id = $students;
$courseid = required_param('courseid', PARAM_INT);
$data->link_cancel = $CFG->wwwroot . "/course/view.php?id=" . $courseid;
$data->form = $sendmessage->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 ($sendmessage->is_cancelled()) {
$backurl = $CFG->wwwroot . '/course/format/iena/suivi_unit.php'.$backurl;
header("Location: {$backurl}");
} else if ($fromform = $sendmessage->get_data()) {
$backurl = $CFG->wwwroot . '/course/format/iena/suivi_unit.php'.$backurl;
try {
$messagecontent = $fromform->summary['text'];
$usersid = explode(",", $fromform->students);
$messagecontent .= "<br>". get_string('course', 'format_iena') . " : <a href='" . $CFG->wwwroot .
"/course/view.php?id=" . $course->id . "'>" . $course->fullname . "</a>";
$messagecontent .= "<br> ". get_string('prof', 'format_iena') . " : " .
$USER->firstname . " " . $USER->lastname;
$brutmessagecontent = $course->fullname . " " . $_POST['summary']['text'];
$coursectx = context_course::instance($courseid);
$students = get_enrolled_users($coursectx);
// Sending a notification to each students.
foreach ($usersid as $userid) {
foreach ($students as $student) {
if ($student->id == $userid) {
$message = new \core\message\message();
$message->courseid = $course->id;
$message->component = 'moodle';
$message->name = 'instantmessage';
$message->userfrom = $USER;
$message->notification = '0';
$message->fullmessageformat = FORMAT_HTML;
$message->subject = "Rappel : " . $course->fullname;
$message->smallmessage = $messagecontent;
$message->fullmessage = $brutmessagecontent;
$message->fullmessagehtml = $messagecontent;
$message->userto = $student;
$messageid = message_send($message);
break;
}
}
}
$backurl .= "&msg_success=true";
} catch (Exception $e) {
$backurl .= "&msg_failure=true";
}
header("Location: {$backurl}");
} else {
echo $OUTPUT->header();
$renderer = $PAGE->get_renderer('format_iena');
$renderer->display_message($data);
echo $OUTPUT->footer();
}
<?php
// This file is part of Moodle - https://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Adds admin settings for the plugin.
*
* @package format_iena
* @copyright 2018 Softia/Université lorraine
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig) {
$settings->add(new admin_setting_confightmleditor('format_iena/msg_dist', get_string('message_dist', 'format_iena'),
get_string('message_dist_desc', 'format_iena'), get_string('message_default_dist', 'format_iena'), PARAM_RAW));
$settings->add(new admin_setting_confightmleditor('format_iena/msg_pres', get_string('message_pres', 'format_iena'),
get_string('message_pres_desc', 'format_iena'), get_string('message_default_pres', 'format_iena'), PARAM_RAW));
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment