Example #1
0
 function getSingleUpdateMask($rowId)
 {
     $tblAll = new Table(array(""));
     if ($rowId == null || $rowId == "") {
         return $tblAll;
     }
     $f1 = new FontType();
     $f1->setFontSize(2);
     $f1->setBold(true);
     $f2 = new FontType();
     $fts = array($f1, $f2);
     $table = new Table(array("", ""));
     $table->setHeadEnabled(false);
     $table->setBorder(0);
     $table->setFontTypes($fts);
     $table->setAlign($this->getAlign());
     $table->setVAlign($this->getVAlign());
     $table->setAlignments($this->getAlignments());
     if ($this->WIDTH > 0) {
         $table->setWidth($this->WIDTH);
     }
     if ($this->HEIGHT > 0) {
         $table->setHeight($this->HEIGHT);
     }
     if ($this->BORDER != null && strlen($this->BORDER) > 0) {
         $table->setBorder($this->BORDER);
     }
     if ($this->PADDING >= 0) {
         $table->setPadding($this->PADDING);
     }
     if ($this->HEAD_ENABLED) {
         $table->setHeadEnabled($this->HEAD_ENABLED);
     }
     if ($this->SPACING >= 0) {
         $table->setSpacing($this->SPACING);
     }
     if ($this->XPOS > 0 && $this->YPOS > 0) {
         $table->setXPos($this->XPOS);
         $table->setYPos($this->YPOS);
     }
     $chk = 0;
     $stmnt = "SELECT ";
     foreach ($this->COLNAMES as $cn) {
         if ($stmnt != "SELECT ") {
             $stmnt .= ", ";
         }
         $stmnt .= $cn;
         $chk++;
     }
     $stmnt .= ", id as rowid ";
     $stmnt .= " FROM " . $this->TABLENAME . "  where id = " . $rowId . " " . $this->ORDERBY . " LIMIT 1 ";
     $result = $this->DBCONNECT->executeQuery($stmnt);
     $rowEdit = mysql_fetch_array($result);
     for ($i = 0; $i < mysql_num_fields($result) - 1; $i++) {
         $fieldName = mysql_field_name($result, $i);
         $arrChk = array_search($fieldName, $this->NOUPDATECOLS);
         if (strlen($arrChk) == 0) {
             $r = $table->createRow();
             $o = "";
             $lookups = getLookupWerte($_SESSION['config']->DBCONNECT, $this->TABLENAME, $fieldName);
             // in der Datenbank für dieses Datenbankfeld
             // definierte Combobox laden (wenn vorhanden)
             $dbCombo = getDbComboArray($this->TABLENAME, $fieldName, $rowEdit);
             $val = "";
             if (isset($rowEdit[$fieldName]) && strlen($rowEdit[$fieldName]) > 0) {
                 $val = $rowEdit[$fieldName];
             }
             if (mysql_num_rows($lookups) == 0 && !$this->isDbComboSet($this->TABLENAME, $fieldName)) {
                 /*if (strpos(" " . $this->DEFAULTS, $fieldName) > 0) {
                                     $tmpval = substr($this->DEFAULTS, strpos($this->DEFAULTS, "=") + 1);
                                     $o = new HiddenField($fieldName, $tmpval);
                 
                                     } else*/
                 if (strpos(mysql_field_flags($result, $i), "enum") > 0) {
                     $ev = $this->getEnumValues($fieldName);
                     if (count($ev) == 2 && (in_array('J', $ev) && in_array('N', $ev))) {
                         $o = new Checkbox($fieldName . $rowId, "", "J");
                         if ($rowEdit[$fieldName] == "J") {
                             $o->setSelected(true);
                         }
                     } else {
                         $o = new ComboBox($fieldName . $rowId, $this->getComboboxEnumArray($fieldName));
                     }
                 } else {
                     if (mysql_field_type($result, $i) == "blob") {
                         $o = new TextArea($fieldName . $rowId, $val, 80, 10);
                         $o->setTextEditor($this->TEXTEDITOR_ENABLED);
                     } else {
                         if (mysql_field_type($result, $i) == "date") {
                             $o = new DateTextfield($fieldName . $rowId, $val);
                             $o->setToolTip("Bitte im Format:  <b>YYYY-MM-TT</b>  angeben");
                         } else {
                             if (mysql_field_type($result, $i) == "int") {
                                 $o = new TextField($fieldName . $rowId, $val);
                             } else {
                                 if (mysql_field_type($result, $i) == "timestamp") {
                                     $o = new TextField($fieldName . $rowId, $val);
                                 } else {
                                     $o = new TextField($fieldName . $rowId, $val);
                                 }
                             }
                         }
                     }
                 }
             } else {
                 if (mysql_num_rows($lookups) > 0) {
                     $o = new LookupCombo($_SESSION['config']->DBCONNECT, $fieldName . $rowId, $this->TABLENAME, $fieldName, $rowEdit[$fieldName]);
                 } else {
                     if (count($dbCombo) > 0) {
                         if (!strpos(" " . $this->DEFAULTS, $fieldName) > 0) {
                             $o = new ComboBox($fieldName . $rowId, $dbCombo, $val);
                         } else {
                             $o = new HiddenField($fieldName . $rowId, $val);
                         }
                     }
                 }
             }
             if ($i < count($this->LABELS)) {
                 $r->setAttribute(0, $this->LABELS[$i]);
             } else {
                 $r->setAttribute(0, "");
             }
             $arrChk = array_search($fieldName, $this->READONLYCOLS);
             if (strlen($arrChk) != 0) {
                 $o->setReadOnly(true);
             }
             $r->setAttribute(1, $o);
             $table->addRow($r);
         }
     }
     foreach ($this->ADDITIONAL_UPDATE_FIELDS as $label => $field) {
         $r = $table->createRow();
         $r->setAttribute(0, $label);
         $r->setAttribute(1, $field);
         $table->addRow($r);
     }
     $okButton = new Button("DbTableUpdate" . $this->TABLENAME, "Speichern");
     $r = $table->createRow();
     $r->setSpawnAll(true);
     $r->setAttribute(0, $okButton);
     $table->addRow($r);
     $rowAll1 = $tblAll->createRow();
     $rowAll2 = $tblAll->createRow();
     $rowAll1->setAttribute(0, $table);
     $tblAll->addRow($rowAll1);
     $tblAll->addRow($rowAll2);
     $f = new Form($_SERVER['SCRIPT_NAME']);
     $f->add($tblAll);
     $f->add(new Hiddenfield("SingleUpdateRowId", $rowId));
     $f->add($this->DEFAULT_HIDDEN_FIELDS);
     return $f;
 }
