/**
  * Export to DOM
  * 
  * @return CMbXMLDocument
  */
 function toDOM()
 {
     $this->doc = new CMbXMLDocument("utf-8");
     $this->doc->formatOutput = true;
     $root = $this->doc->createElement("mediboard-export");
     $root->setAttribute("date", CMbDT::dateTime());
     $root->setAttribute("root", $this->object->_guid);
     $this->doc->appendChild($root);
     $this->_toDOM($this->object, $this->depth);
     return $this->doc;
 }
 /**
  * Execute the request
  *
  * @param string $request  Request to execute
  * @param string $location Webservice URL
  * @param string $action   Action
  * @param int    $version  SOAP version
  * @param int    $one_way  One way
  *
  * @see parent::__doRequest
  *
  * @return null|string
  * @throws CMbException
  */
 public function __doRequest($request, $location, $action, $version, $one_way = 0)
 {
     $ca_file = $this->ca_info;
     if ($this->use_tunnel) {
         $tunnel_exist = false;
         $tunnel_pass = CAppUI::conf("eai tunnel_pass");
         $tunnel_object = new CHTTPTunnelObject();
         $tunnels = $tunnel_object->loadActiveTunnel();
         foreach ($tunnels as $_tunnel) {
             if ($_tunnel->checkStatus()) {
                 $location = preg_replace("#[^/]*//[^/]*#", $_tunnel->address, $location);
                 $ca_file = $_tunnel->ca_file;
                 $tunnel_exist = true;
                 break;
             }
         }
         if (!$tunnel_exist && $tunnel_pass === "0") {
             throw new CMbException("Pas de tunnel actif");
         }
     }
     $response = null;
     if ($this->return_mode == "file") {
         $this->doRequestToFile($request, $location, $action, $ca_file);
         return "";
     } elseif ($this->xop_mode) {
         $response = $this->doRequestXOP($request, $location, $action, $ca_file);
     } else {
         $response = parent::__doRequest($request, $location, $action, $version, $one_way);
     }
     if ($this->return_mode == "normal") {
         return $response;
     }
     if (!$response) {
         return null;
     }
     $document = new CMbXMLDocument();
     $document->loadXMLSafe($response, null, true);
     $xpath = new CMbXPath($document);
     $documentElement = $document->documentElement;
     $xpath->registerNamespace($documentElement->prefix, $documentElement->namespaceURI);
     $body = $xpath->queryUniqueNode("/{$documentElement->prefix}:Envelope/{$documentElement->prefix}:Body");
     $new_document = new CMbXMLDocument("UTF-8");
     $new_document->appendChild($new_document->importNode($body->firstChild, true));
     $this->response_body = $new_document->saveXML();
     return $response;
 }
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$modeles_ids = CView::post("modeles_ids", "str");
$object_class = CView::post("object_class", "str");
$owner = CView::post("owner", "str");
CView::checkin();
$modeles_ids = explode("-", $modeles_ids);
CMbArray::removeValue(array(), $modeles_ids);
if (!count($modeles_ids)) {
    CAppUI::stepMessage("Aucun modèle à exporter");
    CApp::rip();
}
$doc = new CMbXMLDocument(null);
$root = $doc->createElement("modeles");
$doc->appendChild($root);
$where = array("compte_rendu_id" => CSQLDataSource::prepareIn($modeles_ids));
// Récupération des header_id, footer_id, preface_id et ending_id
$ds = CSQLDataSource::get("std");
$request = new CRequest();
$request->addTable("compte_rendu");
$request->addWhere($where);
$components_ids = array();
foreach (array("header_id", "footer_id", "preface_id", "ending_id") as $_component) {
    $request->select = array();
    $request->addSelect($_component);
    $components_ids = array_merge($components_ids, $ds->loadColumn($request->makeSelect()));
}
$modeles_ids = array_unique(array_merge($components_ids, $modeles_ids));
CMbArray::removeValue("", $modeles_ids);
foreach ($modeles_ids as $_modele_id) {