fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9682]


From: Torstein
Subject: [Fmsystem-commits] [9682]
Date: Wed, 27 Jun 2012 12:48:47 +0000

Revision: 9682
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9682
Author:   vator
Date:     2012-06-27 12:48:47 +0000 (Wed, 27 Jun 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.socheck_list.inc.php
    trunk/controller/inc/class.socontrol.inc.php
    trunk/controller/inc/class.uicalendar.inc.php
    trunk/controller/templates/base/calendar/view_calendar_month.xsl
    trunk/controller/templates/base/calendar/view_calendar_year.xsl
    trunk/controller/templates/base/css/base.css

Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php     2012-06-27 10:57:42 UTC 
(rev 9681)
+++ trunk/controller/inc/class.socheck_list.inc.php     2012-06-27 12:48:47 UTC 
(rev 9682)
@@ -659,13 +659,14 @@
        }
        
        // Fetches check lists for component and control id
-       function get_check_lists_for_control_and_component( $control_id, 
$component_id, $from_date_ts, $to_date_ts, $repeat_type = null ){
+       function get_check_lists_for_control_and_component( $control_id, 
$location_id, $component_id, $from_date_ts, $to_date_ts, $repeat_type = null ){
                $sql =  "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, planned_date, completed_date, ";
-               $sql .= "cl.component_id as cl_component_id, cl.location_code 
as cl_location_code, num_open_cases, num_pending_cases "; 
+               $sql .= "cl.component_id as cl_component_id, cl.location_id as 
cl_location_id, cl.location_code as cl_location_code, num_open_cases, 
num_pending_cases "; 
                $sql .= "FROM controller_check_list cl ";
                $sql .= "LEFT JOIN controller_control c on cl.control_id = c.id 
";
                $sql .= "WHERE cl.control_id = {$control_id} ";
                $sql .= "AND cl.component_id = {$component_id} ";
+               $sql .= "AND cl.location_id = {$location_id} ";
                
                if( $repeat_type != null )
                        $sql .= "AND c.repeat_type = $repeat_type ";
@@ -682,6 +683,7 @@
                        
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date', 
true), 'int'));
                        
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date', 
true), 'int')); 
                        
$check_list->set_component_id($this->unmarshal($this->db->f('cl_component_id', 
true), 'int'));
+                       
$check_list->set_location_id($this->unmarshal($this->db->f('cl_location_id', 
true), 'int'));
                        
$check_list->set_location_code($this->unmarshal($this->db->f('cl_location_code',
 true), 'string'));
                        
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases', 
true), 'int'));
                        
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases',
 true), 'int'));

Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php        2012-06-27 10:57:42 UTC 
(rev 9681)
+++ trunk/controller/inc/class.socontrol.inc.php        2012-06-27 12:48:47 UTC 
(rev 9682)
@@ -410,14 +410,14 @@
                        }
                }
                
-           function get_components_for_control($control_id)
+         function get_components_for_control($control_id)
                {
                        $controls_array = array();
 
-                       $sql =  "SELECT c.id, c.title, ccl.component_id, 
bim_type.description, bim.location_code ";
+                       $sql =  "SELECT c.id, c.title, ccl.component_id, 
ccl.location_id, bim_type.description, bim.location_code ";
       $sql .= "FROM controller_control c, controller_control_component_list 
ccl, fm_bim_item bim, fm_bim_type bim_type "; 
                        $sql .= "WHERE ccl.control_id = $control_id ";
-            $sql .= "AND ccl.control_id = c.id ";
+      $sql .= "AND ccl.control_id = c.id ";
                        $sql .= "AND bim.id = ccl.component_id ";
                        $sql .= "AND bim_type.id = bim.type";
 
@@ -427,6 +427,7 @@
                                $control_id = 
$this->unmarshal($this->db->f('id', true), 'int');
                                $title = $this->unmarshal($this->db->f('title', 
true), 'string');
                                $component_id = 
$this->unmarshal($this->db->f('component_id', true), 'int');
+                               $location_id = 
$this->unmarshal($this->db->f('location_id', true), 'int');
                                $component_type = 
$this->unmarshal($this->db->f('description', true), 'string');
                                $component_location_code = 
$this->unmarshal($this->db->f('location_code', true), 'string');
                                //$component_guid = 
$this->unmarshal($this->db->f('guid', true), 'string');
@@ -436,7 +437,7 @@
                                
                                $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$component_location_code));
                                
