Esempio n. 1
0
 function TableBySql($sql)
 {
     $this->NAME = "Table";
     $this->XPOS = "";
     $this->YPOS = "";
     $this->WIDTH = "100%";
     $this->HEIGHT = 0;
     $this->BORDER = 0;
     $this->setPadding(0);
     $this->setSpacing(0);
     $this->COLSIZES = array();
     $this->ROWS = array();
     $this->FONTTYPES = array();
     $this->DESIGNJN = "N";
     $this->TABLEDESIGN = "default";
     $this->DESIGNWIDTH = 20;
     $this->DESIGNHEIGHT = 20;
     $this->HEAD_ENABLED = true;
     $this->DBCONNECT = $_SESSION['config']->DBCONNECT;
     $this->SQL = $sql;
     $result = $this->DBCONNECT->executeQuery($this->SQL);
     $menge = mysql_num_fields($result);
     // SpaltenNamen  holen
     for ($x = 0; $x < $menge; $x++) {
         $cN[$x] = mysql_field_name($result, $x);
     }
     $this->COLNAMES = $cN;
     $this->prepareFonts();
     //Select-Ergebniss in Rows *packen*
     while ($rowArray = @mysql_fetch_array($result)) {
         $newRow = $this->createRow();
         if (strlen($this->getVAlign()) > 0) {
             $newRow->setVAlign($this->getVAlign());
         }
         if (strlen($this->getAlign()) > 0) {
             $newRow->setAlign($this->getAlign());
         }
         for ($i = 0; $i < count($this->COLNAMES); $i++) {
             if (mysql_field_type($result, $i) == "blob") {
                 $txa = new TextArea("txt", $rowArray[$i]);
                 $txa->setWidth(40);
                 $txa->setHeight(3);
                 $txa->setReadOnly(true);
                 $newRow->setAttribute($i, $txa);
             } else {
                 $newRow->setAttribute($i, new Text($rowArray[$i]));
             }
         }
         $this->addRow($newRow);
     }
 }