/** * Check if the user has the given capability for the requested curriculum */ function _has_capability($capability, $id = null) { if (empty($id)) { $id = isset($this) && method_exists($this, 'required_param') ? $this->required_param('id', PARAM_INT) : required_param('id', PARAM_INT); } $cached = curriculumpage::check_cached($capability, $id); if ($cached !== null) { return $cached; } $context = \local_elisprogram\context\program::instance($id); return has_capability($capability, $context); }
/** * Check if the user has the given capability for the requested curriculum */ function _has_capability($capability, $id = null) { $id = $id ? $id : $this->required_param('id', PARAM_INT); $cached = curriculumpage::check_cached($capability, $id); if ($cached !== null) { return $cached; } $context = get_context_instance(context_level_base::get_custom_context_level('curriculum', 'block_curr_admin'), $id); return has_capability($capability, $context); }