57 lines
1.0 KiB
PHP
57 lines
1.0 KiB
PHP
<?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;
|
|
}
|
|
|
|
|