Beispiel #1
0
 public function generate()
 {
     $array = $this->array;
     $colTitle = $this->colTitle;
     $t = $this;
     $k = 0;
     if ($this->text) {
         $ncols = count($array[0]);
         $t->setCell($k++, 0, $this->text, " class=\"mTableRawTitle\" colspan={$ncols} ");
     }
     if (is_array($colTitle)) {
         $n = count($colTitle);
         for ($i = 0; $i < $n; $i++) {
             $t->setCell($k, $i, $colTitle[$i], " class=\"mTableRawColumnTitle\" ");
         }
         $k++;
     }
     if (is_array($array)) {
         $nrows = count($array);
         for ($i = 0; $i < $nrows; $i++) {
             $rowClass = "mTableRawRow" . ($this->zebra ? $i % 2 : '');
             $t->setRowClass($k, $rowClass);
             if (is_array($array[$i])) {
                 $ncols = count($array[$i]);
                 for ($j = 0; $j < $ncols; $j++) {
                     $attr = $this->attr['cell'][$k][$j];
                     if ($attr == '') {
                         $attr = "width=0 align=\"left\" valign=\"top\"";
                     }
                     $t->setCell($k, $j, $array[$i][$j], $attr);
                 }
             } else {
                 $attr = $this->attr['cell'][$k][0];
                 if ($attr == '') {
                     $attr = "width=0 align=\"left\" valign=\"top\"";
                 }
                 $t->setCell($k, 0, $array[$i], $attr);
             }
             $k++;
         }
     }
     return parent::generate();
 }