fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11223] more on controller


From: Sigurd Nes
Subject: [Fmsystem-commits] [11223] more on controller
Date: Tue, 02 Jul 2013 12:02:09 +0000

Revision: 11223
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11223
Author:   sigurdne
Date:     2013-07-02 12:02:08 +0000 (Tue, 02 Jul 2013)
Log Message:
-----------
more on controller

Modified Paths:
--------------
    trunk/controller/inc/class.socheck_item.inc.php
    trunk/controller/inc/class.uicase.inc.php
    trunk/controller/inc/class.uicheck_list.inc.php
    trunk/controller/templates/base/case/add_case.xsl
    trunk/controller/templates/base/case/view_closed_cases.xsl
    trunk/controller/templates/base/case/view_open_cases.xsl
    trunk/controller/templates/base/check_list/edit_check_list.xsl
    
trunk/controller/templates/base/check_list/fragments/check_list_top_section.xsl
    trunk/controller/templates/base/check_list/view_control_info.xsl

Modified: trunk/controller/inc/class.socheck_item.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_item.inc.php     2013-07-02 10:43:31 UTC 
(rev 11222)
+++ trunk/controller/inc/class.socheck_item.inc.php     2013-07-02 12:02:08 UTC 
(rev 11223)
@@ -326,6 +326,8 @@
                        
                        $check_item_id = 0;
                        $check_item = null;
+                       $check_items_array=array();
+
                        while ($this->db->next_record())
                        {
                                if( $this->db->f('ci_id') != $check_item_id )
@@ -381,13 +383,9 @@
                                $check_item->set_cases_array($cases_array);
                                                        
                                $check_items_array[] = $check_item;
-                               
-                               return $check_items_array;
                        }
