<?php
/**
* Configuration du site
*
* @version $Id$
* @copyright 2009
*/
class admin_config {
var $name = 'Configuration';
var $description = 'Configuration du site';
function index(){
if ($_SERVER['REQUEST_METHOD'] == 'POST')
self::post();
$page = page::open();
$page->module = '../ext/config';
$table = new Data('config');
$table->Select(array(), array('*'), '-categorie');
while($table->next()){
$page->append('conf', $table->row);
} // while
$page->ExeTpl('conf.tpl');
}
private function post(){
$page = page::open();
$table = new Data('config');
$sql = DB_Driver::Open();
$sql->table = "config";
$table->Select();
while($table->next()){
if (isset($_POST[$table->key]) && $_POST[$table->key] != $table->value) {
$sql->Update(array(
'value'=>$_POST[$table->key]
), array(
'key'=>$table->key
)
);
$page->append('msg', "value $table->key updated");
}
} // while
}
}
?>