fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9828] controller: link to component type of checklis


From: Sigurd Nes
Subject: [Fmsystem-commits] [9828] controller: link to component type of checklist from hook_home, include short deskription on component
Date: Fri, 03 Aug 2012 10:12:20 +0000

Revision: 9828
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9828
Author:   sigurdne
Date:     2012-08-03 10:12:19 +0000 (Fri, 03 Aug 2012)
Log Message:
-----------
controller: link to component type of checklist from hook_home, include short 
deskription on component

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-08-02 18:04:41 UTC 
(rev 9827)
+++ trunk/controller/inc/class.socontrol.inc.php        2012-08-03 10:12:19 UTC 
(rev 9828)
@@ -185,7 +185,7 @@
                {
                        $controls_array = array();
                        
-                       $sql  = "SELECT distinct c.*, 
fm_responsibility_role.name AS responsibility_name ";
+                       $sql  = "SELECT distinct c.*, 
fm_responsibility_role.name AS responsibility_name, ccl.location_id, 
ccl.component_id ";
                        $sql .= "FROM controller_control_component_list ccl "; 
                        $sql .= "LEFT JOIN controller_control c on 
ccl.control_id=c.id ";
                        $sql .= "LEFT JOIN fm_responsibility_role ON 
fm_responsibility_role.id = c.responsibility_id ";
@@ -199,7 +199,7 @@
                        
                        $sql .= "AND (c.start_date <= $from_date AND c.end_date 
IS NULL ";
                        $sql .= "OR c.end_date > $from_date AND c.start_date < 
$to_date)";
-                       
+
                        $this->db->query($sql);
                        
                        while($this->db->next_record()) {
@@ -217,7 +217,10 @@
                                
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
                                
$control->set_repeat_type_label($this->unmarshal($this->db->f('repeat_type', 
true), 'int'));
                                
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
-                               
+//Sigurd 3.august 2010:
+                               
$control->set_location_id($this->unmarshal($this->db->f('location_id'), 'int'));
+                               
$control->set_component_id($this->unmarshal($this->db->f('component_id'), 
'int'));
+//
                                if($return_type == "return_object")
                                        $controls_array[] = $control;
                                else

Modified: trunk/controller/inc/hook_home.inc.php
===================================================================
--- trunk/controller/inc/hook_home.inc.php      2012-08-02 18:04:41 UTC (rev 
9827)
+++ trunk/controller/inc/hook_home.inc.php      2012-08-03 10:12:19 UTC (rev 
9828)
@@ -72,7 +72,6 @@
            $controls = array();
            $controls_loc = 
$so_control->get_controls_by_location($location["location_code"], 
$from_date_ts, $to_date_ts, $repeat_type, '', $location["role_id"] );
            $controls_comp = 
$so_control->get_controls_for_components_by_location($location["location_code"],
 $from_date_ts, $to_date_ts, $repeat_type, '', $location["role_id"] );
-           
            foreach($controls_loc as $cl)
            {
                $controls[] = $cl;
@@ -138,6 +137,14 @@
                $check_lists = 
$so->get_open_check_lists_for_control($current_control["id"], $curr_location, 
$from_date_ts);
                $location_array = execMethod('property.bolocation.read_single', 
array('location_code' => $curr_location));
                $location_name = $location_array["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'])))
+                       {
+                               $location_name .= "::{$short_desc}";
+                       }
+               }
+
                foreach($control_areas['cat_list'] as $area)
                {
                        if($area['cat_id'] == 
$current_control["control_area_id"])
@@ -222,6 +229,14 @@
                $check_lists = 
$so->get_planned_check_lists_for_control($current_control["id"], 
$curr_location);
                $location_array = execMethod('property.bolocation.read_single', 
array('location_code' => $curr_location));
                $location_name = $location_array["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'])))
+                       {
+                               $location_name .= "::{$short_desc}";
+                       }
+               }
+
                foreach($control_areas['cat_list'] as $area)
                {
                        if($area['cat_id'] == 
$current_control["control_area_id"])
@@ -297,6 +312,14 @@
                //$control_location = 
$so_control->getLocationCodeFromControl($current_control->get_id());
                $location_array = execMethod('property.bolocation.read_single', 
array('location_code' => $curr_location));
                $location_name = $location_array["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'])))
+                       {
+                               $location_name .= "::{$short_desc}";
+                       }
+               }
+
                foreach($control_areas['cat_list'] as $area)
                {
                        if($area['cat_id'] == 
$current_control["control_area_id"])
@@ -320,7 +343,16 @@
                                                ($current_date, array
                                                (
                                                        'text' => "<span 
class='title'>{$location_name}</span><span 
class='control-area'>{$control_area_name}</span> <span 
class='control'>{$current_control["title"]}</span> <span 
class='date'>{$next_date}</span>",
-                                                       'link' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicheck_list.add_check_list', 'deadline_ts' => $current_date, 
'control_id' => $current_control["id"], 'location_code' => $curr_location))
+                                                       'link' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                                       (
+                                                               'menuaction'    
=> 'controller.uicheck_list.add_check_list',
+                                                               'deadline_ts'   
=> $current_date,
+                                                               'control_id'    
=> $current_control["id"],
+                                                               'location_code' 
=> $curr_location,
+                                                               'type'          
        => $current_control['component_id'] ? 'component' : '',
+                                                               'location_id'   
=> $current_control['location_id'],
+                                                               'component_id'  
=> $current_control['component_id']
+                                                       ))
                                                ));
                                        }
                                        else
@@ -341,11 +373,21 @@
                        else
                        {
                                $next_date = "Fristdato: " . date('d/m/Y', 
$current_date);
+                       
                                $portalbox2_data[] = array
                                ($current_date, array
                                (
                                        'text' => "<span 
class='title'>{$location_name}</span><span 
class='control-area'>{$control_area_name}</span> <span 
class='control'>{$current_control["title"]}</span> <span 
class='date'>{$next_date}</span>",
-                                       'link' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicheck_list.add_check_list', 'deadline_ts' => $current_date, 
'control_id' => $current_control["id"], 'location_code' => $curr_location))
+                                       'link' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'    => 
'controller.uicheck_list.add_check_list', 
+                                               'deadline_ts'   => 
$current_date, 
+                                               'control_id'    => 
$current_control["id"], 
+                                               'location_code' => 
$curr_location,
+                                               'type'                  => 
$current_control['component_id'] ? 'component' : '',
+                                               'location_id'   => 
$current_control['location_id'],
+                                               'component_id'  => 
$current_control['component_id']
+                                       ))
                                ));                                     
                        }
                }

Modified: trunk/controller/inc/model/class.control.inc.php
===================================================================
--- trunk/controller/inc/model/class.control.inc.php    2012-08-02 18:04:41 UTC 
(rev 9827)
+++ trunk/controller/inc/model/class.control.inc.php    2012-08-03 10:12:19 UTC 
(rev 9828)
@@ -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();
@@ -233,6 +235,32 @@
                        $this->error_msg_array = $error_msg_array;
                }
                
+
+
+//Sigurd 3.august 2010: needed for 
socontrol::get_controls_for_components_by_location() 
+
+               public function set_location_id($location_id)
+               {
+                       $this->location_id = $location_id;
+               }
+
+               public function get_location_id()
+               {
+                       return $this->location_id;
+               }
+
+               public function set_component_id($component_id)
+               {
+                       $this->component_id = $component_id;
+               }
+
+               public function get_component_id()
+               {
+                       return $this->component_id;
+               }
+
+//
+
                /**
                 * Get a static reference to the storage object associated with 
this model object
                 * 




reply via email to

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