-                       else
-                       {
-                               return null;
-                       }
+
+                       return $check_items_array;
                }
                
                /**

Modified: trunk/controller/inc/class.uicase.inc.php
===================================================================
--- trunk/controller/inc/class.uicase.inc.php   2013-07-02 10:43:31 UTC (rev 
11222)
+++ trunk/controller/inc/class.uicase.inc.php   2013-07-02 12:02:08 UTC (rev 
11223)
@@ -131,6 +131,7 @@
                                
                                $type = 'component';
                                $building_location_code = 
$this->location_finder->get_building_location_code($component_arr['location_code']);
+                               $buildings_on_property = array();
                        }
                        else
                        {
@@ -138,13 +139,19 @@
                                $location_code_search_components = 
$case_location_code ? $case_location_code : $location_code;
                                $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
                                $type = 'location';
+                               // Fetches buildings on property
+                               $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, $location_code, 
$level);
+                               foreach ( $buildings_on_property as &$building)
+                               {
+                                       $building['selected'] = $building['id'] 
== $case_location_code ? 1 : 0;
+                               }
                        }
 
 
                        //------------- START find already registered cases 
-------------//
 
                        $cases_at_component_group = array();
-                       $existing_check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, $type = null, 
'all', null, null);//$location_code_search_components);
+                       $existing_check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, $_type = null, 
'all', null, null);//$location_code_search_components);
                        foreach($existing_check_items_and_cases as $check_item)
                        {
                                foreach($check_item->get_cases_array() as $case)
@@ -171,11 +178,10 @@
                                if(count($saved_control_items) > 0)
                                {                               
                                        $component_location_id = 
$control_group->get_component_location_id();
-                                       if($component_location_id)
-                                       {
-                                               //// start components
 
-
+                                       if($component_location_id && $type == 
'location')
+                                       {
+                                               //--- start components 
-------------//
                                                $criterias_array = array();
                                                $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($component_location_id);
                                                $criterias_array['location_id'] 
= $component_location_id;
@@ -206,7 +212,7 @@
                                                        
$components_at_location[$component_location_id][$location_code_search_components]
 = $_components_at_location;
                                                }
                                                
-                                               /// end components
+                                               //--- end components 
-------------//
 
                                                if($_components_at_location)
                                                {
@@ -244,13 +250,6 @@
                                                        
                        $user_role = true;
 
-                       // Fetches buildings on property
-                       $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, $location_code, 
$level);
-                       foreach ( $buildings_on_property as &$building)
-                       {
-                               $building['selected'] = $building['id'] == 
$case_location_code ? 1 : 0;
-                       }
-
                        $data = array
                        (
                                'control'                                       
                => $control,
@@ -788,12 +787,15 @@
                                
                                $type = 'component';
                                $building_location_code = 
$this->location_finder->get_building_location_code($component_arr['location_code']);
+                               $buildings_on_property = array();
                        }
                        else
                        {
                                
                                $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$check_list_location_code));
                                $type = 'location';
+                               // Fetches locations on property
+                               $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, 
$check_list_location_code, $level);
                        }
       
       
@@ -803,20 +805,15 @@
                                                        
                        $user_role = true;
 
-                       // Fetches buildings on property
-                       $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, 
$check_list_location_code, $level);
+                       $open_check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, $_type = null, 
'open_or_waiting', null, $case_location_code);
+
       
-                       if( count($buildings_on_property) > 0 )
+                       if( $buildings_on_property )
                        {
-               //              $case_location_code = $case_location_code ? 
$case_location_code : $buildings_on_property[0]['id'];
-
-                               $open_check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, $type = null, 
'open_or_waiting', null, $case_location_code);
-
                                foreach ( $buildings_on_property as &$building)
                                {
                                        $building['selected'] = $building['id'] 
== $case_location_code ? 1 : 0;
                                }
-
                        }
       
                        foreach($open_check_items_and_cases as $key => 
$check_item)
@@ -841,7 +838,7 @@
       
                        $data = array
                        (
-                           'control'                              => $control,
+                           'control'                                           
=> $control,
                                'check_list'                                    
=> $check_list,
                                'buildings_on_property'         => 
$buildings_on_property,
                            'location_array'                            => 
$location_array,
@@ -892,12 +889,15 @@
                                
                                $type = 'component';
                                $building_location_code = 
$this->location_finder->get_building_location_code($component_arr['location_code']);
+                               $buildings_on_property = array();
                        }
                        else
                        {
                                $location_code = 
$check_list->get_location_code();
                                $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
                                $type = 'location';
+                               // Fetches buildings on property
+                               $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, $location_code, 
$level);
                        }
                        // Check list top section info
       
@@ -907,13 +907,10 @@
 
                        $user_role = true;
 
-                       // Fetches buildings on property
-                       $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, $location_code, 
$level);
+                       $closed_check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, null, 
'closed', null, $case_location_code);
 
-                       if( count($buildings_on_property) > 0 )
+                       if( $buildings_on_property )
                        {
-               //              $building_location_code = 
$buildings_on_property[0]['id'];
-                               $closed_check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, null, 
'closed', null, $case_location_code);
                                foreach ( $buildings_on_property as &$building)
                                {
                                        $building['selected'] = $building['id'] 
== $case_location_code ? 1 : 0;

Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php     2013-07-02 10:43:31 UTC 
(rev 11222)
+++ trunk/controller/inc/class.uicheck_list.inc.php     2013-07-02 12:02:08 UTC 
(rev 11223)
@@ -577,16 +577,16 @@
 
                        $data = array
                        (
-                               'control' => $control,
-                               'check_list' => $check_list,
-                               'buildings_on_property' => 
$buildings_on_property,
-                               'location_array' => $location_array,
-                               'component_array' => $component_array,
-                               'type' => $type,
-                               'current_year' => $year,
-                               'current_month_nr' => $month,
-                               'building_location_code' => 
$building_location_code,
-                               'location_level' => $level
+                               'control'                                       
=> $control,
+                               'check_list'                            => 
$check_list,
+                               'buildings_on_property'         => 
$buildings_on_property,
+                               'location_array'                        => 
$location_array,
+                               'component_array'                       => 
$component_array,
+                               'type'                                          
=> $type,
+                               'current_year'                          => 
$year,
+                               'current_month_nr'                      => 
$month,
+                               'building_location_code'        => 
$building_location_code,
+                               'location_level'                        => 
$level
                        );
 
                        phpgwapi_jquery::load_widget('core');

Modified: trunk/controller/templates/base/case/add_case.xsl
===================================================================
--- trunk/controller/templates/base/case/add_case.xsl   2013-07-02 10:43:31 UTC 
(rev 11222)
+++ trunk/controller/templates/base/case/add_case.xsl   2013-07-02 12:02:08 UTC 
(rev 11223)
@@ -4,11 +4,16 @@
 
 <div id="main_content" class="medium">
   
-       <xsl:call-template name="check_list_top_section" />
+    <xsl:call-template name="check_list_top_section">
+    </xsl:call-template>
                
-       <div id="choose-building-wrp">
-    <xsl:call-template name="select_buildings_on_property" />
-  </div>
+       <xsl:choose>
+               <xsl:when test="buildings_on_property/child::node()">
+                       <div id="choose-building-wrp">
+                               <xsl:call-template 
name="select_buildings_on_property" />
+                       </div>
+               </xsl:when>  
+  </xsl:choose>
 
        <div id="view_cases">
 
@@ -39,6 +44,11 @@
                                                                <input 
type="hidden" name="location_code"  value="" class="required" />
                                                                <input 
type="hidden" name="control_group_id"  value="{$control_group_id}" />
                                                                <input 
type="hidden" name="component_id"  value="" />
+                                                                               
<xsl:variable name="control_item_id"><xsl:value-of select="id"/></xsl:variable>
+                                                                               
<input type="hidden" name="control_item_id" value="{$control_item_id}" /> 
+                                                                               
<input type="hidden" name="check_list_id">
+                                                                               
        <xsl:attribute name="value"><xsl:value-of 
select="//check_list/id"/></xsl:attribute
+                                                                               
></input>
 
                                                                                
<xsl:choose>
                                                                                
        <xsl:when test="what_to_do !=''">
@@ -66,9 +76,6 @@
 
                                                                                
<xsl:choose>
                                                                                
        <xsl:when test="type = 'control_item_type_1'">
-                                                                               
                        <xsl:variable name="control_item_id"><xsl:value-of 
select="id"/></xsl:variable>
-                                                                               
                        <input type="hidden" name="control_item_id" 
value="{$control_item_id}" /> 
-                                                                               
                        <input type="hidden" 
name="check_list_id"><xsl:attribute name="value"><xsl:value-of 
select="//check_list/id"/></xsl:attribute></input>
                                                                                
                        <input type="hidden" name="status" value="0" />
                                                                                
        <input type="hidden" name="type" value="control_item_type_1" />
                                                                                
                    
@@ -88,10 +95,6 @@
 
                                                                                
        </xsl:when>
                                                                                
        <xsl:when test="type = 'control_item_type_2'">
-
-                                                                               
                <xsl:variable name="control_item_id"><xsl:value-of 
select="id"/></xsl:variable>
-                                                                               
                        <input type="hidden" name="control_item_id" 
value="{$control_item_id}" /> 
-                                                                               
                        <input name="check_list_id" 
type="hidden"><xsl:attribute name="value"><xsl:value-of 
select="//check_list/id"/></xsl:attribute></input>
                                                                                
                        <input name="type" type="hidden" 
value="control_item_type_2" />
                                                                                
                
                                                                                
                        <div class="row">
@@ -129,10 +132,6 @@
 
                                                                                
        </xsl:when>
                                                                                
        <xsl:when test="type = 'control_item_type_3'">
-
-                                                                               
                        <xsl:variable name="control_item_id"><xsl:value-of 
select="id"/></xsl:variable>
-                                                                               
                        <input type="hidden" name="control_item_id" 
value="{$control_item_id}" /> 
-                                                                               
                        <input name="check_list_id" 
type="hidden"><xsl:attribute name="value"><xsl:value-of 
select="//check_list/id"/></xsl:attribute></input>
                                                                                
                        <input name="type" type="hidden" 
value="control_item_type_3" />
                                                                                
                
                                                                                
                        <div class="row">
@@ -172,9 +171,6 @@
                                                                                
        </xsl:when>
                                                                                
        <xsl:when test="type = 'control_item_type_4'">
 
-                                                                               
                        <xsl:variable name="control_item_id"><xsl:value-of 
select="id"/></xsl:variable>
-                                                                               
                        <input type="hidden" name="control_item_id" 
value="{$control_item_id}" /> 
-                                                                               
                        <input name="check_list_id" 
type="hidden"><xsl:attribute name="value"><xsl:value-of 
select="//check_list/id"/></xsl:attribute></input>
                                                                                
                        <input name="type" type="hidden" 
value="control_item_type_4" />
                                                                                
                
                                                                                
                        <div class="row">
@@ -213,7 +209,7 @@
 
                                                                                
        </xsl:when>
                                                                                
</xsl:choose>   
-                                                                               
</form>
+                                                                       </form>
                                                                </li>
                                                        </xsl:for-each>
                                                </ul>

Modified: trunk/controller/templates/base/case/view_closed_cases.xsl
===================================================================
--- trunk/controller/templates/base/case/view_closed_cases.xsl  2013-07-02 
10:43:31 UTC (rev 11222)
+++ trunk/controller/templates/base/case/view_closed_cases.xsl  2013-07-02 
12:02:08 UTC (rev 11223)
@@ -5,9 +5,14 @@
 <div id="main_content" class="medium">
  <xsl:call-template name="check_list_top_section" />
 
- <div id="choose-building-wrp">
-                       <xsl:call-template name="select_buildings_on_property" 
/>
- </div>
+       <xsl:choose>
+               <xsl:when test="buildings_on_property/child::node()">
+                       <div id="choose-building-wrp">
+                               <xsl:call-template 
name="select_buildings_on_property" />
+                       </div>
+               </xsl:when>  
+  </xsl:choose>
+
  
 <div id="view_cases">
        <xsl:call-template name="cases_tab_menu">

Modified: trunk/controller/templates/base/case/view_open_cases.xsl
===================================================================
--- trunk/controller/templates/base/case/view_open_cases.xsl    2013-07-02 
10:43:31 UTC (rev 11222)
+++ trunk/controller/templates/base/case/view_open_cases.xsl    2013-07-02 
12:02:08 UTC (rev 11223)
@@ -2,12 +2,17 @@
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
 
 <div id="main_content" class="medium">
-  <xsl:call-template name="check_list_top_section" />
-  
-  <div id="choose-building-wrp">
-    <xsl:call-template name="select_buildings_on_property" />
-  </div>
-  
+   <xsl:call-template name="check_list_top_section">
+      <xsl:with-param name="active_tab">view_cases</xsl:with-param>
+    </xsl:call-template>
+
+       <xsl:choose>
+               <xsl:when test="buildings_on_property/child::node()">
+                       <div id="choose-building-wrp">
+                               <xsl:call-template 
name="select_buildings_on_property" />
+                       </div>
+               </xsl:when>  
+  </xsl:choose>
   <div id="view_cases">
     <xsl:call-template name="cases_tab_menu">
       <xsl:with-param name="active_tab">view_open_cases</xsl:with-param>

Modified: trunk/controller/templates/base/check_list/edit_check_list.xsl
===================================================================
--- trunk/controller/templates/base/check_list/edit_check_list.xsl      
2013-07-02 10:43:31 UTC (rev 11222)
+++ trunk/controller/templates/base/check_list/edit_check_list.xsl      
2013-07-02 12:02:08 UTC (rev 11223)
@@ -5,7 +5,10 @@
 
 <div id="main_content" class="medium">
                
-       <xsl:call-template name="check_list_top_section" />
+    <xsl:call-template name="check_list_top_section">
+      <xsl:with-param name="active_tab">view_details</xsl:with-param>
+    </xsl:call-template>
+
                        
        <!-- ==================  CHECKLIST DETAILS  ===================== -->
        <div id="check_list_details">

Modified: 
trunk/controller/templates/base/check_list/fragments/check_list_top_section.xsl
===================================================================
--- 
trunk/controller/templates/base/check_list/fragments/check_list_top_section.xsl 
    2013-07-02 10:43:31 UTC (rev 11222)
+++ 
trunk/controller/templates/base/check_list/fragments/check_list_top_section.xsl 
    2013-07-02 12:02:08 UTC (rev 11223)
@@ -71,7 +71,9 @@
         <xsl:choose>
         <xsl:when test="count(check_list_type) = 0 or check_list_type != 
'add_check_list'">
             <xsl:call-template name="check_list_menu">
-                <xsl:with-param name="active_tab">view_details</xsl:with-param>
+                <xsl:with-param name="active_tab">
+                       <xsl:value-of select="$active_tab" />
+                       </xsl:with-param>
             </xsl:call-template>
         </xsl:when>
         <xsl:otherwise>

Modified: trunk/controller/templates/base/check_list/view_control_info.xsl
===================================================================
--- trunk/controller/templates/base/check_list/view_control_info.xsl    
2013-07-02 10:43:31 UTC (rev 11222)
+++ trunk/controller/templates/base/check_list/view_control_info.xsl    
2013-07-02 12:02:08 UTC (rev 11223)
@@ -67,7 +67,9 @@
                                
        </script>
                
-       <xsl:call-template name="check_list_top_section" />
+    <xsl:call-template name="check_list_top_section">
+      <xsl:with-param name="active_tab">view_control_info</xsl:with-param>
+    </xsl:call-template>
                                
        <div class="tab_menu">
                <a id="view_control_details" class="active">




reply via email to

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