[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/includes/classes/ -> boxes.php (source)

   1  <?php
   2  /*

   3  $Id: boxes.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 tableBox {
  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  // class constructor

  23      function tableBox($contents, $direct_output = false) {
  24        $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) . '"';
  25        if (tep_not_null($this->table_parameters)) $tableBox_string .= ' ' . $this->table_parameters;
  26        $tableBox_string .= '>' . "\n";
  27  
  28        for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
  29          if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= $contents[$i]['form'] . "\n";
  30          $tableBox_string .= '  <tr';
  31          if (tep_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters;
  32          if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params'];
  33          $tableBox_string .= '>' . "\n";
  34  
  35          if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
  36            for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {
  37              if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) {
  38                $tableBox_string .= '    <td';
  39                if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i][$x]['align']) . '"';
  40                if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {
  41                  $tableBox_string .= ' ' . $contents[$i][$x]['params'];
  42                } elseif (tep_not_null($this->table_data_parameters)) {
  43                  $tableBox_string .= ' ' . $this->table_data_parameters;
  44                }
  45                $tableBox_string .= '>';
  46                if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form'];
  47                $tableBox_string .= $contents[$i][$x]['text'];
  48                if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';
  49                $tableBox_string .= '</td>' . "\n";
  50              }
  51            }
  52          } else {
  53            $tableBox_string .= '    <td';
  54            if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i]['align']) . '"';
  55            if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {
  56              $tableBox_string .= ' ' . $contents[$i]['params'];
  57            } elseif (tep_not_null($this->table_data_parameters)) {
  58              $tableBox_string .= ' ' . $this->table_data_parameters;
  59            }
  60            $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n";
  61          }
  62  
  63          $tableBox_string .= '  </tr>' . "\n";
  64          if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= '</form>' . "\n";
  65        }
  66  
  67        $tableBox_string .= '</table>' . "\n";
  68  
  69        if ($direct_output == true) echo $tableBox_string;
  70  
  71        return $tableBox_string;
  72      }
  73    }
  74  
  75    class infoBox extends tableBox {
  76      function infoBox($contents) {
  77        $info_box_contents = array();
  78        $info_box_contents[] = array('text' => $this->infoBoxContents($contents));
  79        $this->table_cellpadding = '1';
  80        $this->table_parameters = 'class="infoBox"';
  81        $this->tableBox($info_box_contents, true);
  82      }
  83  
  84      function infoBoxContents($contents) {
  85        $this->table_cellpadding = '3';
  86        $this->table_parameters = 'class="infoBoxContents"';
  87        $info_box_contents = array();
  88        $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
  89        for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
  90          $info_box_contents[] = array(array('align' => (isset($contents[$i]['align']) ? $contents[$i]['align'] : ''),
  91                                             'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''),
  92                                             'params' => 'class="boxText"',
  93                                             'text' => (isset($contents[$i]['text']) ? $contents[$i]['text'] : '')));
  94        }
  95        $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
  96        return $this->tableBox($info_box_contents);
  97      }
  98    }
  99  
 100    class infoBoxHeading extends tableBox {
 101      function infoBoxHeading($contents, $left_corner = true, $right_corner = true, $right_arrow = false) {
 102        $this->table_cellpadding = '0';
 103  
 104        if ($left_corner == true) {
 105          $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_left.gif');
 106        } else {
 107          $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_right_left.gif');
 108        }
 109        if ($right_arrow == true) {
 110          $right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'infobox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';
 111        } else {
 112          $right_arrow = '';
 113        }
 114        if ($right_corner == true) {
 115          $right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'infobox/corner_right.gif');
 116        } else {
 117          $right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');
 118        }
 119  
 120        $info_box_contents = array();
 121        $info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"',
 122                                           'text' => $left_corner),
 123                                     array('params' => 'width="100%" height="14" class="infoBoxHeading"',
 124                                           'text' => $contents[0]['text']),
 125                                     array('params' => 'height="14" class="infoBoxHeading" nowrap',
 126                                           'text' => $right_corner));
 127  
 128        $this->tableBox($info_box_contents, true);
 129      }
 130    }
 131  
 132    class contentBox extends tableBox {
 133      function contentBox($contents) {
 134        $info_box_contents = array();
 135        $info_box_contents[] = array('text' => $this->contentBoxContents($contents));
 136        $this->table_cellpadding = '1';
 137        $this->table_parameters = 'class="infoBox"';
 138        $this->tableBox($info_box_contents, true);
 139      }
 140  
 141      function contentBoxContents($contents) {
 142        $this->table_cellpadding = '4';
 143        $this->table_parameters = 'class="infoBoxContents"';
 144        return $this->tableBox($contents);
 145      }
 146    }
 147  
 148    class contentBoxHeading extends tableBox {
 149      function contentBoxHeading($contents) {
 150        $this->table_width = '100%';
 151        $this->table_cellpadding = '0';
 152  
 153        $info_box_contents = array();
 154        $info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"',
 155                                           'text' => tep_image(DIR_WS_IMAGES . 'infobox/corner_left.gif')),
 156                                     array('params' => 'height="14" class="infoBoxHeading" width="100%"',
 157                                           'text' => $contents[0]['text']),
 158                                     array('params' => 'height="14" class="infoBoxHeading"',
 159                                           'text' => tep_image(DIR_WS_IMAGES . 'infobox/corner_right_left.gif')));
 160  
 161        $this->tableBox($info_box_contents, true);
 162      }
 163    }
 164  
 165    class errorBox extends tableBox {
 166      function errorBox($contents) {
 167        $this->table_data_parameters = 'class="errorBox"';
 168        $this->tableBox($contents, true);
 169      }
 170    }
 171  
 172    class productListingBox extends tableBox {
 173      function productListingBox($contents) {
 174        $this->table_parameters = 'class="productListing"';
 175        $this->tableBox($contents, true);
 176      }
 177    }
 178  ?>


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