54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
|
|
include_once(realpath(dirname(__FILE__)) . "/../../../../classes/Baseobj.class.php");
|
|
|
|
class Codepromo_codepromo extends PluginsClassiques{
|
|
|
|
var $id;
|
|
var $code;
|
|
var $nom;
|
|
var $description;
|
|
var $action;
|
|
var $valeur;
|
|
var $statut;
|
|
|
|
var $table="codepromo";
|
|
var $bddvars = array("id", "code", "nom", "description", "action", "valeur", "statut");
|
|
|
|
function __construct($id=0){
|
|
parent::__construct();
|
|
|
|
if($id>0)
|
|
$this->charger_id($id);
|
|
}
|
|
|
|
function init(){
|
|
$query = "CREATE TABLE `codepromo` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`nom` varchar(50) NOT NULL,
|
|
`description` text NOT NULL,
|
|
`action` varchar(100) NOT NULL,
|
|
`valeur` float NOT NULL,
|
|
`code` varchar(100) NOT NULL,
|
|
`statut` smallint(6) NOT NULL,
|
|
PRIMARY KEY (`id`)
|
|
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
|
|
$resul = mysql_query($query, $this->link);
|
|
|
|
}
|
|
|
|
function charger($code){
|
|
return $this->getVars("select * from $this->table where code=\"$code\"");
|
|
}
|
|
|
|
function charger_id($id){
|
|
return $this->getVars("select * from $this->table where id=\"$id\"");
|
|
}
|
|
|
|
function charger_statut($code, $statut){
|
|
return $this->getVars("select * from $this->table where code='$code' AND statut IN(" . implode(",", $statut) . ")");
|
|
}
|
|
}
|
|
|
|
?>
|