Commit 268425bd authored by Robert Lyon's avatar Robert Lyon

Bug 1409546: Adding smart evidence switch to institution config form

And adding the master switch to be set via the config.php file

Change-Id: I92c5a689af75b42b1774c54cc8b97f2938099740
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 9ac1591c
......@@ -207,6 +207,7 @@ if ($institution || $add) {
$data = get_record('institution', 'name', $institution);
$data->commentsortorder = get_config_institution($institution, 'commentsortorder');
$data->commentthreaded = get_config_institution($institution, 'commentthreaded');
$data->allowinstitutionsmartevidence = get_config_institution($institution, 'allowinstitutionsmartevidence');
$lockedprofilefields = (array) get_column('institution_locked_profile_field', 'profilefield', 'name', $institution);
// TODO: Find a better way to work around Smarty's minimal looping logic
......@@ -240,6 +241,7 @@ if ($institution || $add) {
$data->defaultmembershipperiod = null;
$data->showonlineusers = 2;
$data->allowinstitutionpublicviews = get_config('allowpublicviews') ? 1 : 0;
$data->allowinstitutionsmartevidence = 0;
$data->licensemandatory = 0;
$data->licensedefault = '';
$data->dropdownmenu = get_config('dropdownmenu') ? 1 : 0;
......@@ -260,6 +262,7 @@ if ($institution || $add) {
$sitename = get_config('sitename');
safe_require('artefact', 'internal');
safe_require('module', 'framework');
$elements = array(
'add' => array(
'type' => 'hidden',
......@@ -522,7 +525,14 @@ if ($institution || $add) {
);
}
}
$elements['allowinstitutionsmartevidence'] = array(
'type' => 'switchbox',
'title' => get_string('allowinstitutionsmartevidence', 'admin'),
'description' => get_string('allowinstitutionsmartevidencedescription','admin'),
'defaultvalue' => PluginModuleFramework::is_active() && $data->allowinstitutionsmartevidence,
'disabled' => PluginModuleFramework::is_active() == false,
'help' => true,
);
$elements['lockedfields'] = array(
'type' => 'fieldset',
'class' => 'last with-formgroup',
......@@ -696,6 +706,10 @@ function institution_validate(Pieform $form, $values) {
if (!empty($values['lang']) && $values['lang'] != 'sitedefault' && !array_key_exists($values['lang'], get_languages())) {
$form->set_error('lang', get_string('institutionlanginvalid', 'admin'));
}
safe_require('module', 'framework');
if (!PluginModuleFramework::is_active() && (!empty($values['allowinstitutionsmartevidence']))) {
$form->set_error('allowinstitutionsmartevidence', get_string('institutionsmartevidencenotallowed', 'admin'));
}
// Validate plugins settings.
plugin_institution_prefs_validate($form, $values);
......@@ -832,6 +846,7 @@ function institution_submit(Pieform $form, $values) {
}
$newinstitution->allowinstitutionpublicviews = (isset($values['allowinstitutionpublicviews']) && $values['allowinstitutionpublicviews']) ? 1 : 0;
$newinstitution->allowinstitutionsmartevidence = (isset($values['allowinstitutionsmartevidence']) && $values['allowinstitutionsmartevidence']) ? 1 : 0;
// TODO: Move handling of authentication instances within the Institution class as well?
if (!empty($values['authplugin'])) {
......
......@@ -337,6 +337,9 @@ $string['allowpublicviews'] = 'Allow public pages';
$string['allowpublicviewsdescription1'] = 'Users can create portfolio pages that are accessible to the public rather than only to logged-in users.';
$string['allowinstitutionpublicviews'] = 'Allow institution public pages';
$string['allowinstitutionpublicviewsdescription2'] = 'Allow users belonging to this institution to create portfolio pages that are accessible to the public rather than only to registered users.';
$string['allowinstitutionsmartevidence'] = 'Allow SmartEvidence';
$string['allowinstitutionsmartevidencedescription'] = 'Turn collections into SmartEvidence collections, which are linked to a competency framework.';
$string['institutionsmartevidencenotallowed'] = 'You need to activate the "smartevidence" module on the "Plugin administration" page before you can set the SmartEvidence options';
$string['allowpublicprofiles'] = 'Allow public profiles';
$string['allowpublicprofilesdescription1'] = 'Users can set their profile pages to be accessible to the public rather than only to registered users.';
$string['allowanonymouspages'] = 'Allow anonymous pages';
......
<!-- @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later -->
<!-- @copyright For copyright information on Mahara, please see the README file distributed with this software. -->
<h3>Allow SmartEvidence</h3>
<p>SmartEvidence allows your users to work with a competency framework in
a portfolio. They will have an overview page containing a matrix where
they can see quickly, for which competencies they already have
evidence gathered, which have been approved by an assessor or
themselves if the framework allows self-assessment, and where they
need more work.</p>
<p>
When activated, users can turn a regular collection into a
SmartEvidence collection in order to use that portfolio with a
competency framework.</p>
......@@ -34,7 +34,6 @@ Scenario: Turning switches on and off on Edit Institution page (Bug 1431569)
| Update user quotas | 0 |
| Allow institution public pages | 1 |
| Maximum user accounts allowed | |
And I follow "Locked fields"
# Checking the default settings are correct
And the following fields match these values:
| First name | 0 |
......
......@@ -2,9 +2,10 @@
Feature: Make sure 'framework' module is installed and active
In order to use SmartEvidence
As an admin
So I can benefit from the recording/marking of SmartEvidence in Mahara
So I can benefit from the recording/marking of SmartEvidence in a
Mahara institution
Scenario: Installing framework module
Scenario: Installing framework module and actoivating for an institution
Given I log in as "admin" with password "Kupuhipa1"
And I follow "Administration"
And I choose "Plugin administration" in "Extensions"
......@@ -15,4 +16,11 @@ Scenario: Installing framework module
# Make sure we have a matrix config form
And I scroll to the base of id "module.framework"
And I follow "Configuration for module framework"
Then I should see "Name of matrix file"
\ No newline at end of file
Then I should see "Name of matrix file"
# Activate smartevidence in an institution
And I choose "Institutions" in "Institutions"
And I click on "Edit" in "No Institution" row
And I enable the switch "Allow SmartEvidence"
And I press "Submit"
Then I should see "Institution updated successfully."
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment