Пример #1
0
 /**
  * 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);
     // course contexts are different -- we rely on the cache because curricula
     // require special logic
     coursepage::get_contexts($capability);
     $cached = coursepage::check_cached($capability, $id);
     if ($cached !== null) {
         return $cached;
     }
     $context = get_context_instance(context_level_base::get_custom_context_level('course', 'block_curr_admin'), $id);
     return has_capability($capability, $context);
 }
Пример #2
0
 /**
  * Check if the user has the given capability for the requested curriculum
  */
 public 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);
     }
     // course contexts are different -- we rely on the cache because curricula
     // require special logic
     coursepage::get_contexts($capability);
     $cached = coursepage::check_cached($capability, $id);
     if ($cached !== null) {
         return $cached;
     }
     return has_capability($capability, $this->context);
 }