Ejemplo n.º 1
0
//get favourites from user
$favourites = $owner->get_buddies();
if (!is_array($favourites)) {
    $favourites = array();
}
//save changes
$all = array_merge($groups, $favourites);
if ($mission == "save") {
    //get the right arrays
    $post = $_POST;
    $publish = isset($post["publish"]) ? $post["publish"] : array();
    //unset all rights for users and groups, that are no more a favourit
    $rights->unset_rights_nofavourit($all);
    foreach ($all as $entity) {
        //unset rights to set new rights
        $rights->unset_rights($entity);
        if (isset($post["edit_" . $entity->get_id()]) && $publish == "user") {
            $rights->set_rights_edit($entity);
        } else {
            $set = false;
            //important set at first the evaluate rights and then fill out rights
            if (isset($post["evaluate_" . $entity->get_id()]) && $publish == "user") {
                $rights->set_rights_evaluate($entity);
                $set = true;
            }
            if (isset($post["fillout_" . $entity->get_id()]) && ($publish == "user" || $publish == "public")) {
                $rights->set_rights_fillout($entity);
                $set = true;
            }
            if (!$set) {
                $rights->unset_rights($entity);