Exemplo n.º 1
0
 /**
  * Destructor
  *
  * @access public
  * @return null
  */
 public function __destruct()
 {
     if ($this->object_retour->statut != self::STATE_ERROR && $this->object_retour->statut != self::STATE_ERROR_AUTH) {
         $this->object_retour->statut = self::STATE_FINISH;
     }
     $strSorti = "";
     $fin = new SimpleObject\OdaDate();
     $this->object_retour->metro["ODAEnd"] = $fin->getDateTimeWithMili();
     $endMicro = SimpleObject\OdaDate::getMicro();
     $duree = $endMicro - $this->startMicro;
     $this->object_retour->metro["ODADuree"] = $duree;
     //choix du traitement
     switch ($this->modeSortie) {
         case "text":
             $strSorti = OdaLib::fomatage_text($this->object_retour);
             break;
         case "json":
             $strSorti = OdaLib::fomatage_json($this->object_retour);
             break;
         case "xml":
             $strSorti = OdaLib::fomatage_xml($this->object_retour->data);
             break;
         case "csv":
             $strSorti = OdaLib::fomatage_csv($this->object_retour->data);
             break;
         default:
             $strSorti = OdaLib::fomatage_text($this->object_retour);
             break;
     }
     if (!is_null($this->BD_ENGINE)) {
         $this->_finishTransaction($strSorti, $fin);
     }
     if (!empty($this->fileName) && !empty($this->modeSortie)) {
         header("Content-type: text/" . $this->modeSortie . "; charset=utf-8");
         header("Content-Disposition: attachment; filename=" . $this->fileName . "." . $this->modeSortie);
         header("Pragma: no-cache");
         header("Expires: 0");
         echo "";
         // UTF-8 BOM
         echo $strSorti;
     } else {
         echo $strSorti;
     }
 }