00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00029 class Listing extends Tpl
00030 {
00031 var $indent;
00032 var $bullet;
00033
00034 function Listing($indent ='', $bullet ='*')
00035 {
00036 static $id = 'Listing_01';
00037
00038 Tpl::Tpl('Listing');
00039 $this->id = $id++;
00040 $this->indent = $indent;
00041 $this->bullet = $bullet;
00042 }
00043
00044 function to_html($indent, $class)
00045 {
00046
00047 $b = $this->bullet;
00048 if ($b=='*')
00049 {
00050 $tag = 'ul';
00051 $type = '';
00052 }
00053 else
00054 {
00055 $tag = 'ol';
00056 $t = substr($b, 0, 1);
00057 $type = "type='$t'";
00058 }
00059
00060 $html = ("\n$indent<$tag $type $class>"
00061 . Tpl::to_html($indent, $class)
00062 . "$indent</$tag>\n");
00063 return $html;
00064 }
00065
00066 function to_xml($indent)
00067 {
00068
00069 $b = $this->bullet;
00070 if ($b=='*')
00071 {
00072 $tag = 'itemizedlist';
00073 $type = '';
00074 }
00075 else
00076 {
00077 $tag = 'orderedlist';
00078 switch ($b)
00079 {
00080 case '1.':
00081 $numeration = 'numeration="arabic"';
00082 break;
00083 case 'a.':
00084 $numeration = 'numeration="loweralpha"';
00085 break;
00086 case 'i.':
00087 $numeration = 'numeration="lowerroman"';
00088 break;
00089 case 'A.':
00090 $numeration = 'numeration="upperalpha"';
00091 break;
00092 case 'I.':
00093 $numeration = 'numeration="upperroman"';
00094 break;
00095 }
00096 }
00097
00098 $html = ("\n$indent<$tag $numeration>"
00099 . Tpl::to_xml($indent)
00100 . "$indent</$tag>\n");
00101 return $html;
00102 }
00103 }
00104 ?>