public function showItems()
 {
     $GLOBALS['phpgw']->js->validate_file('yui3', 'yui/yui-min', 'phpgwapi');
     $GLOBALS['phpgw']->js->validate_file('yahoo', 'bim.modellist', 'bim');
     $modelId = phpgw::get_var("modelId");
     //$modelId = 3;
     if (empty($modelId)) {
         echo "No modelId!";
     } else {
         $GLOBALS['phpgw']->xslttpl->add_file(array('bim_showitems'));
         $sobimitem = new sobimitem_impl($this->db);
         $sobimitem->setModelId($modelId);
         $bobimitem = new bobimitem_impl();
         $bobimitem->setSobimitem($sobimitem);
         $items = $bobimitem->fetchItemsByModelId();
         $bimItems = array();
         $count = count($items);
         foreach ($items as $bimItem) {
             /* @var $bimItem BimItem*/
             array_push($bimItems, $bimItem->transformObjectToArray());
             //$bimItem->);
         }
         //$bimItems = print_r($items, true);
         $data = array('someData' => "data", 'modelId' => $modelId, 'count' => $count, 'bimItems' => array("item" => $bimItems));
         $this->setupBimCss();
         $GLOBALS['phpgw']->xslttpl->set_var('bimitems', $data);
     }
 }
예제 #2
0
 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();
 }
예제 #3
0
 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);
     }
 }