Skip to content
Snippets Groups Projects
Commit f4d8031d authored by DELARUELLE Myriam's avatar DELARUELLE Myriam
Browse files

Merge branch '1-option-to-toggle-display-for-students' into 'master'

Resolve "Ajout d’une option pour ne pas afficher le bloc aux étudiant·e·s"

Closes #1

See merge request !1
parents fcb692ed 5d360622
No related branches found
No related tags found
1 merge request!1Resolve "Ajout d’une option pour ne pas afficher le bloc aux étudiant·e·s"
......@@ -65,6 +65,12 @@ class block_career extends block_base
if (empty($this->config)) {
$this->config = new stdClass();
}
if (empty($this->config->showstudents)) {
$this->config->showstudents = get_config('block_career', 'showstudentsbydefault');
}
if (!$this->config->showstudents && current(get_user_roles(context_course::instance($COURSE->id), $USER->id))->shortname == 'student') {
return;
}
$request = $DB->get_records_sql('SELECT * FROM {block_career} WHERE course = ?', array($COURSE->id));
// var_dump($request);
......
......@@ -11,10 +11,12 @@
function specific_definition($mform)
{
// Adding an element to the form
// $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
// Option to show/hide the block to students
$mform->addElement('advcheckbox', 'config_showstudents', get_string('config_showstudents', 'block_career'), get_string('config_showstudents_desc', 'block_career'));
$mform->setDefault('config_showstudents', get_config('block_career', 'showstudentsbydefault'));
}
}
?>
?>
\ No newline at end of file
<?php
$string['date_release'] = '{$a->month}.{$a->date}.{$a->year}';
$string['career'] = 'Moodle Version';
$string['career:addinstance'] = 'Ajouter un block Parcours';
$string['career:myaddinstance'] = 'Ajouter un block Parcours sur ma page';
$string['pluginname'] = 'Path block';
$string['career:addinstance'] = 'Add a new career block';
$string['career:myaddinstance'] = 'Add a new career block to Dashboard';
$string['pluginname'] = 'Path block';
$string['release'] = 'Release: ';
$string['title_plugin'] = 'Path';
$string['titleadd_plugin'] = 'New Path';
......@@ -16,4 +16,8 @@
$string['add_path'] = 'Add a path';
$string['any_carrer'] = 'No Path in this course.';
$string['list_title'] = 'Edit path list';
$string['setting_showstudents'] = 'Show the block to students';
$string['setting_showstudents_desc'] = 'If unselected, the block will be hidden to students by default.';
$string['config_showstudents'] = 'Show the block to students';
$string['config_showstudents_desc'] = 'If unselected, the block will be hidden to students.';
?>
\ No newline at end of file
......@@ -4,6 +4,7 @@
$string['career:addinstance'] = 'Ajouter un block Parcours';
$string['career:myaddinstance'] = 'Ajouter un block Parcours sur ma page';
$string['pluginname'] = 'Bloc Parcours';
$string['release'] = 'Version : ';
$string['title_plugin'] = 'Parcours';
$string['titleadd_plugin'] = 'Ajouter un parcours';
$string['titleaddname_plugin'] = 'Nom';
......@@ -15,4 +16,8 @@
$string['add_path'] = 'Ajouter un parcours';
$string['any_carrer'] = 'Pas de parcours.';
$string['list_title'] = 'Édition des parcours';
$string['setting_showstudents'] = 'Afficher le bloc aux étudiant·e·s';
$string['setting_showstudents_desc'] = 'Si décoché, le bloc sera caché par défaut aux étudiant·e·s.';
$string['config_showstudents'] = 'Afficher le bloc aux étudiant·e·s';
$string['config_showstudents_desc'] = 'Si décoché, le bloc sera caché aux étudiant·e·s.';
?>
\ 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/>.
/**
* Settings for the career block
*
* @package block_career
* @category block
* @copyright 2018 Softia/Université lorraine
* @author Myriam Delaruelle / vrignaud camille/ faouzi / Thomas Fradet
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
// Default for showing/hiding the block to students
$settings->add(new admin_setting_configcheckbox(
'block_career/showstudentsbydefault',
get_string('setting_showstudents', 'block_career'),
get_string('setting_showstudents_desc', 'block_career'),
1
));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment