Ejemplo n.º 1
0
    // if this is a post operation get the input and save it
    if ('POST' === Request::getMethod()) {
        echo $xoops->alert('success', 'Permission updated');
        // save the data
        $name = $permissionHelper->defaultFieldName($permissionName, $permissionItemId);
        $groups = Request::getVar($name, array(), 'POST');
        $permissionHelper->savePermissionForItem($permissionName, $permissionItemId, $groups);
    }
    // build a form for our permission
    $form = new Xoops\Form\ThemeForm("Permission Form (for the permission named '{$permissionName}')", 'form', '', 'POST');
    $groupElement = $permissionHelper->getGroupSelectFormForItem($permissionName, $permissionItemId, "Groups with '{$permissionName}' permission", null, true);
    $form->addElement($groupElement);
    $form->addElement(new Xoops\Form\Button('', 'submit', 'Save', 'submit'));
    echo $form->render();
    // check it the current user has the permission
    if ($permissionHelper->checkPermission($permissionName, $permissionItemId)) {
        echo "<p>You have the <strong>'{$permissionName}'</strong> permission for the 'codex' module.</p>";
    } else {
        echo "<p>You <em>DO NOT</em> have the <strong>'{$permissionName}'</strong> " . "permission for the 'codex' module.</p>";
    }
}
echo '<h2>Metagen</h2>';
//define a title and article to work with
$keywords = '';
$title = "xmf - the XOOPS Module Framework";
$article = <<<EOT
xmf - XOOPS Module Framework

XMF is Copyright © 2011-2015 The XOOPS Project

This program is free software; you can redistribute it and/or modify
Ejemplo n.º 2
0
    // if this is a post operation get the input and save it
    if ('POST' == Request::getMethod()) {
        echo $xoops->alert('success', 'Permission updated');
        // save the data
        $name = $permHelper->defaultFieldName($gperm_name, $gperm_itemid);
        $groups = Request::getVar($name, array(), $hash = 'POST');
        $permHelper->savePermissionForItem($gperm_name, $gperm_itemid, $groups);
    }
    // build a form for our permission
    $form = new Xoops\Form\ThemeForm("Permission Form (for the premission named '{$gperm_name}')", 'form', '', 'POST');
    $grpElement = $permHelper->getGroupSelectFormForItem($gperm_name, $gperm_itemid, "Groups with '{$gperm_name}' permission", null, true);
    $form->addElement($grpElement);
    $form->addElement(new Xoops\Form\Button('', 'submit', 'Save', 'submit'));
    echo $form->render();
    // check it the current user has the permission
    if ($permHelper->checkPermission($gperm_name, $gperm_itemid)) {
        echo "<p>You have the <strong>'{$gperm_name}'</strong> permission for the 'codex' module.</p>";
    } else {
        echo "<p>You <em>DO NOT</em> have the <strong>'{$gperm_name}'</strong> permission for the 'codex' module.</p>";
    }
}
echo '<h2>Metagen</h2>';
//define a title and article to work with
$keywords = '';
$title = "xmf - the XOOPS Module Framework";
$article = <<<EOT
xmf - XOOPS Module Framework

XMF is Copyright © 2011-2014 The XOOPS Project

This program is free software; you can redistribute it and/or modify