Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions block_grade_me.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ public function init() {
public function get_content() {
global $CFG, $USER, $COURSE, $DB, $OUTPUT, $PAGE;

$context = context_course::instance($this->page->course->id);
$isteacher = has_capability('block/grade_me:viewblock', $context);

if(!$isteacher) {
return $this->content;
}

if ($this->content !== null) {
return $this->content;
}
Expand Down
12 changes: 12 additions & 0 deletions db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,17 @@
),

'clonepermissionsfrom' => 'moodle/site:manageblocks'
),

'block/grade_me:viewblock' => array(
'riskbitmask' => RISK_SPAM | RISK_XSS,

'captype' => 'read',
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => array(
'user' => CAP_ALLOW
),

'clonepermissionsfrom' => 'moodle/block:view'
)
);
1 change: 1 addition & 0 deletions lang/en/block_grade_me.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

$string['grade_me:addinstance'] = 'Add a new Grade Me block';
$string['grade_me:myaddinstance'] = 'Add a new Grade Me block to the My Moodle page';
$string['grade_me:viewblock'] = 'View block';
$string['expand'] = 'Collapse / Expand All';

$string['grade_me_tools'] = 'Tools';
Expand Down
1 change: 1 addition & 0 deletions lang/es/block_grade_me.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@
$string['settings_configenablepre'] = '¿Debería el bloque Califícame mostrar actividades sin evaluar del módulo "{$a->plugin_name}" ?';
$string['grade_me:addinstance'] = 'Añadir un nuevo bloque Califícame';
$string['grade_me:myaddinstance'] = 'Añadir un nuevo bloque Califícame a mi página personal';
$string['grade_me:viewblock'] = 'Ver bloque';