$gui_newName4 = $name . "_gui_digitize";
 //check if new gui names are already taken
 while ($gui->guiExists($gui_newName1)) {
     $gui_newName1 .= "_1";
 }
 while ($gui->guiExists($gui_newName2)) {
     $gui_newName2 .= "_1";
 }
 while ($gui->guiExists($gui_newName3)) {
     $gui_newName3 .= "_1";
 }
 while ($gui->guiExists($gui_newName4)) {
     $gui_newName4 .= "_1";
 }
 //create gui_(name) and gui1_(name)
 $gui->copyGui($gui_id1[0], $gui_newName1, true);
 $gui->copyGui($gui_id2[0], $gui_newName2, true);
 $gui->copyGui($gui_id3[0], $gui_newName3, true);
 $gui->copyGui($gui_id4[0], $gui_newName4, true);
 $new_guiId1 = $admin->getGuiIdByGuiName($gui_newName1);
 $new_guiId2 = $admin->getGuiIdByGuiName($gui_newName2);
 $new_guiId3 = $admin->getGuiIdByGuiName($gui_newName3);
 $new_guiId4 = $admin->getGuiIdByGuiName($gui_newName4);
 //grant owner rights for new guis to this user only!
 $admin->delAllUsersOfGui($new_guiId1[0]);
 $admin->delAllUsersOfGui($new_guiId2[0]);
 $admin->delAllUsersOfGui($new_guiId3[0]);
 $admin->delAllUsersOfGui($new_guiId4[0]);
 $admin->insertUserAsGuiOwner($new_guiId1[0], $selected_user);
 $admin->insertUserAsGuiOwner($new_guiId2[0], $selected_user);
 $admin->insertUserAsGuiOwner($new_guiId3[0], $selected_user);
			}
		}
	}
}
</script>
</head>
<body>
<?php 
require_once dirname(__FILE__) . "/../classes/class_administration.php";
require_once dirname(__FILE__) . "/../classes/class_gui.php";
###rename
if ($rename || $copy) {
    $gui = new gui();
    if ($copy) {
        if ($_POST['withU'] == 'true') {
            $gui->copyGui($guiList, $newGuiName, true);
        } else {
            $gui->copyGui($guiList, $newGuiName, false);
        }
    } elseif ($rename) {
        $gui->renameGui($guiList, $newGuiName);
    }
    $rename = 0;
    $copy = 0;
}
###
$admin = new administration();
$ownguis = $admin->getGuisByOwner(Mapbender::session()->get("mb_user_id"), true);
echo "<form name='form1' action='" . $self . "' method='post'>";
if (count($ownguis) > 0) {
    $sql = "SELECT * FROM gui WHERE gui_id IN (";