-
Notifications
You must be signed in to change notification settings - Fork 3
/
block_rgrade.php
72 lines (51 loc) · 1.82 KB
/
block_rgrade.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
<?php
require_once('rgrade_lib.php');
class block_rgrade extends block_base {
function init() {
$this->title = rgrade_get_string('rgrade');
}
function instance_allow_multiple() {
return false;
}
function has_config() {
return false;
}
public function get_content() {
global $CFG, $COURSE, $USER;
if ($this->content !== null) {
return $this->content;
}
$this->content = new stdClass;
$this->content->text = '';
$this->content->footer = '';
$books = rgrade_get_all_books($COURSE->id);
if (empty($books)){
return $this->content;
}
$text = "<form id='marsupialReport' method='get' action='".$CFG->wwwroot."/blocks/rgrade/rgrade_table.php'>";
$text .= "<fieldset>";
$text .= "<input type='hidden' name='courseid' value='{$COURSE->id}'/>";
$text .="<label for='fbook'><span>".rgrade_get_string('book')."</span><br/>";
$text .="<select name='bookid' id='fbook' class='fbook' style='width:100%;'>";
foreach($books as $book){
$text .= "<option value='".$book->id."'>".$book->name."</option>";
}
$text .="</select></label>";
if (rgrade_check_capability("moodle/grade:viewall")) {
$groups = groups_get_all_groups($COURSE->id);
if(!empty($groups)) {
$text .="<br/><label for='fgroup'><span>".rgrade_get_string('group')."</span><br/>";
$text .="<select name='groupid' id='fgroup' class='fgroup' style='width:100%;'>";
$text .= "<option value=''> -- ".rgrade_get_string('all_groups')." -- </option>";
foreach($groups as $group){
$text .= "<option value='".$group->id."'>".$group->name."</option>";
}
$text .="</select></label>";
}
}
$text .= "<input type='submit' class='button' name='mdl_action' value='".rgrade_get_string('go')."'/>";
$text .= "</fieldset></form>";
$this->content->text = $text;
return $this->content;
}
}