Ajout module theme

This commit is contained in:
Michael RICOIS 2009-10-27 11:16:57 +00:00
parent 1c1798dec8
commit 334c4f74c4

56
includes/theme/theme.php Normal file
View File

@ -0,0 +1,56 @@
<?php
// Génération de tableau
function theme_table($table, $attrs)
{
$return = '<table'.theme_attr($attrs).'>';
foreach($table['data'] as $row)
{
$return.= theme_tablerow($row['data'], $row['attrs']);
}
$return.= '</table>';
}
//Génération d'une ligne de tableau
function theme_tablerow($data, $attrs)
{
$return = '<tr'.theme_attr($attrs).'>';
if( isset($row['head']) ) $return.= theme_tablehead($row['data']);
else $return.= theme_tablecell($row['data']);
$return.= '</tr>';
return $return;
}
// Génération entete de tableau
function theme_tablehead($data, $attrs)
{
return '<th'.theme_attr($attrs).'>'.$data['data'].'</th>';
}
//Génération cellule
function theme_tablecell($data, $attrs)
{
return '<td'.theme_attr($attrs).'>'.$data['data'].'</td>';
}
//Génération d'un div
function theme_div()
{
}
function theme_attr($attributs)
{
$attrs = '';
if(is_array($attributs) && count($attributs)>0)
{
foreach( $attributes as $attr_name as $attr_value )
{
$attrs.=' '.$attr_name.'="'.$attr_value.'"';
}
}
return $attrs;
}