Example #1
0
 function ficheAction($id, $r_controller = null, $r_action = null, $r_id = null)
 {
     $retour = "";
     if (!is_null($r_id)) {
         $retour = $r_controller . "/" . $r_action . "/" . $r_id . $this->r_parameters;
     }
     $this->view->setVar("retour", $retour);
     if (!$this->request->isPost()) {
         $igo_couche = IgoCouche::findFirstByid($id);
         if (!$igo_couche) {
             $this->flash->error("Couche {$id} non-trouvée");
             return $this->dispatcher->forward(array("controller" => $this->ctlName, "action" => "index"));
         }
         if (!isset($igo_couche->IgoGeometrie->IgoClasseEntite->IgoCatalogueCsw)) {
             $this->view->setVar("fiche", "Catalogue non-trouvé");
             return;
         }
         $catalogue = $igo_couche->IgoGeometrie->IgoClasseEntite->IgoCatalogueCsw->url;
         $fiche_csw_id = $igo_couche->fiche_csw_id;
         if (trim($fiche_csw_id) == "") {
             $fiche_csw_id = $igo_couche->mf_layer_name;
             //TODO devrait être fait par la réingénierie. Préséence à msp_class_meta
         }
         $url = "http://" . $catalogue . "?SERVICE=CSW&VERSION=2.0.2&REQUEST=GetRecordById&outputSchema=csw:IsoRecord&ID={$fiche_csw_id}&elementSetName=full";
         try {
             $xml = parent::curl_file_get_contents($url);
             $this->view->setVar("fiche", $this->transform($xml, file_get_contents("xml/bs_full.xsl")));
         } catch (Exception $e) {
             $this->view->setVar("fiche", "Erreur lors de l'accès au catalogue");
         }
     }
 }