Example #1
0
        }

        //Object speichern
        if (($changeObject->store()) || ($perms_changed))
            $msg->addMsg(8);
    } else {
        $msg->addMsg(1);
    }
    $_SESSION['resources_data']["view"]="edit_object_perms";
    $view = $_SESSION['resources_data']["view"];
}

//set/unset lockable for a comlete hierarchy
if ((Request::option('set_lockable_recursiv')) || (Request::option('unset_lockable_recursiv'))) {
    if (getGlobalPerms($user->id) == "admin") {
        changeLockableRecursiv(Request::option('lock_resource_id'), (Request::option('set_lockable_recursiv')) ? TRUE : FALSE);
    } else {
        $msg->addMsg(1);
    }
    $_SESSION['resources_data']["view"]="edit_object_perms";
    $view = $_SESSION['resources_data']["view"];
}

//Typen bearbeiten
if ((Request::quoted('add_type')) || (Request::option('delete_type')) || (Request::option('delete_type_property_id')) || (Request::option('change_categories'))) {
    if (getGlobalPerms ($user->id) == "admin") { //check for resources root or global root
        if (Request::option('delete_type')) {
            $query = "DELETE FROM resources_categories WHERE category_id = ?";
            $statement = DBManager::get()->prepare($query);
            $statement->execute(array(
                Request::option('delete_type')
Example #2
0
/**
* changeLockableRecursiv
*
* sets the lockale option for all childs to state
*
* @param    string  the key for the resource object
* @param    boolean if set, all childs will be lockable
*
**/
function changeLockableRecursiv($resource_id, $state)
{
    $query = "UPDATE resources_objects\n              SET lockable = ?\n              WHERE resource_id = ?";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($state, $resource_id));
    $query = "SELECT resource_id\n              FROM resources_objects\n              WHERE parent_id = ?";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($resource_id));
    while ($id = $statement->fetchColumn()) {
        changeLockableRecursiv($id, $state);
    }
}