コード例 #1
0
ファイル: edit.php プロジェクト: Artea/freebeer
    foreach ($group_list as $groupId => $group) {
        if (!isset($perm_val[$groupId])) {
            $new_groups[$groupId] = $group;
        }
    }
} else {
    /* Do not offer a text box to add new groups. */
    $new_groups = false;
}
/* Set up the matrix array, break up each permission integer into an
 * array. The keys of this array will be the row headers. */
$rows = array();
$matrix = array();
foreach ($perm_val as $g_id => $g_perms) {
    $rows[$g_id] = isset($group_list[$g_id]) ? $group_list[$g_id] : $g_id;
    $matrix[$g_id] = Perms::integerToArray($g_perms);
}
$form->addVariable(_("Group permissions"), 'g', 'matrix', false, false, null, array($cols, $rows, $matrix, $new_groups));
/* Set form title. */
$form->setTitle(Horde::img('perms.gif') . ' ' . sprintf(_("Edit permissions for '%s'"), $perms->getTitle($permission->getName())));
if ($form->validate($vars)) {
    $form->getInfo($vars, $info);
    /* Collapse the array for default/guest/creator. */
    $info['default'] = isset($info['default'][0]) ? $info['default'][0] : null;
    $info['guest'] = isset($info['guest'][0]) ? $info['guest'][0] : null;
    $info['creator'] = isset($info['creator'][0]) ? $info['creator'][0] : null;
    /* Update and save the permissions. */
    $permission->updatePermissions($info);
    $permission->save();
    $notification->push(sprintf(_("Updated '%s'."), $permission->getShortName()), 'horde.success');
    $url = Horde::applicationUrl('admin/perms/edit.php', true);