fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7172] property: more on request


From: Sigurd Nes
Subject: [Fmsystem-commits] [7172] property: more on request
Date: Mon, 04 Apr 2011 12:03:31 +0000

Revision: 7172
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7172
Author:   sigurdne
Date:     2011-04-04 12:03:28 +0000 (Mon, 04 Apr 2011)
Log Message:
-----------
property: more on request

Modified Paths:
--------------
    trunk/property/inc/class.borequest.inc.php
    trunk/property/inc/class.sorequest.inc.php
    trunk/property/setup/phpgw_no.lang
    trunk/property/setup/tables_current.inc.php
    trunk/property/templates/base/request.xsl

Modified: trunk/property/inc/class.borequest.inc.php
===================================================================
--- trunk/property/inc/class.borequest.inc.php  2011-04-04 09:40:21 UTC (rev 
7171)
+++ trunk/property/inc/class.borequest.inc.php  2011-04-04 12:03:28 UTC (rev 
7172)
@@ -198,18 +198,15 @@
                                
$selected=$GLOBALS['phpgw_info']['user']['preferences']['property'][$degreedefault_type];
                        }
 
-                       $degree_comment[0]=' - '.lang('None');
-                       $degree_comment[1]=' - '.lang('Minor');
-                       $degree_comment[2]=' - '.lang('Medium');
-                       $degree_comment[3]=' - '.lang('Serious');
+                       $degree_comment[0]=' - '.lang('no symptoms');
+                       $degree_comment[1]=' - '.lang('minor symptoms');
+                       $degree_comment[2]=' - '.lang('medium symptoms');
+                       $degree_comment[3]=' - '.lang('serious symptoms');
                        for ($i=0; $i<=3; $i++)
                        {
                                $degree_list[$i]['id'] = $i;
                                $degree_list[$i]['name'] = $i . 
$degree_comment[$i];
-                               if ($i==$selected)
-                               {
-                                       $degree_list[$i]['selected']= 
'selected';
-                               }
+                               $degree_list[$i]['selected'] = $i==$selected ? 
1 : 0;
                        }
 
                        return $degree_list;
