-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdroodle.admin.inc
More file actions
74 lines (61 loc) · 1.97 KB
/
droodle.admin.inc
File metadata and controls
74 lines (61 loc) · 1.97 KB
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
<?php
/*
* @file Admin Settings for Moodle Webservices
*
*/
function droodle_admin_settings() {
$form = array();
$form['droodle_test'] = array(
'#type' => 'fieldset',
'#title' => t('Test Droodle'),
);
$form['droodle_test']['test'] = array(
'#type' => 'submit',
'#value' => t('Test the connection to Moodle.'),
'#submit' => array('droodle_test_submit'),
);
$form['droodle_token'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('droodle_token', ''),
'#description' => 'Please Enter your Moodle token.',
'#title' => 'Token',
'#required' => TRUE,
);
$form['droodle_fqdn'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('droodle_fqdn', ''),
'#description' => 'Fully qualified domain name. For example, ("https://moodle.com/").',
'#title' => 'FQDN',
'#required' => TRUE,
);
$form['droodle_service_endpoint'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('droodle_service_endpoint', 'webservice/rest/server.php'),
'#description' => 'Please enter the service endpoint. For example, ("webservice/rest/server.php").',
'#title' => 'Service Endpoint',
'#required' => TRUE,
);
$form['droodle_format'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('droodle_format', 'json'),
'#description' => 'Please enter the required response format. Either, ("json" or "xml").',
'#title' => 'Respose Format',
'#required' => TRUE,
);
$form['droodle_authtype'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('droodle_authtype', 'manual'),
'#description' => 'Please enter the Moodle user authentication type.',
'#title' => 'Moodle user auth type',
'#required' => TRUE,
);
return system_settings_form($form);
}
/**
* Submit callback; test moodle connection.
*
* @ingroup forms
*/
function droodle_test_submit($form, &$form_state) {
droodle_test_connection();
}