Skip to content

Commit 6168d77

Browse files
committed
Interactive assignment edit form
1 parent 53d861a commit 6168d77

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

edit_form.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ protected function specific_definition($mform) {
3939
$mform->addElement('header', 'config_vmchecker_header', get_string('header', 'block_vmchecker'));
4040
$mform->setExpanded('config_vmchecker_header');
4141

42+
$mform->addElement('select', 'config_assignment_type', get_string('assignment_type', 'block_vmchecker'), [
43+
'standard' => get_string('assignment_type_standard', 'block_vmchecker'),
44+
'interactive' => get_string('assignment_type_interactive', 'block_vmchecker'),
45+
]);
46+
4247
$mform->addElement(
4348
'select',
4449
'config_autograding',
@@ -53,17 +58,21 @@ protected function specific_definition($mform) {
5358
$mform->settype('config_autograding', PARAM_BOOL);
5459

5560
$mform->addElement('text', 'config_gitlab_project_id', get_string('gitlab_project_id', 'block_vmchecker'));
56-
$mform->addRule('config_gitlab_project_id', null, 'required', null, 'client');
5761
$mform->settype('config_gitlab_project_id', PARAM_INT);
62+
$mform->hideIf('config_gitlab_project_id', 'config_assignment_type', 'eq', 'interactive');
5863

5964
$mform->addElement('text', 'config_gitlab_private_token', get_string('gitlab_private_token', 'block_vmchecker'));
60-
$mform->addRule('config_gitlab_private_token', null, 'required', null, 'client');
6165
$mform->settype('config_gitlab_private_token', PARAM_TEXT);
66+
$mform->hideIf('config_gitlab_private_token', 'config_assignment_type', 'eq', 'interactive');
6267

6368
$mform->addElement('text', 'config_gitlab_branch', get_string('gitlab_branch', 'block_vmchecker'));
64-
$mform->addRule('config_gitlab_branch', null, 'required', null, 'client');
6569
$mform->settype('config_gitlab_branch', PARAM_TEXT);
6670
$mform->setDefault('config_gitlab_branch', 'main');
71+
$mform->hideIf('config_gitlab_branch', 'config_assignment_type', 'eq', 'interactive');
72+
73+
$mform->addElement('textarea', 'config_public_key', get_string('assignment_public_key', 'block_vmchecker'), 'rows="10" cols="50" wrap="virtual"');
74+
$mform->setType('config_public_key', PARAM_TEXT);
75+
$mform->hideIf('config_public_key', 'config_assignment_type', 'eq', 'standard');
6776

6877
$courseactivities = get_fast_modinfo($this->page->course->id)->get_cms();
6978
$assignments = array();

lang/en/block_vmchecker.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
$string['vmchecker:submit'] = 'Types of users that can submit through the VMChecker block';
3030
$string['vmchecker:manage'] = 'User roles allowed to manage the assignemnt (teaching assistants)';
3131
$string['header'] = 'VMChecker settings';
32+
$string['assignment_type'] = 'Assignment type';
33+
$string['assignment_type_standard'] = 'Standard';
34+
$string['assignment_type_interactive'] = 'Interactive';
35+
$string['assignment_public_key'] = 'Public key';
3236
$string['gitlab_project_id'] = 'Gitlab repository ID';
3337
$string['gitlab_private_token'] = 'Gitlab private token';
3438
$string['gitlab_branch'] = 'Gitlab branch';

0 commit comments

Comments
 (0)