fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [10080] Added files for requirements


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [10080] Added files for requirements
Date: Tue, 02 Oct 2012 07:51:59 +0000

Revision: 10080
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10080
Author:   erikhl
Date:     2012-10-02 07:51:58 +0000 (Tue, 02 Oct 2012)
Log Message:
-----------
Added files for requirements

Added Paths:
-----------
    trunk/logistic/inc/class.sorequirement.inc.php
    trunk/logistic/inc/model/class.bim_item_type_requirement.inc.php
    trunk/logistic/inc/model/class.requirement.inc.php
    trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
    trunk/logistic/inc/model/class.requirement_resource_type.inc.php
    trunk/logistic/inc/model/class.requirement_value.inc.php

Added: trunk/logistic/inc/class.sorequirement.inc.php
===================================================================
--- trunk/logistic/inc/class.sorequirement.inc.php                              
(rev 0)
+++ trunk/logistic/inc/class.sorequirement.inc.php      2012-10-02 07:51:58 UTC 
(rev 10080)
@@ -0,0 +1,147 @@
+<?php
+/**
+       * phpGroupWare - logistic: a part of a Facilities Management System.
+       *
+       * @author Erik Holm-Larsen <address@hidden>
+       * @copyright Copyright (C) 2011,2012 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/
+       * @package property
+       * @subpackage logistic
+       * @version $Id:$
+       */
+
+       phpgw::import_class('logistic.socommon');
+
+       include_class('logistic', 'requirement', '/inc/model/');
+
+       class logistic_sorequirement extends logistic_socommon
+       {
+               protected static $so;
+
+               protected function add(&$object)
+               {
+
+               }
+
+               protected function get_id_field_name()
+               {
+                       if(!$extended_info)
+                       {
+                               $ret = 'id';
+                       }
+                       else
+                       {
+                               $ret = array
+                               (
+                                       'table'                 => 
'requirement', // alias
+                                       'field'                 => 'id',
+                                       'translated'    => 'id'
+                               );
+                       }
+
+                       return $ret;
+               }
+
+               protected function get_query(string $sort_field, boolean 
$ascending, string $search_for, string $search_type, array $filters, boolean 
$return_count)
+               {
+                       $clauses = array('1=1');
+
+                       if($search_for)
+                       {
+                               $like_pattern = "'%" . 
$this->db->db_addslashes($search_for) . "%'";
+                               $like_clauses = array();
+                               switch($search_type)
+                               {
+                                       default:
+                                               $like_clauses[] = 
"requirement.name $this->like $like_pattern";
+                                               break;
+                               }
+                               if(count($like_clauses))
+                               {
+                                       $clauses[] = '(' . join(' OR ', 
$like_clauses) . ')';
+                               }
+                       }
+
+                       $filter_clauses = array();
+                       if(isset($filters[$this->get_id_field_name()]))
+                       {
+                               $filter_clauses[] = "requirement.id = 
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
+                       }
+                       if(isset($filters['activity']) && !$filters['activity'] 
== '')
+                       {
+                               $filter_clauses[] = "requirement.activity_id = 
{$this->marshal($filters['activity'], 'int')}";
+                       }
+
+                       if(count($filter_clauses))
+                       {
+                               $clauses[] = join(' AND ', $filter_clauses);
+                       }
+
+                       $condition =  join(' AND ', $clauses);
+
+                       //$joins = " {$this->left_join} controller_control_area 
ON (controller_procedure.control_area_id = controller_control_area.id)";
+
+                       $tables = "lg_requirement requirement";
+
+                       if($return_count) // We should only return a count
+                       {
+                               $cols = 'COUNT(DISTINCT(requirement.id)) AS 
count';
+                       }
+                       else
+                       {
+                               $cols .= "* ";
+                       }
+
+                       $dir = $ascending ? 'ASC' : 'DESC';
+                       $order = $sort_field ? "ORDER BY 
{$this->marshal($sort_field, 'field')} $dir ": '';
+
+                       //var_dump("SELECT {$cols} FROM {$tables} {$joins} 
WHERE {$condition} {$order}");
+
+                       return "SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}";
+               }
+
+               protected function populate(int $requirement_id, &$requirement)
+               {
+                       if($requirement == null)
+                       {
+                               $requirement = new logistic_requirement((int) 
$requirement_id);
+
+                               
$requirement->set_activity_id($this->unmarshal($this->db->f('activity_id'), 
'int'));
+                               
$requirement->set_date_from($this->unmarshal($this->db->f('date_from'), 'int'));
+                               
$requirement->set_date_to($this->unmarshal($this->db->f('date_to'), 'int'));
+                       }
+
+                       return $requirement;
+               }
+
+               protected function update($object)
+               {
+
+               }
+
+               public static function get_instance()
+               {
+                       if (self::$so == null)
+                       {
+                               self::$so = 
CreateObject('logistic.sorequirement');
+                       }
+                       return self::$so;
+               }
+       }
\ No newline at end of file

