-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the ues_meta_viewer wiki!
The UES Meta Viewer allows users to query UES meta data from meta tables.
Should your plugin add data with meta information, you can add that information without having to patch this codebase.
Your plugin must handle the ues_meta_supported_types
event, and directly add your support instance. The meta viewer only needs to know the names of the support type and its default fields to query against.
Note: The meta view will find the meta fields so do not include those.
class employee_support_meta implements supported_meta {
public function name() {
return get_string('employee', 'block_custom');
}
public function defaults() {
return array('id', 'name', 'department');
}
}
function event_handler($support) {
$support->types[] = new employee_support_meta();
return true;
}
Even though users may share the ability to see meta viewer, a plugin may want to restrict or add new fields to query against. Plugins can achieve this by handling {type}_data_ui_keys
, where type
is the name of the supported meta data class.
// Filter the sport fields from non athletic employees
function ues_user_data_ui_keys($viewer) {
if (!ues_employee::is_athletic_director($viewer->user)) {
$not_sport = function ($key) { return !$key == 'user_sport'; };
$viewer->keys = array_filter($viewer->keys, $not_sport);
}
return true;
}
Sometimes the data storing in the meta tables is not helpful for users. Plugins can format output by handling {type}_data_ui_element
where type
is the name of supported meta class.
The CPS has an example of this already.
-
events/ues_meta_viewer.php
- shows the event handler -
events/lib.php
- shows the actual extenstion
The ui element is used for sql building too. You should refer to the meta_data_ui_element
base class for more intimate details about what's available to the developer.
-
ues_meta_supported_types
- to add supported types to query against -
{type}_data_ui_keys
- to customize visibility for certain fields -
{type}_data_ui_element
- add specific formatting or sql to the elements