[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10011] controller: tuning / find komponents
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10011] controller: tuning / find komponents |
Date: |
Wed, 19 Sep 2012 13:21:33 +0000 |
Revision: 10011
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10011
Author: sigurdne
Date: 2012-09-19 13:21:28 +0000 (Wed, 19 Sep 2012)
Log Message:
-----------
controller: tuning / find komponents
Modified Paths:
--------------
trunk/controller/inc/class.socontrol.inc.php
trunk/controller/inc/hook_home.inc.php
trunk/controller/inc/model/class.control.inc.php
Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php 2012-09-19 08:53:10 UTC
(rev 10010)
+++ trunk/controller/inc/class.socontrol.inc.php 2012-09-19 13:21:28 UTC
(rev 10011)
@@ -245,8 +245,10 @@
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type'), 'int'));
$control->set_repeat_type_label($this->unmarshal($this->db->f('repeat_type'),
'int'));
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval'),
'int'));
+
$control->set_component_id($this->unmarshal($this->db->f('component_id'),
'int'));
+
$control->set_location_id($this->unmarshal($this->db->f('location_id'), 'int'));
- if($return_type == "return_object")
+ if($return_type == "return_object")
{
$controls_array[] = $control;
}
@@ -354,7 +356,9 @@
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type'), 'int'));
$control->set_repeat_type_label($this->unmarshal($this->db->f('repeat_type'),
'int'));
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval'),
'int'));
-
+
$control->set_component_id($this->unmarshal($this->db->f('component_id'),
'int'));
+
$control->set_location_id($this->unmarshal($this->db->f('location_id'), 'int'));
+
if($return_type == "return_object")
{
$controls_array[] = $control;
@@ -388,6 +392,7 @@
}
}
+
/**
* Get controls with a control area
*
Modified: trunk/controller/inc/hook_home.inc.php
===================================================================
--- trunk/controller/inc/hook_home.inc.php 2012-09-19 08:53:10 UTC (rev
10010)
+++ trunk/controller/inc/hook_home.inc.php 2012-09-19 13:21:28 UTC (rev
10011)
@@ -34,6 +34,9 @@
include_class('controller', 'date_generator', 'inc/component/');
include_class('controller', 'location_finder', 'inc/helper/');
+ $location_array = array();
+ $component_short_desc = array();
+
$so_check_list = CreateObject('controller.socheck_list');
$so_control = CreateObject('controller.socontrol');
@@ -191,7 +194,7 @@
$date_generator = new
date_generator($my_control["start_date"], $my_control["end_date"],
$from_date_ts, $to_date_ts, $my_control["repeat_type"],
$my_control["repeat_interval"]);
$deadline_dates_for_control =
$date_generator->get_dates();
-
+
$check_list_array = array();
foreach($deadline_dates_for_control as $deadline_ts)
{
@@ -207,7 +210,7 @@
$check_list =
$so_check_list->get_check_list_for_control_by_date($my_control['id'],
$deadline_ts, null, null, $component['location_id'], $component['id'],
"component" );
}
-
+
$control_id = $my_control['id'];
if($check_list == null & $control_type ==
"location")
@@ -278,8 +281,11 @@
if($check_list_type == "location")
{
$location_code = $my_undone_control[4];
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
- $location_name =
$location_array["loc1_name"];
+
if(!isset($location_array[$location_code]) || !$location_array[$location_code])
+ {
+ $location_array[$location_code]
= execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ }
+ $location_name =
$location_array[$location_code]["loc1_name"];
if(count( $controls_on_date) > 1 )
{
@@ -302,7 +308,15 @@
$location_id = $my_undone_control[4];
$component_id = $my_undone_control[5];
- $short_desc_arr =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
+
if(!isset($component_short_desc[$location_id][$component_id]))
+ {
+
$component_short_desc[$location_id][$component_id] =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
+ }
+
+
if($component_short_desc[$location_id][$component_id])
+ {
+ $short_desc_arr =
$component_short_desc[$location_id][$component_id];
+ }
if(count( $controls_on_date) > 1 )
{
@@ -325,9 +339,12 @@
$check_list_id = $my_undone_control[3];
$location_code = $my_undone_control[4];
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
- $location_name = $location_array["loc1_name"];
-
+ if(!isset($location_array[$location_code]) ||
!$location_array[$location_code])
+ {
+ $location_array[$location_code] =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ }
+ $location_name =
$location_array[$location_code]["loc1_name"];
+
if(count( $controls_on_date) > 1 )
{
$portalbox0->data[] = array(
@@ -362,6 +379,7 @@
$controls_for_location_array = array();
foreach($my_locations as $location)
{
+
$controls = array();
$controls_loc =
$so_control->get_controls_by_location($location["location_code"],
$from_date_ts, $to_date_ts, $repeat_type, "return_array", $location["role_id"]
);
$controls_comp =
$so_control->get_controls_for_components_by_location($location["location_code"],
$from_date_ts, $to_date_ts, $repeat_type, "return_array", $location["role_id"]
);
@@ -378,10 +396,11 @@
$controls_for_location_array[] =
array($location["location_code"], $controls);
}
-
+
$controls_array = array();
$control_dates = array();
- foreach($controls_for_location_array as $control_arr){
+ foreach($controls_for_location_array as $control_arr)
+ {
$current_location = $control_arr[0];
$controls_for_loc_array = $control_arr[1];
foreach($controls_for_loc_array as $control)
@@ -390,7 +409,7 @@
$controls_array[] = array($current_location, $control,
$date_generator->get_dates());
}
}
-
+
$portalbox1 = CreateObject('phpgwapi.listbox', array
(
'title' => "<div class='control heading'>Tittel på
kontroll</div><div class='title heading'>Lokasjonsnavn</div><div
class='control-area heading'>Kontrollområde</div><div class='date
heading'>Fristdato</div>",
@@ -415,14 +434,25 @@
$curr_location = $control_instance[0];
$current_control = $control_instance[1];
$check_lists =
$so_check_list->get_planned_check_lists_for_control($current_control["id"],
$curr_location, $current_control['location_id'],
$current_control['component_id']);
- $location_array = execMethod('property.bolocation.read_single',
array('location_code' => $curr_location));
- $location_name = $location_array["loc1_name"];
+
+ if(!isset($location_array[$curr_location]) ||
!$location_array[$curr_location])
+ {
+ $location_array[$curr_location] =
execMethod('property.bolocation.read_single', array('location_code' =>
$curr_location));
+ }
+ $location_name = $location_array[$curr_location]["loc1_name"];
+
if(isset($current_control['component_id']) &&
$current_control['component_id'])
{
- if($short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$current_control['location_id'], 'id' => $current_control['component_id'])))
+//_debug_array($current_control);
+
if(!isset($component_short_desc[$current_control['location_id']][$current_control['component_id']]))
{
- $location_name .= "::{$short_desc}";
+
$component_short_desc[$current_control['location_id']][$current_control['component_id']]
= execMethod('property.soentity.get_short_description', array('location_id' =>
$current_control['location_id'], 'id' => $current_control['component_id']));
}
+
+
if($component_short_desc[$current_control['location_id']][$current_control['component_id']])
+ {
+ $location_name .=
"::{$component_short_desc[$current_control['location_id']][$current_control['component_id']]}";
+ }
}
foreach($control_areas['cat_list'] as $area)
@@ -490,11 +520,13 @@
$level = count(explode('-', $location_code));
- if($level == 1){
+ if($level == 1)
+ {
// Fetches all controls for the components for a
location within time period
$filter = "bim_item.location_code = '$location_code' ";
$components_with_controls_array =
$so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_array", $location["role_id"], $filter);
- }else
+ }
+ else
{
// Fetches all controls for the components for a
location within time period
$filter = "bim_item.location_code LIKE
'$location_code%' ";
@@ -507,11 +539,11 @@
}
if( count($components_with_controls_array) > 0 )
- {
+ {
foreach($components_with_controls_array as $component)
{
- $my_controls[] = array( $location_code, 'component',
$component['controls_array'], $component );
- }
+ $my_controls[] = array( $location_code, 'component',
$component['controls_array'], $component );
+ }
}
}
@@ -541,10 +573,10 @@
// Daily, monthly yearly control: Todate in one
month
$to_date_ts = mktime(0, 0, 0, date("n")+1,
date("j"), date("Y") );
}
-
+
$date_generator = new
date_generator($my_control["start_date"], $my_control["end_date"],
$from_date_ts, $to_date_ts, $my_control["repeat_type"],
$my_control["repeat_interval"]);
$deadline_dates_for_control =
$date_generator->get_dates();
-
+
$check_list_array = array();
foreach($deadline_dates_for_control as $deadline_ts)
{
@@ -570,7 +602,7 @@
{
$component = $container_arr[3];
$my_assigned_controls[$deadline_ts][] = array("add", $deadline_ts,
$my_control, "component", $component['location_id'], $component['id'] );
- }
+ }
}
else if($check_list->get_status() ==
controller_check_list::STATUS_NOT_DONE)
{
@@ -579,7 +611,7 @@
}
}
}
-
+
// Sorts my_undone_controls by deadline date
//usort($my_undone_controls, "sort_cmp");
foreach($my_assigned_controls as $date_ts => $assigned_controls_on_date)
@@ -618,10 +650,14 @@
if($check_list_type == "location")
{
$location_code =
$my_assigned_control[4];
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
- $location_name =
$location_array["loc1_name"];
+
+
if(!isset($location_array[$location_code]) || !$location_array[$location_code])
+ {
+ $location_array[$location_code]
= execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ }
+ $location_name =
$location_array[$location_code]["loc1_name"];
+
-
if(count( $assigned_controls_on_date) > 1 )
{
$portalbox2->data[] = array(
@@ -642,8 +678,16 @@
$location_id = $my_assigned_control[4];
$component_id = $my_assigned_control[5];
- $short_desc_arr =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
-
+
if(!isset($component_short_desc[$location_id][$component_id]))
+ {
+
$component_short_desc[$location_id][$component_id] =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
+ }
+
+
if($component_short_desc[$location_id][$component_id])
+ {
+ $short_desc_arr =
$component_short_desc[$location_id][$component_id];
+ }
+
if(count( $assigned_controls_on_date) >
1 )
{
$portalbox2->data[] = array(
@@ -665,9 +709,12 @@
$check_list_id = $my_assigned_control[3];
$location_code = $my_assigned_control[4];
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
- $location_name = $location_array["loc1_name"];
-
+ if(!isset($location_array[$location_code]) ||
!$location_array[$location_code])
+ {
+ $location_array[$location_code] =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ }
+ $location_name =
$location_array[$location_code]["loc1_name"];
+
if(count( $assigned_controls_on_date ) > 1 )
{
$portalbox2->data[] = array(
@@ -718,4 +765,4 @@
}
return ($a[0] < $b[0]) ? -1 : 1;
- }
\ No newline at end of file
+ }
Modified: trunk/controller/inc/model/class.control.inc.php
===================================================================
--- trunk/controller/inc/model/class.control.inc.php 2012-09-19 08:53:10 UTC
(rev 10010)
+++ trunk/controller/inc/model/class.control.inc.php 2012-09-19 13:21:28 UTC
(rev 10011)
@@ -57,6 +57,8 @@
protected $responsibility_name;
protected $control_area_id;
protected $control_area_name;
+ protected $location_id;
+ protected $component_id;
// Objects
protected $check_lists_array = array();
@@ -232,7 +234,28 @@
{
$this->error_msg_array = $error_msg_array;
}
+
+ public function set_component_id($component_id)
+ {
+ $this->component_id = $component_id;
+ }
+ public function get_component_id()
+ {
+ return $this->component_id;
+ }
+
+
+ public function set_location_id($location_id)
+ {
+ $this->location_id = $location_id;
+ }
+
+ public function get_location_id()
+ {
+ return $this->location_id;
+ }
+
/**
* Get a static reference to the storage object associated with
this model object
*
@@ -288,9 +311,11 @@
'procedure_name' => $this->get_procedure_name(),
'control_area_id' =>
$this->get_control_area_id(),
'control_area_name' =>
$this->get_control_area_name(),
- 'repeat_type' => $this->get_repeat_type(),
+ 'repeat_type' => $this->get_repeat_type(),
'repeat_interval' =>
$this->get_repeat_interval(),
- 'responsibility_name' =>
$this->get_responsibility_name()
+ 'responsibility_name' =>
$this->get_responsibility_name(),
+ 'component_id' =>
$this->get_component_id(),
+ 'location_id' =>
$this->get_location_id()
);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10011] controller: tuning / find komponents,
Sigurd Nes <=