Ejemplo n.º 1
0
 public function getHTML($id)
 {
     $bps = $this->getMyBPSData();
     $t = new HTMLTable(1);
     $t->setTableStyle("width:160px;float:right;margin-right:10px;");
     if (!isset($bps["ID"])) {
         $F = new mFhemGUI();
         $F->addAssocV3("FhemType", "!=", "FHZ");
         while ($f = $F->getNextEntry()) {
             $B = new Button($f->getA()->FhemName, "./fheME/Fhem/fhem.png");
             $B->onclick("contentManager.loadFrame('contentRight','mFhemTimer',-1,0,'mFhemTimerGUI;ID:" . $f->getID() . ";type:D;name:" . $f->getA()->FhemName . "');");
             $t->addRow($B);
             $t->addRowClass("backgroundColor0");
         }
         $t->addRow("");
         $t->addRowClass("backgroundColor1");
         $F = new anyC();
         $F->setCollectionOf("FhemPreset");
         $F->addAssocV3("FhemPresetHide", "=", "0");
         while ($f = $F->getNextEntry()) {
             $B = new Button($f->getA()->FhemPresetName, "./fheME/Fhem/events.png");
             $B->onclick("contentManager.loadFrame('contentRight','mFhemTimer',-1,0,'mFhemTimerGUI;ID:" . $f->getID() . ";type:P;name:" . $f->getA()->FhemPresetName . "');");
             $t->addRow($B);
             $t->addRowClass("backgroundColor0");
         }
         return $t;
     }
     if (isset($bps["ID"])) {
         if ($bps["type"] == "D") {
             $F = new Fhem($bps["ID"]);
             $F->loadMe();
             $FF = new Fhem("timer");
             $FF->setA($F->getA());
             $C = new FhemControlGUI();
             $control = $C->getControl($FF);
         } else {
             $control = "";
         }
         $rand = rand(10, 10000000);
         $B = new Button("set timer", "okCatch");
         $B->rme("FhemControl", '', 'setTimer', array($bps["ID"], "'setBPSValue'", "'{$bps['type']}'", "parent.clock4Timer{$rand}.stunden", "parent.clock4Timer{$rand}.minuten", "'{$bps['name']}'"), "contentManager.loadFrame(\\'contentRight\\',\\'mFhem\\',-1,0,\\'\\');");
         $B->style("float:right;");
         $t->addRow("<iframe name=\"clock4Timer{$rand}\" style=\"width:240px;height:330px;border:0px;\" src=\"./libraries/ClockGUI.class.php\"></iframe>");
         $t->addRowClass("backgroundColor0");
         $t->addRow($B);
         $t->addRowClass("backgroundColor0");
         return $control . $t;
     }
 }
Ejemplo n.º 2
0
 public function setTimer($id, $action, $type, $stunden, $minuten, $deviceName)
 {
     if ($action == "setBPSValue") {
         $action = $_SESSION["BPS"]->getProperty("mFhemTimer", "FhemValue");
     }
     switch ($type) {
         case "D":
             $F = new Fhem($id);
             $F->loadMe();
             $S = new FhemServer($F->getA()->FhemServerID);
             $S->loadMe();
             break;
         case "P":
             $ac = new anyC();
             $ac->setCollectionOf("FhemPreset");
             $ac->addJoinV3("FhemServer", "FhemPresetServerID", "=", "FhemServerID");
             $ac->addAssocV3("FhemPresetID", "=", $id);
             $ac->setLimitV3("1");
             $S = $ac->getNextEntry();
             $action = "on";
             break;
     }
     try {
         $T = new Telnet($S->getA()->FhemServerIP, $S->getA()->FhemServerPort);
     } catch (NoServerConnectionException $e) {
         die("error:'The connection to the server with IP-address " . $S->getA()->FhemServerIP . " could not be established!'");
     }
     $T->fireAndForget("define a" . rand(10, 10000000) . " at " . ($stunden < 10 ? "0" : "") . "{$stunden}:" . ($minuten < 10 ? "0" : "") . "{$minuten}:00 set " . $deviceName . " {$action}");
     $T->disconnect();
 }