forked from vfremaux/moodle-block_course_ascendants
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassign_form.php
56 lines (45 loc) · 1.95 KB
/
assign_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
<?php
include $CFG->libdir.'/formslib.php';
class Assign_Form extends moodleform{
var $blockinstance;
function __construct($action, &$theBlock){
$this->blockinstance = $theBlock;
parent::__construct($action);
}
function definition(){
global $COURSE, $DB;
// take local as default
if (empty($this->blockinstance->config->coursescopestartcategory)) $this->blockinstance->config->coursescopestartcategory = $COURSE->category;
$categories = array();
$this->blockinstance->read_category_tree($this->blockinstance->config->coursescopestartcategory, $categories, true);
$courseoptions = array();
if ($categories){
foreach($categories as $cat){
if (!empty($cat->courses)){
foreach($cat->courses as $c){
$courseoptions[$cat->name][$c->id] = $c->fullname;
}
}
}
}
$mform = $this->_form;
$mform->addElement('hidden', 'course', $COURSE->id);
$mform->addElement('hidden', 'id', $this->blockinstance->instance->id);
foreach($courseoptions as $cc => $cs){
$mform->addElement('header', 'h'.$cc, format_string($cc));
foreach($cs as $cid => $name){
$notifytext = get_string('uncheckadvice', 'block_course_ascendants');
$radioarray = array();
$radioarray[] =& $mform->createElement('radio', 'c'.$cid, '', get_string('open', 'block_course_ascendants'), 1, array('onchange' => "notifyeffect('$notifytext')"));
$radioarray[] =& $mform->createElement('radio', 'c'.$cid, '', get_string('close', 'block_course_ascendants'), 0, array('onchange' => "notifyeffect('$notifytext')"));
$mform->addGroup($radioarray, 'radioar', format_string($name), array(' '), false);
}
}
$mform->addElement('header', 'options', get_string('options', 'block_course_ascendants'));
$pushnewgroupsstr = get_string('pushnewgroups', 'block_course_ascendants');
$mform->addElement('checkbox', 'pushnewgroups', $pushnewgroupsstr);
$this->add_action_buttons(true);
}
function validation($data){
}
}