MDL-75335 mod_data: Zero state for Fields and Templates

This commit is contained in:
Amaia Anabitarte
2022-10-25 16:35:58 +02:00
parent 32c8f75c0d
commit ab97d41644
25 changed files with 264 additions and 118 deletions
+13
View File
@@ -301,6 +301,19 @@ class manager {
return new template($this, $templatecontent, $options);
}
/** Check if the user can manage templates on the current context.
*
* @param int $userid the user id to check ($USER->id if null).
* @return bool if the user can manage templates on current context.
*/
public function can_manage_templates(?int $userid = null): bool {
global $USER;
if (!$userid) {
$userid = $USER->id;
}
return has_capability('mod/data:managetemplates', $this->context, $userid);
}
/**
* Update the database templates.
*