CRM_ACL_Page_ACL
extends CRM_Core_Page_Basic
in package
A Page is basically data in a nice pretty format.
Tags
Table of Contents
Properties
- $_permission : string
- The permission we have on this contact
- $ajaxResponse : array<string|int, mixed>
- What to return to the client if in ajax mode (snippet=json)
- $expectedSmartyVariables : array<string|int, string>
- Variables smarty expects to have set.
- $urlPath : array<string|int, mixed>
- Url path used to reach this page
- $useLivePageJS : mixed
- $_action : int
- $_embedded : bool
- Is this object being embedded in another object. If so the display routine needs to not do any work. (The parent object takes care of the display)
- $_id : int
- $_mode : int
- A page can have multiple modes. (i.e. displays a different set of data based on the input
- $_name : string
- The name of the page (auto generated from class name)
- $_print : int|string
- Are we in print mode? if so we need to modify the display functionality to do a minimal display :)
- $_session : CRM_Core_Session
- Cache the session for efficiency reasons
- $_template : CRM_Core_Smarty
- Cache the smarty template for efficiency reasons
- $_title : object
- The title associated with this page.
Methods
- __construct() : CRM_Core_Page_Basic
- Class constructor.
- action() : mixed
- Given an object, get the actions that can be associated with this object. Check the is_active and is_required flags to display valid actions
- addExpectedSmartyVariable() : void
- Add an expected smarty variable to the array.
- addExpectedSmartyVariables() : void
- Add an expected smarty variable to the array.
- addValues() : mixed
- Allows the derived class to add some more state variables to the controller. By default does nothing, and hence is abstract
- append() : mixed
- Appends values to template variables.
- assign() : mixed
- Assign value to name in template.
- assign_by_ref() : mixed
- Assign value to name in template by reference.
- browse() : mixed
- Browse all acls.
- checkPermission() : string
- Allow objects to be added based on permission.
- crmIcon() : string
- Handy helper to produce the standard markup for an icon with alternative text for a title and screen readers.
- edit() : mixed
- Edit an ACL.
- editForm() : string
- Get name of edit form.
- editName() : string
- Get edit form name.
- get() : mixed
- Get the variable from the form scope.
- get_template_vars() : array<string|int, mixed>
- Returns an array containing template variables.
- getBAOName() : string
- Get BAO Name.
- getEmbedded() : bool
- Getter for embedded.
- getHookedTemplateFileName() : mixed
- A wrapper for getTemplateFileName that includes calling the hook to prevent us from having to copy & paste the logic of calling the hook
- getIdAndAction() : int
- Retrieve the action and ID from the request.
- getLinkPath() : string|null
- Get the menu path corresponding to an action on this entity
- getPrint() : int|string
- Getter for print.
- getTemplate() : CRM_Core_Smarty
- getTemplateFileName() : string
- Use the form name to create the tpl file name.
- getTemplateVars() : mixed
- Get the value/s assigned to the Template Engine (Smarty).
- getVar() : null
- invalidKey() : mixed
- links() : array<string|int, array<string|int, mixed>>
- Get array of action links for the "browse" page.
- overrideExtraTemplateFileName() : string
- Default extra tpl file basically just replaces .tpl with .extra.tpl i.e. we dont override
- reset() : mixed
- Destroy all the session state of this page.
- run() : mixed
- Run the page.
- set() : mixed
- Store the variable with the value in the form scope.
- setEmbedded() : mixed
- Setter for embedded.
- setPrint() : void
- Setter for print.
- setVar() : mixed
- superRun() : string
- userContext() : string
- Get user context.
- userContextParams() : string
- Get userContext params.
- assignFieldMetadataToTemplate() : mixed
- Assign metadata about fields to the template.
- getExpectedRowProperties() : array<string|int, mixed>
- Get any properties that should always be present in each row (null if no value).
- getRows() : array<string|int, mixed>
Properties
$_permission
The permission we have on this contact
public
string
$_permission
$ajaxResponse
What to return to the client if in ajax mode (snippet=json)
public
array<string|int, mixed>
$ajaxResponse
= []
$expectedSmartyVariables
Variables smarty expects to have set.
public
array<string|int, string>
$expectedSmartyVariables
= [
'isForm',
'hookContent',
'hookContentPlacement',
// required for footer.tpl
'contactId',
// required for info.tpl
'infoMessage',
'infoTitle',
'infoType',
'infoOptions',
// required for Summary.tpl (contact summary) but seems
// likely to be used more broadly to warrant inclusion here.
'context',
// for CMSPrint.tpl
'urlIsPublic',
'breadcrumb',
'pageTitle',
'isDeleted',
// Required for footer.tpl,
// See ExampleHookTest:testPageOutput.
'footer_status_severity',
// in 'body.tpl
'suppressForm',
'beginHookFormElements',
// This is checked in validate.tpl
'snippet_type',
]
We ensure these are assigned (value = NULL) when Smarty is instantiated in order to avoid e-notices / having to use empty or isset in the template layer.
$urlPath
Url path used to reach this page
public
array<string|int, mixed>
$urlPath
= []
$useLivePageJS
public
mixed
$useLivePageJS
= \TRUE
$_action
protected
int
$_action
$_embedded
Is this object being embedded in another object. If so the display routine needs to not do any work. (The parent object takes care of the display)
protected
bool
$_embedded
= \FALSE
$_id
protected
int
$_id
$_mode
A page can have multiple modes. (i.e. displays a different set of data based on the input
protected
int
$_mode
$_name
The name of the page (auto generated from class name)
protected
string
$_name
$_print
Are we in print mode? if so we need to modify the display functionality to do a minimal display :)
protected
int|string
$_print
= \FALSE
Should match a CRM_Core_Smarty::PRINT_* constant, or equal 0 if not in print mode
$_session
Cache the session for efficiency reasons
protected
static CRM_Core_Session
$_session
$_template
Cache the smarty template for efficiency reasons
protected
static CRM_Core_Smarty
$_template
$_title
The title associated with this page.
protected
object
$_title
Methods
__construct()
Class constructor.
public
__construct([string $title = NULL ][, int $mode = NULL ]) : CRM_Core_Page_Basic
Parameters
- $title : string = NULL
-
Title of the page.
- $mode : int = NULL
-
Mode of the page.
Return values
CRM_Core_Page_Basicaction()
Given an object, get the actions that can be associated with this object. Check the is_active and is_required flags to display valid actions
public
action(CRM_Core_DAO &$object, int $action, array<string|int, mixed> &$values, array<string|int, mixed> &$links, string $permission[, bool $forceAction = FALSE ]) : mixed
Parameters
- $object : CRM_Core_DAO
-
The object being considered.
- $action : int
-
The base set of actions.
- $values : array<string|int, mixed>
-
The array of values that we send to the template.
- $links : array<string|int, mixed>
-
The array of links.
- $permission : string
-
The permission assigned to this object.
- $forceAction : bool = FALSE
addExpectedSmartyVariable()
Add an expected smarty variable to the array.
public
addExpectedSmartyVariable(string $elementName) : void
Parameters
- $elementName : string
addExpectedSmartyVariables()
Add an expected smarty variable to the array.
public
addExpectedSmartyVariables(array<string|int, mixed> $elementNames) : void
Parameters
- $elementNames : array<string|int, mixed>
addValues()
Allows the derived class to add some more state variables to the controller. By default does nothing, and hence is abstract
public
addValues(CRM_Core_Controller $controller) : mixed
Parameters
- $controller : CRM_Core_Controller
-
The controller object.
append()
Appends values to template variables.
public
append(array<string|int, mixed>|string $tpl_var[, mixed $value = NULL ][, bool $merge = FALSE ]) : mixed
Parameters
- $tpl_var : array<string|int, mixed>|string
-
the template variable name(s)
- $value : mixed = NULL
-
The value to append.
- $merge : bool = FALSE
assign()
Assign value to name in template.
public
assign(string $var[, mixed $value = NULL ]) : mixed
Parameters
- $var : string
- $value : mixed = NULL
-
Value of variable.
assign_by_ref()
Assign value to name in template by reference.
public
assign_by_ref(string $var, mixed &$value) : mixed
since 5.72 will be removed around 5.84
Parameters
- $var : string
- $value : mixed
-
(reference) value of variable.
browse()
Browse all acls.
public
browse() : mixed
checkPermission()
Allow objects to be added based on permission.
public
checkPermission(int $id, int $name) : string
Parameters
- $id : int
-
The id of the object.
- $name : int
-
The name or title of the object.
Return values
string —permission value if permission is granted, else null
crmIcon()
Handy helper to produce the standard markup for an icon with alternative text for a title and screen readers.
public
static crmIcon(string $icon[, string $text = NULL ][, bool $condition = TRUE ][, array<string|int, mixed> $attribs = [] ]) : string
See also the smarty block function icon
Parameters
- $icon : string
-
The class name of the icon to display.
- $text : string = NULL
-
The translated text to display.
- $condition : bool = TRUE
-
Whether to display anything at all. This helps simplify code when a checkmark should appear if something is true.
- $attribs : array<string|int, mixed> = []
-
Attributes to set or override on the icon element. Any standard attribute can be unset by setting the value to an empty string.
Return values
string —The whole bit to drop in.
edit()
Edit an ACL.
public
edit(int $mode[, int $id = NULL ][, bool $imageUpload = FALSE ][, bool $pushUserContext = TRUE ]) : mixed
Parameters
- $mode : int
-
What mode for the form ?.
- $id : int = NULL
-
Id of the entity (for update, view operations).
- $imageUpload : bool = FALSE
-
Not used in this case, but extended from CRM_Core_Page_Basic.
- $pushUserContext : bool = TRUE
-
Not used in this case, but extended from CRM_Core_Page_Basic.
editForm()
Get name of edit form.
public
editForm() : string
Return values
string —Classname of edit form.
editName()
Get edit form name.
public
editName() : string
Return values
string —name of this page.
get()
Get the variable from the form scope.
public
get(string $name) : mixed
Parameters
- $name : string
-
name of the variable
get_template_vars()
Returns an array containing template variables.
public
get_template_vars([string $name = NULL ]) : array<string|int, mixed>
since 5.69 will be removed around 5.93. use getTemplateVars.
Parameters
- $name : string = NULL
Return values
array<string|int, mixed>getBAOName()
Get BAO Name.
public
getBAOName() : string
Return values
string —Classname of BAO.
getEmbedded()
Getter for embedded.
public
getEmbedded() : bool
Return values
bool —return the embedded value
getHookedTemplateFileName()
A wrapper for getTemplateFileName that includes calling the hook to prevent us from having to copy & paste the logic of calling the hook
public
getHookedTemplateFileName() : mixed
getIdAndAction()
Retrieve the action and ID from the request.
public
getIdAndAction() : int
Action is assigned to the template while we're at it. This is pulled from
the run()
method above.
Tags
Return values
int —The ID if present, or 0.
getLinkPath()
Get the menu path corresponding to an action on this entity
public
getLinkPath(string $linkAction) : string|null
Parameters
- $linkAction : string
-
e.g. "view"
Return values
string|null —e.g. "civicrm/activity?reset=1&action=view&id=[id]"
getPrint()
Getter for print.
public
getPrint() : int|string
Return values
int|string —Value matching a CRM_Core_Smarty::PRINT_* constant, or 0 if not in print mode
getTemplate()
public
static & getTemplate() : CRM_Core_Smarty
Return values
CRM_Core_SmartygetTemplateFileName()
Use the form name to create the tpl file name.
public
getTemplateFileName() : string
Return values
stringgetTemplateVars()
Get the value/s assigned to the Template Engine (Smarty).
public
getTemplateVars([string|null $name = NULL ]) : mixed
Parameters
- $name : string|null = NULL
getVar()
public
getVar(string $name) : null
Parameters
- $name : string
Return values
nullinvalidKey()
public
invalidKey() : mixed
links()
Get array of action links for the "browse" page.
public
& links() : array<string|int, array<string|int, mixed>>
Transforms from the 'paths' in metadata to the format expected by basic pages.
Return values
array<string|int, array<string|int, mixed>>overrideExtraTemplateFileName()
Default extra tpl file basically just replaces .tpl with .extra.tpl i.e. we dont override
public
overrideExtraTemplateFileName() : string
Return values
stringreset()
Destroy all the session state of this page.
public
reset() : mixed
run()
Run the page.
public
run() : mixed
Set the breadcrumb before beginning the standard page run.
set()
Store the variable with the value in the form scope.
public
set(string|array<string|int, mixed> $name[, mixed $value = NULL ]) : mixed
Parameters
- $name : string|array<string|int, mixed>
-
name of the variable or an assoc array of name/value pairs
- $value : mixed = NULL
-
Value of the variable if string.
setEmbedded()
Setter for embedded.
public
setEmbedded(bool $embedded) : mixed
Parameters
- $embedded : bool
setPrint()
Setter for print.
public
setPrint(int|string $print) : void
Parameters
- $print : int|string
-
Should match a CRM_Core_Smarty::PRINT_* constant, or equal 0 if not in print mode
setVar()
public
setVar(string $name, mixed $value) : mixed
Parameters
- $name : string
- $value : mixed
superRun()
public
superRun() : string
Return values
stringuserContext()
Get user context.
public
userContext([null $mode = NULL ]) : string
Parameters
- $mode : null = NULL
Return values
string —user context.
userContextParams()
Get userContext params.
public
userContextParams([int $mode = NULL ]) : string
Parameters
- $mode : int = NULL
-
Mode that we are in.
Return values
stringassignFieldMetadataToTemplate()
Assign metadata about fields to the template.
protected
assignFieldMetadataToTemplate(string $entity) : mixed
In order to allow the template to format fields we assign information about them to the template.
At this stage only date field metadata is assigned as that is the only use-case in play and we don't want to assign a lot of unneeded data.
Parameters
- $entity : string
-
The entity being queried.
Tags
getExpectedRowProperties()
Get any properties that should always be present in each row (null if no value).
protected
getExpectedRowProperties() : array<string|int, mixed>
Return values
array<string|int, mixed>getRows()
protected
getRows(mixed $sort, mixed $action, array<string|int, mixed> $links) : array<string|int, mixed>
Parameters
- $sort : mixed
- $action : mixed
- $links : array<string|int, mixed>