/**                                  
  * Debug
  * -------------------------
  **/
 public function Debug($VAL)
 {
     if ($this->Debug) {
         X::Debug($VAL);
     }
     return true;
 }
Exemple #2
0
 /**
  * Make
  * -------------------------
  **/
 public function Make($A, $T = false, $W = false, $C = 'tbl', $TBLID = false, $F = false)
 {
     if (empty($A)) {
         return false;
     }
     foreach ($A as $ID => $r) {
         if ($this->DEBUG) {
             X::Debug($r);
         }
         if (empty($c)) {
             $c = 0;
             if (isset($T['title'])) {
                 $TITLE = $T['title'];
             } else {
                 $TITLE = false;
             }
             $this->Start($TITLE, $TBLID, $W, $C);
             $this->Row('header', false, true);
             if (isset($T['left'])) {
                 foreach ($T['left'] as $t) {
                     if (isset($t['check'])) {
                         $this->Cell($t['check'], 'check', 'check');
                     } else {
                         $this->Cell();
                     }
                 }
             }
             if ($this->DEBUG) {
                 echo "<PRE>";
             }
             foreach ($r as $k => $v) {
                 if ($this->DEBUG) {
                     echo 'KEY: ' . $k . ' - VAL: ';
                     print_r($v);
                     echo "\n";
                 }
                 if (isset($v['CLASS'])) {
                     $this->Cell($k, false, false, $v['CLASS']);
                 } elseif (!in_array($k, ['CLASS', 'ID']) || empty($k)) {
                     $this->Cell($k);
                 }
             }
             if ($this->DEBUG) {
                 echo "</PRE>";
             }
             if (isset($T['right'])) {
                 foreach ($T['right'] as $T) {
                     $this->Cell();
                 }
             }
             $this->RowEnd();
             $this->tBody();
         }
         $clr = 'white';
         if (isset($r['CLASS'])) {
             $clr = $r['CLASS'];
         }
         if (isset($r['ID'])) {
             $ID = $r[$r['ID']];
         }
         $this->Row($clr, $ID);
         if (isset($T['left'])) {
             foreach ($T['left'] as $t) {
                 if (stristr($t['id'], '/')) {
                     $IDnt = $t['id'] . '/' . $r[$t['name']];
                 } else {
                     $IDnt = $t['id'];
                 }
                 if ($IDnt == '...') {
                     $this->Cell(' ');
                 } elseif (isset($t['html'])) {
                     $this->Cell($t['html'], 'class', 'id');
                 } else {
                     if ($t['name'] == 'id') {
                         $this->ToolCell(['icon' => $t['icon']], $IDnt, $ID);
                     } else {
                         $this->ToolCell(['icon' => $t['icon']], $IDnt, $r[$t['name']]);
                     }
                 }
             }
         }
         foreach ($r as $k => $v) {
             $A = false;
             $W = false;
             if (is_array($v)) {
                 if (isset($v['CLASS'])) {
                     $this->Cell($v['VALUE'], $W, $k, $v['CLASS'], $A);
                 } else {
                     $this->Cell(stripslashes(implode("<br>", $v)), $W, $k, false, $A);
                 }
             } elseif (!in_array($k, ['CLASS', 'ID']) || empty($k)) {
                 $this->Cell(stripslashes($v), $W, $k, false, $A);
             }
         }
         if (isset($T['right'])) {
             foreach ($T['right'] as $t) {
                 if (stristr($t['id'], '/')) {
                     $IDnt = $t['id'] . '/' . $r[$t['name']];
                 } else {
                     $IDnt = $t['id'];
                 }
                 if ($IDnt == '...') {
                     $this->Cell(' ');
                 } else {
                     if ($t['name'] == 'id') {
                         $this->ToolCell(['icon' => $t['icon']], $IDnt, $ID);
                     } else {
                         $this->ToolCell(['icon' => $t['icon']], $IDnt, $r[$t['name']]);
                     }
                 }
             }
         }
         $this->RowEnd();
         $c++;
     }
     $this->tBody(1);
     if ($F != false) {
         $this->_R[] = "<tfoot>";
         $this->_R[] = "<tr class='header'>";
         foreach ($F as $val) {
             $this->_R[] = "<td>{$val}</td>";
         }
         $this->_R[] = "</tr>";
         $this->_R[] = "</tfoot>";
     }
     return $this->End();
 }