[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8852]
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [8852] |
Date: |
Tue, 14 Feb 2012 07:17:20 +0000 |
Revision: 8852
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8852
Author: erikhl
Date: 2012-02-14 07:17:14 +0000 (Tue, 14 Feb 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/controller/inc/class.socontrol_group.inc.php
trunk/controller/inc/class.socontrol_item.inc.php
trunk/controller/inc/class.uicheck_list.inc.php
trunk/controller/inc/class.uicontrol_group_component.inc.php
trunk/controller/inc/class.uidocument.inc.php
Modified: trunk/controller/inc/class.socontrol_group.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol_group.inc.php 2012-02-13 13:47:22 UTC
(rev 8851)
+++ trunk/controller/inc/class.socontrol_group.inc.php 2012-02-14 07:17:14 UTC
(rev 8852)
@@ -418,4 +418,34 @@
$sql = "INSERT INTO
controller_control_group_component_list (control_group_id, component_id)
values($control_group_id, $component_id)";
$this->db->query($sql);
}
+
+ function get_control_group_ids_for_control($control_id)
+ {
+ $results = array();
+
+ $sql = "select distinct(cg.id) from
controller_control_group cg, controller_control_item ci,
controller_control_item_list cil where cil.control_id = {$control_id} and ci.id
= cil.control_item_id and cg.id = ci.control_group_id";
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ while ($this->db->next_record())
+ {
+ $results[] = $this->db->f('id');
+ }
+
+ return $results;
+ }
+
+ function get_components_for_control_group($control_group_id)
+ {
+ $results = array();
+
+ $sql = "select * from
controller_control_group_component_list where
control_group_id={$control_group_id}";
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ while ($this->db->next_record())
+ {
+ $results[] = $this->db->f('component_id');
+ }
+
+ return $results;
+ }
}
Modified: trunk/controller/inc/class.socontrol_item.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol_item.inc.php 2012-02-13 13:47:22 UTC
(rev 8851)
+++ trunk/controller/inc/class.socontrol_item.inc.php 2012-02-14 07:17:14 UTC
(rev 8852)
@@ -300,5 +300,49 @@
return $control_item;
}
+
+ function get_control_items_for_component($control_group_id,
$location_code)
+ {
+ $results = array();
+ $sql1 = "select distinct(cg.id) from
controller_control_group cg, controller_control_item ci,
controller_control_item_list cil where cil.control_id = {$control_id} and ci.id
= cil.control_item_id and cg.id = ci.control_group_id";
+ //var_dump($sql1);
+ $this->db->query($sql1, __LINE__, __FILE__);
+ while ($this->db->next_record()) {
+ $results[] = array('control_group' =>
$this->db->f('id'));
+ }
+
+ return $results;
+
+ }
+
+ function location_has_component($comp, $location_code)
+ {
+ return true;
+ }
+
+ function get_items_for_control_group($control_id,
$control_group_id)
+ {
+ $results = array();
+
+ $sql = "select ci.* from controller_control_item ci,
controller_control_item_list cil where ci.control_group_id =
{$control_group_id} and cil.control_id = {$control_id} and ci.id =
cil.control_item_id";
+ //var_dump($sql);
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ while($this->db->next_record())
+ {
+ //create check_item and add to return array
+ $control_item = new
controller_control_item($this->unmarshal($this->db->f('id', true), 'int'));
+
$control_item->set_title($this->unmarshal($this->db->f('title', true),
'string'));
+
$control_item->set_required($this->unmarshal($this->db->f('required', true),
'boolean'));
+
$control_item->set_type($this->unmarshal($this->db->f('type', true), 'string'));
+
$control_item->set_what_to_do($this->unmarshal($this->db->f('what_to_do',
true), 'string'));
+
$control_item->set_how_to_do($this->unmarshal($this->db->f('how_to_do', true),
'string'));
+
$control_item->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
true), 'int'));
+
+ $results[] = $control_item;
+ }
+ return $results;
+ }
+
}
Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php 2012-02-13 13:47:22 UTC
(rev 8851)
+++ trunk/controller/inc/class.uicheck_list.inc.php 2012-02-14 07:17:14 UTC
(rev 8852)
@@ -48,6 +48,7 @@
private $so_check_item;
private $so_procedure;
private $so_control_group_list;
+ private $so_control_group;
private $so_control_item_list;
var $public_functions = array(
@@ -84,6 +85,7 @@
$this->so_check_item =
CreateObject('controller.socheck_item');
$this->so_procedure =
CreateObject('controller.soprocedure');
$this->so_control_group_list =
CreateObject('controller.socontrol_group_list');
+ $this->so_control_group =
CreateObject('controller.socontrol_group');
$this->so_control_item_list =
CreateObject('controller.socontrol_item_list');
self::set_active_menu('controller::control::check_list');
@@ -527,6 +529,40 @@
}
}
+ //get control items based on control group/component
connection
+ $control_groups_for_control =
$this->so_control_group->get_control_group_ids_for_control($control->get_id());
+ //_debug_array($control_groups_for_control);
+ foreach($control_groups_for_control as $cg)
+ {
+ $components_for_control_group[] = array($cg =>
$this->so_control_group->get_components_for_control_group($cg));
+ }
+ //_debug_array($components_for_control_group);
+ $control_group_check_items = array();
+ foreach($components_for_control_group as $cg_components)
+ {
+ foreach($control_groups_for_control as
$cg_control)
+ {
+ $components =
$cg_components[$cg_control];
+ //_debug_array($components);
+ $location_has_component = false;
+ foreach($components as $comp)
+ {
+ if(!$location_has_component)
+ {
+ //check if current
location has component
+ $location_has_component
= $this->so_control_item->location_has_component($comp,
$check_list->get_location_code);
+ }
+ }
+ if($location_has_component)
+ {
+ //the check items for the
control group shall be added
+ $check_items =
$this->so_control_item->get_items_for_control_group($control->get_id(),
$cg_control);
+ $control_group_check_items[] =
$check_items;
+ }
+ }
+ }
+ //_debug_array($control_group_check_items);
+
// Makes control items list stripped for closed check
items of type measurement
foreach($control_items as $control_item){
if( !in_array($control_item->get_id(),
$remove_control_item_ids_array) ){
Modified: trunk/controller/inc/class.uicontrol_group_component.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_group_component.inc.php
2012-02-13 13:47:22 UTC (rev 8851)
+++ trunk/controller/inc/class.uicontrol_group_component.inc.php
2012-02-14 07:17:14 UTC (rev 8852)
@@ -331,6 +331,9 @@
$allrows =
phpgw::get_var('allrows', 'bool');
$location_code =
phpgw::get_var('location_code');*/
+ $control_group_id = phpgw::get_var('control_group_id');
+ //var_dump($control_group_id);
+
$type_id = phpgw::get_var('bim_type_id');
$start = phpgw::get_var('startIndex');
Modified: trunk/controller/inc/class.uidocument.inc.php
===================================================================
--- trunk/controller/inc/class.uidocument.inc.php 2012-02-13 13:47:22 UTC
(rev 8851)
+++ trunk/controller/inc/class.uidocument.inc.php 2012-02-14 07:17:14 UTC
(rev 8852)
@@ -220,7 +220,7 @@
$document->set_name($_FILES["file_path"]["name"]);
$document->set_type_id(phpgw::get_var('document_type'));
$desc =
phpgw::get_var('document_description','html');
- var_dump($desc);
+ //var_dump($desc);
$document->set_description($desc);
$document->set_procedure_id($procedure_id);
//var_dump($document);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8852],
Erik Holm-Larsen <=