This repository has been archived by the owner on Jun 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
turnitin_form.php
93 lines (75 loc) · 4.76 KB
/
turnitin_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?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/>.
require_once($CFG->dirroot.'/lib/formslib.php');
class turnitin_setup_form extends moodleform {
/// Define the form
public function definition () {
global $CFG;
$mform =& $this->_form;
$choices = array('No', 'Yes');
$mform->addElement('html', get_string('tiiexplain', 'plagiarism_turnitin'));
$mform->addElement('checkbox', 'turnitin_use', get_string('useturnitin', 'plagiarism_turnitin'));
$mform->addElement('text', 'turnitin_api', get_string('tiiapi', 'plagiarism_turnitin'));
$mform->addHelpButton('turnitin_api', 'tiiapi', 'plagiarism_turnitin');
$mform->addRule('turnitin_api', null, 'required', null, 'client');
$mform->setDefault('turnitin_api', 'https://api.turnitin.com/api.asp');
$mform->setType('turnitin_api', PARAM_URL);
$mform->addElement('text', 'turnitin_accountid', get_string('tiiaccountid', 'plagiarism_turnitin'));
$mform->addHelpButton('turnitin_accountid', 'tiiaccountid', 'plagiarism_turnitin');
$mform->addRule('turnitin_accountid', null, 'numeric', null, 'client');
$mform->setType('turnitin_accountid', PARAM_ALPHANUMEXT);
$mform->addElement('passwordunmask', 'turnitin_secretkey', get_string('tiisecretkey', 'plagiarism_turnitin'));
$mform->addHelpButton('turnitin_secretkey', 'tiisecretkey', 'plagiarism_turnitin');
$mform->addRule('turnitin_secretkey', null, 'required', null, 'client');
$mform->setType('turnitin_secretkey', PARAM_TEXT);
$mform->addElement('checkbox', 'turnitin_enablegrademark', get_string('tiienablegrademark', 'plagiarism_turnitin'));
$mform->addHelpButton('turnitin_enablegrademark', 'tiienablegrademark', 'plagiarism_turnitin');
$mform->addElement('checkbox', 'turnitin_institutionnode', get_string('turnitin_institutionnode', 'plagiarism_turnitin'));
$mform->addHelpButton('turnitin_institutionnode', 'turnitin_institutionnode', 'plagiarism_turnitin');
$mform->addElement('checkbox', 'turnitin_senduseremail', get_string('tiisenduseremail', 'plagiarism_turnitin'));
$mform->addHelpButton('turnitin_senduseremail', 'tiisenduseremail', 'plagiarism_turnitin');
$mform->addElement('text', 'turnitin_attemptcodes', get_string('turnitin_attemptcodes', 'plagiarism_turnitin'));
$mform->addHelpButton('turnitin_attemptcodes', 'turnitin_attemptcodes', 'plagiarism_turnitin');
$mform->setDefault('turnitin_attemptcodes', '1009,1013,1023');
$mform->setType('turnitin_attemptcodes', PARAM_SEQUENCE);
$mform->addElement('text', 'turnitin_attempts', get_string('turnitin_attempts', 'plagiarism_turnitin'));
$mform->addHelpButton('turnitin_attempts', 'turnitin_attempts', 'plagiarism_turnitin');
$mform->addRule('turnitin_attempts', null, 'numeric', null, 'client');
$mform->addRule('turnitin_attempts', null, 'maxlength', 1, 'client');
$mform->setDefault('turnitin_attempts', '1');
$mform->setType('turnitin_attempts', PARAM_INT);
$mform->addElement('textarea', 'turnitin_student_disclosure', get_string('studentdisclosure', 'plagiarism_turnitin'), 'wrap="virtual" rows="6" cols="50"');
$mform->addHelpButton('turnitin_student_disclosure', 'studentdisclosure', 'plagiarism_turnitin');
$mform->setDefault('turnitin_student_disclosure', get_string('studentdisclosuredefault', 'plagiarism_turnitin'));
$mform->setType('turnitin_student_disclosure', PARAM_CLEANHTML);
$mods = get_plugin_list('mod');
foreach ($mods as $mod => $modname) {
if (plugin_supports('mod', $mod, FEATURE_PLAGIARISM)) {
$modstring = 'turnitin_enable_mod_' . $mod;
$mform->addElement('checkbox', $modstring, get_string('turnitin_enableplugin', 'plagiarism_turnitin', $mod));
}
}
$this->add_action_buttons(true);
}
}
class turnitin_defaults_form extends moodleform {
/// Define the form
public function definition () {
$mform =& $this->_form;
turnitin_get_form_elements($mform);
$this->add_action_buttons(true);
}
}