@@ -219,17 +216,14 @@
                {
                        $selected=$probability_value;
 
-                       $probability_comment[1]=' - '.lang('Small');
-                       $probability_comment[2]=' - '.lang('Medium');
-                       $probability_comment[3]=' - '.lang('Large');
+                       $probability_comment[1]=' - '.lang('low probability');
+                       $probability_comment[2]=' - '.lang('medium 
probability');
+                       $probability_comment[3]=' - '.lang('high probability');
                        for ($i=1; $i<=3; $i++)
                        {
                                $probability_list[$i]['id'] = $i;
                                $probability_list[$i]['name'] = $i . 
$probability_comment[$i];
-                               if ($i==$selected)
-                               {
-                                       $probability_list[$i]['selected']= 
'selected';
-                               }
+                               $probability_list[$i]['selected'] = 
$i==$selected ? 1 : 0;
                        }
 
                        return $probability_list;
@@ -237,7 +231,7 @@
 
                function select_conditions($request_id='')
                {
-                       $conditions = array();
+                       $values = array();
                        $condition_type_list = 
$this->so->select_condition_type_list();
 
                        if($request_id)
@@ -247,14 +241,17 @@
 
                        for ($i=0;$i<count($condition_type_list);$i++)
                        {
-                               $conditions[$i]['degree']                       
        = array('options' => 
$this->select_degree_list($conditions[$i]['degree']));
-                               $conditions[$i]['probability']                  
= array('options' => 
$this->select_probability_list($conditions[$i]['probability']));
-                               $conditions[$i]['consequence']                  
= array('options' => 
$this->select_consequence_list($conditions[$i]['consequence']));
-                               $conditions[$i]['condition_type']               
= $condition_type_list[$i]['id'];
-                               $conditions[$i]['condition_type_name']  = 
$condition_type_list[$i]['name'];
+                               $values[$i]['degree']                           
= array('options' => $this->select_degree_list($conditions[$i]['degree']));
+                               $values[$i]['probability']                      
= array('options' => 
$this->select_probability_list($conditions[$i]['probability']));
+                               $values[$i]['consequence']                      
= array('options' => 
$this->select_consequence_list($conditions[$i]['consequence']));
+                               $values[$i]['condition_type']           = 
$condition_type_list[$i]['id'];
+                               $values[$i]['condition_type_name']      = 
$condition_type_list[$i]['name'];
+                               $values[$i]['weight']                           
= $condition_type_list[$i]['weight'];
+                               $values[$i]['risk']                             
        = (int)$condition_type_list[$i]['weight'] * 
(int)$conditions[$i]['probability'] * (int)$conditions[$i]['consequence'];
+                               $values[$i]['score']                            
= $values[$i]['risk'] * (int)$conditions[$i]['degree'];
                        }
 
-                       return $conditions;
+                       return $values;
                }
 
                function 
select_consequence_list($consequence_value='',$consequencedefault_type='')
@@ -276,10 +273,7 @@
                        {
                                $consequence_list[$i][id] = $i;
                                $consequence_list[$i]['name'] = $i . 
$consequence_comment[$i];
-                               if ($i==$selected)
-                               {
-                                       $consequence_list[$i]['selected']= 
'selected';
-                               }
+                               $consequence_list[$i]['selected'] = 
$i==$selected ? 1 : 0;
                        }
 
                        return $consequence_list;

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2011-04-04 09:40:21 UTC (rev 
7171)
+++ trunk/property/inc/class.sorequest.inc.php  2011-04-04 12:03:28 UTC (rev 
7172)
@@ -87,6 +87,7 @@
                        }
                        else
                        {
+                               $request = array();
                                $this->db->query("SELECT id FROM 
fm_request",__LINE__,__FILE__);
 
                                while ($this->db->next_record())
@@ -95,19 +96,18 @@
                                }
                        }
 
-                       while (is_array($request) && list(,$id) = 
each($request))
+                       foreach ($request as $id)
                        {
-
                                
if($GLOBALS['phpgw_info']['server']['db_type']=='pgsql' || 
$GLOBALS['phpgw_info']['server']['db_type']=='postgres')
                                {
-                                       $sql = "UPDATE fm_request SET score = 
(SELECT sum(priority_key * ( degree * probability * ( consequence +1 )))  FROM 
fm_request_condition"
+                                       $sql = "UPDATE fm_request SET score = 
(SELECT sum(priority_key * ( degree * probability * ( consequence )))  FROM 
fm_request_condition"
                                                . " $this->join  
fm_request_condition_type ON (fm_request_condition.condition_type = 
fm_request_condition_type.id) WHERE request_id = $id) WHERE fm_request.id = 
$id";
 
                                        
$this->db->query($sql,__LINE__,__FILE__);
                                }
                                else
                                {
-                                       $sql = "SELECT sum(priority_key * ( 
degree * probability * ( consequence +1 ))) AS score FROM fm_request_condition"
+                                       $sql = "SELECT sum(priority_key * ( 
degree * probability * ( consequence ))) AS score FROM fm_request_condition"
                                                . " $this->join  
