????
| Current Path : /home2/morganrand/www/store/includes/classes/ |
| Current File : /home2/morganrand/www/store/includes/classes/boxes.php |
<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
class tableBox {
var $table_border = '0';
var $table_width = '100%';
var $table_cellspacing = '0';
var $table_cellpadding = '0';
var $table_parameters = '';
var $table_row_parameters = '';
var $table_data_parameters = '';
// class constructor
function tableBox($contents, $direct_output = false) {
$tableBox_string = '<div';
if (tep_not_null($this->table_parameters)) $tableBox_string .= ' ' . $this->table_parameters;
$tableBox_string .= '>' . "\n";
$tableBox_string .= '<table border="' . tep_output_string($this->table_border) . '" width="' . tep_output_string($this->table_width) . '" cellspacing="' . tep_output_string($this->table_cellspacing) . '" cellpadding="' . tep_output_string($this->table_cellpadding) . '"';
$tableBox_string .= '>' . "\n";
for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= $contents[$i]['form'] . "\n";
$tableBox_string .= ' <tr';
if (tep_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters;
if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params'];
$tableBox_string .= '>' . "\n";
if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {
if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) {
$tableBox_string .= ' <td><div';
if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i][$x]['align']) . '"';
if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {
$tableBox_string .= ' ' . $contents[$i][$x]['params'];
} elseif (tep_not_null($this->table_data_parameters)) {
$tableBox_string .= ' ' . $this->table_data_parameters;
}
$tableBox_string .= '>';
if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form'];
$tableBox_string .= $contents[$i][$x]['text'];
if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';
$tableBox_string .= '</div></td>' . "\n";
}
}
} else {
$tableBox_string .= ' <td><div';
if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i]['align']) . '"';
if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {
$tableBox_string .= ' ' . $contents[$i]['params'];
} elseif (tep_not_null($this->table_data_parameters)) {
$tableBox_string .= ' ' . $this->table_data_parameters;
}
$tableBox_string .= '>' . $contents[$i]['text'] . '</div></td>' . "\n";
}
$tableBox_string .= ' </tr>' . "\n";
if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= '</form>' . "\n";
}
$tableBox_string .= '</table></div>' . "\n";
if ($direct_output == true) echo $tableBox_string;
return $tableBox_string;
}
}
class infoBox extends tableBox {
function infoBox($contents) {
$info_box_contents = array();
$info_box_contents[] = array('text' => $this->infoBoxContents($contents));
$this->table_cellpadding = '0';
$this->table_parameters = '';
$this->tableBox($info_box_contents, true);
}
function infoBoxContents($contents) {
$this->table_cellpadding = '0';
$this->table_parameters = 'class="ui-widget-content"';
$info_box_contents = array();
$info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
$info_box_contents[] = array(array('align' => (isset($contents[$i]['align']) ? $contents[$i]['align'] : ''),
'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''),
'params' => '',
'text' => (isset($contents[$i]['text']) ? $contents[$i]['text'] : '')));
}
$info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
return $this->tableBox($info_box_contents);
}
}
class infoBoxHeading extends tableBox {
function infoBoxHeading($contents, $left_corner = false, $right_corner = false, $right_arrow = false) {
$this->table_cellpadding = '0';
$info_box_contents = array();
$info_box_contents[] = array('params' => 'height="14" class="ui-widget-heading"',
'text' => $contents[0]['text']);
$this->tableBox($info_box_contents, true);
}
}
class contentBox extends tableBox {
function contentBox($contents) {
$info_box_contents = array();
$info_box_contents[] = array('text' => $this->contentBoxContents($contents));
$this->table_cellpadding = '0';
$this->table_parameters = '';
$this->tableBox($info_box_contents, true);
}
function contentBoxContents($contents) {
$this->table_cellpadding = '0';
$this->table_parameters = '';
return $this->tableBox($contents);
}
}
class contentBoxHeading extends tableBox {
function contentBoxHeading($contents) {
$this->table_width = '100%';
$this->table_cellpadding = '0';
$info_box_contents = array();
$info_box_contents[] = array('params' => '',
'text' => $contents[0]['text']);
$this->tableBox($info_box_contents, true);
}
}
class errorBox extends tableBox {
function errorBox($contents) {
$this->table_data_parameters = 'class="ui-state-error"';
$this->tableBox($contents, true);
}
}
class productListingBox extends tableBox {
function productListingBox($contents) {
$this->table_parameters = '';
$this->tableBox($contents, true);
}
}
?>