$newItemBtn = $termDbTable->getNewEntryButton("Neue Bedingung anlegen");
 $rZuordnung = $table->createRow();
 $rZuordnung->setSpawnAll(true);
 $rZuordnung->setAttribute(0, $newItemBtn);
 $table->addRow($rZuordnung);
 $form = new Form();
 $form->add($spc);
 $form->add($table);
 $form->add($spc);
 $form->show();
 // -------------------------------------------
 //                 Schaltgruppen
 // -------------------------------------------
 $regelItemsDbTable = new DbTable($_SESSION['config']->DBCONNECT, 'homecontrol_regeln_items', array("config_id", "art_id", "zimmer_id", "etagen_id", "on_off", "regel_id", "id"), "Objekt, Objekt-Art, Zimmer, Etage, An/Aus", "regel_id=" . $_SESSION['SelectedRegelToEdit'], "config_id DESC, zimmer_id DESC, etagen_id DESC", "regel_id=" . $_SESSION['SelectedRegelToEdit']);
 $regelItemsDbTable->setReadOnlyCols(array("id"));
 $regelItemsDbTable->setNoInsertCols(array("id"));
 $regelItemsDbTable->setNoUpdateCols(array("regel_id", "id"));
 $regelItemsDbTable->setDeleteInUpdate(true);
 $regelItemsDbTable->setHeaderEnabled(true);
 $itemsTable = new Table(array("", ""));
 //$itemsTable->setColSizes(array(150));
 $itemsTable->setBorder(0);
 $ttlItems = new Title("Zu schaltende Objekte");
 $ttlItems->setAlign("left");
 $itemsTable->addSpacer(0, 15);
 $r1Title = $itemsTable->createRow();
 $r1Title->setSpawnAll(true);
 $r1Title->setAttribute(0, $ttlItems);
 $itemsTable->addRow($r1Title);
 // Neuer Eintrag
 if (isset($_REQUEST['InsertIntoDB' . $regelItemsDbTable->TABLENAME]) && $_REQUEST['InsertIntoDB' . $regelItemsDbTable->TABLENAME] == "Speichern") {
Ejemplo n.º 2
0
 $r2Auswahl->setSpawnAll(true);
 $r2Auswahl->setAttribute(0, new Text("Schaltgruppe auswaehlen: "));
 $table->addRow($r2Auswahl);
 $r2Auswahl = $table->createRow();
 $r2Auswahl->setSpawnAll(true);
 $r2Auswahl->setAttribute(0, $cobSelectItems);
 $table->addRow($r2Auswahl);
 $table->addSpacer(0, 10);
 if (isset($_SESSION['SelectedAlarmItemToEdit'])) {
     $where = "trigger_id=" . $_SESSION['SelectedAlarmToEdit'] . " AND trigger_type=3 ";
     if (isset($_SESSION['SelectedAlarmItemToEdit']) && strlen($_SESSION['SelectedAlarmItemToEdit']) > 0) {
         $where .= " AND trigger_subid=" . $_SESSION['SelectedAlarmItemToEdit'];
     }
     $termDbTable = new DbTable($_SESSION['config']->DBCONNECT, 'homecontrol_term', array("id", "trigger_id", "trigger_type", "config_id", "term_type", "sensor_id", "min", "std", "value", "termcondition", "status", "montag", "dienstag", "mittwoch", "donnerstag", "freitag", "samstag", "sonntag", "order_nr", "and_or"), "", "", "order_nr", $where);
     $termDbTable->setReadOnlyCols(array("id"));
     $termDbTable->setNoInsertCols(array("id"));
     $termDbTable->setDeleteInUpdate(true);
     $termDbTable->setHeaderEnabled(true);
     $termDbTable->setWidth("100%");
     $table->addSpacer(0, 10);
     if (isset($_REQUEST[$termDbTable->getNewEntryButtonName()])) {
         $addUrl = $termDbTable->getNewEntryButtonName() . "=" . $_REQUEST[$termDbTable->getNewEntryButtonName()];
         $hcTermCreator = new HomeControlTermCreator($_SESSION['SelectedAlarmToEdit'], $_SESSION['SelectedAlarmItemToEdit'], 3, $addUrl);
         $rNew = $table->createRow();
         $rNew->setAlign("center");
         $rNew->setAttribute(0, $hcTermCreator);
         $rNew->setSpawnAll(true);
         $table->addRow($rNew);
         $table->addSpacer(0, 20);
     }
     $c1 = $_SESSION['config']->COLORS['Tabelle_Hintergrund_1'];
    $tbl->addRow($r);
    $tbl->show();
    /* --------------------------------- */
} else {
    // -----------------------------------
    //   Image Upload
    // -----------------------------------
    $t = new Title("Etagen");
    $t->setAlign("left");
    $t->show();
    $spc = new Spacer(20);
    $ln = new Line();
    $scDbTable = new DbTable($_SESSION['config']->DBCONNECT, 'homecontrol_etagen', array("name", "pic"), "Name, Raumplan", "pic = 'pics/default_etage.jpg'", "name", "");
    $scDbTable->setDeleteInUpdate(true);
    $scDbTable->setHeaderEnabled(true);
    $scDbTable->setNoInsertCols(array("pic"));
    $scDbTable->setToCheck("name");
    $scDbTable->setWidth("100%");
    $spc->show();
    $scDbTable->setBorder(0);
    // --------------------------------------------------
    //  Neuer Eintrag
    // --------------------------------------------------
    if (isset($_REQUEST['dbTableNewhomecontrol_etagen'])) {
        $scDbTable->showInsertMask();
    }
    if (isset($_REQUEST['InsertIntoDBhomecontrol_etagen']) && $_REQUEST['InsertIntoDBhomecontrol_etagen'] == "Speichern") {
        $scDbTable->doInsert();
        //       $getMaxSql = "SELECT max(id) maxId FROM homecontrol_etagen";
        //       $rslt = $_SESSION['config']->DBCONNECT->executeQuery($getMaxSql);
        //       $r = mysql_fetch_array($rslt);
 function show()
 {
     $dbArr = getComboArrayBySql("select id, name from homecontrol_sender");
     if (count($dbArr) <= 0) {
         $msg = new Message("Kein Sender vorhanden", "Legen Sie zuerst unter *Einstellungen - Basis* mindestens einen Sender an.");
     } else {
         $this->checkSensorOrControlSwitch();
         $this->handleEtage();
         $this->checkSwitch();
         if ($this->LAYOUT_ART == $this->LAYOUTART_MOBILE) {
             $this->showMobileView();
             return;
         }
         if ($this->LAYOUT_ART == $this->LAYOUTART_TABLET) {
             $this->showTabletView();
             return;
         }
         // ungültige Layout-Art korrigieren auf Default (Desktop)
         $this->LAYOUT_ART = $this->LAYOUTART_DESKTOP;
         if (isset($_SESSION['aktEtage']) && strlen($_SESSION['aktEtage']) > 0) {
             $dbTable = new DbTable($_SESSION['config']->DBCONNECT, 'homecontrol_config', array("id", "name", "funk_id", "funk_id2", "beschreibung", "control_art", "etage", "zimmer", "x", "y", "dimmer", "sender_id"), "", "", "", "etage=" . $_SESSION['aktEtage']);
             $dbTable->setNoInsertCols("id");
             $dbSensorTable = new DbTable($_SESSION['config']->DBCONNECT, 'homecontrol_sensor', array("id", "name", "beschreibung", "status_sensor", "sensor_art", "etage", "zimmer", "x", "y", "lastValue", "lastSignal"), "ID, Name, Beschreibung, Status-Sensor?, Art, Etage, Zimmer, X, Y, Letzter Wert, Letztes Signal", "", "etage, zimmer, name", "etage=" . $_SESSION['aktEtage']);
             if ($this->EDITMODE) {
                 if ($this->handleSensorEdit($dbSensorTable)) {
                     $dbSensorTable->refresh();
                 }
                 if ($this->handleControlEdit($dbTable)) {
                     $dbTable->refresh();
                 }
             }
         }
         $navBar = $this->getNavigationBar();
         $navBar->show();
         if (isset($_SESSION['aktEtage']) && strlen($_SESSION['aktEtage']) > 0) {
             if ($this->EDITMODE) {
                 echo "\n            \t  <script type=\"text/javascript\">\n            \t\tfunction Coords () {\n                            var Ziel = \"?";
                 if ($_SESSION['AnlageArt'] == "S") {
                     echo "InsertNewSensorControl";
                 } else {
                     echo "InsertNewControl";
                 }
                 echo "=do&X=\" + window.event.pageX + \"&Y=\" + window.event.pageY;\n                            window.location.href = Ziel;  \n            \t\t}\n                  </script>\n                    ";
             }
             $this->showMap($dbTable, $dbSensorTable);
             $this->postHandleControlEdit($dbTable);
         }
     }
 }