Example #1
0
 function getUpdateMask()
 {
     $tNames = $this->LABELS;
     $colNames = $this->COLNAMES;
     array_push($colNames, "Aktion");
     array_push($tNames, " ");
     $table = new Table($tNames);
     if (count($this->COLSIZES) > 0) {
         $table->setColSizes($this->COLSIZES);
     }
     if (count($this->ALIGNMENTS) > 0) {
         $table->setAlignments($this->ALIGNMENTS);
     }
     if (isset($_REQUEST["showUpdateMask" . $this->TABLENAME]) && strlen($_REQUEST["showUpdateMask" . $this->TABLENAME]) > 0) {
         $r = $table->createRow();
         $r->setSpawnAll(true);
         $r->setAttribute(0, $this->getSingleUpdateMask($_REQUEST["showUpdateMask" . $this->TABLENAME]));
         $rX = $table->getRow(0);
         $table->setRow(0, $r);
         $table->addRow($rX);
         $table->addSpacer(0, 15);
     }
     $table->setHeadEnabled($this->HEAD_ENABLED);
     $table->setBackgroundColorChange(true);
     if ($this->isDeleteInUpdate()) {
         $this->doDeleteFromUpdatemask();
         for ($i = 0; $i < count($tNames); $i++) {
             if ($i != count($tNames) - 1) {
                 $tmpW[$i] = "";
             } else {
                 $tmpW[$i] = "125";
             }
         }
         $table->setColSizes($tmpW);
     }
     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);
     }
     //---------------------------------------------------
     // gesamte Tabelle einlesen um Feldtypen zu ermitteln
     //---------------------------------------------------
     $stmnt = "SELECT " . $this->COLNAMESTRING . " FROM " . $this->TABLENAME . " LIMIT 1 ";
     $result = $this->DBCONNECT->executeQuery($stmnt);
     //---------------------------------------------------
     // ROWS in Table aufnehmen
     //---------------------------------------------------
     $bgCtr = 1;
     for ($ir = 1; $ir <= count($this->ROWS); $ir++) {
         $r = $table->createRow();
         $r->setStyle("padding", "5px 5px");
         for ($ia = 0; $ia < count($this->COLNAMES); $ia++) {
             $row = $this->ROWS[$ir];
             $rowId = $this->ROWS[$ir]->getAttribute(count($this->COLNAMES));
             $val = "";
             $t = "";
             if (strlen($row->getAttribute($ia)) > 0) {
                 $val = getDbComboValue($this->TABLENAME, $this->COLNAMES[$ia], $row->getAttribute($ia), $row);
             }
             // Wenn DbCombo definiert wurde wird der passende Text zum Code der Spalte angezeigt
             if (strlen($val) > 0) {
                 $t = $val;
             } else {
                 $t = $row->getAttribute($ia);
             }
             $txt = new Text($t);
             if (mysql_field_type($result, $ia) == "blob") {
                 $txt = new Text("...");
                 $fn = mysql_field_name($result, $ia);
                 $txt->setToolTip("<b>" . $fn . ":</b> " . $t);
             } else {
                 if (mysql_field_type($result, $ia) == "date") {
                     $txt->setText($txt->getText());
                 } else {
                     //Maximal  ersten 30Stellen anzeigen
                     if (strlen($t) > 30) {
                         $tmp = $t;
                         if (strtolower($this->COLNAMES[$ia]) == "email") {
                             $tmp = "<a href='mailto:" . $t . "'>" . substr($t, 0, 30) . "..." . "</a>";
                         }
                         $txt->setFilter(false);
                         $txt->setText($tmp);
                         $txt->setToolTip($t);
                     } else {
                         $tmp = $t;
                         if (strtolower($this->COLNAMES[$ia]) == "email") {
                             $tmp = "<a href='mailto:" . $t . "'>" . $t . "</a>";
                         }
                         $txt->setFilter(false);
                         $txt->setText($tmp);
                     }
                 }
             }
             if (!$this->isInvisibleCol($this->COLNAMES[$ia])) {
                 $r->setAttribute($ia, $txt);
             } else {
                 $r->setAttribute($ia, " ");
             }
         }
         $tblBtns = new Table(array("", ""));
         $tblBtns->setWidth(150);
         $frmUpdBtn = new Form();
         $frmUpdBtn->add($this->DEFAULT_HIDDEN_FIELDS);
         $frmUpdBtn->add(new Hiddenfield("showUpdateMask" . $this->TABLENAME, $rowId));
         $frmUpdBtn->add(new Button("editEtage", "bearbeiten"));
         //bearbeiten Link
         $btnUpd = new Link($_SERVER['SCRIPT_NAME'] . "?" . "showUpdateMask" . $this->TABLENAME . "=" . $rowId, "bearbeiten");
         $btnUpd->setValidate(false);
         //$div->add($btnUpd);
         // entfernen Link einfügen
         $frmDelBtn = new Form();
         $frmDelBtn->add($this->DEFAULT_HIDDEN_FIELDS);
         $frmDelBtn->add(new Button("delete" . $rowId . $this->TABLENAME, "entfernen"));
         $rBtns = $tblBtns->createRow();
         $rBtns->setAttribute(0, $frmUpdBtn);
         if ($this->isDeleteInUpdate()) {
             $rBtns->setAttribute(1, $frmDelBtn);
         } else {
             $rBtns->setSpawnAll(true);
         }
         $tblBtns->addRow($rBtns);
         $r->setAttribute(count($tNames) - 1, $tblBtns);
         $table->addRow($r);
     }
     $form = new Form($_SERVER['SCRIPT_NAME']);
     $form->add($this->getPageNavigation());
     $form->add($table);
     $form->add($this->DEFAULT_HIDDEN_FIELDS);
     return $form;
 }