Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core_question\local\bank\question_edit_contexts Class Reference

Public Member Functions

 __construct (\context $thiscontext)
 Constructor.
 
 all ()
 Get all the contexts.
 
 have_cap ($cap)
 Has at least one parent context got the cap $cap?
 
 have_one_cap ($caps)
 Has at least one parent context got one of the caps $caps?
 
 have_one_edit_tab_cap ($tabname)
 Has at least one parent context got one of the caps for actions on $tabname.
 
 having_add_and_use ()
 Contexts for adding question and also using it.
 
 having_cap ($cap)
 Get the contexts having cap.
 
 having_one_cap ($caps)
 Get the contexts having at least one cap.
 
 having_one_edit_tab_cap ($tabname)
 Context having at least one cap.
 
 lowest ()
 Get the lowest context.
 
 require_cap ($cap)
 Throw error if at least one parent context hasn't got the cap $cap.
 
 require_one_cap ($caps)
 Throw error if at least one parent context hasn't got one of the caps $caps.
 
 require_one_edit_tab_cap ($tabname)
 Throw error if at least one parent context hasn't got one of the caps $caps.
 

Static Public Attributes

static string[][] $caps
 array of the capabilities.
 

Protected Attributes

array $allcontexts
 of contexts.
 

Constructor & Destructor Documentation

◆ __construct()

core_question\local\bank\question_edit_contexts::__construct ( \context $thiscontext)

Constructor.

Parameters
context$thiscontextthe current context.

Member Function Documentation

◆ all()

core_question\local\bank\question_edit_contexts::all ( )

Get all the contexts.

Return values
context[]all parent contexts

◆ have_cap()

core_question\local\bank\question_edit_contexts::have_cap ( $cap)

Has at least one parent context got the cap $cap?

Parameters
string$capcapability
Return values
boolean

◆ have_one_cap()

core_question\local\bank\question_edit_contexts::have_one_cap ( $caps)

Has at least one parent context got one of the caps $caps?

Parameters
array$capscapability
Return values
boolean

◆ have_one_edit_tab_cap()

core_question\local\bank\question_edit_contexts::have_one_edit_tab_cap ( $tabname)

Has at least one parent context got one of the caps for actions on $tabname.

Parameters
string$tabnameedit tab name
Return values
boolean

◆ having_add_and_use()

core_question\local\bank\question_edit_contexts::having_add_and_use ( )

Contexts for adding question and also using it.

Return values
context[]those contexts where a user can add a question and then use it.

◆ having_cap()

core_question\local\bank\question_edit_contexts::having_cap ( $cap)

Get the contexts having cap.

Parameters
string$capcapability
Return values
context[]parent contexts having capability, zero based index

◆ having_one_cap()

core_question\local\bank\question_edit_contexts::having_one_cap ( $caps)

Get the contexts having at least one cap.

Parameters
array$capscapabilities
Return values
context[]parent contexts having at least one of $caps, zero based index

◆ having_one_edit_tab_cap()

core_question\local\bank\question_edit_contexts::having_one_edit_tab_cap ( $tabname)

Context having at least one cap.

Parameters
string$tabnameedit tab name
Return values
context[]parent contexts having at least one of $caps, zero based index

◆ lowest()

core_question\local\bank\question_edit_contexts::lowest ( )

Get the lowest context.

Return values
contextlowest context which must be either the module or course context

◆ require_cap()

core_question\local\bank\question_edit_contexts::require_cap ( $cap)

Throw error if at least one parent context hasn't got the cap $cap.

Parameters
string$capcapability

◆ require_one_cap()

core_question\local\bank\question_edit_contexts::require_one_cap ( $caps)

Throw error if at least one parent context hasn't got one of the caps $caps.

Parameters
array$capscapabilities

◆ require_one_edit_tab_cap()

core_question\local\bank\question_edit_contexts::require_one_edit_tab_cap ( $tabname)

Throw error if at least one parent context hasn't got one of the caps $caps.

Parameters
string$tabnameedit tab name

Member Data Documentation

◆ $caps

string [][] core_question\local\bank\question_edit_contexts::$caps
static
Initial value:
= [
'editq' => [
'moodle/question:add',
'moodle/question:editmine',
'moodle/question:editall',
'moodle/question:viewmine',
'moodle/question:viewall',
'moodle/question:usemine',
'moodle/question:useall',
'moodle/question:movemine',
'moodle/question:moveall'],
'questions' => [
'moodle/question:add',
'moodle/question:editmine',
'moodle/question:editall',
'moodle/question:viewmine',
'moodle/question:viewall',
'moodle/question:movemine',
'moodle/question:moveall'],
'categories' => [
'moodle/question:managecategory'],
'import' => [
'moodle/question:add'],
'export' => [
'moodle/question:viewall',
'moodle/question:viewmine']]

array of the capabilities.


The documentation for this class was generated from the following file: