public function testGetStuff() { $theXml = $this->getFacilityManagementXmlWithValidIfc(); $bobimitem = new bobimitem_impl(); $this->sobimitem = new sobimitem_impl($this->db); $bobimitem->setModelId(3); $bobimitem->setIfcXml($theXml); $bobimitem->setSobimitem($this->sobimitem); $bobimitem->setSobimtype(new sobimtype_impl($this->db)); $bobimitem->loadIfcItemsIntoDatabase(); }
public function getFacilityManagementXmlByModelId($modelId = null) { $GLOBALS['phpgw_info']['flags']['noheader'] = true; $GLOBALS['phpgw_info']['flags']['nofooter'] = true; $GLOBALS['phpgw_info']['flags']['xslt_app'] = false; header("Content-type: application/xml"); $restUrl = $this->bimconverterUrl; if ($modelId == null) { $modelId = (int) phpgw::get_var("modelId"); } //echo "ModelId is:".$modelId; $bobimmodel = new bobimmodel_impl(); $sovfs = new sovfs_impl(); $sovfs->setSubModule(self::$virtualFileSystemPath); $bobimmodel->setVfsObject($sovfs); $sobimmodel = new sobimmodel_impl($this->db); $sobimmodel->setModelId($modelId); $bobimmodel->setSobimmodel($sobimmodel); $sobimmodelinformation = new sobimmodelinformation_impl($this->db, $modelId); try { if ($bobimmodel->checkBimModelIsUsed()) { throw new Exception("Model is already in use!"); } $ifcFileWithRealPath = $bobimmodel->getIfcFileNameWithRealPath(); $xmlResult = $this->getFacilityManagementXmlFromIfc($ifcFileWithRealPath); $bobimitem = new bobimitem_impl(); $bobimitem->setSobimmodelinformation($sobimmodelinformation); $bobimitem->setIfcXml($xmlResult); $bobimitem->setSobimitem(new sobimitem_impl($this->db)); $bobimitem->setSobimtype(new sobimtype_impl($this->db)); $bobimitem->loadIfcItemsIntoDatabase(); $result = array(); $result["result"] = 1; $result["error"] = ""; echo json_encode($result); } catch (NoResponseException $e) { $result = array(); $result["result"] = 0; $result["error"] = "Could not connect to BIM converter rest service!"; $result["Exception"] = $e; echo json_encode($result); } catch (Exception $e) { $result = array(); $result["result"] = 0; $result["error"] = "General error!\nMessage: " . $e->getMessage(); echo json_encode($result); } }