-                               $controls_array[] = array("id" => $control_id, 
"title" => $title, "component_id" => $component_id, "component_description" => 
$component_type, "component_location" => $location_array["loc1_name"]);
+                               $controls_array[] = array("id" => $control_id, 
"title" => $title, "component_id" => $component_id, "location_id" => 
$location_id, "component_description" => $component_type, "component_location" 
=> $location_array["loc1_name"]);
                        }
 
                        if( count( $controls_array ) > 0 ){

Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php       2012-06-27 10:57:42 UTC 
(rev 9681)
+++ trunk/controller/inc/class.uicalendar.inc.php       2012-06-27 12:48:47 UTC 
(rev 9682)
@@ -240,8 +240,11 @@
                                        
$cl_criteria->set_control_id($control->get_id());
                                        
$cl_criteria->set_location_code($location_code);
                                        
+                                       $from_month = 
$this->get_start_month_for_control($control);
+                                       $to_month = 
$this->get_end_month_for_control($control);
+                                       
                                        // Loops through controls and populates 
aggregate open cases pr month array.
-                                       $agg_open_cases_pr_month_array = 
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year);
+                                       $agg_open_cases_pr_month_array = 
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month, 
$to_month);
                                        
                                        $year_calendar = new 
year_calendar($control, $year);
                                        $calendar_array = 
$year_calendar->build_agg_month_calendar($agg_open_cases_pr_month_array);
@@ -268,8 +271,6 @@
                                }
                        }
                        
-                       //print_r( $components_with_controls_array );
-                       
                        // COMPONENTS
                        foreach($components_with_controls_array as $component)
                        {
@@ -305,7 +306,10 @@
                                                $cl_criteria->set_component_id( 
$component->get_id() );
                                        $cl_criteria->set_location_id( 
$component->get_type() );
                                        
-                                         $agg_open_cases_pr_month_array = 
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year);
+                                       $from_month = 
$this->get_start_month_for_control($control);
+                                               $to_month = 
$this->get_end_month_for_control($control);
+                                                                               
+                                         $agg_open_cases_pr_month_array = 
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month, 
$to_month);
                                        
                                          $year_calendar = new 
year_calendar($control, $year);
                                          $calendar_array = 
$year_calendar->build_agg_month_calendar($agg_open_cases_pr_month_array);
@@ -338,6 +342,7 @@
                        $heading_array = year_calendar::get_heading_array();
                        
                        $roles_array = $this->so_control->get_roles();
+                       
                        $repeat_type_array = array(
                                                                        
array('id'      => "0", 'value' => "Dag"),
                                                                        
array('id'      => "1", 'value' => "Uke"),
@@ -404,9 +409,12 @@
                                        $cl_criteria = new 
controller_check_list();
                                        $cl_criteria->set_control_id( 
$control->get_id() );
                                        $cl_criteria->set_location_code( 
$curr_location_code );
+                                       
+                                       $from_month = 
$this->get_start_month_for_control($control);
+                                       $to_month = 
$this->get_end_month_for_control($control);
                                        
                                        // Loops through controls in 
controls_for_location_array and populates aggregate open cases pr month array.
-                                       $agg_open_cases_pr_month_array = 
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year);
+                                       $agg_open_cases_pr_month_array = 
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month, 
$to_month);
                                        
                                        $year_calendar = new 
year_calendar($control, $year);
                                        $calendar_array = 
$year_calendar->build_agg_month_calendar($agg_open_cases_pr_month_array);
@@ -415,10 +423,19 @@
                                
                          foreach($components_for_control_array as $component)
                          {
-                                       $curr_component_id = 
$component['component_id'];
+                                       $component_id = 
$component['component_id'];
+                                       $location_id = 
$component['location_id'];
                                        
+                                       $cl_criteria = new 
controller_check_list();
+                                       $cl_criteria->set_control_id( 
$control->get_id() );
+                                       $cl_criteria->set_component_id( 
$component_id);
+                                 $cl_criteria->set_location_id( $location_id );
+                                       
+                                 $from_month = 
$this->get_start_month_for_control($control);
+                                       $to_month = 
$this->get_end_month_for_control($control);
+                               
                                        // Loops through controls in 
controls_for_location_array and populates aggregate open cases pr month array.
-                                       $agg_open_cases_pr_month_array = 
$this->build_agg_open_cases_pr_month_array($control, $curr_component_id, $year, 
true);
+                                       $agg_open_cases_pr_month_array = 
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month, 
$to_month);
                                        
                                        $year_calendar = new 
year_calendar($control, $year);
                                        $calendar_array = 
$year_calendar->build_agg_calendar($agg_open_cases_pr_month_array);
@@ -446,9 +463,10 @@
                          foreach($components_for_control_array as $component)
                          {
                                        $curr_component_id = 
$component['component_id'];
+                                       $curr_location_id = 
$component['location_id'];
                                        
                                        $repeat_type = 
$control->get_repeat_type();
-                                       $component_with_check_lists = 
$this->so->get_check_lists_for_control_and_component($control_id, 
$curr_component_id, $from_date_ts, $to_date_ts, $repeat_type);  
+                                       $component_with_check_lists = 
$this->so->get_check_lists_for_control_and_component($control_id, 
$curr_location_id, $curr_component_id, $from_date_ts, $to_date_ts, 
$repeat_type);       
                                        
                                        $check_lists_array = 
$component_with_check_lists["check_lists_array"];
                                        
@@ -570,27 +588,8 @@
                }
                
                // Generates array of aggregated number of open cases for each 
