$__midcom_class_name__
$__midcom_class_name__ : string
MidCOM classname
MidCOM level replacement for the Midgard SnippetDir record with framework support.
The uplink is the owning snippetdir.
$__metadata : \midcom_helper_metadata
Metadata object
new_query_builder() : \midcom_core_querybuilder
Shortcut for accessing MidCOM Query Builder
The initialized instance of the query builder.
new_collector(string $domain = null, mixed $value = null) : \midcom_core_collector
Shortcut for accessing MidCOM Collector
string | $domain | The domain property of the collector instance |
mixed | $value | Value match for the collector instance |
The initialized instance of the collector.
get_metadata() : \midcom_helper_metadata
get_parameter(string $domain, string $name) : string
Return a parameter from the database.
No event handlers are called here yet.
string | $domain | The parameter domain. |
string | $name | The parameter name. |
The parameter value or false otherwise (remember typesafe comparisons to protect against '' strings).
list_parameters(string $domain = null) : array
List the parameters of an object. This will either list the parameters of a single domain or the complete set of parameters, depending on the value of $domain.
It delegates the actual execution to two separate helper functions.
No event handlers are called here yet.
In case of a complete query, the result will be an associative array indexed by the domain name and containing another array with parameter name/value pairs. For example:
Array ( [Asgard] => Array ( [lang] => en_US [act] => view [actloc] => tree ) [AsgardTreeHost] => Array ( [selected] => host0 ) )
If you query only a single domain, the result will be a single associative array containing the parameter name/value pairs. For example:
Array ( [lang] => en_US [act] => view [actloc] => tree )
In both cases an empty Array will indicate that no parameter was found, while false will indicate a failure while querying the database.
string | $domain | The parameter domain to query, this may be null to indicate a full listing. |
Parameter list (see above for details) or false on failure.
set_parameter(string $domain, string $name, string $value) : boolean
Set a parameter to the value specified.
This is either a create or an update operation depending on whether there was already a parameter of that domain/name present, or not.
The user needs both update and parameter manipulation permission on the parent object for updates.
string | $domain | The Parameter Domain. |
string | $name | The Parameter name. |
string | $value | The Parameter value. If this is empty, the corresponding parameter is deleted. |
Indicating success.
delete_parameter(string $domain, string $name) : boolean
Delete a parameter.
Current implementation note: Deletion is not yet implemented in MgdSchema. Therefore we set the parameters to an empty string for now, which should have almost the same effect for most cases and thus is good enough for now. Note, that empty string parameters are filtered in the getter methods until this matter is resolved.
The user needs both update and parameter manipulation permission on the parent object for updates.
string | $domain | The Parameter Domain. |
string | $name | The Parameter name. |
Indicating success.
get_attachment(string $name) : \midcom_db_attachment
Retrieves an attachment by its name.
If multiple attachments match the name (should not happen in reality), the first match will be returned.
string | $name | The name of the attachment to look up. |
The attachment found, or false on failure.
create_attachment(string $name, string $title, string $mimetype) : \midcom_db_attachment
Creates a new attachment at the current object and returns it for usage.
string | $name | The name of the attachment. |
string | $title | The title of the attachment. |
string | $mimetype | The MIME-Type of the attachment. |
The created attachment or false on failure.
get_attachment_qb() : \midcom_core_querybuilder
Returns a prepared query builder that is already limited to the attachments of the given object.
The initialized instance of the query builder or false on failure.
list_attachments() : array<mixed,\midcom_db_attachment>
Returns a complete list of attachments for the current object. If there are no attachments, an empty array is returned.
A list of attachments
get_privileges() : array<mixed,\midcom_core_privilege>
Read all privilege records and return them accordingly.
You need privilege access to get this information (midgard:read (tested during construction) and midgard:privileges) otherwise, the call will fail.
A list of privilege objects or false on failure.
set_privilege(mixed $privilege, mixed $assignee = null, integer $value = MIDCOM_PRIVILEGE_ALLOW, string $classname = '') : boolean
Set a privilege on an object.
This requires both midgard:update and midgard:privileges.
You can either pass a ready made privilege record or a privilege/assignee/value combination suitable for usage with create_new_privilege_object() (see there).
mixed | $privilege | Either the full privilege object (midcom_core_privilege) to set or the name of the privilege (string). If the name was specified, the other parameters must be specified as well. |
mixed | $assignee | A valid assignee suitable for midcom_core_privilege::set_privilege(). This defaults to the currently active user if authenticated or to 'EVERYONE' otherwise (invalid if $privilege is a midcom_core_privilege). |
integer | $value | The privilege value, this defaults to MIDCOM_PRIVILEGE_ALLOW (invalid if $privilege is a midcom_core_privilege). |
string | $classname | An optional class name to which a SELF privilege gets restricted to. Only valid for SELF privileges (invalid if $privilege is a midcom_core_privilege). |
Indicating success.
unset_privilege(mixed $privilege, mixed $assignee = null, string $classname = '') : boolean
Unset a privilege on an object (e.g. set it to INHERIT).
mixed | $privilege | Either the full privilege object (midcom_core_privilege) to set or the name of the privilege (string). If the name was specified, the other parameters must be specified as well. |
mixed | $assignee | A valid assignee suitable for midcom_core_privilege::set_privilege(). This defaults to the currently active user if authenticated or to 'EVERYONE' otherwise (invalid if $privilege is a midcom_core_privilege). |
string | $classname | An optional class name to which a SELF privilege gets restricted to. Only valid for SELF privileges (invalid if $privilege is a midcom_core_privilege). |
Indicating Success.
get_privilege(string $privilege, mixed $assignee, string $classname = '') : \midcom_core_privilege
Looks up a privilege by its parameters.
string | $privilege | The name of the privilege. |
mixed | $assignee | Either a valid magic assignee (SELF, EVERYONE, USERS, ANONYMOUS), a midcom_core_user or a midcom_core_group object or subtype thereof. |
string | $classname | An optional class name to which a SELF privilege is restricted to. |
The privilege record from the database.
create_new_privilege_object(string $name, mixed $assignee = null, integer $value = MIDCOM_PRIVILEGE_ALLOW, string $classname = '') : \midcom_core_privilege
Create a new privilege object. The privilege will be initialized with the values given in the arguments, as outlined below.
This call requires the midgard:privileges privilege.
string | $name | The name of the privilege to add. |
mixed | $assignee | A valid assignee suitable for midcom_core_privilege::set_privilege(). This defaults to the currently active user if authenticated or to 'EVERYONE' otherwise. |
integer | $value | The privilege value, this defaults to MIDCOM_PRIVILEGE_ALLOW. |
string | $classname | An optional class name to which a SELF privilege gets restricted to. Only valid for SELF privileges. |
The newly created privilege record or false on failure.