Added: trunk/logistic/inc/model/class.bim_item_type_requirement.inc.php
===================================================================
--- trunk/logistic/inc/model/class.bim_item_type_requirement.inc.php            
                (rev 0)
+++ trunk/logistic/inc/model/class.bim_item_type_requirement.inc.php    
2012-10-02 07:51:58 UTC (rev 10080)
@@ -0,0 +1,116 @@
+<?php
+
+       /**
+        * phpGroupWare - logistic: a part of a Facilities Management System.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @copyright Copyright (C) 2011,2012 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/
+        * @package property
+        * @subpackage logistic
+        * @version $Id $
+        */
+       include_class('logistic', 'model', '/inc/model/');
+
+       class logistic_bim_item_type_requirement extends logistic_model
+       {
+               public static $so;
+
+               protected static $id;
+               protected static $location_id;
+               protected static $project_type_id;
+               protected static $attribute_name;
+               protected static $attribute_type;
+
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                *
+                * @param int $id the id of this project
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int) $id;
+               }
+
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+
+               public function get_id()
+               {
+                       return $this->id;
+               }
+
+               public function set_location_id($location_id)
+               {
+                       $this->location_id = $location_id;
+               }
+
+               public function get_location_id()
+               {
+                       return $this->location_id;
+               }
+
+               public function set_project_type_id($project_type_id)
+               {
+                       $this->project_type_id = $project_type_id;
+               }
+
+               public function get_project_type_id()
+               {
+                       return $this->project_type_id;
+               }
+
+               public function set_attribute_name($attribute_name)
+               {
+                       $this->attribute_name = $attribute_name;
+               }
+
+               public function get_attribute_name()
+               {
+                       return $this->attribute_name;
+               }
+
+               public function set_attribute_type($attribute_type)
+               {
+                       $this->attribute_type = $attribute_type;
+               }
+
+               public function get_attribute_type()
+               {
+                       return $this->attribute_type;
+               }
+
+               /**
+               * Get a static reference to the storage object associated with 
this model object
+               *
+               * @return the storage object
+               */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('logistic.sobim_item_type_requirement');
+                       }
+
+                       return self::$so;
+               }
+       }
\ No newline at end of file

Added: trunk/logistic/inc/model/class.requirement.inc.php
===================================================================
--- trunk/logistic/inc/model/class.requirement.inc.php                          
(rev 0)
+++ trunk/logistic/inc/model/class.requirement.inc.php  2012-10-02 07:51:58 UTC 
(rev 10080)
@@ -0,0 +1,115 @@
+<?php
+
+       /**
+        * phpGroupWare - logistic: a part of a Facilities Management System.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @copyright Copyright (C) 2011,2012 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/
+        * @package property
+        * @subpackage logistic
+        * @version $Id $
+        */
+       include_class('logistic', 'model', '/inc/model/');
+
+       class logistic_requirement extends logistic_model
+       {
+
+               public static $so;
+               protected static $requirement_id;
+               protected static $activity_id;
+               protected static $date_from;
+               protected static $date_to;
+
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                *
+                * @param int $id the id of this project
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->requirement_id = (int) $id;
+               }
+
+               public function set_requirement_id($id)
+               {
+                       $this->requirement_id = $id;
+               }
+
+               public function get_requirement_id()
+               {
+                       return $this->requirement_id;
+               }
+
+               public function set_activity_id($activity_id)
+               {
+                       $this->activity_id = $activity_id;
+               }
+
+               public function get_activity_id()
+               {
+                       return $this->activity_id;
+               }
+
+               public function set_date_from($date_from)
+               {
+                       $this->date_from = $date_from;
+               }
+
+               public function get_date_from()
+               {
+                       return $this->date_from;
+               }
+
+               public function set_date_to($date_to)
+               {
+                       $this->date_to = $date_to;
+               }
+
+               public function get_date_to()
+               {
+                       return $this->date_to;
+               }
+
+               /**
+               * Get a static reference to the storage object associated with 
this model object
+               *
+               * @return the storage object
+               */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('logistic.sorequirement');
+                       }
+
+                       return self::$so;
+               }
+
+               public function serialize()
+               {
+                       return array(
+                               'requirement_id' => $this->get_requirement_id(),
+                               'activity_id' => $this->get_activity_id(),
+                               'date_from' => $this->get_date_from(),
+                               'date_to' => $this->get_date_to()
+                       );
+               }
+       }
\ No newline at end of file

Added: trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php      
                        (rev 0)