month in time period 
-               function build_agg_open_cases_pr_month_array( $cl_criteria, 
$year )
+               function build_agg_open_cases_pr_month_array( $cl_criteria, 
$year, $from_month, $to_month )
                {
-                       // Checks if control starts in the year that is 
displayed 
-                       if( date("Y", $control->get_start_date()) == $year )
-                       {
-                               $from_month = date("n", 
$control->get_start_date());    
-                       }
-                       else
-                       {
-                               $from_month = 1;
-                       }
-                       
-                       // Checks if control ends in the year that is displayed
-                       if( date("Y", $control->get_end_date()) == $year )
-                       {
-                               $to_month = date("n", $control->get_end_date());
-                       }
-                       else
-                       {
-                               $to_month = 12;
-                       }
                                        
                        $agg_open_cases_pr_month_array = array();
                        
@@ -650,6 +649,36 @@
       return $buildings_on_property;
                }
                
+               function get_start_month_for_control($control)
+               {
+                 // Checks if control starts in the year that is displayed 
+                       if( date("Y", $control->get_start_date()) == $year )
+                       {
+                               $from_month = date("n", 
$control->get_start_date());    
+                       }
+                       else
+                       {
+                               $from_month = 1;
+                       }
+                       
+                       return $from_month;
+               }
+               
+               function get_end_month_for_control($control)
+               {       
+                       // Checks if control ends in the year that is displayed
+                       if( date("Y", $control->get_end_date()) == $year )
+                       {
+                               $to_month = date("n", $control->get_end_date());
+                       }
+                       else
+                       {
+                               $to_month = 12;
+                       }
+                       
+                       return $to_month;
+         }
+                       
                function get_location_level($location_code)
                {
                        $level = count(explode('-', $location_code));

Modified: trunk/controller/templates/base/calendar/view_calendar_month.xsl
===================================================================
--- trunk/controller/templates/base/calendar/view_calendar_month.xsl    
2012-06-27 10:57:42 UTC (rev 9681)
+++ trunk/controller/templates/base/calendar/view_calendar_month.xsl    
2012-06-27 12:48:47 UTC (rev 9682)
@@ -73,7 +73,7 @@
                        </xsl:choose>
                                                
                        <xsl:variable name="month_str">month <xsl:value-of 
select="current_month_nr"/> capitalized</xsl:variable>
-                       <h3>Kalenderoversikt for <xsl:value-of 
select="php:function('lang', $month_str)" /><span class="year"><xsl:value-of 
select="current_year"/></span></h3>
+                       <h3>Kalenderoversikt for <span 
class="month"><xsl:value-of select="php:function('lang', $month_str)" 
/></span><span class="year"><xsl:value-of select="current_year"/></span></h3>
                
                        <!-- =====================  SEARCH FOR LOCATION  
================= -->
                        <div id="search-location" class="select-box">

Modified: trunk/controller/templates/base/calendar/view_calendar_year.xsl
===================================================================
--- trunk/controller/templates/base/calendar/view_calendar_year.xsl     
2012-06-27 10:57:42 UTC (rev 9681)
+++ trunk/controller/templates/base/calendar/view_calendar_year.xsl     
2012-06-27 12:48:47 UTC (rev 9682)
@@ -216,7 +216,8 @@
                </table>
                
                <h2 class="components">Komponenter</h2>
-               
+               <xsl:choose>
+                               <xsl:when 
test="components_calendar_array/child::node()">
                <xsl:for-each select="components_calendar_array">
                  
                            <h3><xsl:value-of 
select="component/xml_short_desc"/></h3>
@@ -293,6 +294,11 @@
                                </xsl:for-each>
                                </table>        
                </xsl:for-each>
+               </xsl:when>
+                       <xsl:otherwise>
+                               <p>Ingen kontroller for komponenter tilknyttet 
lokasjon</p>
+                       </xsl:otherwise>
+                       </xsl:choose>
        </div>
 </div>
 </div>

Modified: trunk/controller/templates/base/css/base.css
===================================================================
--- trunk/controller/templates/base/css/base.css        2012-06-27 10:57:42 UTC 
(rev 9681)
+++ trunk/controller/templates/base/css/base.css        2012-06-27 12:48:47 UTC 
(rev 9682)
@@ -1070,6 +1070,10 @@
   padding: 0;
 }
 
+#control_plan .top h3 .month {
+  margin-right: 5px;
+}
+
 #control_plan .middle {
   background: none repeat scroll 0 0 #EDF5FF;
   border-color: #DBE5EF;




reply via email to

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