Ejemplo n.º 1
0
<?php

require_once "config.php";
if (isset($_POST["Operation"])) {
    $dataobject = new Dataclass();
    switch ($_POST["Operation"]) {
        case "Add":
            $result = $dataobject->insert_room($_POST["floor"], $_POST["roomName"]);
            if ($result) {
                echo $_POST["roomName"] . " was added";
            } else {
                echo $_POST["roomName"] . " was not added";
            }
            break;
        case "Update":
            if (isset($_POST["roomid"])) {
                $result = $dataobject->update_room($_POST["roomid"], $_POST["floor"], $_POST["roomName"]);
                if ($result) {
                    echo $_POST["roomName"] . " was updated";
                } else {
                    echo $_POST["roomName"] . " was not updated";
                }
            }
            break;
        case "Delete":
            if (isset($_POST["roomid"])) {
                $result = $dataobject->delete_room($_POST["roomid"]);
                if ($result) {
                    echo $_POST["roomName"] . " was deleted";
                } else {
                    echo $_POST["roomName"] . " was not deleted";
Ejemplo n.º 2
0
?>

<?php 
$zwaveServer = new ZwaveServer(ZWAVE_HOST, ZWAVE_PORT);
//get list of devices
$zwaveServer->send("ALIST");
$list = $zwaveServer->read();
$list = substr($list, 0, strlen($list) - 1);
$zwaveServer->close();
$devicesList = explode("#", $list);
$zones = "";
foreach ($devicesList as $device) {
    $device = explode("~", $device);
    $zones .= $device["3"] . "~";
}
$dataobject = new Dataclass();
?>

<?php 
MPage::BeginBlock();
?>
 
<?php 
$dsRooms = $dataobject->get_Rooms();
$count = 1;
while ($floor = $dsRooms->fetch()) {
    $zone = $floor["tbl_room"];
    echo "\t" . '<div class="zone" id="zone' . $count . '">' . "\n";
    echo "\t" . '<div class="zonetitle">' . $zone . '</div>' . "\n";
    echo "\t" . '<div class="zonedetails">' . "\n";
    $count++;
Ejemplo n.º 3
0
<?php

require_once "config.php";
if (isset($_POST["Operation"])) {
    $dataobject = new Dataclass();
    switch ($_POST["Operation"]) {
        case "Add":
            $result = $dataobject->insert_Floor($_POST["FloorName"]);
            if ($result) {
                echo $_POST["FloorName"] . " was added";
            } else {
                echo $_POST["FloorName"] . " was not added";
            }
            break;
        case "Update":
            if (isset($_POST["floorid"])) {
                $result = $dataobject->update_Floor($_POST["floorid"], $_POST["FloorName"]);
                if ($result) {
                    echo $_POST["FloorName"] . " was updated";
                } else {
                    echo $_POST["FloorName"] . " was not updated";
                }
            }
            break;
        case "Delete":
            if (isset($_POST["floorid"])) {
                $result = $dataobject->delete_Floor($_POST["floorid"]);
                if ($result) {
                    echo $_POST["FloorName"] . " was deleted";
                } else {
                    echo $_POST["FloorName"] . " was not deleted";
Ejemplo n.º 4
0
<?php

require_once "config.php";
if (isset($_POST["txtPassword"])) {
    $dataobject = new Dataclass();
    $dataobject->update_password($_POST["txtPassword"]);
    echo "Password has been set!";
}
Ejemplo n.º 5
0
<?php

require_once "config.php";
$dataobject = new Dataclass();
if (isset($_POST["floorid"])) {
    $dataobject->update_floor($_POST["floorid"], $_POST["FloorName"]);
    echo $_POST["FloorName"] . " Updated";
} else {
    ?>

    <?php 
    MPage::BeginBlock();
    ?>
    <link type="text/css" href="css/dark-hive/jquery-ui-1.8.17.custom.css" rel="stylesheet" />
    <script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.8.17.custom.min.js"></script>
    <script type="text/javascript">   
        function initMenu() {
            $('#menu ul').hide();
            $('#menu ul:first').show();
            $('#menu li a').click(
            function() {
                var checkElement = $(this).next();
                if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
                    return false;
                }
                if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
                    $('#menu ul:visible').slideUp('normal');
                    checkElement.slideDown('normal');
                    return false;
                }
Ejemplo n.º 6
0
<?php

require_once "config.php";
?>
 
<?php 
if (isset($_POST["txtUsername"]) && isset($_POST["txtPassword"])) {
    $dataclass = new Dataclass();
    $result = $dataclass->check_Login($_POST["txtUsername"], sha1($_POST["txtPassword"]));
    $valid = false;
    $userID = 0;
    while ($row = $result->fetch()) {
        //Login ok
        $userID = $row["idtbladmin"];
        $_SESSION["UserId"] = $userID;
        $_SESSION["Username"] = $row["username"];
        $valid = true;
    }
    //
    if (isset($_POST["chkRemember"])) {
        setcookie("Username", $_POST["txtUsername"], EXPIRE);
        setcookie("Password", $_POST["txtPassword"], EXPIRE);
    }
    if (isset($_POST["chkKeepSignedIn"])) {
        setcookie("SignedIn", "true", EXPIRE);
        setcookie("UserId", $userID, EXPIRE);
        setcookie("Username", $_POST["txtUsername"], EXPIRE);
    }
}
if (isset($_SESSION["Username"])) {
    header("location:index.php");
Ejemplo n.º 7
0
                }            
            }
        }); 
        
    });
    
</script>
<?php 
MPage::EndBlock("scripts");
MPage::BeginBlock();
?>
<div id="rooms">
    <div class="menutitle">Scheduled Jobs</div>
    <ul id="menu">
        <?php 
$dataobject = new Dataclass();
foreach ($zones as $zone) {
    if ($zone != null) {
        echo '<li><a href="#">' . $zone . '</a>';
        echo '<ul>';
        foreach ($devicesList as $device) {
            $device = explode("~", $device);
            if ($device[3] == $zone) {
                $dsSchedules = $dataobject->get_Schedules();
                while ($job = $dsSchedules->fetch()) {
                    //get node
                    if ($job["schedule_on"] != null) {
                        $details = parseCommand($job["schedule_on"]);
                    } else {
                        $details = parseCommand($job["schedule_off"]);
                    }