|
ZenCart_Documentation
1.5.0
http://www.collinsharper.com
|
00001 <?php 00002 // 00003 // +----------------------------------------------------------------------+ 00004 // |zen-cart Open Source E-commerce | 00005 // +----------------------------------------------------------------------+ 00006 // | Copyright (c) 2003 The zen-cart developers | 00007 // | | 00008 // | http://www.zen-cart.com/index.php | 00009 // | | 00010 // | Portions Copyright (c) 2003 osCommerce | 00011 // +----------------------------------------------------------------------+ 00012 // | This source file is subject to version 2.0 of the GPL license, | 00013 // | that is bundled with this package in the file LICENSE, and is | 00014 // | available through the world-wide-web at the following url: | 00015 // | http://www.zen-cart.com/license/2_0.txt. | 00016 // | If you did not receive a copy of the zen-cart license and are unable | 00017 // | to obtain it through the world-wide-web, please send a note to | 00018 // | [email protected] so we can mail you a copy immediately. | 00019 // +----------------------------------------------------------------------+ 00020 // $Id: table_block.php 1969 2005-09-13 06:57:21Z drbyte $ 00021 // 00022 00023 class tableBlock { 00024 var $table_border = '0'; 00025 var $table_width = '100%'; 00026 var $table_cellspacing = '0'; 00027 var $table_cellpadding = '2'; 00028 var $table_parameters = ''; 00029 var $table_row_parameters = ''; 00030 var $table_data_parameters = ''; 00031 00032 function tableBlock($contents) { 00033 $tableBox_string = ''; 00034 00035 $form_set = false; 00036 if (isset($contents['form'])) { 00037 $tableBox_string .= $contents['form'] . "\n"; 00038 $form_set = true; 00039 array_shift($contents); 00040 } 00041 00042 $tableBox_string .= '<table border="' . $this->table_border . '" width="' . $this->table_width . '" cellspacing="' . $this->table_cellspacing . '" cellpadding="' . $this->table_cellpadding . '"'; 00043 if (zen_not_null($this->table_parameters)) $tableBox_string .= ' ' . $this->table_parameters; 00044 $tableBox_string .= '>' . "\n"; 00045 00046 for ($i=0, $n=sizeof($contents); $i<$n; $i++) { 00047 $tableBox_string .= ' <tr'; 00048 if (zen_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters; 00049 if (isset($contents[$i]['params']) && zen_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params']; 00050 $tableBox_string .= '>' . "\n"; 00051 00052 if (isset($contents[$i][0]) && is_array($contents[$i][0])) { 00053 for ($x=0, $y=sizeof($contents[$i]); $x<$y; $x++) { 00054 if (isset($contents[$i][$x]['text']) && zen_not_null(isset($contents[$i][$x]['text']))) { 00055 $tableBox_string .= ' <td'; 00056 if (isset($contents[$i][$x]['align']) && zen_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . $contents[$i][$x]['align'] . '"'; 00057 if (isset($contents[$i][$x]['params']) && zen_not_null(isset($contents[$i][$x]['params']))) { 00058 $tableBox_string .= ' ' . $contents[$i][$x]['params']; 00059 } elseif (zen_not_null($this->table_data_parameters)) { 00060 $tableBox_string .= ' ' . $this->table_data_parameters; 00061 } 00062 $tableBox_string .= '>'; 00063 if (isset($contents[$i][$x]['form']) && zen_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form']; 00064 $tableBox_string .= $contents[$i][$x]['text']; 00065 if (isset($contents[$i][$x]['form']) && zen_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>'; 00066 $tableBox_string .= '</td>' . "\n"; 00067 } 00068 } 00069 } else { 00070 $tableBox_string .= ' <td'; 00071 if (isset($contents[$i]['align']) && zen_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . $contents[$i]['align'] . '"'; 00072 if (isset($contents[$i]['params']) && zen_not_null($contents[$i]['params'])) { 00073 $tableBox_string .= ' ' . $contents[$i]['params']; 00074 } elseif (zen_not_null($this->table_data_parameters)) { 00075 $tableBox_string .= ' ' . $this->table_data_parameters; 00076 } 00077 $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n"; 00078 } 00079 00080 $tableBox_string .= ' </tr>' . "\n"; 00081 } 00082 00083 $tableBox_string .= '</table>' . "\n"; 00084 00085 if ($form_set == true) $tableBox_string .= '</form>' . "\n"; 00086 00087 return $tableBox_string; 00088 } 00089 } 00090 ?>