Text_Wiki
[ class tree: Text_Wiki ] [ index: Text_Wiki ] [ all elements ]

Source for file Table.php

Documentation is available at Table.php

  1. <?php
  2.  
  3.     
  4.     var $conf = array(
  5.         'css_table' => null,
  6.         'css_tr' => null,
  7.         'css_th' => null,
  8.         'css_td' => null
  9.     );
  10.     
  11.     
  12.     /**
  13.     * 
  14.     * Renders a token into text matching the requested format.
  15.     * 
  16.     * @access public
  17.     * 
  18.     * @param array $options The "options" portion of the token (second
  19.     *  element).
  20.     * 
  21.     * @return string The text rendered from the token options.
  22.     * 
  23.     */
  24.     
  25.     function token($options)
  26.     {
  27.         // make nice variable names (type, attr, span)
  28.         extract($options);
  29.         
  30.         $pad '    ';
  31.         
  32.         switch ($type{
  33.         
  34.         case 'table_start':
  35.             $css $this->formatConf(' class="%s"''css_table');
  36.             return "\n\n<table$css>\n";
  37.             break;
  38.         
  39.         case 'table_end':
  40.             return "</table>\n\n";
  41.             break;
  42.         
  43.         case 'row_start':
  44.             $css $this->formatConf(' class="%s"''css_tr');
  45.             return "$pad<tr$css>\n";
  46.             break;
  47.         
  48.         case 'row_end':
  49.             return "$pad</tr>\n";
  50.             break;
  51.         
  52.         case 'cell_start':
  53.             
  54.             // base html
  55.             $html $pad $pad;
  56.             
  57.             // is this a TH or TD cell?
  58.             if ($attr == 'header'{
  59.                 // start a header cell
  60.                 $css $this->formatConf(' class="%s"''css_th');
  61.                 $html .= "<th$css";
  62.             else {
  63.                 // start a normal cell
  64.                 $css $this->formatConf(' class="%s"''css_td');
  65.                 $html .= "<td$css";
  66.             }
  67.             
  68.             // add the column span
  69.             if ($span > 1{
  70.                 $html .= " colspan=\"$span\"";
  71.             }
  72.             
  73.             // add alignment
  74.             if ($attr != 'header' && $attr != ''{
  75.                 $html .= " style=\"text-align: $attr;\"";
  76.             }
  77.             
  78.             // done!
  79.             $html .= '>';
  80.             return $html;
  81.             break;
  82.         
  83.         case 'cell_end':
  84.             if ($attr == 'header'{
  85.                 return "</th>\n";
  86.             else {
  87.                 return "</td>\n";
  88.             }
  89.             break;
  90.         
  91.         default:
  92.             return '';
  93.         
  94.         }
  95.     }
  96. }
  97. ?>

Documentation generated on Mon, 11 Mar 2019 14:28:54 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.