[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/includes/classes/ -> table_block.php (source)

   1  <?php
   2  /*

   3  $Id: table_block.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13    class tableBlock {
  14      var $table_border = '0';
  15      var $table_width = '100%';
  16      var $table_cellspacing = '0';
  17      var $table_cellpadding = '2';
  18      var $table_parameters = '';
  19      var $table_row_parameters = '';
  20      var $table_data_parameters = '';
  21  
  22      function tableBlock($contents) {
  23        $tableBox_string = '';
  24  
  25        $form_set = false;
  26        if (isset($contents['form'])) {
  27          $tableBox_string .= $contents['form'] . "\n";
  28          $form_set = true;
  29          array_shift($contents);
  30        }
  31  
  32        $tableBox_string .= '<table border="' . $this->table_border . '" width="' . $this->table_width . '" cellspacing="' . $this->table_cellspacing . '" cellpadding="' . $this->table_cellpadding . '"';
  33        if (tep_not_null($this->table_parameters)) $tableBox_string .= ' ' . $this->table_parameters;
  34        $tableBox_string .= '>' . "\n";
  35  
  36        for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
  37          $tableBox_string .= '  <tr';
  38          if (tep_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters;
  39          if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params'];
  40          $tableBox_string .= '>' . "\n";
  41  
  42          if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
  43            for ($x=0, $y=sizeof($contents[$i]); $x<$y; $x++) {
  44              if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) {
  45                $tableBox_string .= '    <td';
  46                if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . $contents[$i][$x]['align'] . '"';
  47                if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {
  48                  $tableBox_string .= ' ' . $contents[$i][$x]['params'];
  49                } elseif (tep_not_null($this->table_data_parameters)) {
  50                  $tableBox_string .= ' ' . $this->table_data_parameters;
  51                }
  52                $tableBox_string .= '>';
  53                if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form'];
  54                $tableBox_string .= $contents[$i][$x]['text'];
  55                if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';
  56                $tableBox_string .= '</td>' . "\n";
  57              }
  58            }
  59          } else {
  60            $tableBox_string .= '    <td';
  61            if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . $contents[$i]['align'] . '"';
  62            if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {
  63              $tableBox_string .= ' ' . $contents[$i]['params'];
  64            } elseif (tep_not_null($this->table_data_parameters)) {
  65              $tableBox_string .= ' ' . $this->table_data_parameters;
  66            }
  67            $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n";
  68          }
  69  
  70          $tableBox_string .= '  </tr>' . "\n";
  71        }
  72  
  73        $tableBox_string .= '</table>' . "\n";
  74  
  75        if ($form_set == true) $tableBox_string .= '</form>' . "\n";
  76  
  77        return $tableBox_string;
  78      }
  79    }
  80  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7