-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod_form.php
66 lines (49 loc) · 2.4 KB
/
mod_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
<?php
require_once ($CFG->dirroot.'/course/moodleform_mod.php');
class mod_autoview_mod_form extends moodleform_mod {
function definition() {
global $add, $CFG, $COURSE;
$mform =& $this->_form;
$mform->addElement('text', 'content', get_string("autoviewtext", "autoview"), 'size="47"');
if (!empty($CFG->formatstringstriptags)) {
$mform->setType('content', PARAM_TEXT);
} else {
$mform->setType('content', PARAM_CLEAN);
}
$mform->addRule('content', null, 'required', null, 'client');
$mform->addElement('htmleditor', 'summary', get_string("autoviewsummary", "autoview"), array('size'=>'64'));
$mform->setType('summary', PARAM_RAW);
//$mform->setHelpButton('summary', array('questions', 'richtext'), false, 'editorhelpbutton');
$mform->addElement('checkbox', 'noframe', '', get_string("hidenav", "autoview"));
$mform->setDefault('noframe', false);
if ($add)
{
$mform->addElement('checkbox', 'usedir', '', get_string("usedir", "autoview"));
$mform->setDefault('usedir', true);
$mform->addElement('checkbox', 'createnew', '', get_string("createnew", "autoview"));
$mform->setDefault('createnew', true);
}
$opts=array('courseid'=>$COURSE->id, 'height'=>500, 'width'=>750, 'options'=>'none');
$mform->addElement('text', 'configfile', get_string("chooseconfig", "autoview"), 'size="47"');
$mform->setType('configfile', PARAM_PATH);
if ($add)
{
$mform->disabledIf('configfile', 'createnew', 'checked');
$mform->disabledIf('usedir', 'createnew');
}
$features = array('groups'=>false, 'groupings'=>false, 'groupmembersonly'=>true,
'outcomes'=>false, 'gradecat'=>false, 'idnumber'=>false);
$this->standard_coursemodule_elements($features);
//-------------------------------------------------------------------------------
// buttons
$this->add_action_buttons(true, null, null);
if (!$add)
{
$mform->addElement('html', "\n<br />\n".
"<div style=\"text-align:center;font-weight:bold;\">\n".
"<a href=\"".$CFG->wwwroot."/mod/autoview/view.php?edit=1&id=".$this->_cm->id."\">".get_string("editbutton", "autoview")."</a>\n".
"</div><br />\n");
}
}
}
?>