+++ trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php      
2012-10-02 07:51:58 UTC (rev 10080)
@@ -0,0 +1,105 @@
+<?php
+
+       /**
+        * phpGroupWare - logistic: a part of a Facilities Management System.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @copyright Copyright (C) 2011,2012 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/
+        * @package property
+        * @subpackage logistic
+        * @version $Id $
+        */
+       include_class('logistic', 'model', '/inc/model/');
+
+       class logistic_requirement_resource_allocation extends logistic_model
+       {
+               public static $so;
+
+               protected static $id;
+               protected static $requirement_id;
+               protected static $article_id;
+               protected static $type;
+
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                *
+                * @param int $id the id of this project
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int) $id;
+               }
+
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+
+               public function get_id()
+               {
+                       return $this->id;
+               }
+
+               public function set_requirement_id($requirement_id)
+               {
+                       $this->requirement_id = $requirement_id;
+               }
+
+               public function get_requirement_id()
+               {
+                       return $this->requirement_id;
+               }
+
+               public function set_article_id($article_id)
+               {
+                       $this->article_id = $article_id;
+               }
+
+               public function get_article_id()
+               {
+                       return $this->article_id;
+               }
+
+               public function set_type($type)
+               {
+                       $this->type = $type;
+               }
+
+               public function get_type()
+               {
+                       return $this->type;
+               }
+
+               /**
+               * Get a static reference to the storage object associated with 
this model object
+               *
+               * @return the storage object
+               */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('logistic.sorequirement');
+                       }
+
+                       return self::$so;
+               }
+       }
\ No newline at end of file

Added: trunk/logistic/inc/model/class.requirement_resource_type.inc.php
===================================================================
--- trunk/logistic/inc/model/class.requirement_resource_type.inc.php            
                (rev 0)
+++ trunk/logistic/inc/model/class.requirement_resource_type.inc.php    
2012-10-02 07:51:58 UTC (rev 10080)
@@ -0,0 +1,105 @@
+<?php
+
+       /**
+        * phpGroupWare - logistic: a part of a Facilities Management System.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @copyright Copyright (C) 2011,2012 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/
+        * @package property
+        * @subpackage logistic
+        * @version $Id $
+        */
+       include_class('logistic', 'model', '/inc/model/');
+
+       class logistic_requirement_resource_type extends logistic_model
+       {
+               public static $so;
+
+               protected static $id;
+               protected static $requirement_id;
+               protected static $resource_type_id;
+               protected static $no_of_elements;
+
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                *
+                * @param int $id the id of this project
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int) $id;
+               }
+
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+
+               public function get_id()
+               {
+                       return $this->id;
+               }
+
+               public function set_requirement_id($requirement_id)
+               {
+                       $this->requirement_id = $requirement_id;
+               }
+
+               public function get_requirement_id()
+               {
+                       return $this->requirement_id;
+               }
+
+               public function set_resource_type_id($resource_type_id)
+               {
+                       $this->resource_type_id = $resource_type_id;
+               }
+
+               public function get_resource_type_id()
+               {
+                       return $this->resource_type_id;
+               }
+
+               public function set_no_of_elements($no_of_elements)
+               {
+                       $this->no_of_elements = $no_of_elements;
+               }
+
+               public function get_no_of_elements()
+               {
+                       return $this->no_of_elements;
+               }
+
+               /**
+               * Get a static reference to the storage object associated with 
this model object
+               *
+               * @return the storage object
+               */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('logistic.sorequirement_resource_type');
+                       }
+
+                       return self::$so;
+               }
+       }

Added: trunk/logistic/inc/model/class.requirement_value.inc.php
===================================================================
--- trunk/logistic/inc/model/class.requirement_value.inc.php                    
        (rev 0)
+++ trunk/logistic/inc/model/class.requirement_value.inc.php    2012-10-02 
07:51:58 UTC (rev 10080)
@@ -0,0 +1,105 @@
+<?php
+
+       /**
+        * phpGroupWare - logistic: a part of a Facilities Management System.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @copyright Copyright (C) 2011,2012 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/
+        * @package property
+        * @subpackage logistic
+        * @version $Id $
+        */
+       include_class('logistic', 'model', '/inc/model/');
+
+       class logistic_requirement_value extends logistic_model
+       {
+               public static $so;
+
+               protected static $id;
+               protected static $requirement_id;
+               protected static $bim_item_type_requirement_id;
+               protected static $value;
+
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                *
+                * @param int $id the id of this project
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int) $id;
+               }
+
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+
+               public function get_id()
+               {
+                       return $this->id;
+               }
+
+               public function set_requirement_id($requirement_id)
+               {
+                       $this->requirement_id = $requirement_id;
+               }
+
+               public function get_requirement_id()
+               {
+                       return $this->requirement_id;
+               }
+
+               public function 
set_bim_item_type_requirement_id($bim_item_type_requirement_id)
+               {
+                       $this->bim_item_type_requirement_id = 
$bim_item_type_requirement_id;
+               }
+
+               public function get_bim_item_type_requirement_id()
+               {
+                       return $this->bim_item_type_requirement_id;
+               }
+
+               public function set_value($value)
+               {
+                       $this->value = $value;
+               }
+
+               public function get_value()
+               {
+                       return $this->value;
+               }
+
+               /**
+               * Get a static reference to the storage object associated with 
this model object
+               *
+               * @return the storage object
+               */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('logistic.sorequirement');
+                       }
+
+                       return self::$so;
+               }
+       }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]