Example #1
0
function prDomy_Menu($spojeni)
{
    $iddum = $_SESSION["iddum"];
    $nahoru = $_POST["nahoru_x"];
    $dolu = $_POST["dolu_x"];
    $prejmenovat = $_POST["prejmenovat_x"];
    $novy = $_POST["novy_x"];
    $smazat = $_POST["smazat_x"];
    $id = $_POST["idmenu"];
    $novynazev = $_POST["nazev" . $id];
    $typ = $_POST["typ"];
    if ($novy) {
        $nazevn = $_POST["nazevn"];
        $poradi = $_POST["poradi"];
        $sql = "INSERT INTO domy_Menu (id_dum,nazev,poradi,typ) VALUES ({$iddum},'{$nazevn}',{$poradi},'{$typ}')";
        $res = PrSql($spojeni, $sql);
    }
    if ($prejmenovat) {
        $sql = "UPDATE domy_Menu SET nazev='{$novynazev}' where id_domy_Menu={$id}";
        $res = PrSql($spojeni, $sql);
    }
    if ($smazat) {
        $sql = "DELETE from domy_Menu where id_domy_Menu={$id}";
        $res = PrSql($spojeni, $sql);
    }
    if ($nahoru || $dolu) {
        $poradi = $_POST["poradi"];
        if ($nahoru) {
            $sql = "SELECT * from domy_Menu where poradi<{$poradi} and id_dum={$iddum} order by poradi DESC LIMIT 1";
        } else {
            $sql = "SELECT * from domy_Menu where poradi>{$poradi} and id_dum={$iddum} order by poradi ASC LIMIT 1";
        }
        $res = PrSQL($spojeni, $sql);
        $pocet = mysqli_num_rows($res);
        if ($pocet > 0) {
            $zaznam = mysqli_fetch_array($res);
            $idvrchni = $zaznam["id_domy_Menu"];
            $porvrchni = $zaznam["poradi"];
            $sql = "UPDATE domy_Menu SET poradi='{$porvrchni}' where id_domy_Menu={$id}";
            $res = PrSql($spojeni, $sql);
            $sql = "UPDATE domy_Menu SET poradi='{$poradi}' where id_domy_Menu={$idvrchni}";
            $res = PrSql($spojeni, $sql);
        }
    }
    zobrazDomyMenu($spojeni);
}
Example #2
0
 case "prDomy_Menu":
     prDomy_Menu($spojeni);
     break;
 case "prcontent_Menu":
     prContent_Menu($spojeni);
     break;
 case "editcontent_Data":
     editContent_Data($spojeni);
     break;
 case "prData_Domy":
     prData_Domy($spojeni);
     break;
 case "editMenuDomy":
     $iddum = $_GET["iddum"];
     $_SESSION["iddum"] = $iddum;
     zobrazDomyMenu($spojeni);
     break;
 case "editdata_Domy":
     $iddum = $_GET["idm"];
     $_SESSION["iddomy_Menu"] = $iddum;
     editData_Domy($spojeni);
     break;
 case "zobrazLDolniMenu":
     zobrazLDolniMenu($spojeni);
     break;
 case "zobrazcontent_Menu":
     $idm = $_GET["idm"];
     $_SESSION["idhmenu"] = $idm;
     zobrazContent_Menu($spojeni);
     break;
 case "zobrazhlavni_Menu":