fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11498] property: condition survey:: summation


From: Sigurd Nes
Subject: [Fmsystem-commits] [11498] property: condition survey:: summation
Date: Wed, 27 Nov 2013 14:41:21 +0000

Revision: 11498
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11498
Author:   sigurdne
Date:     2013-11-27 14:41:18 +0000 (Wed, 27 Nov 2013)
Log Message:
-----------
property: condition survey:: summation

Modified Paths:
--------------
    trunk/property/inc/class.bocondition_survey.inc.php
    trunk/property/inc/class.uicondition_survey.inc.php
    trunk/property/templates/base/condition_survey_summation.xsl

Modified: trunk/property/inc/class.bocondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.bocondition_survey.inc.php 2013-11-27 10:09:07 UTC 
(rev 11497)
+++ trunk/property/inc/class.bocondition_survey.inc.php 2013-11-27 14:41:18 UTC 
(rev 11498)
@@ -309,8 +309,10 @@
                        }
                }
 
-               public function get_summation($id)
+               public function get_summation($id,$year = 0)
                {
+                       $year = $year ? (int)$year : date('Y');
+
                        $surveys = array();
                        
                        if($id == -1)
@@ -340,7 +342,7 @@
                                
$values[$entry['condition_survey_id']][$i]['building_part'] = 
$entry['building_part'];
                                
$values[$entry['condition_survey_id']][$i]['category'] = $entry['category'];
                                
-                               $diff = $entry['year'] - date('Y');
+                               $diff = $entry['year'] - $year;
                                if($diff < 0)
                                {
                                        $period = 1;

Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2013-11-27 10:09:07 UTC 
(rev 11497)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2013-11-27 14:41:18 UTC 
(rev 11498)
@@ -682,13 +682,14 @@
                function get_summation()
                {
                        $id     = phpgw::get_var('id', 'int', 'REQUEST');
+                       $year   = phpgw::get_var('year', 'int', 'REQUEST');
 
                        if( !$this->acl_read)
                        {
                                return;
                        }
 
-                       $values = $this->bo->get_summation($id);
+                       $values = $this->bo->get_summation($id, $year);
 
                        $total_records = count($values);
 
@@ -1389,9 +1390,24 @@
                                        'name'                  => 
$survey['title'], 
                                        'description'   => $survey['address'], 
                                );
-                       
                        }
 
+
+
+                       $current_year = date('Y');
+
+                       $years = array();
+
+                       for ($i=0; $i < 6; $i++ )
+                       {
+                               $years[] = array
+                               (
+                                       'id'    => $current_year,
+                                       'name'  => $current_year
+                               );
+                               $current_year++;
+                       }
+
                        $summation_def = array
                        (
                                array('key' => 
'building_part','label'=>lang('building 
part'),'sortable'=>false,'resizeable'=>true),
@@ -1415,8 +1431,9 @@
 
                        $data = array
                        (
-                               'datatable_def'                                 
=> $datatable_def,
-                               'surveys'                                       
=> array('options' => $surveys),
+                               'datatable_def'                 => 
$datatable_def,
+                               'surveys'                               => 
array('options' => $surveys),
+                               'years'                                 => 
array('options' => $years),
                        );
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . '::' . lang('condition survey');

Modified: trunk/property/templates/base/condition_survey_summation.xsl
===================================================================
--- trunk/property/templates/base/condition_survey_summation.xsl        
2013-11-27 10:09:07 UTC (rev 11497)
+++ trunk/property/templates/base/condition_survey_summation.xsl        
2013-11-27 14:41:18 UTC (rev 11498)
@@ -29,7 +29,7 @@
                                <dl class="proplist-col">
 
                                        <dt>
-                                               <label 
for="category"><xsl:value-of select="php:function('lang', 'category')" 
/></label>
+                                               <label 
for="category"><xsl:value-of select="php:function('lang', 'condition survey')" 
/></label>
                                        </dt>
                                        <dd>
                                                <select id="survey_id" 
name="survey_id" onChange="update_summation();" >
@@ -37,6 +37,15 @@
                                                </select>
                                        </dd>
 
+                                       <dt>
+                                               <label 
for="category"><xsl:value-of select="php:function('lang', 'year')" /> 0</label>
+                                       </dt>
+                                       <dd>
+                                               <select id="year" name="year" 
onChange="update_summation();" >
+                                                       <xsl:apply-templates 
select="years/options"/>
+                                               </select>
+                                       </dd>
+
                                </dl>
                        </div>
                        <xsl:call-template name="datasource-definition" />
@@ -55,7 +64,8 @@
        function update_summation()
        {
                var survey_id = document.getElementById("survey_id").value;
-               var oArgs = 
{menuaction:'property.uicondition_survey.get_summation', id:survey_id};
+               var year = document.getElementById("year").value;
+               var oArgs = 
{menuaction:'property.uicondition_survey.get_summation', id:survey_id, year: 
year};
                var strURL = phpGWLink('index.php', oArgs, true);
                YAHOO.portico.updateinlineTableHelper('datatable-container_0', 
strURL);
        }




reply via email to

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