forked from blindsidenetworks-ps/moodle-mod_bigbluebuttonbn
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod_form.php
More file actions
126 lines (91 loc) · 5.78 KB
/
Copy pathmod_form.php
File metadata and controls
126 lines (91 loc) · 5.78 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
/**
* Config all BigBlueButtonBN instances in this course.
*
* Authors:
* Fred Dixon (ffdixon [at] blindsidenetworks [dt] com)
* Jesus Federico (jesus [at] blindsidenetworks [dt] com)
*
* @package mod_bigbluebuttonbn
* @copyright 2010-2012 Blindside Networks
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once(dirname(__FILE__).'/locallib.php');
require_once($CFG->dirroot.'/course/moodleform_mod.php');
class mod_bigbluebuttonbn_mod_form extends moodleform_mod {
function definition() {
global $CFG, $PAGE;
//Validates if the BigBlueButton server is running
//BigBlueButton server data
$url = trim(trim($CFG->BigBlueButtonBNServerURL),'/').'/';
$salt = trim($CFG->BigBlueButtonBNSecuritySalt);
$serverVersion = bigbluebuttonbn_getServerVersion($url);
if ( !isset($serverVersion) ) {
print_error( 'general_error_unable_connect', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
}
$mform =& $this->_form;
$current_activity =& $this->current;
$mform->addElement('header', 'general', get_string('mod_form_block_general', 'bigbluebuttonbn'));
$mform->addElement('text', 'name', get_string('mod_form_field_name','bigbluebuttonbn'), 'maxlength="64" size="32"' );
$mform->addRule( 'name', null, 'required', null, 'client' );
$mform->addElement('textarea', 'welcome', get_string('mod_form_field_welcome','bigbluebuttonbn'), 'wrap="virtual" rows="5" cols="60"');
$mform->addHelpButton('welcome', 'mod_form_field_welcome', 'bigbluebuttonbn');
//$mform->addElement('text', 'voicebridge', get_string('mod_form_field_voicebridge','bigbluebuttonbn'), 'maxlength="5" size="10"' );
//$mform->setDefault( 'voicebridge', 0 );
//$mform->addHelpButton('voicebridge', 'mod_form_field_voicebridge', 'bigbluebuttonbn');
$mform->addElement( 'checkbox', 'newwindow', get_string('mod_form_field_newwindow', 'bigbluebuttonbn') );
$mform->setDefault( 'newwindow', 0 );
$mform->addElement( 'checkbox', 'wait', get_string('mod_form_field_wait', 'bigbluebuttonbn') );
$mform->setDefault( 'wait', 1 );
//-------------------------------------------------------------------------------
// Second block starts here
//-------------------------------------------------------------------------------
//if ( $current_activity->section > 0 ) { //This is not a general activity, it is part of a week, so it can have schedule
$mform->addElement('header', 'general', get_string('mod_form_block_schedule', 'bigbluebuttonbn'));
$mform->addElement('date_time_selector', 'timeavailable', get_string('mod_form_field_availabledate', 'bigbluebuttonbn'), array('optional'=>true));
$mform->setDefault('timeavailable', time());
$mform->addElement('date_time_selector', 'timedue', get_string('mod_form_field_duedate', 'bigbluebuttonbn'), array('optional' => true));
$mform->setDefault('timedue', time()+3600);
//}
//-------------------------------------------------------------------------------
// Second block ends here
//-------------------------------------------------------------------------------
//-------------------------------------------------------------------------------
// Third block starts here
//-------------------------------------------------------------------------------
if ( floatval($serverVersion) >= 0.8 ) {
$mform->addElement('header', 'general', get_string('mod_form_block_record', 'bigbluebuttonbn'));
$mform->addElement( 'checkbox', 'record', get_string('mod_form_field_record', 'bigbluebuttonbn') );
$mform->setDefault( 'record', 0 );
$mform->addElement('text', 'description', get_string('mod_form_field_description','bigbluebuttonbn'), 'maxlength="100" size="32"' );
$mform->addElement('duration', 'timeduration', get_string('mod_form_field_duration', 'bigbluebuttonbn')); //Set zero for unlimited
$mform->setDefault('timeduration', 14400);
$mform->addHelpButton('timeduration', 'mod_form_field_duration', 'bigbluebuttonbn');
}
//-------------------------------------------------------------------------------
// Third block ends here
//-------------------------------------------------------------------------------
//-------------------------------------------------------------------------------
// add standard elements, common to all modules
$this->standard_coursemodule_elements();
//$this->standard_hidden_coursemodule_elements();
//-------------------------------------------------------------------------------
// add standard buttons, common to all modules
$this->add_action_buttons();
// Take off the option [visible groups]
$PAGE->requires->js_init_call('M.mod_bigbluebuttonbn.modform_Editting');
}
public function validation($data, $files) {
$current_activity =& $this->current;
$errors = parent::validation($data, $files);
//if ( $current_activity->section > 0 ) { //This is not a general activity, it is part of a week, so it can have schedule
// Check open and close times are consistent.
if ($data['timeavailable'] != 0 && $data['timedue'] != 0 && $data['timedue'] < $data['timeavailable']) {
$errors['timedue'] = get_string('bbbduetimeoverstartingtime', 'bigbluebuttonbn');
}
//}
return $errors;
}
}
?>