fm_request_condition_type ON (fm_request_condition.condition_type = 
fm_request_condition_type.id) WHERE request_id = $id";
 
                                        
$this->db->query($sql,__LINE__,__FILE__);
@@ -139,26 +139,30 @@
 
                function select_condition_type_list()
                {
-                       $this->db->query("SELECT id, descr FROM 
fm_request_condition_type ORDER BY id ");
+                       $this->db->query("SELECT id, descr, priority_key FROM 
fm_request_condition_type ORDER BY id ");
 
-                       $i = 0;
+                       $values = array();
                        while ($this->db->next_record())
                        {
-                               $condition_type_list[$i]['id']          = 
$this->db->f('id');
-                               $condition_type_list[$i]['name']        = 
stripslashes($this->db->f('descr'));
-                               $i++;
+                               $values[] = array
+                               (
+                                       'id'            => $this->db->f('id'),
+                                       'name'          => 
$this->db->f('descr',true),
+                                       'weight'        => 
$this->db->f('priority_key'),                                        
+                               );
                        }
-                       return $condition_type_list;
+                       return $values;
                }
 
                function 
select_conditions($request_id='',$condition_type_list='')
                {
+                       $conditions = array();
                        for ($i=0;$i<count($condition_type_list);$i++)
                        {
-                               $this->db->query("SELECT 
degree,probability,consequence FROM fm_request_condition WHERE 
request_id=$request_id AND condition_type =" . $condition_type_list[$i]['id']);
+                               $this->db->query("SELECT 
degree,probability,consequence FROM fm_request_condition WHERE 
request_id=$request_id AND condition_type =" . 
(int)$condition_type_list[$i]['id']);
                                $this->db->next_record();
                                $conditions[$i]['request_id']           = 
$request_id;
-                               $conditions[$i]['degree']               = 
$this->db->f('degree');
+                               $conditions[$i]['degree']                       
= $this->db->f('degree');
                                $conditions[$i]['probability']          = 
$this->db->f('probability');
                                $conditions[$i]['consequence']          = 
$this->db->f('consequence');
                        }

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2011-04-04 09:40:21 UTC (rev 7171)
+++ trunk/property/setup/phpgw_no.lang  2011-04-04 12:03:28 UTC (rev 7172)
@@ -1862,3 +1862,12 @@
 in progress date       property        no      Påbegynt dato
 delivered date property        no      Utført dato
 closed date    property        no      Avsluttet dato
+no symptoms    property        no      Ingen Symptomer
+minor symptoms property        no      Svake Symptomer
+medium symptoms        property        no      Middels Symptomer
+serious symptoms       property        no      Kraftige Symptomer
+low probability        property        no      Liten sannsynlighet
+medium probability     property        no      Middels sannsynlighet
+high probability       property        no      Stor sannsynlighet
+weight property        no      Vekt
+risk   property        no      Risiko

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2011-04-04 09:40:21 UTC (rev 
7171)
+++ trunk/property/setup/tables_current.inc.php 2011-04-04 12:03:28 UTC (rev 
7172)
@@ -1262,7 +1262,7 @@
                        'fd' => array(
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
                                'descr' => array('type' => 
'varchar','precision' => '50','nullable' => False),
-                               'priority_key' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True)
+                               'priority_key' => array('type' => 
'int','precision' => '4','default' => '1','nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/property/templates/base/request.xsl
===================================================================
--- trunk/property/templates/base/request.xsl   2011-04-04 09:40:21 UTC (rev 
7171)
+++ trunk/property/templates/base/request.xsl   2011-04-04 12:03:28 UTC (rev 
7172)
@@ -480,10 +480,13 @@
                                        <div id="condition">
                                                <table>
                                                        <tr>
-                                                               <td>
-                                                                       <table 
width="100%" cellpadding="2" cellspacing="2" align="center">
+                                                               <td colspan='2'>
+                                                                       <table 
border="1" width="100%" cellpadding="2" cellspacing="2" align="center">
                                                                                
<xsl:apply-templates select="table_header_importance"/>
                                                                                
<xsl:apply-templates select="condition_list"/>
+                                                                       </table>
+                                                               </td>
+                                                       </tr>
                                                                                
<tr>
                                                                                
        <td>
                                                                                
                <br/>
@@ -573,9 +576,6 @@
                                                                                
                <xsl:value-of select="value_score"/>
                                                                                
        </td>
                                                                                
</tr>
-                                                                       </table>
-                                                               </td>
-                                                       </tr>
                                                </table>
                                        </div>
 
@@ -730,6 +730,15 @@
                                        <xsl:apply-templates 
select="consequence/options"/>
                                </select>
                        </td>
+                       <td class="small_text" align="right">
+                               <xsl:value-of select="weight"/>
+                       </td>
+                       <td class="small_text" align="right">
+                               <xsl:value-of select="risk"/>
+                       </td>
+                       <td class="small_text" align="right">
+                               <xsl:value-of select="score"/>
+                       </td>
                </tr>
        </xsl:template>
 
@@ -825,18 +834,28 @@
                </tr>
        </xsl:template>
 
-       <xsl:template match="table_header_importance">
-               <tr class="th">
-                       <td class="th_text" width="10%" align="left">
-                       </td>
-                       <td class="th_text" width="10%" align="left">
+       <xsl:template match="table_header_importance" 
xmlns:php="http://php.net/xsl";>
+               <tr>
+                       <th width="20%" align="left">
+                               <xsl:value-of select="php:function('lang', 
'request condition_type')" />
+                       </th>
+                       <th width="20%" align="center">
                                <xsl:value-of select="lang_condition_degree"/>
-                       </td>
-                       <td class="th_text" width="10%" align="left">
+                       </th>
+                       <th width="20%" align="center">
                                <xsl:value-of select="lang_prob_worsening"/>
-                       </td>
-                       <td class="th_text" width="10%" align="left">
+                       </th>
+                       <th width="20%" align="center">
                                <xsl:value-of select="lang_consequence"/>
-                       </td>
+                       </th>
+                       <th width="5%" align="center">
+                               <xsl:value-of select="php:function('lang', 
'weight')" />
+                       </th>
+                       <th width="5%" align="center">
+                               <xsl:value-of select="php:function('lang', 
'risk')" />
+                       </th>
+                       <th width="5%" align="center">
+                               <xsl:value-of select="php:function('lang', 
'score')" />
+                       </th>
                </tr>
        </xsl:template>




reply via email to

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