Skip to content
Snippets Groups Projects
Commit 3230ef9d authored by Thomas Fradet's avatar Thomas Fradet
Browse files

folder

parent 9b319c9e
Branches
Tags
No related merge requests found
Showing
with 1873 additions and 93 deletions
Nous sommes plus qu'ouvert aux contributions ! Contactez <iena-contact@univ-lorraine.fr> pour plus d'informations.
Contributors are welcome, please contact <iena-contact@univ-lorraine.fr>.
\ No newline at end of file
# Plugin Compétences
Ce plugin MOODLE de type Bloc permet d'ajouter des fonctionnalités autours de la manipulation des Compétences dans MOODE et d'en simplifier l'usage. Il se base sur l'implémentation native des compétences dans MOODLE et est pleinement compatible avec elle.
This MOODLE plugin make Competency functionalities easier to use and add some news. It is based on native MOODLE competency object and offer full compatibility.
## Auteurs
Univesité de Lorraine : <https://www.univ-lorraine.fr/>.
Développement : Softia (<http://www.softia.fr/>).
- Vrignaud Camille <cvrignaud@softia.fr>
- Lebeau Michaël <mlebeau@softia.fr>
- Thomas Fradet <thomas.fradet@univ-lorraine.fr>
## Compatibility
MOODLE 35.
## Contribution
Contributors are welcome ! Please contact <iena-contact@univ-lorraine.fr>.
## Contact
Pour assistance interne (Univesité de Lorraine) : <https://helpdesk.univ-lorraine.fr>.
Pour tout autre sujet : <iena-contact@univ-lorraine.fr>.
Other : <iena-contact@univ-lorraine.fr>.
## Fonctionnalités
__Pour plus d'informations, consultez le [wiki](https://gitlab.univ-lorraine.fr/fradet1/iena-competency/wikis/home).__
### Liaison de compétences à un cours
L'ajout des compétences à un cours utilise une interface plus simple qu'à l'origine en affichant la description des compétences sélectionnées. L'association des compétences aux activité se fait dans une matrice Compétences x Activité, évitant de se rendre dans les paramètres de chaque activité.
### Information sur l'APC et gestion des accès aux référentiels
Une page paramétrable par l'administrateur permet de donner des renseignement sur l'APC directement dans le contexte du cours en ligne. L'enseignant pourra donc y trouver une aide directe et les contacts des services d'appui appropriés si nécessaire.
Cette page dispose d'un formulaire de contact qui permet à un administrateur de donner à un enseignant demandeur des droits d'édition des référentiels de compétences, afin de pouvoir adopter une approche concertée de l'implémentation et de l'évolution des référentiels de compétence dans la plateforme.
### Tableaux de bord
Enseignants et étudiants disposent de listes des compétences travaillés dans un cours et peuvent en voir l'état d'acquisition.
### Page Compétence de l'tudiant
Pour chaque compétence au sein du cours, l'étudiant dispose d'une page à laquelle l'enseignant et lui peuvent accéder. Cette page contient l'état d'acquisition de la compétence, les modules de cours qui y sont liés, les fonctionnalités de demande d'évaluation et d'évaluation, une zone de commentaire pour échanger et un historique complet du travail sur cette compétence au sein du cours et en dehors.
Cette page permet de visualiser les informations principales des éléments "parents" et "enfants" dans le référentiel de compétences.
<?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/>.
/**
* This file contains the Activity modules block.
*
* @package block_activity_modules
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/filelib.php');
class block_activity_modules extends block_list {
function init() {
$this->title = get_string('pluginname', 'block_activity_modules');
}
function get_content() {
global $CFG, $DB, $OUTPUT;
if($this->content !== NULL) {
return $this->content;
}
$this->content = new stdClass;
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
$course = $this->page->course;
require_once($CFG->dirroot.'/course/lib.php');
$modinfo = get_fast_modinfo($course);
$modfullnames = array();
$archetypes = array();
foreach($modinfo->cms as $cm) {
// Exclude activities which are not visible or have no link (=label)
if (!$cm->uservisible or !$cm->has_view()) {
continue;
}
if (array_key_exists($cm->modname, $modfullnames)) {
continue;
}
if (!array_key_exists($cm->modname, $archetypes)) {
$archetypes[$cm->modname] = plugin_supports('mod', $cm->modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
}
if ($archetypes[$cm->modname] == MOD_ARCHETYPE_RESOURCE) {
if (!array_key_exists('resources', $modfullnames)) {
$modfullnames['resources'] = get_string('resources');
}
} else {
$modfullnames[$cm->modname] = $cm->modplural;
}
}
core_collator::asort($modfullnames);
foreach ($modfullnames as $modname => $modfullname) {
if ($modname === 'resources') {
$icon = $OUTPUT->pix_icon('icon', '', 'mod_page', array('class' => 'icon'));
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/resources.php?id='.$course->id.'">'.$icon.$modfullname.'</a>';
} else {
$icon = $OUTPUT->image_icon('icon', get_string('pluginname', $modname), $modname);
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$course->id.'">'.$icon.$modfullname.'</a>';
}
}
return $this->content;
}
/**
* Returns the role that best describes this blocks contents.
*
* This returns 'navigation' as the blocks contents is a list of links to activities and resources.
*
* @return string 'navigation'
*/
public function get_aria_role() {
return 'navigation';
}
function applicable_formats() {
return array('all' => true, 'mod' => false, 'my' => false, 'admin' => false,
'tag' => false);
}
}
<?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/>.
/**
* Privacy Subsystem implementation for block_activity_modules.
*
* @package block_activity_modules
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace block_activity_modules\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for block_activity_modules implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}
<?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/>.
/**
* Activity modules block caps.
*
* @package block_activity_modules
* @copyright Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
'block/activity_modules:addinstance' => array(
'riskbitmask' => RISK_SPAM | RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:manageblocks'
),
);
<?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/>.
/**
* Strings for component 'block_activity_modules', language 'en', branch 'MOODLE_20_STABLE'
*
* @package block_activity_modules
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['activity_modules:addinstance'] = 'Add a new activities block';
$string['pluginname'] = 'Activities';
$string['privacy:metadata'] = 'The Activities block only shows data stored in other locations.';
@block @block_activity_modules
Feature: Block activity modules
In order to overview activity modules in a course
As a manager
I can add activities block in a course or on the frontpage
Scenario: Add activities block on the frontpage
Given the following "activities" exist:
| activity | name | intro | course | idnumber |
| assign | Frontpage assignment name | Frontpage assignment description | Acceptance test site | assign0 |
| book | Frontpage book name | Frontpage book description | Acceptance test site | book0 |
| chat | Frontpage chat name | Frontpage chat description | Acceptance test site | chat0 |
| choice | Frontpage choice name | Frontpage choice description | Acceptance test site | choice0 |
| data | Frontpage database name | Frontpage database description | Acceptance test site | data0 |
| feedback | Frontpage feedback name | Frontpage feedback description | Acceptance test site | feedback0 |
| forum | Frontpage forum name | Frontpage forum description | Acceptance test site | forum0 |
| label | Frontpage label name | Frontpage label description | Acceptance test site | label0 |
| lti | Frontpage lti name | Frontpage lti description | Acceptance test site | lti0 |
| page | Frontpage page name | Frontpage page description | Acceptance test site | page0 |
| quiz | Frontpage quiz name | Frontpage quiz description | Acceptance test site | quiz0 |
| resource | Frontpage resource name | Frontpage resource description | Acceptance test site | resource0 |
| imscp | Frontpage imscp name | Frontpage imscp description | Acceptance test site | imscp0 |
| folder | Frontpage folder name | Frontpage folder description | Acceptance test site | folder0 |
| glossary | Frontpage glossary name | Frontpage glossary description | Acceptance test site | glossary0 |
| scorm | Frontpage scorm name | Frontpage scorm description | Acceptance test site | scorm0 |
| lesson | Frontpage lesson name | Frontpage lesson description | Acceptance test site | lesson0 |
| survey | Frontpage survey name | Frontpage survey description | Acceptance test site | survey0 |
| url | Frontpage url name | Frontpage url description | Acceptance test site | url0 |
| wiki | Frontpage wiki name | Frontpage wiki description | Acceptance test site | wiki0 |
| workshop | Frontpage workshop name | Frontpage workshop description | Acceptance test site | workshop0 |
When I log in as "admin"
And I am on site homepage
And I follow "Turn editing on"
And I add the "Activities" block
And I click on "Assignments" "link" in the "Activities" "block"
Then I should see "Frontpage assignment name"
And I am on site homepage
And I click on "Chats" "link" in the "Activities" "block"
And I should see "Frontpage chat name"
And I am on site homepage
And I click on "Choices" "link" in the "Activities" "block"
And I should see "Frontpage choice name"
And I am on site homepage
And I click on "Databases" "link" in the "Activities" "block"
And I should see "Frontpage database name"
And I am on site homepage
And I click on "Feedback" "link" in the "Activities" "block"
And I should see "Frontpage feedback name"
And I am on site homepage
And I click on "Forums" "link" in the "Activities" "block"
And I should see "Frontpage forum name"
And I am on site homepage
And I click on "External tools" "link" in the "Activities" "block"
And I should see "Frontpage lti name"
And I am on site homepage
And I click on "Quizzes" "link" in the "Activities" "block"
And I should see "Frontpage quiz name"
And I am on site homepage
And I click on "Glossaries" "link" in the "Activities" "block"
And I should see "Frontpage glossary name"
And I am on site homepage
And I click on "SCORM packages" "link" in the "Activities" "block"
And I should see "Frontpage scorm name"
And I am on site homepage
And I click on "Lessons" "link" in the "Activities" "block"
And I should see "Frontpage lesson name"
And I am on site homepage
And I click on "Wikis" "link" in the "Activities" "block"
And I should see "Frontpage wiki name"
And I am on site homepage
And I click on "Workshop" "link" in the "Activities" "block"
And I should see "Frontpage workshop name"
And I am on site homepage
And I click on "Resources" "link" in the "Activities" "block"
And I should see "Frontpage book name"
And I should see "Frontpage page name"
And I should see "Frontpage resource name"
And I should see "Frontpage imscp name"
And I should see "Frontpage folder name"
And I should see "Frontpage url name"
Scenario: Add activities block in a course
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| assign | Test assignment name | Test assignment description | C1 | assign1 |
| book | Test book name | Test book description | C1 | book1 |
| chat | Test chat name | Test chat description | C1 | chat1 |
| choice | Test choice name | Test choice description | C1 | choice1 |
| data | Test database name | Test database description | C1 | data1 |
| feedback | Test feedback name | Test feedback description | C1 | feedback1 |
| folder | Test folder name | Test folder description | C1 | folder1 |
| forum | Test forum name | Test forum description | C1 | forum1 |
| glossary | Test glossary name | Test glossary description | C1 | glossary1 |
| imscp | Test imscp name | Test imscp description | C1 | imscp1 |
| label | Test label name | Test label description | C1 | label1 |
| lesson | Test lesson name | Test lesson description | C1 | lesson1 |
| lti | Test lti name | Test lti description | C1 | lti1 |
| page | Test page name | Test page description | C1 | page1 |
| quiz | Test quiz name | Test quiz description | C1 | quiz1 |
| resource | Test resource name | Test resource description | C1 | resource1 |
| scorm | Test scorm name | Test scorm description | C1 | scorm1 |
| survey | Test survey name | Test survey description | C1 | survey1 |
| url | Test url name | Test url description | C1 | url1 |
| wiki | Test wiki name | Test wiki description | C1 | wiki1 |
| workshop | Test workshop name | Test workshop description | C1 | workshop1 |
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add the "Activities" block
And I click on "Assignments" "link" in the "Activities" "block"
Then I should see "Test assignment name"
And I am on "Course 1" course homepage
And I click on "Chats" "link" in the "Activities" "block"
And I should see "Test chat name"
And I am on "Course 1" course homepage
And I click on "Choices" "link" in the "Activities" "block"
And I should see "Test choice name"
And I am on "Course 1" course homepage
And I click on "Databases" "link" in the "Activities" "block"
And I should see "Test database name"
And I am on "Course 1" course homepage
And I click on "Feedback" "link" in the "Activities" "block"
And I should see "Test feedback name"
And I am on "Course 1" course homepage
And I click on "Forums" "link" in the "Activities" "block"
And I should see "Test forum name"
And I am on "Course 1" course homepage
And I click on "External tools" "link" in the "Activities" "block"
And I should see "Test lti name"
And I am on "Course 1" course homepage
And I click on "Quizzes" "link" in the "Activities" "block"
And I should see "Test quiz name"
And I am on "Course 1" course homepage
And I click on "Glossaries" "link" in the "Activities" "block"
And I should see "Test glossary name"
And I am on "Course 1" course homepage
And I click on "SCORM packages" "link" in the "Activities" "block"
And I should see "Test scorm name"
And I am on "Course 1" course homepage
And I click on "Lessons" "link" in the "Activities" "block"
And I should see "Test lesson name"
And I am on "Course 1" course homepage
And I click on "Wikis" "link" in the "Activities" "block"
And I should see "Test wiki name"
And I am on "Course 1" course homepage
And I click on "Workshop" "link" in the "Activities" "block"
And I should see "Test workshop name"
And I am on "Course 1" course homepage
And I click on "Resources" "link" in the "Activities" "block"
And I should see "Test book name"
And I should see "Test page name"
And I should see "Test resource name"
And I should see "Test imscp name"
And I should see "Test folder name"
And I should see "Test url name"
...@@ -17,19 +17,13 @@ ...@@ -17,19 +17,13 @@
/** /**
* Version details * Version details
* *
* The block competency_iena plugin add competency_iena in moodle it is a different * @package block_activity_modules
* way to screen modules * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
*
* @package block_competency_iena
* @category block
* @copyright 2018 Softia/Université de Lorraine
* @author Vrignaud Camille / Michaël Lebeau
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$plugin->version = 2018102201; $plugin->version = 2018051400; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2014051200; $plugin->requires = 2018050800; // Requires this Moodle version
$plugin->component = 'block_competency_iena'; $plugin->component = 'block_activity_modules'; // Full name of the plugin (used for diagnostics)
$plugin->release = 'v1.0';
$plugin->maturity = MATURITY_STABLE;
\ 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/>.
/**
* Define all the backup steps that will be used by the backup_block_task
* @package block_activity_results
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @copyright 2015 Stephen Bourget
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Specialised restore task for the activity_results block
* (using execute_after_tasks for recoding of target activity)
*
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class restore_activity_results_block_task extends restore_block_task {
/**
* Define (add) particular settings this activity can have
*/
protected function define_my_settings() {
}
/**
* Define (add) particular steps this activity can have
*/
protected function define_my_steps() {
}
/**
* Define the associated file areas
*/
public function get_fileareas() {
return array(); // No associated fileareas.
}
/**
* Define special handling of configdata.
*/
public function get_configdata_encoded_attributes() {
return array(); // No special handling of configdata.
}
/**
* This function, executed after all the tasks in the plan
* have been executed, will perform the recode of the
* target activity for the block. This must be done here
* and not in normal execution steps because the activity
* can be restored after the block.
*/
public function after_restore() {
global $DB;
// Get the blockid.
$blockid = $this->get_blockid();
if ($configdata = $DB->get_field('block_instances', 'configdata', array('id' => $blockid))) {
$config = unserialize(base64_decode($configdata));
if (!empty($config->activityparentid)) {
// Get the mapping and replace it in config.
if ($mapping = restore_dbops::get_backup_ids_record($this->get_restoreid(),
$config->activityparent, $config->activityparentid)) {
// Update the parent module id (the id from mdl_quiz etc...)
$config->activityparentid = $mapping->newitemid;
// Get the grade_items record to update the activitygradeitemid.
$info = $DB->get_record('grade_items',
array('iteminstance' => $config->activityparentid, 'itemmodule' => $config->activityparent));
// Update the activitygradeitemid the id from the grade_items table.
$config->activitygradeitemid = $info->id;
// Encode and save the config.
$configdata = base64_encode(serialize($config));
$DB->set_field('block_instances', 'configdata', $configdata, array('id' => $blockid));
}
}
}
}
/**
* Define the contents in the activity that must be
* processed by the link decoder
*/
static public function define_decode_contents() {
return array();
}
/**
* Define the decoding rules for links belonging
* to the activity to be executed by the link decoder
*/
static public function define_decode_rules() {
return array();
}
}
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/>.
/**
* Privacy Subsystem implementation for block_activity_results.
*
* @package block_activity_results
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace block_activity_results\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for block_activity_results implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}
<?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/>.
/**
* Activity results block caps.
*
* @package block_activity_results
* @copyright 2015 Stephen Bourget
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
'block/activity_results:addinstance' => array(
'riskbitmask' => RISK_SPAM | RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:manageblocks'
),
);
<?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/>.
/**
* Defines the form for editing Quiz results block instances.
*
* @package block_activity_results
* @copyright 2009 Tim Hunt
* @copyright 2015 Stephen Bourget
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/lib/grade/constants.php');
/**
* Form for editing activity results block instances.
*
* @copyright 2009 Tim Hunt
* @copyright 2015 Stephen Bourget
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class block_activity_results_edit_form extends block_edit_form {
/**
* The definition of the fields to use.
*
* @param MoodleQuickForm $mform
*/
protected function specific_definition($mform) {
global $DB;
// Load defaults.
$blockconfig = get_config('block_activity_results');
// Fields for editing activity_results block title and contents.
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
// Get supported modules (Only modules using grades or scales will be listed).
$sql = 'SELECT id, itemname FROM {grade_items} WHERE courseid = ? and itemtype = ? and (gradetype = ? or gradetype = ?)';
$params = array($this->page->course->id, 'mod', GRADE_TYPE_VALUE, GRADE_TYPE_SCALE);
$activities = $DB->get_records_sql_menu($sql, $params);
core_collator::asort($activities);
if (empty($activities)) {
$mform->addElement('static', 'noactivitieswarning', get_string('config_select_activity', 'block_activity_results'),
get_string('config_no_activities_in_course', 'block_activity_results'));
} else {
foreach ($activities as $id => $name) {
$activities[$id] = strip_tags(format_string($name));
}
$mform->addElement('select', 'config_activitygradeitemid',
get_string('config_select_activity', 'block_activity_results'), $activities);
$mform->setDefault('config_activitygradeitemid', $this->block->get_owning_activity()->id);
}
$mform->addElement('text', 'config_showbest',
get_string('config_show_best', 'block_activity_results'), array('size' => 3));
$mform->setDefault('config_showbest', $blockconfig->config_showbest);
$mform->setType('config_showbest', PARAM_INT);
if ($blockconfig->config_showbest_locked) {
$mform->freeze('config_showbest');
}
$mform->addElement('text', 'config_showworst',
get_string('config_show_worst', 'block_activity_results'), array('size' => 3));
$mform->setDefault('config_showworst', $blockconfig->config_showworst);
$mform->setType('config_showworst', PARAM_INT);
if ($blockconfig->config_showworst_locked) {
$mform->freeze('config_showworst');
}
$mform->addElement('selectyesno', 'config_usegroups', get_string('config_use_groups', 'block_activity_results'));
$mform->setDefault('config_usegroups', $blockconfig->config_usegroups);
if ($blockconfig->config_usegroups_locked) {
$mform->freeze('config_usegroups');
}
$nameoptions = array(
B_ACTIVITYRESULTS_NAME_FORMAT_FULL => get_string('config_names_full', 'block_activity_results'),
B_ACTIVITYRESULTS_NAME_FORMAT_ID => get_string('config_names_id', 'block_activity_results'),
B_ACTIVITYRESULTS_NAME_FORMAT_ANON => get_string('config_names_anon', 'block_activity_results')
);
$mform->addElement('select', 'config_nameformat',
get_string('config_name_format', 'block_activity_results'), $nameoptions);
$mform->setDefault('config_nameformat', $blockconfig->config_nameformat);
if ($blockconfig->config_nameformat_locked) {
$mform->freeze('config_nameformat');
}
$gradeeoptions = array(
B_ACTIVITYRESULTS_GRADE_FORMAT_PCT => get_string('config_format_percentage', 'block_activity_results'),
B_ACTIVITYRESULTS_GRADE_FORMAT_FRA => get_string('config_format_fraction', 'block_activity_results'),
B_ACTIVITYRESULTS_GRADE_FORMAT_ABS => get_string('config_format_absolute', 'block_activity_results')
);
$mform->addElement('select', 'config_gradeformat',
get_string('config_grade_format', 'block_activity_results'), $gradeeoptions);
$mform->setDefault('config_gradeformat', $blockconfig->config_gradeformat);
if ($blockconfig->config_gradeformat_locked) {
$mform->freeze('config_gradeformat');
}
$options = array();
for ($i = 0; $i <= 5; $i++) {
$options[$i] = $i;
}
$mform->addElement('select', 'config_decimalpoints', get_string('config_decimalplaces', 'block_activity_results'),
$options);
$mform->setDefault('config_decimalpoints', $blockconfig->config_decimalpoints);
$mform->setType('config_decimalpoints', PARAM_INT);
if ($blockconfig->config_decimalpoints_locked) {
$mform->freeze('config_decimalpoints');
}
}
}
\ 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/>.
/**
* Strings for component 'block_activity_results', language 'en', branch 'MOODLE_20_STABLE'
*
* @package block_activity_results
* @copyright 2015 Stephen Bourget
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['activity_results:addinstance'] = 'Add a new activity results block';
$string['bestgrade'] = 'The highest grade:';
$string['bestgrades'] = 'The {$a} highest grades:';
$string['bestgroupgrade'] = 'The group with the highest average:';
$string['bestgroupgrades'] = 'The {$a} groups with the highest average:';
$string['config_format_absolute'] = 'Absolute numbers';
$string['config_format_fraction'] = 'Fractions';
$string['config_format_percentage'] = 'Percentages';
$string['config_decimalplaces'] = 'Decimal places to display';
$string['config_grade_format'] = 'Display grades as';
$string['config_name_format'] = 'Privacy of results';
$string['config_names_anon'] = 'Anonymous results';
$string['config_names_full'] = 'Display full names';
$string['config_names_id'] = 'Display only ID numbers';
$string['config_no_activities_in_course'] = 'There are not yet any activities in this course.';
$string['config_select_activity'] = 'Which activity should this block display results from?';
$string['config_show_best'] = 'How many of the highest grades should be shown (0 to disable)?';
$string['config_show_worst'] = 'How many of the lowest grades should be shown (0 to disable)?';
$string['configuredtoshownothing'] = 'This block\'s configuration currently does not allow it to show any results.';
$string['config_use_groups'] = 'Show groups instead of students (only if the activity supports groups)?';
$string['defaulthighestgrades'] = 'Default highest grades shown';
$string['defaulthighestgrades_desc'] = 'How many of the highest grades should be shown by default?';
$string['defaultlowestgrades'] = 'Default lowest grades shown';
$string['defaultlowestgrades_desc'] = 'How many of the lowest grades should be shown by default?';
$string['defaultshowgroups'] = 'Default show groups';
$string['defaultnameoptions'] = 'Privacy of results';
$string['defaultnameoptions_desc'] = 'How should the students be identified by default?';
$string['defaultshowgroups_desc'] = 'Show groups instead of students by default (only if the activity supports groups)';
$string['defaultgradedisplay'] = 'Display grades as';
$string['defaultgradedisplay_desc'] = 'How should the grades be displayed by default?';
$string['defaultdecimalplaces'] = 'Decimal places';
$string['defaultdecimalplaces_desc'] = 'Number of decimal places to display by default';
$string['error_emptyactivityid'] = 'Please configure this block and select which activity it should display results from.';
$string['error_emptyactivityrecord'] = 'Error: the selected activity does not exist in the database.';
$string['error_nogroupsexist'] = 'Error: the block is set to display grades in group mode, but there are no groups defined.';
$string['error_unsupportedgradetype'] = 'Error: the activity selected uses a grading method that is not supported by this block.';
$string['notyetgraded'] = 'Not yet graded';
$string['pluginname'] = 'Activity results';
$string['unknown'] = 'Unknown scale';
$string['worstgrade'] = 'The lowest grade:';
$string['worstgrades'] = 'The {$a} lowest grades:';
$string['worstgroupgrade'] = 'The group with the lowest average:';
$string['worstgroupgrades'] = 'The {$a} groups with the lowest average:';
$string['privacy:metadata'] = 'The Activity results block only shows data stored in other locations.';
<?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/>.
/**
* Defines the form for editing activity results block instances.
*
* @package block_activity_results
* @copyright 2016 Stephen Bourget
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
// Default high scores.
$setting = new admin_setting_configtext('block_activity_results/config_showbest',
new lang_string('defaulthighestgrades', 'block_activity_results'),
new lang_string('defaulthighestgrades_desc', 'block_activity_results'), 3, PARAM_INT);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
// Default low scores.
$setting = new admin_setting_configtext('block_activity_results/config_showworst',
new lang_string('defaultlowestgrades', 'block_activity_results'),
new lang_string('defaultlowestgrades_desc', 'block_activity_results'), 0, PARAM_INT);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
// Default group display.
$yesno = array(0 => get_string('no'), 1 => get_string('yes'));
$setting = new admin_setting_configselect('block_activity_results/config_usegroups',
new lang_string('defaultshowgroups', 'block_activity_results'),
new lang_string('defaultshowgroups_desc', 'block_activity_results'), 0, $yesno);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
// Default privacy settings.
$nameoptions = array(
B_ACTIVITYRESULTS_NAME_FORMAT_FULL => get_string('config_names_full', 'block_activity_results'),
B_ACTIVITYRESULTS_NAME_FORMAT_ID => get_string('config_names_id', 'block_activity_results'),
B_ACTIVITYRESULTS_NAME_FORMAT_ANON => get_string('config_names_anon', 'block_activity_results')
);
$setting = new admin_setting_configselect('block_activity_results/config_nameformat',
new lang_string('defaultnameoptions', 'block_activity_results'),
new lang_string('defaultnameoptions_desc', 'block_activity_results'), B_ACTIVITYRESULTS_NAME_FORMAT_FULL, $nameoptions);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
// Default grade display settings.
$gradeoptions = array(
B_ACTIVITYRESULTS_GRADE_FORMAT_PCT => get_string('config_format_percentage', 'block_activity_results'),
B_ACTIVITYRESULTS_GRADE_FORMAT_FRA => get_string('config_format_fraction', 'block_activity_results'),
B_ACTIVITYRESULTS_GRADE_FORMAT_ABS => get_string('config_format_absolute', 'block_activity_results')
);
$setting = new admin_setting_configselect('block_activity_results/config_gradeformat',
new lang_string('defaultgradedisplay', 'block_activity_results'),
new lang_string('defaultgradedisplay_desc', 'block_activity_results'), B_ACTIVITYRESULTS_GRADE_FORMAT_PCT, $gradeoptions);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
// Default decimal places.
$places = array();
for ($i = 0; $i <= 5; $i++) {
$places[$i] = $i;
}
$setting = new admin_setting_configselect('block_activity_results/config_decimalpoints',
new lang_string('defaultdecimalplaces', 'block_activity_results'),
new lang_string('defaultdecimalplaces_desc', 'block_activity_results'), 2, $places);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
}
.block_activity_results h1 {
margin: 4px;
font-size: 1.1em;
}
.block_activity_results table.grades {
text-align: left;
width: 100%;
}
.block_activity_results table.grades .number {
text-align: left;
width: 10%;
}
.block_activity_results table.grades .name {
text-align: left;
width: 77%;
}
.block_activity_results table.grades .grade {
text-align: right;
}
.block_activity_results table.grades caption {
font-weight: bold;
font-size: 18px;
}
@block @block_activity_results
Feature: The activity results block displays student scores
In order to be display student scores
As a user
I need to see the activity results block
Background:
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
| student1 | Student | 1 | student1@example.com | S1 |
| student2 | Student | 2 | student2@example.com | S2 |
| student3 | Student | 3 | student3@example.com | S3 |
| student4 | Student | 4 | student4@example.com | S4 |
| student5 | Student | 5 | student5@example.com | S5 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
| student4 | C1 | student |
| student5 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 1 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I am on "Course 1" course homepage
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 2 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I am on "Course 1" course homepage
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 3 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I am on "Course 1" course homepage
And I add a "Page" to section "1"
And I set the following fields to these values:
| Name | Test page name |
| Description | Test page description |
| Page content | This is a page |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I should see "Test page name"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment 1"
And I give the grade "80.00" to the user "Student 2" for the grade item "Test assignment 1"
And I give the grade "70.00" to the user "Student 3" for the grade item "Test assignment 1"
And I give the grade "60.00" to the user "Student 4" for the grade item "Test assignment 1"
And I give the grade "50.00" to the user "Student 5" for the grade item "Test assignment 1"
And I press "Save changes"
And I am on "Course 1" course homepage
Scenario: Configure the block on a non-graded activity to show 3 high scores
Given I follow "Test page name"
And I add the "Activity results" block
When I configure the "Activity results" block
And I set the following fields to these values:
| id_config_activitygradeitemid | Test assignment 1 |
| id_config_showbest | 3 |
| id_config_showworst | 0 |
| id_config_gradeformat | Absolute numbers |
| id_config_nameformat | Display full names |
And I press "Save changes"
Then I should see "Student 1" in the "Activity results" "block"
And I should see "90.00" in the "Activity results" "block"
And I should see "Student 2" in the "Activity results" "block"
And I should see "80.00" in the "Activity results" "block"
And I should see "Student 3" in the "Activity results" "block"
And I should see "70.00" in the "Activity results" "block"
Scenario: Block should select current activity by default
Given I follow "Test assignment 1"
When I add the "Activity results" block
And I configure the "Activity results" block
Then the field "id_config_activitygradeitemid" matches value "Test assignment 1"
And I press "Cancel"
And I am on "Course 1" course homepage
And I follow "Test assignment 2"
And I add the "Activity results" block
And I configure the "Activity results" block
And the field "id_config_activitygradeitemid" matches value "Test assignment 2"
And I press "Cancel"
And I am on "Course 1" course homepage
And I follow "Test assignment 3"
And I add the "Activity results" block
And I configure the "Activity results" block
And the field "id_config_activitygradeitemid" matches value "Test assignment 3"
And I press "Cancel"
And I am on "Course 1" course homepage
And I follow "Test page name"
And I add the "Activity results" block
And I configure the "Activity results" block
And the field "id_config_activitygradeitemid" does not match value "Test page name"
@block @block_activity_results
Feature: The activity results block doesn't displays student scores for unconfigured block
In order to be display student scores
As a user
I need to see the activity results block
Background:
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Scenario: Add the block to a the course
Given I add the "Activity results" block
Then I should see "Please configure this block and select which activity it should display results from." in the "Activity results" "block"
Scenario: Try to configure the block on the course page in a course without activities
Given I add the "Activity results" block
When I configure the "Activity results" block
And I should see "There are not yet any activities in this course."
And I press "Save changes"
Then I should see "Please configure this block and select which activity it should display results from." in the "Activity results" "block"
Scenario: Try to configure the block on a resource page in a course without activities
Given I add a "Page" to section "1"
And I set the following fields to these values:
| Name | Test page name |
| Description | Test page description |
| page | This is a page |
And I press "Save and display"
When I add the "Activity results" block
And I configure the "Activity results" block
And I should see "There are not yet any activities in this course."
And I press "Save changes"
Then I should see "Please configure this block and select which activity it should display results from." in the "Activity results" "block"
@block @block_activity_results
Feature: The activity results block doesn't display student scores for unsupported activity
In order to be display student scores
As a user
I need to properly configure the activity results block
Background:
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Scenario: Try to configure the block to use an activity without grades
Given I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I am on "Course 1" course homepage
And I add the "Activity results" block
And I configure the "Activity results" block
And I set the following fields to these values:
| id_config_showbest | 1 |
| id_config_showworst | 0 |
| id_config_gradeformat | Percentages |
| id_config_nameformat | Display full names |
And I press "Save changes"
When I follow "Test assignment"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| id_grade_modgrade_type | None |
And I press "Save and return to course"
Then I should see "Error: the activity selected uses a grading method that is not supported by this block." in the "Activity results" "block"
@block @block_activity_results
Feature: The activity results block can have administrator set defaults
In order to be customize the activity results block
As an admin
I need can assign some site wide defaults
Background:
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
| student1 | Student | 1 | student1@example.com | S1 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
Scenario: Assign some site-wide defaults to the block.
Given the following config values are set as admin:
| config_showbest | 0 | block_activity_results |
| config_showworst | 0 | block_activity_results |
| config_gradeformat | 2 | block_activity_results |
| config_nameformat | 2 | block_activity_results |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I am on "Course 1" course homepage
And I add the "Activity results" block
When I configure the "Activity results" block
And the following fields match these values:
| id_config_showbest | 0 |
| id_config_showworst | 0 |
| id_config_gradeformat | Fractions |
| id_config_nameformat | Display only ID numbers |
And I press "Save changes"
Then I should see "This block's configuration currently does not allow it to show any results." in the "Activity results" "block"
Scenario: Assign some site-wide defaults to the block and lock them.
Given the following config values are set as admin:
| config_showbest | 0 | block_activity_results |
| config_showbest_locked | 1 | block_activity_results |
| config_showworst | 0 | block_activity_results |
| config_showworst_locked | 1 | block_activity_results |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I am on "Course 1" course homepage
And I add the "Activity results" block
When I configure the "Activity results" block
And the following fields match these values:
| id_config_showbest | 0 |
| id_config_showworst | 0 |
And the "id_config_showbest" "field" should be readonly
And the "id_config_showworst" "field" should be readonly
And I press "Save changes"
Then I should see "This block's configuration currently does not allow it to show any results." in the "Activity results" "block"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment