Subversion-Projekte lars-tiefland.openvz_admin

Revision

Revision 162 | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php
    //$Id: control.php 165 2011-07-10 19:03:44Z lars $
    /**
     *     @package    openvz_admin
     *     @author        Lars Tiefland <ltiefland@gmail.com> 
     **/
    require ( "include/common.php" );
    $smarty->assign( "title", "openVZ Administration" );
    $smarty->assign( "h1", "vServer kontrollieren" );
    $mode = ( isset( $_POST["mode"] ) ) ? $_POST["mode"] : "";
    $act = ( isset( $_POST["action"] ) ) ? $_POST["action"] : "";
    $v_id = ( isset( $_POST["v_id"] ) ) ? $_POST["v_id"] : 0;
    $hn_id = ( isset( $_POST["hn_id"] ) ) ? $_POST["hn_id"] : 1;
    switch ( $mode )
    {
        case "ask":
            switch ( $act )
            {
                case "destroy":
                    $action = "l&ouml;schen";
                    break;
                case "stop":
                    $action = "stoppen";
                    break;
                case "start":
                    $action = "starten";
                    break;
                case "restart":
                    $action = "neu starten";
                    break;
            }
            $hn = HN::getHN( $hn_id );
            $hn_name = $hn["name"];
            $ve = new vServer( $v_id, $hn_id );
            $ve = $ve->toArray();
            $ve_name = $ve["name"];
            $smarty->assign( "action", $action );
            $smarty->assign( "name", ( $v_id ) ? $ve_name : $hn_name );
            $smarty->assign( "id", $v_id );
            $smarty->assign( "hn_id", $hn_id );
            $smarty->assign( "art", ( $v_id ) ? "vServer" : "Hardwarenode" );
            $smarty->assign( "mode", $act );
            $smarty->display( "confirm.tpl" );
            break;
        case "destroy":
        case "start":
        case "stop":
        case "restart":

            $vs = new vServer( $v_id, $hn_id );
            $ret = $vs->control( $mode );
            $smarty->assign( "hn_id", $hn_id );
            $smarty->assign( "db_meld", $ret["status"] );
            $smarty->assign( "error", $ret["error"] );
            $smarty->display( "meld.tpl" );
            break;
    }
?>