コード例 #1
0
 public function processControlMenu()
 {
     if (isset($_REQUEST['main_tab'])) {
         $option = $_REQUEST['main_tab'];
         if ($option === 'lights') {
             echo Lightbulb::getLightBulbForm();
         } elseif ($option === 'locks') {
             echo Lock::getLockForm();
         } elseif ($option === 'thermostat') {
             echo Thermostat::getThermostatForm();
         } else {
             if ($option == 'lightGroups') {
                 echo LightGroup::getLightGroupForm();
             } else {
                 echo "<h3>Undefined Tab Selected</h3>";
             }
         }
         //continue with locks
         //thermostat etc.
         $this->display = FALSE;
     } else {
         $command = escapeshellcmd("python /var/www/python/killall.py");
         shell_exec($command);
         $command = escapeshellcmd("python /var/www/python/clear.py");
         shell_exec($command);
     }
 }
コード例 #2
0
<?php

require_once '../shell.php';
if (isset($_POST['id'])) {
    $id = $_POST['id'];
    $group = new LightGroup($id);
    if ($group->status === '0') {
        $group->status = '1';
        $lightstatus = 'on';
    } else {
        $group->status = '0';
        $lightstatus = 'off';
    }
    $group->save();
    $lightIDs = $group->getStringFromIds();
    echo "IDs: " . $lightIDs;
    $command = escapeshellcmd("python /var/www/python/lightGroup.py {$lightstatus} {$lightIDs}");
    echo "<{$command} br>";
    echo shell_exec($command);
}
コード例 #3
0
 public static function processAddLight()
 {
     if (isset($_POST['addLight'])) {
         //get group from passed id
         $groupID = $_POST['groupID'];
         $lightID = $_POST['lightID'];
         $group = new LightGroup($groupID);
         $group->addIdToApplianceIds($lightID);
         $group->save();
         echo Navigation_Menu::getPopup("Your Light has been added!");
     }
 }