Example #2
0
$banner->setWidth($bannerWidth);
if (!$noFrameLayout) {
    $banner->setGenerated(false);
    $contentLayoutRow1 = $layoutTable->createRow();
    $contentLayoutRow1->setAlign("left");
    $contentLayoutRow1->setAttribute(0, $banner);
    $contentLayoutRow1->setStyle("padding", "10px");
    $layoutTable->addRow($contentLayoutRow1);
} else {
    $_SESSION['additionalLayoutHeight'] = 15;
    $bannerHeight = $_SESSION['additionalLayoutHeight'];
}
$modeSwitchComboTbl = new Table(array(""));
$modeSwitchComboTbl->setWidth(100);
$modeSwitchComboTbl->setAlign("center");
$modeSwitchComboTbl->setVAlign("middle");
$modeSwitchComboTbl->setHeight(25);
$cobMode = new ComboBoxBySql($_SESSION['config']->DBCONNECT, "SELECT id, name FROM homecontrol_modes WHERE selectable = 'J'", "changeMode", $_SESSION['config']->PUBLICVARS['currentMode']);
$cobMode->setDirectSelect(true);
$rMode = $modeSwitchComboTbl->createRow();
$rMode->setAttribute(0, $cobMode);
$modeSwitchComboTbl->addRow($rMode);
$fMode = new Form();
$fMode->add($modeSwitchComboTbl);
/* ------------------------------------
HAUPT-MENU
------------------------------------ */
$menuDiv = new Div();
$menuDiv->setWidth($bannerWidth - 80);
$menuDiv->setBorder(0);
$menuDiv->setOverflow("hidden");
 }
 // --------------------------------------------------
 //  Bearbeiten-Maske
 // --------------------------------------------------
 $tDel = $scDbTable->doDeleteFromUpdatemask();
 if (method_exists($tDel, "show")) {
     $fDel = new Form();
     $fDel->add($tDel);
     $fDel->show();
 }
 if (isset($_REQUEST["DbTableUpdate" . $scDbTable->TABLENAME])) {
     $scDbTable->doUpdate();
 }
 $tblEtagen = new Table(array("Name", "Raumplan", "hochladen", "entfernen"));
 $tblEtagen->setHeadEnabled(true);
 $tblEtagen->setVAlign("middle");
 $tblEtagen->setAlignments(array("left", "center", "center", "right"));
 $tblEtagen->setBackgroundColorChange(true);
 foreach ($scDbTable->ROWS as $etagenRow) {
     $rowId = $etagenRow->getNamedAttribute("rowid");
     $txfName = new Textfield("name" . $rowId, $etagenRow->getNamedAttribute("name"));
     $btnRaumplan = new Button("uploadImage" . $rowId, "Raumplan hochladen");
     $btnDelete = new Button("delete" . $rowId . "homecontrol_etagen", "entfernen");
     $imgRaumplan = "";
     if (isset($_REQUEST["uploadImage" . $rowId]) && $_REQUEST["uploadImage" . $rowId] == "Raumplan hochladen") {
         $hdnImg = new Hiddenfield("uploadImage" . $rowId, $_REQUEST["uploadImage" . $rowId]);
         $imgUploader = new ImageUploader("/pics/raumplan", "RP_", "homecontrol_etagen", "pic", $rowId, $hdnImg, $rowId . ".jpg");
         $imgUploader->show();
         $imgRaumplan = new Image(getDbValue("homecontrol_etagen", "pic", "id=" . $rowId));
     } else {
         $imgRaumplan = new Image(getEtagenImagePath($rowId));
 function getNavigationBar()
 {
     $mask = new Table(array("Etage Label", "Etage Combo", "Spacer", "Zimmer Full-Switch"));
     $mask->setAlignments(array("left", "left", "left", "right"));
     $mask->setHeight(40);
     $mask->setWidth(600);
     $mask->setVAlign("middle");
     $row = $mask->createRow();
     $mask->addRow($row);
     $cobEtage = $this->getEtagenCombo("aktEtage", $_SESSION['aktEtage']);
     $cobEtage->setDirectSelect(true);
     $frmEtage = new Form();
     $frmEtage->add($cobEtage);
     $frmFullSwitch = $this->getZimmerFullSwitchNavigation();
     $frmSensorOrControlSwitch = $this->EDITMODE ? $this->getSensorOrControlSwitch() : new Text("");
     $row->setAttribute(0, "Etage:");
     $row->setAttribute(1, $frmEtage);
     $row->setAttribute(2, $frmSensorOrControlSwitch);
     $row->setAttribute(3, "");
     //$frmFullSwitch);
     return $mask;
 }