Пример #1
0
 /**
  * Récupérer les infos sur le Seller
  * 
  * @return string $csv
  */
 public function getSellerIdentity()
 {
     if (isset($this->Seller)) {
         $txt = new ComplexData($this->Seller->getIdentity());
         return $txt->csvArrays();
     } else {
         return 423;
     }
 }
Пример #2
0
 /**
  * retourne la liste de toutes les périodes
  * 
  * @return String $periodes
  */
 public function getAllPeriod()
 {
     $txt = new ComplexData(array());
     $res = $this->db->query("SELECT per_id, per_name FROM t_period_per WHERE per_name != '' AND per_removed = '0'", array());
     while ($don = $this->db->fetchArray($res)) {
         $txt->addLine(array($don['per_id'], $don['per_name']));
     }
     return $txt->csvArrays();
 }
Пример #3
0
 /**
  * Renvoyer la liste des types de recharges.
  * 
  * @param String $type
  * @return String $csv
  */
 public function getTypeRecharge($type = '')
 {
     $txt = new ComplexData(array());
     if ($type == '') {
         $res = $this->db->query("SELECT rty_id, rty_name FROM t_recharge_type_rty WHERE rty_removed = '0' ORDER BY rty_id ASC;");
     } else {
         $res = $this->db->query("SELECT rty_id, rty_name FROM t_recharge_type_rty WHERE rty_removed = '0' AND rty_type = '%s' ORDER BY rty_id ASC;", array($type));
     }
     if ($this->db->affectedRows() >= 1) {
         while ($don = $this->db->fetchArray($res)) {
             $txt->addLine(array($don['rty_id'], $don['rty_name']));
         }
         return $txt->csvArrays();
     } else {
         return 400;
     }
 }
Пример #4
0
 /**
  *
  * @param String $post
  * @return String $state
  */
 public function transactionClientDecode($post)
 {
     $sh = new Sherlocks($this->Buyer);
     $txt = new ComplexData($sh->ClientDecode($post));
     return $txt->csvArrays();
 }
Пример #5
0
 /**
  * donne les points utilisables par une fundation pour faire sa tambouille
  * @return String $csvGroups
  */
 public function getAvailablePoints()
 {
     $rtn = new ComplexData();
     $req = $this->db->query("SELECT poi_id, poi_name FROM t_point_poi WHERE poi_removed = '0';");
     while ($don = $this->db->fetchArray($req)) {
         $poi = new Point($don['poi_id']);
         $rtn->addLine(array($don['poi_id'], $poi->getName()));
     }
     return $rtn->csvArrays();
 }
Пример #6
0
 /**
  * Récupérer un csv du panier.
  * 
  * @return int $state
  */
 public function getCartCsv()
 {
     $txt = new ComplexData(array());
     foreach ($this->Cart as $key => $value) {
         $txt->addLine(array($value['name'], $value['quantity'], $value['credit']));
     }
     return $txt->csvArrays();
 }
Пример #7
0
 /**
  * Retourne un csv qui contient les id_fundation, id_point en fonction de ses droits
  * @param String $droit [optional]
  * @return String $txt
  */
 public function getDroits($droit = '')
 {
     if (isset($this->user)) {
         $txt = new ComplexData(array());
         if ($droit == '') {
             foreach ($this->user->getDroits() as $don) {
                 $txt->addLine(array($don['droit'], $don['fundation']->getId(), $don['fundation']->getName(), $don['id_point']));
             }
         } else {
             foreach ($this->user->getDroits() as $i => $don) {
                 $key = in_array($droit, $don);
                 if ($key) {
                     $txt->addLine(array($don['fundation']->getId(), $don['fundation']->getName(), $don['id_point']));
                 }
             }
         }
         return $txt->csvArrays();
     } else {
         return 409;
     }
 }
Пример #8
0
 /**
  * Fonction qui renvoie les ventes entre 2 dates
  * 
  * @param int $date_start
  * @param int $date_end
  * @return string $csv
  */
 public function getPurchase($date_start, $date_end)
 {
     if ($this->User->isBuckuttTrezo() != 1) {
         return 400;
     }
     $txt = new ComplexData(array());
     $res = $this->db->query("SELECT fun_name, sum(pur_price) AS total, poi_name FROM t_purchase_pur pur, t_fundation_fun fun, t_point_poi poi WHERE pur.poi_id = poi.poi_id AND pur.fun_id = fun.fun_id AND pur.pur_removed = '0' AND UNIX_TIMESTAMP(pur.pur_date) >= '%u' AND UNIX_TIMESTAMP(pur.pur_date) < '%u' GROUP BY pur.fun_id ORDER BY fun.fun_name", array($date_start, $date_end));
     if ($this->db->affectedRows() >= 1) {
         while ($don = $this->db->fetchArray($res)) {
             $txt->addLine(array($don['fun_name'], $don['total'], $don['poi_name']));
         }
         return $txt->csvArrays();
     } else {
         return 400;
     }
 }