function _heartbeat_perms_options in Heartbeat 7
Same name and namespace in other branches
- 6.4 heartbeat.module \_heartbeat_perms_options()
Helper function to get the options for perm types
Parameters
boolean $profile indicator for personal or profile labels:
Return value
array of perm types
3 calls to _heartbeat_perms_options()
- ctools_export_ui_heartbeat_template::_edit_form in modules/
heartbeat_ui/ plugins/ export_ui/ ctools_export_ui_heartbeat_template.class.php - Helper function with element for the settings editing form.
- heartbeat_user_templates in ./
heartbeat.module - Add the heartbeat template field to the user edit form.
- _theme_user_message_select_form in ./
heartbeat.module - Helper theme function for the activity selection in the user profile form
File
- ./
heartbeat.module, line 1733 - Module file for heartbeat activity. Basic hook implementations and helper functions will be found here.
Code
function _heartbeat_perms_options($profile = FALSE, $max_perm = HEARTBEAT_PUBLIC_TO_ALL) {
$permissions = array();
if ($profile) {
$perms = array(
HEARTBEAT_NONE => 'Never',
HEARTBEAT_PRIVATE => t('Only me'),
HEARTBEAT_PUBLIC_TO_CONNECTED => t('Only my friends'),
HEARTBEAT_PUBLIC_TO_ALL => t('Everyone'),
);
}
else {
$perms = array(
HEARTBEAT_PRIVATE => t('Only the user himself is allowed to see this message'),
HEARTBEAT_PUBLIC_TO_ADDRESSEE => t('Only the user himself and the addressee are allowed to see this message'),
HEARTBEAT_PUBLIC_TO_CONNECTED => t('Only user and relations are allowed to see this message'),
HEARTBEAT_PUBLIC_TO_ALL => t('Everyone can see this message'),
);
}
foreach ($perms as $access => $desc) {
if ($access <= $max_perm) {
$permissions[$access] = $desc;
}
}
return $permissions;
}