[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6918] Added method that fetches items by modelId
From: |
Petur Thorsteinsson |
Subject: |
[Fmsystem-commits] [6918] Added method that fetches items by modelId |
Date: |
Thu, 03 Feb 2011 19:22:07 +0000 |
Revision: 6918
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6918
Author: peturbjorn
Date: 2011-02-03 19:22:06 +0000 (Thu, 03 Feb 2011)
Log Message:
-----------
Added method that fetches items by modelId
Modified Paths:
--------------
branches/dev-bim2/property/inc/class.sobimitem.inc.php
Modified: branches/dev-bim2/property/inc/class.sobimitem.inc.php
===================================================================
--- branches/dev-bim2/property/inc/class.sobimitem.inc.php 2011-02-03
19:21:28 UTC (rev 6917)
+++ branches/dev-bim2/property/inc/class.sobimitem.inc.php 2011-02-03
19:22:06 UTC (rev 6918)
@@ -1,8 +1,8 @@
<?php
phpgw::import_class('property.sobim');
+phpgw::import_class('property.bimitem');
-
interface sobimitem extends sobim {
/*
* @return array of BIM objects
@@ -18,11 +18,14 @@
public function checkIfBimItemExists($guid);
public function updateBimItem($bimItem);
public function getBimItemAttributeValue($bimItemGuid, $attribute);
+ public function retrieveItemsByModelId();
+ public function setModelId();
}
class sobimitem_impl implements sobimitem
{
/* @var phpgwapi_db_ */
private $db;
+ private $modelId;
public function __construct(& $db) {
// $this->db = & $GLOBALS['phpgw']->db;
@@ -157,52 +160,35 @@
}*/
}
}
-
-
-
-}
-class BimItem {
- 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;
+ public function retrieveItemsByModelId($modelId) {
+ 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'));
+ array_push($bimItems, $bimModel);
+ }
+ }
+ } catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ public function setModelId($modelId) {
$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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6918] Added method that fetches items by modelId,
Petur Thorsteinsson <=