[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7014] BIM: merge from bim-branch
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7014] BIM: merge from bim-branch |
Date: |
Wed, 16 Feb 2011 14:10:41 +0000 |
Revision: 7014
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7014
Author: sigurdne
Date: 2011-02-16 14:10:41 +0000 (Wed, 16 Feb 2011)
Log Message:
-----------
BIM: merge from bim-branch
Modified Paths:
--------------
trunk/bim/inc/class.bimitem.inc.php
trunk/bim/inc/class.bimmodel.inc.php
trunk/bim/inc/class.bimmodelinformation.inc.php
trunk/bim/inc/class.boattribute.inc.php
trunk/bim/inc/class.boattribute_owner.inc.php
trunk/bim/inc/class.bogroup.inc.php
trunk/bim/inc/class.boitem.inc.php
trunk/bim/inc/class.menu.inc.php
trunk/bim/inc/class.sobim_converter.inc.php
trunk/bim/inc/class.sobim_repository.inc.php
trunk/bim/inc/class.sobimmodelinformation.inc.php
trunk/bim/inc/class.soitem.inc.php
trunk/bim/inc/class.soitem_group.inc.php
trunk/bim/inc/class.sovfs.inc.php
trunk/bim/inc/class.uibimitem.inc.php
trunk/bim/inc/class.uiifc.inc.php
trunk/bim/inc/class.uiitem.inc.php
Added Paths:
-----------
trunk/bim/inc/class.bobimitem.inc.php
trunk/bim/inc/class.bobimmodel.inc.php
trunk/bim/inc/class.sobimitem.inc.php
trunk/bim/inc/class.sobimmodel.inc.php
trunk/bim/inc/class.uibim.inc.php
trunk/bim/index.php
trunk/bim/js/
trunk/bim/js/yahoo/
trunk/bim/js/yahoo/bim.modellist.js
trunk/bim/setup/
trunk/bim/setup/setup.inc.php
trunk/bim/setup/tables_current.inc.php
trunk/bim/setup/tables_update.inc.php
trunk/bim/templates/
trunk/bim/templates/base/
trunk/bim/templates/base/app_data.xsl
trunk/bim/templates/base/bim_modelinformation.xsl
trunk/bim/templates/base/bim_showSingleItem.xsl
trunk/bim/templates/base/bim_showitems.xsl
trunk/bim/templates/base/bim_showmodels.xsl
trunk/bim/templates/base/bim_upload_ifc.xsl
trunk/bim/templates/base/bim_upload_ifc_result.xsl
trunk/bim/templates/base/config.tpl
trunk/bim/templates/base/css/
trunk/bim/templates/base/css/bim.css
trunk/bim/templates/base/images/
trunk/bim/templates/base/images/ajaxLoader.gif
trunk/bim/templates/default/
trunk/bim/tests/
trunk/bim/tests/BIM/
trunk/bim/tests/BIM/PropertyBimTestSuite.php
trunk/bim/tests/BIM/TestBObimitem.php
trunk/bim/tests/BIM/TestBObimmodel.php
trunk/bim/tests/BIM/TestBimCommon.php
trunk/bim/tests/BIM/TestBimmodelinformation_solo.php
trunk/bim/tests/BIM/TestSObim_converter_solo.php
trunk/bim/tests/BIM/TestSObim_solo.php
trunk/bim/tests/BIM/TestSObimitem.php
trunk/bim/tests/BIM/TestSObimmodel.php
trunk/bim/tests/BIM/TestSObimmodelinformation.php
trunk/bim/tests/BIM/TestSObimrest_solo.php
trunk/bim/tests/BIM/TestSObimtype.php
trunk/bim/tests/BIM/TestSOvfs.php
trunk/bim/tests/BIM/TestUIbim.php
trunk/bim/tests/BIM/restTestFile.txt
trunk/bim/tests/BIM/testData.xml
trunk/bim/tests/BIM/valid_ifc_example.ifc
trunk/bim/tests/BIM/wholeModelOutputExample.xml
Modified: trunk/bim/inc/class.bimitem.inc.php
===================================================================
--- trunk/bim/inc/class.bimitem.inc.php 2011-02-16 09:49:40 UTC (rev 7013)
+++ trunk/bim/inc/class.bimitem.inc.php 2011-02-16 14:10:41 UTC (rev 7014)
@@ -1,5 +1,5 @@
<?php
-phpgw::import_class('property.bimobject');
+phpgw::import_class('bim.bimobject');
class BimItem extends BimObject{
private $databaseId;
private $guid;
@@ -43,4 +43,4 @@
$this->modelId = $id;
}
-}
\ No newline at end of file
+}
Modified: trunk/bim/inc/class.bimmodel.inc.php
===================================================================
--- trunk/bim/inc/class.bimmodel.inc.php 2011-02-16 09:49:40 UTC (rev
7013)
+++ trunk/bim/inc/class.bimmodel.inc.php 2011-02-16 14:10:41 UTC (rev
7014)
@@ -1,5 +1,5 @@
<?php
-phpgw::import_class('property.bimobject');
+phpgw::import_class('bim.bimobject');
class BimModel extends BimObject{
private $databaseId;
private $name;
@@ -74,4 +74,4 @@
return (bool)($this->usedItemCount > 0);
}
}
-}
\ No newline at end of file
+}
Modified: trunk/bim/inc/class.bimmodelinformation.inc.php
===================================================================
--- trunk/bim/inc/class.bimmodelinformation.inc.php 2011-02-16 09:49:40 UTC
(rev 7013)
+++ trunk/bim/inc/class.bimmodelinformation.inc.php 2011-02-16 14:10:41 UTC
(rev 7014)
@@ -1,5 +1,5 @@
<?php
-phpgw::import_class('property.bimobject');
+phpgw::import_class('bim.bimobject');
class BimModelInformation extends BimObject{
private $authorization;
@@ -124,4 +124,4 @@
public function getNativeSchema() {
return $this->nativeSchema;
}
-}
\ No newline at end of file
+}
Modified: trunk/bim/inc/class.boattribute.inc.php
===================================================================
--- trunk/bim/inc/class.boattribute.inc.php 2011-02-16 09:49:40 UTC (rev
7013)
+++ trunk/bim/inc/class.boattribute.inc.php 2011-02-16 14:10:41 UTC (rev
7014)
@@ -4,7 +4,7 @@
*
* @author Espen
*/
- class property_boattribute
+ class bim_boattribute
{
private $id, $name, $display_name, $value, $data_type, $unit, $desc;
Modified: trunk/bim/inc/class.boattribute_owner.inc.php
===================================================================
--- trunk/bim/inc/class.boattribute_owner.inc.php 2011-02-16 09:49:40 UTC
(rev 7013)
+++ trunk/bim/inc/class.boattribute_owner.inc.php 2011-02-16 14:10:41 UTC
(rev 7014)
@@ -5,7 +5,7 @@
* @author Espen
* @abstract
*/
- abstract class property_boattribute_owner
+ abstract class bim_boattribute_owner
{
protected $attributes;
@@ -20,10 +20,10 @@
*
* @abstract
* @param string $attr_def
- * @param property_boattribute $attr
+ * @param bim_boattribute $attr
* @return bool FALSE if failed, TRUE otherwise.
*/
- public abstract function set_attribute($attr_def, property_boattribute
$attr);
+ public abstract function set_attribute($attr_def, bim_boattribute
$attr);
/**
@@ -34,7 +34,7 @@
*/
public function get_attribute($attr_def)
{
- return ($this->attributes[$attr_def] instanceof
property_boattribute ? $this->attributes[$attr_def] : null);
+ return ($this->attributes[$attr_def] instanceof bim_boattribute ?
$this->attributes[$attr_def] : null);
}
Added: trunk/bim/inc/class.bobimitem.inc.php
===================================================================
--- trunk/bim/inc/class.bobimitem.inc.php (rev 0)
+++ trunk/bim/inc/class.bobimitem.inc.php 2011-02-16 14:10:41 UTC (rev
7014)
@@ -0,0 +1,137 @@
+<?php
+
+ phpgw::import_class('bim.bimmodelinformation');
+
+ interface bobimitem {
+ public function setIfcXml(SimpleXMLElement $xml);
+ public function setSobimitem(sobimitem $sobimitem);
+ public function setSobimtype(sobimtype $sobimtype);
+ public function setSobimmodelinformation(sobimmodelinformation
$sobimmodelinformation);
+ public function loadIfcItemsIntoDatabase();
+ public function fetchItemsByModelId();
+ }
+
+ class bobimitem_impl implements bobimitem {
+ private $ifcXml;
+ /* @var $sobimitem sobimitem */
+ private $sobimitem;
+ private $sobimtype;
+ private $sobimmodelinformation;
+
+ public function __construct() {
+
+ }
+
+ public function loadIfcItemsIntoDatabase() {
+ $this->checkArguments();
+ /* @var $modelInfo SimpleXMLElement */
+ $modelInfo = $this->ifcXml->modelInformation[0];
+ $modelInfoXml = $modelInfo->asXML();
+ $bimmodelInformation = new BimModelInformation();
+ $bimmodelInformation->loadVariablesFromXml($modelInfo);
+
$this->sobimmodelinformation->setBimModelInformation($bimmodelInformation);
+ try {
+
$this->sobimmodelinformation->updateModelInformation();
+ } catch (Exception $e) {
+ throw $e;
+ }
+ //var_dump($this->ifcXml);
+
+ $BimItems = $this->loopThrough();
+
+ foreach($BimItems as $item) {
+ $type = $item->getType();
+ try {
+
$this->sobimtype->addBimObjectType($type);
+ } catch (Exception $e) {
+ // do nothing
+ }
+ try {
+ $this->sobimitem->addBimItem($item);
+ } catch (BimDataException $e) {
+ throw new BimDataException("Data
exception\n MSG:".$e->getMessage()."\nReason:".$e->getPrevious()->getMessage(),
$e);
+ //echo "Data exception with
message:".$e->getMessage()."\n";
+ //echo
"Reason:".$e->getPrevious()->getMessage();
+ //break;
+ }
+ }
+
+ }
+
+ private function loopThrough() {
+ $BimItemArray = array();
+ /* @var $second_gen SimpleXMLElement */
+ foreach ($this->ifcXml->children() as $second_gen) {
+ //echo "Child with
name:".$second_gen->getName()."\n";
+ if ( $second_gen['ifcObjectType']) {
+ $bimItem =
$this->createBimItem($second_gen);
+ array_push($BimItemArray, $bimItem);
+
+ } else if($second_gen->getName() !=
"modelInformation") {
+ /* @var $third_gen SimpleXMLElement */
+ foreach ($second_gen->children() as
$third_gen) {
+ if (
$third_gen['ifcObjectType']) {
+ $bimItem =
$this->createBimItem($third_gen);
+
array_push($BimItemArray, $bimItem);
+
+ } else {
+ echo "Could not add
item, missing attribute, item:".$third_gen->asXML();
+ }
+ }
+ }
+ }
+ return $BimItemArray;
+ }
+ /*
+ * Needs the following variables set
+ * sobimitem (with modelId set)
+ *
+ */
+ public function fetchItemsByModelId() {
+ $this->checkFetchArguments();
+ return $this->sobimitem->retrieveItemsByModelId();
+ }
+ /*
+ * @throws IncompleteItemException if the ifc object is missing
anything
+ */
+ private function createBimItem(& $ifcObject) {
+ $guid = $ifcObject->attributes->guid;
+ $type = $ifcObject['ifcObjectType'];
+ $xml = $ifcObject->asXML();
+ if(empty($guid) || empty($type) || empty($xml)) {
+ $currentItem = "GUID:".$guid."\n".
+
"Type:".$type."\n".
+ "XML:".$xml;
+ throw new IncompleteItemException($currentItem);
+ }
+ // return new BimItem(null, $guid, $type, $xml,
$this->sobimitem->getModelId());
+ return new BimItem(null, $guid, $type, $xml,
$this->sobimmodelinformation->getModelId());// Sigurd 15.feb 2011: this one
seems to work
+ }
+
+ private function checkFetchArguments() {
+ if(!$this->sobimitem) {
+ throw new InvalidArgumentException("Missing
sobimitem");
+ }
+ }
+ private function checkArguments() {
+ if(empty($this->ifcXml) || empty($this->sobimitem) ||
empty($this->sobimtype) || empty($this->sobimmodelinformation)) {
+ $args = "IfcXml
type:".gettype($this->ifcXml)."\n".
+ "Sobimitem
type:".gettype($this->sobimitem)."\n".
+ "Sobimtype
type:".gettype($this->sobimtype)."\n".
+ "Sobimmodelinformation
type:".gettype($this->sobimmodelinformation)."\n";
+ throw new
InvalidArgumentException("BObimitem:Incorrect arguments\b".$args);
+ }
+ }
+ public function setSobimmodelinformation(sobimmodelinformation
$sobimmodelinformation) {
+ $this->sobimmodelinformation = $sobimmodelinformation;
+ }
+ public function setIfcXml(SimpleXMLElement $xml) {
+ $this->ifcXml = $xml;
+ }
+ public function setSobimitem(sobimitem $sobimitem) {
+ $this->sobimitem = $sobimitem;
+ }
+ public function setSobimtype(sobimtype $sobimType){
+ $this->sobimtype = $sobimType;
+ }
+ }
Added: trunk/bim/inc/class.bobimmodel.inc.php
===================================================================
--- trunk/bim/inc/class.bobimmodel.inc.php (rev 0)
+++ trunk/bim/inc/class.bobimmodel.inc.php 2011-02-16 14:10:41 UTC (rev
7014)
@@ -0,0 +1,228 @@
+<?php
+/*
+ * Business logic class for creating new BIM models in Portico
+ * This class is designed with dependancy injection in mind
+ */
+/*phpgw::import_class('bim.bimExceptions');
+phpgw::import_class('bim.sobim');
+phpgw::import_class('bim.sobimmodel');
+phpgw::import_class('bim.sovfs');*/
+interface bobimmodel {
+ public function addUploadedIfcModel();
+ public function createBimModelList();
+ public function setVfsObject(sovfs $vfs);
+ public function setSobimmodel(sobimmodel $sobimmodel);
+ public function checkBimModelExists();
+ public function checkBimModelExistsByModelId();
+ public function checkBimModelIsUsed();
+ public function removeIfcModel();
+ public function removeIfcModelByModelId();
+ public function setModelName($name);
+ public function getModelName();
+ public function getIfcFileNameWithRealPath();
+}
+
+class bobimmodel_impl implements bobimmodel {
+ private $sovfs;
+ private $sobimmodel;
+ private $modelName;
+ function __construct() {
+
+ }
+
+ public function setVfsObject(sovfs $vfs) {
+ $this->sovfs = $vfs;
+ }
+ public function setSobimmodel(sobimmodel $sobimmodel) {
+ $this->sobimmodel = $sobimmodel;
+ }
+ /*
+ * taken from calss.uitts.inc.php
+ * @return boolean true if success
+ * @throws FileExistsException if filename is already used
+ * @throws CopyFailureException if there is a failure copying
+ */
+
+ public function addUploadedIfcModel() {
+ if(!$this->sovfs) {
+ throw new Exception('Missing vfs object!');
+ }
+ try {
+ $filename = $this->saveUploadedBimData();
+ $this->applyModelName($filename);
+ $file_database_id = $this->sovfs->retrieveVfsFileId();
+ $this->sobimmodel->setVfsdatabaseid($file_database_id);
+ $this->sobimmodel->setModelName($this->modelName);
+ $this->sobimmodel->addBimModel();
+ return true;
+ } catch (FileExistsException $e) {
+ throw $e;
+ } catch (CopyFailureException $e) {
+ throw $e;
+ } catch ( ModelExistsException $e) {
+ throw $e;
+ }catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ private function applyModelName($filename) {
+ if(!($this->modelName && strlen($this->modelName)>0)) {
+ $this->modelName = $filename;
+ }
+ }
+ /*
+ * requires sobimmodel with db set
+ */
+ public function createBimModelList() {
+ if(!$this->sobimmodel) {
+ throw new Exception('Missing sobimodel object!');
+ }
+ $BimModelArray = $this->sobimmodel->retrieveBimModelList();
+ if(!$BimModelArray) {
+ return null;
+ } else {
+ $outputArray = array();
+
+ foreach($BimModelArray as $BimModel) {
+ //var_dump($BimModel);
+ /* @var $BimModel BimModel */
+ //array_push($outputArray,
$this->transformObjectToArray($BimModel));
+ array_push($outputArray,
$BimModel->transformObjectToArray());
+ }
+ return $outputArray;
+ }
+
+ }
+
+
+ /*
+ * This function requires:
+ * An SOvfs object with the filename and the submodule set
+ * An sobimmodel object with the modelname and the vfs_database_id
+ */
+ public function checkBimModelExists() {
+ if(!$this->sobimmodel || !$this->sovfs) {
+ throw new
InvalidArgumentException($this->displayArguments());
+ }
+ if($this->sovfs->checkIfFileExists()) {
+ $fileId = $this->sovfs->retrieveVfsFileId();
+ $this->sobimmodel->setVfsdatabaseid($fileId);
+ if($this->sobimmodel->checkIfModelExists() ) {
+ return true;
+ }
+
+ }
+ return false;
+
+ }
+ public function getIfcFileNameWithRealPath() {
+ $this->checkIdVfsArguments();
+ /* @var $bimModel BimModel */
+ $bimModel =
$this->sobimmodel->retrieveBimModelInformationById();
+ $this->sovfs->setFilename($bimModel->getFileName());
+ return $this->sovfs->getAbsolutePathOfVfsFile();
+ }
+ /*
+ * needs sobimmodel object with db and modelId set
+ * @return boolean
+ */
+ public function checkBimModelExistsByModelId() {
+ $this->checkIdArguments();
+ $bimModel =
$this->sobimmodel->retrieveBimModelInformationById();
+ return ($bimModel != null);
+ }
+ public function checkBimModelIsUsed() {
+ $this->checkIdArguments();
+ /* @var $bimModel BimModel */
+ $bimModel =
$this->sobimmodel->retrieveBimModelInformationById();
+ return ($bimModel->getUsedItemCount() > 0);
+ }
+
+ private function displayArguments() {
+ $string = "(bobimmodel)Argument list:\n".
+ "Model name:\t $this->modelName \n".
+ "Model id:\t
".$this->sobimmodel->getModelId()." \n".
+ "SOvfs:\t ".gettype($this->sovfs)."\n".
+ "SObimmodel:\t
".gettype($this->sobimmodel)."\n".
+ "Submodule:\t
".$this->sovfs->getSubModule()."\n";
+ return $string;
+
+ }
+ /*
+ * This function needs:
+ * An SOvfs object with the filename and the submodule set
+ * An sobimmodel object with the modelname and the vfs_database_id
+ */
+ public function removeIfcModel() {
+ if(!$this->sobimmodel || !$this->sovfs) {
+ throw new
InvalidArgumentException($this->displayArguments());
+ }
+ $this->sobimmodel->removeBimModelFromDatabase();
+ $this->sovfs->removeFileFromVfs();
+ return true;
+ }
+ /*
+ * needs sobimmodel object with db and modelId set
+ * needs sovfs object, with submodule set
+ * @throws ModelDoesNotExistException
+ */
+ public function removeIfcModelByModelId() {
+ try {
+ $this->checkIdVfsArguments();
+ } catch (InvalidArgumentException $e) {
+ throw $e;
+ }
+ /* @var $bimModel BimModel */
+ try {
+ $bimModel =
$this->sobimmodel->retrieveBimModelInformationById();
+ $this->sobimmodel->setModelName($bimModel->getName());
+
$this->sobimmodel->setVfsdatabaseid($bimModel->getVfsFileId());
+
+ $this->sovfs->setFilename($bimModel->getFileName());
+ $this->removeIfcModel();
+ } catch (ModelDoesNotExistException $e) {
+ throw new ModelDoesNotExistException();
+ }
+
+ }
+
+ private function checkIdVfsArguments() {
+ if(!$this->sobimmodel || !$this->sovfs ||
!$this->sobimmodel->getModelId() || !$this->sovfs->getSubModule()) {
+ throw new
InvalidArgumentException($this->displayArguments());
+ }
+ }
+ private function checkIdArguments() {
+ if(!$this->sobimmodel || !$this->sobimmodel->getModelId() ||
!$this->sovfs->getSubModule()) {
+ throw new
InvalidArgumentException($this->displayArguments());
+ }
+ }
+ /*
+ * expects item from the $_FILES object in the form:
+ * @param $uploadedFileArray Array ( [name] => <name>
+ * [type] => <mimeType>
+ * [tmp_name] => <filename with path>
+ * [error] => <error status>
+ * [size] => <file size> )
+ * @throws FileExistsException|Exception
+ * @return String|null filename of the uploaded file
+ */
+ private function saveUploadedBimData() {
+ try {
+ return $this->sovfs->addFileToVfs();
+ } catch (FileExistsException $e) {
+ throw $e;
+ } catch (CopyFailureException $e) {
+ throw $e;
+ } catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ public function setModelName($name) {
+ $this->modelName = $name;
+ }
+ public function getModelName() {
+ return $this->modelName;
+ }
+}
Modified: trunk/bim/inc/class.bogroup.inc.php
===================================================================
--- trunk/bim/inc/class.bogroup.inc.php 2011-02-16 09:49:40 UTC (rev 7013)
+++ trunk/bim/inc/class.bogroup.inc.php 2011-02-16 14:10:41 UTC (rev 7014)
@@ -5,7 +5,7 @@
*
* @author Espen
*/
- class property_bogroup extends property_boattribute_owner
+ class bim_bogroup extends bim_boattribute_owner
{
private $id, $name, $bpn, $nat_group_no, $catalog;
@@ -57,7 +57,7 @@
return $this->catalog;
}
- public function set_catalog(property_bocatalog $catalog)
+ public function set_catalog(bim_bocatalog $catalog)
{
$this->catalog = $catalot;
}
Modified: trunk/bim/inc/class.boitem.inc.php
===================================================================
--- trunk/bim/inc/class.boitem.inc.php 2011-02-16 09:49:40 UTC (rev 7013)
+++ trunk/bim/inc/class.boitem.inc.php 2011-02-16 14:10:41 UTC (rev 7014)
@@ -1,19 +1,19 @@
<?php
-include_class('property', 'boattribute_owner', 'inc/');
+include_class('bim', 'boattribute_owner', 'inc/');
/**
* FIXME: Description
*
* @author Espen
*/
- class property_boitem extends property_boattribute_owner
+ class bim_boitem extends bim_boattribute_owner
{
private $id, $installed_date, $location_id, $vendor_id;
/**
* Should contain the group object of which this item belongs to.
- * @var property_bogroup
+ * @var bim_bogroup
*/
private $group;
@@ -30,7 +30,7 @@
$this->attributes[$attr_def] = null;
}
- public function set_attribute($attr_def, property_boattribute $attr) {
+ public function set_attribute($attr_def, bim_boattribute $attr) {
$group_attrs = $this->group->get_attribute_list();
if(array_key_exists($attr_def, $group_attrs))
{
@@ -61,7 +61,7 @@
$this->id = $id;
}
- public function set_group(property_bogroup $group)
+ public function set_group(bim_bogroup $group)
{
$this->group = $group;
}
Modified: trunk/bim/inc/class.menu.inc.php
===================================================================
--- trunk/bim/inc/class.menu.inc.php 2011-02-16 09:49:40 UTC (rev 7013)
+++ trunk/bim/inc/class.menu.inc.php 2011-02-16 14:10:41 UTC (rev 7014)
@@ -1,12 +1,11 @@
<?php
/**
- * property - Menus
+ * bim - Menus
*
- * @author Dave Hall <address@hidden>
* @author Sigurd Nes <address@hidden>
* @copyright Copyright (C) 2007,2008 Free Software Foundation, Inc.
http://www.fsf.org/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @package property
+ * @package bim
* @version $Id$
*/
@@ -29,39 +28,29 @@
/**
* Menus
*
- * @package property
+ * @package bim
*/
- class property_menu
+ class bim_menu
{
/**
- * Get the menus for the property
+ * Get the menus for the bim
*
* @return array available menus for the current user
*/
- public function get_menu($type='')
+ public function get_menu()
{
$incoming_app =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
+ $GLOBALS['phpgw_info']['flags']['currentapp'] = 'bim';
$acl = & $GLOBALS['phpgw']->acl;
$menus = array();
- $entity =
CreateObject('property.soadmin_entity');
- $entity_list = $entity->read(array('allrows' =>
true));
-
- $start_page = 'location';
- if (
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_start_page'])
- &&
$GLOBALS['phpgw_info']['user']['preferences']['property']['default_start_page']
)
- {
- $start_page =
$GLOBALS['phpgw_info']['user']['preferences']['property']['default_start_page'];
- }
-
$menus['navbar'] = array
(
- 'property' => array
+ 'bim' => array
(
- 'text' => lang('property'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
"property.ui{$start_page}.index") ),
- 'image' => array('property', 'navbar'),
+ 'text' => lang('bim'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
"bim.uibim.showModels") ),
+ 'image' => array('bim', 'navbar'),
'order' => 35,
'group' => 'facilities management'
),
@@ -69,425 +58,22 @@
$menus['toolbar'] = array();
- $soadmin_location =
CreateObject('property.soadmin_location');
- $locations =
$soadmin_location->select_location_type();
-
-// if (
isset($GLOBALS['phpgw_info']['user']['apps']['admin']) )
if ( $GLOBALS['phpgw']->acl->check('run',
phpgwapi_acl::READ, 'admin')
- || $GLOBALS['phpgw']->acl->check('admin',
phpgwapi_acl::ADD, 'property'))
+ || $GLOBALS['phpgw']->acl->check('admin',
phpgwapi_acl::ADD, 'bim'))
{
- if ( is_array($entity_list) &&
count($entity_list) )
- {
- foreach($entity_list as $entry)
- {
-
$admin_children_entity["entity_{$entry['id']}"] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiadmin_entity.category', 'entity_id'=> $entry['id'])),
- 'text' =>
$entry['name'],
- 'image' =>
array( 'property', 'entity_' . $entry['id'] )
- );
-
$admin_children_entity["entity_{$entry['id']}"]['children'] =
$entity->read_category_tree($entry['id'],
'property.uiadmin_entity.list_attribute');
- /*
- $cat_list =
$entity->read_category(array('allrows'=>true,'entity_id'=>$entry['id']));
- foreach($cat_list as $category)
- {
-
$admin_children_entity["entity_{$entry['id']}"]['children']["entity_{$entry['id']}_{$category['id']}"]
= array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiadmin_entity.list_attribute', 'entity_id'=> $entry['id'] ,
'cat_id'=> $category['id'])),
- 'text' =>
$category['name']
- );
- }
- */
- }
- }
-
- $admin_children_tenant = array
- (
- 'tenant_cats' => array
- (
- 'text' => lang('Tenant
Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'tenant_cats') )
- ),
- 'tenant_global_cats' => array
- (
- 'text' => lang('Tenant Global
Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uicategories.index', 'appname' => 'property', 'location' => '.tenant',
'global_cats' => 'true', 'menu_selection' =>
'admin::property::tenant::tenant_global_cats') )
- ),
- 'tenant_attribs' => array
- (
- 'text' => lang('Tenant
Attributes'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.ui_custom.list_attribute', 'appname' => 'property', 'location'
=>'.tenant', 'menu_selection' => 'admin::property::tenant::tenant_attribs') )
- ),
- 'claims_cats' => array
- (
- 'text' => lang('Tenant Claim
Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'tenant_claim') )
- )
- );
-
- $admin_children_vendor = array
- (
- 'vendor_cats' => array
- (
- 'text' => lang('Vendor
Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'vendor_cats') )
- ),
- 'vendor_global_cats' => array
- (
- 'text' => lang('Vendor Global
Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uicategories.index', 'appname' => 'property', 'location' => '.vendor',
'global_cats' => 'true', 'menu_selection' =>
'admin::property::vendor::vendor_global_cats') )
- ),
- 'vendor_attribs' => array
- (
- 'text' => lang('Vendor
Attributes'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.ui_custom.list_attribute', 'appname' => 'property', 'location' =>
'.vendor', 'menu_selection' => 'admin::property::vendor::vendor_attribs') )
- )
- );
- $admin_children_owner = array
- (
- 'owner_cats' => array
- (
- 'text' => lang('Owner
Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'owner_cats') )
- ),
- 'owner_attribs' => array
- (
- 'text' => lang('Owner
Attributes'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.ui_custom.list_attribute', 'appname' => 'property', 'location'
=>'.owner', 'menu_selection' => 'admin::property::owner::owner_attribs') )
- )
- );
-
- $admin_children_accounting = array
- (
- 'accounting_cats' => array
- (
- 'text' => lang('Accounting
Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'b_account') )
- ),
- 'budget_account' => array
- (
- 'text' => lang('budget
account'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'budget_account') )
- ),
- 'accounting_dimb' => array
- (
- 'text' => lang('Accounting dim
b'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'dimb') )
- ),
- 'dimb_roles' => array
- (
- 'text' => lang('dimb roles'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uicategories.index', 'appname' => 'property', 'location' =>
'.invoice.dimb', 'global_cats' => 'true', 'menu_selection' =>
'admin::property::accounting::dimb_roles') )
- ),
- 'accounting_dimd' => array
- (
- 'text' => lang('Accounting dim
d'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'dimd') )
- ),
- 'accounting_tax' => array
- (
- 'text' => lang('Accounting
tax'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'tax') )
- ),
- 'voucher_cats' => array
- (
- 'text' => lang('Accounting
voucher category'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'voucher_cat') )
- ),
- 'voucher_type' => array
- (
- 'text' => lang('Accounting
voucher type'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'voucher_type') )
- )
- );
-
- $admin_children_agreement = array
- (
- 'agreement_status' => array
- (
- 'text' => lang('Agreement
status'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'agreement_status') )
- ),
- 'agreement_attribs' => array
- (
- 'text' => lang('Agreement
Attributes'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.ui_custom.list_attribute', 'appname' => 'property', 'location'
=>'.agreement', 'menu_selection' =>
'admin::property::agreement::agreement_attribs') )
- ),
- 'service_agree_cats' => array
- (
- 'text' => lang('service
agreement categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 's_agreement') )
- ),
- 'service_agree_attribs' => array
- (
- 'text' => lang('service
agreement Attributes'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.ui_custom.list_attribute', 'appname' => 'property', 'location'
=>'.s_agreement', 'menu_selection' =>
'admin::property::agreement::service_agree_attribs') )
- ),
- 'service_agree_item_attribs' => array
- (
- 'text' => lang('service
agreement item Attributes'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.ui_custom.list_attribute', 'appname' => 'property', 'location'
=>'.s_agreement.detail', 'menu_selection' =>
'admin::property::agreement::service_agree_item_attribs') )
- )
- );
-
- foreach ( $locations as $location )
- {
-
$admin_children_location_children["attribute_loc_{$location['id']}"] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiadmin_location.list_attribute', 'type_id' => $location['id'])),
- 'text' => $location['name'] .
' ' . lang('attributes'),
- );
-
$admin_children_location_children["category_{$location['id']}"] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uigeneric.index', 'type' => 'location', 'type_id' => $location['id'])
),
- 'text' => $location['name'] .
' ' . lang('categories'),
- );
- }
-
- $admin_children_location = array
- (
- 'street' => array
- (
- 'text' => lang('Street'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'street') )
- ),
- 'district' => array
- (
- 'text' => lang('District'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'district') )
- ),
- 'district' => array
- (
- 'text' => lang('District'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'district') )
- ),
- 'town' => array
- (
- 'text' => lang('Part of town'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'part_of_town') )
- ),
- 'location' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiadmin_location.index') ),
- 'text' => lang('Location
type'),
- 'children' =>
$admin_children_location_children
- ),
- 'config' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiadmin_location.config') ),
- 'text' => lang('Config')
- ),
- 'update_location' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uilocation.update_location') ),
- 'text' => lang('update
location')
- )
- );
-
$menus['admin'] = array
(
'index' => array
(
'text' =>
lang('Configuration'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uiconfig.index', 'appname' => 'property') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uiconfig.index', 'appname' => 'bim') )
),
- 'entity' => array
+ 'acl' => array
(
- 'text' => lang('Admin entity'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiadmin_entity.index') ),
- 'children' =>
$admin_children_entity
- ),
- 'location' => array
- (
- 'text' => lang('Admin
Location'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiadmin_location.index') ),
- 'image' => array(
'property', 'location' ),
- 'children' =>
$admin_children_location
-
- ),
- 'inactive_cats' => array
- (
- 'text' => lang('Update the not
active category for locations'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uilocation.update_cat') )
- ),
- 'project_cats' => array
- (
- 'text' => lang('project
categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uicategories.index', 'appname' => 'property', 'location' => '.project',
'global_cats' => 'true', 'menu_selection' => 'admin::property::project_cats') )
- ),
- 'workorder_detail' => array
- (
- 'text' => lang('Workorder
Detail Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'wo_hours') )
- ),
- 'ticket_cats' => array
- (
- 'text' => lang('Ticket
Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uicategories.index', 'appname' => 'property', 'location' => '.ticket',
'global_cats' => 'true', 'menu_selection' => 'admin::property::ticket_cats') )
- ),
- 'ticket_status' => array
- (
- 'text' => lang('Ticket
status'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'ticket_status') )
- ),
- 'tenant' => array
- (
- 'text' => lang('Tenant'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'tenant', 'admin' => true) ),
- 'image' => array(
'property', 'location_tenant' ),
- 'children' =>
$admin_children_tenant
- ),
- 'owner' => array
- (
- 'text' => lang('Owner'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'owner', 'admin' => true) ),
- 'children' =>
$admin_children_owner
- ),
- 'vendor' => array
- (
- 'text' => lang('Vendor'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'vendor', 'admin' => true) ),
- 'children' =>
$admin_children_vendor
- ),
- 'doc_cats' => array
- (
- 'text' => lang('document
categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uicategories.index', 'appname' => 'property', 'location' => '.document',
'global_cats' => 'true') )
- ),
- 'building_part' => array
- (
- 'text' => lang('Building
Part'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'building_part') )
- ),
- 'tender' => array
- (
- 'text' => lang('Tender
chapter'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'tender_chapter') )
- ),
- 'id_control' => array
- (
- 'text' => lang('ID Control'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiadmin.edit_id') )
- ),
- 'permissions' => array
- (
- 'text' => lang('Permissions'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiadmin.list_acl') )
- ),
- 'user_contact' => array
- (
- 'text' => lang('User contact
info'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiadmin.contact_info') )
- ),
- 'request_status' => array
- (
- 'text' => lang('Request
status'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'request_status') )
- ),
- 'request_condition' => array
- (
- 'text' => lang('Request
condition_type'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'r_condition_type') )
- ),
- 'order_dim1' => array
- (
- 'text' =>
lang('order_dim1'),//translation have to refeflect the (local) meaning
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'order_dim1') )
- ),
- 'workorder_status' => array
- (
- 'text' => lang('Workorders
status'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'workorder_status') )
- ),
- 'project_status' => array
- (
- 'text' => lang('project
status'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'project_status') )
- ),
- 'project_group' => array
- (
- 'text' => lang('project
group'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'project_group') )
- ),
- 'agreement' => array
- (
- 'text' => lang('Agreement'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'agreement_status') ),
- 'image' => array(
'property', 'agreement' ),
- 'children' =>
$admin_children_agreement
- ),
- 'document_status' => array
- (
- 'text' => lang('Document
Status'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'document_status') )
- ),
- 'unit' => array
- (
- 'text' => lang('Unit'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'unit') )
- ),
- 'key_location' => array
- (
- 'text' => lang('Key location'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'key_location') )
- ),
- 'branch' => array
- (
- 'text' => lang('Branch'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'branch') )
- ),
- 'accounting' => array
- (
- 'text' => lang('Accounting'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'budget_account') ),
- 'children' =>
$admin_children_accounting
- ),
- 'admin_async' => array
- (
- 'text' => lang('Admin Async
services'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uialarm.index') )
- ),
- 'async' => array
- (
- 'text' => lang('Async
services'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiasync.index') )
- ),
- 'event_action' => array
- (
- 'text' => lang('event action'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'event_action') )
- ),
- 'list_functions' => array
- (
- 'text' => lang('Admin custom
functions'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.ui_custom.list_custom_function','appname' => 'property') )
- ),
- 'migrate_db' => array
- (
- 'text' => lang('Migrate to
alternative db'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uimigrate.index') )
- ),
- 'custom_menu_items' => array
- (
- 'text' => lang('custom menu
items'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'custom_menu_items') )
- ),
- 'responsibility_role' => array
- (
- 'text' => lang('responsibility
role'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'responsibility_role') )
- ),
- 'responsible_matrix' => array
- (
- 'text' =>
lang('responsible matrix'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiresponsible.index') ),
- ),
- 'pending_action_type' => array
- (
- 'text' =>
lang('pending action type'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'pending_action_type') )
+ 'text' => lang('Configure
Access Permissions'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'preferences.uiadmin_acl.list_acl', 'acl_app' => 'bim') )
)
);
}
@@ -499,480 +85,81 @@
array
(
'text' =>
$GLOBALS['phpgw']->translation->translate('Preferences', array(), true),
- 'url' =>
$GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname' =>
'property', 'type'=> 'user') )
+ 'url' =>
$GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname' =>
'bim', 'type'=> 'user') )
),
array
(
'text' =>
$GLOBALS['phpgw']->translation->translate('Grant Access', array(), true),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiadmin.aclprefs', 'acl_app'=> 'property'))
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'bim.uiadmin.aclprefs', 'acl_app'=> 'bim'))
)
);
$menus['toolbar'][] = array
(
'text' =>
$GLOBALS['phpgw']->translation->translate('Preferences', array(), true),
- 'url' =>
$GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname' =>
'property')),
- 'image' => array('property',
'preferences')
+ 'url' =>
$GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname' =>
'bim')),
+ 'image' => array('bim', 'preferences')
);
}
$menus['navigation'] = array();
-//
$acl->set_account_id($GLOBALS['phpgw_info']['user']['account_id'], true);
- if ( $acl->check('.location', PHPGW_ACL_READ,
'property') )
- {
- $children = array();
- foreach ( $locations as $location )
- {
- if (
$acl->check(".location.{$location['id']}", PHPGW_ACL_READ, 'property') )
- {
-
$children["loc_{$location['id']}"] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uilocation.index', 'type_id' => $location['id'])),
- 'text' =>
$location['name'],
- 'image' =>
array('property', 'location_' . $location['id'])
- );
- }
- }
-
- $children['tenant'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uilocation.index', 'lookup_tenant' => 1, 'type_id' =>
$soadmin_location->read_config_single('tenant_id'))),
- 'text' => lang('Tenant'),
- 'image' => array('property',
'location_tenant')
- );
- $children['gabnr'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uigab.index')),
- 'text' => lang('gabnr'),
- 'image' => array('property',
'location_gabnr')
- );
- $children['summary'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uilocation.summary')),
- 'text' => lang('Summary'),
- 'image' => array('property',
'location_summary')
- );
- $children['responsibility_role'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uilocation.responsiblility_role')),
- 'text' => lang('responsibility
role'),
- 'image' => array('property',
'responsibility_role')
- );
-
-/* if ( $acl->check('.location', 16, 'property') )
- {
- $children['type'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiadmin_location.index')),
- 'text' => lang('Location type')
- );
- $children['config'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiadmin_location.config')),
- 'text' => lang('Config')
- );
- }
-*/
- $menus['navigation']['location'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uilocation.index', 'type_id'=>1)),
- 'text' => lang('Location'),
- 'image' => array('property',
'location'),
- 'children' => $children
- );
- }
-
- if ( $acl->check('.ifc', PHPGW_ACL_READ, 'property') )
+ if ( $acl->check('.ifc', PHPGW_ACL_READ, 'bim') )
{
$menus['navigation']['ifc'] = array
(
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiifc.import')),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 'bim.uiifc.import')),
'text' => lang('IFC'),
- 'image' => array('property',
'ifc'),
+ 'image' => array('bim', 'ifc'),
'children' => array
(
'import' => array
(
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiifc.import')),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 'bim.uiifc.import')),
'text' =>
lang('import'),
- 'image' =>
array('property', 'ifc_import'),
+ 'image' =>
array('bim', 'ifc_import'),
)
)
);
}
- if ( $acl->check('.ticket',PHPGW_ACL_READ, 'property') )
- {
- $menus['navigation']['helpdesk'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uitts.index')),
- 'text' => lang('Helpdesk'),
- 'image' => array('property',
'helpdesk')
- );
- }
-
- if ( $acl->check('.ticket.order',PHPGW_ACL_ADD,
'property') )
- {
- $menus['navigation']['helpdesk']['children'] =
array
- (
- 'order_template' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'order_template') ),
- 'text' => lang('order
template'),
- 'image' =>
array('property', 'helpdesk')
- )
- );
- }
-
- if ( $acl->check('.project', PHPGW_ACL_READ,
'property') )
- {
- $menus['navigation']['project'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiproject.index')),
- 'text' => lang('Project'),
- 'image' => array('property',
'project'),
- 'children' => array
- (
- 'project' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiproject.index')),
- 'text' =>
lang('Project'),
- 'image' =>
array('property', 'project')
- ),
- 'workorder' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiworkorder.index')),
- 'text' =>
lang('Workorder'),
- 'image' =>
array('property', 'project_workorder')
- ),
- 'request' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uirequest.index')),
- 'text' =>
lang('Request'),
- 'image' =>
array('property', 'project_request')
- ),
- 'template' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uitemplate.index')),
- 'text' =>
lang('template'),
- 'image' =>
array('property', 'project_template')
- )
- )
- );
- }
-
- if ( $acl->check('.scheduled_events', PHPGW_ACL_READ,
'property') )
- {
- $menus['navigation']['scheduled_events'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uievent.index')),
- 'text' => lang('scheduled
events'),
- 'image' =>
array('scheduled_events', 'project')
- );
- }
-
- if ( $acl->check('.invoice', PHPGW_ACL_READ,
'property') )
- {
- $children = array();
- if ( $acl->check('.invoice', PHPGW_ACL_PRIVATE,
'property') )
- {
- $children['investment'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiinvestment.index')),
- 'text' =>
lang('Investment value')
- );
-
- $children['import'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiXport.import')),
- 'text' => lang('Import
invoice')
- );
-
- $children['export'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiXport.export')),
- 'text' => lang('Export
invoice')
- );
- }
-
- if ( $acl->check('.invoice', PHPGW_ACL_ADD,
'property') )
- {
- $children['add'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiinvoice.add')),
- 'text' => lang('Add')
- );
- }
-
- $menus['navigation']['invoice'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiinvoice.index')),
- 'text' => lang('Invoice'),
- 'image' => array('property', 'invoice'),
- 'children' => array_merge(array
- (
- 'paid' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiinvoice.index', 'paid'=>true)),
- 'text' => lang('Paid')
- ),
- // Should this be process?
skwashd jan08
- 'consume' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiinvoice.consume')),
- 'text' =>
lang('consume')
- ),
- 'budget_account' => array
- (
- 'text' => lang('budget
account'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'budget_account') )
- ),
- 'vendor' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uigeneric.index', 'type'=> 'vendor')),
- 'text' =>
lang('Vendor')
- ),
- 'tenant' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uigeneric.index', 'type'=> 'tenant')),
- 'text' =>
lang('Tenant')
- ),
- 'claim' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uitenant_claim.index')),
- 'text' => lang('Tenant
claim'),
- 'image' =>
array('property', 'project_tenant_claim')
- )
- ), $children)
- );
- }
-
- if ( $acl->check('.budget', PHPGW_ACL_READ, 'property')
)
- {
- $menus['navigation']['budget'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uibudget.index')),
- 'text' => lang('Budget'),
- 'image' => array('property',
'budget'),
- 'children' => array
- (
- 'budget' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uibudget.index')),
- 'text' =>
lang('budget')
- ),
- 'obligations' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uibudget.obligations')),
- 'text' =>
lang('obligations')
- )
- )
- );
-
- if ( $acl->check('.budget.basis',
PHPGW_ACL_READ, 'property') )
- {
-
$menus['navigation']['budget']['children']['basis'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uibudget.basis')),
- 'text' => lang('basis')
- );
- }
- }
-
- if ( $acl->check('.agreement', PHPGW_ACL_READ,
'property') )
- {
- $admin_menu = array();
- if ( $acl->check('.agreement', 16, 'property') )
- {
- $admin_menu = array
- (
- 'group' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uipricebook.agreement_group')),
- 'text' =>
lang('Agreement group')
- ),
- 'activities' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uipricebook.activity')),
- 'text' =>
lang('Activities')
- ),
- 'agreement' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiagreement.index')),
- 'text' =>
lang('Agreement')
- )
- );
- }
-
- $menus['navigation']['agreement'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiagreement.index')),
- 'text' => lang('Agreement'),
- 'image' => array('property',
'agreement'),
- 'children' => array
- (
- 'pricebook' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiagreement.index')),
- 'text' =>
lang('Pricebook'),
- 'children' =>
$admin_menu
- ),
- 'service' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uis_agreement.index')),
- 'text' =>
lang('Service')
- ),
- 'alarm' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uialarm.list_alarm')),
- 'text' => lang('alarm')
- )
- )
- );
- }
-
- if ( $acl->check('.document', PHPGW_ACL_READ,
'property') )
- {
- $laws_url =
$GLOBALS['phpgw']->link('/redirect.php',array('go' =>
urlencode('http://www.regelhjelp.no/')));
- $menus['navigation']['documentation'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uidocument.index')),
- 'text' =>
lang('Documentation'),
- 'image' => array('property',
'documentation'),
- 'children' => array
- (
- 'legislation' => array
- (
- 'text' =>
$GLOBALS['phpgw']->translation->translate('laws and regulations', array(),
true),
- // degrade
gracefully hack
- 'url' =>
$laws_url . '" onclick="window.open(\'' . $laws_url . '\'); return false;',
- ),
- 'location' => array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uidocument.index')),
- 'text' =>
lang('location')
- )
- )
- );
- if (is_array($entity_list) &&
count($entity_list) )
- {
- foreach ( $entity_list as $entry )
- {
- if($entry['documentation'] &&
$acl->check(".entity.{$entry['id']}", PHPGW_ACL_READ, 'property') )
- {
-
$menus['navigation']['documentation']['children']["entity_{$entry['id']}"] =
array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'property.uidocument.index', 'entity_id' => $entry['id'])),
- 'text' =>
$entry['name']
- );
- }
- }
- }
-
-
$menus['navigation']['documentation']['children']['gallery'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uigallery.index')),
- 'text' => lang('gallery')
- );
-
- $custom_menus =
CreateObject('property.sogeneric');
-
$custom_menus->get_location_info('custom_menu_items',false);
- $custom_menu_items=
$custom_menus->read(array('type' => 'custom_menu_items' , 'filter' =>
array('location' => '.document')));
- foreach($custom_menu_items as $item)
- {
- if($item['local_files'])
- {
- $item['url'] = 'file:///' .
str_replace(':','|',$item['url']);
- }
-
$menus['navigation']['documentation']['children'][] = array
- (
- 'url' => $item['url'],
- 'text' => $item['name'],
- 'target'=> '_blank'
- );
- }
- }
-
- if ( $acl->check('.custom', PHPGW_ACL_READ, 'property')
)
- {
- $menus['navigation']['custom'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uicustom.index')),
- 'text' => lang('Custom'),
- 'image' => array('property',
'custom')
- );
- }
-
- if ( is_array($entity_list) && count($entity_list) )
- {
- foreach($entity_list as $entry)
- {
- if (
$acl->check(".entity.{$entry['id']}", PHPGW_ACL_READ, 'property') )
- {
-
$menus['navigation']["entity_{$entry['id']}"] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uientity.index', 'entity_id'=> $entry['id'])),
- 'text' =>
$entry['name'],
- 'image' =>
array( 'property', 'entity_' . $entry['id'] )
- );
-
- if ($type != 'horisontal')
- {
-
$menus['navigation']["entity_{$entry['id']}"]['children'] =
$entity->read_category_tree($entry['id'],'property.uientity.index',
PHPGW_ACL_READ);
- }
- }
- }
- }
$menus['navigation']['item'] = array
(
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiitem.index')),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 'bim.uiitem.index')),
'text' => lang('BIM_Items'),
- 'image' => array('property', 'custom'),
+ 'image' => array('bim', 'custom'),
'children' => array_merge(array
(
'index' => array
(
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiitem.index')),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 'bim.uiitem.index')),
'text' => lang('Register')
),
'foo' => array
(
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiitem.foo')),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 'bim.uiitem.foo')),
'text' => lang('Foo')
),
'showModels' => array
(
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uibim.showModels')),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'bim.uibim.showModels')),
'text' => lang('Show Models')
),
'ifc' => array
(
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiifc.import')),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 'bim.uiifc.import')),
'text' => lang('Ifc')
),
'upload' => array
(
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uibim.upload')),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 'bim.uibim.upload')),
'text' => lang('Upload Model'),
- 'image' => array('property',
'project_tenant_claim')
+ 'image' => array('bim', 'project_tenant_claim')
)
))
);
- unset($entity_list);
- unset($entity);
- if ( $acl->check('.jasper', PHPGW_ACL_READ, 'property')
)
- {
- $menus['navigation']['jasper'] = array
- (
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uijasper.index')),
- 'text' => JasperReports,
- 'image' => array('property',
'report')
- );
- }
-
$GLOBALS['phpgw_info']['flags']['currentapp'] =
$incoming_app;
return $menus;
}
Modified: trunk/bim/inc/class.sobim_converter.inc.php
===================================================================
--- trunk/bim/inc/class.sobim_converter.inc.php 2011-02-16 09:49:40 UTC (rev
7013)
+++ trunk/bim/inc/class.sobim_converter.inc.php 2011-02-16 14:10:41 UTC (rev
7014)
@@ -5,7 +5,7 @@
* HTTP_Request (Pear)
*/
-phpgw::import_class('property.restrequest');
+phpgw::import_class('bim.restrequest');
/*
*
*/
@@ -92,4 +92,4 @@
public function setFileToSend($name) {
$this->fileToSend = $name;
}
-}
\ No newline at end of file
+}
Modified: trunk/bim/inc/class.sobim_repository.inc.php
===================================================================
--- trunk/bim/inc/class.sobim_repository.inc.php 2011-02-16 09:49:40 UTC
(rev 7013)
+++ trunk/bim/inc/class.sobim_repository.inc.php 2011-02-16 14:10:41 UTC
(rev 7014)
@@ -5,7 +5,7 @@
* HTTP_Request (Pear)
*/
-phpgw::import_class('property.restrequest');
+phpgw::import_class('bim.restrequest');
interface sobimrest {
public function getRepositoryCountJson();
@@ -42,4 +42,4 @@
$output = $rest->getResponseBody();
echo $output;
}
-}
\ No newline at end of file
+}
Added: trunk/bim/inc/class.sobimitem.inc.php
===================================================================
--- trunk/bim/inc/class.sobimitem.inc.php (rev 0)
+++ trunk/bim/inc/class.sobimitem.inc.php 2011-02-16 14:10:41 UTC (rev
7014)
@@ -0,0 +1,203 @@
+<?php
+
+phpgw::import_class('bim.sobim');
+phpgw::import_class('bim.bimitem');
+
+interface sobimitem extends sobim {
+ /*
+ * @return array of BIM objects
+ */
+ public function getAll();
+ /*
+ * @param int id
+ * @return BIMItem
+ */
+ public function getBimItem($bimObjectId);
+ public function addBimItem($bimItem);
+ public function deleteBimItem($guid);
+ public function checkIfBimItemExists($guid);
+ public function updateBimItem($bimItem);
+ public function getBimItemAttributeValue($bimItemGuid, $attribute);
+ public function retrieveItemsByModelId();
+ public function setModelId($modelId);
+}
+class sobimitem_impl implements sobimitem
+{
+ /* @var phpgwapi_db_ */
+ private $db;
+ private $modelId;
+
+ public function __construct(& $db) {
+ // $this->db = & $GLOBALS['phpgw']->db;
+ $this->db = $db;
+ $db->Halt_On_Error = 'no';
+ $db->Exception_On_Error = true;
+ }
+ /*
+ * @return Array an array of BimItem objects
+ */
+ public function getAll() {
+ $itemTable = self::bimItemTable;
+ $typeTable = self::bimTypeTable;
+ $sql = "SELECT $itemTable.id, fm_bim_type.name AS type,
$itemTable.guid, $itemTable.xml_representation ".
+ "FROM public. $itemTable,
public.$typeTable ".
+ "WHERE $itemTable.type =
$typeTable.id";
+ $bimItemArray = array();
+ $this->db->query($sql);
+ while($this->db->next_record())
+ {
+ $bimItem = new
BimItem($this->db->f('id'),$this->db->f('guid'), $this->db->f('type'),
$this->db->f('xml_representation',true));
+ array_push($bimItemArray, $bimItem);
+ }
+
+ return $bimItemArray;
+ }
+
+
+ public function getBimItem($bimObjectGuid){
+ $itemTable = self::bimItemTable;
+ $typeTable = self::bimTypeTable;
+ $sql = "SELECT $itemTable.id, fm_bim_type.name AS type,
$itemTable.guid, $itemTable.xml_representation, $itemTable.model ".
+ "FROM public.$itemTable,
public.$typeTable ".
+ "WHERE $itemTable.type = $typeTable.id
" .
+ "AND $itemTable.guid ='$bimObjectGuid'";
+ $this->db->query($sql,__LINE__,__FILE__);
+ if($this->db->num_rows() == 0) {
+ throw new Exception('Item not found!');
+ } else {
+ $this->db->next_record();
+ return new
BimItem($this->db->f('id'),$this->db->f('guid'), $this->db->f('type'),
$this->db->f('xml_representation',true),$this->db->f('model'));
+ }
+ }
+
+ public function addBimItem($bimItem) {
+ /* @var $bimItem BimItem */
+ if(!$bimItem->getModelId())
+ {
+ throw new Exception('ModelId not set');
+ }
+
+ $sql = "INSERT INTO ".self::bimItemTable." (type, guid,
xml_representation, model) values (";
+ $sql = $sql."(select id from ".self::bimTypeTable." where name
= '".$bimItem->getType()."'),";
+ $sql = $sql."'".$bimItem->getGuid()."',
'".$this->db->db_addslashes($bimItem->getXml())."',
".$bimItem->getModelId().")";
+ try {
+ if(is_null($this->db->query($sql,__LINE__,__FILE__))) {
+ throw new Exception('Query to add item was
unsuccessful');
+ } else {
+ return $this->db->num_rows();
+ }
+ }catch (PDOException $e) {
+ throw new BimDataException("Could not add item",$e);
+ }
+
+ }
+ /*
+ * Checks if the bim item exists
+ * @param string GUID
+ * @return boolean
+ */
+ public function checkIfBimItemExists($guid) {
+ $resultAlias = 'test_item_count';
+ $sql = "SELECT count(id) as $resultAlias from
public.".self::bimItemTable." where guid = '$guid'";
+
+ if(is_null($this->db->query($sql,__LINE__,__FILE__))) {
+ throw new Exception('Query to check items was
unsuccessful');
+ } else {
+ $this->db->next_record();
+ $rowCountOfItemTypes = $this->db->f($resultAlias);
+ return (bool)$rowCountOfItemTypes;
+ }
+ }
+ /*
+ * @return number of affected rows
+ */
+ public function deleteBimItem($guid) {
+ $sql = "Delete from public.".self::bimItemTable." where guid =
'$guid'";
+ if(is_null($this->db->query($sql,__LINE__,__FILE__))) {
+ throw new Exception('Query to delete item was
unsuccessful');
+ } else {
+ return $this->db->num_rows();
+ }
+ }
+
+ public function updateBimItem($bimItem) {
+ if(!$this->checkIfBimItemExists($bimItem->getGuid())) {
+ throw new Exception("Item does not exist!");
+ }
+ $sql = "Update ".self::bimItemTable." set
xml_representation='".$this->db->db_addslashes($bimItem->getXml())."' where
guid='".$bimItem->getGuid()."'";
+
+ if(is_null($this->db->query($sql,__LINE__,__FILE__) )){
+ throw new Exception("Error updating xml of bim item!");
+ } else {
+ return (bool)$this->db->num_rows();
+ }
+ }
+ /*
+ * Searches the xml representation and returns the values of any
attributes that have the specified name
+ * If there are multiple elements with the same name, all of their
value's will be returned
+ * Note: the name can be written in xpath format in relation to it's
parent, so instead of 'name',
+ * you could write 'attributes/name'
+ * @access public
+ * @param string $bimItemGuid the guid of the item
+ * @param string $attribute the name of the attribute
+ * @throws Exception if nothing is found
+ * $return array results
+ */
+ public function getBimItemAttributeValue($bimItemGuid, $attribute) {
+ $columnAlias = "attribute_values";
+ $itemTable = self::bimItemTable;
+ //$sql = "select
xpath('descendant-or-self::*[$attribute]/$attribute/text()', (select
xml_representation from fm_bim_data where guid='$bimItemGuid'))";
+ $sql = "select
array_to_string(xpath('descendant-or-self::*[$attribute]/$attribute/text()',
(select xml_representation from $itemTable where guid='$bimItemGuid')), ',') as
$columnAlias";
+ $this->db->query($sql,__LINE__,__FILE__);
+ if($this->db->num_rows() == 0) {
+ throw new Exception('Error!');
+ } else {
+ $this->db->next_record();
+ $result = $this->db->f($columnAlias,true);
+ return preg_split('/,/', $result);
+ //$match; // xpath result from database will look like:
'{data1, data2, data3}', or '{}' for no results
+ //preg_match('/^\{(.*)\}$/', $result, $match);
+ /*if(!$match[1]) {
+ throw new Exception('Attribute not found!');
+ } else {
+ return preg_split('/,/', $match[1]);
+ }*/
+ }
+ }
+ /*
+ * Needs the modelId field set
+ */
+ public function retrieveItemsByModelId() {
+ if(empty($this->modelId)) {
+ throw new InvalidArgumentException("Missing modelId!");
+ }
+ $itemTable = self::bimItemTable;
+ $typeTable = self::bimTypeTable;
+ $bimItems = array();
+ $sql = "select $itemTable.id, (select name from fm_bim_type
where $itemTable.type = $typeTable.id) as type, $itemTable.guid from $itemTable
where $itemTable.model =".$this->modelId;
+ try {
+ $this->db->query($sql,__LINE__,__FILE__);
+ if($this->db->num_rows() == 0) {
+ return null;
+ } else {
+ while($this->db->next_record())
+ {
+ $bimItem = new
BimItem($this->db->f('id'),$this->db->f('guid'),$this->db->f('type'));
+ array_push($bimItems, $bimItem);
+ }
+ return $bimItems;
+ }
+ } catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ public function setModelId($modelId) {
+ $this->modelId = $modelId;
+ }
+ public function getModelId() {
+ return $this->modelId;
+ }
+
+
+}
Added: trunk/bim/inc/class.sobimmodel.inc.php
===================================================================
--- trunk/bim/inc/class.sobimmodel.inc.php (rev 0)
+++ trunk/bim/inc/class.sobimmodel.inc.php 2011-02-16 14:10:41 UTC (rev
7014)
@@ -0,0 +1,219 @@
+<?php
+
+phpgw::import_class('bim.bimExceptions');
+phpgw::import_class('bim.bimmodel');
+phpgw::import_class('bim.bimmodelinformation');
+
+/*
+ * @see sobimmodel_impl
+ */
+interface sobimmodel extends sobim{
+
+ public function addBimModel();
+ public function retrieveBimModelList();
+ public function retrieveBimModelInformationById();
+ public function removeBimModelByIdFromDatabase();
+ /*
+ * @throws InvalidArgumentException If the arguments are not set
+ * @throws ModelExistsException if the model does not exist
+ * @throws Exception When sql request fails
+ * @return boolean true if success
+ */
+ public function removeBimModelFromDatabase();
+ /*
+ * @return boolean
+ */
+ public function checkIfModelExists();
+ public function setModelName($name);
+ public function getModelName();
+ /*
+ * set virtual file id from database
+ */
+ public function setVfsdatabaseid(int $id);
+ public function getVfsdatabaseid();
+
+ public function setModelId(int $id);
+ public function getModelId();
+
+
+}
+class sobimmodel_impl implements sobimmodel
+{
+
+ private $db;
+ private $modelName;
+ private $vfs_database_id;
+ private $modelId;
+
+ public function __construct(& $db, $modelName = null, $vfs_id = null) {
+ // $this->db = & $GLOBALS['phpgw']->db;
+ $this->db = $db;
+ $db->Halt_On_Error = 'no';
+ $db->Exception_On_Error = true;
+ }
+
+ public function retrieveBimModelList() {
+ $bimModelArray = array();
+ $itemTable = self::bimItemTable;
+ $modelTable = self::bimModelTable;
+ $sql = "select model.id,model.name,vfs.created,vfs.size as
filesize,vfs.name as filename,vfs.file_id as vfs_file_id,(select count(*) from
$itemTable where model=model.id) as used_item_count from $modelTable as model
left join phpgw_vfs as vfs on model.vfs_file_id = vfs.file_id";
+ if(is_null($this->db->query($sql,__LINE__,__FILE__))) {
+ throw new Exception('Query to find bim models failed');
+ } else {
+ if($this->db->num_rows() == 0) {
+ return null;
+ } else {
+ while($this->db->next_record())
+ {
+ $bimModel =
$this->assembleBimModelFromCurrentDatabaseRecord();
+ array_push($bimModelArray, $bimModel);
+ }
+ }
+ }
+ return $bimModelArray;
+ }
+ private function assembleBimModelFromCurrentDatabaseRecord() {
+ $bimModel = new BimModel();
+ $bimModel->setDatabaseId($this->db->f('id'));
+ $bimModel->setName($this->db->f('name'));
+ $bimModel->setCreationDate($this->db->f('created'));
+ $bimModel->setFileSize($this->db->f('filesize'));
+ $bimModel->setFileName($this->db->f('filename'));
+ $bimModel->setUsedItemCount($this->db->f('used_item_count'));
+ $bimModel->setVfsFileId($this->db->f('vfs_file_id'));
+ return $bimModel;
+ }
+ /*
+ * Needs modelId set
+ * @throws ModelDoesNotExistException
+ * @return null|BimModel
+ */
+ public function retrieveBimModelInformationById() {
+ $this->checkArgModelId();
+ $itemTable = self::bimItemTable;
+ $modelTable = self::bimModelTable;
+ $sql = "Select * from $modelTable where id=".$this->modelId;
+ $sql = "select model.id,model.name,vfs.created,vfs.size as
filesize,vfs.name as filename,vfs.file_id as vfs_file_id,".
+ "(select count(*) from $itemTable where
model=model.id) as used_item_count from $modelTable as model ".
+ "left join phpgw_vfs as vfs on
model.vfs_file_id = vfs.file_id where id=".$this->modelId;
+ if(is_null($this->db->query($sql,__LINE__,__FILE__))) {
+ throw new Exception('Query to find bim model failed');
+ } else {
+ if($this->db->num_rows() == 0) {
+ throw new ModelDoesNotExistException();
+ } else {
+ $this->db->next_record();
+
+// $bimModel = new BimModel();
+// $bimModel->setDatabaseId($this->db->f('id'));
+// $bimModel->setName($this->db->f('name'));
+//
$bimModel->setVfsFileId($this->db->f('vfs_file_id'));
+ $bimModel =
$this->assembleBimModelFromCurrentDatabaseRecord();
+ return $bimModel;
+ }
+ }
+ }
+ public function removeBimModelByIdFromDatabase(){
+ $this->checkArgModelId();
+ $sql = "Delete from ".self::bimModelTable." where
id=".$this->modelId;
+ if(is_null($this->db->query($sql,__LINE__,__FILE__))) {
+ throw new Exception('Query to delete model was
unsuccessful');
+ } else {
+ return $this->db->num_rows();
+ }
+ }
+ public function addBimModel() {
+ if(!$this->checkIfModelExists()) {
+ $sql = "INSERT INTO ".self::bimModelTable." (name,
vfs_file_id) values ('$this->modelName',$this->vfs_database_id)";
+ if(is_null($this->db->query($sql,__LINE__,__FILE__))) {
+ throw new Exception('Query to add model was
unsuccessful');
+ } else {
+ return $this->db->num_rows();
+ }
+ } else {
+ throw new ModelExistsException('Model already exists');
+ }
+ }
+
+ public function checkIfModelExists() {
+ $this->checkArgs();
+ $resultAlias = "id";
+
+ $sql = "select count(*) as $resultAlias from
".sobim::bimModelTable." where name = '$this->modelName' and
vfs_file_id=$this->vfs_database_id";
+ if(is_null($this->db->query($sql,__LINE__,__FILE__))) {
+ throw new Exception('Error checking if model exists!');
+ } else {
+ $this->db->next_record();
+ $rowCountOfModels = $this->db->f($resultAlias);
+ return ($rowCountOfModels > 0);
+ }
+ }
+ /*
+ * @see sobimmodel
+ */
+ public function removeBimModelFromDatabase() {
+ $this->checkArgs();
+ if(!$this->checkIfModelExists()) {
+ throw new ModelExistsException("Model does not exist");
+ }
+ if(!$this->removeBimModelDatabaseEntry()) {
+ throw new Exception("Error removing sql model");
+ }
+ return true;
+ }
+
+ private function removeBimModelDatabaseEntry()
+ {
+ $sql = "SELECT id FROM ".sobim::bimModelTable." WHERE name =
'$this->modelName' AND vfs_file_id=$this->vfs_database_id";
+ $this->db->query($sql,__LINE__,__FILE__);
+ $this->db->next_record();
+ $model_id = (int)$this->db->f('id');
+
+ $this->db->transaction_begin();
+ $sql = "DELETE FROM public.".sobim::bimItemTable." WHERE model
= '$model_id'";
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ $sql = "DELETE FROM ".sobim::bimModelTable." WHERE name =
'$this->modelName' AND vfs_file_id=$this->vfs_database_id";
+ $this->db->query($sql,__LINE__,__FILE__);
+ if( $this->db->transaction_commit() )
+ {
+ return ($this->db->num_rows() > 0);
+ }
+ else
+ {
+ throw new Exception('Query to delete model was
unsuccessful');
+ }
+ }
+
+ private function checkArgs() {
+ if(!$this->modelName || !is_int($this->getVfsdatabaseid()) ||
$this->getVfsdatabaseid() == 0) {
+ throw new InvalidArgumentException("Invalid arguments!
\n modelname: $this->modelName \n VFS ID : $this->vfs_database_id");
+ }
+ }
+ private function checkArgModelId() {
+ if(!$this->modelId) {
+ throw new InvalidArgumentException("Invalid arguments!
\n modelid: $this->modelId");
+ }
+ }
+
+ public function setModelName($name) {
+ $this->modelName = $name;
+ }
+ public function getModelName() {
+ return $this->modelName;
+ }
+ public function setVfsdatabaseid(int $id) {
+ $this->vfs_database_id = (int) $id;
+ }
+ public function getVfsdatabaseid() {
+ return $this->vfs_database_id;
+ }
+ public function getModelId() {
+ return $this->modelId;
+ }
+ public function setModelId(int $id) {
+ $this->modelId = $id;
+ }
+}
+
+
Modified: trunk/bim/inc/class.sobimmodelinformation.inc.php
===================================================================
--- trunk/bim/inc/class.sobimmodelinformation.inc.php 2011-02-16 09:49:40 UTC
(rev 7013)
+++ trunk/bim/inc/class.sobimmodelinformation.inc.php 2011-02-16 14:10:41 UTC
(rev 7014)
@@ -1,7 +1,7 @@
<?php
-phpgw::import_class('property.bimExceptions');
-phpgw::import_class('property.bimmodelinformation');
+phpgw::import_class('bim.bimExceptions');
+phpgw::import_class('bim.bimmodelinformation');
/*
* @see sobimmodel_impl
Modified: trunk/bim/inc/class.soitem.inc.php
===================================================================
--- trunk/bim/inc/class.soitem.inc.php 2011-02-16 09:49:40 UTC (rev 7013)
+++ trunk/bim/inc/class.soitem.inc.php 2011-02-16 14:10:41 UTC (rev 7014)
@@ -1,14 +1,14 @@
<?php
-phpgw::import_class('property.soitem_group');
-phpgw::import_class('property.boitem');
+phpgw::import_class('bim.soitem_group');
+phpgw::import_class('bim.boitem');
/**
* Description of soitem
*
* @author Espen
*/
- class property_soitem
+ class bim_soitem
{
private $db;
private static $instance;
@@ -20,7 +20,7 @@
/**
- * @return property_soitem
+ * @return bim_soitem
*/
public static function singleton()
{
@@ -136,11 +136,11 @@
}
$return_objects = array();
- $sogroup = property_sogroup::singleton();
+ $sogroup = bim_sogroup::singleton();
foreach($items as $item)
{
- $item_obj = new property_boitem($items['installed_date']);
+ $item_obj = new bim_boitem($items['installed_date']);
$item_obj->set_group($sogroup->get($item['group_id']));
$return_objects[] = $item_obj;
@@ -153,9 +153,9 @@
/**
* Save changes on an item to database or insert a new one if ID is
empty.
*
- * @param property_boitem $obj
+ * @param bim_boitem $obj
*/
- public function save(property_boitem $obj)
+ public function save(bim_boitem $obj)
{
// If item has an ID, do an update, otherwise, do an insert
$ins_or_upd = ($obj->get_id() != null ? 'UPDATE' : 'INSERT INTO');
Modified: trunk/bim/inc/class.soitem_group.inc.php
===================================================================
--- trunk/bim/inc/class.soitem_group.inc.php 2011-02-16 09:49:40 UTC (rev
7013)
+++ trunk/bim/inc/class.soitem_group.inc.php 2011-02-16 14:10:41 UTC (rev
7014)
@@ -5,7 +5,7 @@
*
* @author Espen
*/
- class property_soitem_group {
+ class bim_soitem_group {
private $db;
private static $instance;
@@ -15,7 +15,7 @@
/**
- * @return property_sogroup
+ * @return bim_sogroup
*/
public static function singleton()
{
@@ -90,10 +90,10 @@
}
$return_objects = array();
- $socatalog = property_socatalog::get_instance();
+ $socatalog = bim_socatalog::get_instance();
foreach($groups as $group) {
- $group_obj = new property_bogroup();
+ $group_obj = new bim_bogroup();
$group_obj->set_bpn($group['bpn']);
$group_obj->set_name($group['name']);
$group_obj->set_nat_group_no($group['ngno']);
Modified: trunk/bim/inc/class.sovfs.inc.php
===================================================================
--- trunk/bim/inc/class.sovfs.inc.php 2011-02-16 09:49:40 UTC (rev 7013)
+++ trunk/bim/inc/class.sovfs.inc.php 2011-02-16 14:10:41 UTC (rev 7014)
@@ -2,7 +2,7 @@
/*
* Class that interacts with the VFS system in portico
*/
-phpgw::import_class('property.bimExceptions');
+phpgw::import_class('bim.bimExceptions');
/*
* Interface for communicating with Portico estate's virtual file system
*/
@@ -213,4 +213,4 @@
return $this->subModule;
}
- }
\ No newline at end of file
+ }
Added: trunk/bim/inc/class.uibim.inc.php
===================================================================
--- trunk/bim/inc/class.uibim.inc.php (rev 0)
+++ trunk/bim/inc/class.uibim.inc.php 2011-02-16 14:10:41 UTC (rev 7014)
@@ -0,0 +1,352 @@
+<?php
+phpgw::import_class('phpgwapi.yui');
+phpgw::import_class('bim.soitem');
+phpgw::import_class('bim.sobim');
+phpgw::import_class('bim.sovfs');
+phpgw::import_class('bim.sobimmodel');
+phpgw::import_class('bim.sobim_converter');
+phpgw::import_class('bim.soitem_group');
+phpgw::import_class('bim.bobimmodel');
+phpgw::import_class('bim.bobimitem');
+phpgw::import_class('bim.sobimitem');
+phpgw::import_class('bim.sobimtype');
+phpgw::import_class('bim.sobimmodelinformation');
+/*
+ * This class serves as the 'Controller' or 'Container' in a dependancy
injection context
+ */
+interface uibim {
+
+}
+class bim_uibim implements uibim {
+ public static $virtualFileSystemPath = "ifc";
+ private $db;
+ /* @var $bocommon property_bocommon */
+ private $bocommon;
+ private $bimconverterUrl = "http://localhost:8080/bimconverter/rest/";
+
+ public function __construct() {
+ $this->bocommon = CreateObject('property.bocommon');
+
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
'bim::item::index';
+ $this->db = & $GLOBALS['phpgw']->db;
+ }
+
+ public $public_functions = array
+ (
+ 'index' => true,
+ 'foo' => true,
+ 'showModels' => true,
+ 'getModelsJson' => true,
+ 'removeModelJson' => true,
+ 'getFacilityManagementXmlByModelId' => true,
+ 'upload' => true,
+ 'uploadFile' => true,
+ 'displayModelInformation' => true
+ );
+ private function setupBimCss() {
+ if ( !isset($GLOBALS['phpgw']->css) ||
!is_object($GLOBALS['phpgw']->css) ) {
+ $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+ }
+
$GLOBALS['phpgw']->css->add_external_file('bim/templates/base/css/bim.css');
+ }
+ public function getModelsJson() {
+ $GLOBALS['phpgw_info']['flags']['noheader'] = true;
+ $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+ header("Content-type: application/json");
+ $bobimmodel = new bobimmodel_impl();
+ $sobimmodel = new sobimmodel_impl($this->db);
+ $bobimmodel->setSobimmodel($sobimmodel);
+ $output = $bobimmodel->createBimModelList();
+// return $output;
+ echo json_encode($output);
+ }
+ /*
+ *
+ */
+ public function removeModelJson($modelId = null) {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+ header("Content-type: application/json");
+ $output = array();
+ $output["result"] = 1;
+ if($modelId == null) {
+ $modelId = (int) phpgw::get_var("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);
+ try {
+ $bobimmodel->removeIfcModelByModelId();
+ echo json_encode($output);
+ } catch (InvalidArgumentException $e) {
+ $output["result"] = 0;
+ $output["error"] = "Invalid arguments";
+ $output["exception"] = $e;
+ echo json_encode($output);
+ } catch (ModelDoesNotExistException $e) {
+ $output["result"] = 0;
+ $output["error"] = "Model does not exist!";
+ $output["exception"] = $e;
+ echo json_encode($output);
+ } catch (Exception $e) {
+ $output["result"] = 0;
+ $output["error"] = "General error";
+ $output["exception"] = $e;
+ echo json_encode($output);
+ }
+ }
+
+ 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);
+ }
+
+
+
+ }
+
+ private function getFacilityManagementXmlFromIfc($fileWithPath) {
+ $sobim_converter = new sobim_converter_impl();
+ $sobim_converter->setBaseUrl($this->bimconverterUrl);
+ $sobim_converter->setFileToSend($fileWithPath);
+
+ try {
+ $returnedXml =
$sobim_converter->getFacilityManagementXml();
+ $sxe = simplexml_load_string($returnedXml);
+ return $sxe;
+ } catch (NoResponseException $e) {
+ throw $e;
+ } catch (InvalidArgumentException $e) {
+ throw $e;
+ } catch ( Exception $e) {
+ echo $e;
+ }
+ }
+
+ public function showModels() {
+ $GLOBALS['phpgw']->js->validate_file( 'yahoo', 'bim.modellist',
'bim' );
+ /*$GLOBALS['phpgw_info']['flags']['noheader'] = false;
+ $GLOBALS['phpgw_info']['flags']['nofooter'] = false;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+ $GLOBALS['phpgw']->common->phpgw_header(true);*/
+
+
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('bim_showmodels'));
+ $bobimmodel = new bobimmodel_impl();
+ $sobimmodel = new sobimmodel_impl($this->db);
+ $bobimmodel->setSobimmodel($sobimmodel);
+ $output = $bobimmodel->createBimModelList();
+ $loadingImage = $GLOBALS['phpgw']->common->find_image('bim',
'ajaxLoader.gif');
+ $data = array (
+ 'models' => $output,
+ 'loadingImage' => $loadingImage
+ );
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('modelData'
=> $data));
+ $this->setupBimCss();
+ // echo '<script type="text/javascript"
src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>';
+ $ble = <<<HTML
+ <script>YUI().use("event-delegate", function(Y) {
+
+ Y.delegate("click", function(e) {
+
+ // The list item that matched the provided selector is the
+ // default 'this' object
+ Y.log("Default scope: " + this.get("id"));
+
+ // The list item that matched the provided selector is
+ // also available via the event's currentTarget property
+ // in case the 'this' object is overridden in the subscription.
+ Y.log("Clicked list item: " + e.currentTarget.get("id"));
+
+ // The actual click target, which could be the matched item or a
+ // descendant of it.
+ Y.log("Event target: " + e.target);
+
+ // The delegation container is added to the event facade
+ Y.log("Delegation container: " + e.container.get("id"));
+
+
+ }, "#container44", "li");
+
+});</script>
+HTML;
+
+ $someOutput = '<div id="container44"><ul id="list"><li
id="li-1">List Item 1</li>
+ <li id="li-2">List Item 2</li>
+ <li id="li-3">List Item 3</li>
+ <li id="li-4">List Item 4</li>
+ <li id="li-5">List Item 5</li>
+ </ul>
+ </div> <script>doDelegate()</script>';
+ }
+
+ private $form_upload_field_filename ="ifc_file_name";
+ private $form_upload_field_modelname ="ifc_model_name";
+
+ public function upload() {
+ $GLOBALS['phpgw']->xslttpl->add_file(array('bim_upload_ifc'));
+
+ $import_action =
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'bim.uibim.uploadFile', 'id'=> $id));
+ $data = array
+ (
+ 'importfile'
=> $importfile,
+ 'values'
=> $content,
+ 'form_field_modelname' =>
$this->form_upload_field_modelname,
+ 'form_field_filename' =>
$this->form_upload_field_filename,
+ 'import_action'
=> $import_action,
+ 'lang_import_statustext' =>
lang('import to this location from spreadsheet'),
+ 'lang_import'
=> lang('import'),
+ 'lang_cancel'
=> lang('cancel')
+ );
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('upload' =>
$data));
+ $this->setupBimCss();
+ }
+
+
+ public function uploadFile($uploadedFileArray = null, $modelName =
null, $unitTest = false) {
+ if(!$unitTest) {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('bim_upload_ifc_result'));
+ }
+
+ if(!$uploadedFileArray) {
+ $uploadedFileArray =
$_FILES[$this->form_upload_field_filename];
+ }
+ if(!$modelName) {
+ $modelName =
phpgw::get_var($this->form_upload_field_modelname);
+ }
+ $returnValue = array();
+
+ $filename = $uploadedFileArray['name'];
+ $filenameWithPath = $uploadedFileArray['tmp_name'];
+ $bobimmodel = new bobimmodel_impl();
+ $sovfs = new sovfs_impl($filename, $filenameWithPath,
self::$virtualFileSystemPath);
+ $bobimmodel->setVfsObject($sovfs);
+ $sobimmodel = new sobimmodel_impl($this->db);
+ $bobimmodel->setSobimmodel($sobimmodel);
+ $bobimmodel->setModelName($modelName);
+ $errorMessage = "";
+ $error = false;
+ try {
+ $bobimmodel->addUploadedIfcModel();
+
+ } catch (FileExistsException $e) {
+ $error = true;
+ $errorMessage = "Filename in use! \n Try renaming the
file";
+ if($unitTest) {
+ throw $e;
+ }
+ } catch (Exception $e) {
+ $error = true;
+ $errorMessage = $e->getMessage();
+ if($unitTest) {
+ throw $e;
+ }
+ }
+
+
+ $link_to_models =
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'bim.uibim.showModels'));
+ $link_to_upload =
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 'bim.uibim.upload'));
+ $data = array
+ (
+ 'modelName'
=> $modelName,
+ 'error'
=> $error,
+ 'errorMessage'
=> $errorMessage,
+ 'linkToModels'
=> $link_to_models,
+ 'linkToUpload'
=> $link_to_upload
+ );
+
+ if(!$unitTest) {
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('uploadResult' => $data));
+ }
+
+ return $data;
+ }
+
+ public function displayModelInformation() {
+ /*$GLOBALS['phpgw_info']['flags']['noheader'] = false;
+ $GLOBALS['phpgw_info']['flags']['nofooter'] = false;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+ $GLOBALS['phpgw']->common->phpgw_header(true);*/
+
$GLOBALS['phpgw']->xslttpl->add_file(array('bim_modelinformation'));
+ $modelId = phpgw::get_var("modelId");
+ //$modelId = 3;
+ if(empty($modelId)) {
+ // go apeshit
+ echo "No modelId!";
+
+ } else {
+ $sobimInfo = new sobimmodelinformation_impl($this->db,
$modelId);
+ /* @var $modelInfo BimModelInformation */
+ $modelInfo = $sobimInfo->getModelInformation();
+ $sobimmodel = new sobimmodel_impl($this->db);
+ $sobimmodel->setModelId($modelId);
+ /* @var $model BimModel */
+ $model = $sobimmodel->retrieveBimModelInformationById();
+ $data = array (
+ 'model' =>
$model->transformObjectToArray(),
+ 'information' =>
$modelInfo->transformObjectToArray()
+ );
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('modelInformation' => $data));
+
+ }
+
+ $this->setupBimCss();
+
+ }
+
+
+}
Modified: trunk/bim/inc/class.uibimitem.inc.php
===================================================================
--- trunk/bim/inc/class.uibimitem.inc.php 2011-02-16 09:49:40 UTC (rev
7013)
+++ trunk/bim/inc/class.uibimitem.inc.php 2011-02-16 14:10:41 UTC (rev
7014)
@@ -1,7 +1,7 @@
<?php
phpgw::import_class('phpgwapi.yui');
-phpgw::import_class('property.bobimitem');
-phpgw::import_class('property.sobimitem');
+phpgw::import_class('bim.bobimitem');
+phpgw::import_class('bim.sobimitem');
/*
* This class serves as the 'Controller' or 'Container' in a dependancy
injection context
*/
@@ -9,7 +9,7 @@
public function showItems();
public function showBimItem();
}
-class property_uibimitem implements uibimitem {
+class bim_uibimitem implements uibimitem {
private $db;
public function __construct() {
@@ -26,7 +26,7 @@
);
public function showItems() {
- $GLOBALS['phpgw']->js->validate_file( 'yahoo', 'bim.modellist',
'property' );
+ $GLOBALS['phpgw']->js->validate_file( 'yahoo', 'bim.modellist',
'bim' );
$modelId = phpgw::get_var("modelId");
//$modelId = 3;
if(empty($modelId)) {
@@ -65,7 +65,7 @@
$GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
$GLOBALS['phpgw']->common->phpgw_header(true);*/
- $GLOBALS['phpgw']->js->validate_file( 'yahoo', 'bim.modellist',
'property' );
+ $GLOBALS['phpgw']->js->validate_file( 'yahoo', 'bim.modellist',
'bim' );
$modelGuid = phpgw::get_var("modelGuid");
//$modelId = 3;
if(empty($modelGuid)) {
@@ -90,7 +90,7 @@
phpgw::import_class('phpgwapi.template_portico');
$app = $GLOBALS['phpgw_info']['flags']['currentapp'];
-
$GLOBALS['phpgw']->template->set_root("C:\\vBoxShare\\html\\dev-bim2\\property\\templates\\portico");
+
$GLOBALS['phpgw']->template->set_root("C:\\vBoxShare\\html\\dev-bim2\\bim\\templates\\portico");
$GLOBALS['phpgw']->template->set_unknowns('remove');
$GLOBALS['phpgw']->template->set_file('test', 'test.tpl');
$tpl_vars = array
@@ -106,8 +106,8 @@
if ( !isset($GLOBALS['phpgw']->css) || !is_object($GLOBALS['phpgw']->css)
) {
$GLOBALS['phpgw']->css = createObject('phpgwapi.css');
}
-
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/bim.css');
+
$GLOBALS['phpgw']->css->add_external_file('bim/templates/base/css/bim.css');
}
-}
\ No newline at end of file
+}
Modified: trunk/bim/inc/class.uiifc.inc.php
===================================================================
--- trunk/bim/inc/class.uiifc.inc.php 2011-02-16 09:49:40 UTC (rev 7013)
+++ trunk/bim/inc/class.uiifc.inc.php 2011-02-16 14:10:41 UTC (rev 7014)
@@ -22,7 +22,7 @@
*
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
+ * @package bim
* @subpackage ifc
* @version $Id$
*/
@@ -55,18 +55,18 @@
function uiifc()
{
$GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
- $GLOBALS['phpgw_info']['flags']['menu_selection'] =
'property::ifc';
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
'bim::ifc';
// $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->cats =
CreateObject('phpgwapi.categories');
$this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bo =
CreateObject('property.boifc',true);
+ $this->bo =
CreateObject('bim.boifc',true);
$this->acl = &
$GLOBALS['phpgw']->acl;
$this->acl_location = '.ifc';
- $this->acl_read =
true;//$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
- $this->acl_add =
true;//$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
- $this->acl_edit =
true;//$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
- $this->acl_delete =
true;//$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
+ $this->acl_read =
true;//$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'bim');
+ $this->acl_add =
true;//$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'bim');
+ $this->acl_edit =
true;//$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'bim');
+ $this->acl_delete =
true;//$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'bim');
$this->start = $this->bo->start;
$this->query = $this->bo->query;
@@ -136,19 +136,19 @@
{
$content[$j]['row'][$i]['statustext'] = lang('view the
record');
$content[$j]['row'][$i]['text']
= lang('view');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'property.uiifc.view','ifc_id'=> $entry['id']));
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'bim.uiifc.view','ifc_id'=> $entry['id']));
}
if($this->acl_edit)
{
$content[$j]['row'][$i]['statustext'] = lang('edit the
record');
$content[$j]['row'][$i]['text']
= lang('edit');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'property.uiifc.edit', 'ifc_id'=> $entry['id']));
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 'bim.uiifc.edit',
'ifc_id'=> $entry['id']));
}
if($this->acl_delete)
{
$content[$j]['row'][$i]['statustext'] = lang('delete the
record');
$content[$j]['row'][$i]['text']
= lang('delete');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'property.uiifc.delete', 'ifc_id'=> $entry['id']));
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 'bim.uiifc.delete',
'ifc_id'=> $entry['id']));
}
$j++;
@@ -170,7 +170,7 @@
'sort' =>
$this->sort,
'var' =>
$uicols['name'][$i],
'order' =>
$this->order,
- 'extra' =>
array('menuaction' => 'property.uiifc.index',
+ 'extra' =>
array('menuaction' => 'bim.uiifc.index',
'query' => $this->query,
'cat_id' => $this->cat_id,
'filter' => $this->filter,
@@ -211,7 +211,7 @@
(
'lang_add'
=> lang('add'),
'lang_add_statustext' => lang('add a
ifc'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'property.uiifc.edit','output'=>$output)),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'bim.uiifc.edit','output'=>$output)),
);
}
@@ -226,7 +226,7 @@
$link_data = array
(
- 'menuaction' => 'property.uiifc.index',
+ 'menuaction' => 'bim.uiifc.index',
'sort' => $this->sort,
'order' => $this->order,
'cat_id' => $this->cat_id,
@@ -262,7 +262,7 @@
//_debug_array($data);
$function_msg= lang('list ifc values');
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property'). ': ' . $function_msg;
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('bim'). ': ' . $function_msg;
if($output == 'wml')
{
@@ -274,10 +274,10 @@
function import()
{
- //$GLOBALS['phpgw']->locations->add('.ifc', 'ifc
integration','property',true);
+ //$GLOBALS['phpgw']->locations->add('.ifc', 'ifc
integration','bim',true);
$GLOBALS['phpgw_info']['flags']['menu_selection'] .=
'::import';
$acl_location = '.ifc.import';
- if(!$this->acl->check($acl_location,PHPGW_ACL_ADD,
'property'))
+ if(!$this->acl->check($acl_location,PHPGW_ACL_ADD,
'bim'))
{
// $this->no_access();
// return;
@@ -312,7 +312,7 @@
if (isset($values['save']) &&
$values['save'])
{
$GLOBALS['phpgw']->session->appsession('session_data','ifc_receipt',$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uiifc.index'));
+
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'bim.uiifc.index'));
}
}
}
@@ -322,7 +322,7 @@
{
unlink ($ifcfile);
}
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uiifc.index'));
+
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'bim.uiifc.index'));
}
}
@@ -339,7 +339,7 @@
$link_data = array
(
- 'menuaction' => 'property.uiifc.import'
+ 'menuaction' => 'bim.uiifc.import'
);
$msgbox_data = isset($msgbox_data) ?
$GLOBALS['phpgw']->common->msgbox_data($receipt) : '';
@@ -467,13 +467,13 @@
if (isset($values['save']) &&
$values['save'])
{
$GLOBALS['phpgw']->session->appsession('session_data','hrm_training_receipt',$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction'=>
'property.uiifc.index', 'output'=> $output));
+
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction'=>
'bim.uiifc.index', 'output'=> $output));
}
}
}
else
{
-
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction'=>
'property.uiifc.index', 'output'=> $output));
+
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction'=>
'bim.uiifc.index', 'output'=> $output));
}
}
@@ -496,7 +496,7 @@
$link_data = array
(
- 'menuaction' => 'property.uiifc.edit',
+ 'menuaction' => 'bim.uiifc.edit',
'ifc_id' => $ifc_id,
'output' => $output
);
@@ -545,7 +545,7 @@
$appname = lang('ifc');
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('bim') . ' - ' . $appname . ': ' . $function_msg;
if($output == 'wml')
{
$GLOBALS['phpgw']->xslttpl->set_output('wml');
@@ -600,7 +600,7 @@
'lang_town'
=> lang('town'),
'lang_remark' =>
lang('remark'),
- 'form_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'property.uiifc.index','output'=>$output)),
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'bim.uiifc.index','output'=>$output)),
'lang_cancel' =>
lang('cancel'),
'value_id'
=> $ifc_id,
'lang_category' =>
lang('category'),
@@ -614,7 +614,7 @@
$appname = lang('ifc');
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('bim') . ' - ' . $appname . ': ' . $function_msg;
if($output == 'wml')
{
$GLOBALS['phpgw']->xslttpl->set_output('wml');
@@ -643,7 +643,7 @@
$link_data = array
(
- 'menuaction' => 'property.uiifc.index'
+ 'menuaction' => 'bim.uiifc.index'
);
if (phpgw::get_var('confirm', 'bool', 'POST'))
@@ -657,7 +657,7 @@
$data = array
(
'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'property.uiifc.delete', 'ifc_id'=> $ifc_id)),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 'bim.uiifc.delete',
'ifc_id'=> $ifc_id)),
'lang_confirm_msg' => lang('do you
really want to delete this entry'),
'lang_yes' =>
lang('yes'),
'lang_yes_statustext' => lang('Delete the
entry'),
@@ -668,7 +668,7 @@
$appname = lang('ifc');
$function_msg = lang('delete');
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('bim') . ' - ' . $appname . ': ' . $function_msg;
if($output == 'wml')
{
@@ -693,7 +693,7 @@
$appname = lang('No access');
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname;
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('bim') . ' - ' . $appname;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('no_access' => $data));
}
}
Modified: trunk/bim/inc/class.uiitem.inc.php
===================================================================
--- trunk/bim/inc/class.uiitem.inc.php 2011-02-16 09:49:40 UTC (rev 7013)
+++ trunk/bim/inc/class.uiitem.inc.php 2011-02-16 14:10:41 UTC (rev 7014)
@@ -1,20 +1,20 @@
<?php
phpgw::import_class('phpgwapi.yui');
-phpgw::import_class('property.soitem');
-phpgw::import_class('property.sobim');
-phpgw::import_class('property.sovfs');
-phpgw::import_class('property.sobimmodel');
-phpgw::import_class('property.sobim_converter');
-phpgw::import_class('property.soitem_group');
-phpgw::import_class('property.bobimmodel');
+phpgw::import_class('bim.soitem');
+phpgw::import_class('bim.sobim');
+phpgw::import_class('bim.sovfs');
+phpgw::import_class('bim.sobimmodel');
+phpgw::import_class('bim.sobim_converter');
+phpgw::import_class('bim.soitem_group');
+phpgw::import_class('bim.bobimmodel');
phpgw::import_class('phpgwapi.datetime');
-//phpgw::import_class('property.bobimcreate');
+//phpgw::import_class('bim.bobimcreate');
/**
* FIXME: Description
- * @package property
+ * @package bim
*/
-class property_uiitem {
+class bim_uiitem {
public static $virtualFileSystemPath = "ifc";
@@ -43,10 +43,10 @@
$this->bocommon = CreateObject('property.bocommon');
$GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
- $GLOBALS['phpgw_info']['flags']['menu_selection'] =
'property::item::index';
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] = 'bim::item::index';
$this->db = & $GLOBALS['phpgw']->db;
- $this->so = property_soitem::singleton();
- $this->sogroup = property_soitem_group::singleton();
+ $this->so = bim_soitem::singleton();
+ $this->sogroup = bim_soitem_group::singleton();
}
@@ -84,7 +84,7 @@
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('actor') . ': ' .
lang('list ' . $this->role);
// Prepare YUI Library
- $GLOBALS['phpgw']->js->validate_file( 'yahoo', 'item.index',
'property' );
+ $GLOBALS['phpgw']->js->validate_file( 'yahoo', 'item.index', 'bim' );
//$this->save_sessiondata();
}
@@ -150,10 +150,10 @@
// Set base URL. FIXME: Add more URL parameters when needed
$datatable['config']['base_url'] =
$GLOBALS['phpgw']->link('/index.php', array
(
- 'menuaction'=> 'property.uiitem.index',
+ 'menuaction'=> 'bim.uiitem.index',
));
$datatable['config']['allow_allrows'] = true;
- $datatable['config']['base_java_url'] =
"menuaction:'property.uiitem.index',group:'all'";
+ $datatable['config']['base_java_url'] =
"menuaction:'bim.uiitem.index',group:'all'";
$this->setForm($datatable);
$this->dry_run=true;
}
@@ -169,7 +169,7 @@
array(
'action' => $GLOBALS['phpgw']->link('/index.php',
array(
- 'menuaction' => 'property.uiitem.index',
+ 'menuaction' => 'bim.uiitem.index',
'group_id' => 0
)
),
@@ -188,7 +188,7 @@
'id' => 'btn_columns',
'url' =>
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
array(
- 'menuaction' =>
'property.uiitem.columns',
+ 'menuaction' =>
'bim.uiitem.columns',
'role' => $this->role
))."','','width=350,height=370')",
'value' => lang('columns'),
@@ -313,7 +313,7 @@
'text' => lang('view'),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
- 'menuaction' => 'property.uiitem.view',
+ 'menuaction' => 'bim.uiitem.view',
'role' => $this->role
)),
'parameters' => $parameters
@@ -323,7 +323,7 @@
'text' => lang('open view in new
window'),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
- 'menuaction' => 'property.uiitem.view',
+ 'menuaction' => 'bim.uiitem.view',
'role' => $this->role,
'target' => '_blank'
)),
@@ -336,7 +336,7 @@
'text' => lang('edit'),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
- 'menuaction'=> 'property.uiitem.edit',
+ 'menuaction'=> 'bim.uiitem.edit',
'role' => $this->role
)),
'parameters' => $parameters
@@ -346,7 +346,7 @@
'text' => lang('open edit in new
window'),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
- 'menuaction' => 'property.uiitem.edit',
+ 'menuaction' => 'bim.uiitem.edit',
'role' => $this->role,
'target' => '_blank'
)),
@@ -359,7 +359,7 @@
'confirm_msg' => lang('do you really want to delete this
entry'),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
- 'menuaction' => 'property.uiitem.delete',
+ 'menuaction' => 'bim.uiitem.delete',
'role' => $this->role
)),
'parameters' => $parameters
@@ -369,7 +369,7 @@
'text' => lang('add'),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
- 'menuaction' => 'property.uiitem.edit',
+ 'menuaction' => 'bim.uiitem.edit',
'role' => $this->role
))
);
@@ -401,13 +401,13 @@
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
-
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/bim.css');
+
$GLOBALS['phpgw']->css->add_external_file('bim/templates/base/css/bim.css');
}
private function setupBimCss() {
if ( !isset($GLOBALS['phpgw']->css) || !is_object($GLOBALS['phpgw']->css)
) {
$GLOBALS['phpgw']->css = createObject('phpgwapi.css');
}
-
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/bim.css');
+
$GLOBALS['phpgw']->css->add_external_file('bim/templates/base/css/bim.css');
}
public function foo() {
@@ -501,7 +501,7 @@
}
public function showModels() {
- $GLOBALS['phpgw']->js->validate_file( 'yahoo', 'bim.modellist',
'property' );
+ $GLOBALS['phpgw']->js->validate_file( 'yahoo', 'bim.modellist', 'bim' );
/*$GLOBALS['phpgw_info']['flags']['noheader'] = false;
$GLOBALS['phpgw_info']['flags']['nofooter'] = false;
$GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
@@ -514,7 +514,7 @@
$sobimmodel = new sobimmodel_impl($this->db);
$bobimmodel->setSobimmodel($sobimmodel);
$output = $bobimmodel->createBimModelList();
- $loadingImage = $GLOBALS['phpgw']->common->find_image('property',
'ajaxLoader.gif');
+ $loadingImage = $GLOBALS['phpgw']->common->find_image('bim',
'ajaxLoader.gif');
$data = array (
'models' => $output,
'loadingImage' => $loadingImage
@@ -564,7 +564,7 @@
public function upload() {
$GLOBALS['phpgw']->xslttpl->add_file(array('bim_upload_ifc'));
- $import_action =
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiitem.uploadFile', 'id'=> $id));
+ $import_action =
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'bim.uiitem.uploadFile', 'id'=> $id));
$data = array
(
'importfile'
=> $importfile,
Added: trunk/bim/index.php
===================================================================
--- trunk/bim/index.php (rev 0)
+++ trunk/bim/index.php 2011-02-16 14:10:41 UTC (rev 7014)
@@ -0,0 +1,45 @@
+<?php
+ /**
+ * phpGroupWare - bim: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package bim
+ * @version $Id: index.php 6445 2010-10-05 21:52:58Z sigurdne $
+ */
+
+ /**
+ * Start page
+ *
+ * This script will check if there is defined a startpage in the users
+ * preferences - and then forward the user to this page
+ */
+
+ $GLOBALS['phpgw_info']['flags'] = array
+ (
+ 'noheader' => true,
+ 'nonavbar' => true,
+ 'currentapp' => 'bim'
+ );
+
+ include_once('../header.inc.php');
+
+ $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' =>
'bim.uibim.showModels'));
Added: trunk/bim/js/yahoo/bim.modellist.js
===================================================================
--- trunk/bim/js/yahoo/bim.modellist.js (rev 0)
+++ trunk/bim/js/yahoo/bim.modellist.js 2011-02-16 14:10:41 UTC (rev 7014)
@@ -0,0 +1,443 @@
+function include_yui3(filename) {
+ var head = document.getElementsByTagName('head')[0];
+ script = document.createElement('script');
+ script.src = filename;
+ script.type = 'text/javascript';
+ head.appendChild(script)
+}
+// Load YUI3
+//include_yui3('http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js');
+
+// Because of the way portico does loading, this function must be called
specifically
+function doDelegateDeleteModel(){
+ function deleteModelCall(e) {
+ var path_update = new Array();
+ path_update["menuaction"] = "bim.uibim.removeModelJson";
+ var postUrl = phpGWLink('index.php',path_update);
+ var modelDatabaseId = this.getAttribute("value"); //
getAttribute("value");
+
+ var inputAlert = confirm("Are you sure you want to delete this
model(id:"+modelDatabaseId+") ?");
+ if(inputAlert) {
+ deleteModel(postUrl, modelDatabaseId);
+ }
+
+ //var Y = new YUI({ debug : true });
+ };
+ YUI().use("event-delegate", function(Y){
+ Y.delegate("click", deleteModelCall, "#bimModelList2",
"button.del");
+ });
+};
+
+function doDelegateLoadModel(){
+ function loadModelCall(e) {
+ var path_update = new Array();
+ path_update["menuaction"] =
"bim.uibim.getFacilityManagementXmlByModelId";
+ var postUrl = phpGWLink('index.php',path_update);
+ var modelDatabaseId = this.getAttribute("value");
//getAttribute("value");
+
+ var inputAlert = confirm("Are you sure you want to load this
model(id:"+modelDatabaseId+") ?");
+ if(inputAlert) {
+ loadModel(postUrl, modelDatabaseId);
+ }
+
+ //var Y = new YUI({ debug : true });
+ };
+ YUI().use("event-delegate", function(Y){
+ Y.delegate("click", loadModelCall, "#bimModelList2",
"button.load");
+ });
+};
+function doDelegateModelInfo(){
+ function loadModelInfoCall(e) {
+ var path_update = new Array();
+ path_update["menuaction"] = "bim.uibim.displayModelInformation";
+ var postUrl = phpGWLink('index.php',path_update);
+ var modelDatabaseId = this.getAttribute("value");
//getAttribute("value");
+
createAppendSubmitModelIdForm(postUrl,"modelId",modelDatabaseId);
+ };
+ YUI().use("event-delegate", function(Y){
+ Y.delegate("click", loadModelInfoCall, "#bimModelList2",
"button.info");
+ });
+};
+
+
+function doDelegateModelView(){
+ function loadModelViewCall(e) {
+ var path_update = new Array();
+ path_update["menuaction"] = "bim.uibimitem.showItems";
+ var postUrl = phpGWLink('index.php',path_update);
+ var modelDatabaseId = this.getAttribute("value");
//getAttribute("value");
+
createAppendSubmitModelIdForm(postUrl,"modelId",modelDatabaseId);
+ };
+ YUI().use("event-delegate", function(Y){
+ Y.delegate("click", loadModelViewCall, "#bimModelList2",
"button.view");
+ });
+};
+function doDelegateViewItem(){
+ function loadViewItemCall(e) {
+ YUI().use('node', function(Y) {
+ var path_update = new Array();
+ path_update["menuaction"] = "bim.uibimitem.showBimItem";
+ var postUrl = phpGWLink('index.php',path_update);
+ var guid = e.currentTarget.getContent();
+ createAppendSubmitModelIdForm(postUrl,"modelGuid",guid);
+ });
+ };
+
+ YUI().use("event-delegate", function(Y){
+ Y.delegate("click", loadViewItemCall, "#bimItems", "td.guid");
+ });
+};
+function createAppendSubmitModelIdForm(postUrl, varName, varValue) {
+ var form = document.createElement("form");
+ form.setAttribute("method", "post");
+ form.setAttribute("action", postUrl);
+ var hiddenField = document.createElement("input");
+ hiddenField.setAttribute("type", "hidden");
+ hiddenField.setAttribute("name", varName);
+ hiddenField.setAttribute("value", varValue);
+ form.appendChild(hiddenField);
+ document.body.appendChild(form);
+ form.submit();
+}
+/*
+function populateModelList() {
+ YUI().use('io-base','node', function(Y) {
+ var modelTable = Y.one('#bimModelList2');
+ var rowCount = modelTable.get("rows").size();
+ var currentRow = modelTable.invoke("insertRow",rowCount);
+ console.log(currentRow);
+ });
+
+}
+*/
+function hideLoadingDiv() {
+ YUI().use('node', function(Y) {
+ var loadingDiv = Y.one('#modelsLoader');
+ loadingDiv.hide();
+ });
+}
+
+
+function showLoadingDiv() {
+ YUI().use('node', function(Y) {
+ var loadingDiv = Y.one('#modelsLoader');
+ loadingDiv.show();
+ });
+}
+
+function clearModelList() {
+ YUI().use('node', function(Y) {
+ var modelTable = Y.one('#bimModelList2');
+ var rowCount = modelTable.get("rows").size();
+ while ( rowCount > 1) {
+ modelTable.invoke("deleteRow", rowCount -1);
+ rowCount = modelTable.get("rows").size();
+ }
+ });
+}
+function getModelList() {
+ YUI().use('io-base','node', 'json-parse', function(Y) {
+ showLoadingDiv;
+ var modelTable = Y.one('#bimModelList2');
+ var rowCount = modelTable.get("rows").size();
+ //object in its second argument:
+ function successHandler(id, o){
+ Y.log("Success handler called; handler will parse the
retrieved XML and insert into DOM.", "info", "example");
+
+ var root = o.responseText;
+ try {
+ var data = Y.JSON.parse(root);
+ } catch (e) {
+ alert("Invalid data");
+ }
+
+ for (var i = 0; i < data.length; i++) {
+ var bimModel = data[i];
+ var currentRow =
modelTable.invoke("insertRow",rowCount);
+ var cellIndex = 0;
+ var cell = currentRow.invoke("insertCell",
cellIndex++);
+
cell.appendChild(document.createTextNode(bimModel.databaseId));
+ cell = currentRow.invoke("insertCell",
cellIndex++);
+
cell.appendChild(document.createTextNode(bimModel.name));
+ cell = currentRow.invoke("insertCell",
cellIndex++);
+
cell.appendChild(document.createTextNode(bimModel.creationDate));
+ cell = currentRow.invoke("insertCell",
cellIndex++);
+
cell.appendChild(document.createTextNode(bimModel.fileSize));
+ cell = currentRow.invoke("insertCell",
cellIndex++);
+
cell.appendChild(document.createTextNode(bimModel.fileName));
+ cell = currentRow.invoke("insertCell",
cellIndex++);
+
cell.appendChild(document.createTextNode(bimModel.usedItemCount));
+ cell = currentRow.invoke("insertCell",
cellIndex++);
+
cell.appendChild(document.createTextNode(bimModel.vfsFileId));
+ cell = currentRow.invoke("insertCell",
cellIndex++);
+
cell.appendChild(document.createTextNode(bimModel.used));
+ cell = currentRow.invoke("insertCell",
cellIndex++);
+
cell.appendChild(createFunctionButton(bimModel.databaseId, "view", "View"));
+ cell = currentRow.invoke("insertCell",
cellIndex++);
+
cell.appendChild(createFunctionButton(bimModel.databaseId, "load", "Load"));
+ cell = currentRow.invoke("insertCell",
cellIndex++);
+
cell.appendChild(createFunctionButton(bimModel.databaseId, "del", "Remove"));
+ cell = currentRow.invoke("insertCell",
cellIndex++);
+
cell.appendChild(createFunctionButton(bimModel.databaseId, "info", "Info"));
+
+ rowCount++;
+ }
+ hideLoadingDiv();
+ Y.log("Success handler is complete.", "info",
"example");
+ }
+ function createFunctionButton(modelId, buttonClass, buttonText)
{
+ var buttonNode = document.createElement("button");
+ buttonNode.setAttribute('value', modelId);
+ buttonNode.setAttribute('class', buttonClass);
+
buttonNode.appendChild(document.createTextNode(buttonText));
+ return buttonNode;
+ }
+
+ //Provide a function that can help debug failed
+ //requests:
+ function failureHandler(id, o){
+ Y.log("Failure handler called; http status: " +
o.status, "info", "example");
+ var currentRow =
modelTable.invoke("insertRow",rowCount);
+ var cell = currentRow.invoke("insertCell", 0);
+ cell.appendChild(document.createTextNode( o.status + "
" + o.statusText));
+ }
+
+ function getModule(){
+ var oArgs = {menuaction:'bim.uibim.getModelsJson'};
+ var sUrl = phpGWLink('index.php', oArgs, false);
+// var entryPoint =
'/share/html/dev-bim2/index.php?menuaction=bim.uibim.getModelsJson';
+// var sUrl = entryPoint;
+ Y.log("Submitting request; ","info", "example");
+ var request = Y.io(sUrl, {
+ method:"POST",
+ on:
+ {
+ success:successHandler,
+ failure:failureHandler
+ }
+ }
+ );
+ }
+
+ //Use the Event Utility to wire the Get RSS button
+ //to the getModule function:
+ Y.on("load", getModule);
+
+ });
+}
+
+function reloadModelList() {
+ showLoadingDiv();
+ clearModelList();
+ getModelList();
+}
+
+function deleteModel(targetUrl, modelId) {
+ YUI().use('io-base','node', 'json-parse', function(Y) {
+
+ function successHandler(id, o){
+ Y.log("Success handler called; handler will parse the
retrieved XML and insert into DOM.", "info", "example");
+
+ var root = o.responseText;
+ try {
+ var data = Y.JSON.parse(root);
+ Y.log(data);
+ if(data.result == 1) {
+ Y.log("Delete was successful", "info");
+ } else {
+ Y.log("Error deleting!");
+ Y.log(data);
+ var string = "An error occurred! \n
error:"+data.error;
+ alert(string);
+ }
+ } catch (e) {
+ alert("Invalid data");
+ }
+ reloadModelList();
+ }
+
+ function failureHandler(id, o){
+ Y.log("Failure handler called; http status: " +
o.status, "info", "example");
+ alert(o.status + " " + o.statusText);
+ }
+
+ function removeModel(){
+ var entryPoint = targetUrl;
+ var sUrl = entryPoint;
+ Y.log("Submitting request; ","info", "example");
+ var request = Y.io(sUrl, {
+ method:"POST",
+ data: "modelId="+modelId,
+ on:
+ {
+ success:successHandler,
+ failure:failureHandler
+ }
+ }
+ );
+ }
+ removeModel();
+ });
+
+}
+
+function loadModel(targetUrl, modelId) {
+ YUI().use('io-base','node', 'json-parse', function(Y) {
+
+ function successHandler(id, o){
+ //Y.log("Success handler called; handler will parse the
retrieved XML and insert into DOM.", "info", "example");
+
+ var root = o.responseText;
+ try {
+ var data = Y.JSON.parse(root);
+ } catch (e) {
+ alert("Invalid data");
+ }
+ if(data.result == 1) {
+ Y.log("Load was successful", "info");
+ alert('Success!');
+ } else {
+ Y.log("Error loading!", "info");
+ var string = "An error occurred! \nerror:
"+data.error;
+ alert(string);
+ }
+ reloadModelList();
+ Y.log(data);
+ //Y.log("Success handler is complete.", "info",
"example");
+ }
+
+ function failureHandler(id, o){
+ //Y.log("Failure handler called; http status: " +
o.status, "info", "example");
+ alert(o.status + " " + o.statusText);
+ }
+
+ function loadModel(){
+ var entryPoint = targetUrl;
+ var sUrl = entryPoint;
+ Y.log("Submitting request; ","info", "example");
+ var request = Y.io(sUrl, {
+ method:"POST",
+ data: "modelId="+modelId,
+ on:
+ {
+ success:successHandler,
+ failure:failureHandler
+ }
+ }
+ );
+ }
+ loadModel();
+ });
+
+}
+
+function addModel(targetUrl, modelId) {
+ YUI().use('io-base','node', 'json-parse', function(Y) {
+
+ function successHandler(id, o){
+ Y.log("Success handler called; handler will parse the
retrieved XML and insert into DOM.", "info", "example");
+
+ var root = o.responseText;
+ try {
+ var data = Y.JSON.parse(root);
+ } catch (e) {
+ alert("Invalid data");
+ }
+ Y.log(data);
+ Y.log("Success handler is complete.", "info",
"example");
+ }
+
+ function failureHandler(id, o){
+ Y.log("Failure handler called; http status: " +
o.status, "info", "example");
+ alert(o.status + " " + o.statusText);
+ }
+
+ function removeModel(){
+ var entryPoint = targetUrl;
+ var sUrl = entryPoint;
+ Y.log("Submitting request; ","info", "example");
+ var request = Y.io(sUrl, {
+ method:"POST",
+ data: "modelId="+modelId,
+ on:
+ {
+ success:successHandler,
+ failure:failureHandler
+ }
+ }
+ );
+ }
+ removeModel();
+ });
+
+}
+/*
+function addListeners() {
+
+ var Dom = YAHOO.util.Dom;
+console.log("running");
+ var onDeleteModel = function (event, matchedEl, container) {
+ console.log(event, matchedEl, container);
+ alert('asdf');
+
+var panelHtmlId = matchedEl.value;//parentNode.parentNode.id;//
getCategoryId(matchedEl.parentNode.parentNode);
+
+ if(panelHtmlId != null) {
+ console.log(panelHtmlId);
+ }
+
+
+ };
+
+
+
+ try
+ {
+ console.log(YAHOO.util.Event.delegate("container", "click", alert('smile'),
"li"));
+ }
+catch(err)
+ {
+ alert(err);
+ }
+};
+
+console.log("doing stuff");
+YAHOO.util.Event.onDOMReady(addListeners);
+//addListeners();
+
+//YAHOO.util.Event.addListener("container44", "click", addListeners);
+
+var testFunc = function() {
+ console.log("My test function");
+}
+console.log(YAHOO.util.Event.delegate("container44", "click", testFunc, "li"));
+*/
+/*
+(function() {
+
+var Dom = YAHOO.util.Dom,
+ Event = YAHOO.util.Event;
+
+var onLIClick = function (event, matchedEl, container) {
+
+ alert('y');
+
+};
+
+// Use the "delegate" method to attach a "click" event listener to the
+// container (<div id="container">). The listener will only be called if
the
+// target of the click event matches the element specified via the CSS
+// selector passed as the fourth argument to the delegate method.
+
+console.log(Event.delegate("container44", "click", onLIClick, "li"));
+
+})();
+
+YUI().use('node-base', function(Y) {
+ Y.on("load", getModelList);
+
+
+ // Y.on("load", doDelegateDeleteModel);
+
+ });
+*/
Added: trunk/bim/setup/setup.inc.php
===================================================================
--- trunk/bim/setup/setup.inc.php (rev 0)
+++ trunk/bim/setup/setup.inc.php 2011-02-16 14:10:41 UTC (rev 7014)
@@ -0,0 +1,73 @@
+<?php
+ /**
+ * phpGroupWare
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2009 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package bim
+ * @subpackage setup
+ * @version $Id: setup.inc.php 6982 2011-02-14 20:01:17Z sigurdne $
+ */
+
+ $setup_info['bim']['name'] = 'bim';
+ $setup_info['bim']['version'] = '0.9.17.500';
+ $setup_info['bim']['app_order'] = 8;
+ $setup_info['bim']['enable'] = 1;
+ $setup_info['bim']['app_group'] = 'office';
+
+ $setup_info['bim']['author'] = array
+ (
+ 'name' => 'Petur Bjørn Thorsteinsson',
+ 'email' => 'address@hidden'
+ );
+
+ $setup_info['bim']['maintainer'] = array
+ (
+ 'name' => 'Sigurd Nes',
+ 'email' => 'address@hidden'
+ );
+
+
+ $setup_info['bim']['tables'] = array
+ (
+ 'fm_bim_type',
+ 'fm_bim_model',
+ 'fm_bim_item'
+ );
+
+ /* The hooks this app includes, needed for hooks registration */
+ $setup_info['bim']['hooks'] = array
+ (
+ 'manual',
+ 'settings',
+ 'preferences',
+ 'help',
+ 'menu' => 'bim.menu.get_menu'
+ );
+
+ /* Dependencies for this app to work */
+ $setup_info['bim']['depends'][] = array
+ (
+ 'appname' => 'phpgwapi',
+ 'versions' => Array('0.9.17', '0.9.18')
+ );
+
+ $setup_info['bim']['depends'][] = array
+ (
+ 'appname' => 'admin',
+ 'versions' => Array('0.9.17', '0.9.18')
+ );
+
+ $setup_info['bim']['depends'][] = array
+ (
+ 'appname' => 'preferences',
+ 'versions' => Array('0.9.17', '0.9.18')
+ );
+
+ $setup_info['bim']['depends'][] = array
+ (
+ 'appname' => 'property',
+ 'versions' => Array('0.9.17', '0.9.18')
+ );
Added: trunk/bim/setup/tables_current.inc.php
===================================================================
--- trunk/bim/setup/tables_current.inc.php (rev 0)
+++ trunk/bim/setup/tables_current.inc.php 2011-02-16 14:10:41 UTC (rev
7014)
@@ -0,0 +1,60 @@
+<?php
+ /**
+ * phpGroupWare - bim
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package bim
+ * @subpackage setup
+ * @version $Id: tables_current.inc.php 6685 2010-12-20 14:44:13Z
peturbjorn $
+ */
+
+ $phpgw_baseline = array(
+ 'fm_bim_type' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto', 'precision' =>
4, 'nullable' => False),
+ 'name' => array('type' => 'varchar',
'precision' => 64,'nullable' => False),
+ 'description' => array('type' => 'varchar',
'precision' => 512,'nullable' => True)
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array('name')
+ ),
+ 'fm_bim_model' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto', 'precision' =>
4,'nullable' => True),
+ 'name' => array('type' => 'varchar',
'precision' => 128,'nullable' => False),
+ 'vfs_file_id' => array('type' => 'int',
'precision' => 4, 'nullable' => False),
+ 'authorization_value' => array('type' =>
'varchar', 'precision' => 200,'nullable' => true),
+ 'author' => array('type' => 'varchar',
'precision' => 256,'nullable' => True),
+ 'changedate' => array('type' =>
'timestamp','nullable' => True),
+ 'description' => array('type' => 'varchar',
'precision' => 512,'nullable' => True),
+ 'organization' => array('type' => 'varchar',
'precision' => 256,'nullable' => True),
+ 'originatingsystem' => array('type' =>
'varchar', 'precision' => 256,'nullable' => True),
+ 'preprocessor' => array('type' => 'varchar',
'precision' => 256,'nullable' => True),
+ 'valdate' => array('type' =>
'timestamp','nullable' => True),
+ 'nativeschema' => array('type' => 'varchar',
'precision' => 256,'nullable' => True),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array('phpgw_vfs' => array('vfs_file_id' =>
'file_id')),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+ 'fm_bim_item' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto', 'precision' =>
4, 'nullable' => False),
+ 'type' => array('type' => 'int', 'precision' =>
4,'nullable' => False),
+ 'guid' => array('type' => 'varchar',
'precision' => 24,'nullable' => False),
+ 'xml_representation' => array('type' =>
'xml','nullable' => False),
+ 'model' => array('type' => 'int', 'precision'
=> 4,'nullable' => False),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array('fm_bim_model' => array('model' => 'id'),
+ 'fm_bim_type' =>
array('type' => 'id')),
+ 'ix' => array(),
+ 'uc' => array('guid')
+ )
+ );
Added: trunk/bim/setup/tables_update.inc.php
===================================================================
--- trunk/bim/setup/tables_update.inc.php (rev 0)
+++ trunk/bim/setup/tables_update.inc.php 2011-02-16 14:10:41 UTC (rev
7014)
@@ -0,0 +1,32 @@
+<?php
+ /**
+ * phpGroupWare - bim: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2009 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package bim
+ * @subpackage setup
+ * @version $Id: tables_update.inc.php 6982 2011-02-14 20:01:17Z
sigurdne $
+ */
+
+ /**
+ * Update bim version from 0.9.17.500 to 0.9.17.501
+ */
+
+
+/*
+ $test[] = '0.9.17.500';
+ function bim_upgrade0_9_17_500()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['bim']['currentver'] =
'0.9.17.501';
+ return $GLOBALS['setup_info']['bim']['currentver'];
+ }
+ }
+*/
Added: trunk/bim/templates/base/app_data.xsl
===================================================================
--- trunk/bim/templates/base/app_data.xsl (rev 0)
+++ trunk/bim/templates/base/app_data.xsl 2011-02-16 14:10:41 UTC (rev
7014)
@@ -0,0 +1,3 @@
+ <xsl:template name="dummy">
+ </xsl:template>
+
Added: trunk/bim/templates/base/bim_modelinformation.xsl
===================================================================
--- trunk/bim/templates/base/bim_modelinformation.xsl
(rev 0)
+++ trunk/bim/templates/base/bim_modelinformation.xsl 2011-02-16 14:10:41 UTC
(rev 7014)
@@ -0,0 +1,36 @@
+ <xsl:template match="modelInformation">
+ <div class="bimObject">
+ <h2>Model</h2>
+
+ <dl>
+ <dt>Name</dt>
+ <dd><xsl:value-of select="model/name"/></dd>
+ <dt>File name</dt>
+ <dd><xsl:value-of select="model/fileName"/></dd>
+ <dt>Used items</dt>
+ <dd><xsl:value-of select="model/usedItemCount"/></dd>
+ </dl>
+ <h2>Model Information</h2>
+
+ <dl>
+ <dt>Author</dt>
+ <dd><xsl:value-of select="information/author"/></dd>
+ <dt>Authorization</dt>
+ <dd><xsl:value-of
select="information/authorization"/></dd>
+ <dt>Change date</dt>
+ <dd><xsl:value-of select="information/changeDate"/></dd>
+ <dt>Description</dt>
+ <dd><xsl:value-of
select="information/description"/></dd>
+ <dt>Organization</dt>
+ <dd><xsl:value-of
select="information/organization"/></dd>
+ <dt>Originating system</dt>
+ <dd><xsl:value-of
select="information/originatingSystem"/></dd>
+ <dt>Pre processor</dt>
+ <dd><xsl:value-of
select="information/preProcessor"/></dd>
+ <dt>Val date</dt>
+ <dd><xsl:value-of select="information/valDate"/></dd>
+ <dt>Native schema</dt>
+ <dd><xsl:value-of
select="information/nativeSchema"/></dd>
+ </dl>
+ </div>
+ </xsl:template>
Added: trunk/bim/templates/base/bim_showSingleItem.xsl
===================================================================
--- trunk/bim/templates/base/bim_showSingleItem.xsl
(rev 0)
+++ trunk/bim/templates/base/bim_showSingleItem.xsl 2011-02-16 14:10:41 UTC
(rev 7014)
@@ -0,0 +1,76 @@
+
+ <xsl:template match="/">
+ <div class="bimObject">
+ <xsl:apply-templates select="*">
+
+ </xsl:apply-templates>
+ </div>
+
+ </xsl:template>
+ <xsl:template match="*">
+ <div>
+
+ <!-- tests if children have no children -->
+ <!--
+ <xsl:choose>
+
+ <xsl:when test="count(*[not(*)]) = 0 and count(*)=0">
+ <dl>
+ <xsl:call-template
name="childElements"/>
+ </dl>
+ </xsl:when>
+ <xsl:otherwise>
+ <h1><xsl:value-of select="name()"/></h1>
+ </xsl:otherwise>
+ </xsl:choose>
+ -->
+ <xsl:choose>
+ <xsl:when test="not(*)">
+
+ <dl>
+
+ <dt><xsl:value-of select="name()"/></dt>
+ <dd><xsl:value-of select="."/></dd>
+
+ </dl>
+
+ </xsl:when>
+ <xsl:otherwise>
+ <h1><xsl:value-of select="name()"/></h1>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@*">
+ <h2>Xml attributes</h2>
+ <dl>
+ <xsl:for-each select="@*">
+ <dt><xsl:value-of select="name()"/></dt>
+ <dd><xsl:value-of select="."/></dd>
+ </xsl:for-each>
+ </dl>
+ </xsl:if>
+
+ <!--
+ <xsl:choose>
+ <xsl:when test="not(*)">
+ <dl>
+ <dt><xsl:value-of select="name()"/></dt>
+ <dd><xsl:value-of select="."/></dd>
+ </dl>
+ </xsl:when>
+ <xsl:otherwise>
+ <h1><xsl:value-of select="name()"/></h1>
+ </xsl:otherwise>
+ </xsl:choose>
+ -->
+
+
+ <xsl:apply-templates select="*">
+
+ </xsl:apply-templates>
+ </div>
+ </xsl:template>
+ <xsl:template name="childElements" >
+ <dt><xsl:value-of select="name()"/></dt>
+ <dd><xsl:value-of select="."/></dd>
+
+ </xsl:template>
Added: trunk/bim/templates/base/bim_showitems.xsl
===================================================================
--- trunk/bim/templates/base/bim_showitems.xsl (rev 0)
+++ trunk/bim/templates/base/bim_showitems.xsl 2011-02-16 14:10:41 UTC (rev
7014)
@@ -0,0 +1,26 @@
+ <xsl:template match="bimitems">
+ <div> Objects </div>
+ <div class="showModels">
+ <table id="bimItems">
+ <tr>
+ <th>Database id</th>
+ <th>Guid</th>
+ <th>type</th>
+ </tr>
+ <xsl:for-each select="bimItems/item">
+ <tr>
+ <td><xsl:value-of
select="databaseId"/></td>
+ <td class="guid"><xsl:value-of
select="guid"/></td>
+ <td><xsl:value-of
select="type"/></td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </div>
+ <script type="text/javascript">
+ if (typeof YUI != 'undefined') {
+ YUI().use('node-base', function(Y) {
+ Y.on("load", doDelegateViewItem);
+ });
+ }
+ </script>
+ </xsl:template>
Added: trunk/bim/templates/base/bim_showmodels.xsl
===================================================================
--- trunk/bim/templates/base/bim_showmodels.xsl (rev 0)
+++ trunk/bim/templates/base/bim_showmodels.xsl 2011-02-16 14:10:41 UTC (rev
7014)
@@ -0,0 +1,92 @@
+ <xsl:template match="modelData">
+ <div> The Model Data </div>
+ <!--<table id="bimModelList">
+ <tr>
+ <th>Database id</th>
+ <th>Name</th>
+ <th>creationDate</th>
+ <th>fileSize</th>
+ <th>fileName</th>
+ <th>usedItemCount</th>
+ <th>vfsFileId</th>
+ <th>used</th>
+ <th></th>
+ </tr>
+ <xsl:for-each select="models">
+ <tr>
+ <td>
+ <xsl:value-of select="databaseId" />
+ </td>
+ <td>
+ <xsl:value-of select="name" />
+ </td>
+ <td>
+ <xsl:value-of select="creationDate" />
+ </td>
+ <td>
+ <xsl:value-of select="fileSize" />
+ </td>
+ <td>
+ <xsl:value-of select="fileName" />
+ </td>
+ <td>
+ <xsl:value-of select="usedItemCount" />
+ </td>
+ <td>
+ <xsl:value-of select="vfsFileId" />
+ </td>
+ <td>
+ <xsl:value-of select="used" />
+ </td>
+ <td>
+ <button>
+ <xsl:attribute name="value">
+
+ <xsl:value-of
select="databaseId" />
+
+ </xsl:attribute>
+ Delete
+ </button>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+
+ -->
+ <div class="showModels">
+ <button onClick="reloadModelList()">Reload model list</button>
+ <table id="bimModelList2">
+ <tr>
+ <th>Database id</th>
+ <th>Name</th>
+ <th>creationDate</th>
+ <th>fileSize</th>
+ <th>fileName</th>
+ <th>usedItemCount</th>
+ <th>vfsFileId</th>
+ <th>used</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+ </table>
+ <div id="modelsLoader">
+ <xsl:variable name="loadingImage"><xsl:value-of
select="loadingImage"/></xsl:variable>
+ <img src="{$loadingImage}" />
+ </div>
+ </div>
+ <script type="text/javascript">
+ // doDelegate();
+
+ if (typeof YUI != 'undefined') {
+ YUI().use('node-base', function(Y) {
+ Y.on("load", getModelList);
+ //Y.on("load", doDelegateDeleteModel);
+ doDelegateDeleteModel();
+ Y.on("load", doDelegateLoadModel);
+ Y.on("load", doDelegateModelInfo);
+ Y.on("load", doDelegateModelView);
+ });
+ }
+ </script>
+</xsl:template>
Added: trunk/bim/templates/base/bim_upload_ifc.xsl
===================================================================
--- trunk/bim/templates/base/bim_upload_ifc.xsl (rev 0)
+++ trunk/bim/templates/base/bim_upload_ifc.xsl 2011-02-16 14:10:41 UTC (rev
7014)
@@ -0,0 +1,22 @@
+ <xsl:template match="upload">
+ <div class="bimObject">
+ <h1>Upload Bim file</h1>
+ <xsl:variable name="form_action"><xsl:value-of
select="import_action"/></xsl:variable>
+ <xsl:variable name="form_field_filename"><xsl:value-of
select="form_field_filename"/></xsl:variable>
+ <xsl:variable name="form_field_modelname"><xsl:value-of
select="form_field_modelname"/></xsl:variable>
+ <form method="post" enctype="multipart/form-data"
name="uploadIfc" action="{$form_action}">
+ <dl>
+ <dt>Upload file</dt>
+ <dd><input type="file"
name="{$form_field_filename}" /></dd>
+
+ <dt>IFC Model name</dt>
+ <dd><input type="text"
name="{$form_field_modelname}" size="64"/></dd>
+
+ <dt></dt>
+ <dd><input type="submit" /></dd>
+
+ </dl>
+ </form>
+ </div>
+ </xsl:template>
+
\ No newline at end of file
Added: trunk/bim/templates/base/bim_upload_ifc_result.xsl
===================================================================
--- trunk/bim/templates/base/bim_upload_ifc_result.xsl
(rev 0)
+++ trunk/bim/templates/base/bim_upload_ifc_result.xsl 2011-02-16 14:10:41 UTC
(rev 7014)
@@ -0,0 +1,30 @@
+ <xsl:template match="uploadResult">
+ <div class="bimObject">
+ <h1>Upload Bim file Result</h1>
+ <xsl:variable name="showModelsLink"><xsl:value-of
select="linkToModels"/></xsl:variable>
+ <xsl:variable name="uploadLink"><xsl:value-of
select="linkToUpload"/></xsl:variable>
+ <xsl:variable name="error"><xsl:value-of
select="error"/></xsl:variable>
+ <xsl:variable name="errorMessage"><xsl:value-of
select="errorMessage"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$error = 1">
+ <p><strong>An error has occurred</strong></p>
+ <p><strong>Error:</strong><xsl:value-of
select="$errorMessage" /></p>
+ <p><a href="{$uploadLink}">Upload file</a></p>
+ </xsl:when>
+ <xsl:otherwise>
+ <p>Upload success!</p>
+ <p>Redirecting</p>
+ <p>If you are not promptly redirected, please
click <a href="{$showModelsLink}">here</a></p>
+ <script type="text/javascript">
+ function showModelsPage(){
+ window.location = '<xsl:value-of
select="$showModelsLink" />';
+ }
+ setTimeout('showModelsPage()', 3000);
+ </script>
+ </xsl:otherwise>
+ </xsl:choose>
+
+
+ </div>
+ </xsl:template>
+
\ No newline at end of file
Added: trunk/bim/templates/base/config.tpl
===================================================================
--- trunk/bim/templates/base/config.tpl (rev 0)
+++ trunk/bim/templates/base/config.tpl 2011-02-16 14:10:41 UTC (rev 7014)
@@ -0,0 +1,30 @@
+<!-- BEGIN header -->
+<form method="POST" action="{action_url}">
+<table border="0" align="center" width="85%">
+<!--
+ <tr class="th">
+ <td colspan="2"><font color="{th_text}"> <b>{title}</b></font></td>
+ </tr>
+-->
+<!-- END header -->
+<!-- BEGIN body -->
+
+<!-- END body -->
+<!-- BEGIN footer -->
+<!--
+ <tr class="th">
+ <td colspan="2">
+
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2" align="center">
+ <input type="submit" name="submit" value="{lang_submit}">
+ <input type="submit" name="cancel" value="{lang_cancel}">
+ </td>
+ </tr>
+-->
+</table>
+</form>
+<!-- END footer -->
Added: trunk/bim/templates/base/css/bim.css
===================================================================
--- trunk/bim/templates/base/css/bim.css (rev 0)
+++ trunk/bim/templates/base/css/bim.css 2011-02-16 14:10:41 UTC (rev
7014)
@@ -0,0 +1,48 @@
+div.bimObject {
+ margin:10px;
+ font-size:14px;
+}
+
+div.bimObject h1, div.bimObject h2 {
+ clear:both;
+}
+div.bimObject h1 {
+ font-size:1.5em;
+}
+div.bimObject h2 {
+ font-size:1.3em;
+}
+div.bimObject dl {
+ width:500px;
+}
+div.bimObject dl dt {
+ clear:both;
+ width:33%;
+ float:left;
+ text-align:right;
+}
+div.bimObject dl dd {
+ width:66%;
+ float:left;
+ margin:0 0 0.5em 0.25em;
+ }
+
+div.showModels {
+ width:100%;
+ /*padding:20px;*/
+}
+div.showModels table {
+ width:100%;
+}
+div.showModels #modelsLoader {
+ text-align:center;
+ margin-top:0px;
+ margin-bottom:0px;
+ padding:0px;
+
+}
+div.showModels .guid {
+ color:blue;
+ text-decoration:underline;
+}
+
Added: trunk/bim/templates/base/images/ajaxLoader.gif
===================================================================
(Binary files differ)
Property changes on: trunk/bim/templates/base/images/ajaxLoader.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/bim/tests/BIM/PropertyBimTestSuite.php
===================================================================
--- trunk/bim/tests/BIM/PropertyBimTestSuite.php
(rev 0)
+++ trunk/bim/tests/BIM/PropertyBimTestSuite.php 2011-02-16 14:10:41 UTC
(rev 7014)
@@ -0,0 +1,298 @@
+<?php
+
+
+/*
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+define('PHPGW_API_UNIT_TEST_PATH', dirname(__FILE__));
+
+
+//include('..\..\inc\class.sobim.inc.php');
+//include('..\..\inc\class.sobimtype.inc.php');
+
+class bimBimSuite extends PHPUnit_Framework_TestSuite
+{
+ protected static $login = 'peturbjorn';
+
+ // this is is a bit of a hack, but it should work
+ protected static $sessionid = '';
+ public static $modelName = "dummyModel";
+ private $modelId;
+ private $bimTypeTableName = 'fm_bim_type';
+ private $bimItemTableName = 'fm_bim_item';
+ private $projectGuid;
+ private $projectType= 'ifcprojecttest';
+ private $projectXml;
+ private $buildingStorey1Guid;
+ private $buildingStorey2Guid;
+ private $buildingStorey1Type;
+ private $buildingStorey2Type;
+ private $buildingStorey1xml;
+ private $buildingStorey2xml;
+ private $db;
+
+ /**
+ * @protected array $suite_tests the tests which are part of this test
suite
+ */
+ //protected static $file1 =
dirname("TestCustomFields.php").'TestCustomFields.php';
+
+ protected static $suite_tests = array
+ (
+ // 'TestSObimitem.php',
+ // 'TestSObimtype.php',
+ // 'TestSObimmodel.php',
+ // 'TestSOvfs.php',
+ 'TestBObimmodel.php',
+ // 'TestBObimitem.php'
+ 'TestUIbim.php',
+ 'TestSObimmodelinformation.php'
+ );
+
+ /**
+ * Get the list of tests for the suite
+ *
+ * @return object Test Suite to be run
+ */
+ public static function suite()
+ {
+ $suite = new bimBimSuite();
+
+ //$suite->addTestFiles(self::$suite_tests);
+
+
+ $suite_tests = self::$suite_tests;
+ foreach($suite_tests as & $entry) {
+ $entry = dirname(__FILE__).DIRECTORY_SEPARATOR.$entry;
+ }
+ //$suite_tests = array(dirname(__FILE__).'\TestSObimtype.php');
+
+ $suite->addTestFiles($suite_tests);
+ return $suite;
+ }
+
+ /**
+ * Prepare the environment for the test suite to run
+ *
+ * @return void
+ */
+ public function setUp()
+ {
+ $GLOBALS['phpgw_info']['flags'] = array
+ (
+ 'currentapp' => 'login',
+ 'login' => true,
+ 'noapi' => false,
+ 'noheader' => true
+ );
+
+ $header = realpath(PHPGW_API_UNIT_TEST_PATH . '/../../..')
+ . '/header.inc.php';
+ include_once $header;
+
+ self::$sessionid = $GLOBALS['phpgw']->session->create(self::$login,
+ '', false);
+ $GLOBALS['phpgw_info']['user']['account_id'] = 7;
+ phpgw::import_class('bim.sobim');
+ phpgw::import_class('bim.sobimitem');
+ phpgw::import_class('bim.sobimtype');
+ phpgw::import_class('bim.sobimmodel');
+ phpgw::import_class('bim.sovfs');
+ phpgw::import_class('bim.bobimmodel');
+ phpgw::import_class('bim.sobim_converter');
+ phpgw::import_class('bim.bobimitem');
+ phpgw::import_class('bim.uibim');
+ phpgw::import_class('bim.bimmodelinformation');
+ phpgw::import_class('bim.sobimmodelinformation');
+ $this->db = & $GLOBALS['phpgw']->db;
+ $this->loadXmlVariables();
+ $this->addDummyModel();
+ $this->addTestTypes();
+ $this->removeTestItems();
+ $this->addTestItems();
+ }
+
+ /**
+ * Clean up the environment after running the test suite
+ *
+ * @return void
+ */
+ public function tearDown()
+ {
+ //$this->removeTestItems();
+ //$this->removeTestTypes();
+ $GLOBALS['phpgw']->session->destroy(self::$sessionid);
+ }
+
+ private function loadXmlVariables() {
+ $xml = simplexml_load_file('testData.xml');
+ $this->projectXml = $xml->project;
+ $this->projectGuid = $this->projectXml->attributes->guid."++";
//add ++ just in case the test data is in use
+ $this->projectType =
$this->projectXml['ifcObjectType']."_test"; //add _test in case object type
already exists
+
+ $this->buildingStorey1xml =
$xml->buildingStoreys->buildingStorey[0];
+ $this->buildingStorey1Guid =
$this->buildingStorey1xml->attributes->guid."++";
+ $this->buildingStorey1Type
=$this->buildingStorey1xml['ifcObjectType']."_test";
+
+ $this->buildingStorey2xml =
$xml->buildingStoreys->buildingStorey[1];
+ $this->buildingStorey2Guid =
$this->buildingStorey2xml->attributes->guid."++";
+ $this->buildingStorey2Type
=$this->buildingStorey2xml['ifcObjectType']."_test";
+
+ //echo $this->projectXml->();
+ }
+
+ private function addDummyModel() {
+ $modelName = self::$modelName;
+ if(!$this->checkIfModelExists($modelName)) {
+ $sobimmodel = new sobimmodel_impl($this->db);
+
+ $bogusId = $this->getBogusId();
+ $sobimmodel->setModelName($modelName);
+ $sobimmodel->setVfsdatabaseid($bogusId);
+ $sobimmodel->addBimModel();
+ }
+ $this->modelId = $this->getModelId($modelName);
+ }
+ private function getModelId($modelName) {
+ $resultAlias = "id";
+ $sql = "select id as $resultAlias from ".sobim::bimModelTable."
where name = '$modelName'";
+ if(is_null($this->db->query($sql,__LINE__,__FILE__))) {
+ throw new Exception('Error getting model Id');
+ } else {
+ $this->db->next_record();
+ return $this->db->f($resultAlias);
+ }
+ }
+ private function checkIfModelExists($modelName) {
+ $resultAlias = "id";
+ $sql = "select count(*) as $resultAlias from
".sobim::bimModelTable." where name = '$modelName'";
+ if(is_null($this->db->query($sql,__LINE__,__FILE__))) {
+ throw new Exception('Error checking if model exists!');
+ } else {
+ $this->db->next_record();
+ $rowCountOfModels = $this->db->f($resultAlias);
+ return ($rowCountOfModels > 0);
+ }
+ }
+ /*
+ * gets an entry from the vfs table in order to satisfy the foreign key
constraint
+ * If the table is empty then there will be a problem!
+ */
+ private function getBogusId() {
+ $resultAlias = "id";
+ $sql = "select file_id as $resultAlias from phpgw_vfs limit 1";
+ if(is_null($this->db->query($sql,__LINE__,__FILE__))) {
+ throw new Exception('phpgw_vfs table is empty! An item
must be added or the tests should be altered!');
+ } else {
+ $this->db->next_record();
+ return $this->db->f($resultAlias);
+ }
+ }
+ private function addTestItems() {
+ /*
+ $sobim = new sobim_impl($this->db);
+
+ if(!$sobim->checkIfBimItemExists($this->projectGuid)) {
+ $sobim->addBimItem(new
BimItem(null,$this->projectGuid,$this->projectType, $this->projectXml->asXML()
));
+ }
+ */
+ if($this->checkIfItemsAlreadyExist()) {
+ //throw new Exception('At least one item already exists
in database');
+
+ } else {
+ $this->insertTestItem($this->projectXml->asXML(),
$this->projectType, $this->projectGuid);
+
$this->insertTestItem($this->buildingStorey1xml->asXML(),
$this->buildingStorey1Type, $this->buildingStorey1Guid);
+
$this->insertTestItem($this->buildingStorey2xml->asXML(),
$this->buildingStorey2Type, $this->buildingStorey2Guid);
+ }
+ }
+ private function removeTestItems() {
+ if($this->checkIfItemsAlreadyExist()) {
+ $this->removeTestItem($this->projectGuid);
+ $this->removeTestItem($this->buildingStorey1Guid);
+ $this->removeTestItem($this->buildingStorey2Guid);
+ }
+ }
+ private function removeTestItem($guid) {
+ $sql = "DELETE FROM $this->bimItemTableName where guid='$guid'";
+ $this->db->query($sql);
+ }
+ private function insertTestItem($itemXml, $itemType, $itemGuid) {
+ $itemXml = $this->db->db_addslashes($itemXml);
+ $sql = "INSERT INTO $this->bimItemTableName (type, guid,
xml_representation, model) values (";
+ $sql = $sql."(select id from $this->bimTypeTableName where name
= '$itemType'),";
+ $sql = $sql."'$itemGuid', '$itemXml', '$this->modelId')";
+ //echo $sql;
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+
+ private function addTestTypes() {
+ if($this->checkIfTestTypesAlreadyExist()) {
+ //throw new Exception('Test type already exists in
database!');
+ } else {
+ $this->insertTestType($this->buildingStorey1Type);
+ $this->insertTestType($this->projectType);
+ }
+ }
+ private function removeTestTypes() {
+ if($this->checkIfTestTypesAlreadyExist()) {
+ $this->removeTestType($this->buildingStorey1Type);
+ $this->removeTestType($this->projectType);
+ }
+ }
+ private function insertTestType($testTypeName) {
+ $sql = 'INSERT INTO '.$this->bimTypeTableName.' (name) VALUES
(\''.$testTypeName.'\')';
+ $this->db->query($sql);
+ }
+ private function removeTestType($testTypeName) {
+ $sql = "DELETE FROM ".$this->bimTypeTableName." where
name='".$testTypeName."'";
+ $this->db->query($sql);
+ }
+ private function checkIfItemsAlreadyExist() {
+ $resultAlias = 'test_item_count';
+ $sql = "SELECT count($this->bimItemTableName.id) as
$resultAlias from public.$this->bimItemTableName where ".
+ "guid = '$this->projectGuid' OR ".
+ "guid = '$this->buildingStorey1Guid' OR ".
+ "guid = '$this->buildingStorey2Guid'";
+
+ if(is_null($this->db->query($sql,__LINE__,__FILE__))) {
+ throw new Exception('Query to check items was
unsuccessful');
+ } else {
+ $this->db->next_record();
+ $rowCountOfItemTypes = $this->db->f($resultAlias);
+
+ if ( $rowCountOfItemTypes != 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ private function checkIfTestTypesAlreadyExist() {
+ $resultAlias = 'test_type_count';
+ $sql = 'SELECT count('.$this->bimTypeTableName.'.id) as
'.$resultAlias.' FROM public.'.$this->bimTypeTableName.' WHERE
'.$this->bimTypeTableName.'.name = \''.$this->buildingStorey1Type.'\' OR
'.$this->bimTypeTableName.'.name = \''.$this->projectType.'\'';
+ //echo "sql is ::".$sql."::";
+ $q = $this->db->query($sql);
+ if(is_null($q)) {
+ throw new Exception('Query to check types was
unsuccessful');
+ }
+ $this->db->next_record();
+ $rowCountOfTestTypes = $this->db->f($resultAlias);
+ if ( $rowCountOfTestTypes != 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
Added: trunk/bim/tests/BIM/TestBObimitem.php
===================================================================
--- trunk/bim/tests/BIM/TestBObimitem.php (rev 0)
+++ trunk/bim/tests/BIM/TestBObimitem.php 2011-02-16 14:10:41 UTC (rev
7014)
@@ -0,0 +1,94 @@
+<?php
+/*
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+include_once './TestBimCommon.php';
+class TestBObimitem extends TestBimCommon
+{
+
+ /**
+ * @var boolean $backupGlobals disable backup of GLOBALS which breaks
things
+ */
+ protected $backupGlobals = false;
+
+ /**
+ * @var integer $fieldID The attribute ID used for all the tests
+ */
+ protected $fieldID;
+
+ private $sobimitem;
+ private $bobimmodel;
+
+ private $validIfcFileName = "valid_ifc_example.ifc";
+ private $validIfcFileWithPath;
+
+ private $testingFileName = "restTestFile.txt";
+ private $testingFileWithPath;
+
+ public function __construct() {
+ $this->testingFileWithPath =
getcwd().DIRECTORY_SEPARATOR.$this->testingFileName;
+ $this->validIfcFileWithPath =
getcwd().DIRECTORY_SEPARATOR.$this->validIfcFileName;
+ }
+
+ /**
+ * Setup the environment for the tests
+ *
+ * @return void
+ */
+ protected function setUp()
+ {
+ $this->initDatabase();
+
+ }
+ /**
+ * Clean up the environment after running a test
+ *
+ * @return void
+ */
+ protected function tearDown()
+ {
+
+ }
+
+ public function testDb(){
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7014] BIM: merge from bim-branch,
Sigurd Nes <=