Example #1
0
 /**
  * ajoute un prix
  * @param int $obj_id
  * @param int $grp_id
  * @param int $per_id
  * @param int $pri_credit
  * @return String $csvResult
  */
 public function addPrice($obj_id, $grp_id, $per_id, $pri_credit)
 {
     $rtn = new ComplexData();
     $obj = new Object($obj_id);
     if ($obj->getState() != 1) {
         $rtn->addLine(array($obj->getState(), 0));
         return $rtn->csvArrays();
     }
     $grp = new Group($grp_id);
     if ($grp->getState() != 1) {
         $rtn->addLine(array($grp->getState(), 0));
         return $rtn->csvArrays();
     }
     $per = new Period($per_id);
     if ($per->getState() != 1) {
         $rtn->addLine(array($per->getState(), 0));
         return $rtn->csvArrays();
     }
     $price = new Price(0, $obj, $grp, $per, $pri_credit);
     $rtn->addLine(array($price->getState(), $price->getId()));
     return $rtn->csvArrays();
 }
Example #2
0
<?php

set_include_path(dirname(_FILE_) . '/../');
require_once 'class/Object.class.php';
require_once 'class/Group.class.php';
require_once 'class/Price.class.php';
//Pour créer un prix, on a besoin d'un objet et d'un groupe
$Objet = new Object(2);
$Group = new Group(2);
$Group1 = new Group(1);
/*
echo '<h2>Création</h2>';
$Price = new Price(0, $Objet, $Group, 150);

echo $Price->getState();
echo $Price->getId();
echo $Price->getObject()->getName();
echo $Price->getGroup()->getName();
*/
echo '<h2>Lecture</h2>';
$Price = new Price(1);
echo $Price->getState();
echo $Price->getId();
echo $Price->getObject()->getName();
echo $Price->getGroup()->getName();
//echo $Price->setCredit(50);
//echo $Price->setGroup($Group);
echo $Price->remove();