function password_policy_view in Password Policy 5
The default view for the password policy module.
1 string reference to 'password_policy_view'
- password_policy_menu in ./
password_policy.module - Implementation of hook_menu().
File
- ./
password_policy.module, line 184
Code
function password_policy_view($pid = NULL) {
// If we have a pid, then display the details for that policy, else
// display all policies.
if ($pid) {
$policy = password_policy_load_policy_by_id($pid);
if (!$policy) {
drupal_goto('admin/user/password_policy');
}
$edit_url = l(t('editing this policy'), 'admin/user/password_policy/edit/' . $pid);
$constraints = $policy->constraints;
$desc = !$constraints ? t('This policy has no constraints set. You can add constraints by ') . $edit_url . '.' : t('This policy has the constraints listed below. You can change the constraints by ') . $edit_url . '.<br />' . $policy
->getValidationErrorMessage();
$output = "<p>{$desc}</p>";
$expiration = $policy->expiration;
$desc = $expiration > 0 ? t('The passwords expire after %number %days.', array(
'%number' => $expiration,
'%days' => format_plural($expiration, t('day'), t('days')),
)) : t('The passwords never expire.');
$output .= "<p>{$desc}</p>";
return $output;
}
// load the summary policies (id->name)
$summaries = _password_policy_load_policy_summaries();
if ($summaries) {
return drupal_get_form('password_policy_view_form', $summaries);
}
return '';
}