Пример #1
0
 /**
  * Récupérer un cvs avec les produits disponibles
  *
  * @param object $Seller
  * @return String $csv
  */
 public function getProposition(&$Seller)
 {
     if (isset($this->SelectObject) and $this->SelectObject->getType() == 'category') {
         $Proposition = new Proposition($this->Seller, $this->Buyer, $this->Point, $this->SelectObject);
     } else {
         if (isset($this->SelectObject) and $this->SelectObject->getType() == 'promotion') {
             $Proposition = new Proposition($this->Seller, $this->Buyer, $this->Point, $this->SelectObject, $this->promo_step);
         } else {
             $Proposition = new Proposition($this->Seller, $this->Buyer, $this->Point);
         }
     }
     if ($Proposition->getEndPromo() == 1) {
         unset($this->SelectObject);
         $this->promo_step = 0;
     }
     return $Proposition->getObjectCsvLight();
 }
Пример #2
0
<?php

set_include_path(dirname(_FILE_) . '/../');
require_once 'class/Point.class.php';
require_once 'class/User.class.php';
require_once 'class/Proposition.class.php';
require_once 'class/Object.class.php';
require_once 'class/Price.class.php';
//Pour créer une proposition, on a besoin d'un user et d'un point
$User = new User('6362', 2, '', 1);
echo $User->getId();
$Point = new Point(2);
echo $Point->getId();
echo '<h2>Création</h2>';
$Proposition = new Proposition($User, $Point);
echo $Proposition->getUser()->getFirstname();
echo $Proposition->getPoint()->getName();
$Propo =& $Proposition->getObjectList();
echo '<pre>';
echo $Propo[0]->getName();
echo '</pre>';
$Object = new Object(2);
echo Price::checkPrice($User, $Point, $Object, 150);
echo Price::checkPrice($User, $Point, $Object, 50);
 public function update($id, Proposition $prop)
 {
     $this->_access->update(StudyPressDB::getTableNamePropositions(), array(StudyPressDB::COL_CONTENT_PROPOSITION => $prop->getContent(), StudyPressDB::COL_ID_QUESTION_PROPOSITION => $prop->getQuestionId(), StudyPressDB::COL_TYPE_PROPOSITION => $prop->getType(), StudyPressDB::COL_ORDER_PROPOSITION => $prop->getOrder()), array(StudyPressDB::COL_ID_PROPOSITION => $id));
 }
Пример #4
0
 public static function install()
 {
     self::init();
     global $wpdb;
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     /* Create Devis Table */
     $sql_create_table = 'CREATE TABLE ' . Devis::getTableName() . ' (
         id int(10) unsigned NOT NULL AUTO_INCREMENT,
         utilisateur_id int(11) NOT NULL,
         vehicule_id int(11) NOT NULL,
         state tinyint(3) unsigned NOT NULL,
         creationDate datetime NOT NULL,
         updateDate datetime DEFAULT NULL,
         mailSent tinyint DEFAULT 0 NOT NULL,
         proposition_id int(11) NULL,
         PRIMARY KEY  (id),
         KEY state (state)
     )' . $charset_collate . ';';
     if (dbDelta($sql_create_table)) {
     } else {
     }
     /* Create Dommage Table */
     $sql_create_table = 'CREATE TABLE ' . Dommage::getTableName() . ' (
         id int(11) NOT NULL AUTO_INCREMENT,
         devis_id int(11) NOT NULL,
         piece int(11) NOT NULL,
         type varchar(30) DEFAULT NULL,
         taille varchar(30) DEFAULT NULL,
         peinture char(3) DEFAULT NULL,
         commentaire text,
         demi float NULL,
         complet float NULL,
         simple float NULL,
         complexe float NULL,
         t_mo float NULL,
         qt float NULL,
         tarif float NULL,
         PRIMARY KEY  (id),
         KEY devis_id (devis_id)
     )' . $charset_collate . ';';
     if (dbDelta($sql_create_table)) {
     } else {
     }
     /* Create Photo table */
     $sql_create_table = 'CREATE TABLE ' . Photo::getTableName() . ' (
         id int(11) NOT NULL AUTO_INCREMENT,
         dommage_id int(11) NOT NULL,
         name varchar(50) NOT NULL,
         PRIMARY KEY  (id),
         KEY dommage_id (dommage_id)
     )' . $charset_collate . ';';
     if (dbDelta($sql_create_table)) {
     } else {
     }
     /* Create Utilisateur Table */
     $sql_create_table = 'CREATE TABLE ' . Utilisateur::getTableName() . ' (
         id int(11) NOT NULL AUTO_INCREMENT,
         civilite varchar(5) NOT NULL,
         nom varchar(100) NOT NULL,
         prenom varchar(100) NOT NULL,
         societe varchar(100) DEFAULT NULL,
         code_client varchar(20) DEFAULT NULL,
         adresse varchar(255) NOT NULL,
         cmplt_adresse varchar(255) DEFAULT NULL,
         cp varchar(10) NOT NULL,
         ville varchar(100) NOT NULL,
         pays varchar(50) DEFAULT NULL,
         tel varchar(20) NOT NULL,
         mobile varchar(20) DEFAULT NULL,
         email varchar(100) NOT NULL,
         comment_connu tinyint(4) NOT NULL,
         PRIMARY KEY  (id)
     )' . $charset_collate . ';';
     if (dbDelta($sql_create_table)) {
     } else {
     }
     /* Create Vehicule Table */
     $sql_create_table = 'CREATE TABLE ' . Vehicule::getTableName() . ' (
         id int(11) NOT NULL AUTO_INCREMENT,
         immatriculation varchar(30) NOT NULL,
         marque varchar(50) NOT NULL,
         modele varchar(50) NOT NULL,
         kms int(11) DEFAULT NULL,
         numero_chassis varchar(100) DEFAULT NULL,
         PRIMARY KEY  (id)
     )' . $charset_collate . ';';
     if (dbDelta($sql_create_table)) {
     } else {
     }
     /* Create Devis Table */
     $sql_create_table = 'CREATE TABLE ' . Proposition::getTableName() . ' (
         id int(10) unsigned NOT NULL AUTO_INCREMENT,
         main_oeuvre float  NOT NULL,
         F_prise_charge int  NOT NULL,
         remise int  NOT NULL,
         ht float  NOT NULL,
         ht_r float  NOT NULL,
         tva float  NOT NULL,
         tot float  NOT NULL,
         comment text NULL,
         acompte int  NOT NULL,
         date1 datetime  NOT NULL,
         date2 datetime NOT NULL,
         date3 datetime NOT NULL,
         matin_midi1 tinyint NOT NULL,
         matin_midi2 tinyint NOT NULL,
         matin_midi3 tinyint NOT NULL,
         PRIMARY KEY  (id)
     )' . $charset_collate . ';';
     if (dbDelta($sql_create_table)) {
     } else {
     }
     add_option('dw_devis_db_version', self::DB_VERSION);
     /* TODO : [création | modification] du répertoire upload avec les bons droits */
     return true;
 }