[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6913] Moved to separate classes
From: |
Petur Thorsteinsson |
Subject: |
[Fmsystem-commits] [6913] Moved to separate classes |
Date: |
Thu, 03 Feb 2011 19:18:31 +0000 |
Revision: 6913
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6913
Author: peturbjorn
Date: 2011-02-03 19:18:30 +0000 (Thu, 03 Feb 2011)
Log Message:
-----------
Moved to separate classes
Modified Paths:
--------------
branches/dev-bim2/property/inc/class.bimmodelinformation.inc.php
Added Paths:
-----------
branches/dev-bim2/property/inc/class.bimitem.inc.php
branches/dev-bim2/property/inc/class.bimmodel.inc.php
branches/dev-bim2/property/inc/class.bimobject.inc.php
Added: branches/dev-bim2/property/inc/class.bimitem.inc.php
===================================================================
--- branches/dev-bim2/property/inc/class.bimitem.inc.php
(rev 0)
+++ branches/dev-bim2/property/inc/class.bimitem.inc.php 2011-02-03
19:18:30 UTC (rev 6913)
@@ -0,0 +1,46 @@
+<?php
+phpgw::import_class('property.bimobject');
+class BimItem extends BimObject{
+ private $databaseId;
+ private $guid;
+ private $type;
+ private $xml;
+ private $modelId;
+
+ function __construct($databaseId = null, $guid = null, $type = null,
$xml = null, $modelId = null) {
+ //$this->databaseId = (is_null($databaseId)) ? null :
(int)$databaseId;
+ $this->databaseId = (int)$databaseId;
+ $this->guid = $guid;
+ $this->type = $type;
+ $this->xml = $xml;
+ $this->modelId = $modelId;
+ }
+ function getDatabaseId() {
+ return $this->databaseId;
+ }
+ function setDatabaseId($databaseId) {
+ $this->databaseId = $databaseId;
+ }
+ function getGuid() {
+ return $this->guid;
+ }
+ function getType() {
+ return $this->type;
+ }
+ function setType($type) {
+ $this->type = $type;
+ }
+ function getXml() {
+ return $this->xml;
+ }
+ function setXml($xml) {
+ $this->xml = $xml;
+ }
+ function getModelId() {
+ return $this->modelId;
+ }
+ function setModelId($id) {
+ $this->modelId = $id;
+ }
+
+}
\ No newline at end of file
Added: branches/dev-bim2/property/inc/class.bimmodel.inc.php
===================================================================
--- branches/dev-bim2/property/inc/class.bimmodel.inc.php
(rev 0)
+++ branches/dev-bim2/property/inc/class.bimmodel.inc.php 2011-02-03
19:18:30 UTC (rev 6913)
@@ -0,0 +1,77 @@
+<?php
+phpgw::import_class('property.bimobject');
+class BimModel extends BimObject{
+ private $databaseId;
+ private $name;
+ private $creationDate;
+ private $fileSize;
+ private $fileName;
+ private $usedItemCount;
+ private $vfsFileId;
+ private $used;
+
+ function __construct($databaseId = null, $name = null, $creationDate =
null, $fileSize = null,$fileName= null,$usedItemCount= null, $vfsFileId = null)
{
+ $this->databaseId = (int)$databaseId;
+ $this->name = $name;
+ $this->creationDate = $creationDate;
+ $this->fileSize = $fileSize;
+ $this->fileName = $fileName;
+ $this->usedItemCount = $usedItemCount;
+ if($usedItemCount && $usedItemCount > 0) {
+ $this->used = true;
+ } else {
+ $this->used = false;
+ }
+
+ }
+ function getDatabaseId() {
+ return $this->databaseId;
+ }
+ function setDatabaseId($databaseId) {
+ $this->databaseId = $databaseId;
+ }
+ function getName() {
+ return $this->name;
+ }
+ function setName($item) {
+ $this->name = $item;
+ }
+ function getCreationDate() {
+ return $this->creationDate;
+ }
+ function setCreationDate($item) {
+ $this->creationDate = $item;
+ }
+ function getFileSize() {
+ return $this->fileSize;
+ }
+ function setFileSize($item) {
+ $this->fileSize = $item;
+ }
+ function getFileName() {
+ return $this->fileName;
+ }
+ function setFileName($item) {
+ $this->fileName = $item;
+ }
+ function getUsedItemCount() {
+ return $this->usedItemCount;
+ }
+ function setUsedItemCount($item) {
+ $this->usedItemCount = $item;
+ }
+ function getVfsFileId() {
+ return $this->vfsFileId;
+ }
+ function setVfsFileId($item) {
+ $this->vfsFileId = $item;
+ }
+
+ function getUsed() {
+ if($this->used) {
+ return $this->used;
+ } else {
+ return (bool)($this->usedItemCount > 0);
+ }
+ }
+}
\ No newline at end of file
Modified: branches/dev-bim2/property/inc/class.bimmodelinformation.inc.php
===================================================================
--- branches/dev-bim2/property/inc/class.bimmodelinformation.inc.php
2011-02-03 19:17:31 UTC (rev 6912)
+++ branches/dev-bim2/property/inc/class.bimmodelinformation.inc.php
2011-02-03 19:18:30 UTC (rev 6913)
@@ -1,6 +1,7 @@
<?php
+phpgw::import_class('property.bimobject');
-class BimModelInformation {
+class BimModelInformation extends BimObject{
private $authorization;
private $author;
private $changeDate;
@@ -10,11 +11,48 @@
private $preProcessor;
private $valDate;
private $nativeSchema;
-
+
public function loadVariablesFromXml(SimpleXMLElement
$modelInformation) {
- $this->setAuthorization($modelInformation->authorization);
+ if(!empty($modelInformation->authorization)){
+
$this->setAuthorization((string)$modelInformation->authorization);
+ }
+ if(!empty($modelInformation->author)) {
+ $this->setAuthor((string)$modelInformation->author);
+ }
+ if(!empty($modelInformation->changeDate)) {
+ $this->setChangeDate($modelInformation->changeDate);
+ }
+ if(!empty($modelInformation->valDate)) {
+ $this->setValDate($modelInformation->valDate);
+ }
+ if(!empty($modelInformation->description)) {
+
$this->setDescription((string)$modelInformation->description);
+ }
+ if(!empty($modelInformation->organization)) {
+
$this->setOrganization((string)$modelInformation->organization);
+ }
+ if(!empty($modelInformation->originatingSystem)) {
+
$this->setOriginatingSystem((string)$modelInformation->originatingSystem);
+ }
+ if(!empty($modelInformation->originatingSystem)) {
+
$this->setOriginatingSystem((string)$modelInformation->originatingSystem);
+ }
+ if(!empty($modelInformation->preProcessor)) {
+
$this->setPreProcessor((string)$modelInformation->preProcessor);
+ }
+ if(!empty($modelInformation->nativeSchema)) {
+
$this->setNativeSchema((string)$modelInformation->nativeSchema);
+ }
}
-
+
+ /*
+ *Converts ISO8601 string to timestamp
+ * Not needed, postgres accepts iso8601 as input
+ */
+ public function convertToTimestamp($iso8601date) {
+ return strtotime($iso8601date);
+ }
+
public function getOrganization() {
return $this->organization;
}
Added: branches/dev-bim2/property/inc/class.bimobject.inc.php
===================================================================
--- branches/dev-bim2/property/inc/class.bimobject.inc.php
(rev 0)
+++ branches/dev-bim2/property/inc/class.bimobject.inc.php 2011-02-03
19:18:30 UTC (rev 6913)
@@ -0,0 +1,18 @@
+<?php
+class BimObject {
+
+ public function transformObjectToArray() {
+ $reflection = new ReflectionObject($this);
+ $publicMethods =
$reflection->getMethods(ReflectionProperty::IS_PUBLIC);
+ $result = array();
+ foreach($publicMethods as $method) {
+ /* @var $method ReflectionMethod */
+ if(preg_match("/^get(.+)/", $method->getName(),
$matches)) {
+ $memberVarible = lcfirst($matches[1]);
+ $value = $method->invoke($this);
+ $result[$memberVarible] = $value;
+ }
+ }
+ return $result;
+ }
+}
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6913] Moved to separate classes,
Petur Thorsteinsson <=