Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

(no description)

File Size: 222 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

question_edit_contexts:: (13 methods):
  __construct()
  all()
  lowest()
  having_cap()
  having_one_cap()
  having_one_edit_tab_cap()
  having_add_and_use()
  have_cap()
  have_one_cap()
  have_one_edit_tab_cap()
  require_cap()
  require_one_cap()
  require_one_edit_tab_cap()


Class: question_edit_contexts  - X-Ref

Tracks all the contexts related to the one we are currently editing questions and provides helper methods to check permissions.

__construct(\context $thiscontext)   X-Ref
Constructor

param: \context $thiscontext the current context.

all()   X-Ref
Get all the contexts.

return: \context[] all parent contexts

lowest()   X-Ref
Get the lowest context.

return: \context lowest context which must be either the module or course context

having_cap($cap)   X-Ref
Get the contexts having cap.

param: string $cap capability
return: \context[] parent contexts having capability, zero based index

having_one_cap($caps)   X-Ref
Get the contexts having at least one cap.

param: array $caps capabilities
return: \context[] parent contexts having at least one of $caps, zero based index

having_one_edit_tab_cap($tabname)   X-Ref
Context having at least one cap.

param: string $tabname edit tab name
return: \context[] parent contexts having at least one of $caps, zero based index

having_add_and_use()   X-Ref
Contexts for adding question and also using it.

return: \context[] those contexts where a user can add a question and then use it.

have_cap($cap)   X-Ref
Has at least one parent context got the cap $cap?

param: string $cap capability
return: boolean

have_one_cap($caps)   X-Ref
Has at least one parent context got one of the caps $caps?

param: array $caps capability
return: boolean

have_one_edit_tab_cap($tabname)   X-Ref
Has at least one parent context got one of the caps for actions on $tabname

param: string $tabname edit tab name
return: boolean

require_cap($cap)   X-Ref
Throw error if at least one parent context hasn't got the cap $cap

param: string $cap capability

require_one_cap($caps)   X-Ref
Throw error if at least one parent context hasn't got one of the caps $caps

param: array $caps capabilities

require_one_edit_tab_cap($tabname)   X-Ref
Throw error if at least one parent context hasn't got one of the caps $caps

param: string $tabname edit tab name