Example #1
0
function show_perm_select()
{
    global $person;
    if ($person->have_perm(PERM_PERSON_WRITE_ROLES)) {
        $selected = explode(",", $person->get_value("perms"));
        $ops = role::get_roles_array("person");
        foreach ($ops as $p => $l) {
            unset($sel);
            in_array($p, $selected) and $sel = " checked";
            echo $br . "<input type=\"checkbox\" name=\"perm_select[]\" value=\"" . $p . "\"" . $sel . "> " . $l;
            $br = "<br>";
        }
    } else {
        $selected = explode(",", $person->get_value("perms"));
        $ops = role::get_roles_array("person");
        foreach ($selected as $sel) {
            echo $br . $ops[$sel];
            $br = "<br>";
        }
    }
}